@nextcloud/files 3.1.0 → 3.2.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/dav/dav.d.ts +2 -1
- package/dist/index.cjs +260 -251
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +255 -245
- package/dist/index.mjs.map +1 -1
- package/dist/vendor.LICENSE.txt +1 -1
- package/package.json +14 -17
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const _ = require("@nextcloud/auth"),
|
|
3
|
+
const _ = require("@nextcloud/auth"), K = require("@nextcloud/logger"), ge = require("@nextcloud/l10n"), y = require("path"), we = require("@nextcloud/paths"), me = require("@nextcloud/router"), W = require("webdav"), Ne = require("cancelable-promise");
|
|
4
4
|
/**
|
|
5
5
|
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
|
|
6
6
|
*
|
|
@@ -22,7 +22,7 @@ const _ = require("@nextcloud/auth"), W = require("@nextcloud/logger"), ge = req
|
|
|
22
22
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
23
23
|
*
|
|
24
24
|
*/
|
|
25
|
-
const
|
|
25
|
+
const Ee = (e) => e === null ? K.getLoggerBuilder().setApp("files").build() : K.getLoggerBuilder().setApp("files").setUid(e.uid).build(), N = Ee(_.getCurrentUser());
|
|
26
26
|
/**
|
|
27
27
|
* @copyright Copyright (c) 2021 John Molakvoæ <skjnldsv@protonmail.com>
|
|
28
28
|
*
|
|
@@ -44,7 +44,7 @@ const Ne = (e) => e === null ? W.getLoggerBuilder().setApp("files").build() : W.
|
|
|
44
44
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
45
45
|
*
|
|
46
46
|
*/
|
|
47
|
-
class
|
|
47
|
+
class be {
|
|
48
48
|
_entries = [];
|
|
49
49
|
registerEntry(t) {
|
|
50
50
|
this.validateEntry(t), this._entries.push(t);
|
|
@@ -85,8 +85,8 @@ class Ee {
|
|
|
85
85
|
throw new Error("Duplicate entry");
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
const
|
|
89
|
-
return typeof window._nc_newfilemenu > "u" && (window._nc_newfilemenu = new
|
|
88
|
+
const L = function() {
|
|
89
|
+
return typeof window._nc_newfilemenu > "u" && (window._nc_newfilemenu = new be(), N.debug("NewFileMenu initialized")), window._nc_newfilemenu;
|
|
90
90
|
};
|
|
91
91
|
/**
|
|
92
92
|
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
|
|
@@ -119,7 +119,7 @@ function ye(e, t = !1, r = !1, s = !1) {
|
|
|
119
119
|
let a = (e / Math.pow(s ? 1e3 : 1024, n)).toFixed(1);
|
|
120
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
121
|
}
|
|
122
|
-
function
|
|
122
|
+
function ve(e, t = !1) {
|
|
123
123
|
try {
|
|
124
124
|
e = `${e}`.toLocaleLowerCase().replaceAll(/\s+/g, "").replaceAll(",", ".");
|
|
125
125
|
} catch {
|
|
@@ -160,8 +160,8 @@ function be(e, t = !1) {
|
|
|
160
160
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
161
161
|
*
|
|
162
162
|
*/
|
|
163
|
-
var
|
|
164
|
-
class
|
|
163
|
+
var R = /* @__PURE__ */ ((e) => (e.DEFAULT = "default", e.HIDDEN = "hidden", e))(R || {});
|
|
164
|
+
class _e {
|
|
165
165
|
_action;
|
|
166
166
|
constructor(t) {
|
|
167
167
|
this.validateAction(t), this._action = t;
|
|
@@ -221,7 +221,7 @@ class ve {
|
|
|
221
221
|
throw new Error("Invalid order");
|
|
222
222
|
if ("parent" in t && typeof t.parent != "string")
|
|
223
223
|
throw new Error("Invalid parent");
|
|
224
|
-
if (t.default && !Object.values(
|
|
224
|
+
if (t.default && !Object.values(R).includes(t.default))
|
|
225
225
|
throw new Error("Invalid default");
|
|
226
226
|
if ("inline" in t && typeof t.inline != "function")
|
|
227
227
|
throw new Error("Invalid inline function");
|
|
@@ -229,13 +229,13 @@ class ve {
|
|
|
229
229
|
throw new Error("Invalid renderInline function");
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
|
-
const
|
|
232
|
+
const Te = function(e) {
|
|
233
233
|
if (typeof window._nc_fileactions > "u" && (window._nc_fileactions = [], N.debug("FileActions initialized")), window._nc_fileactions.find((t) => t.id === e.id)) {
|
|
234
234
|
N.error(`FileAction ${e.id} already registered`, { action: e });
|
|
235
235
|
return;
|
|
236
236
|
}
|
|
237
237
|
window._nc_fileactions.push(e);
|
|
238
|
-
},
|
|
238
|
+
}, Ie = function() {
|
|
239
239
|
return typeof window._nc_fileactions > "u" && (window._nc_fileactions = [], N.debug("FileActions initialized")), window._nc_fileactions;
|
|
240
240
|
};
|
|
241
241
|
/**
|
|
@@ -259,7 +259,7 @@ const _e = function(e) {
|
|
|
259
259
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
260
260
|
*
|
|
261
261
|
*/
|
|
262
|
-
class
|
|
262
|
+
class Ae {
|
|
263
263
|
_header;
|
|
264
264
|
constructor(t) {
|
|
265
265
|
this.validateHeader(t), this._header = t;
|
|
@@ -292,7 +292,7 @@ class Ie {
|
|
|
292
292
|
throw new Error("Invalid updated property");
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
|
-
const
|
|
295
|
+
const Ce = function(e) {
|
|
296
296
|
if (typeof window._nc_filelistheader > "u" && (window._nc_filelistheader = [], N.debug("FileListHeaders initialized")), window._nc_filelistheader.find((t) => t.id === e.id)) {
|
|
297
297
|
N.error(`Header ${e.id} already registered`, { header: e });
|
|
298
298
|
return;
|
|
@@ -355,59 +355,56 @@ const M = [
|
|
|
355
355
|
"nc:has-preview",
|
|
356
356
|
"nc:is-encrypted",
|
|
357
357
|
"nc:mount-type",
|
|
358
|
-
"nc:share-attributes",
|
|
359
358
|
"oc:comments-unread",
|
|
360
359
|
"oc:favorite",
|
|
361
360
|
"oc:fileid",
|
|
362
361
|
"oc:owner-display-name",
|
|
363
362
|
"oc:owner-id",
|
|
364
363
|
"oc:permissions",
|
|
365
|
-
"oc:
|
|
366
|
-
"oc:size",
|
|
367
|
-
"ocs:share-permissions"
|
|
364
|
+
"oc:size"
|
|
368
365
|
], B = {
|
|
369
366
|
d: "DAV:",
|
|
370
367
|
nc: "http://nextcloud.org/ns",
|
|
371
368
|
oc: "http://owncloud.org/ns",
|
|
372
369
|
ocs: "http://open-collaboration-services.org/ns"
|
|
373
|
-
},
|
|
370
|
+
}, Oe = function(e, t = { nc: "http://nextcloud.org/ns" }) {
|
|
374
371
|
typeof window._nc_dav_properties > "u" && (window._nc_dav_properties = [...M], window._nc_dav_namespaces = { ...B });
|
|
375
372
|
const r = { ...window._nc_dav_namespaces, ...t };
|
|
376
373
|
if (window._nc_dav_properties.find((n) => n === e))
|
|
377
|
-
return N.
|
|
374
|
+
return N.warn(`${e} already registered`, { prop: e }), !1;
|
|
378
375
|
if (e.startsWith("<") || e.split(":").length !== 2)
|
|
379
376
|
return N.error(`${e} is not valid. See example: 'oc:fileid'`, { prop: e }), !1;
|
|
380
377
|
const s = e.split(":")[0];
|
|
381
378
|
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
379
|
}, C = function() {
|
|
380
|
+
return typeof window._nc_dav_properties > "u" && (window._nc_dav_properties = [...M]), window._nc_dav_properties.map((e) => `<${e} />`).join(" ");
|
|
381
|
+
}, P = function() {
|
|
385
382
|
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
|
-
},
|
|
383
|
+
}, Fe = function() {
|
|
387
384
|
return `<?xml version="1.0"?>
|
|
388
|
-
<d:propfind ${
|
|
385
|
+
<d:propfind ${P()}>
|
|
389
386
|
<d:prop>
|
|
390
|
-
${
|
|
387
|
+
${C()}
|
|
391
388
|
</d:prop>
|
|
392
389
|
</d:propfind>`;
|
|
393
|
-
},
|
|
390
|
+
}, te = function() {
|
|
394
391
|
return `<?xml version="1.0"?>
|
|
395
|
-
<oc:filter-files ${
|
|
392
|
+
<oc:filter-files ${P()}>
|
|
396
393
|
<d:prop>
|
|
397
|
-
${
|
|
394
|
+
${C()}
|
|
398
395
|
</d:prop>
|
|
399
396
|
<oc:filter-rules>
|
|
400
397
|
<oc:favorite>1</oc:favorite>
|
|
401
398
|
</oc:filter-rules>
|
|
402
399
|
</oc:filter-files>`;
|
|
403
|
-
},
|
|
400
|
+
}, xe = function(e) {
|
|
404
401
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
405
|
-
<d:searchrequest ${
|
|
402
|
+
<d:searchrequest ${P()}
|
|
406
403
|
xmlns:ns="https://github.com/icewind1991/SearchDAV/ns">
|
|
407
404
|
<d:basicsearch>
|
|
408
405
|
<d:select>
|
|
409
406
|
<d:prop>
|
|
410
|
-
${
|
|
407
|
+
${C()}
|
|
411
408
|
</d:prop>
|
|
412
409
|
</d:select>
|
|
413
410
|
<d:from>
|
|
@@ -479,7 +476,7 @@ const M = [
|
|
|
479
476
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
480
477
|
*
|
|
481
478
|
*/
|
|
482
|
-
const
|
|
479
|
+
const re = function(e = "") {
|
|
483
480
|
let t = m.NONE;
|
|
484
481
|
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
482
|
};
|
|
@@ -526,9 +523,9 @@ var O = /* @__PURE__ */ ((e) => (e.Folder = "folder", e.File = "file", e))(O ||
|
|
|
526
523
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
527
524
|
*
|
|
528
525
|
*/
|
|
529
|
-
const
|
|
526
|
+
const ne = function(e, t) {
|
|
530
527
|
return e.match(t) !== null;
|
|
531
|
-
},
|
|
528
|
+
}, Z = (e, t) => {
|
|
532
529
|
if (e.id && typeof e.id != "number")
|
|
533
530
|
throw new Error("Invalid id type of value");
|
|
534
531
|
if (!e.source)
|
|
@@ -560,9 +557,9 @@ const ie = function(e, t) {
|
|
|
560
557
|
throw new Error("Root must start with a leading slash");
|
|
561
558
|
if (e.root && !e.source.includes(e.root))
|
|
562
559
|
throw new Error("Root must be part of the source");
|
|
563
|
-
if (e.root &&
|
|
560
|
+
if (e.root && ne(e.source, t)) {
|
|
564
561
|
const r = e.source.match(t)[0];
|
|
565
|
-
if (!e.source.includes(
|
|
562
|
+
if (!e.source.includes(y.join(r, e.root)))
|
|
566
563
|
throw new Error("The root must be relative to the service. e.g /files/emma");
|
|
567
564
|
}
|
|
568
565
|
if (e.status && !Object.values(k).includes(e.status))
|
|
@@ -595,7 +592,7 @@ class q {
|
|
|
595
592
|
_attributes;
|
|
596
593
|
_knownDavService = /(remote|public)\.php\/(web)?dav/i;
|
|
597
594
|
constructor(t, r) {
|
|
598
|
-
|
|
595
|
+
Z(t, r || this._knownDavService), this._data = t;
|
|
599
596
|
const s = {
|
|
600
597
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
601
598
|
set: (n, i, a) => (this.updateMtime(), Reflect.set(n, i, a)),
|
|
@@ -621,13 +618,13 @@ class q {
|
|
|
621
618
|
* Get this object name
|
|
622
619
|
*/
|
|
623
620
|
get basename() {
|
|
624
|
-
return
|
|
621
|
+
return y.basename(this.source);
|
|
625
622
|
}
|
|
626
623
|
/**
|
|
627
624
|
* Get this object's extension
|
|
628
625
|
*/
|
|
629
626
|
get extension() {
|
|
630
|
-
return
|
|
627
|
+
return y.extname(this.source);
|
|
631
628
|
}
|
|
632
629
|
/**
|
|
633
630
|
* Get the directory path leading to this object
|
|
@@ -638,10 +635,10 @@ class q {
|
|
|
638
635
|
let r = this.source;
|
|
639
636
|
this.isDavRessource && (r = r.split(this._knownDavService).pop());
|
|
640
637
|
const s = r.indexOf(this.root), n = this.root.replace(/\/$/, "");
|
|
641
|
-
return
|
|
638
|
+
return y.dirname(r.slice(s + n.length) || "/");
|
|
642
639
|
}
|
|
643
640
|
const t = new URL(this.source);
|
|
644
|
-
return
|
|
641
|
+
return y.dirname(t.pathname);
|
|
645
642
|
}
|
|
646
643
|
/**
|
|
647
644
|
* Get the file mime
|
|
@@ -689,13 +686,13 @@ class q {
|
|
|
689
686
|
* Is this a dav-related ressource ?
|
|
690
687
|
*/
|
|
691
688
|
get isDavRessource() {
|
|
692
|
-
return
|
|
689
|
+
return ne(this.source, this._knownDavService);
|
|
693
690
|
}
|
|
694
691
|
/**
|
|
695
692
|
* Get the dav root of this object
|
|
696
693
|
*/
|
|
697
694
|
get root() {
|
|
698
|
-
return this._data.root ? this._data.root.replace(/^(.+)\/$/, "$1") : this.isDavRessource &&
|
|
695
|
+
return this._data.root ? this._data.root.replace(/^(.+)\/$/, "$1") : this.isDavRessource && y.dirname(this.source).split(this._knownDavService).pop() || null;
|
|
699
696
|
}
|
|
700
697
|
/**
|
|
701
698
|
* Get the absolute path of this object relative to the root
|
|
@@ -735,7 +732,7 @@ class q {
|
|
|
735
732
|
* e.g. https://cloud.domain.com/remote.php/dav/files/emma/Photos/picture.jpg
|
|
736
733
|
*/
|
|
737
734
|
move(t) {
|
|
738
|
-
|
|
735
|
+
Z({ ...this._data, source: t }, this._knownDavService), this._data.source = t, this.updateMtime();
|
|
739
736
|
}
|
|
740
737
|
/**
|
|
741
738
|
* Rename the node
|
|
@@ -746,7 +743,7 @@ class q {
|
|
|
746
743
|
rename(t) {
|
|
747
744
|
if (t.includes("/"))
|
|
748
745
|
throw new Error("Invalid basename");
|
|
749
|
-
this.move(
|
|
746
|
+
this.move(y.dirname(this.source) + "/" + t);
|
|
750
747
|
}
|
|
751
748
|
/**
|
|
752
749
|
* Update the mtime if exists.
|
|
@@ -776,7 +773,7 @@ class q {
|
|
|
776
773
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
777
774
|
*
|
|
778
775
|
*/
|
|
779
|
-
class
|
|
776
|
+
class ie extends q {
|
|
780
777
|
get type() {
|
|
781
778
|
return O.File;
|
|
782
779
|
}
|
|
@@ -802,7 +799,7 @@ class se extends q {
|
|
|
802
799
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
803
800
|
*
|
|
804
801
|
*/
|
|
805
|
-
class
|
|
802
|
+
class se extends q {
|
|
806
803
|
constructor(t) {
|
|
807
804
|
super({
|
|
808
805
|
...t,
|
|
@@ -841,8 +838,8 @@ class oe extends q {
|
|
|
841
838
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
842
839
|
*
|
|
843
840
|
*/
|
|
844
|
-
const U = `/files/${_.getCurrentUser()?.uid}`, X = me.generateRemoteUrl("dav"),
|
|
845
|
-
const r =
|
|
841
|
+
const U = `/files/${_.getCurrentUser()?.uid}`, X = me.generateRemoteUrl("dav"), $e = function(e = X, t = {}) {
|
|
842
|
+
const r = W.createClient(e, { headers: t });
|
|
846
843
|
function s(i) {
|
|
847
844
|
r.setHeaders({
|
|
848
845
|
...t,
|
|
@@ -852,35 +849,50 @@ const U = `/files/${_.getCurrentUser()?.uid}`, X = me.generateRemoteUrl("dav"),
|
|
|
852
849
|
requesttoken: i ?? ""
|
|
853
850
|
});
|
|
854
851
|
}
|
|
855
|
-
return _.onRequestTokenUpdate(s), s(_.getRequestToken()),
|
|
852
|
+
return _.onRequestTokenUpdate(s), s(_.getRequestToken()), W.getPatcher().patch("fetch", (i, a) => {
|
|
856
853
|
const u = a.headers;
|
|
857
854
|
return u?.method && (a.method = u.method, delete u.method), fetch(i, a);
|
|
858
855
|
}), r;
|
|
859
|
-
},
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
856
|
+
}, Se = (e, t = "/", r = U) => {
|
|
857
|
+
const s = new AbortController();
|
|
858
|
+
return new Ne.CancelablePromise(async (n, i, a) => {
|
|
859
|
+
a(() => s.abort());
|
|
860
|
+
try {
|
|
861
|
+
const o = (await e.getDirectoryContents(`${r}${t}`, {
|
|
862
|
+
signal: s.signal,
|
|
863
|
+
details: !0,
|
|
864
|
+
data: te(),
|
|
865
|
+
headers: {
|
|
866
|
+
// see davGetClient for patched webdav client
|
|
867
|
+
method: "REPORT"
|
|
868
|
+
},
|
|
869
|
+
includeSelf: !0
|
|
870
|
+
})).data.filter((d) => d.filename !== t).map((d) => oe(d, r));
|
|
871
|
+
n(o);
|
|
872
|
+
} catch (u) {
|
|
873
|
+
i(u);
|
|
874
|
+
}
|
|
875
|
+
});
|
|
876
|
+
}, oe = function(e, t = U, r = X) {
|
|
877
|
+
const s = _.getCurrentUser()?.uid;
|
|
878
|
+
if (!s)
|
|
879
|
+
throw new Error("No user id found");
|
|
880
|
+
const n = e.props, i = re(n?.permissions), a = (n?.["owner-id"] || s).toString(), u = {
|
|
881
|
+
id: n?.fileid || 0,
|
|
870
882
|
source: `${r}${e.filename}`,
|
|
871
883
|
mtime: new Date(Date.parse(e.lastmod)),
|
|
872
|
-
mime: e.mime,
|
|
873
|
-
size:
|
|
874
|
-
permissions:
|
|
875
|
-
owner:
|
|
884
|
+
mime: e.mime || "application/octet-stream",
|
|
885
|
+
size: n?.size || Number.parseInt(n.getcontentlength || "0"),
|
|
886
|
+
permissions: i,
|
|
887
|
+
owner: a,
|
|
876
888
|
root: t,
|
|
877
889
|
attributes: {
|
|
878
890
|
...e,
|
|
879
|
-
...
|
|
880
|
-
hasPreview:
|
|
891
|
+
...n,
|
|
892
|
+
hasPreview: n?.["has-preview"]
|
|
881
893
|
}
|
|
882
894
|
};
|
|
883
|
-
return delete
|
|
895
|
+
return delete u.attributes?.props, e.type === "file" ? new ie(u) : new se(u);
|
|
884
896
|
};
|
|
885
897
|
/**
|
|
886
898
|
* @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
|
|
@@ -903,7 +915,7 @@ const U = `/files/${_.getCurrentUser()?.uid}`, X = me.generateRemoteUrl("dav"),
|
|
|
903
915
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
904
916
|
*
|
|
905
917
|
*/
|
|
906
|
-
class
|
|
918
|
+
class ue {
|
|
907
919
|
_views = [];
|
|
908
920
|
_currentView = null;
|
|
909
921
|
register(t) {
|
|
@@ -926,7 +938,7 @@ class ae {
|
|
|
926
938
|
}
|
|
927
939
|
}
|
|
928
940
|
const Ve = function() {
|
|
929
|
-
return typeof window._nc_navigation > "u" && (window._nc_navigation = new
|
|
941
|
+
return typeof window._nc_navigation > "u" && (window._nc_navigation = new ue(), N.debug("Navigation service initialized")), window._nc_navigation;
|
|
930
942
|
};
|
|
931
943
|
/**
|
|
932
944
|
* @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
|
|
@@ -949,10 +961,10 @@ const Ve = function() {
|
|
|
949
961
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
950
962
|
*
|
|
951
963
|
*/
|
|
952
|
-
class
|
|
964
|
+
class ae {
|
|
953
965
|
_column;
|
|
954
966
|
constructor(t) {
|
|
955
|
-
|
|
967
|
+
Le(t), this._column = t;
|
|
956
968
|
}
|
|
957
969
|
get id() {
|
|
958
970
|
return this._column.id;
|
|
@@ -970,7 +982,7 @@ class de {
|
|
|
970
982
|
return this._column.summary;
|
|
971
983
|
}
|
|
972
984
|
}
|
|
973
|
-
const
|
|
985
|
+
const Le = function(e) {
|
|
974
986
|
if (!e.id || typeof e.id != "string")
|
|
975
987
|
throw new Error("A column id is required");
|
|
976
988
|
if (!e.title || typeof e.title != "string")
|
|
@@ -1015,24 +1027,24 @@ var G = {}, F = {};
|
|
|
1015
1027
|
return e.isExist(u) ? u : "";
|
|
1016
1028
|
}, e.isName = a, e.getAllMatches = i, e.nameRegexp = s;
|
|
1017
1029
|
})(F);
|
|
1018
|
-
const H = F,
|
|
1030
|
+
const H = F, Re = {
|
|
1019
1031
|
allowBooleanAttributes: !1,
|
|
1020
1032
|
//A tag can have attributes without any value
|
|
1021
1033
|
unpairedTags: []
|
|
1022
1034
|
};
|
|
1023
1035
|
G.validate = function(e, t) {
|
|
1024
|
-
t = Object.assign({},
|
|
1036
|
+
t = Object.assign({}, Re, t);
|
|
1025
1037
|
const r = [];
|
|
1026
1038
|
let s = !1, n = !1;
|
|
1027
1039
|
e[0] === "\uFEFF" && (e = e.substr(1));
|
|
1028
1040
|
for (let i = 0; i < e.length; i++)
|
|
1029
1041
|
if (e[i] === "<" && e[i + 1] === "?") {
|
|
1030
|
-
if (i += 2, i =
|
|
1042
|
+
if (i += 2, i = Y(e, i), i.err)
|
|
1031
1043
|
return i;
|
|
1032
1044
|
} else if (e[i] === "<") {
|
|
1033
1045
|
let a = i;
|
|
1034
1046
|
if (i++, e[i] === "!") {
|
|
1035
|
-
i =
|
|
1047
|
+
i = J(e, i);
|
|
1036
1048
|
continue;
|
|
1037
1049
|
} else {
|
|
1038
1050
|
let u = !1;
|
|
@@ -1041,18 +1053,18 @@ G.validate = function(e, t) {
|
|
|
1041
1053
|
for (; i < e.length && e[i] !== ">" && e[i] !== " " && e[i] !== " " && e[i] !== `
|
|
1042
1054
|
` && e[i] !== "\r"; i++)
|
|
1043
1055
|
o += e[i];
|
|
1044
|
-
if (o = o.trim(), o[o.length - 1] === "/" && (o = o.substring(0, o.length - 1), i--), !
|
|
1056
|
+
if (o = o.trim(), o[o.length - 1] === "/" && (o = o.substring(0, o.length - 1), i--), !He(o)) {
|
|
1045
1057
|
let f;
|
|
1046
1058
|
return o.trim().length === 0 ? f = "Invalid space after '<'." : f = "Tag '" + o + "' is an invalid name.", p("InvalidTag", f, w(e, i));
|
|
1047
1059
|
}
|
|
1048
|
-
const d =
|
|
1060
|
+
const d = ke(e, i);
|
|
1049
1061
|
if (d === !1)
|
|
1050
1062
|
return p("InvalidAttr", "Attributes for '" + o + "' have open quote.", w(e, i));
|
|
1051
1063
|
let l = d.value;
|
|
1052
1064
|
if (i = d.index, l[l.length - 1] === "/") {
|
|
1053
1065
|
const f = i - l.length;
|
|
1054
1066
|
l = l.substring(0, l.length - 1);
|
|
1055
|
-
const c =
|
|
1067
|
+
const c = Q(l, t);
|
|
1056
1068
|
if (c === !0)
|
|
1057
1069
|
s = !0;
|
|
1058
1070
|
else
|
|
@@ -1076,7 +1088,7 @@ G.validate = function(e, t) {
|
|
|
1076
1088
|
} else
|
|
1077
1089
|
return p("InvalidTag", "Closing tag '" + o + "' doesn't have proper closing.", w(e, i));
|
|
1078
1090
|
else {
|
|
1079
|
-
const f =
|
|
1091
|
+
const f = Q(l, t);
|
|
1080
1092
|
if (f !== !0)
|
|
1081
1093
|
return p(f.err.code, f.err.msg, w(e, i - l.length + f.err.line));
|
|
1082
1094
|
if (n === !0)
|
|
@@ -1086,24 +1098,24 @@ G.validate = function(e, t) {
|
|
|
1086
1098
|
for (i++; i < e.length; i++)
|
|
1087
1099
|
if (e[i] === "<")
|
|
1088
1100
|
if (e[i + 1] === "!") {
|
|
1089
|
-
i++, i =
|
|
1101
|
+
i++, i = J(e, i);
|
|
1090
1102
|
continue;
|
|
1091
1103
|
} else if (e[i + 1] === "?") {
|
|
1092
|
-
if (i =
|
|
1104
|
+
if (i = Y(e, ++i), i.err)
|
|
1093
1105
|
return i;
|
|
1094
1106
|
} else
|
|
1095
1107
|
break;
|
|
1096
1108
|
else if (e[i] === "&") {
|
|
1097
|
-
const f =
|
|
1109
|
+
const f = Xe(e, i);
|
|
1098
1110
|
if (f == -1)
|
|
1099
1111
|
return p("InvalidChar", "char '&' is not expected.", w(e, i));
|
|
1100
1112
|
i = f;
|
|
1101
|
-
} else if (n === !0 && !
|
|
1113
|
+
} else if (n === !0 && !j(e[i]))
|
|
1102
1114
|
return p("InvalidXml", "Extra text at the end", w(e, i));
|
|
1103
1115
|
e[i] === "<" && i--;
|
|
1104
1116
|
}
|
|
1105
1117
|
} else {
|
|
1106
|
-
if (
|
|
1118
|
+
if (j(e[i]))
|
|
1107
1119
|
continue;
|
|
1108
1120
|
return p("InvalidChar", "char '" + e[i] + "' is not expected.", w(e, i));
|
|
1109
1121
|
}
|
|
@@ -1116,11 +1128,11 @@ G.validate = function(e, t) {
|
|
|
1116
1128
|
return p("InvalidXml", "Start tag expected.", 1);
|
|
1117
1129
|
return !0;
|
|
1118
1130
|
};
|
|
1119
|
-
function
|
|
1131
|
+
function j(e) {
|
|
1120
1132
|
return e === " " || e === " " || e === `
|
|
1121
1133
|
` || e === "\r";
|
|
1122
1134
|
}
|
|
1123
|
-
function
|
|
1135
|
+
function Y(e, t) {
|
|
1124
1136
|
const r = t;
|
|
1125
1137
|
for (; t < e.length; t++)
|
|
1126
1138
|
if (e[t] == "?" || e[t] == " ") {
|
|
@@ -1135,7 +1147,7 @@ function J(e, t) {
|
|
|
1135
1147
|
}
|
|
1136
1148
|
return t;
|
|
1137
1149
|
}
|
|
1138
|
-
function
|
|
1150
|
+
function J(e, t) {
|
|
1139
1151
|
if (e.length > t + 5 && e[t + 1] === "-" && e[t + 2] === "-") {
|
|
1140
1152
|
for (t += 3; t < e.length; t++)
|
|
1141
1153
|
if (e[t] === "-" && e[t + 1] === "-" && e[t + 2] === ">") {
|
|
@@ -1158,11 +1170,11 @@ function Q(e, t) {
|
|
|
1158
1170
|
}
|
|
1159
1171
|
return t;
|
|
1160
1172
|
}
|
|
1161
|
-
const
|
|
1162
|
-
function
|
|
1173
|
+
const Me = '"', Be = "'";
|
|
1174
|
+
function ke(e, t) {
|
|
1163
1175
|
let r = "", s = "", n = !1;
|
|
1164
1176
|
for (; t < e.length; t++) {
|
|
1165
|
-
if (e[t] ===
|
|
1177
|
+
if (e[t] === Me || e[t] === Be)
|
|
1166
1178
|
s === "" ? s = e[t] : s !== e[t] || (s = "");
|
|
1167
1179
|
else if (e[t] === ">" && s === "") {
|
|
1168
1180
|
n = !0;
|
|
@@ -1176,9 +1188,9 @@ function Be(e, t) {
|
|
|
1176
1188
|
tagClosed: n
|
|
1177
1189
|
};
|
|
1178
1190
|
}
|
|
1179
|
-
const
|
|
1180
|
-
function
|
|
1181
|
-
const r = H.getAllMatches(e,
|
|
1191
|
+
const qe = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
|
|
1192
|
+
function Q(e, t) {
|
|
1193
|
+
const r = H.getAllMatches(e, qe), s = {};
|
|
1182
1194
|
for (let n = 0; n < r.length; n++) {
|
|
1183
1195
|
if (r[n][1].length === 0)
|
|
1184
1196
|
return p("InvalidAttr", "Attribute '" + r[n][2] + "' has no space in starting.", I(r[n]));
|
|
@@ -1187,7 +1199,7 @@ function D(e, t) {
|
|
|
1187
1199
|
if (r[n][3] === void 0 && !t.allowBooleanAttributes)
|
|
1188
1200
|
return p("InvalidAttr", "boolean attribute '" + r[n][2] + "' is not allowed.", I(r[n]));
|
|
1189
1201
|
const i = r[n][2];
|
|
1190
|
-
if (!
|
|
1202
|
+
if (!Ge(i))
|
|
1191
1203
|
return p("InvalidAttr", "Attribute '" + i + "' is an invalid name.", I(r[n]));
|
|
1192
1204
|
if (!s.hasOwnProperty(i))
|
|
1193
1205
|
s[i] = 1;
|
|
@@ -1196,7 +1208,7 @@ function D(e, t) {
|
|
|
1196
1208
|
}
|
|
1197
1209
|
return !0;
|
|
1198
1210
|
}
|
|
1199
|
-
function
|
|
1211
|
+
function Ue(e, t) {
|
|
1200
1212
|
let r = /\d/;
|
|
1201
1213
|
for (e[t] === "x" && (t++, r = /[\da-fA-F]/); t < e.length; t++) {
|
|
1202
1214
|
if (e[t] === ";")
|
|
@@ -1206,11 +1218,11 @@ function qe(e, t) {
|
|
|
1206
1218
|
}
|
|
1207
1219
|
return -1;
|
|
1208
1220
|
}
|
|
1209
|
-
function
|
|
1221
|
+
function Xe(e, t) {
|
|
1210
1222
|
if (t++, e[t] === ";")
|
|
1211
1223
|
return -1;
|
|
1212
1224
|
if (e[t] === "#")
|
|
1213
|
-
return t++,
|
|
1225
|
+
return t++, Ue(e, t);
|
|
1214
1226
|
let r = 0;
|
|
1215
1227
|
for (; t < e.length; t++, r++)
|
|
1216
1228
|
if (!(e[t].match(/\w/) && r < 20)) {
|
|
@@ -1230,10 +1242,10 @@ function p(e, t, r) {
|
|
|
1230
1242
|
}
|
|
1231
1243
|
};
|
|
1232
1244
|
}
|
|
1233
|
-
function
|
|
1245
|
+
function Ge(e) {
|
|
1234
1246
|
return H.isName(e);
|
|
1235
1247
|
}
|
|
1236
|
-
function
|
|
1248
|
+
function He(e) {
|
|
1237
1249
|
return H.isName(e);
|
|
1238
1250
|
}
|
|
1239
1251
|
function w(e, t) {
|
|
@@ -1248,7 +1260,7 @@ function I(e) {
|
|
|
1248
1260
|
return e.startIndex + e[1].length;
|
|
1249
1261
|
}
|
|
1250
1262
|
var z = {};
|
|
1251
|
-
const
|
|
1263
|
+
const de = {
|
|
1252
1264
|
preserveOrder: !1,
|
|
1253
1265
|
attributeNamePrefix: "@_",
|
|
1254
1266
|
attributesGroupName: !1,
|
|
@@ -1291,12 +1303,12 @@ const le = {
|
|
|
1291
1303
|
return e;
|
|
1292
1304
|
}
|
|
1293
1305
|
// skipEmptyListItem: false
|
|
1294
|
-
},
|
|
1295
|
-
return Object.assign({},
|
|
1306
|
+
}, ze = function(e) {
|
|
1307
|
+
return Object.assign({}, de, e);
|
|
1296
1308
|
};
|
|
1297
|
-
z.buildOptions =
|
|
1298
|
-
z.defaultOptions =
|
|
1299
|
-
class
|
|
1309
|
+
z.buildOptions = ze;
|
|
1310
|
+
z.defaultOptions = de;
|
|
1311
|
+
class Ke {
|
|
1300
1312
|
constructor(t) {
|
|
1301
1313
|
this.tagname = t, this.child = [], this[":@"] = {};
|
|
1302
1314
|
}
|
|
@@ -1307,27 +1319,27 @@ class ze {
|
|
|
1307
1319
|
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 });
|
|
1308
1320
|
}
|
|
1309
1321
|
}
|
|
1310
|
-
var
|
|
1311
|
-
const
|
|
1312
|
-
function
|
|
1322
|
+
var We = Ke;
|
|
1323
|
+
const Ze = F;
|
|
1324
|
+
function je(e, t) {
|
|
1313
1325
|
const r = {};
|
|
1314
1326
|
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") {
|
|
1315
1327
|
t = t + 9;
|
|
1316
1328
|
let s = 1, n = !1, i = !1, a = "";
|
|
1317
1329
|
for (; t < e.length; t++)
|
|
1318
1330
|
if (e[t] === "<" && !i) {
|
|
1319
|
-
if (n &&
|
|
1320
|
-
t += 7, [entityName, val, t] =
|
|
1331
|
+
if (n && Qe(e, t))
|
|
1332
|
+
t += 7, [entityName, val, t] = Ye(e, t + 1), val.indexOf("&") === -1 && (r[rt(entityName)] = {
|
|
1321
1333
|
regx: RegExp(`&${entityName};`, "g"),
|
|
1322
1334
|
val
|
|
1323
1335
|
});
|
|
1324
|
-
else if (n && Qe(e, t))
|
|
1325
|
-
t += 8;
|
|
1326
1336
|
else if (n && De(e, t))
|
|
1327
1337
|
t += 8;
|
|
1328
1338
|
else if (n && et(e, t))
|
|
1339
|
+
t += 8;
|
|
1340
|
+
else if (n && tt(e, t))
|
|
1329
1341
|
t += 9;
|
|
1330
|
-
else if (
|
|
1342
|
+
else if (Je)
|
|
1331
1343
|
i = !0;
|
|
1332
1344
|
else
|
|
1333
1345
|
throw new Error("Invalid DOCTYPE");
|
|
@@ -1343,7 +1355,7 @@ function Ze(e, t) {
|
|
|
1343
1355
|
throw new Error("Invalid Tag instead of DOCTYPE");
|
|
1344
1356
|
return { entities: r, i: t };
|
|
1345
1357
|
}
|
|
1346
|
-
function
|
|
1358
|
+
function Ye(e, t) {
|
|
1347
1359
|
let r = "";
|
|
1348
1360
|
for (; t < e.length && e[t] !== "'" && e[t] !== '"'; t++)
|
|
1349
1361
|
r += e[t];
|
|
@@ -1355,50 +1367,50 @@ function je(e, t) {
|
|
|
1355
1367
|
n += e[t];
|
|
1356
1368
|
return [r, n, t];
|
|
1357
1369
|
}
|
|
1358
|
-
function
|
|
1370
|
+
function Je(e, t) {
|
|
1359
1371
|
return e[t + 1] === "!" && e[t + 2] === "-" && e[t + 3] === "-";
|
|
1360
1372
|
}
|
|
1361
|
-
function
|
|
1373
|
+
function Qe(e, t) {
|
|
1362
1374
|
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";
|
|
1363
1375
|
}
|
|
1364
|
-
function
|
|
1376
|
+
function De(e, t) {
|
|
1365
1377
|
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";
|
|
1366
1378
|
}
|
|
1367
|
-
function
|
|
1379
|
+
function et(e, t) {
|
|
1368
1380
|
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";
|
|
1369
1381
|
}
|
|
1370
|
-
function
|
|
1382
|
+
function tt(e, t) {
|
|
1371
1383
|
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";
|
|
1372
1384
|
}
|
|
1373
|
-
function
|
|
1374
|
-
if (
|
|
1385
|
+
function rt(e) {
|
|
1386
|
+
if (Ze.isName(e))
|
|
1375
1387
|
return e;
|
|
1376
1388
|
throw new Error(`Invalid entity name ${e}`);
|
|
1377
1389
|
}
|
|
1378
|
-
var
|
|
1379
|
-
const
|
|
1390
|
+
var nt = je;
|
|
1391
|
+
const it = /^[-+]?0x[a-fA-F0-9]+$/, st = /^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;
|
|
1380
1392
|
!Number.parseInt && window.parseInt && (Number.parseInt = window.parseInt);
|
|
1381
1393
|
!Number.parseFloat && window.parseFloat && (Number.parseFloat = window.parseFloat);
|
|
1382
|
-
const
|
|
1394
|
+
const ot = {
|
|
1383
1395
|
hex: !0,
|
|
1384
1396
|
leadingZeros: !0,
|
|
1385
1397
|
decimalPoint: ".",
|
|
1386
1398
|
eNotation: !0
|
|
1387
1399
|
//skipLike: /regex/
|
|
1388
1400
|
};
|
|
1389
|
-
function
|
|
1390
|
-
if (t = Object.assign({},
|
|
1401
|
+
function ut(e, t = {}) {
|
|
1402
|
+
if (t = Object.assign({}, ot, t), !e || typeof e != "string")
|
|
1391
1403
|
return e;
|
|
1392
1404
|
let r = e.trim();
|
|
1393
1405
|
if (t.skipLike !== void 0 && t.skipLike.test(r))
|
|
1394
1406
|
return e;
|
|
1395
|
-
if (t.hex &&
|
|
1407
|
+
if (t.hex && it.test(r))
|
|
1396
1408
|
return Number.parseInt(r, 16);
|
|
1397
1409
|
{
|
|
1398
|
-
const s =
|
|
1410
|
+
const s = st.exec(r);
|
|
1399
1411
|
if (s) {
|
|
1400
1412
|
const n = s[1], i = s[2];
|
|
1401
|
-
let a =
|
|
1413
|
+
let a = at(s[3]);
|
|
1402
1414
|
const u = s[4] || s[6];
|
|
1403
1415
|
if (!t.leadingZeros && i.length > 0 && n && r[2] !== ".")
|
|
1404
1416
|
return e;
|
|
@@ -1412,13 +1424,12 @@ function ot(e, t = {}) {
|
|
|
1412
1424
|
return e;
|
|
1413
1425
|
}
|
|
1414
1426
|
}
|
|
1415
|
-
function
|
|
1427
|
+
function at(e) {
|
|
1416
1428
|
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;
|
|
1417
1429
|
}
|
|
1418
|
-
var
|
|
1419
|
-
const
|
|
1420
|
-
|
|
1421
|
-
let ft = class {
|
|
1430
|
+
var dt = ut;
|
|
1431
|
+
const le = F, A = We, lt = nt, ft = dt;
|
|
1432
|
+
let ct = class {
|
|
1422
1433
|
constructor(t) {
|
|
1423
1434
|
this.options = t, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = {
|
|
1424
1435
|
apos: { regex: /&(apos|#39|#x27);/g, val: "'" },
|
|
@@ -1438,11 +1449,13 @@ let ft = class {
|
|
|
1438
1449
|
euro: { regex: /&(euro|#8364);/g, val: "€" },
|
|
1439
1450
|
copyright: { regex: /&(copy|#169);/g, val: "©" },
|
|
1440
1451
|
reg: { regex: /&(reg|#174);/g, val: "®" },
|
|
1441
|
-
inr: { regex: /&(inr|#8377);/g, val: "₹" }
|
|
1442
|
-
|
|
1452
|
+
inr: { regex: /&(inr|#8377);/g, val: "₹" },
|
|
1453
|
+
num_dec: { regex: /&#([0-9]{1,7});/g, val: (r, s) => String.fromCharCode(Number.parseInt(s, 10)) },
|
|
1454
|
+
num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (r, s) => String.fromCharCode(Number.parseInt(s, 16)) }
|
|
1455
|
+
}, this.addExternalEntities = ht, this.parseXml = Nt, this.parseTextData = pt, this.resolveNameSpace = gt, this.buildAttributesMap = mt, this.isItStopNode = vt, this.replaceEntitiesValue = bt, this.readStopNodeData = Tt, this.saveTextToParentTag = yt, this.addChild = Et;
|
|
1443
1456
|
}
|
|
1444
1457
|
};
|
|
1445
|
-
function
|
|
1458
|
+
function ht(e) {
|
|
1446
1459
|
const t = Object.keys(e);
|
|
1447
1460
|
for (let r = 0; r < t.length; r++) {
|
|
1448
1461
|
const s = t[r];
|
|
@@ -1452,14 +1465,14 @@ function ct(e) {
|
|
|
1452
1465
|
};
|
|
1453
1466
|
}
|
|
1454
1467
|
}
|
|
1455
|
-
function
|
|
1468
|
+
function pt(e, t, r, s, n, i, a) {
|
|
1456
1469
|
if (e !== void 0 && (this.options.trimValues && !s && (e = e.trim()), e.length > 0)) {
|
|
1457
1470
|
a || (e = this.replaceEntitiesValue(e));
|
|
1458
1471
|
const u = this.options.tagValueProcessor(t, e, r, n, i);
|
|
1459
|
-
return u == null ? e : typeof u != typeof e || u !== e ? u : this.options.trimValues ?
|
|
1472
|
+
return u == null ? e : typeof u != typeof e || u !== e ? u : this.options.trimValues ? V(e, this.options.parseTagValue, this.options.numberParseOptions) : e.trim() === e ? V(e, this.options.parseTagValue, this.options.numberParseOptions) : e;
|
|
1460
1473
|
}
|
|
1461
1474
|
}
|
|
1462
|
-
function
|
|
1475
|
+
function gt(e) {
|
|
1463
1476
|
if (this.options.removeNSPrefix) {
|
|
1464
1477
|
const t = e.split(":"), r = e.charAt(0) === "/" ? "/" : "";
|
|
1465
1478
|
if (t[0] === "xmlns")
|
|
@@ -1468,10 +1481,10 @@ function pt(e) {
|
|
|
1468
1481
|
}
|
|
1469
1482
|
return e;
|
|
1470
1483
|
}
|
|
1471
|
-
const
|
|
1472
|
-
function
|
|
1484
|
+
const wt = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
|
|
1485
|
+
function mt(e, t, r) {
|
|
1473
1486
|
if (!this.options.ignoreAttributes && typeof e == "string") {
|
|
1474
|
-
const s =
|
|
1487
|
+
const s = le.getAllMatches(e, wt), n = s.length, i = {};
|
|
1475
1488
|
for (let a = 0; a < n; a++) {
|
|
1476
1489
|
const u = this.resolveNameSpace(s[a][1]);
|
|
1477
1490
|
let o = s[a][4], d = this.options.attributeNamePrefix + u;
|
|
@@ -1479,7 +1492,7 @@ function wt(e, t, r) {
|
|
|
1479
1492
|
if (this.options.transformAttributeName && (d = this.options.transformAttributeName(d)), d === "__proto__" && (d = "#__proto__"), o !== void 0) {
|
|
1480
1493
|
this.options.trimValues && (o = o.trim()), o = this.replaceEntitiesValue(o);
|
|
1481
1494
|
const l = this.options.attributeValueProcessor(u, o, t);
|
|
1482
|
-
l == null ? i[d] = o : typeof l != typeof o || l !== o ? i[d] = l : i[d] =
|
|
1495
|
+
l == null ? i[d] = o : typeof l != typeof o || l !== o ? i[d] = l : i[d] = V(
|
|
1483
1496
|
o,
|
|
1484
1497
|
this.options.parseAttributeValue,
|
|
1485
1498
|
this.options.numberParseOptions
|
|
@@ -1496,7 +1509,7 @@ function wt(e, t, r) {
|
|
|
1496
1509
|
return i;
|
|
1497
1510
|
}
|
|
1498
1511
|
}
|
|
1499
|
-
const
|
|
1512
|
+
const Nt = function(e) {
|
|
1500
1513
|
e = e.replace(/\r\n?/g, `
|
|
1501
1514
|
`);
|
|
1502
1515
|
const t = new A("!xml");
|
|
@@ -1517,7 +1530,7 @@ const mt = function(e) {
|
|
|
1517
1530
|
let l = 0;
|
|
1518
1531
|
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;
|
|
1519
1532
|
} else if (e[i + 1] === "?") {
|
|
1520
|
-
let u =
|
|
1533
|
+
let u = S(e, i, !1, "?>");
|
|
1521
1534
|
if (!u)
|
|
1522
1535
|
throw new Error("Pi Tag is not closed.");
|
|
1523
1536
|
if (s = this.saveTextToParentTag(s, r, n), !(this.options.ignoreDeclaration && u.tagName === "?xml" || this.options.ignorePiTags)) {
|
|
@@ -1533,19 +1546,15 @@ const mt = function(e) {
|
|
|
1533
1546
|
}
|
|
1534
1547
|
i = u;
|
|
1535
1548
|
} else if (e.substr(i + 1, 2) === "!D") {
|
|
1536
|
-
const u =
|
|
1549
|
+
const u = lt(e, i);
|
|
1537
1550
|
this.docTypeEntities = u.entities, i = u.i;
|
|
1538
1551
|
} else if (e.substr(i + 1, 2) === "![") {
|
|
1539
1552
|
const u = v(e, "]]>", i, "CDATA is not closed.") - 2, o = e.substring(i + 9, u);
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
let d = this.parseTextData(o, r.tagname, n, !0, !1, !0);
|
|
1544
|
-
d == null && (d = ""), r.add(this.options.textNodeName, d);
|
|
1545
|
-
}
|
|
1546
|
-
i = u + 2;
|
|
1553
|
+
s = this.saveTextToParentTag(s, r, n);
|
|
1554
|
+
let d = this.parseTextData(o, r.tagname, n, !0, !1, !0, !0);
|
|
1555
|
+
d == null && (d = ""), this.options.cdataPropName ? r.add(this.options.cdataPropName, [{ [this.options.textNodeName]: o }]) : r.add(this.options.textNodeName, d), i = u + 2;
|
|
1547
1556
|
} else {
|
|
1548
|
-
let u =
|
|
1557
|
+
let u = S(e, i, this.options.removeNSPrefix), o = u.tagName;
|
|
1549
1558
|
const d = u.rawTagName;
|
|
1550
1559
|
let l = u.tagExp, f = u.attrExpPresent, c = u.closeIndex;
|
|
1551
1560
|
this.options.transformTagName && (o = this.options.transformTagName(o)), r && s && r.tagname !== "!xml" && (s = this.saveTextToParentTag(s, r, n, !1));
|
|
@@ -1580,11 +1589,11 @@ const mt = function(e) {
|
|
|
1580
1589
|
s += e[i];
|
|
1581
1590
|
return t.child;
|
|
1582
1591
|
};
|
|
1583
|
-
function
|
|
1592
|
+
function Et(e, t, r) {
|
|
1584
1593
|
const s = this.options.updateTag(t.tagname, r, t[":@"]);
|
|
1585
1594
|
s === !1 || (typeof s == "string" && (t.tagname = s), e.addChild(t));
|
|
1586
1595
|
}
|
|
1587
|
-
const
|
|
1596
|
+
const bt = function(e) {
|
|
1588
1597
|
if (this.options.processEntities) {
|
|
1589
1598
|
for (let t in this.docTypeEntities) {
|
|
1590
1599
|
const r = this.docTypeEntities[t];
|
|
@@ -1613,7 +1622,7 @@ function yt(e, t, r, s) {
|
|
|
1613
1622
|
s
|
|
1614
1623
|
), e !== void 0 && e !== "" && t.add(this.options.textNodeName, e), e = ""), e;
|
|
1615
1624
|
}
|
|
1616
|
-
function
|
|
1625
|
+
function vt(e, t, r) {
|
|
1617
1626
|
const s = "*." + r;
|
|
1618
1627
|
for (const n in e) {
|
|
1619
1628
|
const i = e[n];
|
|
@@ -1622,7 +1631,7 @@ function bt(e, t, r) {
|
|
|
1622
1631
|
}
|
|
1623
1632
|
return !1;
|
|
1624
1633
|
}
|
|
1625
|
-
function
|
|
1634
|
+
function _t(e, t, r = ">") {
|
|
1626
1635
|
let s, n = "";
|
|
1627
1636
|
for (let i = t; i < e.length; i++) {
|
|
1628
1637
|
let a = e[i];
|
|
@@ -1653,14 +1662,14 @@ function v(e, t, r, s) {
|
|
|
1653
1662
|
throw new Error(s);
|
|
1654
1663
|
return n + t.length - 1;
|
|
1655
1664
|
}
|
|
1656
|
-
function
|
|
1657
|
-
const n =
|
|
1665
|
+
function S(e, t, r, s = ">") {
|
|
1666
|
+
const n = _t(e, t + 1, s);
|
|
1658
1667
|
if (!n)
|
|
1659
1668
|
return;
|
|
1660
1669
|
let i = n.data;
|
|
1661
1670
|
const a = n.index, u = i.search(/\s/);
|
|
1662
1671
|
let o = i, d = !0;
|
|
1663
|
-
u !== -1 && (o = i.
|
|
1672
|
+
u !== -1 && (o = i.substring(0, u), i = i.substring(u + 1).trimStart());
|
|
1664
1673
|
const l = o;
|
|
1665
1674
|
if (r) {
|
|
1666
1675
|
const f = o.indexOf(":");
|
|
@@ -1674,7 +1683,7 @@ function V(e, t, r, s = ">") {
|
|
|
1674
1683
|
rawTagName: l
|
|
1675
1684
|
};
|
|
1676
1685
|
}
|
|
1677
|
-
function
|
|
1686
|
+
function Tt(e, t, r) {
|
|
1678
1687
|
const s = r;
|
|
1679
1688
|
let n = 1;
|
|
1680
1689
|
for (; r < e.length; r++)
|
|
@@ -1694,26 +1703,26 @@ function _t(e, t, r) {
|
|
|
1694
1703
|
else if (e.substr(r + 1, 2) === "![")
|
|
1695
1704
|
r = v(e, "]]>", r, "StopNode is not closed.") - 2;
|
|
1696
1705
|
else {
|
|
1697
|
-
const i =
|
|
1706
|
+
const i = S(e, r, ">");
|
|
1698
1707
|
i && ((i && i.tagName) === t && i.tagExp[i.tagExp.length - 1] !== "/" && n++, r = i.closeIndex);
|
|
1699
1708
|
}
|
|
1700
1709
|
}
|
|
1701
|
-
function
|
|
1710
|
+
function V(e, t, r) {
|
|
1702
1711
|
if (t && typeof e == "string") {
|
|
1703
1712
|
const s = e.trim();
|
|
1704
|
-
return s === "true" ? !0 : s === "false" ? !1 :
|
|
1713
|
+
return s === "true" ? !0 : s === "false" ? !1 : ft(e, r);
|
|
1705
1714
|
} else
|
|
1706
|
-
return
|
|
1715
|
+
return le.isExist(e) ? e : "";
|
|
1707
1716
|
}
|
|
1708
|
-
var
|
|
1709
|
-
function
|
|
1717
|
+
var It = ct, fe = {};
|
|
1718
|
+
function At(e, t) {
|
|
1710
1719
|
return ce(e, t);
|
|
1711
1720
|
}
|
|
1712
1721
|
function ce(e, t, r) {
|
|
1713
1722
|
let s;
|
|
1714
1723
|
const n = {};
|
|
1715
1724
|
for (let i = 0; i < e.length; i++) {
|
|
1716
|
-
const a = e[i], u =
|
|
1725
|
+
const a = e[i], u = Ct(a);
|
|
1717
1726
|
let o = "";
|
|
1718
1727
|
if (r === void 0 ? o = u : o = r + "." + u, u === t.textNodeName)
|
|
1719
1728
|
s === void 0 ? s = a[u] : s += "" + a[u];
|
|
@@ -1722,14 +1731,14 @@ function ce(e, t, r) {
|
|
|
1722
1731
|
continue;
|
|
1723
1732
|
if (a[u]) {
|
|
1724
1733
|
let d = ce(a[u], t, o);
|
|
1725
|
-
const l =
|
|
1734
|
+
const l = Ot(d, t);
|
|
1726
1735
|
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;
|
|
1727
1736
|
}
|
|
1728
1737
|
}
|
|
1729
1738
|
}
|
|
1730
1739
|
return typeof s == "string" ? s.length > 0 && (n[t.textNodeName] = s) : s !== void 0 && (n[t.textNodeName] = s), n;
|
|
1731
1740
|
}
|
|
1732
|
-
function
|
|
1741
|
+
function Ct(e) {
|
|
1733
1742
|
const t = Object.keys(e);
|
|
1734
1743
|
for (let r = 0; r < t.length; r++) {
|
|
1735
1744
|
const s = t[r];
|
|
@@ -1746,15 +1755,15 @@ function Pt(e, t, r, s) {
|
|
|
1746
1755
|
}
|
|
1747
1756
|
}
|
|
1748
1757
|
}
|
|
1749
|
-
function
|
|
1758
|
+
function Ot(e, t) {
|
|
1750
1759
|
const { textNodeName: r } = t, s = Object.keys(e).length;
|
|
1751
1760
|
return !!(s === 0 || s === 1 && (e[r] || typeof e[r] == "boolean" || e[r] === 0));
|
|
1752
1761
|
}
|
|
1753
|
-
fe.prettify =
|
|
1754
|
-
const { buildOptions:
|
|
1762
|
+
fe.prettify = At;
|
|
1763
|
+
const { buildOptions: Ft } = z, xt = It, { prettify: $t } = fe, St = G;
|
|
1755
1764
|
let Vt = class {
|
|
1756
1765
|
constructor(t) {
|
|
1757
|
-
this.externalEntities = {}, this.options =
|
|
1766
|
+
this.externalEntities = {}, this.options = Ft(t);
|
|
1758
1767
|
}
|
|
1759
1768
|
/**
|
|
1760
1769
|
* Parse XML dats to JS object
|
|
@@ -1769,14 +1778,14 @@ let Vt = class {
|
|
|
1769
1778
|
throw new Error("XML data is accepted in String or Bytes[] form.");
|
|
1770
1779
|
if (r) {
|
|
1771
1780
|
r === !0 && (r = {});
|
|
1772
|
-
const i =
|
|
1781
|
+
const i = St.validate(t, r);
|
|
1773
1782
|
if (i !== !0)
|
|
1774
1783
|
throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`);
|
|
1775
1784
|
}
|
|
1776
|
-
const s = new
|
|
1785
|
+
const s = new xt(this.options);
|
|
1777
1786
|
s.addExternalEntities(this.externalEntities);
|
|
1778
1787
|
const n = s.parseXml(t);
|
|
1779
|
-
return this.options.preserveOrder || n === void 0 ? n :
|
|
1788
|
+
return this.options.preserveOrder || n === void 0 ? n : $t(n, this.options);
|
|
1780
1789
|
}
|
|
1781
1790
|
/**
|
|
1782
1791
|
* Add Entity which is not by default supported by this library
|
|
@@ -1793,23 +1802,23 @@ let Vt = class {
|
|
|
1793
1802
|
this.externalEntities[t] = r;
|
|
1794
1803
|
}
|
|
1795
1804
|
};
|
|
1796
|
-
var
|
|
1797
|
-
const
|
|
1805
|
+
var Lt = Vt;
|
|
1806
|
+
const Rt = `
|
|
1798
1807
|
`;
|
|
1799
|
-
function
|
|
1808
|
+
function Mt(e, t) {
|
|
1800
1809
|
let r = "";
|
|
1801
|
-
return t.format && t.indentBy.length > 0 && (r =
|
|
1810
|
+
return t.format && t.indentBy.length > 0 && (r = Rt), he(e, t, "", r);
|
|
1802
1811
|
}
|
|
1803
1812
|
function he(e, t, r, s) {
|
|
1804
1813
|
let n = "", i = !1;
|
|
1805
1814
|
for (let a = 0; a < e.length; a++) {
|
|
1806
|
-
const u = e[a], o =
|
|
1815
|
+
const u = e[a], o = Bt(u);
|
|
1807
1816
|
if (o === void 0)
|
|
1808
1817
|
continue;
|
|
1809
1818
|
let d = "";
|
|
1810
1819
|
if (r.length === 0 ? d = o : d = `${r}.${o}`, o === t.textNodeName) {
|
|
1811
1820
|
let h = u[o];
|
|
1812
|
-
|
|
1821
|
+
kt(d, t) || (h = t.tagValueProcessor(o, h), h = pe(h, t)), i && (n += s), n += h, i = !1;
|
|
1813
1822
|
continue;
|
|
1814
1823
|
} else if (o === t.cdataPropName) {
|
|
1815
1824
|
i && (n += s), n += `<![CDATA[${u[o][0][t.textNodeName]}]]>`, i = !1;
|
|
@@ -1818,19 +1827,19 @@ function he(e, t, r, s) {
|
|
|
1818
1827
|
n += s + `<!--${u[o][0][t.textNodeName]}-->`, i = !0;
|
|
1819
1828
|
continue;
|
|
1820
1829
|
} else if (o[0] === "?") {
|
|
1821
|
-
const h =
|
|
1830
|
+
const h = D(u[":@"], t), T = o === "?xml" ? "" : s;
|
|
1822
1831
|
let E = u[o][0][t.textNodeName];
|
|
1823
1832
|
E = E.length !== 0 ? " " + E : "", n += T + `<${o}${E}${h}?>`, i = !0;
|
|
1824
1833
|
continue;
|
|
1825
1834
|
}
|
|
1826
1835
|
let l = s;
|
|
1827
1836
|
l !== "" && (l += t.indentBy);
|
|
1828
|
-
const f =
|
|
1837
|
+
const f = D(u[":@"], t), c = s + `<${o}${f}`, g = he(u[o], t, d, l);
|
|
1829
1838
|
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;
|
|
1830
1839
|
}
|
|
1831
1840
|
return n;
|
|
1832
1841
|
}
|
|
1833
|
-
function
|
|
1842
|
+
function Bt(e) {
|
|
1834
1843
|
const t = Object.keys(e);
|
|
1835
1844
|
for (let r = 0; r < t.length; r++) {
|
|
1836
1845
|
const s = t[r];
|
|
@@ -1838,7 +1847,7 @@ function Mt(e) {
|
|
|
1838
1847
|
return s;
|
|
1839
1848
|
}
|
|
1840
1849
|
}
|
|
1841
|
-
function
|
|
1850
|
+
function D(e, t) {
|
|
1842
1851
|
let r = "";
|
|
1843
1852
|
if (e && !t.ignoreAttributes)
|
|
1844
1853
|
for (let s in e) {
|
|
@@ -1849,7 +1858,7 @@ function ee(e, t) {
|
|
|
1849
1858
|
}
|
|
1850
1859
|
return r;
|
|
1851
1860
|
}
|
|
1852
|
-
function
|
|
1861
|
+
function kt(e, t) {
|
|
1853
1862
|
e = e.substr(0, e.length - t.textNodeName.length - 1);
|
|
1854
1863
|
let r = e.substr(e.lastIndexOf(".") + 1);
|
|
1855
1864
|
for (let s in t.stopNodes)
|
|
@@ -1865,8 +1874,8 @@ function pe(e, t) {
|
|
|
1865
1874
|
}
|
|
1866
1875
|
return e;
|
|
1867
1876
|
}
|
|
1868
|
-
var
|
|
1869
|
-
const
|
|
1877
|
+
var qt = Mt;
|
|
1878
|
+
const Ut = qt, Xt = {
|
|
1870
1879
|
attributeNamePrefix: "@_",
|
|
1871
1880
|
attributesGroupName: !1,
|
|
1872
1881
|
textNodeName: "#text",
|
|
@@ -1900,21 +1909,21 @@ const qt = kt, Ut = {
|
|
|
1900
1909
|
// transformAttributeName: false,
|
|
1901
1910
|
oneListGroup: !1
|
|
1902
1911
|
};
|
|
1903
|
-
function
|
|
1904
|
-
this.options = Object.assign({},
|
|
1912
|
+
function b(e) {
|
|
1913
|
+
this.options = Object.assign({}, Xt, e), this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() {
|
|
1905
1914
|
return !1;
|
|
1906
|
-
} : (this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute =
|
|
1915
|
+
} : (this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = zt), this.processTextOrObjNode = Gt, this.options.format ? (this.indentate = Ht, this.tagEndChar = `>
|
|
1907
1916
|
`, this.newLine = `
|
|
1908
1917
|
`) : (this.indentate = function() {
|
|
1909
1918
|
return "";
|
|
1910
1919
|
}, this.tagEndChar = ">", this.newLine = "");
|
|
1911
1920
|
}
|
|
1912
|
-
|
|
1913
|
-
return this.options.preserveOrder ?
|
|
1921
|
+
b.prototype.build = function(e) {
|
|
1922
|
+
return this.options.preserveOrder ? Ut(e, this.options) : (Array.isArray(e) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (e = {
|
|
1914
1923
|
[this.options.arrayNodeName]: e
|
|
1915
1924
|
}), this.j2x(e, 0).val);
|
|
1916
1925
|
};
|
|
1917
|
-
|
|
1926
|
+
b.prototype.j2x = function(e, t) {
|
|
1918
1927
|
let r = "", s = "";
|
|
1919
1928
|
for (let n in e)
|
|
1920
1929
|
if (Object.prototype.hasOwnProperty.call(e, n))
|
|
@@ -1949,14 +1958,14 @@ y.prototype.j2x = function(e, t) {
|
|
|
1949
1958
|
s += this.processTextOrObjNode(e[n], n, t);
|
|
1950
1959
|
return { attrStr: r, val: s };
|
|
1951
1960
|
};
|
|
1952
|
-
|
|
1961
|
+
b.prototype.buildAttrPairStr = function(e, t) {
|
|
1953
1962
|
return t = this.options.attributeValueProcessor(e, "" + t), t = this.replaceEntitiesValue(t), this.options.suppressBooleanAttributes && t === "true" ? " " + e : " " + e + '="' + t + '"';
|
|
1954
1963
|
};
|
|
1955
|
-
function
|
|
1964
|
+
function Gt(e, t, r) {
|
|
1956
1965
|
const s = this.j2x(e, r + 1);
|
|
1957
1966
|
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);
|
|
1958
1967
|
}
|
|
1959
|
-
|
|
1968
|
+
b.prototype.buildObjectNode = function(e, t, r, s) {
|
|
1960
1969
|
if (e === "")
|
|
1961
1970
|
return t[0] === "?" ? this.indentate(s) + "<" + t + r + "?" + this.tagEndChar : this.indentate(s) + "<" + t + r + this.closeTag(t) + this.tagEndChar;
|
|
1962
1971
|
{
|
|
@@ -1964,11 +1973,11 @@ y.prototype.buildObjectNode = function(e, t, r, s) {
|
|
|
1964
1973
|
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;
|
|
1965
1974
|
}
|
|
1966
1975
|
};
|
|
1967
|
-
|
|
1976
|
+
b.prototype.closeTag = function(e) {
|
|
1968
1977
|
let t = "";
|
|
1969
1978
|
return this.options.unpairedTags.indexOf(e) !== -1 ? this.options.suppressUnpairedNode || (t = "/") : this.options.suppressEmptyNode ? t = "/" : t = `></${e}`, t;
|
|
1970
1979
|
};
|
|
1971
|
-
|
|
1980
|
+
b.prototype.buildTextValNode = function(e, t, r, s) {
|
|
1972
1981
|
if (this.options.cdataPropName !== !1 && t === this.options.cdataPropName)
|
|
1973
1982
|
return this.indentate(s) + `<![CDATA[${e}]]>` + this.newLine;
|
|
1974
1983
|
if (this.options.commentPropName !== !1 && t === this.options.commentPropName)
|
|
@@ -1980,7 +1989,7 @@ y.prototype.buildTextValNode = function(e, t, r, s) {
|
|
|
1980
1989
|
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;
|
|
1981
1990
|
}
|
|
1982
1991
|
};
|
|
1983
|
-
|
|
1992
|
+
b.prototype.replaceEntitiesValue = function(e) {
|
|
1984
1993
|
if (e && e.length > 0 && this.options.processEntities)
|
|
1985
1994
|
for (let t = 0; t < this.options.entities.length; t++) {
|
|
1986
1995
|
const r = this.options.entities[t];
|
|
@@ -1988,26 +1997,26 @@ y.prototype.replaceEntitiesValue = function(e) {
|
|
|
1988
1997
|
}
|
|
1989
1998
|
return e;
|
|
1990
1999
|
};
|
|
1991
|
-
function
|
|
2000
|
+
function Ht(e) {
|
|
1992
2001
|
return this.options.indentBy.repeat(e);
|
|
1993
2002
|
}
|
|
1994
|
-
function
|
|
2003
|
+
function zt(e) {
|
|
1995
2004
|
return e.startsWith(this.options.attributeNamePrefix) && e !== this.options.textNodeName ? e.substr(this.attrPrefixLen) : !1;
|
|
1996
2005
|
}
|
|
1997
|
-
var
|
|
1998
|
-
const
|
|
1999
|
-
var
|
|
2000
|
-
XMLParser:
|
|
2001
|
-
XMLValidator:
|
|
2002
|
-
XMLBuilder:
|
|
2006
|
+
var Kt = b;
|
|
2007
|
+
const Wt = G, Zt = Lt, jt = Kt;
|
|
2008
|
+
var ee = {
|
|
2009
|
+
XMLParser: Zt,
|
|
2010
|
+
XMLValidator: Wt,
|
|
2011
|
+
XMLBuilder: jt
|
|
2003
2012
|
};
|
|
2004
|
-
function
|
|
2013
|
+
function Yt(e) {
|
|
2005
2014
|
if (typeof e != "string")
|
|
2006
2015
|
throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);
|
|
2007
|
-
if (e = e.trim(), e.length === 0 ||
|
|
2016
|
+
if (e = e.trim(), e.length === 0 || ee.XMLValidator.validate(e) !== !0)
|
|
2008
2017
|
return !1;
|
|
2009
2018
|
let t;
|
|
2010
|
-
const r = new
|
|
2019
|
+
const r = new ee.XMLParser();
|
|
2011
2020
|
try {
|
|
2012
2021
|
t = r.parse(e);
|
|
2013
2022
|
} catch {
|
|
@@ -2036,10 +2045,10 @@ function jt(e) {
|
|
|
2036
2045
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
2037
2046
|
*
|
|
2038
2047
|
*/
|
|
2039
|
-
class
|
|
2048
|
+
class Jt {
|
|
2040
2049
|
_view;
|
|
2041
2050
|
constructor(t) {
|
|
2042
|
-
|
|
2051
|
+
Qt(t), this._view = t;
|
|
2043
2052
|
}
|
|
2044
2053
|
get id() {
|
|
2045
2054
|
return this._view.id;
|
|
@@ -2099,7 +2108,7 @@ class Yt {
|
|
|
2099
2108
|
return this._view.defaultSortKey;
|
|
2100
2109
|
}
|
|
2101
2110
|
}
|
|
2102
|
-
const
|
|
2111
|
+
const Qt = function(e) {
|
|
2103
2112
|
if (!e.id || typeof e.id != "string")
|
|
2104
2113
|
throw new Error("View id is required and must be a string");
|
|
2105
2114
|
if (!e.name || typeof e.name != "string")
|
|
@@ -2108,12 +2117,12 @@ const Jt = function(e) {
|
|
|
2108
2117
|
throw new Error("View caption is required for top-level views and must be a string");
|
|
2109
2118
|
if (!e.getContents || typeof e.getContents != "function")
|
|
2110
2119
|
throw new Error("View getContents is required and must be a function");
|
|
2111
|
-
if (!e.icon || typeof e.icon != "string" || !
|
|
2120
|
+
if (!e.icon || typeof e.icon != "string" || !Yt(e.icon))
|
|
2112
2121
|
throw new Error("View icon is required and must be a valid svg string");
|
|
2113
2122
|
if (!("order" in e) || typeof e.order != "number")
|
|
2114
2123
|
throw new Error("View order is required and must be a number");
|
|
2115
2124
|
if (e.columns && e.columns.forEach((t) => {
|
|
2116
|
-
if (!(t instanceof
|
|
2125
|
+
if (!(t instanceof ae))
|
|
2117
2126
|
throw new Error("View columns must be an array of Column. Invalid column found");
|
|
2118
2127
|
}), e.emptyView && typeof e.emptyView != "function")
|
|
2119
2128
|
throw new Error("View emptyView must be a function");
|
|
@@ -2149,46 +2158,46 @@ const Jt = function(e) {
|
|
|
2149
2158
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
2150
2159
|
*
|
|
2151
2160
|
*/
|
|
2152
|
-
const
|
|
2153
|
-
return
|
|
2154
|
-
}, Dt = function(e) {
|
|
2155
|
-
return S().unregisterEntry(e);
|
|
2161
|
+
const Dt = function(e) {
|
|
2162
|
+
return L().registerEntry(e);
|
|
2156
2163
|
}, er = function(e) {
|
|
2157
|
-
return
|
|
2164
|
+
return L().unregisterEntry(e);
|
|
2165
|
+
}, tr = function(e) {
|
|
2166
|
+
return L().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" }));
|
|
2158
2167
|
};
|
|
2159
|
-
exports.Column =
|
|
2160
|
-
exports.DefaultType =
|
|
2161
|
-
exports.File =
|
|
2162
|
-
exports.FileAction =
|
|
2168
|
+
exports.Column = ae;
|
|
2169
|
+
exports.DefaultType = R;
|
|
2170
|
+
exports.File = ie;
|
|
2171
|
+
exports.FileAction = _e;
|
|
2163
2172
|
exports.FileType = O;
|
|
2164
|
-
exports.Folder =
|
|
2165
|
-
exports.Header =
|
|
2166
|
-
exports.Navigation =
|
|
2173
|
+
exports.Folder = se;
|
|
2174
|
+
exports.Header = Ae;
|
|
2175
|
+
exports.Navigation = ue;
|
|
2167
2176
|
exports.Node = q;
|
|
2168
2177
|
exports.NodeStatus = k;
|
|
2169
2178
|
exports.Permission = m;
|
|
2170
|
-
exports.View =
|
|
2171
|
-
exports.addNewFileMenuEntry =
|
|
2172
|
-
exports.davGetClient =
|
|
2173
|
-
exports.davGetDefaultPropfind =
|
|
2174
|
-
exports.davGetFavoritesReport =
|
|
2175
|
-
exports.davGetRecentSearch =
|
|
2176
|
-
exports.davParsePermissions =
|
|
2179
|
+
exports.View = Jt;
|
|
2180
|
+
exports.addNewFileMenuEntry = Dt;
|
|
2181
|
+
exports.davGetClient = $e;
|
|
2182
|
+
exports.davGetDefaultPropfind = Fe;
|
|
2183
|
+
exports.davGetFavoritesReport = te;
|
|
2184
|
+
exports.davGetRecentSearch = xe;
|
|
2185
|
+
exports.davParsePermissions = re;
|
|
2177
2186
|
exports.davRemoteURL = X;
|
|
2178
|
-
exports.davResultToNode =
|
|
2187
|
+
exports.davResultToNode = oe;
|
|
2179
2188
|
exports.davRootPath = U;
|
|
2180
2189
|
exports.defaultDavNamespaces = B;
|
|
2181
2190
|
exports.defaultDavProperties = M;
|
|
2182
2191
|
exports.formatFileSize = ye;
|
|
2183
|
-
exports.getDavNameSpaces =
|
|
2184
|
-
exports.getDavProperties =
|
|
2185
|
-
exports.getFavoriteNodes =
|
|
2186
|
-
exports.getFileActions =
|
|
2192
|
+
exports.getDavNameSpaces = P;
|
|
2193
|
+
exports.getDavProperties = C;
|
|
2194
|
+
exports.getFavoriteNodes = Se;
|
|
2195
|
+
exports.getFileActions = Ie;
|
|
2187
2196
|
exports.getFileListHeaders = Pe;
|
|
2188
2197
|
exports.getNavigation = Ve;
|
|
2189
|
-
exports.getNewFileMenuEntries =
|
|
2190
|
-
exports.parseFileSize =
|
|
2191
|
-
exports.registerDavProperty =
|
|
2192
|
-
exports.registerFileAction =
|
|
2193
|
-
exports.registerFileListHeaders =
|
|
2194
|
-
exports.removeNewFileMenuEntry =
|
|
2198
|
+
exports.getNewFileMenuEntries = tr;
|
|
2199
|
+
exports.parseFileSize = ve;
|
|
2200
|
+
exports.registerDavProperty = Oe;
|
|
2201
|
+
exports.registerFileAction = Te;
|
|
2202
|
+
exports.registerFileListHeaders = Ce;
|
|
2203
|
+
exports.removeNewFileMenuEntry = er;
|