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