@nextcloud/files 3.0.0-beta.8 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs ADDED
@@ -0,0 +1,2195 @@
1
+ import { getCurrentUser as A, onRequestTokenUpdate as ue, getRequestToken as de } from "@nextcloud/auth";
2
+ import { getLoggerBuilder as q } from "@nextcloud/logger";
3
+ import { getCanonicalLocale as ae } from "@nextcloud/l10n";
4
+ import { join as le, basename as fe, extname as ce, dirname as I } from "path";
5
+ import { encodePath as he } from "@nextcloud/paths";
6
+ import { generateRemoteUrl as pe } from "@nextcloud/router";
7
+ import { createClient as ge, getPatcher as we } from "webdav";
8
+ /**
9
+ * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
10
+ *
11
+ * @author Christoph Wurst <christoph@winzerhof-wurst.at>
12
+ *
13
+ * @license AGPL-3.0-or-later
14
+ *
15
+ * This program is free software: you can redistribute it and/or modify
16
+ * it under the terms of the GNU Affero General Public License as
17
+ * published by the Free Software Foundation, either version 3 of the
18
+ * License, or (at your option) any later version.
19
+ *
20
+ * This program is distributed in the hope that it will be useful,
21
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ * GNU Affero General Public License for more details.
24
+ *
25
+ * You should have received a copy of the GNU Affero General Public License
26
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
27
+ *
28
+ */
29
+ const me = (e) => e === null ? q().setApp("files").build() : q().setApp("files").setUid(e.uid).build(), m = me(A());
30
+ /**
31
+ * @copyright Copyright (c) 2021 John Molakvoæ <skjnldsv@protonmail.com>
32
+ *
33
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
34
+ *
35
+ * @license AGPL-3.0-or-later
36
+ *
37
+ * This program is free software: you can redistribute it and/or modify
38
+ * it under the terms of the GNU Affero General Public License as
39
+ * published by the Free Software Foundation, either version 3 of the
40
+ * License, or (at your option) any later version.
41
+ *
42
+ * This program is distributed in the hope that it will be useful,
43
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
44
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45
+ * GNU Affero General Public License for more details.
46
+ *
47
+ * You should have received a copy of the GNU Affero General Public License
48
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
49
+ *
50
+ */
51
+ class Ne {
52
+ _entries = [];
53
+ registerEntry(t) {
54
+ this.validateEntry(t), this._entries.push(t);
55
+ }
56
+ unregisterEntry(t) {
57
+ const r = typeof t == "string" ? this.getEntryIndex(t) : this.getEntryIndex(t.id);
58
+ if (r === -1) {
59
+ m.warn("Entry not found, nothing removed", { entry: t, entries: this.getEntries() });
60
+ return;
61
+ }
62
+ this._entries.splice(r, 1);
63
+ }
64
+ /**
65
+ * Get the list of registered entries
66
+ *
67
+ * @param {Folder} context the creation context. Usually the current folder
68
+ */
69
+ getEntries(t) {
70
+ return t ? this._entries.filter((r) => typeof r.enabled == "function" ? r.enabled(t) : !0) : this._entries;
71
+ }
72
+ getEntryIndex(t) {
73
+ return this._entries.findIndex((r) => r.id === t);
74
+ }
75
+ validateEntry(t) {
76
+ if (!t.id || !t.displayName || !(t.iconSvgInline || t.iconClass) || !t.handler)
77
+ throw new Error("Invalid entry");
78
+ if (typeof t.id != "string" || typeof t.displayName != "string")
79
+ throw new Error("Invalid id or displayName property");
80
+ if (t.iconClass && typeof t.iconClass != "string" || t.iconSvgInline && typeof t.iconSvgInline != "string")
81
+ throw new Error("Invalid icon provided");
82
+ if (t.enabled !== void 0 && typeof t.enabled != "function")
83
+ throw new Error("Invalid enabled property");
84
+ if (typeof t.handler != "function")
85
+ throw new Error("Invalid handler property");
86
+ if ("order" in t && typeof t.order != "number")
87
+ throw new Error("Invalid order property");
88
+ if (this.getEntryIndex(t.id) !== -1)
89
+ throw new Error("Duplicate entry");
90
+ }
91
+ }
92
+ const F = function() {
93
+ return typeof window._nc_newfilemenu > "u" && (window._nc_newfilemenu = new Ne(), m.debug("NewFileMenu initialized")), window._nc_newfilemenu;
94
+ };
95
+ /**
96
+ * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
97
+ *
98
+ * @author Christoph Wurst <christoph@winzerhof-wurst.at>
99
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
100
+ *
101
+ * @license AGPL-3.0-or-later
102
+ *
103
+ * This program is free software: you can redistribute it and/or modify
104
+ * it under the terms of the GNU Affero General Public License as
105
+ * published by the Free Software Foundation, either version 3 of the
106
+ * License, or (at your option) any later version.
107
+ *
108
+ * This program is distributed in the hope that it will be useful,
109
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
110
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
111
+ * GNU Affero General Public License for more details.
112
+ *
113
+ * You should have received a copy of the GNU Affero General Public License
114
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
115
+ *
116
+ */
117
+ const C = ["B", "KB", "MB", "GB", "TB", "PB"], P = ["B", "KiB", "MiB", "GiB", "TiB", "PiB"];
118
+ function Yt(e, t = !1, r = !1, s = !1) {
119
+ r = r && !s, typeof e == "string" && (e = Number(e));
120
+ let n = e > 0 ? Math.floor(Math.log(e) / Math.log(s ? 1e3 : 1024)) : 0;
121
+ n = Math.min((r ? P.length : C.length) - 1, n);
122
+ const i = r ? P[n] : C[n];
123
+ let d = (e / Math.pow(s ? 1e3 : 1024, n)).toFixed(1);
124
+ return t === !0 && n === 0 ? (d !== "0.0" ? "< 1 " : "0 ") + (r ? P[1] : C[1]) : (n < 2 ? d = parseFloat(d).toFixed(0) : d = parseFloat(d).toLocaleString(ae()), d + " " + i);
125
+ }
126
+ function Jt(e, t = !1) {
127
+ try {
128
+ e = `${e}`.toLocaleLowerCase().replaceAll(/\s+/g, "").replaceAll(",", ".");
129
+ } catch {
130
+ return null;
131
+ }
132
+ const r = e.match(/^([0-9]*(\.[0-9]*)?)([kmgtp]?)(i?)b?$/);
133
+ if (r === null || r[1] === "." || r[1] === "")
134
+ return null;
135
+ const s = {
136
+ "": 0,
137
+ k: 1,
138
+ m: 2,
139
+ g: 3,
140
+ t: 4,
141
+ p: 5,
142
+ e: 6
143
+ }, n = `${r[1]}`, i = r[4] === "i" || t ? 1024 : 1e3;
144
+ return Math.round(Number.parseFloat(n) * i ** s[r[3]]);
145
+ }
146
+ /**
147
+ * @copyright Copyright (c) 2023 John Molakvoæ <skjnldsv@protonmail.com>
148
+ *
149
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
150
+ *
151
+ * @license AGPL-3.0-or-later
152
+ *
153
+ * This program is free software: you can redistribute it and/or modify
154
+ * it under the terms of the GNU Affero General Public License as
155
+ * published by the Free Software Foundation, either version 3 of the
156
+ * License, or (at your option) any later version.
157
+ *
158
+ * This program is distributed in the hope that it will be useful,
159
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
160
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
161
+ * GNU Affero General Public License for more details.
162
+ *
163
+ * You should have received a copy of the GNU Affero General Public License
164
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
165
+ *
166
+ */
167
+ var Z = /* @__PURE__ */ ((e) => (e.DEFAULT = "default", e.HIDDEN = "hidden", e))(Z || {});
168
+ class Qt {
169
+ _action;
170
+ constructor(t) {
171
+ this.validateAction(t), this._action = t;
172
+ }
173
+ get id() {
174
+ return this._action.id;
175
+ }
176
+ get displayName() {
177
+ return this._action.displayName;
178
+ }
179
+ get title() {
180
+ return this._action.title;
181
+ }
182
+ get iconSvgInline() {
183
+ return this._action.iconSvgInline;
184
+ }
185
+ get enabled() {
186
+ return this._action.enabled;
187
+ }
188
+ get exec() {
189
+ return this._action.exec;
190
+ }
191
+ get execBatch() {
192
+ return this._action.execBatch;
193
+ }
194
+ get order() {
195
+ return this._action.order;
196
+ }
197
+ get parent() {
198
+ return this._action.parent;
199
+ }
200
+ get default() {
201
+ return this._action.default;
202
+ }
203
+ get inline() {
204
+ return this._action.inline;
205
+ }
206
+ get renderInline() {
207
+ return this._action.renderInline;
208
+ }
209
+ validateAction(t) {
210
+ if (!t.id || typeof t.id != "string")
211
+ throw new Error("Invalid id");
212
+ if (!t.displayName || typeof t.displayName != "function")
213
+ throw new Error("Invalid displayName function");
214
+ if ("title" in t && typeof t.title != "function")
215
+ throw new Error("Invalid title function");
216
+ if (!t.iconSvgInline || typeof t.iconSvgInline != "function")
217
+ throw new Error("Invalid iconSvgInline function");
218
+ if (!t.exec || typeof t.exec != "function")
219
+ throw new Error("Invalid exec function");
220
+ if ("enabled" in t && typeof t.enabled != "function")
221
+ throw new Error("Invalid enabled function");
222
+ if ("execBatch" in t && typeof t.execBatch != "function")
223
+ throw new Error("Invalid execBatch function");
224
+ if ("order" in t && typeof t.order != "number")
225
+ throw new Error("Invalid order");
226
+ if ("parent" in t && typeof t.parent != "string")
227
+ throw new Error("Invalid parent");
228
+ if (t.default && !Object.values(Z).includes(t.default))
229
+ throw new Error("Invalid default");
230
+ if ("inline" in t && typeof t.inline != "function")
231
+ throw new Error("Invalid inline function");
232
+ if ("renderInline" in t && typeof t.renderInline != "function")
233
+ throw new Error("Invalid renderInline function");
234
+ }
235
+ }
236
+ const Dt = function(e) {
237
+ if (typeof window._nc_fileactions > "u" && (window._nc_fileactions = [], m.debug("FileActions initialized")), window._nc_fileactions.find((t) => t.id === e.id)) {
238
+ m.error(`FileAction ${e.id} already registered`, { action: e });
239
+ return;
240
+ }
241
+ window._nc_fileactions.push(e);
242
+ }, er = function() {
243
+ return typeof window._nc_fileactions > "u" && (window._nc_fileactions = [], m.debug("FileActions initialized")), window._nc_fileactions;
244
+ };
245
+ /**
246
+ * @copyright Copyright (c) 2023 John Molakvoæ <skjnldsv@protonmail.com>
247
+ *
248
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
249
+ *
250
+ * @license AGPL-3.0-or-later
251
+ *
252
+ * This program is free software: you can redistribute it and/or modify
253
+ * it under the terms of the GNU Affero General Public License as
254
+ * published by the Free Software Foundation, either version 3 of the
255
+ * License, or (at your option) any later version.
256
+ *
257
+ * This program is distributed in the hope that it will be useful,
258
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
259
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
260
+ * GNU Affero General Public License for more details.
261
+ *
262
+ * You should have received a copy of the GNU Affero General Public License
263
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
264
+ *
265
+ */
266
+ class tr {
267
+ _header;
268
+ constructor(t) {
269
+ this.validateHeader(t), this._header = t;
270
+ }
271
+ get id() {
272
+ return this._header.id;
273
+ }
274
+ get order() {
275
+ return this._header.order;
276
+ }
277
+ get enabled() {
278
+ return this._header.enabled;
279
+ }
280
+ get render() {
281
+ return this._header.render;
282
+ }
283
+ get updated() {
284
+ return this._header.updated;
285
+ }
286
+ validateHeader(t) {
287
+ if (!t.id || !t.render || !t.updated)
288
+ throw new Error("Invalid header: id, render and updated are required");
289
+ if (typeof t.id != "string")
290
+ throw new Error("Invalid id property");
291
+ if (t.enabled !== void 0 && typeof t.enabled != "function")
292
+ throw new Error("Invalid enabled property");
293
+ if (t.render && typeof t.render != "function")
294
+ throw new Error("Invalid render property");
295
+ if (t.updated && typeof t.updated != "function")
296
+ throw new Error("Invalid updated property");
297
+ }
298
+ }
299
+ const rr = function(e) {
300
+ if (typeof window._nc_filelistheader > "u" && (window._nc_filelistheader = [], m.debug("FileListHeaders initialized")), window._nc_filelistheader.find((t) => t.id === e.id)) {
301
+ m.error(`Header ${e.id} already registered`, { header: e });
302
+ return;
303
+ }
304
+ window._nc_filelistheader.push(e);
305
+ }, nr = function() {
306
+ return typeof window._nc_filelistheader > "u" && (window._nc_filelistheader = [], m.debug("FileListHeaders initialized")), window._nc_filelistheader;
307
+ };
308
+ /**
309
+ * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
310
+ *
311
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
312
+ *
313
+ * @license AGPL-3.0-or-later
314
+ *
315
+ * This program is free software: you can redistribute it and/or modify
316
+ * it under the terms of the GNU Affero General Public License as
317
+ * published by the Free Software Foundation, either version 3 of the
318
+ * License, or (at your option) any later version.
319
+ *
320
+ * This program is distributed in the hope that it will be useful,
321
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
322
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
323
+ * GNU Affero General Public License for more details.
324
+ *
325
+ * You should have received a copy of the GNU Affero General Public License
326
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
327
+ *
328
+ */
329
+ var N = /* @__PURE__ */ ((e) => (e[e.NONE = 0] = "NONE", e[e.CREATE = 4] = "CREATE", e[e.READ = 1] = "READ", e[e.UPDATE = 2] = "UPDATE", e[e.DELETE = 8] = "DELETE", e[e.SHARE = 16] = "SHARE", e[e.ALL = 31] = "ALL", e))(N || {});
330
+ /**
331
+ * @copyright Copyright (c) 2023 John Molakvoæ <skjnldsv@protonmail.com>
332
+ *
333
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
334
+ * @author Ferdinand Thiessen <opensource@fthiessen.de>
335
+ *
336
+ * @license AGPL-3.0-or-later
337
+ *
338
+ * This program is free software: you can redistribute it and/or modify
339
+ * it under the terms of the GNU Affero General Public License as
340
+ * published by the Free Software Foundation, either version 3 of the
341
+ * License, or (at your option) any later version.
342
+ *
343
+ * This program is distributed in the hope that it will be useful,
344
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
345
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
346
+ * GNU Affero General Public License for more details.
347
+ *
348
+ * You should have received a copy of the GNU Affero General Public License
349
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
350
+ *
351
+ */
352
+ const j = [
353
+ "d:getcontentlength",
354
+ "d:getcontenttype",
355
+ "d:getetag",
356
+ "d:getlastmodified",
357
+ "d:quota-available-bytes",
358
+ "d:resourcetype",
359
+ "nc:has-preview",
360
+ "nc:is-encrypted",
361
+ "nc:mount-type",
362
+ "nc:share-attributes",
363
+ "oc:comments-unread",
364
+ "oc:favorite",
365
+ "oc:fileid",
366
+ "oc:owner-display-name",
367
+ "oc:owner-id",
368
+ "oc:permissions",
369
+ "oc:share-types",
370
+ "oc:size",
371
+ "ocs:share-permissions"
372
+ ], Y = {
373
+ d: "DAV:",
374
+ nc: "http://nextcloud.org/ns",
375
+ oc: "http://owncloud.org/ns",
376
+ ocs: "http://open-collaboration-services.org/ns"
377
+ }, ir = function(e, t = { nc: "http://nextcloud.org/ns" }) {
378
+ typeof window._nc_dav_properties > "u" && (window._nc_dav_properties = [...j], window._nc_dav_namespaces = { ...Y });
379
+ const r = { ...window._nc_dav_namespaces, ...t };
380
+ if (window._nc_dav_properties.find((n) => n === e))
381
+ return m.error(`${e} already registered`, { prop: e }), !1;
382
+ if (e.startsWith("<") || e.split(":").length !== 2)
383
+ return m.error(`${e} is not valid. See example: 'oc:fileid'`, { prop: e }), !1;
384
+ const s = e.split(":")[0];
385
+ return r[s] ? (window._nc_dav_properties.push(e), window._nc_dav_namespaces = r, !0) : (m.error(`${e} namespace unknown`, { prop: e, namespaces: r }), !1);
386
+ }, V = function() {
387
+ return typeof window._nc_dav_properties > "u" && (window._nc_dav_properties = [...j]), window._nc_dav_properties.map((e) => `<${e} />`).join(" ");
388
+ }, L = function() {
389
+ return typeof window._nc_dav_namespaces > "u" && (window._nc_dav_namespaces = { ...Y }), Object.keys(window._nc_dav_namespaces).map((e) => `xmlns:${e}="${window._nc_dav_namespaces?.[e]}"`).join(" ");
390
+ }, sr = function() {
391
+ return `<?xml version="1.0"?>
392
+ <d:propfind ${L()}>
393
+ <d:prop>
394
+ ${V()}
395
+ </d:prop>
396
+ </d:propfind>`;
397
+ }, Ee = function() {
398
+ return `<?xml version="1.0"?>
399
+ <oc:filter-files ${L()}>
400
+ <d:prop>
401
+ ${V()}
402
+ </d:prop>
403
+ <oc:filter-rules>
404
+ <oc:favorite>1</oc:favorite>
405
+ </oc:filter-rules>
406
+ </oc:filter-files>`;
407
+ }, or = function(e) {
408
+ return `<?xml version="1.0" encoding="UTF-8"?>
409
+ <d:searchrequest ${L()}
410
+ xmlns:ns="https://github.com/icewind1991/SearchDAV/ns">
411
+ <d:basicsearch>
412
+ <d:select>
413
+ <d:prop>
414
+ ${V()}
415
+ </d:prop>
416
+ </d:select>
417
+ <d:from>
418
+ <d:scope>
419
+ <d:href>/files/${A()?.uid}/</d:href>
420
+ <d:depth>infinity</d:depth>
421
+ </d:scope>
422
+ </d:from>
423
+ <d:where>
424
+ <d:and>
425
+ <d:or>
426
+ <d:not>
427
+ <d:eq>
428
+ <d:prop>
429
+ <d:getcontenttype/>
430
+ </d:prop>
431
+ <d:literal>httpd/unix-directory</d:literal>
432
+ </d:eq>
433
+ </d:not>
434
+ <d:eq>
435
+ <d:prop>
436
+ <oc:size/>
437
+ </d:prop>
438
+ <d:literal>0</d:literal>
439
+ </d:eq>
440
+ </d:or>
441
+ <d:gt>
442
+ <d:prop>
443
+ <d:getlastmodified/>
444
+ </d:prop>
445
+ <d:literal>${e}</d:literal>
446
+ </d:gt>
447
+ </d:and>
448
+ </d:where>
449
+ <d:orderby>
450
+ <d:order>
451
+ <d:prop>
452
+ <d:getlastmodified/>
453
+ </d:prop>
454
+ <d:descending/>
455
+ </d:order>
456
+ </d:orderby>
457
+ <d:limit>
458
+ <d:nresults>100</d:nresults>
459
+ <ns:firstresult>0</ns:firstresult>
460
+ </d:limit>
461
+ </d:basicsearch>
462
+ </d:searchrequest>`;
463
+ };
464
+ /**
465
+ * @copyright Copyright (c) 2023 John Molakvoæ <skjnldsv@protonmail.com>
466
+ *
467
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
468
+ * @author Ferdinand Thiessen <opensource@fthiessen.de>
469
+ *
470
+ * @license AGPL-3.0-or-later
471
+ *
472
+ * This program is free software: you can redistribute it and/or modify
473
+ * it under the terms of the GNU Affero General Public License as
474
+ * published by the Free Software Foundation, either version 3 of the
475
+ * License, or (at your option) any later version.
476
+ *
477
+ * This program is distributed in the hope that it will be useful,
478
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
479
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
480
+ * GNU Affero General Public License for more details.
481
+ *
482
+ * You should have received a copy of the GNU Affero General Public License
483
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
484
+ *
485
+ */
486
+ const be = function(e = "") {
487
+ let t = N.NONE;
488
+ return e && ((e.includes("C") || e.includes("K")) && (t |= N.CREATE), e.includes("G") && (t |= N.READ), (e.includes("W") || e.includes("N") || e.includes("V")) && (t |= N.UPDATE), e.includes("D") && (t |= N.DELETE), e.includes("R") && (t |= N.SHARE)), t;
489
+ };
490
+ /**
491
+ * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
492
+ *
493
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
494
+ *
495
+ * @license AGPL-3.0-or-later
496
+ *
497
+ * This program is free software: you can redistribute it and/or modify
498
+ * it under the terms of the GNU Affero General Public License as
499
+ * published by the Free Software Foundation, either version 3 of the
500
+ * License, or (at your option) any later version.
501
+ *
502
+ * This program is distributed in the hope that it will be useful,
503
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
504
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
505
+ * GNU Affero General Public License for more details.
506
+ *
507
+ * You should have received a copy of the GNU Affero General Public License
508
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
509
+ *
510
+ */
511
+ var R = /* @__PURE__ */ ((e) => (e.Folder = "folder", e.File = "file", e))(R || {});
512
+ /**
513
+ * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
514
+ *
515
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
516
+ *
517
+ * @license AGPL-3.0-or-later
518
+ *
519
+ * This program is free software: you can redistribute it and/or modify
520
+ * it under the terms of the GNU Affero General Public License as
521
+ * published by the Free Software Foundation, either version 3 of the
522
+ * License, or (at your option) any later version.
523
+ *
524
+ * This program is distributed in the hope that it will be useful,
525
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
526
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
527
+ * GNU Affero General Public License for more details.
528
+ *
529
+ * You should have received a copy of the GNU Affero General Public License
530
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
531
+ *
532
+ */
533
+ const J = function(e, t) {
534
+ return e.match(t) !== null;
535
+ }, X = (e, t) => {
536
+ if (e.id && typeof e.id != "number")
537
+ throw new Error("Invalid id type of value");
538
+ if (!e.source)
539
+ throw new Error("Missing mandatory source");
540
+ try {
541
+ new URL(e.source);
542
+ } catch {
543
+ throw new Error("Invalid source format, source must be a valid URL");
544
+ }
545
+ if (!e.source.startsWith("http"))
546
+ throw new Error("Invalid source format, only http(s) is supported");
547
+ if (e.mtime && !(e.mtime instanceof Date))
548
+ throw new Error("Invalid mtime type");
549
+ if (e.crtime && !(e.crtime instanceof Date))
550
+ throw new Error("Invalid crtime type");
551
+ if (!e.mime || typeof e.mime != "string" || !e.mime.match(/^[-\w.]+\/[-+\w.]+$/gi))
552
+ throw new Error("Missing or invalid mandatory mime");
553
+ if ("size" in e && typeof e.size != "number" && e.size !== void 0)
554
+ throw new Error("Invalid size type");
555
+ if ("permissions" in e && e.permissions !== void 0 && !(typeof e.permissions == "number" && e.permissions >= N.NONE && e.permissions <= N.ALL))
556
+ throw new Error("Invalid permissions");
557
+ if (e.owner && e.owner !== null && typeof e.owner != "string")
558
+ throw new Error("Invalid owner type");
559
+ if (e.attributes && typeof e.attributes != "object")
560
+ throw new Error("Invalid attributes type");
561
+ if (e.root && typeof e.root != "string")
562
+ throw new Error("Invalid root type");
563
+ if (e.root && !e.root.startsWith("/"))
564
+ throw new Error("Root must start with a leading slash");
565
+ if (e.root && !e.source.includes(e.root))
566
+ throw new Error("Root must be part of the source");
567
+ if (e.root && J(e.source, t)) {
568
+ const r = e.source.match(t)[0];
569
+ if (!e.source.includes(le(r, e.root)))
570
+ throw new Error("The root must be relative to the service. e.g /files/emma");
571
+ }
572
+ if (e.status && !Object.values(Q).includes(e.status))
573
+ throw new Error("Status must be a valid NodeStatus");
574
+ };
575
+ /**
576
+ * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
577
+ *
578
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
579
+ *
580
+ * @license AGPL-3.0-or-later
581
+ *
582
+ * This program is free software: you can redistribute it and/or modify
583
+ * it under the terms of the GNU Affero General Public License as
584
+ * published by the Free Software Foundation, either version 3 of the
585
+ * License, or (at your option) any later version.
586
+ *
587
+ * This program is distributed in the hope that it will be useful,
588
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
589
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
590
+ * GNU Affero General Public License for more details.
591
+ *
592
+ * You should have received a copy of the GNU Affero General Public License
593
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
594
+ *
595
+ */
596
+ var Q = /* @__PURE__ */ ((e) => (e.NEW = "new", e.FAILED = "failed", e.LOADING = "loading", e.LOCKED = "locked", e))(Q || {});
597
+ class D {
598
+ _data;
599
+ _attributes;
600
+ _knownDavService = /(remote|public)\.php\/(web)?dav/i;
601
+ constructor(t, r) {
602
+ X(t, r || this._knownDavService), this._data = t;
603
+ const s = {
604
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
605
+ set: (n, i, d) => (this.updateMtime(), Reflect.set(n, i, d)),
606
+ deleteProperty: (n, i) => (this.updateMtime(), Reflect.deleteProperty(n, i))
607
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
608
+ };
609
+ this._attributes = new Proxy(t.attributes || {}, s), delete this._data.attributes, r && (this._knownDavService = r);
610
+ }
611
+ /**
612
+ * Get the source url to this object
613
+ */
614
+ get source() {
615
+ return this._data.source.replace(/\/$/i, "");
616
+ }
617
+ /**
618
+ * Get the encoded source url to this object for requests purposes
619
+ */
620
+ get encodedSource() {
621
+ const { origin: t } = new URL(this.source);
622
+ return t + he(this.source.slice(t.length));
623
+ }
624
+ /**
625
+ * Get this object name
626
+ */
627
+ get basename() {
628
+ return fe(this.source);
629
+ }
630
+ /**
631
+ * Get this object's extension
632
+ */
633
+ get extension() {
634
+ return ce(this.source);
635
+ }
636
+ /**
637
+ * Get the directory path leading to this object
638
+ * Will use the relative path to root if available
639
+ */
640
+ get dirname() {
641
+ if (this.root) {
642
+ const r = this.source.indexOf(this.root);
643
+ return I(this.source.slice(r + this.root.length) || "/");
644
+ }
645
+ const t = new URL(this.source);
646
+ return I(t.pathname);
647
+ }
648
+ /**
649
+ * Get the file mime
650
+ */
651
+ get mime() {
652
+ return this._data.mime;
653
+ }
654
+ /**
655
+ * Get the file modification time
656
+ */
657
+ get mtime() {
658
+ return this._data.mtime;
659
+ }
660
+ /**
661
+ * Get the file creation time
662
+ */
663
+ get crtime() {
664
+ return this._data.crtime;
665
+ }
666
+ /**
667
+ * Get the file size
668
+ */
669
+ get size() {
670
+ return this._data.size;
671
+ }
672
+ /**
673
+ * Get the file attribute
674
+ */
675
+ get attributes() {
676
+ return this._attributes;
677
+ }
678
+ /**
679
+ * Get the file permissions
680
+ */
681
+ get permissions() {
682
+ return this.owner === null && !this.isDavRessource ? N.READ : this._data.permissions !== void 0 ? this._data.permissions : N.NONE;
683
+ }
684
+ /**
685
+ * Get the file owner
686
+ */
687
+ get owner() {
688
+ return this.isDavRessource ? this._data.owner : null;
689
+ }
690
+ /**
691
+ * Is this a dav-related ressource ?
692
+ */
693
+ get isDavRessource() {
694
+ return J(this.source, this._knownDavService);
695
+ }
696
+ /**
697
+ * Get the dav root of this object
698
+ */
699
+ get root() {
700
+ return this._data.root ? this._data.root.replace(/^(.+)\/$/, "$1") : this.isDavRessource && I(this.source).split(this._knownDavService).pop() || null;
701
+ }
702
+ /**
703
+ * Get the absolute path of this object relative to the root
704
+ */
705
+ get path() {
706
+ if (this.root) {
707
+ const t = this.source.indexOf(this.root);
708
+ return this.source.slice(t + this.root.length) || "/";
709
+ }
710
+ return (this.dirname + "/" + this.basename).replace(/\/\//g, "/");
711
+ }
712
+ /**
713
+ * Get the node id if defined.
714
+ * Will look for the fileid in attributes if undefined.
715
+ */
716
+ get fileid() {
717
+ return this._data?.id || this.attributes?.fileid;
718
+ }
719
+ /**
720
+ * Get the node status.
721
+ */
722
+ get status() {
723
+ return this._data?.status;
724
+ }
725
+ /**
726
+ * Set the node status.
727
+ */
728
+ set status(t) {
729
+ this._data.status = t;
730
+ }
731
+ /**
732
+ * Move the node to a new destination
733
+ *
734
+ * @param {string} destination the new source.
735
+ * e.g. https://cloud.domain.com/remote.php/dav/files/emma/Photos/picture.jpg
736
+ */
737
+ move(t) {
738
+ X({ ...this._data, source: t }, this._knownDavService), this._data.source = t, this.updateMtime();
739
+ }
740
+ /**
741
+ * Rename the node
742
+ * This aliases the move method for easier usage
743
+ *
744
+ * @param basename The new name of the node
745
+ */
746
+ rename(t) {
747
+ if (t.includes("/"))
748
+ throw new Error("Invalid basename");
749
+ this.move(I(this.source) + "/" + t);
750
+ }
751
+ /**
752
+ * Update the mtime if exists.
753
+ */
754
+ updateMtime() {
755
+ this._data.mtime && (this._data.mtime = /* @__PURE__ */ new Date());
756
+ }
757
+ }
758
+ /**
759
+ * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
760
+ *
761
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
762
+ *
763
+ * @license AGPL-3.0-or-later
764
+ *
765
+ * This program is free software: you can redistribute it and/or modify
766
+ * it under the terms of the GNU Affero General Public License as
767
+ * published by the Free Software Foundation, either version 3 of the
768
+ * License, or (at your option) any later version.
769
+ *
770
+ * This program is distributed in the hope that it will be useful,
771
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
772
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
773
+ * GNU Affero General Public License for more details.
774
+ *
775
+ * You should have received a copy of the GNU Affero General Public License
776
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
777
+ *
778
+ */
779
+ class ye extends D {
780
+ get type() {
781
+ return R.File;
782
+ }
783
+ }
784
+ /**
785
+ * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
786
+ *
787
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
788
+ *
789
+ * @license AGPL-3.0-or-later
790
+ *
791
+ * This program is free software: you can redistribute it and/or modify
792
+ * it under the terms of the GNU Affero General Public License as
793
+ * published by the Free Software Foundation, either version 3 of the
794
+ * License, or (at your option) any later version.
795
+ *
796
+ * This program is distributed in the hope that it will be useful,
797
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
798
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
799
+ * GNU Affero General Public License for more details.
800
+ *
801
+ * You should have received a copy of the GNU Affero General Public License
802
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
803
+ *
804
+ */
805
+ class _e extends D {
806
+ constructor(t) {
807
+ super({
808
+ ...t,
809
+ mime: "httpd/unix-directory"
810
+ });
811
+ }
812
+ get type() {
813
+ return R.Folder;
814
+ }
815
+ get extension() {
816
+ return null;
817
+ }
818
+ get mime() {
819
+ return "httpd/unix-directory";
820
+ }
821
+ }
822
+ /**
823
+ * @copyright Copyright (c) 2023 John Molakvoæ <skjnldsv@protonmail.com>
824
+ *
825
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
826
+ * @author Ferdinand Thiessen <opensource@fthiessen.de>
827
+ *
828
+ * @license AGPL-3.0-or-later
829
+ *
830
+ * This program is free software: you can redistribute it and/or modify
831
+ * it under the terms of the GNU Affero General Public License as
832
+ * published by the Free Software Foundation, either version 3 of the
833
+ * License, or (at your option) any later version.
834
+ *
835
+ * This program is distributed in the hope that it will be useful,
836
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
837
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
838
+ * GNU Affero General Public License for more details.
839
+ *
840
+ * You should have received a copy of the GNU Affero General Public License
841
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
842
+ *
843
+ */
844
+ const ee = `/files/${A()?.uid}`, te = pe("dav"), ur = function(e = te) {
845
+ const t = ge(e);
846
+ function r(n) {
847
+ t.setHeaders({
848
+ // Add this so the server knows it is an request from the browser
849
+ "X-Requested-With": "XMLHttpRequest",
850
+ // Inject user auth
851
+ requesttoken: n ?? ""
852
+ });
853
+ }
854
+ return ue(r), r(de()), we().patch("fetch", (n, i) => {
855
+ const d = i.headers;
856
+ return d?.method && (i.method = d.method, delete d.method), fetch(n, i);
857
+ }), t;
858
+ }, dr = async (e, t = "/", r = ee) => (await e.getDirectoryContents(`${r}${t}`, {
859
+ details: !0,
860
+ data: Ee(),
861
+ headers: {
862
+ // see davGetClient for patched webdav client
863
+ method: "REPORT"
864
+ },
865
+ includeSelf: !0
866
+ })).data.filter((n) => n.filename !== t).map((n) => ve(n, r)), ve = function(e, t = ee, r = te) {
867
+ const s = e.props, n = be(s?.permissions), i = A()?.uid, d = {
868
+ id: s?.fileid || 0,
869
+ source: `${r}${e.filename}`,
870
+ mtime: new Date(Date.parse(e.lastmod)),
871
+ mime: e.mime,
872
+ size: s?.size || Number.parseInt(s.getcontentlength || "0"),
873
+ permissions: n,
874
+ owner: i,
875
+ root: t,
876
+ attributes: {
877
+ ...e,
878
+ ...s,
879
+ hasPreview: s?.["has-preview"]
880
+ }
881
+ };
882
+ return delete d.attributes?.props, e.type === "file" ? new ye(d) : new _e(d);
883
+ };
884
+ /**
885
+ * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
886
+ *
887
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
888
+ *
889
+ * @license AGPL-3.0-or-later
890
+ *
891
+ * This program is free software: you can redistribute it and/or modify
892
+ * it under the terms of the GNU Affero General Public License as
893
+ * published by the Free Software Foundation, either version 3 of the
894
+ * License, or (at your option) any later version.
895
+ *
896
+ * This program is distributed in the hope that it will be useful,
897
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
898
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
899
+ * GNU Affero General Public License for more details.
900
+ *
901
+ * You should have received a copy of the GNU Affero General Public License
902
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
903
+ *
904
+ */
905
+ class Te {
906
+ _views = [];
907
+ _currentView = null;
908
+ register(t) {
909
+ if (this._views.find((r) => r.id === t.id))
910
+ throw new Error(`View id ${t.id} is already registered`);
911
+ this._views.push(t);
912
+ }
913
+ remove(t) {
914
+ const r = this._views.findIndex((s) => s.id === t);
915
+ r !== -1 && this._views.splice(r, 1);
916
+ }
917
+ get views() {
918
+ return this._views;
919
+ }
920
+ setActive(t) {
921
+ this._currentView = t;
922
+ }
923
+ get active() {
924
+ return this._currentView;
925
+ }
926
+ }
927
+ const ar = function() {
928
+ return typeof window._nc_navigation > "u" && (window._nc_navigation = new Te(), m.debug("Navigation service initialized")), window._nc_navigation;
929
+ };
930
+ /**
931
+ * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
932
+ *
933
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
934
+ *
935
+ * @license AGPL-3.0-or-later
936
+ *
937
+ * This program is free software: you can redistribute it and/or modify
938
+ * it under the terms of the GNU Affero General Public License as
939
+ * published by the Free Software Foundation, either version 3 of the
940
+ * License, or (at your option) any later version.
941
+ *
942
+ * This program is distributed in the hope that it will be useful,
943
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
944
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
945
+ * GNU Affero General Public License for more details.
946
+ *
947
+ * You should have received a copy of the GNU Affero General Public License
948
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
949
+ *
950
+ */
951
+ class Ie {
952
+ _column;
953
+ constructor(t) {
954
+ Ae(t), this._column = t;
955
+ }
956
+ get id() {
957
+ return this._column.id;
958
+ }
959
+ get title() {
960
+ return this._column.title;
961
+ }
962
+ get render() {
963
+ return this._column.render;
964
+ }
965
+ get sort() {
966
+ return this._column.sort;
967
+ }
968
+ get summary() {
969
+ return this._column.summary;
970
+ }
971
+ }
972
+ const Ae = function(e) {
973
+ if (!e.id || typeof e.id != "string")
974
+ throw new Error("A column id is required");
975
+ if (!e.title || typeof e.title != "string")
976
+ throw new Error("A column title is required");
977
+ if (!e.render || typeof e.render != "function")
978
+ throw new Error("A render function is required");
979
+ if (e.sort && typeof e.sort != "function")
980
+ throw new Error("Column sortFunction must be a function");
981
+ if (e.summary && typeof e.summary != "function")
982
+ throw new Error("Column summary must be a function");
983
+ return !0;
984
+ };
985
+ var S = {}, O = {};
986
+ (function(e) {
987
+ const t = ":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD", r = t + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040", s = "[" + t + "][" + r + "]*", n = new RegExp("^" + s + "$"), i = function(u, o) {
988
+ const a = [];
989
+ let l = o.exec(u);
990
+ for (; l; ) {
991
+ const f = [];
992
+ f.startIndex = o.lastIndex - l[0].length;
993
+ const c = l.length;
994
+ for (let g = 0; g < c; g++)
995
+ f.push(l[g]);
996
+ a.push(f), l = o.exec(u);
997
+ }
998
+ return a;
999
+ }, d = function(u) {
1000
+ const o = n.exec(u);
1001
+ return !(o === null || typeof o > "u");
1002
+ };
1003
+ e.isExist = function(u) {
1004
+ return typeof u < "u";
1005
+ }, e.isEmptyObject = function(u) {
1006
+ return Object.keys(u).length === 0;
1007
+ }, e.merge = function(u, o, a) {
1008
+ if (o) {
1009
+ const l = Object.keys(o), f = l.length;
1010
+ for (let c = 0; c < f; c++)
1011
+ a === "strict" ? u[l[c]] = [o[l[c]]] : u[l[c]] = o[l[c]];
1012
+ }
1013
+ }, e.getValue = function(u) {
1014
+ return e.isExist(u) ? u : "";
1015
+ }, e.isName = d, e.getAllMatches = i, e.nameRegexp = s;
1016
+ })(O);
1017
+ const M = O, Oe = {
1018
+ allowBooleanAttributes: !1,
1019
+ //A tag can have attributes without any value
1020
+ unpairedTags: []
1021
+ };
1022
+ S.validate = function(e, t) {
1023
+ t = Object.assign({}, Oe, t);
1024
+ const r = [];
1025
+ let s = !1, n = !1;
1026
+ e[0] === "\uFEFF" && (e = e.substr(1));
1027
+ for (let i = 0; i < e.length; i++)
1028
+ if (e[i] === "<" && e[i + 1] === "?") {
1029
+ if (i += 2, i = G(e, i), i.err)
1030
+ return i;
1031
+ } else if (e[i] === "<") {
1032
+ let d = i;
1033
+ if (i++, e[i] === "!") {
1034
+ i = z(e, i);
1035
+ continue;
1036
+ } else {
1037
+ let u = !1;
1038
+ e[i] === "/" && (u = !0, i++);
1039
+ let o = "";
1040
+ for (; i < e.length && e[i] !== ">" && e[i] !== " " && e[i] !== " " && e[i] !== `
1041
+ ` && e[i] !== "\r"; i++)
1042
+ o += e[i];
1043
+ if (o = o.trim(), o[o.length - 1] === "/" && (o = o.substring(0, o.length - 1), i--), !Re(o)) {
1044
+ let f;
1045
+ return o.trim().length === 0 ? f = "Invalid space after '<'." : f = "Tag '" + o + "' is an invalid name.", p("InvalidTag", f, w(e, i));
1046
+ }
1047
+ const a = xe(e, i);
1048
+ if (a === !1)
1049
+ return p("InvalidAttr", "Attributes for '" + o + "' have open quote.", w(e, i));
1050
+ let l = a.value;
1051
+ if (i = a.index, l[l.length - 1] === "/") {
1052
+ const f = i - l.length;
1053
+ l = l.substring(0, l.length - 1);
1054
+ const c = H(l, t);
1055
+ if (c === !0)
1056
+ s = !0;
1057
+ else
1058
+ return p(c.err.code, c.err.msg, w(e, f + c.err.line));
1059
+ } else if (u)
1060
+ if (a.tagClosed) {
1061
+ if (l.trim().length > 0)
1062
+ return p("InvalidTag", "Closing tag '" + o + "' can't have attributes or invalid starting.", w(e, d));
1063
+ {
1064
+ const f = r.pop();
1065
+ if (o !== f.tagName) {
1066
+ let c = w(e, f.tagStartPos);
1067
+ return p(
1068
+ "InvalidTag",
1069
+ "Expected closing tag '" + f.tagName + "' (opened in line " + c.line + ", col " + c.col + ") instead of closing tag '" + o + "'.",
1070
+ w(e, d)
1071
+ );
1072
+ }
1073
+ r.length == 0 && (n = !0);
1074
+ }
1075
+ } else
1076
+ return p("InvalidTag", "Closing tag '" + o + "' doesn't have proper closing.", w(e, i));
1077
+ else {
1078
+ const f = H(l, t);
1079
+ if (f !== !0)
1080
+ return p(f.err.code, f.err.msg, w(e, i - l.length + f.err.line));
1081
+ if (n === !0)
1082
+ return p("InvalidXml", "Multiple possible root nodes found.", w(e, i));
1083
+ t.unpairedTags.indexOf(o) !== -1 || r.push({ tagName: o, tagStartPos: d }), s = !0;
1084
+ }
1085
+ for (i++; i < e.length; i++)
1086
+ if (e[i] === "<")
1087
+ if (e[i + 1] === "!") {
1088
+ i++, i = z(e, i);
1089
+ continue;
1090
+ } else if (e[i + 1] === "?") {
1091
+ if (i = G(e, ++i), i.err)
1092
+ return i;
1093
+ } else
1094
+ break;
1095
+ else if (e[i] === "&") {
1096
+ const f = Ve(e, i);
1097
+ if (f == -1)
1098
+ return p("InvalidChar", "char '&' is not expected.", w(e, i));
1099
+ i = f;
1100
+ } else if (n === !0 && !U(e[i]))
1101
+ return p("InvalidXml", "Extra text at the end", w(e, i));
1102
+ e[i] === "<" && i--;
1103
+ }
1104
+ } else {
1105
+ if (U(e[i]))
1106
+ continue;
1107
+ return p("InvalidChar", "char '" + e[i] + "' is not expected.", w(e, i));
1108
+ }
1109
+ if (s) {
1110
+ if (r.length == 1)
1111
+ return p("InvalidTag", "Unclosed tag '" + r[0].tagName + "'.", w(e, r[0].tagStartPos));
1112
+ if (r.length > 0)
1113
+ return p("InvalidXml", "Invalid '" + JSON.stringify(r.map((i) => i.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 });
1114
+ } else
1115
+ return p("InvalidXml", "Start tag expected.", 1);
1116
+ return !0;
1117
+ };
1118
+ function U(e) {
1119
+ return e === " " || e === " " || e === `
1120
+ ` || e === "\r";
1121
+ }
1122
+ function G(e, t) {
1123
+ const r = t;
1124
+ for (; t < e.length; t++)
1125
+ if (e[t] == "?" || e[t] == " ") {
1126
+ const s = e.substr(r, t - r);
1127
+ if (t > 5 && s === "xml")
1128
+ return p("InvalidXml", "XML declaration allowed only at the start of the document.", w(e, t));
1129
+ if (e[t] == "?" && e[t + 1] == ">") {
1130
+ t++;
1131
+ break;
1132
+ } else
1133
+ continue;
1134
+ }
1135
+ return t;
1136
+ }
1137
+ function z(e, t) {
1138
+ if (e.length > t + 5 && e[t + 1] === "-" && e[t + 2] === "-") {
1139
+ for (t += 3; t < e.length; t++)
1140
+ if (e[t] === "-" && e[t + 1] === "-" && e[t + 2] === ">") {
1141
+ t += 2;
1142
+ break;
1143
+ }
1144
+ } else if (e.length > t + 8 && e[t + 1] === "D" && e[t + 2] === "O" && e[t + 3] === "C" && e[t + 4] === "T" && e[t + 5] === "Y" && e[t + 6] === "P" && e[t + 7] === "E") {
1145
+ let r = 1;
1146
+ for (t += 8; t < e.length; t++)
1147
+ if (e[t] === "<")
1148
+ r++;
1149
+ else if (e[t] === ">" && (r--, r === 0))
1150
+ break;
1151
+ } else if (e.length > t + 9 && e[t + 1] === "[" && e[t + 2] === "C" && e[t + 3] === "D" && e[t + 4] === "A" && e[t + 5] === "T" && e[t + 6] === "A" && e[t + 7] === "[") {
1152
+ for (t += 8; t < e.length; t++)
1153
+ if (e[t] === "]" && e[t + 1] === "]" && e[t + 2] === ">") {
1154
+ t += 2;
1155
+ break;
1156
+ }
1157
+ }
1158
+ return t;
1159
+ }
1160
+ const Ce = '"', Pe = "'";
1161
+ function xe(e, t) {
1162
+ let r = "", s = "", n = !1;
1163
+ for (; t < e.length; t++) {
1164
+ if (e[t] === Ce || e[t] === Pe)
1165
+ s === "" ? s = e[t] : s !== e[t] || (s = "");
1166
+ else if (e[t] === ">" && s === "") {
1167
+ n = !0;
1168
+ break;
1169
+ }
1170
+ r += e[t];
1171
+ }
1172
+ return s !== "" ? !1 : {
1173
+ value: r,
1174
+ index: t,
1175
+ tagClosed: n
1176
+ };
1177
+ }
1178
+ const $e = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
1179
+ function H(e, t) {
1180
+ const r = M.getAllMatches(e, $e), s = {};
1181
+ for (let n = 0; n < r.length; n++) {
1182
+ if (r[n][1].length === 0)
1183
+ return p("InvalidAttr", "Attribute '" + r[n][2] + "' has no space in starting.", v(r[n]));
1184
+ if (r[n][3] !== void 0 && r[n][4] === void 0)
1185
+ return p("InvalidAttr", "Attribute '" + r[n][2] + "' is without value.", v(r[n]));
1186
+ if (r[n][3] === void 0 && !t.allowBooleanAttributes)
1187
+ return p("InvalidAttr", "boolean attribute '" + r[n][2] + "' is not allowed.", v(r[n]));
1188
+ const i = r[n][2];
1189
+ if (!Le(i))
1190
+ return p("InvalidAttr", "Attribute '" + i + "' is an invalid name.", v(r[n]));
1191
+ if (!s.hasOwnProperty(i))
1192
+ s[i] = 1;
1193
+ else
1194
+ return p("InvalidAttr", "Attribute '" + i + "' is repeated.", v(r[n]));
1195
+ }
1196
+ return !0;
1197
+ }
1198
+ function Fe(e, t) {
1199
+ let r = /\d/;
1200
+ for (e[t] === "x" && (t++, r = /[\da-fA-F]/); t < e.length; t++) {
1201
+ if (e[t] === ";")
1202
+ return t;
1203
+ if (!e[t].match(r))
1204
+ break;
1205
+ }
1206
+ return -1;
1207
+ }
1208
+ function Ve(e, t) {
1209
+ if (t++, e[t] === ";")
1210
+ return -1;
1211
+ if (e[t] === "#")
1212
+ return t++, Fe(e, t);
1213
+ let r = 0;
1214
+ for (; t < e.length; t++, r++)
1215
+ if (!(e[t].match(/\w/) && r < 20)) {
1216
+ if (e[t] === ";")
1217
+ break;
1218
+ return -1;
1219
+ }
1220
+ return t;
1221
+ }
1222
+ function p(e, t, r) {
1223
+ return {
1224
+ err: {
1225
+ code: e,
1226
+ msg: t,
1227
+ line: r.line || r,
1228
+ col: r.col
1229
+ }
1230
+ };
1231
+ }
1232
+ function Le(e) {
1233
+ return M.isName(e);
1234
+ }
1235
+ function Re(e) {
1236
+ return M.isName(e);
1237
+ }
1238
+ function w(e, t) {
1239
+ const r = e.substring(0, t).split(/\r?\n/);
1240
+ return {
1241
+ line: r.length,
1242
+ // column number is last line's length + 1, because column numbering starts at 1:
1243
+ col: r[r.length - 1].length + 1
1244
+ };
1245
+ }
1246
+ function v(e) {
1247
+ return e.startIndex + e[1].length;
1248
+ }
1249
+ var B = {};
1250
+ const re = {
1251
+ preserveOrder: !1,
1252
+ attributeNamePrefix: "@_",
1253
+ attributesGroupName: !1,
1254
+ textNodeName: "#text",
1255
+ ignoreAttributes: !0,
1256
+ removeNSPrefix: !1,
1257
+ // remove NS from tag name or attribute name if true
1258
+ allowBooleanAttributes: !1,
1259
+ //a tag can have attributes without any value
1260
+ //ignoreRootElement : false,
1261
+ parseTagValue: !0,
1262
+ parseAttributeValue: !1,
1263
+ trimValues: !0,
1264
+ //Trim string values of tag and attributes
1265
+ cdataPropName: !1,
1266
+ numberParseOptions: {
1267
+ hex: !0,
1268
+ leadingZeros: !0,
1269
+ eNotation: !0
1270
+ },
1271
+ tagValueProcessor: function(e, t) {
1272
+ return t;
1273
+ },
1274
+ attributeValueProcessor: function(e, t) {
1275
+ return t;
1276
+ },
1277
+ stopNodes: [],
1278
+ //nested tags will not be parsed even for errors
1279
+ alwaysCreateTextNode: !1,
1280
+ isArray: () => !1,
1281
+ commentPropName: !1,
1282
+ unpairedTags: [],
1283
+ processEntities: !0,
1284
+ htmlEntities: !1,
1285
+ ignoreDeclaration: !1,
1286
+ ignorePiTags: !1,
1287
+ transformTagName: !1,
1288
+ transformAttributeName: !1,
1289
+ updateTag: function(e, t, r) {
1290
+ return e;
1291
+ }
1292
+ // skipEmptyListItem: false
1293
+ }, Se = function(e) {
1294
+ return Object.assign({}, re, e);
1295
+ };
1296
+ B.buildOptions = Se;
1297
+ B.defaultOptions = re;
1298
+ class Me {
1299
+ constructor(t) {
1300
+ this.tagname = t, this.child = [], this[":@"] = {};
1301
+ }
1302
+ add(t, r) {
1303
+ t === "__proto__" && (t = "#__proto__"), this.child.push({ [t]: r });
1304
+ }
1305
+ addChild(t) {
1306
+ t.tagname === "__proto__" && (t.tagname = "#__proto__"), t[":@"] && Object.keys(t[":@"]).length > 0 ? this.child.push({ [t.tagname]: t.child, ":@": t[":@"] }) : this.child.push({ [t.tagname]: t.child });
1307
+ }
1308
+ }
1309
+ var Be = Me;
1310
+ const ke = O;
1311
+ function qe(e, t) {
1312
+ const r = {};
1313
+ if (e[t + 3] === "O" && e[t + 4] === "C" && e[t + 5] === "T" && e[t + 6] === "Y" && e[t + 7] === "P" && e[t + 8] === "E") {
1314
+ t = t + 9;
1315
+ let s = 1, n = !1, i = !1, d = "";
1316
+ for (; t < e.length; t++)
1317
+ if (e[t] === "<" && !i) {
1318
+ if (n && Ge(e, t))
1319
+ t += 7, [entityName, val, t] = Xe(e, t + 1), val.indexOf("&") === -1 && (r[We(entityName)] = {
1320
+ regx: RegExp(`&${entityName};`, "g"),
1321
+ val
1322
+ });
1323
+ else if (n && ze(e, t))
1324
+ t += 8;
1325
+ else if (n && He(e, t))
1326
+ t += 8;
1327
+ else if (n && Ke(e, t))
1328
+ t += 9;
1329
+ else if (Ue)
1330
+ i = !0;
1331
+ else
1332
+ throw new Error("Invalid DOCTYPE");
1333
+ s++, d = "";
1334
+ } else if (e[t] === ">") {
1335
+ if (i ? e[t - 1] === "-" && e[t - 2] === "-" && (i = !1, s--) : s--, s === 0)
1336
+ break;
1337
+ } else
1338
+ e[t] === "[" ? n = !0 : d += e[t];
1339
+ if (s !== 0)
1340
+ throw new Error("Unclosed DOCTYPE");
1341
+ } else
1342
+ throw new Error("Invalid Tag instead of DOCTYPE");
1343
+ return { entities: r, i: t };
1344
+ }
1345
+ function Xe(e, t) {
1346
+ let r = "";
1347
+ for (; t < e.length && e[t] !== "'" && e[t] !== '"'; t++)
1348
+ r += e[t];
1349
+ if (r = r.trim(), r.indexOf(" ") !== -1)
1350
+ throw new Error("External entites are not supported");
1351
+ const s = e[t++];
1352
+ let n = "";
1353
+ for (; t < e.length && e[t] !== s; t++)
1354
+ n += e[t];
1355
+ return [r, n, t];
1356
+ }
1357
+ function Ue(e, t) {
1358
+ return e[t + 1] === "!" && e[t + 2] === "-" && e[t + 3] === "-";
1359
+ }
1360
+ function Ge(e, t) {
1361
+ return e[t + 1] === "!" && e[t + 2] === "E" && e[t + 3] === "N" && e[t + 4] === "T" && e[t + 5] === "I" && e[t + 6] === "T" && e[t + 7] === "Y";
1362
+ }
1363
+ function ze(e, t) {
1364
+ return e[t + 1] === "!" && e[t + 2] === "E" && e[t + 3] === "L" && e[t + 4] === "E" && e[t + 5] === "M" && e[t + 6] === "E" && e[t + 7] === "N" && e[t + 8] === "T";
1365
+ }
1366
+ function He(e, t) {
1367
+ return e[t + 1] === "!" && e[t + 2] === "A" && e[t + 3] === "T" && e[t + 4] === "T" && e[t + 5] === "L" && e[t + 6] === "I" && e[t + 7] === "S" && e[t + 8] === "T";
1368
+ }
1369
+ function Ke(e, t) {
1370
+ return e[t + 1] === "!" && e[t + 2] === "N" && e[t + 3] === "O" && e[t + 4] === "T" && e[t + 5] === "A" && e[t + 6] === "T" && e[t + 7] === "I" && e[t + 8] === "O" && e[t + 9] === "N";
1371
+ }
1372
+ function We(e) {
1373
+ if (ke.isName(e))
1374
+ return e;
1375
+ throw new Error(`Invalid entity name ${e}`);
1376
+ }
1377
+ var Ze = qe;
1378
+ const je = /^[-+]?0x[a-fA-F0-9]+$/, Ye = /^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;
1379
+ !Number.parseInt && window.parseInt && (Number.parseInt = window.parseInt);
1380
+ !Number.parseFloat && window.parseFloat && (Number.parseFloat = window.parseFloat);
1381
+ const Je = {
1382
+ hex: !0,
1383
+ leadingZeros: !0,
1384
+ decimalPoint: ".",
1385
+ eNotation: !0
1386
+ //skipLike: /regex/
1387
+ };
1388
+ function Qe(e, t = {}) {
1389
+ if (t = Object.assign({}, Je, t), !e || typeof e != "string")
1390
+ return e;
1391
+ let r = e.trim();
1392
+ if (t.skipLike !== void 0 && t.skipLike.test(r))
1393
+ return e;
1394
+ if (t.hex && je.test(r))
1395
+ return Number.parseInt(r, 16);
1396
+ {
1397
+ const s = Ye.exec(r);
1398
+ if (s) {
1399
+ const n = s[1], i = s[2];
1400
+ let d = De(s[3]);
1401
+ const u = s[4] || s[6];
1402
+ if (!t.leadingZeros && i.length > 0 && n && r[2] !== ".")
1403
+ return e;
1404
+ if (!t.leadingZeros && i.length > 0 && !n && r[1] !== ".")
1405
+ return e;
1406
+ {
1407
+ const o = Number(r), a = "" + o;
1408
+ return a.search(/[eE]/) !== -1 || u ? t.eNotation ? o : e : r.indexOf(".") !== -1 ? a === "0" && d === "" || a === d || n && a === "-" + d ? o : e : i ? d === a || n + d === a ? o : e : r === a || r === n + a ? o : e;
1409
+ }
1410
+ } else
1411
+ return e;
1412
+ }
1413
+ }
1414
+ function De(e) {
1415
+ return e && e.indexOf(".") !== -1 && (e = e.replace(/0+$/, ""), e === "." ? e = "0" : e[0] === "." ? e = "0" + e : e[e.length - 1] === "." && (e = e.substr(0, e.length - 1))), e;
1416
+ }
1417
+ var et = Qe;
1418
+ const k = O, T = Be, tt = Ze, rt = et;
1419
+ "<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)".replace(/NAME/g, k.nameRegexp);
1420
+ let nt = class {
1421
+ constructor(t) {
1422
+ this.options = t, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = {
1423
+ apos: { regex: /&(apos|#39|#x27);/g, val: "'" },
1424
+ gt: { regex: /&(gt|#62|#x3E);/g, val: ">" },
1425
+ lt: { regex: /&(lt|#60|#x3C);/g, val: "<" },
1426
+ quot: { regex: /&(quot|#34|#x22);/g, val: '"' }
1427
+ }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = {
1428
+ space: { regex: /&(nbsp|#160);/g, val: " " },
1429
+ // "lt" : { regex: /&(lt|#60);/g, val: "<" },
1430
+ // "gt" : { regex: /&(gt|#62);/g, val: ">" },
1431
+ // "amp" : { regex: /&(amp|#38);/g, val: "&" },
1432
+ // "quot" : { regex: /&(quot|#34);/g, val: "\"" },
1433
+ // "apos" : { regex: /&(apos|#39);/g, val: "'" },
1434
+ cent: { regex: /&(cent|#162);/g, val: "¢" },
1435
+ pound: { regex: /&(pound|#163);/g, val: "£" },
1436
+ yen: { regex: /&(yen|#165);/g, val: "¥" },
1437
+ euro: { regex: /&(euro|#8364);/g, val: "€" },
1438
+ copyright: { regex: /&(copy|#169);/g, val: "©" },
1439
+ reg: { regex: /&(reg|#174);/g, val: "®" },
1440
+ inr: { regex: /&(inr|#8377);/g, val: "₹" }
1441
+ }, this.addExternalEntities = it, this.parseXml = at, this.parseTextData = st, this.resolveNameSpace = ot, this.buildAttributesMap = dt, this.isItStopNode = ht, this.replaceEntitiesValue = ft, this.readStopNodeData = gt, this.saveTextToParentTag = ct, this.addChild = lt;
1442
+ }
1443
+ };
1444
+ function it(e) {
1445
+ const t = Object.keys(e);
1446
+ for (let r = 0; r < t.length; r++) {
1447
+ const s = t[r];
1448
+ this.lastEntities[s] = {
1449
+ regex: new RegExp("&" + s + ";", "g"),
1450
+ val: e[s]
1451
+ };
1452
+ }
1453
+ }
1454
+ function st(e, t, r, s, n, i, d) {
1455
+ if (e !== void 0 && (this.options.trimValues && !s && (e = e.trim()), e.length > 0)) {
1456
+ d || (e = this.replaceEntitiesValue(e));
1457
+ const u = this.options.tagValueProcessor(t, e, r, n, i);
1458
+ return u == null ? e : typeof u != typeof e || u !== e ? u : this.options.trimValues ? $(e, this.options.parseTagValue, this.options.numberParseOptions) : e.trim() === e ? $(e, this.options.parseTagValue, this.options.numberParseOptions) : e;
1459
+ }
1460
+ }
1461
+ function ot(e) {
1462
+ if (this.options.removeNSPrefix) {
1463
+ const t = e.split(":"), r = e.charAt(0) === "/" ? "/" : "";
1464
+ if (t[0] === "xmlns")
1465
+ return "";
1466
+ t.length === 2 && (e = r + t[1]);
1467
+ }
1468
+ return e;
1469
+ }
1470
+ const ut = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
1471
+ function dt(e, t, r) {
1472
+ if (!this.options.ignoreAttributes && typeof e == "string") {
1473
+ const s = k.getAllMatches(e, ut), n = s.length, i = {};
1474
+ for (let d = 0; d < n; d++) {
1475
+ const u = this.resolveNameSpace(s[d][1]);
1476
+ let o = s[d][4], a = this.options.attributeNamePrefix + u;
1477
+ if (u.length)
1478
+ if (this.options.transformAttributeName && (a = this.options.transformAttributeName(a)), a === "__proto__" && (a = "#__proto__"), o !== void 0) {
1479
+ this.options.trimValues && (o = o.trim()), o = this.replaceEntitiesValue(o);
1480
+ const l = this.options.attributeValueProcessor(u, o, t);
1481
+ l == null ? i[a] = o : typeof l != typeof o || l !== o ? i[a] = l : i[a] = $(
1482
+ o,
1483
+ this.options.parseAttributeValue,
1484
+ this.options.numberParseOptions
1485
+ );
1486
+ } else
1487
+ this.options.allowBooleanAttributes && (i[a] = !0);
1488
+ }
1489
+ if (!Object.keys(i).length)
1490
+ return;
1491
+ if (this.options.attributesGroupName) {
1492
+ const d = {};
1493
+ return d[this.options.attributesGroupName] = i, d;
1494
+ }
1495
+ return i;
1496
+ }
1497
+ }
1498
+ const at = function(e) {
1499
+ e = e.replace(/\r\n?/g, `
1500
+ `);
1501
+ const t = new T("!xml");
1502
+ let r = t, s = "", n = "";
1503
+ for (let i = 0; i < e.length; i++)
1504
+ if (e[i] === "<")
1505
+ if (e[i + 1] === "/") {
1506
+ const u = y(e, ">", i, "Closing Tag is not closed.");
1507
+ let o = e.substring(i + 2, u).trim();
1508
+ if (this.options.removeNSPrefix) {
1509
+ const f = o.indexOf(":");
1510
+ f !== -1 && (o = o.substr(f + 1));
1511
+ }
1512
+ this.options.transformTagName && (o = this.options.transformTagName(o)), r && (s = this.saveTextToParentTag(s, r, n));
1513
+ const a = n.substring(n.lastIndexOf(".") + 1);
1514
+ if (o && this.options.unpairedTags.indexOf(o) !== -1)
1515
+ throw new Error(`Unpaired tag can not be used as closing tag: </${o}>`);
1516
+ let l = 0;
1517
+ a && this.options.unpairedTags.indexOf(a) !== -1 ? (l = n.lastIndexOf(".", n.lastIndexOf(".") - 1), this.tagsNodeStack.pop()) : l = n.lastIndexOf("."), n = n.substring(0, l), r = this.tagsNodeStack.pop(), s = "", i = u;
1518
+ } else if (e[i + 1] === "?") {
1519
+ let u = x(e, i, !1, "?>");
1520
+ if (!u)
1521
+ throw new Error("Pi Tag is not closed.");
1522
+ if (s = this.saveTextToParentTag(s, r, n), !(this.options.ignoreDeclaration && u.tagName === "?xml" || this.options.ignorePiTags)) {
1523
+ const o = new T(u.tagName);
1524
+ o.add(this.options.textNodeName, ""), u.tagName !== u.tagExp && u.attrExpPresent && (o[":@"] = this.buildAttributesMap(u.tagExp, n, u.tagName)), this.addChild(r, o, n);
1525
+ }
1526
+ i = u.closeIndex + 1;
1527
+ } else if (e.substr(i + 1, 3) === "!--") {
1528
+ const u = y(e, "-->", i + 4, "Comment is not closed.");
1529
+ if (this.options.commentPropName) {
1530
+ const o = e.substring(i + 4, u - 2);
1531
+ s = this.saveTextToParentTag(s, r, n), r.add(this.options.commentPropName, [{ [this.options.textNodeName]: o }]);
1532
+ }
1533
+ i = u;
1534
+ } else if (e.substr(i + 1, 2) === "!D") {
1535
+ const u = tt(e, i);
1536
+ this.docTypeEntities = u.entities, i = u.i;
1537
+ } else if (e.substr(i + 1, 2) === "![") {
1538
+ const u = y(e, "]]>", i, "CDATA is not closed.") - 2, o = e.substring(i + 9, u);
1539
+ if (s = this.saveTextToParentTag(s, r, n), this.options.cdataPropName)
1540
+ r.add(this.options.cdataPropName, [{ [this.options.textNodeName]: o }]);
1541
+ else {
1542
+ let a = this.parseTextData(o, r.tagname, n, !0, !1, !0);
1543
+ a == null && (a = ""), r.add(this.options.textNodeName, a);
1544
+ }
1545
+ i = u + 2;
1546
+ } else {
1547
+ let u = x(e, i, this.options.removeNSPrefix), o = u.tagName;
1548
+ const a = u.rawTagName;
1549
+ let l = u.tagExp, f = u.attrExpPresent, c = u.closeIndex;
1550
+ this.options.transformTagName && (o = this.options.transformTagName(o)), r && s && r.tagname !== "!xml" && (s = this.saveTextToParentTag(s, r, n, !1));
1551
+ const g = r;
1552
+ if (g && this.options.unpairedTags.indexOf(g.tagname) !== -1 && (r = this.tagsNodeStack.pop(), n = n.substring(0, n.lastIndexOf("."))), o !== t.tagname && (n += n ? "." + o : o), this.isItStopNode(this.options.stopNodes, n, o)) {
1553
+ let h = "";
1554
+ if (l.length > 0 && l.lastIndexOf("/") === l.length - 1)
1555
+ i = u.closeIndex;
1556
+ else if (this.options.unpairedTags.indexOf(o) !== -1)
1557
+ i = u.closeIndex;
1558
+ else {
1559
+ const E = this.readStopNodeData(e, a, c + 1);
1560
+ if (!E)
1561
+ throw new Error(`Unexpected end of ${a}`);
1562
+ i = E.i, h = E.tagContent;
1563
+ }
1564
+ const _ = new T(o);
1565
+ o !== l && f && (_[":@"] = this.buildAttributesMap(l, n, o)), h && (h = this.parseTextData(h, o, n, !0, f, !0, !0)), n = n.substr(0, n.lastIndexOf(".")), _.add(this.options.textNodeName, h), this.addChild(r, _, n);
1566
+ } else {
1567
+ if (l.length > 0 && l.lastIndexOf("/") === l.length - 1) {
1568
+ o[o.length - 1] === "/" ? (o = o.substr(0, o.length - 1), n = n.substr(0, n.length - 1), l = o) : l = l.substr(0, l.length - 1), this.options.transformTagName && (o = this.options.transformTagName(o));
1569
+ const h = new T(o);
1570
+ o !== l && f && (h[":@"] = this.buildAttributesMap(l, n, o)), this.addChild(r, h, n), n = n.substr(0, n.lastIndexOf("."));
1571
+ } else {
1572
+ const h = new T(o);
1573
+ this.tagsNodeStack.push(r), o !== l && f && (h[":@"] = this.buildAttributesMap(l, n, o)), this.addChild(r, h, n), r = h;
1574
+ }
1575
+ s = "", i = c;
1576
+ }
1577
+ }
1578
+ else
1579
+ s += e[i];
1580
+ return t.child;
1581
+ };
1582
+ function lt(e, t, r) {
1583
+ const s = this.options.updateTag(t.tagname, r, t[":@"]);
1584
+ s === !1 || (typeof s == "string" && (t.tagname = s), e.addChild(t));
1585
+ }
1586
+ const ft = function(e) {
1587
+ if (this.options.processEntities) {
1588
+ for (let t in this.docTypeEntities) {
1589
+ const r = this.docTypeEntities[t];
1590
+ e = e.replace(r.regx, r.val);
1591
+ }
1592
+ for (let t in this.lastEntities) {
1593
+ const r = this.lastEntities[t];
1594
+ e = e.replace(r.regex, r.val);
1595
+ }
1596
+ if (this.options.htmlEntities)
1597
+ for (let t in this.htmlEntities) {
1598
+ const r = this.htmlEntities[t];
1599
+ e = e.replace(r.regex, r.val);
1600
+ }
1601
+ e = e.replace(this.ampEntity.regex, this.ampEntity.val);
1602
+ }
1603
+ return e;
1604
+ };
1605
+ function ct(e, t, r, s) {
1606
+ return e && (s === void 0 && (s = Object.keys(t.child).length === 0), e = this.parseTextData(
1607
+ e,
1608
+ t.tagname,
1609
+ r,
1610
+ !1,
1611
+ t[":@"] ? Object.keys(t[":@"]).length !== 0 : !1,
1612
+ s
1613
+ ), e !== void 0 && e !== "" && t.add(this.options.textNodeName, e), e = ""), e;
1614
+ }
1615
+ function ht(e, t, r) {
1616
+ const s = "*." + r;
1617
+ for (const n in e) {
1618
+ const i = e[n];
1619
+ if (s === i || t === i)
1620
+ return !0;
1621
+ }
1622
+ return !1;
1623
+ }
1624
+ function pt(e, t, r = ">") {
1625
+ let s, n = "";
1626
+ for (let i = t; i < e.length; i++) {
1627
+ let d = e[i];
1628
+ if (s)
1629
+ d === s && (s = "");
1630
+ else if (d === '"' || d === "'")
1631
+ s = d;
1632
+ else if (d === r[0])
1633
+ if (r[1]) {
1634
+ if (e[i + 1] === r[1])
1635
+ return {
1636
+ data: n,
1637
+ index: i
1638
+ };
1639
+ } else
1640
+ return {
1641
+ data: n,
1642
+ index: i
1643
+ };
1644
+ else
1645
+ d === " " && (d = " ");
1646
+ n += d;
1647
+ }
1648
+ }
1649
+ function y(e, t, r, s) {
1650
+ const n = e.indexOf(t, r);
1651
+ if (n === -1)
1652
+ throw new Error(s);
1653
+ return n + t.length - 1;
1654
+ }
1655
+ function x(e, t, r, s = ">") {
1656
+ const n = pt(e, t + 1, s);
1657
+ if (!n)
1658
+ return;
1659
+ let i = n.data;
1660
+ const d = n.index, u = i.search(/\s/);
1661
+ let o = i, a = !0;
1662
+ u !== -1 && (o = i.substr(0, u).replace(/\s\s*$/, ""), i = i.substr(u + 1));
1663
+ const l = o;
1664
+ if (r) {
1665
+ const f = o.indexOf(":");
1666
+ f !== -1 && (o = o.substr(f + 1), a = o !== n.data.substr(f + 1));
1667
+ }
1668
+ return {
1669
+ tagName: o,
1670
+ tagExp: i,
1671
+ closeIndex: d,
1672
+ attrExpPresent: a,
1673
+ rawTagName: l
1674
+ };
1675
+ }
1676
+ function gt(e, t, r) {
1677
+ const s = r;
1678
+ let n = 1;
1679
+ for (; r < e.length; r++)
1680
+ if (e[r] === "<")
1681
+ if (e[r + 1] === "/") {
1682
+ const i = y(e, ">", r, `${t} is not closed`);
1683
+ if (e.substring(r + 2, i).trim() === t && (n--, n === 0))
1684
+ return {
1685
+ tagContent: e.substring(s, r),
1686
+ i
1687
+ };
1688
+ r = i;
1689
+ } else if (e[r + 1] === "?")
1690
+ r = y(e, "?>", r + 1, "StopNode is not closed.");
1691
+ else if (e.substr(r + 1, 3) === "!--")
1692
+ r = y(e, "-->", r + 3, "StopNode is not closed.");
1693
+ else if (e.substr(r + 1, 2) === "![")
1694
+ r = y(e, "]]>", r, "StopNode is not closed.") - 2;
1695
+ else {
1696
+ const i = x(e, r, ">");
1697
+ i && ((i && i.tagName) === t && i.tagExp[i.tagExp.length - 1] !== "/" && n++, r = i.closeIndex);
1698
+ }
1699
+ }
1700
+ function $(e, t, r) {
1701
+ if (t && typeof e == "string") {
1702
+ const s = e.trim();
1703
+ return s === "true" ? !0 : s === "false" ? !1 : rt(e, r);
1704
+ } else
1705
+ return k.isExist(e) ? e : "";
1706
+ }
1707
+ var wt = nt, ne = {};
1708
+ function mt(e, t) {
1709
+ return ie(e, t);
1710
+ }
1711
+ function ie(e, t, r) {
1712
+ let s;
1713
+ const n = {};
1714
+ for (let i = 0; i < e.length; i++) {
1715
+ const d = e[i], u = Nt(d);
1716
+ let o = "";
1717
+ if (r === void 0 ? o = u : o = r + "." + u, u === t.textNodeName)
1718
+ s === void 0 ? s = d[u] : s += "" + d[u];
1719
+ else {
1720
+ if (u === void 0)
1721
+ continue;
1722
+ if (d[u]) {
1723
+ let a = ie(d[u], t, o);
1724
+ const l = bt(a, t);
1725
+ d[":@"] ? Et(a, d[":@"], o, t) : Object.keys(a).length === 1 && a[t.textNodeName] !== void 0 && !t.alwaysCreateTextNode ? a = a[t.textNodeName] : Object.keys(a).length === 0 && (t.alwaysCreateTextNode ? a[t.textNodeName] = "" : a = ""), n[u] !== void 0 && n.hasOwnProperty(u) ? (Array.isArray(n[u]) || (n[u] = [n[u]]), n[u].push(a)) : t.isArray(u, o, l) ? n[u] = [a] : n[u] = a;
1726
+ }
1727
+ }
1728
+ }
1729
+ return typeof s == "string" ? s.length > 0 && (n[t.textNodeName] = s) : s !== void 0 && (n[t.textNodeName] = s), n;
1730
+ }
1731
+ function Nt(e) {
1732
+ const t = Object.keys(e);
1733
+ for (let r = 0; r < t.length; r++) {
1734
+ const s = t[r];
1735
+ if (s !== ":@")
1736
+ return s;
1737
+ }
1738
+ }
1739
+ function Et(e, t, r, s) {
1740
+ if (t) {
1741
+ const n = Object.keys(t), i = n.length;
1742
+ for (let d = 0; d < i; d++) {
1743
+ const u = n[d];
1744
+ s.isArray(u, r + "." + u, !0, !0) ? e[u] = [t[u]] : e[u] = t[u];
1745
+ }
1746
+ }
1747
+ }
1748
+ function bt(e, t) {
1749
+ const { textNodeName: r } = t, s = Object.keys(e).length;
1750
+ return !!(s === 0 || s === 1 && (e[r] || typeof e[r] == "boolean" || e[r] === 0));
1751
+ }
1752
+ ne.prettify = mt;
1753
+ const { buildOptions: yt } = B, _t = wt, { prettify: vt } = ne, Tt = S;
1754
+ let It = class {
1755
+ constructor(t) {
1756
+ this.externalEntities = {}, this.options = yt(t);
1757
+ }
1758
+ /**
1759
+ * Parse XML dats to JS object
1760
+ * @param {string|Buffer} xmlData
1761
+ * @param {boolean|Object} validationOption
1762
+ */
1763
+ parse(t, r) {
1764
+ if (typeof t != "string")
1765
+ if (t.toString)
1766
+ t = t.toString();
1767
+ else
1768
+ throw new Error("XML data is accepted in String or Bytes[] form.");
1769
+ if (r) {
1770
+ r === !0 && (r = {});
1771
+ const i = Tt.validate(t, r);
1772
+ if (i !== !0)
1773
+ throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`);
1774
+ }
1775
+ const s = new _t(this.options);
1776
+ s.addExternalEntities(this.externalEntities);
1777
+ const n = s.parseXml(t);
1778
+ return this.options.preserveOrder || n === void 0 ? n : vt(n, this.options);
1779
+ }
1780
+ /**
1781
+ * Add Entity which is not by default supported by this library
1782
+ * @param {string} key
1783
+ * @param {string} value
1784
+ */
1785
+ addEntity(t, r) {
1786
+ if (r.indexOf("&") !== -1)
1787
+ throw new Error("Entity value can't have '&'");
1788
+ if (t.indexOf("&") !== -1 || t.indexOf(";") !== -1)
1789
+ throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");
1790
+ if (r === "&")
1791
+ throw new Error("An entity with value '&' is not permitted");
1792
+ this.externalEntities[t] = r;
1793
+ }
1794
+ };
1795
+ var At = It;
1796
+ const Ot = `
1797
+ `;
1798
+ function Ct(e, t) {
1799
+ let r = "";
1800
+ return t.format && t.indentBy.length > 0 && (r = Ot), se(e, t, "", r);
1801
+ }
1802
+ function se(e, t, r, s) {
1803
+ let n = "", i = !1;
1804
+ for (let d = 0; d < e.length; d++) {
1805
+ const u = e[d], o = Pt(u);
1806
+ if (o === void 0)
1807
+ continue;
1808
+ let a = "";
1809
+ if (r.length === 0 ? a = o : a = `${r}.${o}`, o === t.textNodeName) {
1810
+ let h = u[o];
1811
+ xt(a, t) || (h = t.tagValueProcessor(o, h), h = oe(h, t)), i && (n += s), n += h, i = !1;
1812
+ continue;
1813
+ } else if (o === t.cdataPropName) {
1814
+ i && (n += s), n += `<![CDATA[${u[o][0][t.textNodeName]}]]>`, i = !1;
1815
+ continue;
1816
+ } else if (o === t.commentPropName) {
1817
+ n += s + `<!--${u[o][0][t.textNodeName]}-->`, i = !0;
1818
+ continue;
1819
+ } else if (o[0] === "?") {
1820
+ const h = K(u[":@"], t), _ = o === "?xml" ? "" : s;
1821
+ let E = u[o][0][t.textNodeName];
1822
+ E = E.length !== 0 ? " " + E : "", n += _ + `<${o}${E}${h}?>`, i = !0;
1823
+ continue;
1824
+ }
1825
+ let l = s;
1826
+ l !== "" && (l += t.indentBy);
1827
+ const f = K(u[":@"], t), c = s + `<${o}${f}`, g = se(u[o], t, a, l);
1828
+ t.unpairedTags.indexOf(o) !== -1 ? t.suppressUnpairedNode ? n += c + ">" : n += c + "/>" : (!g || g.length === 0) && t.suppressEmptyNode ? n += c + "/>" : g && g.endsWith(">") ? n += c + `>${g}${s}</${o}>` : (n += c + ">", g && s !== "" && (g.includes("/>") || g.includes("</")) ? n += s + t.indentBy + g + s : n += g, n += `</${o}>`), i = !0;
1829
+ }
1830
+ return n;
1831
+ }
1832
+ function Pt(e) {
1833
+ const t = Object.keys(e);
1834
+ for (let r = 0; r < t.length; r++) {
1835
+ const s = t[r];
1836
+ if (e.hasOwnProperty(s) && s !== ":@")
1837
+ return s;
1838
+ }
1839
+ }
1840
+ function K(e, t) {
1841
+ let r = "";
1842
+ if (e && !t.ignoreAttributes)
1843
+ for (let s in e) {
1844
+ if (!e.hasOwnProperty(s))
1845
+ continue;
1846
+ let n = t.attributeValueProcessor(s, e[s]);
1847
+ n = oe(n, t), n === !0 && t.suppressBooleanAttributes ? r += ` ${s.substr(t.attributeNamePrefix.length)}` : r += ` ${s.substr(t.attributeNamePrefix.length)}="${n}"`;
1848
+ }
1849
+ return r;
1850
+ }
1851
+ function xt(e, t) {
1852
+ e = e.substr(0, e.length - t.textNodeName.length - 1);
1853
+ let r = e.substr(e.lastIndexOf(".") + 1);
1854
+ for (let s in t.stopNodes)
1855
+ if (t.stopNodes[s] === e || t.stopNodes[s] === "*." + r)
1856
+ return !0;
1857
+ return !1;
1858
+ }
1859
+ function oe(e, t) {
1860
+ if (e && e.length > 0 && t.processEntities)
1861
+ for (let r = 0; r < t.entities.length; r++) {
1862
+ const s = t.entities[r];
1863
+ e = e.replace(s.regex, s.val);
1864
+ }
1865
+ return e;
1866
+ }
1867
+ var $t = Ct;
1868
+ const Ft = $t, Vt = {
1869
+ attributeNamePrefix: "@_",
1870
+ attributesGroupName: !1,
1871
+ textNodeName: "#text",
1872
+ ignoreAttributes: !0,
1873
+ cdataPropName: !1,
1874
+ format: !1,
1875
+ indentBy: " ",
1876
+ suppressEmptyNode: !1,
1877
+ suppressUnpairedNode: !0,
1878
+ suppressBooleanAttributes: !0,
1879
+ tagValueProcessor: function(e, t) {
1880
+ return t;
1881
+ },
1882
+ attributeValueProcessor: function(e, t) {
1883
+ return t;
1884
+ },
1885
+ preserveOrder: !1,
1886
+ commentPropName: !1,
1887
+ unpairedTags: [],
1888
+ entities: [
1889
+ { regex: new RegExp("&", "g"), val: "&amp;" },
1890
+ //it must be on top
1891
+ { regex: new RegExp(">", "g"), val: "&gt;" },
1892
+ { regex: new RegExp("<", "g"), val: "&lt;" },
1893
+ { regex: new RegExp("'", "g"), val: "&apos;" },
1894
+ { regex: new RegExp('"', "g"), val: "&quot;" }
1895
+ ],
1896
+ processEntities: !0,
1897
+ stopNodes: [],
1898
+ // transformTagName: false,
1899
+ // transformAttributeName: false,
1900
+ oneListGroup: !1
1901
+ };
1902
+ function b(e) {
1903
+ this.options = Object.assign({}, Vt, e), this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() {
1904
+ return !1;
1905
+ } : (this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = St), this.processTextOrObjNode = Lt, this.options.format ? (this.indentate = Rt, this.tagEndChar = `>
1906
+ `, this.newLine = `
1907
+ `) : (this.indentate = function() {
1908
+ return "";
1909
+ }, this.tagEndChar = ">", this.newLine = "");
1910
+ }
1911
+ b.prototype.build = function(e) {
1912
+ return this.options.preserveOrder ? Ft(e, this.options) : (Array.isArray(e) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (e = {
1913
+ [this.options.arrayNodeName]: e
1914
+ }), this.j2x(e, 0).val);
1915
+ };
1916
+ b.prototype.j2x = function(e, t) {
1917
+ let r = "", s = "";
1918
+ for (let n in e)
1919
+ if (Object.prototype.hasOwnProperty.call(e, n))
1920
+ if (typeof e[n] > "u")
1921
+ this.isAttribute(n) && (s += "");
1922
+ else if (e[n] === null)
1923
+ this.isAttribute(n) ? s += "" : n[0] === "?" ? s += this.indentate(t) + "<" + n + "?" + this.tagEndChar : s += this.indentate(t) + "<" + n + "/" + this.tagEndChar;
1924
+ else if (e[n] instanceof Date)
1925
+ s += this.buildTextValNode(e[n], n, "", t);
1926
+ else if (typeof e[n] != "object") {
1927
+ const i = this.isAttribute(n);
1928
+ if (i)
1929
+ r += this.buildAttrPairStr(i, "" + e[n]);
1930
+ else if (n === this.options.textNodeName) {
1931
+ let d = this.options.tagValueProcessor(n, "" + e[n]);
1932
+ s += this.replaceEntitiesValue(d);
1933
+ } else
1934
+ s += this.buildTextValNode(e[n], n, "", t);
1935
+ } else if (Array.isArray(e[n])) {
1936
+ const i = e[n].length;
1937
+ let d = "";
1938
+ for (let u = 0; u < i; u++) {
1939
+ const o = e[n][u];
1940
+ typeof o > "u" || (o === null ? n[0] === "?" ? s += this.indentate(t) + "<" + n + "?" + this.tagEndChar : s += this.indentate(t) + "<" + n + "/" + this.tagEndChar : typeof o == "object" ? this.options.oneListGroup ? d += this.j2x(o, t + 1).val : d += this.processTextOrObjNode(o, n, t) : d += this.buildTextValNode(o, n, "", t));
1941
+ }
1942
+ this.options.oneListGroup && (d = this.buildObjectNode(d, n, "", t)), s += d;
1943
+ } else if (this.options.attributesGroupName && n === this.options.attributesGroupName) {
1944
+ const i = Object.keys(e[n]), d = i.length;
1945
+ for (let u = 0; u < d; u++)
1946
+ r += this.buildAttrPairStr(i[u], "" + e[n][i[u]]);
1947
+ } else
1948
+ s += this.processTextOrObjNode(e[n], n, t);
1949
+ return { attrStr: r, val: s };
1950
+ };
1951
+ b.prototype.buildAttrPairStr = function(e, t) {
1952
+ return t = this.options.attributeValueProcessor(e, "" + t), t = this.replaceEntitiesValue(t), this.options.suppressBooleanAttributes && t === "true" ? " " + e : " " + e + '="' + t + '"';
1953
+ };
1954
+ function Lt(e, t, r) {
1955
+ const s = this.j2x(e, r + 1);
1956
+ return e[this.options.textNodeName] !== void 0 && Object.keys(e).length === 1 ? this.buildTextValNode(e[this.options.textNodeName], t, s.attrStr, r) : this.buildObjectNode(s.val, t, s.attrStr, r);
1957
+ }
1958
+ b.prototype.buildObjectNode = function(e, t, r, s) {
1959
+ if (e === "")
1960
+ return t[0] === "?" ? this.indentate(s) + "<" + t + r + "?" + this.tagEndChar : this.indentate(s) + "<" + t + r + this.closeTag(t) + this.tagEndChar;
1961
+ {
1962
+ let n = "</" + t + this.tagEndChar, i = "";
1963
+ return t[0] === "?" && (i = "?", n = ""), (r || r === "") && e.indexOf("<") === -1 ? this.indentate(s) + "<" + t + r + i + ">" + e + n : this.options.commentPropName !== !1 && t === this.options.commentPropName && i.length === 0 ? this.indentate(s) + `<!--${e}-->` + this.newLine : this.indentate(s) + "<" + t + r + i + this.tagEndChar + e + this.indentate(s) + n;
1964
+ }
1965
+ };
1966
+ b.prototype.closeTag = function(e) {
1967
+ let t = "";
1968
+ return this.options.unpairedTags.indexOf(e) !== -1 ? this.options.suppressUnpairedNode || (t = "/") : this.options.suppressEmptyNode ? t = "/" : t = `></${e}`, t;
1969
+ };
1970
+ b.prototype.buildTextValNode = function(e, t, r, s) {
1971
+ if (this.options.cdataPropName !== !1 && t === this.options.cdataPropName)
1972
+ return this.indentate(s) + `<![CDATA[${e}]]>` + this.newLine;
1973
+ if (this.options.commentPropName !== !1 && t === this.options.commentPropName)
1974
+ return this.indentate(s) + `<!--${e}-->` + this.newLine;
1975
+ if (t[0] === "?")
1976
+ return this.indentate(s) + "<" + t + r + "?" + this.tagEndChar;
1977
+ {
1978
+ let n = this.options.tagValueProcessor(t, e);
1979
+ return n = this.replaceEntitiesValue(n), n === "" ? this.indentate(s) + "<" + t + r + this.closeTag(t) + this.tagEndChar : this.indentate(s) + "<" + t + r + ">" + n + "</" + t + this.tagEndChar;
1980
+ }
1981
+ };
1982
+ b.prototype.replaceEntitiesValue = function(e) {
1983
+ if (e && e.length > 0 && this.options.processEntities)
1984
+ for (let t = 0; t < this.options.entities.length; t++) {
1985
+ const r = this.options.entities[t];
1986
+ e = e.replace(r.regex, r.val);
1987
+ }
1988
+ return e;
1989
+ };
1990
+ function Rt(e) {
1991
+ return this.options.indentBy.repeat(e);
1992
+ }
1993
+ function St(e) {
1994
+ return e.startsWith(this.options.attributeNamePrefix) && e !== this.options.textNodeName ? e.substr(this.attrPrefixLen) : !1;
1995
+ }
1996
+ var Mt = b;
1997
+ const Bt = S, kt = At, qt = Mt;
1998
+ var W = {
1999
+ XMLParser: kt,
2000
+ XMLValidator: Bt,
2001
+ XMLBuilder: qt
2002
+ };
2003
+ function Xt(e) {
2004
+ if (typeof e != "string")
2005
+ throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);
2006
+ if (e = e.trim(), e.length === 0 || W.XMLValidator.validate(e) !== !0)
2007
+ return !1;
2008
+ let t;
2009
+ const r = new W.XMLParser();
2010
+ try {
2011
+ t = r.parse(e);
2012
+ } catch {
2013
+ return !1;
2014
+ }
2015
+ return !(!t || !("svg" in t));
2016
+ }
2017
+ /**
2018
+ * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
2019
+ *
2020
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
2021
+ *
2022
+ * @license AGPL-3.0-or-later
2023
+ *
2024
+ * This program is free software: you can redistribute it and/or modify
2025
+ * it under the terms of the GNU Affero General Public License as
2026
+ * published by the Free Software Foundation, either version 3 of the
2027
+ * License, or (at your option) any later version.
2028
+ *
2029
+ * This program is distributed in the hope that it will be useful,
2030
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2031
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2032
+ * GNU Affero General Public License for more details.
2033
+ *
2034
+ * You should have received a copy of the GNU Affero General Public License
2035
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2036
+ *
2037
+ */
2038
+ class cr {
2039
+ _view;
2040
+ constructor(t) {
2041
+ Ut(t), this._view = t;
2042
+ }
2043
+ get id() {
2044
+ return this._view.id;
2045
+ }
2046
+ get name() {
2047
+ return this._view.name;
2048
+ }
2049
+ get caption() {
2050
+ return this._view.caption;
2051
+ }
2052
+ get emptyTitle() {
2053
+ return this._view.emptyTitle;
2054
+ }
2055
+ get emptyCaption() {
2056
+ return this._view.emptyCaption;
2057
+ }
2058
+ get getContents() {
2059
+ return this._view.getContents;
2060
+ }
2061
+ get icon() {
2062
+ return this._view.icon;
2063
+ }
2064
+ set icon(t) {
2065
+ this._view.icon = t;
2066
+ }
2067
+ get order() {
2068
+ return this._view.order;
2069
+ }
2070
+ set order(t) {
2071
+ this._view.order = t;
2072
+ }
2073
+ get params() {
2074
+ return this._view.params;
2075
+ }
2076
+ set params(t) {
2077
+ this._view.params = t;
2078
+ }
2079
+ get columns() {
2080
+ return this._view.columns;
2081
+ }
2082
+ get emptyView() {
2083
+ return this._view.emptyView;
2084
+ }
2085
+ get parent() {
2086
+ return this._view.parent;
2087
+ }
2088
+ get sticky() {
2089
+ return this._view.sticky;
2090
+ }
2091
+ get expanded() {
2092
+ return this._view.expanded;
2093
+ }
2094
+ set expanded(t) {
2095
+ this._view.expanded = t;
2096
+ }
2097
+ get defaultSortKey() {
2098
+ return this._view.defaultSortKey;
2099
+ }
2100
+ }
2101
+ const Ut = function(e) {
2102
+ if (!e.id || typeof e.id != "string")
2103
+ throw new Error("View id is required and must be a string");
2104
+ if (!e.name || typeof e.name != "string")
2105
+ throw new Error("View name is required and must be a string");
2106
+ if (e.columns && e.columns.length > 0 && (!e.caption || typeof e.caption != "string"))
2107
+ throw new Error("View caption is required for top-level views and must be a string");
2108
+ if (!e.getContents || typeof e.getContents != "function")
2109
+ throw new Error("View getContents is required and must be a function");
2110
+ if (!e.icon || typeof e.icon != "string" || !Xt(e.icon))
2111
+ throw new Error("View icon is required and must be a valid svg string");
2112
+ if (!("order" in e) || typeof e.order != "number")
2113
+ throw new Error("View order is required and must be a number");
2114
+ if (e.columns && e.columns.forEach((t) => {
2115
+ if (!(t instanceof Ie))
2116
+ throw new Error("View columns must be an array of Column. Invalid column found");
2117
+ }), e.emptyView && typeof e.emptyView != "function")
2118
+ throw new Error("View emptyView must be a function");
2119
+ if (e.parent && typeof e.parent != "string")
2120
+ throw new Error("View parent must be a string");
2121
+ if ("sticky" in e && typeof e.sticky != "boolean")
2122
+ throw new Error("View sticky must be a boolean");
2123
+ if ("expanded" in e && typeof e.expanded != "boolean")
2124
+ throw new Error("View expanded must be a boolean");
2125
+ if (e.defaultSortKey && typeof e.defaultSortKey != "string")
2126
+ throw new Error("View defaultSortKey must be a string");
2127
+ return !0;
2128
+ };
2129
+ /**
2130
+ * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
2131
+ *
2132
+ * @author Christoph Wurst <christoph@winzerhof-wurst.at>
2133
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
2134
+ *
2135
+ * @license AGPL-3.0-or-later
2136
+ *
2137
+ * This program is free software: you can redistribute it and/or modify
2138
+ * it under the terms of the GNU Affero General Public License as
2139
+ * published by the Free Software Foundation, either version 3 of the
2140
+ * License, or (at your option) any later version.
2141
+ *
2142
+ * This program is distributed in the hope that it will be useful,
2143
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2144
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2145
+ * GNU Affero General Public License for more details.
2146
+ *
2147
+ * You should have received a copy of the GNU Affero General Public License
2148
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2149
+ *
2150
+ */
2151
+ const hr = function(e) {
2152
+ return F().registerEntry(e);
2153
+ }, pr = function(e) {
2154
+ return F().unregisterEntry(e);
2155
+ }, gr = function(e) {
2156
+ return F().getEntries(e).sort((r, s) => r.order !== void 0 && s.order !== void 0 && r.order !== s.order ? r.order - s.order : r.displayName.localeCompare(s.displayName, void 0, { numeric: !0, sensitivity: "base" }));
2157
+ };
2158
+ export {
2159
+ Ie as Column,
2160
+ Z as DefaultType,
2161
+ ye as File,
2162
+ Qt as FileAction,
2163
+ R as FileType,
2164
+ _e as Folder,
2165
+ tr as Header,
2166
+ Te as Navigation,
2167
+ D as Node,
2168
+ Q as NodeStatus,
2169
+ N as Permission,
2170
+ cr as View,
2171
+ hr as addNewFileMenuEntry,
2172
+ ur as davGetClient,
2173
+ sr as davGetDefaultPropfind,
2174
+ Ee as davGetFavoritesReport,
2175
+ or as davGetRecentSearch,
2176
+ be as davParsePermissions,
2177
+ te as davRemoteURL,
2178
+ ve as davResultToNode,
2179
+ ee as davRootPath,
2180
+ Y as defaultDavNamespaces,
2181
+ j as defaultDavProperties,
2182
+ Yt as formatFileSize,
2183
+ L as getDavNameSpaces,
2184
+ V as getDavProperties,
2185
+ dr as getFavoriteNodes,
2186
+ er as getFileActions,
2187
+ nr as getFileListHeaders,
2188
+ ar as getNavigation,
2189
+ gr as getNewFileMenuEntries,
2190
+ Jt as parseFileSize,
2191
+ ir as registerDavProperty,
2192
+ Dt as registerFileAction,
2193
+ rr as registerFileListHeaders,
2194
+ pr as removeNewFileMenuEntry
2195
+ };