@nextcloud/files 3.0.1-beta.0 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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 B } 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 ? B().setApp("files").build() : B().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 W = /* @__PURE__ */ ((e) => (e.DEFAULT = "default", e.HIDDEN = "hidden", e))(W || {});
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(W).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 Z = [
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
+ "oc:comments-unread",
363
+ "oc:favorite",
364
+ "oc:fileid",
365
+ "oc:owner-display-name",
366
+ "oc:owner-id",
367
+ "oc:permissions",
368
+ "oc:size"
369
+ ], j = {
370
+ d: "DAV:",
371
+ nc: "http://nextcloud.org/ns",
372
+ oc: "http://owncloud.org/ns",
373
+ ocs: "http://open-collaboration-services.org/ns"
374
+ }, ir = function(e, t = { nc: "http://nextcloud.org/ns" }) {
375
+ typeof window._nc_dav_properties > "u" && (window._nc_dav_properties = [...Z], window._nc_dav_namespaces = { ...j });
376
+ const r = { ...window._nc_dav_namespaces, ...t };
377
+ if (window._nc_dav_properties.find((n) => n === e))
378
+ return m.warn(`${e} already registered`, { prop: e }), !1;
379
+ if (e.startsWith("<") || e.split(":").length !== 2)
380
+ return m.error(`${e} is not valid. See example: 'oc:fileid'`, { prop: e }), !1;
381
+ const s = e.split(":")[0];
382
+ 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);
383
+ }, V = function() {
384
+ return typeof window._nc_dav_properties > "u" && (window._nc_dav_properties = [...Z]), window._nc_dav_properties.map((e) => `<${e} />`).join(" ");
385
+ }, L = function() {
386
+ return typeof window._nc_dav_namespaces > "u" && (window._nc_dav_namespaces = { ...j }), Object.keys(window._nc_dav_namespaces).map((e) => `xmlns:${e}="${window._nc_dav_namespaces?.[e]}"`).join(" ");
387
+ }, sr = function() {
388
+ return `<?xml version="1.0"?>
389
+ <d:propfind ${L()}>
390
+ <d:prop>
391
+ ${V()}
392
+ </d:prop>
393
+ </d:propfind>`;
394
+ }, Ee = function() {
395
+ return `<?xml version="1.0"?>
396
+ <oc:filter-files ${L()}>
397
+ <d:prop>
398
+ ${V()}
399
+ </d:prop>
400
+ <oc:filter-rules>
401
+ <oc:favorite>1</oc:favorite>
402
+ </oc:filter-rules>
403
+ </oc:filter-files>`;
404
+ }, or = function(e) {
405
+ return `<?xml version="1.0" encoding="UTF-8"?>
406
+ <d:searchrequest ${L()}
407
+ xmlns:ns="https://github.com/icewind1991/SearchDAV/ns">
408
+ <d:basicsearch>
409
+ <d:select>
410
+ <d:prop>
411
+ ${V()}
412
+ </d:prop>
413
+ </d:select>
414
+ <d:from>
415
+ <d:scope>
416
+ <d:href>/files/${A()?.uid}/</d:href>
417
+ <d:depth>infinity</d:depth>
418
+ </d:scope>
419
+ </d:from>
420
+ <d:where>
421
+ <d:and>
422
+ <d:or>
423
+ <d:not>
424
+ <d:eq>
425
+ <d:prop>
426
+ <d:getcontenttype/>
427
+ </d:prop>
428
+ <d:literal>httpd/unix-directory</d:literal>
429
+ </d:eq>
430
+ </d:not>
431
+ <d:eq>
432
+ <d:prop>
433
+ <oc:size/>
434
+ </d:prop>
435
+ <d:literal>0</d:literal>
436
+ </d:eq>
437
+ </d:or>
438
+ <d:gt>
439
+ <d:prop>
440
+ <d:getlastmodified/>
441
+ </d:prop>
442
+ <d:literal>${e}</d:literal>
443
+ </d:gt>
444
+ </d:and>
445
+ </d:where>
446
+ <d:orderby>
447
+ <d:order>
448
+ <d:prop>
449
+ <d:getlastmodified/>
450
+ </d:prop>
451
+ <d:descending/>
452
+ </d:order>
453
+ </d:orderby>
454
+ <d:limit>
455
+ <d:nresults>100</d:nresults>
456
+ <ns:firstresult>0</ns:firstresult>
457
+ </d:limit>
458
+ </d:basicsearch>
459
+ </d:searchrequest>`;
460
+ };
461
+ /**
462
+ * @copyright Copyright (c) 2023 John Molakvoæ <skjnldsv@protonmail.com>
463
+ *
464
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
465
+ * @author Ferdinand Thiessen <opensource@fthiessen.de>
466
+ *
467
+ * @license AGPL-3.0-or-later
468
+ *
469
+ * This program is free software: you can redistribute it and/or modify
470
+ * it under the terms of the GNU Affero General Public License as
471
+ * published by the Free Software Foundation, either version 3 of the
472
+ * License, or (at your option) any later version.
473
+ *
474
+ * This program is distributed in the hope that it will be useful,
475
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
476
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
477
+ * GNU Affero General Public License for more details.
478
+ *
479
+ * You should have received a copy of the GNU Affero General Public License
480
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
481
+ *
482
+ */
483
+ const be = function(e = "") {
484
+ let t = N.NONE;
485
+ 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;
486
+ };
487
+ /**
488
+ * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
489
+ *
490
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
491
+ *
492
+ * @license AGPL-3.0-or-later
493
+ *
494
+ * This program is free software: you can redistribute it and/or modify
495
+ * it under the terms of the GNU Affero General Public License as
496
+ * published by the Free Software Foundation, either version 3 of the
497
+ * License, or (at your option) any later version.
498
+ *
499
+ * This program is distributed in the hope that it will be useful,
500
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
501
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
502
+ * GNU Affero General Public License for more details.
503
+ *
504
+ * You should have received a copy of the GNU Affero General Public License
505
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
506
+ *
507
+ */
508
+ var S = /* @__PURE__ */ ((e) => (e.Folder = "folder", e.File = "file", e))(S || {});
509
+ /**
510
+ * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
511
+ *
512
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
513
+ *
514
+ * @license AGPL-3.0-or-later
515
+ *
516
+ * This program is free software: you can redistribute it and/or modify
517
+ * it under the terms of the GNU Affero General Public License as
518
+ * published by the Free Software Foundation, either version 3 of the
519
+ * License, or (at your option) any later version.
520
+ *
521
+ * This program is distributed in the hope that it will be useful,
522
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
523
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
524
+ * GNU Affero General Public License for more details.
525
+ *
526
+ * You should have received a copy of the GNU Affero General Public License
527
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
528
+ *
529
+ */
530
+ const Y = function(e, t) {
531
+ return e.match(t) !== null;
532
+ }, q = (e, t) => {
533
+ if (e.id && typeof e.id != "number")
534
+ throw new Error("Invalid id type of value");
535
+ if (!e.source)
536
+ throw new Error("Missing mandatory source");
537
+ try {
538
+ new URL(e.source);
539
+ } catch {
540
+ throw new Error("Invalid source format, source must be a valid URL");
541
+ }
542
+ if (!e.source.startsWith("http"))
543
+ throw new Error("Invalid source format, only http(s) is supported");
544
+ if (e.mtime && !(e.mtime instanceof Date))
545
+ throw new Error("Invalid mtime type");
546
+ if (e.crtime && !(e.crtime instanceof Date))
547
+ throw new Error("Invalid crtime type");
548
+ if (!e.mime || typeof e.mime != "string" || !e.mime.match(/^[-\w.]+\/[-+\w.]+$/gi))
549
+ throw new Error("Missing or invalid mandatory mime");
550
+ if ("size" in e && typeof e.size != "number" && e.size !== void 0)
551
+ throw new Error("Invalid size type");
552
+ if ("permissions" in e && e.permissions !== void 0 && !(typeof e.permissions == "number" && e.permissions >= N.NONE && e.permissions <= N.ALL))
553
+ throw new Error("Invalid permissions");
554
+ if (e.owner && e.owner !== null && typeof e.owner != "string")
555
+ throw new Error("Invalid owner type");
556
+ if (e.attributes && typeof e.attributes != "object")
557
+ throw new Error("Invalid attributes type");
558
+ if (e.root && typeof e.root != "string")
559
+ throw new Error("Invalid root type");
560
+ if (e.root && !e.root.startsWith("/"))
561
+ throw new Error("Root must start with a leading slash");
562
+ if (e.root && !e.source.includes(e.root))
563
+ throw new Error("Root must be part of the source");
564
+ if (e.root && Y(e.source, t)) {
565
+ const r = e.source.match(t)[0];
566
+ if (!e.source.includes(le(r, e.root)))
567
+ throw new Error("The root must be relative to the service. e.g /files/emma");
568
+ }
569
+ if (e.status && !Object.values(J).includes(e.status))
570
+ throw new Error("Status must be a valid NodeStatus");
571
+ };
572
+ /**
573
+ * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
574
+ *
575
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
576
+ *
577
+ * @license AGPL-3.0-or-later
578
+ *
579
+ * This program is free software: you can redistribute it and/or modify
580
+ * it under the terms of the GNU Affero General Public License as
581
+ * published by the Free Software Foundation, either version 3 of the
582
+ * License, or (at your option) any later version.
583
+ *
584
+ * This program is distributed in the hope that it will be useful,
585
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
586
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
587
+ * GNU Affero General Public License for more details.
588
+ *
589
+ * You should have received a copy of the GNU Affero General Public License
590
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
591
+ *
592
+ */
593
+ var J = /* @__PURE__ */ ((e) => (e.NEW = "new", e.FAILED = "failed", e.LOADING = "loading", e.LOCKED = "locked", e))(J || {});
594
+ class Q {
595
+ _data;
596
+ _attributes;
597
+ _knownDavService = /(remote|public)\.php\/(web)?dav/i;
598
+ constructor(t, r) {
599
+ q(t, r || this._knownDavService), this._data = t;
600
+ const s = {
601
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
602
+ set: (n, i, d) => (this.updateMtime(), Reflect.set(n, i, d)),
603
+ deleteProperty: (n, i) => (this.updateMtime(), Reflect.deleteProperty(n, i))
604
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
605
+ };
606
+ this._attributes = new Proxy(t.attributes || {}, s), delete this._data.attributes, r && (this._knownDavService = r);
607
+ }
608
+ /**
609
+ * Get the source url to this object
610
+ */
611
+ get source() {
612
+ return this._data.source.replace(/\/$/i, "");
613
+ }
614
+ /**
615
+ * Get the encoded source url to this object for requests purposes
616
+ */
617
+ get encodedSource() {
618
+ const { origin: t } = new URL(this.source);
619
+ return t + he(this.source.slice(t.length));
620
+ }
621
+ /**
622
+ * Get this object name
623
+ */
624
+ get basename() {
625
+ return fe(this.source);
626
+ }
627
+ /**
628
+ * Get this object's extension
629
+ */
630
+ get extension() {
631
+ return ce(this.source);
632
+ }
633
+ /**
634
+ * Get the directory path leading to this object
635
+ * Will use the relative path to root if available
636
+ */
637
+ get dirname() {
638
+ if (this.root) {
639
+ let r = this.source;
640
+ this.isDavRessource && (r = r.split(this._knownDavService).pop());
641
+ const s = r.indexOf(this.root), n = this.root.replace(/\/$/, "");
642
+ return I(r.slice(s + n.length) || "/");
643
+ }
644
+ const t = new URL(this.source);
645
+ return I(t.pathname);
646
+ }
647
+ /**
648
+ * Get the file mime
649
+ */
650
+ get mime() {
651
+ return this._data.mime;
652
+ }
653
+ /**
654
+ * Get the file modification time
655
+ */
656
+ get mtime() {
657
+ return this._data.mtime;
658
+ }
659
+ /**
660
+ * Get the file creation time
661
+ */
662
+ get crtime() {
663
+ return this._data.crtime;
664
+ }
665
+ /**
666
+ * Get the file size
667
+ */
668
+ get size() {
669
+ return this._data.size;
670
+ }
671
+ /**
672
+ * Get the file attribute
673
+ */
674
+ get attributes() {
675
+ return this._attributes;
676
+ }
677
+ /**
678
+ * Get the file permissions
679
+ */
680
+ get permissions() {
681
+ return this.owner === null && !this.isDavRessource ? N.READ : this._data.permissions !== void 0 ? this._data.permissions : N.NONE;
682
+ }
683
+ /**
684
+ * Get the file owner
685
+ */
686
+ get owner() {
687
+ return this.isDavRessource ? this._data.owner : null;
688
+ }
689
+ /**
690
+ * Is this a dav-related ressource ?
691
+ */
692
+ get isDavRessource() {
693
+ return Y(this.source, this._knownDavService);
694
+ }
695
+ /**
696
+ * Get the dav root of this object
697
+ */
698
+ get root() {
699
+ return this._data.root ? this._data.root.replace(/^(.+)\/$/, "$1") : this.isDavRessource && I(this.source).split(this._knownDavService).pop() || null;
700
+ }
701
+ /**
702
+ * Get the absolute path of this object relative to the root
703
+ */
704
+ get path() {
705
+ if (this.root) {
706
+ let t = this.source;
707
+ this.isDavRessource && (t = t.split(this._knownDavService).pop());
708
+ const r = t.indexOf(this.root), s = this.root.replace(/\/$/, "");
709
+ return t.slice(r + s.length) || "/";
710
+ }
711
+ return (this.dirname + "/" + this.basename).replace(/\/\//g, "/");
712
+ }
713
+ /**
714
+ * Get the node id if defined.
715
+ * Will look for the fileid in attributes if undefined.
716
+ */
717
+ get fileid() {
718
+ return this._data?.id || this.attributes?.fileid;
719
+ }
720
+ /**
721
+ * Get the node status.
722
+ */
723
+ get status() {
724
+ return this._data?.status;
725
+ }
726
+ /**
727
+ * Set the node status.
728
+ */
729
+ set status(t) {
730
+ this._data.status = t;
731
+ }
732
+ /**
733
+ * Move the node to a new destination
734
+ *
735
+ * @param {string} destination the new source.
736
+ * e.g. https://cloud.domain.com/remote.php/dav/files/emma/Photos/picture.jpg
737
+ */
738
+ move(t) {
739
+ q({ ...this._data, source: t }, this._knownDavService), this._data.source = t, this.updateMtime();
740
+ }
741
+ /**
742
+ * Rename the node
743
+ * This aliases the move method for easier usage
744
+ *
745
+ * @param basename The new name of the node
746
+ */
747
+ rename(t) {
748
+ if (t.includes("/"))
749
+ throw new Error("Invalid basename");
750
+ this.move(I(this.source) + "/" + t);
751
+ }
752
+ /**
753
+ * Update the mtime if exists.
754
+ */
755
+ updateMtime() {
756
+ this._data.mtime && (this._data.mtime = /* @__PURE__ */ new Date());
757
+ }
758
+ }
759
+ /**
760
+ * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
761
+ *
762
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
763
+ *
764
+ * @license AGPL-3.0-or-later
765
+ *
766
+ * This program is free software: you can redistribute it and/or modify
767
+ * it under the terms of the GNU Affero General Public License as
768
+ * published by the Free Software Foundation, either version 3 of the
769
+ * License, or (at your option) any later version.
770
+ *
771
+ * This program is distributed in the hope that it will be useful,
772
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
773
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
774
+ * GNU Affero General Public License for more details.
775
+ *
776
+ * You should have received a copy of the GNU Affero General Public License
777
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
778
+ *
779
+ */
780
+ class ye extends Q {
781
+ get type() {
782
+ return S.File;
783
+ }
784
+ }
785
+ /**
786
+ * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
787
+ *
788
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
789
+ *
790
+ * @license AGPL-3.0-or-later
791
+ *
792
+ * This program is free software: you can redistribute it and/or modify
793
+ * it under the terms of the GNU Affero General Public License as
794
+ * published by the Free Software Foundation, either version 3 of the
795
+ * License, or (at your option) any later version.
796
+ *
797
+ * This program is distributed in the hope that it will be useful,
798
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
799
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
800
+ * GNU Affero General Public License for more details.
801
+ *
802
+ * You should have received a copy of the GNU Affero General Public License
803
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
804
+ *
805
+ */
806
+ class _e extends Q {
807
+ constructor(t) {
808
+ super({
809
+ ...t,
810
+ mime: "httpd/unix-directory"
811
+ });
812
+ }
813
+ get type() {
814
+ return S.Folder;
815
+ }
816
+ get extension() {
817
+ return null;
818
+ }
819
+ get mime() {
820
+ return "httpd/unix-directory";
821
+ }
822
+ }
823
+ /**
824
+ * @copyright Copyright (c) 2023 John Molakvoæ <skjnldsv@protonmail.com>
825
+ *
826
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
827
+ * @author Ferdinand Thiessen <opensource@fthiessen.de>
828
+ *
829
+ * @license AGPL-3.0-or-later
830
+ *
831
+ * This program is free software: you can redistribute it and/or modify
832
+ * it under the terms of the GNU Affero General Public License as
833
+ * published by the Free Software Foundation, either version 3 of the
834
+ * License, or (at your option) any later version.
835
+ *
836
+ * This program is distributed in the hope that it will be useful,
837
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
838
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
839
+ * GNU Affero General Public License for more details.
840
+ *
841
+ * You should have received a copy of the GNU Affero General Public License
842
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
843
+ *
844
+ */
845
+ const D = `/files/${A()?.uid}`, ee = pe("dav"), ur = function(e = ee, t = {}) {
846
+ const r = ge(e, { headers: t });
847
+ function s(i) {
848
+ r.setHeaders({
849
+ ...t,
850
+ // Add this so the server knows it is an request from the browser
851
+ "X-Requested-With": "XMLHttpRequest",
852
+ // Inject user auth
853
+ requesttoken: i ?? ""
854
+ });
855
+ }
856
+ return ue(s), s(de()), we().patch("fetch", (i, d) => {
857
+ const u = d.headers;
858
+ return u?.method && (d.method = u.method, delete u.method), fetch(i, d);
859
+ }), r;
860
+ }, dr = async (e, t = "/", r = D) => (await e.getDirectoryContents(`${r}${t}`, {
861
+ details: !0,
862
+ data: Ee(),
863
+ headers: {
864
+ // see davGetClient for patched webdav client
865
+ method: "REPORT"
866
+ },
867
+ includeSelf: !0
868
+ })).data.filter((n) => n.filename !== t).map((n) => ve(n, r)), ve = function(e, t = D, r = ee) {
869
+ const s = A()?.uid;
870
+ if (!s)
871
+ throw new Error("No user id found");
872
+ const n = e.props, i = be(n?.permissions), d = (n?.["owner-id"] || s).toString(), u = {
873
+ id: n?.fileid || 0,
874
+ source: `${r}${e.filename}`,
875
+ mtime: new Date(Date.parse(e.lastmod)),
876
+ mime: e.mime || "application/octet-stream",
877
+ size: n?.size || Number.parseInt(n.getcontentlength || "0"),
878
+ permissions: i,
879
+ owner: d,
880
+ root: t,
881
+ attributes: {
882
+ ...e,
883
+ ...n,
884
+ hasPreview: n?.["has-preview"]
885
+ }
886
+ };
887
+ return delete u.attributes?.props, e.type === "file" ? new ye(u) : new _e(u);
888
+ };
889
+ /**
890
+ * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
891
+ *
892
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
893
+ *
894
+ * @license AGPL-3.0-or-later
895
+ *
896
+ * This program is free software: you can redistribute it and/or modify
897
+ * it under the terms of the GNU Affero General Public License as
898
+ * published by the Free Software Foundation, either version 3 of the
899
+ * License, or (at your option) any later version.
900
+ *
901
+ * This program is distributed in the hope that it will be useful,
902
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
903
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
904
+ * GNU Affero General Public License for more details.
905
+ *
906
+ * You should have received a copy of the GNU Affero General Public License
907
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
908
+ *
909
+ */
910
+ class Te {
911
+ _views = [];
912
+ _currentView = null;
913
+ register(t) {
914
+ if (this._views.find((r) => r.id === t.id))
915
+ throw new Error(`View id ${t.id} is already registered`);
916
+ this._views.push(t);
917
+ }
918
+ remove(t) {
919
+ const r = this._views.findIndex((s) => s.id === t);
920
+ r !== -1 && this._views.splice(r, 1);
921
+ }
922
+ get views() {
923
+ return this._views;
924
+ }
925
+ setActive(t) {
926
+ this._currentView = t;
927
+ }
928
+ get active() {
929
+ return this._currentView;
930
+ }
931
+ }
932
+ const ar = function() {
933
+ return typeof window._nc_navigation > "u" && (window._nc_navigation = new Te(), m.debug("Navigation service initialized")), window._nc_navigation;
934
+ };
935
+ /**
936
+ * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
937
+ *
938
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
939
+ *
940
+ * @license AGPL-3.0-or-later
941
+ *
942
+ * This program is free software: you can redistribute it and/or modify
943
+ * it under the terms of the GNU Affero General Public License as
944
+ * published by the Free Software Foundation, either version 3 of the
945
+ * License, or (at your option) any later version.
946
+ *
947
+ * This program is distributed in the hope that it will be useful,
948
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
949
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
950
+ * GNU Affero General Public License for more details.
951
+ *
952
+ * You should have received a copy of the GNU Affero General Public License
953
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
954
+ *
955
+ */
956
+ class Ie {
957
+ _column;
958
+ constructor(t) {
959
+ Ae(t), this._column = t;
960
+ }
961
+ get id() {
962
+ return this._column.id;
963
+ }
964
+ get title() {
965
+ return this._column.title;
966
+ }
967
+ get render() {
968
+ return this._column.render;
969
+ }
970
+ get sort() {
971
+ return this._column.sort;
972
+ }
973
+ get summary() {
974
+ return this._column.summary;
975
+ }
976
+ }
977
+ const Ae = function(e) {
978
+ if (!e.id || typeof e.id != "string")
979
+ throw new Error("A column id is required");
980
+ if (!e.title || typeof e.title != "string")
981
+ throw new Error("A column title is required");
982
+ if (!e.render || typeof e.render != "function")
983
+ throw new Error("A render function is required");
984
+ if (e.sort && typeof e.sort != "function")
985
+ throw new Error("Column sortFunction must be a function");
986
+ if (e.summary && typeof e.summary != "function")
987
+ throw new Error("Column summary must be a function");
988
+ return !0;
989
+ };
990
+ var R = {}, O = {};
991
+ (function(e) {
992
+ 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) {
993
+ const a = [];
994
+ let l = o.exec(u);
995
+ for (; l; ) {
996
+ const f = [];
997
+ f.startIndex = o.lastIndex - l[0].length;
998
+ const c = l.length;
999
+ for (let g = 0; g < c; g++)
1000
+ f.push(l[g]);
1001
+ a.push(f), l = o.exec(u);
1002
+ }
1003
+ return a;
1004
+ }, d = function(u) {
1005
+ const o = n.exec(u);
1006
+ return !(o === null || typeof o > "u");
1007
+ };
1008
+ e.isExist = function(u) {
1009
+ return typeof u < "u";
1010
+ }, e.isEmptyObject = function(u) {
1011
+ return Object.keys(u).length === 0;
1012
+ }, e.merge = function(u, o, a) {
1013
+ if (o) {
1014
+ const l = Object.keys(o), f = l.length;
1015
+ for (let c = 0; c < f; c++)
1016
+ a === "strict" ? u[l[c]] = [o[l[c]]] : u[l[c]] = o[l[c]];
1017
+ }
1018
+ }, e.getValue = function(u) {
1019
+ return e.isExist(u) ? u : "";
1020
+ }, e.isName = d, e.getAllMatches = i, e.nameRegexp = s;
1021
+ })(O);
1022
+ const M = O, Oe = {
1023
+ allowBooleanAttributes: !1,
1024
+ //A tag can have attributes without any value
1025
+ unpairedTags: []
1026
+ };
1027
+ R.validate = function(e, t) {
1028
+ t = Object.assign({}, Oe, t);
1029
+ const r = [];
1030
+ let s = !1, n = !1;
1031
+ e[0] === "\uFEFF" && (e = e.substr(1));
1032
+ for (let i = 0; i < e.length; i++)
1033
+ if (e[i] === "<" && e[i + 1] === "?") {
1034
+ if (i += 2, i = U(e, i), i.err)
1035
+ return i;
1036
+ } else if (e[i] === "<") {
1037
+ let d = i;
1038
+ if (i++, e[i] === "!") {
1039
+ i = G(e, i);
1040
+ continue;
1041
+ } else {
1042
+ let u = !1;
1043
+ e[i] === "/" && (u = !0, i++);
1044
+ let o = "";
1045
+ for (; i < e.length && e[i] !== ">" && e[i] !== " " && e[i] !== " " && e[i] !== `
1046
+ ` && e[i] !== "\r"; i++)
1047
+ o += e[i];
1048
+ if (o = o.trim(), o[o.length - 1] === "/" && (o = o.substring(0, o.length - 1), i--), !Se(o)) {
1049
+ let f;
1050
+ return o.trim().length === 0 ? f = "Invalid space after '<'." : f = "Tag '" + o + "' is an invalid name.", p("InvalidTag", f, w(e, i));
1051
+ }
1052
+ const a = xe(e, i);
1053
+ if (a === !1)
1054
+ return p("InvalidAttr", "Attributes for '" + o + "' have open quote.", w(e, i));
1055
+ let l = a.value;
1056
+ if (i = a.index, l[l.length - 1] === "/") {
1057
+ const f = i - l.length;
1058
+ l = l.substring(0, l.length - 1);
1059
+ const c = z(l, t);
1060
+ if (c === !0)
1061
+ s = !0;
1062
+ else
1063
+ return p(c.err.code, c.err.msg, w(e, f + c.err.line));
1064
+ } else if (u)
1065
+ if (a.tagClosed) {
1066
+ if (l.trim().length > 0)
1067
+ return p("InvalidTag", "Closing tag '" + o + "' can't have attributes or invalid starting.", w(e, d));
1068
+ {
1069
+ const f = r.pop();
1070
+ if (o !== f.tagName) {
1071
+ let c = w(e, f.tagStartPos);
1072
+ return p(
1073
+ "InvalidTag",
1074
+ "Expected closing tag '" + f.tagName + "' (opened in line " + c.line + ", col " + c.col + ") instead of closing tag '" + o + "'.",
1075
+ w(e, d)
1076
+ );
1077
+ }
1078
+ r.length == 0 && (n = !0);
1079
+ }
1080
+ } else
1081
+ return p("InvalidTag", "Closing tag '" + o + "' doesn't have proper closing.", w(e, i));
1082
+ else {
1083
+ const f = z(l, t);
1084
+ if (f !== !0)
1085
+ return p(f.err.code, f.err.msg, w(e, i - l.length + f.err.line));
1086
+ if (n === !0)
1087
+ return p("InvalidXml", "Multiple possible root nodes found.", w(e, i));
1088
+ t.unpairedTags.indexOf(o) !== -1 || r.push({ tagName: o, tagStartPos: d }), s = !0;
1089
+ }
1090
+ for (i++; i < e.length; i++)
1091
+ if (e[i] === "<")
1092
+ if (e[i + 1] === "!") {
1093
+ i++, i = G(e, i);
1094
+ continue;
1095
+ } else if (e[i + 1] === "?") {
1096
+ if (i = U(e, ++i), i.err)
1097
+ return i;
1098
+ } else
1099
+ break;
1100
+ else if (e[i] === "&") {
1101
+ const f = Ve(e, i);
1102
+ if (f == -1)
1103
+ return p("InvalidChar", "char '&' is not expected.", w(e, i));
1104
+ i = f;
1105
+ } else if (n === !0 && !X(e[i]))
1106
+ return p("InvalidXml", "Extra text at the end", w(e, i));
1107
+ e[i] === "<" && i--;
1108
+ }
1109
+ } else {
1110
+ if (X(e[i]))
1111
+ continue;
1112
+ return p("InvalidChar", "char '" + e[i] + "' is not expected.", w(e, i));
1113
+ }
1114
+ if (s) {
1115
+ if (r.length == 1)
1116
+ return p("InvalidTag", "Unclosed tag '" + r[0].tagName + "'.", w(e, r[0].tagStartPos));
1117
+ if (r.length > 0)
1118
+ return p("InvalidXml", "Invalid '" + JSON.stringify(r.map((i) => i.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 });
1119
+ } else
1120
+ return p("InvalidXml", "Start tag expected.", 1);
1121
+ return !0;
1122
+ };
1123
+ function X(e) {
1124
+ return e === " " || e === " " || e === `
1125
+ ` || e === "\r";
1126
+ }
1127
+ function U(e, t) {
1128
+ const r = t;
1129
+ for (; t < e.length; t++)
1130
+ if (e[t] == "?" || e[t] == " ") {
1131
+ const s = e.substr(r, t - r);
1132
+ if (t > 5 && s === "xml")
1133
+ return p("InvalidXml", "XML declaration allowed only at the start of the document.", w(e, t));
1134
+ if (e[t] == "?" && e[t + 1] == ">") {
1135
+ t++;
1136
+ break;
1137
+ } else
1138
+ continue;
1139
+ }
1140
+ return t;
1141
+ }
1142
+ function G(e, t) {
1143
+ if (e.length > t + 5 && e[t + 1] === "-" && e[t + 2] === "-") {
1144
+ for (t += 3; t < e.length; t++)
1145
+ if (e[t] === "-" && e[t + 1] === "-" && e[t + 2] === ">") {
1146
+ t += 2;
1147
+ break;
1148
+ }
1149
+ } 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") {
1150
+ let r = 1;
1151
+ for (t += 8; t < e.length; t++)
1152
+ if (e[t] === "<")
1153
+ r++;
1154
+ else if (e[t] === ">" && (r--, r === 0))
1155
+ break;
1156
+ } 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] === "[") {
1157
+ for (t += 8; t < e.length; t++)
1158
+ if (e[t] === "]" && e[t + 1] === "]" && e[t + 2] === ">") {
1159
+ t += 2;
1160
+ break;
1161
+ }
1162
+ }
1163
+ return t;
1164
+ }
1165
+ const Ce = '"', Pe = "'";
1166
+ function xe(e, t) {
1167
+ let r = "", s = "", n = !1;
1168
+ for (; t < e.length; t++) {
1169
+ if (e[t] === Ce || e[t] === Pe)
1170
+ s === "" ? s = e[t] : s !== e[t] || (s = "");
1171
+ else if (e[t] === ">" && s === "") {
1172
+ n = !0;
1173
+ break;
1174
+ }
1175
+ r += e[t];
1176
+ }
1177
+ return s !== "" ? !1 : {
1178
+ value: r,
1179
+ index: t,
1180
+ tagClosed: n
1181
+ };
1182
+ }
1183
+ const $e = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
1184
+ function z(e, t) {
1185
+ const r = M.getAllMatches(e, $e), s = {};
1186
+ for (let n = 0; n < r.length; n++) {
1187
+ if (r[n][1].length === 0)
1188
+ return p("InvalidAttr", "Attribute '" + r[n][2] + "' has no space in starting.", v(r[n]));
1189
+ if (r[n][3] !== void 0 && r[n][4] === void 0)
1190
+ return p("InvalidAttr", "Attribute '" + r[n][2] + "' is without value.", v(r[n]));
1191
+ if (r[n][3] === void 0 && !t.allowBooleanAttributes)
1192
+ return p("InvalidAttr", "boolean attribute '" + r[n][2] + "' is not allowed.", v(r[n]));
1193
+ const i = r[n][2];
1194
+ if (!Le(i))
1195
+ return p("InvalidAttr", "Attribute '" + i + "' is an invalid name.", v(r[n]));
1196
+ if (!s.hasOwnProperty(i))
1197
+ s[i] = 1;
1198
+ else
1199
+ return p("InvalidAttr", "Attribute '" + i + "' is repeated.", v(r[n]));
1200
+ }
1201
+ return !0;
1202
+ }
1203
+ function Fe(e, t) {
1204
+ let r = /\d/;
1205
+ for (e[t] === "x" && (t++, r = /[\da-fA-F]/); t < e.length; t++) {
1206
+ if (e[t] === ";")
1207
+ return t;
1208
+ if (!e[t].match(r))
1209
+ break;
1210
+ }
1211
+ return -1;
1212
+ }
1213
+ function Ve(e, t) {
1214
+ if (t++, e[t] === ";")
1215
+ return -1;
1216
+ if (e[t] === "#")
1217
+ return t++, Fe(e, t);
1218
+ let r = 0;
1219
+ for (; t < e.length; t++, r++)
1220
+ if (!(e[t].match(/\w/) && r < 20)) {
1221
+ if (e[t] === ";")
1222
+ break;
1223
+ return -1;
1224
+ }
1225
+ return t;
1226
+ }
1227
+ function p(e, t, r) {
1228
+ return {
1229
+ err: {
1230
+ code: e,
1231
+ msg: t,
1232
+ line: r.line || r,
1233
+ col: r.col
1234
+ }
1235
+ };
1236
+ }
1237
+ function Le(e) {
1238
+ return M.isName(e);
1239
+ }
1240
+ function Se(e) {
1241
+ return M.isName(e);
1242
+ }
1243
+ function w(e, t) {
1244
+ const r = e.substring(0, t).split(/\r?\n/);
1245
+ return {
1246
+ line: r.length,
1247
+ // column number is last line's length + 1, because column numbering starts at 1:
1248
+ col: r[r.length - 1].length + 1
1249
+ };
1250
+ }
1251
+ function v(e) {
1252
+ return e.startIndex + e[1].length;
1253
+ }
1254
+ var k = {};
1255
+ const te = {
1256
+ preserveOrder: !1,
1257
+ attributeNamePrefix: "@_",
1258
+ attributesGroupName: !1,
1259
+ textNodeName: "#text",
1260
+ ignoreAttributes: !0,
1261
+ removeNSPrefix: !1,
1262
+ // remove NS from tag name or attribute name if true
1263
+ allowBooleanAttributes: !1,
1264
+ //a tag can have attributes without any value
1265
+ //ignoreRootElement : false,
1266
+ parseTagValue: !0,
1267
+ parseAttributeValue: !1,
1268
+ trimValues: !0,
1269
+ //Trim string values of tag and attributes
1270
+ cdataPropName: !1,
1271
+ numberParseOptions: {
1272
+ hex: !0,
1273
+ leadingZeros: !0,
1274
+ eNotation: !0
1275
+ },
1276
+ tagValueProcessor: function(e, t) {
1277
+ return t;
1278
+ },
1279
+ attributeValueProcessor: function(e, t) {
1280
+ return t;
1281
+ },
1282
+ stopNodes: [],
1283
+ //nested tags will not be parsed even for errors
1284
+ alwaysCreateTextNode: !1,
1285
+ isArray: () => !1,
1286
+ commentPropName: !1,
1287
+ unpairedTags: [],
1288
+ processEntities: !0,
1289
+ htmlEntities: !1,
1290
+ ignoreDeclaration: !1,
1291
+ ignorePiTags: !1,
1292
+ transformTagName: !1,
1293
+ transformAttributeName: !1,
1294
+ updateTag: function(e, t, r) {
1295
+ return e;
1296
+ }
1297
+ // skipEmptyListItem: false
1298
+ }, Re = function(e) {
1299
+ return Object.assign({}, te, e);
1300
+ };
1301
+ k.buildOptions = Re;
1302
+ k.defaultOptions = te;
1303
+ class Me {
1304
+ constructor(t) {
1305
+ this.tagname = t, this.child = [], this[":@"] = {};
1306
+ }
1307
+ add(t, r) {
1308
+ t === "__proto__" && (t = "#__proto__"), this.child.push({ [t]: r });
1309
+ }
1310
+ addChild(t) {
1311
+ 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 });
1312
+ }
1313
+ }
1314
+ var ke = Me;
1315
+ const Be = O;
1316
+ function qe(e, t) {
1317
+ const r = {};
1318
+ 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") {
1319
+ t = t + 9;
1320
+ let s = 1, n = !1, i = !1, d = "";
1321
+ for (; t < e.length; t++)
1322
+ if (e[t] === "<" && !i) {
1323
+ if (n && Ge(e, t))
1324
+ t += 7, [entityName, val, t] = Xe(e, t + 1), val.indexOf("&") === -1 && (r[We(entityName)] = {
1325
+ regx: RegExp(`&${entityName};`, "g"),
1326
+ val
1327
+ });
1328
+ else if (n && ze(e, t))
1329
+ t += 8;
1330
+ else if (n && He(e, t))
1331
+ t += 8;
1332
+ else if (n && Ke(e, t))
1333
+ t += 9;
1334
+ else if (Ue)
1335
+ i = !0;
1336
+ else
1337
+ throw new Error("Invalid DOCTYPE");
1338
+ s++, d = "";
1339
+ } else if (e[t] === ">") {
1340
+ if (i ? e[t - 1] === "-" && e[t - 2] === "-" && (i = !1, s--) : s--, s === 0)
1341
+ break;
1342
+ } else
1343
+ e[t] === "[" ? n = !0 : d += e[t];
1344
+ if (s !== 0)
1345
+ throw new Error("Unclosed DOCTYPE");
1346
+ } else
1347
+ throw new Error("Invalid Tag instead of DOCTYPE");
1348
+ return { entities: r, i: t };
1349
+ }
1350
+ function Xe(e, t) {
1351
+ let r = "";
1352
+ for (; t < e.length && e[t] !== "'" && e[t] !== '"'; t++)
1353
+ r += e[t];
1354
+ if (r = r.trim(), r.indexOf(" ") !== -1)
1355
+ throw new Error("External entites are not supported");
1356
+ const s = e[t++];
1357
+ let n = "";
1358
+ for (; t < e.length && e[t] !== s; t++)
1359
+ n += e[t];
1360
+ return [r, n, t];
1361
+ }
1362
+ function Ue(e, t) {
1363
+ return e[t + 1] === "!" && e[t + 2] === "-" && e[t + 3] === "-";
1364
+ }
1365
+ function Ge(e, t) {
1366
+ 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";
1367
+ }
1368
+ function ze(e, t) {
1369
+ 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";
1370
+ }
1371
+ function He(e, t) {
1372
+ 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";
1373
+ }
1374
+ function Ke(e, t) {
1375
+ 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";
1376
+ }
1377
+ function We(e) {
1378
+ if (Be.isName(e))
1379
+ return e;
1380
+ throw new Error(`Invalid entity name ${e}`);
1381
+ }
1382
+ var Ze = qe;
1383
+ const je = /^[-+]?0x[a-fA-F0-9]+$/, Ye = /^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;
1384
+ !Number.parseInt && window.parseInt && (Number.parseInt = window.parseInt);
1385
+ !Number.parseFloat && window.parseFloat && (Number.parseFloat = window.parseFloat);
1386
+ const Je = {
1387
+ hex: !0,
1388
+ leadingZeros: !0,
1389
+ decimalPoint: ".",
1390
+ eNotation: !0
1391
+ //skipLike: /regex/
1392
+ };
1393
+ function Qe(e, t = {}) {
1394
+ if (t = Object.assign({}, Je, t), !e || typeof e != "string")
1395
+ return e;
1396
+ let r = e.trim();
1397
+ if (t.skipLike !== void 0 && t.skipLike.test(r))
1398
+ return e;
1399
+ if (t.hex && je.test(r))
1400
+ return Number.parseInt(r, 16);
1401
+ {
1402
+ const s = Ye.exec(r);
1403
+ if (s) {
1404
+ const n = s[1], i = s[2];
1405
+ let d = De(s[3]);
1406
+ const u = s[4] || s[6];
1407
+ if (!t.leadingZeros && i.length > 0 && n && r[2] !== ".")
1408
+ return e;
1409
+ if (!t.leadingZeros && i.length > 0 && !n && r[1] !== ".")
1410
+ return e;
1411
+ {
1412
+ const o = Number(r), a = "" + o;
1413
+ 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;
1414
+ }
1415
+ } else
1416
+ return e;
1417
+ }
1418
+ }
1419
+ function De(e) {
1420
+ 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;
1421
+ }
1422
+ var et = Qe;
1423
+ const re = O, T = ke, tt = Ze, rt = et;
1424
+ let nt = class {
1425
+ constructor(t) {
1426
+ this.options = t, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = {
1427
+ apos: { regex: /&(apos|#39|#x27);/g, val: "'" },
1428
+ gt: { regex: /&(gt|#62|#x3E);/g, val: ">" },
1429
+ lt: { regex: /&(lt|#60|#x3C);/g, val: "<" },
1430
+ quot: { regex: /&(quot|#34|#x22);/g, val: '"' }
1431
+ }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = {
1432
+ space: { regex: /&(nbsp|#160);/g, val: " " },
1433
+ // "lt" : { regex: /&(lt|#60);/g, val: "<" },
1434
+ // "gt" : { regex: /&(gt|#62);/g, val: ">" },
1435
+ // "amp" : { regex: /&(amp|#38);/g, val: "&" },
1436
+ // "quot" : { regex: /&(quot|#34);/g, val: "\"" },
1437
+ // "apos" : { regex: /&(apos|#39);/g, val: "'" },
1438
+ cent: { regex: /&(cent|#162);/g, val: "¢" },
1439
+ pound: { regex: /&(pound|#163);/g, val: "£" },
1440
+ yen: { regex: /&(yen|#165);/g, val: "¥" },
1441
+ euro: { regex: /&(euro|#8364);/g, val: "€" },
1442
+ copyright: { regex: /&(copy|#169);/g, val: "©" },
1443
+ reg: { regex: /&(reg|#174);/g, val: "®" },
1444
+ inr: { regex: /&(inr|#8377);/g, val: "₹" }
1445
+ }, 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;
1446
+ }
1447
+ };
1448
+ function it(e) {
1449
+ const t = Object.keys(e);
1450
+ for (let r = 0; r < t.length; r++) {
1451
+ const s = t[r];
1452
+ this.lastEntities[s] = {
1453
+ regex: new RegExp("&" + s + ";", "g"),
1454
+ val: e[s]
1455
+ };
1456
+ }
1457
+ }
1458
+ function st(e, t, r, s, n, i, d) {
1459
+ if (e !== void 0 && (this.options.trimValues && !s && (e = e.trim()), e.length > 0)) {
1460
+ d || (e = this.replaceEntitiesValue(e));
1461
+ const u = this.options.tagValueProcessor(t, e, r, n, i);
1462
+ 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;
1463
+ }
1464
+ }
1465
+ function ot(e) {
1466
+ if (this.options.removeNSPrefix) {
1467
+ const t = e.split(":"), r = e.charAt(0) === "/" ? "/" : "";
1468
+ if (t[0] === "xmlns")
1469
+ return "";
1470
+ t.length === 2 && (e = r + t[1]);
1471
+ }
1472
+ return e;
1473
+ }
1474
+ const ut = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
1475
+ function dt(e, t, r) {
1476
+ if (!this.options.ignoreAttributes && typeof e == "string") {
1477
+ const s = re.getAllMatches(e, ut), n = s.length, i = {};
1478
+ for (let d = 0; d < n; d++) {
1479
+ const u = this.resolveNameSpace(s[d][1]);
1480
+ let o = s[d][4], a = this.options.attributeNamePrefix + u;
1481
+ if (u.length)
1482
+ if (this.options.transformAttributeName && (a = this.options.transformAttributeName(a)), a === "__proto__" && (a = "#__proto__"), o !== void 0) {
1483
+ this.options.trimValues && (o = o.trim()), o = this.replaceEntitiesValue(o);
1484
+ const l = this.options.attributeValueProcessor(u, o, t);
1485
+ l == null ? i[a] = o : typeof l != typeof o || l !== o ? i[a] = l : i[a] = $(
1486
+ o,
1487
+ this.options.parseAttributeValue,
1488
+ this.options.numberParseOptions
1489
+ );
1490
+ } else
1491
+ this.options.allowBooleanAttributes && (i[a] = !0);
1492
+ }
1493
+ if (!Object.keys(i).length)
1494
+ return;
1495
+ if (this.options.attributesGroupName) {
1496
+ const d = {};
1497
+ return d[this.options.attributesGroupName] = i, d;
1498
+ }
1499
+ return i;
1500
+ }
1501
+ }
1502
+ const at = function(e) {
1503
+ e = e.replace(/\r\n?/g, `
1504
+ `);
1505
+ const t = new T("!xml");
1506
+ let r = t, s = "", n = "";
1507
+ for (let i = 0; i < e.length; i++)
1508
+ if (e[i] === "<")
1509
+ if (e[i + 1] === "/") {
1510
+ const u = y(e, ">", i, "Closing Tag is not closed.");
1511
+ let o = e.substring(i + 2, u).trim();
1512
+ if (this.options.removeNSPrefix) {
1513
+ const f = o.indexOf(":");
1514
+ f !== -1 && (o = o.substr(f + 1));
1515
+ }
1516
+ this.options.transformTagName && (o = this.options.transformTagName(o)), r && (s = this.saveTextToParentTag(s, r, n));
1517
+ const a = n.substring(n.lastIndexOf(".") + 1);
1518
+ if (o && this.options.unpairedTags.indexOf(o) !== -1)
1519
+ throw new Error(`Unpaired tag can not be used as closing tag: </${o}>`);
1520
+ let l = 0;
1521
+ 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;
1522
+ } else if (e[i + 1] === "?") {
1523
+ let u = x(e, i, !1, "?>");
1524
+ if (!u)
1525
+ throw new Error("Pi Tag is not closed.");
1526
+ if (s = this.saveTextToParentTag(s, r, n), !(this.options.ignoreDeclaration && u.tagName === "?xml" || this.options.ignorePiTags)) {
1527
+ const o = new T(u.tagName);
1528
+ o.add(this.options.textNodeName, ""), u.tagName !== u.tagExp && u.attrExpPresent && (o[":@"] = this.buildAttributesMap(u.tagExp, n, u.tagName)), this.addChild(r, o, n);
1529
+ }
1530
+ i = u.closeIndex + 1;
1531
+ } else if (e.substr(i + 1, 3) === "!--") {
1532
+ const u = y(e, "-->", i + 4, "Comment is not closed.");
1533
+ if (this.options.commentPropName) {
1534
+ const o = e.substring(i + 4, u - 2);
1535
+ s = this.saveTextToParentTag(s, r, n), r.add(this.options.commentPropName, [{ [this.options.textNodeName]: o }]);
1536
+ }
1537
+ i = u;
1538
+ } else if (e.substr(i + 1, 2) === "!D") {
1539
+ const u = tt(e, i);
1540
+ this.docTypeEntities = u.entities, i = u.i;
1541
+ } else if (e.substr(i + 1, 2) === "![") {
1542
+ const u = y(e, "]]>", i, "CDATA is not closed.") - 2, o = e.substring(i + 9, u);
1543
+ s = this.saveTextToParentTag(s, r, n);
1544
+ let a = this.parseTextData(o, r.tagname, n, !0, !1, !0, !0);
1545
+ a == null && (a = ""), this.options.cdataPropName ? r.add(this.options.cdataPropName, [{ [this.options.textNodeName]: o }]) : r.add(this.options.textNodeName, a), 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.substring(0, u), i = i.substring(u + 1).trimStart());
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 re.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 } = k, _t = wt, { prettify: vt } = ne, Tt = R;
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 = H(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 = H(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 H(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 = Rt), this.processTextOrObjNode = Lt, this.options.format ? (this.indentate = St, 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 St(e) {
1991
+ return this.options.indentBy.repeat(e);
1992
+ }
1993
+ function Rt(e) {
1994
+ return e.startsWith(this.options.attributeNamePrefix) && e !== this.options.textNodeName ? e.substr(this.attrPrefixLen) : !1;
1995
+ }
1996
+ var Mt = b;
1997
+ const kt = R, Bt = At, qt = Mt;
1998
+ var K = {
1999
+ XMLParser: Bt,
2000
+ XMLValidator: kt,
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 || K.XMLValidator.validate(e) !== !0)
2007
+ return !1;
2008
+ let t;
2009
+ const r = new K.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
+ W as DefaultType,
2161
+ ye as File,
2162
+ Qt as FileAction,
2163
+ S as FileType,
2164
+ _e as Folder,
2165
+ tr as Header,
2166
+ Te as Navigation,
2167
+ Q as Node,
2168
+ J 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
+ ee as davRemoteURL,
2178
+ ve as davResultToNode,
2179
+ D as davRootPath,
2180
+ j as defaultDavNamespaces,
2181
+ Z 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
+ };