@nextcloud/files 3.1.1 → 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 +191 -177
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +195 -180
- package/dist/index.mjs.map +1 -1
- package/dist/vendor.LICENSE.txt +1 -1
- package/package.json +9 -8
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"), K = require("@nextcloud/logger"), ge = require("@nextcloud/l10n"),
|
|
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"), K = 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 ? K.getLoggerBuilder().setApp("files").build() : K.
|
|
|
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);
|
|
@@ -86,7 +86,7 @@ class Ee {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
const L = function() {
|
|
89
|
-
return typeof window._nc_newfilemenu > "u" && (window._nc_newfilemenu = new
|
|
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 {
|
|
@@ -161,7 +161,7 @@ function be(e, t = !1) {
|
|
|
161
161
|
*
|
|
162
162
|
*/
|
|
163
163
|
var R = /* @__PURE__ */ ((e) => (e.DEFAULT = "default", e.HIDDEN = "hidden", e))(R || {});
|
|
164
|
-
class
|
|
164
|
+
class _e {
|
|
165
165
|
_action;
|
|
166
166
|
constructor(t) {
|
|
167
167
|
this.validateAction(t), this._action = t;
|
|
@@ -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;
|
|
@@ -376,35 +376,35 @@ const M = [
|
|
|
376
376
|
return N.error(`${e} is not valid. See example: 'oc:fileid'`, { prop: e }), !1;
|
|
377
377
|
const s = e.split(":")[0];
|
|
378
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);
|
|
379
|
-
},
|
|
379
|
+
}, C = function() {
|
|
380
380
|
return typeof window._nc_dav_properties > "u" && (window._nc_dav_properties = [...M]), window._nc_dav_properties.map((e) => `<${e} />`).join(" ");
|
|
381
|
-
},
|
|
381
|
+
}, P = function() {
|
|
382
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(" ");
|
|
383
|
-
},
|
|
383
|
+
}, Fe = function() {
|
|
384
384
|
return `<?xml version="1.0"?>
|
|
385
|
-
<d:propfind ${
|
|
385
|
+
<d:propfind ${P()}>
|
|
386
386
|
<d:prop>
|
|
387
|
-
${
|
|
387
|
+
${C()}
|
|
388
388
|
</d:prop>
|
|
389
389
|
</d:propfind>`;
|
|
390
390
|
}, te = function() {
|
|
391
391
|
return `<?xml version="1.0"?>
|
|
392
|
-
<oc:filter-files ${
|
|
392
|
+
<oc:filter-files ${P()}>
|
|
393
393
|
<d:prop>
|
|
394
|
-
${
|
|
394
|
+
${C()}
|
|
395
395
|
</d:prop>
|
|
396
396
|
<oc:filter-rules>
|
|
397
397
|
<oc:favorite>1</oc:favorite>
|
|
398
398
|
</oc:filter-rules>
|
|
399
399
|
</oc:filter-files>`;
|
|
400
|
-
},
|
|
400
|
+
}, xe = function(e) {
|
|
401
401
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
402
|
-
<d:searchrequest ${
|
|
402
|
+
<d:searchrequest ${P()}
|
|
403
403
|
xmlns:ns="https://github.com/icewind1991/SearchDAV/ns">
|
|
404
404
|
<d:basicsearch>
|
|
405
405
|
<d:select>
|
|
406
406
|
<d:prop>
|
|
407
|
-
${
|
|
407
|
+
${C()}
|
|
408
408
|
</d:prop>
|
|
409
409
|
</d:select>
|
|
410
410
|
<d:from>
|
|
@@ -501,7 +501,7 @@ const re = function(e = "") {
|
|
|
501
501
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
502
502
|
*
|
|
503
503
|
*/
|
|
504
|
-
var
|
|
504
|
+
var O = /* @__PURE__ */ ((e) => (e.Folder = "folder", e.File = "file", e))(O || {});
|
|
505
505
|
/**
|
|
506
506
|
* @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
|
|
507
507
|
*
|
|
@@ -559,7 +559,7 @@ const ne = function(e, t) {
|
|
|
559
559
|
throw new Error("Root must be part of the source");
|
|
560
560
|
if (e.root && ne(e.source, t)) {
|
|
561
561
|
const r = e.source.match(t)[0];
|
|
562
|
-
if (!e.source.includes(
|
|
562
|
+
if (!e.source.includes(y.join(r, e.root)))
|
|
563
563
|
throw new Error("The root must be relative to the service. e.g /files/emma");
|
|
564
564
|
}
|
|
565
565
|
if (e.status && !Object.values(k).includes(e.status))
|
|
@@ -618,13 +618,13 @@ class q {
|
|
|
618
618
|
* Get this object name
|
|
619
619
|
*/
|
|
620
620
|
get basename() {
|
|
621
|
-
return
|
|
621
|
+
return y.basename(this.source);
|
|
622
622
|
}
|
|
623
623
|
/**
|
|
624
624
|
* Get this object's extension
|
|
625
625
|
*/
|
|
626
626
|
get extension() {
|
|
627
|
-
return
|
|
627
|
+
return y.extname(this.source);
|
|
628
628
|
}
|
|
629
629
|
/**
|
|
630
630
|
* Get the directory path leading to this object
|
|
@@ -635,10 +635,10 @@ class q {
|
|
|
635
635
|
let r = this.source;
|
|
636
636
|
this.isDavRessource && (r = r.split(this._knownDavService).pop());
|
|
637
637
|
const s = r.indexOf(this.root), n = this.root.replace(/\/$/, "");
|
|
638
|
-
return
|
|
638
|
+
return y.dirname(r.slice(s + n.length) || "/");
|
|
639
639
|
}
|
|
640
640
|
const t = new URL(this.source);
|
|
641
|
-
return
|
|
641
|
+
return y.dirname(t.pathname);
|
|
642
642
|
}
|
|
643
643
|
/**
|
|
644
644
|
* Get the file mime
|
|
@@ -692,7 +692,7 @@ class q {
|
|
|
692
692
|
* Get the dav root of this object
|
|
693
693
|
*/
|
|
694
694
|
get root() {
|
|
695
|
-
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;
|
|
696
696
|
}
|
|
697
697
|
/**
|
|
698
698
|
* Get the absolute path of this object relative to the root
|
|
@@ -743,7 +743,7 @@ class q {
|
|
|
743
743
|
rename(t) {
|
|
744
744
|
if (t.includes("/"))
|
|
745
745
|
throw new Error("Invalid basename");
|
|
746
|
-
this.move(
|
|
746
|
+
this.move(y.dirname(this.source) + "/" + t);
|
|
747
747
|
}
|
|
748
748
|
/**
|
|
749
749
|
* Update the mtime if exists.
|
|
@@ -775,7 +775,7 @@ class q {
|
|
|
775
775
|
*/
|
|
776
776
|
class ie extends q {
|
|
777
777
|
get type() {
|
|
778
|
-
return
|
|
778
|
+
return O.File;
|
|
779
779
|
}
|
|
780
780
|
}
|
|
781
781
|
/**
|
|
@@ -807,7 +807,7 @@ class se extends q {
|
|
|
807
807
|
});
|
|
808
808
|
}
|
|
809
809
|
get type() {
|
|
810
|
-
return
|
|
810
|
+
return O.Folder;
|
|
811
811
|
}
|
|
812
812
|
get extension() {
|
|
813
813
|
return null;
|
|
@@ -838,7 +838,7 @@ class se extends q {
|
|
|
838
838
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
839
839
|
*
|
|
840
840
|
*/
|
|
841
|
-
const U = `/files/${_.getCurrentUser()?.uid}`, X = me.generateRemoteUrl("dav"),
|
|
841
|
+
const U = `/files/${_.getCurrentUser()?.uid}`, X = me.generateRemoteUrl("dav"), $e = function(e = X, t = {}) {
|
|
842
842
|
const r = W.createClient(e, { headers: t });
|
|
843
843
|
function s(i) {
|
|
844
844
|
r.setHeaders({
|
|
@@ -853,15 +853,27 @@ const U = `/files/${_.getCurrentUser()?.uid}`, X = me.generateRemoteUrl("dav"),
|
|
|
853
853
|
const u = a.headers;
|
|
854
854
|
return u?.method && (a.method = u.method, delete u.method), fetch(i, a);
|
|
855
855
|
}), r;
|
|
856
|
-
},
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
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) {
|
|
865
877
|
const s = _.getCurrentUser()?.uid;
|
|
866
878
|
if (!s)
|
|
867
879
|
throw new Error("No user id found");
|
|
@@ -952,7 +964,7 @@ const Ve = function() {
|
|
|
952
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 ae {
|
|
|
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,13 +1027,13 @@ 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));
|
|
@@ -1041,11 +1053,11 @@ 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;
|
|
@@ -1094,7 +1106,7 @@ G.validate = function(e, t) {
|
|
|
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;
|
|
@@ -1158,11 +1170,11 @@ function J(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
|
|
1191
|
+
const qe = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
|
|
1180
1192
|
function Q(e, t) {
|
|
1181
|
-
const r = H.getAllMatches(e,
|
|
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 Q(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 Q(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) {
|
|
@@ -1291,12 +1303,12 @@ const de = {
|
|
|
1291
1303
|
return e;
|
|
1292
1304
|
}
|
|
1293
1305
|
// skipEmptyListItem: false
|
|
1294
|
-
},
|
|
1306
|
+
}, ze = function(e) {
|
|
1295
1307
|
return Object.assign({}, de, e);
|
|
1296
1308
|
};
|
|
1297
|
-
z.buildOptions =
|
|
1309
|
+
z.buildOptions = ze;
|
|
1298
1310
|
z.defaultOptions = de;
|
|
1299
|
-
class
|
|
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,12 +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 le = F, A =
|
|
1420
|
-
let
|
|
1430
|
+
var dt = ut;
|
|
1431
|
+
const le = F, A = We, lt = nt, ft = dt;
|
|
1432
|
+
let ct = class {
|
|
1421
1433
|
constructor(t) {
|
|
1422
1434
|
this.options = t, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = {
|
|
1423
1435
|
apos: { regex: /&(apos|#39|#x27);/g, val: "'" },
|
|
@@ -1437,11 +1449,13 @@ let ft = class {
|
|
|
1437
1449
|
euro: { regex: /&(euro|#8364);/g, val: "€" },
|
|
1438
1450
|
copyright: { regex: /&(copy|#169);/g, val: "©" },
|
|
1439
1451
|
reg: { regex: /&(reg|#174);/g, val: "®" },
|
|
1440
|
-
inr: { regex: /&(inr|#8377);/g, val: "₹" }
|
|
1441
|
-
|
|
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;
|
|
1442
1456
|
}
|
|
1443
1457
|
};
|
|
1444
|
-
function
|
|
1458
|
+
function ht(e) {
|
|
1445
1459
|
const t = Object.keys(e);
|
|
1446
1460
|
for (let r = 0; r < t.length; r++) {
|
|
1447
1461
|
const s = t[r];
|
|
@@ -1451,14 +1465,14 @@ function ct(e) {
|
|
|
1451
1465
|
};
|
|
1452
1466
|
}
|
|
1453
1467
|
}
|
|
1454
|
-
function
|
|
1468
|
+
function pt(e, t, r, s, n, i, a) {
|
|
1455
1469
|
if (e !== void 0 && (this.options.trimValues && !s && (e = e.trim()), e.length > 0)) {
|
|
1456
1470
|
a || (e = this.replaceEntitiesValue(e));
|
|
1457
1471
|
const u = this.options.tagValueProcessor(t, e, r, n, i);
|
|
1458
|
-
return u == null ? e : typeof u != typeof e || u !== e ? u : this.options.trimValues ?
|
|
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;
|
|
1459
1473
|
}
|
|
1460
1474
|
}
|
|
1461
|
-
function
|
|
1475
|
+
function gt(e) {
|
|
1462
1476
|
if (this.options.removeNSPrefix) {
|
|
1463
1477
|
const t = e.split(":"), r = e.charAt(0) === "/" ? "/" : "";
|
|
1464
1478
|
if (t[0] === "xmlns")
|
|
@@ -1467,10 +1481,10 @@ function pt(e) {
|
|
|
1467
1481
|
}
|
|
1468
1482
|
return e;
|
|
1469
1483
|
}
|
|
1470
|
-
const
|
|
1471
|
-
function
|
|
1484
|
+
const wt = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
|
|
1485
|
+
function mt(e, t, r) {
|
|
1472
1486
|
if (!this.options.ignoreAttributes && typeof e == "string") {
|
|
1473
|
-
const s = le.getAllMatches(e,
|
|
1487
|
+
const s = le.getAllMatches(e, wt), n = s.length, i = {};
|
|
1474
1488
|
for (let a = 0; a < n; a++) {
|
|
1475
1489
|
const u = this.resolveNameSpace(s[a][1]);
|
|
1476
1490
|
let o = s[a][4], d = this.options.attributeNamePrefix + u;
|
|
@@ -1478,7 +1492,7 @@ function wt(e, t, r) {
|
|
|
1478
1492
|
if (this.options.transformAttributeName && (d = this.options.transformAttributeName(d)), d === "__proto__" && (d = "#__proto__"), o !== void 0) {
|
|
1479
1493
|
this.options.trimValues && (o = o.trim()), o = this.replaceEntitiesValue(o);
|
|
1480
1494
|
const l = this.options.attributeValueProcessor(u, o, t);
|
|
1481
|
-
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(
|
|
1482
1496
|
o,
|
|
1483
1497
|
this.options.parseAttributeValue,
|
|
1484
1498
|
this.options.numberParseOptions
|
|
@@ -1495,7 +1509,7 @@ function wt(e, t, r) {
|
|
|
1495
1509
|
return i;
|
|
1496
1510
|
}
|
|
1497
1511
|
}
|
|
1498
|
-
const
|
|
1512
|
+
const Nt = function(e) {
|
|
1499
1513
|
e = e.replace(/\r\n?/g, `
|
|
1500
1514
|
`);
|
|
1501
1515
|
const t = new A("!xml");
|
|
@@ -1516,7 +1530,7 @@ const mt = function(e) {
|
|
|
1516
1530
|
let l = 0;
|
|
1517
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;
|
|
1518
1532
|
} else if (e[i + 1] === "?") {
|
|
1519
|
-
let u =
|
|
1533
|
+
let u = S(e, i, !1, "?>");
|
|
1520
1534
|
if (!u)
|
|
1521
1535
|
throw new Error("Pi Tag is not closed.");
|
|
1522
1536
|
if (s = this.saveTextToParentTag(s, r, n), !(this.options.ignoreDeclaration && u.tagName === "?xml" || this.options.ignorePiTags)) {
|
|
@@ -1532,7 +1546,7 @@ const mt = function(e) {
|
|
|
1532
1546
|
}
|
|
1533
1547
|
i = u;
|
|
1534
1548
|
} else if (e.substr(i + 1, 2) === "!D") {
|
|
1535
|
-
const u =
|
|
1549
|
+
const u = lt(e, i);
|
|
1536
1550
|
this.docTypeEntities = u.entities, i = u.i;
|
|
1537
1551
|
} else if (e.substr(i + 1, 2) === "![") {
|
|
1538
1552
|
const u = v(e, "]]>", i, "CDATA is not closed.") - 2, o = e.substring(i + 9, u);
|
|
@@ -1540,7 +1554,7 @@ const mt = function(e) {
|
|
|
1540
1554
|
let d = this.parseTextData(o, r.tagname, n, !0, !1, !0, !0);
|
|
1541
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;
|
|
1542
1556
|
} else {
|
|
1543
|
-
let u =
|
|
1557
|
+
let u = S(e, i, this.options.removeNSPrefix), o = u.tagName;
|
|
1544
1558
|
const d = u.rawTagName;
|
|
1545
1559
|
let l = u.tagExp, f = u.attrExpPresent, c = u.closeIndex;
|
|
1546
1560
|
this.options.transformTagName && (o = this.options.transformTagName(o)), r && s && r.tagname !== "!xml" && (s = this.saveTextToParentTag(s, r, n, !1));
|
|
@@ -1575,11 +1589,11 @@ const mt = function(e) {
|
|
|
1575
1589
|
s += e[i];
|
|
1576
1590
|
return t.child;
|
|
1577
1591
|
};
|
|
1578
|
-
function
|
|
1592
|
+
function Et(e, t, r) {
|
|
1579
1593
|
const s = this.options.updateTag(t.tagname, r, t[":@"]);
|
|
1580
1594
|
s === !1 || (typeof s == "string" && (t.tagname = s), e.addChild(t));
|
|
1581
1595
|
}
|
|
1582
|
-
const
|
|
1596
|
+
const bt = function(e) {
|
|
1583
1597
|
if (this.options.processEntities) {
|
|
1584
1598
|
for (let t in this.docTypeEntities) {
|
|
1585
1599
|
const r = this.docTypeEntities[t];
|
|
@@ -1608,7 +1622,7 @@ function yt(e, t, r, s) {
|
|
|
1608
1622
|
s
|
|
1609
1623
|
), e !== void 0 && e !== "" && t.add(this.options.textNodeName, e), e = ""), e;
|
|
1610
1624
|
}
|
|
1611
|
-
function
|
|
1625
|
+
function vt(e, t, r) {
|
|
1612
1626
|
const s = "*." + r;
|
|
1613
1627
|
for (const n in e) {
|
|
1614
1628
|
const i = e[n];
|
|
@@ -1617,7 +1631,7 @@ function bt(e, t, r) {
|
|
|
1617
1631
|
}
|
|
1618
1632
|
return !1;
|
|
1619
1633
|
}
|
|
1620
|
-
function
|
|
1634
|
+
function _t(e, t, r = ">") {
|
|
1621
1635
|
let s, n = "";
|
|
1622
1636
|
for (let i = t; i < e.length; i++) {
|
|
1623
1637
|
let a = e[i];
|
|
@@ -1648,8 +1662,8 @@ function v(e, t, r, s) {
|
|
|
1648
1662
|
throw new Error(s);
|
|
1649
1663
|
return n + t.length - 1;
|
|
1650
1664
|
}
|
|
1651
|
-
function
|
|
1652
|
-
const n =
|
|
1665
|
+
function S(e, t, r, s = ">") {
|
|
1666
|
+
const n = _t(e, t + 1, s);
|
|
1653
1667
|
if (!n)
|
|
1654
1668
|
return;
|
|
1655
1669
|
let i = n.data;
|
|
@@ -1669,7 +1683,7 @@ function V(e, t, r, s = ">") {
|
|
|
1669
1683
|
rawTagName: l
|
|
1670
1684
|
};
|
|
1671
1685
|
}
|
|
1672
|
-
function
|
|
1686
|
+
function Tt(e, t, r) {
|
|
1673
1687
|
const s = r;
|
|
1674
1688
|
let n = 1;
|
|
1675
1689
|
for (; r < e.length; r++)
|
|
@@ -1689,26 +1703,26 @@ function _t(e, t, r) {
|
|
|
1689
1703
|
else if (e.substr(r + 1, 2) === "![")
|
|
1690
1704
|
r = v(e, "]]>", r, "StopNode is not closed.") - 2;
|
|
1691
1705
|
else {
|
|
1692
|
-
const i =
|
|
1706
|
+
const i = S(e, r, ">");
|
|
1693
1707
|
i && ((i && i.tagName) === t && i.tagExp[i.tagExp.length - 1] !== "/" && n++, r = i.closeIndex);
|
|
1694
1708
|
}
|
|
1695
1709
|
}
|
|
1696
|
-
function
|
|
1710
|
+
function V(e, t, r) {
|
|
1697
1711
|
if (t && typeof e == "string") {
|
|
1698
1712
|
const s = e.trim();
|
|
1699
|
-
return s === "true" ? !0 : s === "false" ? !1 :
|
|
1713
|
+
return s === "true" ? !0 : s === "false" ? !1 : ft(e, r);
|
|
1700
1714
|
} else
|
|
1701
1715
|
return le.isExist(e) ? e : "";
|
|
1702
1716
|
}
|
|
1703
|
-
var
|
|
1704
|
-
function
|
|
1717
|
+
var It = ct, fe = {};
|
|
1718
|
+
function At(e, t) {
|
|
1705
1719
|
return ce(e, t);
|
|
1706
1720
|
}
|
|
1707
1721
|
function ce(e, t, r) {
|
|
1708
1722
|
let s;
|
|
1709
1723
|
const n = {};
|
|
1710
1724
|
for (let i = 0; i < e.length; i++) {
|
|
1711
|
-
const a = e[i], u =
|
|
1725
|
+
const a = e[i], u = Ct(a);
|
|
1712
1726
|
let o = "";
|
|
1713
1727
|
if (r === void 0 ? o = u : o = r + "." + u, u === t.textNodeName)
|
|
1714
1728
|
s === void 0 ? s = a[u] : s += "" + a[u];
|
|
@@ -1724,7 +1738,7 @@ function ce(e, t, r) {
|
|
|
1724
1738
|
}
|
|
1725
1739
|
return typeof s == "string" ? s.length > 0 && (n[t.textNodeName] = s) : s !== void 0 && (n[t.textNodeName] = s), n;
|
|
1726
1740
|
}
|
|
1727
|
-
function
|
|
1741
|
+
function Ct(e) {
|
|
1728
1742
|
const t = Object.keys(e);
|
|
1729
1743
|
for (let r = 0; r < t.length; r++) {
|
|
1730
1744
|
const s = t[r];
|
|
@@ -1745,11 +1759,11 @@ function Ot(e, t) {
|
|
|
1745
1759
|
const { textNodeName: r } = t, s = Object.keys(e).length;
|
|
1746
1760
|
return !!(s === 0 || s === 1 && (e[r] || typeof e[r] == "boolean" || e[r] === 0));
|
|
1747
1761
|
}
|
|
1748
|
-
fe.prettify =
|
|
1749
|
-
const { buildOptions:
|
|
1762
|
+
fe.prettify = At;
|
|
1763
|
+
const { buildOptions: Ft } = z, xt = It, { prettify: $t } = fe, St = G;
|
|
1750
1764
|
let Vt = class {
|
|
1751
1765
|
constructor(t) {
|
|
1752
|
-
this.externalEntities = {}, this.options =
|
|
1766
|
+
this.externalEntities = {}, this.options = Ft(t);
|
|
1753
1767
|
}
|
|
1754
1768
|
/**
|
|
1755
1769
|
* Parse XML dats to JS object
|
|
@@ -1764,14 +1778,14 @@ let Vt = class {
|
|
|
1764
1778
|
throw new Error("XML data is accepted in String or Bytes[] form.");
|
|
1765
1779
|
if (r) {
|
|
1766
1780
|
r === !0 && (r = {});
|
|
1767
|
-
const i =
|
|
1781
|
+
const i = St.validate(t, r);
|
|
1768
1782
|
if (i !== !0)
|
|
1769
1783
|
throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`);
|
|
1770
1784
|
}
|
|
1771
|
-
const s = new
|
|
1785
|
+
const s = new xt(this.options);
|
|
1772
1786
|
s.addExternalEntities(this.externalEntities);
|
|
1773
1787
|
const n = s.parseXml(t);
|
|
1774
|
-
return this.options.preserveOrder || n === void 0 ? n :
|
|
1788
|
+
return this.options.preserveOrder || n === void 0 ? n : $t(n, this.options);
|
|
1775
1789
|
}
|
|
1776
1790
|
/**
|
|
1777
1791
|
* Add Entity which is not by default supported by this library
|
|
@@ -1788,23 +1802,23 @@ let Vt = class {
|
|
|
1788
1802
|
this.externalEntities[t] = r;
|
|
1789
1803
|
}
|
|
1790
1804
|
};
|
|
1791
|
-
var
|
|
1792
|
-
const
|
|
1805
|
+
var Lt = Vt;
|
|
1806
|
+
const Rt = `
|
|
1793
1807
|
`;
|
|
1794
|
-
function
|
|
1808
|
+
function Mt(e, t) {
|
|
1795
1809
|
let r = "";
|
|
1796
|
-
return t.format && t.indentBy.length > 0 && (r =
|
|
1810
|
+
return t.format && t.indentBy.length > 0 && (r = Rt), he(e, t, "", r);
|
|
1797
1811
|
}
|
|
1798
1812
|
function he(e, t, r, s) {
|
|
1799
1813
|
let n = "", i = !1;
|
|
1800
1814
|
for (let a = 0; a < e.length; a++) {
|
|
1801
|
-
const u = e[a], o =
|
|
1815
|
+
const u = e[a], o = Bt(u);
|
|
1802
1816
|
if (o === void 0)
|
|
1803
1817
|
continue;
|
|
1804
1818
|
let d = "";
|
|
1805
1819
|
if (r.length === 0 ? d = o : d = `${r}.${o}`, o === t.textNodeName) {
|
|
1806
1820
|
let h = u[o];
|
|
1807
|
-
|
|
1821
|
+
kt(d, t) || (h = t.tagValueProcessor(o, h), h = pe(h, t)), i && (n += s), n += h, i = !1;
|
|
1808
1822
|
continue;
|
|
1809
1823
|
} else if (o === t.cdataPropName) {
|
|
1810
1824
|
i && (n += s), n += `<![CDATA[${u[o][0][t.textNodeName]}]]>`, i = !1;
|
|
@@ -1825,7 +1839,7 @@ function he(e, t, r, s) {
|
|
|
1825
1839
|
}
|
|
1826
1840
|
return n;
|
|
1827
1841
|
}
|
|
1828
|
-
function
|
|
1842
|
+
function Bt(e) {
|
|
1829
1843
|
const t = Object.keys(e);
|
|
1830
1844
|
for (let r = 0; r < t.length; r++) {
|
|
1831
1845
|
const s = t[r];
|
|
@@ -1844,7 +1858,7 @@ function D(e, t) {
|
|
|
1844
1858
|
}
|
|
1845
1859
|
return r;
|
|
1846
1860
|
}
|
|
1847
|
-
function
|
|
1861
|
+
function kt(e, t) {
|
|
1848
1862
|
e = e.substr(0, e.length - t.textNodeName.length - 1);
|
|
1849
1863
|
let r = e.substr(e.lastIndexOf(".") + 1);
|
|
1850
1864
|
for (let s in t.stopNodes)
|
|
@@ -1860,8 +1874,8 @@ function pe(e, t) {
|
|
|
1860
1874
|
}
|
|
1861
1875
|
return e;
|
|
1862
1876
|
}
|
|
1863
|
-
var
|
|
1864
|
-
const
|
|
1877
|
+
var qt = Mt;
|
|
1878
|
+
const Ut = qt, Xt = {
|
|
1865
1879
|
attributeNamePrefix: "@_",
|
|
1866
1880
|
attributesGroupName: !1,
|
|
1867
1881
|
textNodeName: "#text",
|
|
@@ -1895,21 +1909,21 @@ const qt = kt, Ut = {
|
|
|
1895
1909
|
// transformAttributeName: false,
|
|
1896
1910
|
oneListGroup: !1
|
|
1897
1911
|
};
|
|
1898
|
-
function
|
|
1899
|
-
this.options = Object.assign({},
|
|
1912
|
+
function b(e) {
|
|
1913
|
+
this.options = Object.assign({}, Xt, e), this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() {
|
|
1900
1914
|
return !1;
|
|
1901
|
-
} : (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 = `>
|
|
1902
1916
|
`, this.newLine = `
|
|
1903
1917
|
`) : (this.indentate = function() {
|
|
1904
1918
|
return "";
|
|
1905
1919
|
}, this.tagEndChar = ">", this.newLine = "");
|
|
1906
1920
|
}
|
|
1907
|
-
|
|
1908
|
-
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 = {
|
|
1909
1923
|
[this.options.arrayNodeName]: e
|
|
1910
1924
|
}), this.j2x(e, 0).val);
|
|
1911
1925
|
};
|
|
1912
|
-
|
|
1926
|
+
b.prototype.j2x = function(e, t) {
|
|
1913
1927
|
let r = "", s = "";
|
|
1914
1928
|
for (let n in e)
|
|
1915
1929
|
if (Object.prototype.hasOwnProperty.call(e, n))
|
|
@@ -1944,14 +1958,14 @@ y.prototype.j2x = function(e, t) {
|
|
|
1944
1958
|
s += this.processTextOrObjNode(e[n], n, t);
|
|
1945
1959
|
return { attrStr: r, val: s };
|
|
1946
1960
|
};
|
|
1947
|
-
|
|
1961
|
+
b.prototype.buildAttrPairStr = function(e, t) {
|
|
1948
1962
|
return t = this.options.attributeValueProcessor(e, "" + t), t = this.replaceEntitiesValue(t), this.options.suppressBooleanAttributes && t === "true" ? " " + e : " " + e + '="' + t + '"';
|
|
1949
1963
|
};
|
|
1950
|
-
function
|
|
1964
|
+
function Gt(e, t, r) {
|
|
1951
1965
|
const s = this.j2x(e, r + 1);
|
|
1952
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);
|
|
1953
1967
|
}
|
|
1954
|
-
|
|
1968
|
+
b.prototype.buildObjectNode = function(e, t, r, s) {
|
|
1955
1969
|
if (e === "")
|
|
1956
1970
|
return t[0] === "?" ? this.indentate(s) + "<" + t + r + "?" + this.tagEndChar : this.indentate(s) + "<" + t + r + this.closeTag(t) + this.tagEndChar;
|
|
1957
1971
|
{
|
|
@@ -1959,11 +1973,11 @@ y.prototype.buildObjectNode = function(e, t, r, s) {
|
|
|
1959
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;
|
|
1960
1974
|
}
|
|
1961
1975
|
};
|
|
1962
|
-
|
|
1976
|
+
b.prototype.closeTag = function(e) {
|
|
1963
1977
|
let t = "";
|
|
1964
1978
|
return this.options.unpairedTags.indexOf(e) !== -1 ? this.options.suppressUnpairedNode || (t = "/") : this.options.suppressEmptyNode ? t = "/" : t = `></${e}`, t;
|
|
1965
1979
|
};
|
|
1966
|
-
|
|
1980
|
+
b.prototype.buildTextValNode = function(e, t, r, s) {
|
|
1967
1981
|
if (this.options.cdataPropName !== !1 && t === this.options.cdataPropName)
|
|
1968
1982
|
return this.indentate(s) + `<![CDATA[${e}]]>` + this.newLine;
|
|
1969
1983
|
if (this.options.commentPropName !== !1 && t === this.options.commentPropName)
|
|
@@ -1975,7 +1989,7 @@ y.prototype.buildTextValNode = function(e, t, r, s) {
|
|
|
1975
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;
|
|
1976
1990
|
}
|
|
1977
1991
|
};
|
|
1978
|
-
|
|
1992
|
+
b.prototype.replaceEntitiesValue = function(e) {
|
|
1979
1993
|
if (e && e.length > 0 && this.options.processEntities)
|
|
1980
1994
|
for (let t = 0; t < this.options.entities.length; t++) {
|
|
1981
1995
|
const r = this.options.entities[t];
|
|
@@ -1983,20 +1997,20 @@ y.prototype.replaceEntitiesValue = function(e) {
|
|
|
1983
1997
|
}
|
|
1984
1998
|
return e;
|
|
1985
1999
|
};
|
|
1986
|
-
function
|
|
2000
|
+
function Ht(e) {
|
|
1987
2001
|
return this.options.indentBy.repeat(e);
|
|
1988
2002
|
}
|
|
1989
|
-
function
|
|
2003
|
+
function zt(e) {
|
|
1990
2004
|
return e.startsWith(this.options.attributeNamePrefix) && e !== this.options.textNodeName ? e.substr(this.attrPrefixLen) : !1;
|
|
1991
2005
|
}
|
|
1992
|
-
var
|
|
1993
|
-
const
|
|
2006
|
+
var Kt = b;
|
|
2007
|
+
const Wt = G, Zt = Lt, jt = Kt;
|
|
1994
2008
|
var ee = {
|
|
1995
|
-
XMLParser:
|
|
1996
|
-
XMLValidator:
|
|
1997
|
-
XMLBuilder:
|
|
2009
|
+
XMLParser: Zt,
|
|
2010
|
+
XMLValidator: Wt,
|
|
2011
|
+
XMLBuilder: jt
|
|
1998
2012
|
};
|
|
1999
|
-
function
|
|
2013
|
+
function Yt(e) {
|
|
2000
2014
|
if (typeof e != "string")
|
|
2001
2015
|
throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);
|
|
2002
2016
|
if (e = e.trim(), e.length === 0 || ee.XMLValidator.validate(e) !== !0)
|
|
@@ -2031,10 +2045,10 @@ function jt(e) {
|
|
|
2031
2045
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
2032
2046
|
*
|
|
2033
2047
|
*/
|
|
2034
|
-
class
|
|
2048
|
+
class Jt {
|
|
2035
2049
|
_view;
|
|
2036
2050
|
constructor(t) {
|
|
2037
|
-
|
|
2051
|
+
Qt(t), this._view = t;
|
|
2038
2052
|
}
|
|
2039
2053
|
get id() {
|
|
2040
2054
|
return this._view.id;
|
|
@@ -2094,7 +2108,7 @@ class Yt {
|
|
|
2094
2108
|
return this._view.defaultSortKey;
|
|
2095
2109
|
}
|
|
2096
2110
|
}
|
|
2097
|
-
const
|
|
2111
|
+
const Qt = function(e) {
|
|
2098
2112
|
if (!e.id || typeof e.id != "string")
|
|
2099
2113
|
throw new Error("View id is required and must be a string");
|
|
2100
2114
|
if (!e.name || typeof e.name != "string")
|
|
@@ -2103,7 +2117,7 @@ const Jt = function(e) {
|
|
|
2103
2117
|
throw new Error("View caption is required for top-level views and must be a string");
|
|
2104
2118
|
if (!e.getContents || typeof e.getContents != "function")
|
|
2105
2119
|
throw new Error("View getContents is required and must be a function");
|
|
2106
|
-
if (!e.icon || typeof e.icon != "string" || !
|
|
2120
|
+
if (!e.icon || typeof e.icon != "string" || !Yt(e.icon))
|
|
2107
2121
|
throw new Error("View icon is required and must be a valid svg string");
|
|
2108
2122
|
if (!("order" in e) || typeof e.order != "number")
|
|
2109
2123
|
throw new Error("View order is required and must be a number");
|
|
@@ -2144,30 +2158,30 @@ const Jt = function(e) {
|
|
|
2144
2158
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
2145
2159
|
*
|
|
2146
2160
|
*/
|
|
2147
|
-
const
|
|
2161
|
+
const Dt = function(e) {
|
|
2148
2162
|
return L().registerEntry(e);
|
|
2149
|
-
}, Dt = function(e) {
|
|
2150
|
-
return L().unregisterEntry(e);
|
|
2151
2163
|
}, er = function(e) {
|
|
2164
|
+
return L().unregisterEntry(e);
|
|
2165
|
+
}, tr = function(e) {
|
|
2152
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" }));
|
|
2153
2167
|
};
|
|
2154
2168
|
exports.Column = ae;
|
|
2155
2169
|
exports.DefaultType = R;
|
|
2156
2170
|
exports.File = ie;
|
|
2157
|
-
exports.FileAction =
|
|
2158
|
-
exports.FileType =
|
|
2171
|
+
exports.FileAction = _e;
|
|
2172
|
+
exports.FileType = O;
|
|
2159
2173
|
exports.Folder = se;
|
|
2160
|
-
exports.Header =
|
|
2174
|
+
exports.Header = Ae;
|
|
2161
2175
|
exports.Navigation = ue;
|
|
2162
2176
|
exports.Node = q;
|
|
2163
2177
|
exports.NodeStatus = k;
|
|
2164
2178
|
exports.Permission = m;
|
|
2165
|
-
exports.View =
|
|
2166
|
-
exports.addNewFileMenuEntry =
|
|
2167
|
-
exports.davGetClient =
|
|
2168
|
-
exports.davGetDefaultPropfind =
|
|
2179
|
+
exports.View = Jt;
|
|
2180
|
+
exports.addNewFileMenuEntry = Dt;
|
|
2181
|
+
exports.davGetClient = $e;
|
|
2182
|
+
exports.davGetDefaultPropfind = Fe;
|
|
2169
2183
|
exports.davGetFavoritesReport = te;
|
|
2170
|
-
exports.davGetRecentSearch =
|
|
2184
|
+
exports.davGetRecentSearch = xe;
|
|
2171
2185
|
exports.davParsePermissions = re;
|
|
2172
2186
|
exports.davRemoteURL = X;
|
|
2173
2187
|
exports.davResultToNode = oe;
|
|
@@ -2175,15 +2189,15 @@ exports.davRootPath = U;
|
|
|
2175
2189
|
exports.defaultDavNamespaces = B;
|
|
2176
2190
|
exports.defaultDavProperties = M;
|
|
2177
2191
|
exports.formatFileSize = ye;
|
|
2178
|
-
exports.getDavNameSpaces =
|
|
2179
|
-
exports.getDavProperties =
|
|
2180
|
-
exports.getFavoriteNodes =
|
|
2181
|
-
exports.getFileActions =
|
|
2192
|
+
exports.getDavNameSpaces = P;
|
|
2193
|
+
exports.getDavProperties = C;
|
|
2194
|
+
exports.getFavoriteNodes = Se;
|
|
2195
|
+
exports.getFileActions = Ie;
|
|
2182
2196
|
exports.getFileListHeaders = Pe;
|
|
2183
2197
|
exports.getNavigation = Ve;
|
|
2184
|
-
exports.getNewFileMenuEntries =
|
|
2185
|
-
exports.parseFileSize =
|
|
2198
|
+
exports.getNewFileMenuEntries = tr;
|
|
2199
|
+
exports.parseFileSize = ve;
|
|
2186
2200
|
exports.registerDavProperty = Oe;
|
|
2187
|
-
exports.registerFileAction =
|
|
2188
|
-
exports.registerFileListHeaders =
|
|
2189
|
-
exports.removeNewFileMenuEntry =
|
|
2201
|
+
exports.registerFileAction = Te;
|
|
2202
|
+
exports.registerFileListHeaders = Ce;
|
|
2203
|
+
exports.removeNewFileMenuEntry = er;
|