lakutata 2.0.81 → 2.0.83
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/com/docker.cjs +1 -1
- package/com/docker.mjs +1 -1
- package/decorator/orm.cjs +84 -84
- package/decorator/orm.mjs +42 -128
- package/orm.cjs +873 -1410
- package/orm.mjs +708 -1458
- package/package.json +1 -1
- package/src/components/cacher/adapters/CreateFileCacheAdapter.cjs +230 -239
- package/src/components/cacher/adapters/CreateFileCacheAdapter.mjs +230 -239
- package/src/components/docker/ConnectionOptionsBuilder.cjs +1 -1
- package/src/components/docker/ConnectionOptionsBuilder.mjs +1 -1
- package/src/components/docker/Docker.cjs +4919 -4808
- package/src/components/docker/Docker.mjs +4939 -4828
- package/src/components/docker/lib/DockerContainer.cjs +1 -1
- package/src/components/docker/lib/DockerContainer.mjs +1 -1
- package/src/components/docker/lib/DockerContainerTTY.cjs +1 -1
- package/src/components/docker/lib/DockerContainerTTY.mjs +1 -1
- package/src/components/entrypoint/Entrypoint.cjs +1669 -2159
- package/src/components/entrypoint/Entrypoint.mjs +1629 -2119
- package/src/decorators/orm/AfterInsert.cjs +26 -4
- package/src/decorators/orm/AfterInsert.mjs +25 -5
- package/src/decorators/orm/AfterLoad.cjs +26 -4
- package/src/decorators/orm/AfterLoad.mjs +25 -5
- package/src/decorators/orm/AfterRecover.cjs +26 -4
- package/src/decorators/orm/AfterRecover.mjs +25 -5
- package/src/decorators/orm/AfterRemove.cjs +26 -4
- package/src/decorators/orm/AfterRemove.mjs +25 -5
- package/src/decorators/orm/AfterSoftRemove.cjs +26 -4
- package/src/decorators/orm/AfterSoftRemove.mjs +25 -5
- package/src/decorators/orm/AfterUpdate.cjs +26 -4
- package/src/decorators/orm/AfterUpdate.mjs +25 -5
- package/src/decorators/orm/BeforeInsert.cjs +26 -4
- package/src/decorators/orm/BeforeInsert.mjs +25 -5
- package/src/decorators/orm/BeforeRecover.cjs +26 -4
- package/src/decorators/orm/BeforeRecover.mjs +25 -5
- package/src/decorators/orm/BeforeRemove.cjs +26 -4
- package/src/decorators/orm/BeforeRemove.mjs +25 -5
- package/src/decorators/orm/BeforeSoftRemove.cjs +26 -4
- package/src/decorators/orm/BeforeSoftRemove.mjs +25 -5
- package/src/decorators/orm/BeforeUpdate.cjs +26 -4
- package/src/decorators/orm/BeforeUpdate.mjs +25 -5
- package/src/decorators/orm/Check.cjs +29 -4
- package/src/decorators/orm/Check.mjs +28 -5
- package/src/decorators/orm/ChildEntity.cjs +29 -4
- package/src/decorators/orm/ChildEntity.mjs +28 -5
- package/src/decorators/orm/Column.cjs +61 -4
- package/src/decorators/orm/Column.mjs +61 -6
- package/src/decorators/orm/CreateDateColumn.cjs +25 -4
- package/src/decorators/orm/CreateDateColumn.mjs +24 -5
- package/src/decorators/orm/DeleteDateColumn.cjs +25 -4
- package/src/decorators/orm/DeleteDateColumn.mjs +23 -4
- package/src/decorators/orm/Entity.cjs +35 -4
- package/src/decorators/orm/Entity.mjs +33 -4
- package/src/decorators/orm/EventSubscriber.cjs +22 -4
- package/src/decorators/orm/EventSubscriber.mjs +21 -5
- package/src/decorators/orm/Exclusion.cjs +29 -4
- package/src/decorators/orm/Exclusion.mjs +28 -5
- package/src/decorators/orm/Generated.cjs +24 -4
- package/src/decorators/orm/Generated.mjs +23 -5
- package/src/decorators/orm/Index.cjs +41 -4
- package/src/decorators/orm/Index.mjs +41 -6
- package/src/decorators/orm/JoinColumn.cjs +29 -4
- package/src/decorators/orm/JoinColumn.mjs +28 -5
- package/src/decorators/orm/JoinTable.cjs +30 -4
- package/src/decorators/orm/JoinTable.mjs +28 -4
- package/src/decorators/orm/ManyToMany.cjs +42 -4
- package/src/decorators/orm/ManyToMany.mjs +40 -4
- package/src/decorators/orm/ManyToOne.cjs +42 -4
- package/src/decorators/orm/ManyToOne.mjs +40 -4
- package/src/decorators/orm/ObjectIdColumn.cjs +28 -4
- package/src/decorators/orm/ObjectIdColumn.mjs +27 -5
- package/src/decorators/orm/OneToMany.cjs +34 -4
- package/src/decorators/orm/OneToMany.mjs +34 -6
- package/src/decorators/orm/OneToOne.cjs +42 -4
- package/src/decorators/orm/OneToOne.mjs +40 -4
- package/src/decorators/orm/PrimaryColumn.cjs +49 -4
- package/src/decorators/orm/PrimaryColumn.mjs +49 -6
- package/src/decorators/orm/PrimaryGeneratedColumn.cjs +54 -4
- package/src/decorators/orm/PrimaryGeneratedColumn.mjs +54 -6
- package/src/decorators/orm/RelationId.cjs +26 -4
- package/src/decorators/orm/RelationId.mjs +25 -5
- package/src/decorators/orm/TableInheritance.cjs +26 -4
- package/src/decorators/orm/TableInheritance.mjs +25 -5
- package/src/decorators/orm/Tree.cjs +24 -4
- package/src/decorators/orm/Tree.mjs +23 -5
- package/src/decorators/orm/TreeChildren.cjs +31 -4
- package/src/decorators/orm/TreeChildren.mjs +29 -4
- package/src/decorators/orm/TreeLevelColumn.cjs +25 -4
- package/src/decorators/orm/TreeLevelColumn.mjs +23 -4
- package/src/decorators/orm/TreeParent.cjs +31 -4
- package/src/decorators/orm/TreeParent.mjs +29 -4
- package/src/decorators/orm/Unique.cjs +44 -4
- package/src/decorators/orm/Unique.mjs +44 -6
- package/src/decorators/orm/UpdateDateColumn.cjs +25 -4
- package/src/decorators/orm/UpdateDateColumn.mjs +24 -5
- package/src/decorators/orm/VersionColumn.cjs +25 -4
- package/src/decorators/orm/VersionColumn.mjs +24 -5
- package/src/decorators/orm/ViewColumn.cjs +25 -4
- package/src/decorators/orm/ViewColumn.mjs +24 -5
- package/src/decorators/orm/ViewEntity.cjs +34 -4
- package/src/decorators/orm/ViewEntity.mjs +33 -5
- package/src/decorators/orm/VirtualColumn.cjs +42 -4
- package/src/decorators/orm/VirtualColumn.mjs +40 -4
- package/src/lib/base/EventEmitter.cjs +1193 -1200
- package/src/lib/base/EventEmitter.mjs +1194 -1201
- package/src/lib/base/internal/DataValidator.cjs +185 -174
- package/src/lib/base/internal/DataValidator.mjs +186 -175
- package/src/lib/base/internal/PatternManager.cjs +735 -740
- package/src/lib/base/internal/PatternManager.mjs +740 -745
- package/src/lib/core/Application.cjs +99 -112
- package/src/lib/core/Application.mjs +127 -140
- package/src/lib/helpers/IsHtml.cjs +13 -7
- package/src/lib/helpers/IsHtml.mjs +13 -7
- package/src/lib/helpers/IsXML.cjs +1016 -1158
- package/src/lib/helpers/IsXML.mjs +729 -871
- package/src/lib/helpers/ObjectHash.cjs +371 -378
- package/src/lib/helpers/ObjectHash.mjs +371 -378
- package/src/lib/helpers/RandomString.cjs +146 -167
- package/src/lib/helpers/RandomString.mjs +145 -166
- package/src/lib/helpers/URLBuilder.cjs +355 -355
- package/src/lib/helpers/URLBuilder.mjs +350 -350
- package/src/lib/ioc/ListModules.cjs +5237 -5160
- package/src/lib/ioc/ListModules.mjs +5252 -5175
- package/src/lib/validation/VLD.cjs +3903 -4080
- package/src/lib/validation/VLD.mjs +2793 -2970
- package/src/providers/migration/GenerateMigration.cjs +2 -2
- package/src/providers/migration/GenerateMigration.mjs +2 -2
- package/vendor/Package.112.cjs +38321 -38240
- package/vendor/Package.112.mjs +37720 -37579
- package/vendor/Package.16.cjs +7386 -7268
- package/vendor/Package.16.mjs +6706 -6588
- package/vendor/Package.18.cjs +48229 -20
- package/vendor/Package.18.mjs +48192 -24
- package/vendor/Package.2.cjs +5698 -5727
- package/vendor/Package.2.mjs +5707 -5736
- package/vendor/Package.4.cjs +874 -884
- package/vendor/Package.4.mjs +874 -884
- package/vendor/Package.5.cjs +11 -15
- package/vendor/Package.5.mjs +7 -11
- package/vendor/Package.6.cjs +511 -520
- package/vendor/Package.6.mjs +534 -543
- package/vendor/Package.62.cjs +87 -90
- package/vendor/Package.62.mjs +180 -183
- package/vendor/Package.65.cjs +1285 -1292
- package/vendor/Package.65.mjs +190 -197
- package/vendor/Package.68.cjs +111 -252
- package/vendor/Package.68.mjs +134 -268
- package/vendor/Package.9.cjs +118 -132
- package/vendor/Package.9.mjs +124 -138
- package/vendor/TypeDef.internal.3.d.ts +0 -14
- package/vendor/Package.19.cjs +0 -37
- package/vendor/Package.19.mjs +0 -35
- package/vendor/Package.20.cjs +0 -37
- package/vendor/Package.20.mjs +0 -35
- package/vendor/Package.21.cjs +0 -37
- package/vendor/Package.21.mjs +0 -35
- package/vendor/Package.22.cjs +0 -37
- package/vendor/Package.22.mjs +0 -35
- package/vendor/Package.23.cjs +0 -37
- package/vendor/Package.23.mjs +0 -35
- package/vendor/Package.24.cjs +0 -37
- package/vendor/Package.24.mjs +0 -35
- package/vendor/Package.25.cjs +0 -37
- package/vendor/Package.25.mjs +0 -35
- package/vendor/Package.26.cjs +0 -37
- package/vendor/Package.26.mjs +0 -35
- package/vendor/Package.27.cjs +0 -37
- package/vendor/Package.27.mjs +0 -35
- package/vendor/Package.28.cjs +0 -37
- package/vendor/Package.28.mjs +0 -35
- package/vendor/Package.29.cjs +0 -40
- package/vendor/Package.29.mjs +0 -38
- package/vendor/Package.30.cjs +0 -41
- package/vendor/Package.30.mjs +0 -39
- package/vendor/Package.31.cjs +0 -72
- package/vendor/Package.31.mjs +0 -70
- package/vendor/Package.32.cjs +0 -37
- package/vendor/Package.32.mjs +0 -35
- package/vendor/Package.33.cjs +0 -37
- package/vendor/Package.33.mjs +0 -35
- package/vendor/Package.34.cjs +0 -46
- package/vendor/Package.34.mjs +0 -44
- package/vendor/Package.35.cjs +0 -34
- package/vendor/Package.35.mjs +0 -32
- package/vendor/Package.36.cjs +0 -40
- package/vendor/Package.36.mjs +0 -38
- package/vendor/Package.37.cjs +0 -36
- package/vendor/Package.37.mjs +0 -34
- package/vendor/Package.38.cjs +0 -52
- package/vendor/Package.38.mjs +0 -50
- package/vendor/Package.39.cjs +0 -41
- package/vendor/Package.39.mjs +0 -39
- package/vendor/Package.40.cjs +0 -42
- package/vendor/Package.40.mjs +0 -40
- package/vendor/Package.41.cjs +0 -53
- package/vendor/Package.41.mjs +0 -51
- package/vendor/Package.42.cjs +0 -53
- package/vendor/Package.42.mjs +0 -51
- package/vendor/Package.43.cjs +0 -40
- package/vendor/Package.43.mjs +0 -38
- package/vendor/Package.44.cjs +0 -46
- package/vendor/Package.44.mjs +0 -44
- package/vendor/Package.45.cjs +0 -53
- package/vendor/Package.45.mjs +0 -51
- package/vendor/Package.46.cjs +0 -59
- package/vendor/Package.46.mjs +0 -57
- package/vendor/Package.47.cjs +0 -65
- package/vendor/Package.47.mjs +0 -63
- package/vendor/Package.48.cjs +0 -38
- package/vendor/Package.48.mjs +0 -36
- package/vendor/Package.49.cjs +0 -38
- package/vendor/Package.49.mjs +0 -36
- package/vendor/Package.50.cjs +0 -36
- package/vendor/Package.50.mjs +0 -34
- package/vendor/Package.51.cjs +0 -43
- package/vendor/Package.51.mjs +0 -41
- package/vendor/Package.52.cjs +0 -37
- package/vendor/Package.52.mjs +0 -35
- package/vendor/Package.53.cjs +0 -43
- package/vendor/Package.53.mjs +0 -41
- package/vendor/Package.54.cjs +0 -55
- package/vendor/Package.54.mjs +0 -53
- package/vendor/Package.55.cjs +0 -37
- package/vendor/Package.55.mjs +0 -35
- package/vendor/Package.56.cjs +0 -37
- package/vendor/Package.56.mjs +0 -35
- package/vendor/Package.57.cjs +0 -37
- package/vendor/Package.57.mjs +0 -35
- package/vendor/Package.58.cjs +0 -45
- package/vendor/Package.58.mjs +0 -43
- package/vendor/Package.59.cjs +0 -53
- package/vendor/Package.59.mjs +0 -51
- package/vendor/Package.60.cjs +0 -47649
- package/vendor/Package.60.mjs +0 -47606
|
@@ -1,75 +1,80 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import { g as e } from "../../../vendor/Package.5.mjs";
|
|
2
|
+
|
|
3
|
+
var t = {};
|
|
4
|
+
|
|
5
|
+
var n = {};
|
|
6
|
+
|
|
7
|
+
(function(e) {
|
|
8
|
+
"use strict";
|
|
9
|
+
const t = ":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
|
|
10
|
+
const n = t + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
|
|
11
|
+
const i = "[" + t + "][" + n + "]*";
|
|
12
|
+
const s = new RegExp("^" + i + "$");
|
|
13
|
+
const r = function(e, t) {
|
|
14
|
+
const n = [];
|
|
15
|
+
let i = t.exec(e);
|
|
16
|
+
while (i) {
|
|
17
|
+
const s = [];
|
|
18
|
+
s.startIndex = t.lastIndex - i[0].length;
|
|
19
|
+
const r = i.length;
|
|
20
|
+
for (let e = 0; e < r; e++) {
|
|
21
|
+
s.push(i[e]);
|
|
22
|
+
}
|
|
23
|
+
n.push(s);
|
|
24
|
+
i = t.exec(e);
|
|
20
25
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const s = n.length;
|
|
44
|
-
for (let r = 0; r < s; r++) {
|
|
45
|
-
if (i === "strict") {
|
|
46
|
-
e[n[r]] = [ t[n[r]] ];
|
|
47
|
-
} else {
|
|
48
|
-
e[n[r]] = t[n[r]];
|
|
26
|
+
return n;
|
|
27
|
+
};
|
|
28
|
+
const o = function(e) {
|
|
29
|
+
const t = s.exec(e);
|
|
30
|
+
return !(t === null || typeof t === "undefined");
|
|
31
|
+
};
|
|
32
|
+
e.isExist = function(e) {
|
|
33
|
+
return typeof e !== "undefined";
|
|
34
|
+
};
|
|
35
|
+
e.isEmptyObject = function(e) {
|
|
36
|
+
return Object.keys(e).length === 0;
|
|
37
|
+
};
|
|
38
|
+
e.merge = function(e, t, n) {
|
|
39
|
+
if (t) {
|
|
40
|
+
const i = Object.keys(t);
|
|
41
|
+
const s = i.length;
|
|
42
|
+
for (let r = 0; r < s; r++) {
|
|
43
|
+
if (n === "strict") {
|
|
44
|
+
e[i[r]] = [ t[i[r]] ];
|
|
45
|
+
} else {
|
|
46
|
+
e[i[r]] = t[i[r]];
|
|
47
|
+
}
|
|
49
48
|
}
|
|
50
49
|
}
|
|
51
|
-
}
|
|
52
|
-
|
|
50
|
+
};
|
|
51
|
+
e.getValue = function(t) {
|
|
52
|
+
if (e.isExist(t)) {
|
|
53
|
+
return t;
|
|
54
|
+
} else {
|
|
55
|
+
return "";
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
e.isName = o;
|
|
59
|
+
e.getAllMatches = r;
|
|
60
|
+
e.nameRegexp = i;
|
|
61
|
+
})(n);
|
|
53
62
|
|
|
54
|
-
|
|
55
|
-
if (exports.isExist(e)) {
|
|
56
|
-
return e;
|
|
57
|
-
} else {
|
|
58
|
-
return "";
|
|
59
|
-
}
|
|
60
|
-
}
|
|
63
|
+
const i = e(n);
|
|
61
64
|
|
|
62
65
|
"use strict";
|
|
63
66
|
|
|
64
|
-
const
|
|
67
|
+
const s = n;
|
|
68
|
+
|
|
69
|
+
const r = {
|
|
65
70
|
allowBooleanAttributes: false,
|
|
66
71
|
unpairedTags: []
|
|
67
72
|
};
|
|
68
73
|
|
|
69
|
-
function
|
|
70
|
-
t = Object.assign({},
|
|
71
|
-
const
|
|
72
|
-
let
|
|
74
|
+
var o = t.validate = function(e, t) {
|
|
75
|
+
t = Object.assign({}, r, t);
|
|
76
|
+
const n = [];
|
|
77
|
+
let i = false;
|
|
73
78
|
let s = false;
|
|
74
79
|
if (e[0] === "\ufeff") {
|
|
75
80
|
e = e.substr(1);
|
|
@@ -77,104 +82,104 @@ function d(e, t) {
|
|
|
77
82
|
for (let r = 0; r < e.length; r++) {
|
|
78
83
|
if (e[r] === "<" && e[r + 1] === "?") {
|
|
79
84
|
r += 2;
|
|
80
|
-
r =
|
|
85
|
+
r = l(e, r);
|
|
81
86
|
if (r.err) return r;
|
|
82
87
|
} else if (e[r] === "<") {
|
|
83
88
|
let o = r;
|
|
84
89
|
r++;
|
|
85
90
|
if (e[r] === "!") {
|
|
86
|
-
r =
|
|
91
|
+
r = u(e, r);
|
|
87
92
|
continue;
|
|
88
93
|
} else {
|
|
89
|
-
let
|
|
94
|
+
let f = false;
|
|
90
95
|
if (e[r] === "/") {
|
|
91
|
-
|
|
96
|
+
f = true;
|
|
92
97
|
r++;
|
|
93
98
|
}
|
|
94
|
-
let
|
|
99
|
+
let c = "";
|
|
95
100
|
for (;r < e.length && e[r] !== ">" && e[r] !== " " && e[r] !== "\t" && e[r] !== "\n" && e[r] !== "\r"; r++) {
|
|
96
|
-
|
|
101
|
+
c += e[r];
|
|
97
102
|
}
|
|
98
|
-
|
|
99
|
-
if (
|
|
100
|
-
|
|
103
|
+
c = c.trim();
|
|
104
|
+
if (c[c.length - 1] === "/") {
|
|
105
|
+
c = c.substring(0, c.length - 1);
|
|
101
106
|
r--;
|
|
102
107
|
}
|
|
103
|
-
if (!
|
|
108
|
+
if (!b(c)) {
|
|
104
109
|
let t;
|
|
105
|
-
if (
|
|
110
|
+
if (c.trim().length === 0) {
|
|
106
111
|
t = "Invalid space after '<'.";
|
|
107
112
|
} else {
|
|
108
|
-
t = "Tag '" +
|
|
113
|
+
t = "Tag '" + c + "' is an invalid name.";
|
|
109
114
|
}
|
|
110
|
-
return
|
|
115
|
+
return x("InvalidTag", t, E(e, r));
|
|
111
116
|
}
|
|
112
|
-
const
|
|
113
|
-
if (
|
|
114
|
-
return
|
|
117
|
+
const d = h(e, r);
|
|
118
|
+
if (d === false) {
|
|
119
|
+
return x("InvalidAttr", "Attributes for '" + c + "' have open quote.", E(e, r));
|
|
115
120
|
}
|
|
116
|
-
let
|
|
117
|
-
r =
|
|
118
|
-
if (
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
const s =
|
|
121
|
+
let g = d.value;
|
|
122
|
+
r = d.index;
|
|
123
|
+
if (g[g.length - 1] === "/") {
|
|
124
|
+
const n = r - g.length;
|
|
125
|
+
g = g.substring(0, g.length - 1);
|
|
126
|
+
const s = p(g, t);
|
|
122
127
|
if (s === true) {
|
|
123
|
-
|
|
128
|
+
i = true;
|
|
124
129
|
} else {
|
|
125
|
-
return
|
|
130
|
+
return x(s.err.code, s.err.msg, E(e, n + s.err.line));
|
|
126
131
|
}
|
|
127
|
-
} else if (
|
|
128
|
-
if (!
|
|
129
|
-
return
|
|
130
|
-
} else if (
|
|
131
|
-
return
|
|
132
|
-
} else if (
|
|
133
|
-
return
|
|
132
|
+
} else if (f) {
|
|
133
|
+
if (!d.tagClosed) {
|
|
134
|
+
return x("InvalidTag", "Closing tag '" + c + "' doesn't have proper closing.", E(e, r));
|
|
135
|
+
} else if (g.trim().length > 0) {
|
|
136
|
+
return x("InvalidTag", "Closing tag '" + c + "' can't have attributes or invalid starting.", E(e, o));
|
|
137
|
+
} else if (n.length === 0) {
|
|
138
|
+
return x("InvalidTag", "Closing tag '" + c + "' has not been opened.", E(e, o));
|
|
134
139
|
} else {
|
|
135
|
-
const t =
|
|
136
|
-
if (
|
|
137
|
-
let
|
|
138
|
-
return
|
|
140
|
+
const t = n.pop();
|
|
141
|
+
if (c !== t.tagName) {
|
|
142
|
+
let n = E(e, t.tagStartPos);
|
|
143
|
+
return x("InvalidTag", "Expected closing tag '" + t.tagName + "' (opened in line " + n.line + ", col " + n.col + ") instead of closing tag '" + c + "'.", E(e, o));
|
|
139
144
|
}
|
|
140
|
-
if (
|
|
145
|
+
if (n.length == 0) {
|
|
141
146
|
s = true;
|
|
142
147
|
}
|
|
143
148
|
}
|
|
144
149
|
} else {
|
|
145
|
-
const a =
|
|
150
|
+
const a = p(g, t);
|
|
146
151
|
if (a !== true) {
|
|
147
|
-
return
|
|
152
|
+
return x(a.err.code, a.err.msg, E(e, r - g.length + a.err.line));
|
|
148
153
|
}
|
|
149
154
|
if (s === true) {
|
|
150
|
-
return
|
|
151
|
-
} else if (t.unpairedTags.indexOf(
|
|
152
|
-
|
|
153
|
-
tagName:
|
|
155
|
+
return x("InvalidXml", "Multiple possible root nodes found.", E(e, r));
|
|
156
|
+
} else if (t.unpairedTags.indexOf(c) !== -1) {} else {
|
|
157
|
+
n.push({
|
|
158
|
+
tagName: c,
|
|
154
159
|
tagStartPos: o
|
|
155
160
|
});
|
|
156
161
|
}
|
|
157
|
-
|
|
162
|
+
i = true;
|
|
158
163
|
}
|
|
159
164
|
for (r++; r < e.length; r++) {
|
|
160
165
|
if (e[r] === "<") {
|
|
161
166
|
if (e[r + 1] === "!") {
|
|
162
167
|
r++;
|
|
163
|
-
r =
|
|
168
|
+
r = u(e, r);
|
|
164
169
|
continue;
|
|
165
170
|
} else if (e[r + 1] === "?") {
|
|
166
|
-
r =
|
|
171
|
+
r = l(e, ++r);
|
|
167
172
|
if (r.err) return r;
|
|
168
173
|
} else {
|
|
169
174
|
break;
|
|
170
175
|
}
|
|
171
176
|
} else if (e[r] === "&") {
|
|
172
|
-
const t =
|
|
173
|
-
if (t == -1) return
|
|
177
|
+
const t = m(e, r);
|
|
178
|
+
if (t == -1) return x("InvalidChar", "char '&' is not expected.", E(e, r));
|
|
174
179
|
r = t;
|
|
175
180
|
} else {
|
|
176
|
-
if (s === true && !
|
|
177
|
-
return
|
|
181
|
+
if (s === true && !a(e[r])) {
|
|
182
|
+
return x("InvalidXml", "Extra text at the end", E(e, r));
|
|
178
183
|
}
|
|
179
184
|
}
|
|
180
185
|
}
|
|
@@ -183,36 +188,36 @@ function d(e, t) {
|
|
|
183
188
|
}
|
|
184
189
|
}
|
|
185
190
|
} else {
|
|
186
|
-
if (
|
|
191
|
+
if (a(e[r])) {
|
|
187
192
|
continue;
|
|
188
193
|
}
|
|
189
|
-
return
|
|
194
|
+
return x("InvalidChar", "char '" + e[r] + "' is not expected.", E(e, r));
|
|
190
195
|
}
|
|
191
196
|
}
|
|
192
|
-
if (!
|
|
193
|
-
return
|
|
194
|
-
} else if (
|
|
195
|
-
return
|
|
196
|
-
} else if (
|
|
197
|
-
return
|
|
197
|
+
if (!i) {
|
|
198
|
+
return x("InvalidXml", "Start tag expected.", 1);
|
|
199
|
+
} else if (n.length == 1) {
|
|
200
|
+
return x("InvalidTag", "Unclosed tag '" + n[0].tagName + "'.", E(e, n[0].tagStartPos));
|
|
201
|
+
} else if (n.length > 0) {
|
|
202
|
+
return x("InvalidXml", "Invalid '" + JSON.stringify(n.map((e => e.tagName)), null, 4).replace(/\r?\n/g, "") + "' found.", {
|
|
198
203
|
line: 1,
|
|
199
204
|
col: 1
|
|
200
205
|
});
|
|
201
206
|
}
|
|
202
207
|
return true;
|
|
203
|
-
}
|
|
208
|
+
};
|
|
204
209
|
|
|
205
|
-
function
|
|
210
|
+
function a(e) {
|
|
206
211
|
return e === " " || e === "\t" || e === "\n" || e === "\r";
|
|
207
212
|
}
|
|
208
213
|
|
|
209
|
-
function
|
|
210
|
-
const
|
|
214
|
+
function l(e, t) {
|
|
215
|
+
const n = t;
|
|
211
216
|
for (;t < e.length; t++) {
|
|
212
217
|
if (e[t] == "?" || e[t] == " ") {
|
|
213
|
-
const
|
|
214
|
-
if (t > 5 &&
|
|
215
|
-
return
|
|
218
|
+
const i = e.substr(n, t - n);
|
|
219
|
+
if (t > 5 && i === "xml") {
|
|
220
|
+
return x("InvalidXml", "XML declaration allowed only at the start of the document.", E(e, t));
|
|
216
221
|
} else if (e[t] == "?" && e[t + 1] == ">") {
|
|
217
222
|
t++;
|
|
218
223
|
break;
|
|
@@ -224,7 +229,7 @@ function c(e, t) {
|
|
|
224
229
|
return t;
|
|
225
230
|
}
|
|
226
231
|
|
|
227
|
-
function
|
|
232
|
+
function u(e, t) {
|
|
228
233
|
if (e.length > t + 5 && e[t + 1] === "-" && e[t + 2] === "-") {
|
|
229
234
|
for (t += 3; t < e.length; t++) {
|
|
230
235
|
if (e[t] === "-" && e[t + 1] === "-" && e[t + 2] === ">") {
|
|
@@ -233,13 +238,13 @@ function p(e, t) {
|
|
|
233
238
|
}
|
|
234
239
|
}
|
|
235
240
|
} else if (e.length > t + 8 && e[t + 1] === "D" && e[t + 2] === "O" && e[t + 3] === "C" && e[t + 4] === "T" && e[t + 5] === "Y" && e[t + 6] === "P" && e[t + 7] === "E") {
|
|
236
|
-
let
|
|
241
|
+
let n = 1;
|
|
237
242
|
for (t += 8; t < e.length; t++) {
|
|
238
243
|
if (e[t] === "<") {
|
|
239
|
-
|
|
244
|
+
n++;
|
|
240
245
|
} else if (e[t] === ">") {
|
|
241
|
-
|
|
242
|
-
if (
|
|
246
|
+
n--;
|
|
247
|
+
if (n === 0) {
|
|
243
248
|
break;
|
|
244
249
|
}
|
|
245
250
|
}
|
|
@@ -255,126 +260,128 @@ function p(e, t) {
|
|
|
255
260
|
return t;
|
|
256
261
|
}
|
|
257
262
|
|
|
258
|
-
const
|
|
263
|
+
const f = '"';
|
|
259
264
|
|
|
260
|
-
const
|
|
265
|
+
const c = "'";
|
|
261
266
|
|
|
262
|
-
function
|
|
263
|
-
let i = "";
|
|
267
|
+
function h(e, t) {
|
|
264
268
|
let n = "";
|
|
269
|
+
let i = "";
|
|
265
270
|
let s = false;
|
|
266
271
|
for (;t < e.length; t++) {
|
|
267
|
-
if (e[t] ===
|
|
268
|
-
if (
|
|
269
|
-
|
|
270
|
-
} else if (
|
|
271
|
-
|
|
272
|
+
if (e[t] === f || e[t] === c) {
|
|
273
|
+
if (i === "") {
|
|
274
|
+
i = e[t];
|
|
275
|
+
} else if (i !== e[t]) {} else {
|
|
276
|
+
i = "";
|
|
272
277
|
}
|
|
273
278
|
} else if (e[t] === ">") {
|
|
274
|
-
if (
|
|
279
|
+
if (i === "") {
|
|
275
280
|
s = true;
|
|
276
281
|
break;
|
|
277
282
|
}
|
|
278
283
|
}
|
|
279
|
-
|
|
284
|
+
n += e[t];
|
|
280
285
|
}
|
|
281
|
-
if (
|
|
286
|
+
if (i !== "") {
|
|
282
287
|
return false;
|
|
283
288
|
}
|
|
284
289
|
return {
|
|
285
|
-
value:
|
|
290
|
+
value: n,
|
|
286
291
|
index: t,
|
|
287
292
|
tagClosed: s
|
|
288
293
|
};
|
|
289
294
|
}
|
|
290
295
|
|
|
291
|
-
const
|
|
296
|
+
const d = new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?", "g");
|
|
292
297
|
|
|
293
|
-
function
|
|
294
|
-
const
|
|
295
|
-
const
|
|
296
|
-
for (let e = 0; e <
|
|
297
|
-
if (
|
|
298
|
-
return
|
|
299
|
-
} else if (
|
|
300
|
-
return
|
|
301
|
-
} else if (
|
|
302
|
-
return
|
|
303
|
-
}
|
|
304
|
-
const s =
|
|
305
|
-
if (!
|
|
306
|
-
return
|
|
307
|
-
}
|
|
308
|
-
if (!
|
|
309
|
-
|
|
298
|
+
function p(e, t) {
|
|
299
|
+
const n = s.getAllMatches(e, d);
|
|
300
|
+
const i = {};
|
|
301
|
+
for (let e = 0; e < n.length; e++) {
|
|
302
|
+
if (n[e][1].length === 0) {
|
|
303
|
+
return x("InvalidAttr", "Attribute '" + n[e][2] + "' has no space in starting.", v(n[e]));
|
|
304
|
+
} else if (n[e][3] !== undefined && n[e][4] === undefined) {
|
|
305
|
+
return x("InvalidAttr", "Attribute '" + n[e][2] + "' is without value.", v(n[e]));
|
|
306
|
+
} else if (n[e][3] === undefined && !t.allowBooleanAttributes) {
|
|
307
|
+
return x("InvalidAttr", "boolean attribute '" + n[e][2] + "' is not allowed.", v(n[e]));
|
|
308
|
+
}
|
|
309
|
+
const s = n[e][2];
|
|
310
|
+
if (!N(s)) {
|
|
311
|
+
return x("InvalidAttr", "Attribute '" + s + "' is an invalid name.", v(n[e]));
|
|
312
|
+
}
|
|
313
|
+
if (!i.hasOwnProperty(s)) {
|
|
314
|
+
i[s] = 1;
|
|
310
315
|
} else {
|
|
311
|
-
return
|
|
316
|
+
return x("InvalidAttr", "Attribute '" + s + "' is repeated.", v(n[e]));
|
|
312
317
|
}
|
|
313
318
|
}
|
|
314
319
|
return true;
|
|
315
320
|
}
|
|
316
321
|
|
|
317
|
-
function
|
|
318
|
-
let
|
|
322
|
+
function g(e, t) {
|
|
323
|
+
let n = /\d/;
|
|
319
324
|
if (e[t] === "x") {
|
|
320
325
|
t++;
|
|
321
|
-
|
|
326
|
+
n = /[\da-fA-F]/;
|
|
322
327
|
}
|
|
323
328
|
for (;t < e.length; t++) {
|
|
324
329
|
if (e[t] === ";") return t;
|
|
325
|
-
if (!e[t].match(
|
|
330
|
+
if (!e[t].match(n)) break;
|
|
326
331
|
}
|
|
327
332
|
return -1;
|
|
328
333
|
}
|
|
329
334
|
|
|
330
|
-
function
|
|
335
|
+
function m(e, t) {
|
|
331
336
|
t++;
|
|
332
337
|
if (e[t] === ";") return -1;
|
|
333
338
|
if (e[t] === "#") {
|
|
334
339
|
t++;
|
|
335
|
-
return
|
|
340
|
+
return g(e, t);
|
|
336
341
|
}
|
|
337
|
-
let
|
|
338
|
-
for (;t < e.length; t++,
|
|
339
|
-
if (e[t].match(/\w/) &&
|
|
342
|
+
let n = 0;
|
|
343
|
+
for (;t < e.length; t++, n++) {
|
|
344
|
+
if (e[t].match(/\w/) && n < 20) continue;
|
|
340
345
|
if (e[t] === ";") break;
|
|
341
346
|
return -1;
|
|
342
347
|
}
|
|
343
348
|
return t;
|
|
344
349
|
}
|
|
345
350
|
|
|
346
|
-
function
|
|
351
|
+
function x(e, t, n) {
|
|
347
352
|
return {
|
|
348
353
|
err: {
|
|
349
354
|
code: e,
|
|
350
355
|
msg: t,
|
|
351
|
-
line:
|
|
352
|
-
col:
|
|
356
|
+
line: n.line || n,
|
|
357
|
+
col: n.col
|
|
353
358
|
}
|
|
354
359
|
};
|
|
355
360
|
}
|
|
356
361
|
|
|
357
|
-
function
|
|
358
|
-
return
|
|
362
|
+
function N(e) {
|
|
363
|
+
return s.isName(e);
|
|
359
364
|
}
|
|
360
365
|
|
|
361
|
-
function
|
|
362
|
-
return
|
|
366
|
+
function b(e) {
|
|
367
|
+
return s.isName(e);
|
|
363
368
|
}
|
|
364
369
|
|
|
365
|
-
function
|
|
366
|
-
const
|
|
370
|
+
function E(e, t) {
|
|
371
|
+
const n = e.substring(0, t).split(/\r?\n/);
|
|
367
372
|
return {
|
|
368
|
-
line:
|
|
369
|
-
col:
|
|
373
|
+
line: n.length,
|
|
374
|
+
col: n[n.length - 1].length + 1
|
|
370
375
|
};
|
|
371
376
|
}
|
|
372
377
|
|
|
373
|
-
function
|
|
378
|
+
function v(e) {
|
|
374
379
|
return e.startIndex + e[1].length;
|
|
375
380
|
}
|
|
376
381
|
|
|
377
|
-
|
|
382
|
+
var y = {};
|
|
383
|
+
|
|
384
|
+
const T = {
|
|
378
385
|
preserveOrder: false,
|
|
379
386
|
attributeNamePrefix: "@_",
|
|
380
387
|
attributesGroupName: false,
|
|
@@ -408,25 +415,20 @@ const P = {
|
|
|
408
415
|
ignorePiTags: false,
|
|
409
416
|
transformTagName: false,
|
|
410
417
|
transformAttributeName: false,
|
|
411
|
-
updateTag: function(e, t,
|
|
418
|
+
updateTag: function(e, t, n) {
|
|
412
419
|
return e;
|
|
413
|
-
}
|
|
414
|
-
captureMetaData: false
|
|
420
|
+
}
|
|
415
421
|
};
|
|
416
422
|
|
|
417
|
-
const
|
|
418
|
-
return Object.assign({},
|
|
423
|
+
const O = function(e) {
|
|
424
|
+
return Object.assign({}, T, e);
|
|
419
425
|
};
|
|
420
426
|
|
|
421
|
-
|
|
427
|
+
var w = y.buildOptions = O;
|
|
422
428
|
|
|
423
|
-
|
|
429
|
+
var P = y.defaultOptions = T;
|
|
424
430
|
|
|
425
|
-
|
|
426
|
-
C = "@@xmlMetadata";
|
|
427
|
-
} else {
|
|
428
|
-
C = Symbol("XML Node Metadata");
|
|
429
|
-
}
|
|
431
|
+
"use strict";
|
|
430
432
|
|
|
431
433
|
class XmlNode {
|
|
432
434
|
constructor(e) {
|
|
@@ -440,7 +442,7 @@ class XmlNode {
|
|
|
440
442
|
[e]: t
|
|
441
443
|
});
|
|
442
444
|
}
|
|
443
|
-
addChild(e
|
|
445
|
+
addChild(e) {
|
|
444
446
|
if (e.tagname === "__proto__") e.tagname = "#__proto__";
|
|
445
447
|
if (e[":@"] && Object.keys(e[":@"]).length > 0) {
|
|
446
448
|
this.child.push({
|
|
@@ -452,324 +454,162 @@ class XmlNode {
|
|
|
452
454
|
[e.tagname]: e.child
|
|
453
455
|
});
|
|
454
456
|
}
|
|
455
|
-
if (t !== undefined) {
|
|
456
|
-
this.child[this.child.length - 1][C] = {
|
|
457
|
-
startIndex: t
|
|
458
|
-
};
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
static getMetaDataSymbol() {
|
|
462
|
-
return C;
|
|
463
457
|
}
|
|
464
458
|
}
|
|
465
459
|
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
} else if (V(e, "!--", t)) r = true; else throw new Error(`Invalid DOCTYPE`);
|
|
498
|
-
n++;
|
|
499
|
-
o = "";
|
|
500
|
-
} else if (e[t] === ">") {
|
|
501
|
-
if (r) {
|
|
502
|
-
if (e[t - 1] === "-" && e[t - 2] === "-") {
|
|
503
|
-
r = false;
|
|
504
|
-
n--;
|
|
505
|
-
}
|
|
506
|
-
} else {
|
|
507
|
-
n--;
|
|
508
|
-
}
|
|
509
|
-
if (n === 0) {
|
|
510
|
-
break;
|
|
460
|
+
var A = XmlNode;
|
|
461
|
+
|
|
462
|
+
const I = e(A);
|
|
463
|
+
|
|
464
|
+
const C = n;
|
|
465
|
+
|
|
466
|
+
function S(e, t) {
|
|
467
|
+
const n = {};
|
|
468
|
+
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") {
|
|
469
|
+
t = t + 9;
|
|
470
|
+
let i = 1;
|
|
471
|
+
let s = false, r = false;
|
|
472
|
+
let o = "";
|
|
473
|
+
for (;t < e.length; t++) {
|
|
474
|
+
if (e[t] === "<" && !r) {
|
|
475
|
+
if (s && k(e, t)) {
|
|
476
|
+
t += 7;
|
|
477
|
+
let i, s;
|
|
478
|
+
[i, s, t] = V(e, t + 1);
|
|
479
|
+
if (s.indexOf("&") === -1) n[D(i)] = {
|
|
480
|
+
regx: RegExp(`&${i};`, "g"),
|
|
481
|
+
val: s
|
|
482
|
+
};
|
|
483
|
+
} else if (s && $(e, t)) t += 8; else if (s && F(e, t)) t += 8; else if (s && _(e, t)) t += 9; else if (j) r = true; else throw new Error("Invalid DOCTYPE");
|
|
484
|
+
i++;
|
|
485
|
+
o = "";
|
|
486
|
+
} else if (e[t] === ">") {
|
|
487
|
+
if (r) {
|
|
488
|
+
if (e[t - 1] === "-" && e[t - 2] === "-") {
|
|
489
|
+
r = false;
|
|
490
|
+
i--;
|
|
511
491
|
}
|
|
512
|
-
} else if (e[t] === "[") {
|
|
513
|
-
s = true;
|
|
514
492
|
} else {
|
|
515
|
-
|
|
493
|
+
i--;
|
|
516
494
|
}
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
throw new Error(`Unclosed DOCTYPE`);
|
|
520
|
-
}
|
|
521
|
-
} else {
|
|
522
|
-
throw new Error(`Invalid Tag instead of DOCTYPE`);
|
|
523
|
-
}
|
|
524
|
-
return {
|
|
525
|
-
entities: i,
|
|
526
|
-
i: t
|
|
527
|
-
};
|
|
528
|
-
}
|
|
529
|
-
readEntityExp(e, t) {
|
|
530
|
-
t = S(e, t);
|
|
531
|
-
let i = "";
|
|
532
|
-
while (t < e.length && !/\s/.test(e[t]) && e[t] !== '"' && e[t] !== "'") {
|
|
533
|
-
i += e[t];
|
|
534
|
-
t++;
|
|
535
|
-
}
|
|
536
|
-
D(i);
|
|
537
|
-
t = S(e, t);
|
|
538
|
-
if (!this.suppressValidationErr) {
|
|
539
|
-
if (e.substring(t, t + 6).toUpperCase() === "SYSTEM") {
|
|
540
|
-
throw new Error("External entities are not supported");
|
|
541
|
-
} else if (e[t] === "%") {
|
|
542
|
-
throw new Error("Parameter entities are not supported");
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
let n = "";
|
|
546
|
-
[t, n] = this.readIdentifierVal(e, t, "entity");
|
|
547
|
-
t--;
|
|
548
|
-
return [ i, n, t ];
|
|
549
|
-
}
|
|
550
|
-
readNotationExp(e, t) {
|
|
551
|
-
t = S(e, t);
|
|
552
|
-
let i = "";
|
|
553
|
-
while (t < e.length && !/\s/.test(e[t])) {
|
|
554
|
-
i += e[t];
|
|
555
|
-
t++;
|
|
556
|
-
}
|
|
557
|
-
!this.suppressValidationErr && D(i);
|
|
558
|
-
t = S(e, t);
|
|
559
|
-
const n = e.substring(t, t + 6).toUpperCase();
|
|
560
|
-
if (!this.suppressValidationErr && n !== "SYSTEM" && n !== "PUBLIC") {
|
|
561
|
-
throw new Error(`Expected SYSTEM or PUBLIC, found "${n}"`);
|
|
562
|
-
}
|
|
563
|
-
t += n.length;
|
|
564
|
-
t = S(e, t);
|
|
565
|
-
let s = null;
|
|
566
|
-
let r = null;
|
|
567
|
-
if (n === "PUBLIC") {
|
|
568
|
-
[t, s] = this.readIdentifierVal(e, t, "publicIdentifier");
|
|
569
|
-
t = S(e, t);
|
|
570
|
-
if (e[t] === '"' || e[t] === "'") {
|
|
571
|
-
[t, r] = this.readIdentifierVal(e, t, "systemIdentifier");
|
|
572
|
-
}
|
|
573
|
-
} else if (n === "SYSTEM") {
|
|
574
|
-
[t, r] = this.readIdentifierVal(e, t, "systemIdentifier");
|
|
575
|
-
if (!this.suppressValidationErr && !r) {
|
|
576
|
-
throw new Error("Missing mandatory system identifier for SYSTEM notation");
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
return {
|
|
580
|
-
notationName: i,
|
|
581
|
-
publicIdentifier: s,
|
|
582
|
-
systemIdentifier: r,
|
|
583
|
-
index: --t
|
|
584
|
-
};
|
|
585
|
-
}
|
|
586
|
-
readIdentifierVal(e, t, i) {
|
|
587
|
-
let n = "";
|
|
588
|
-
const s = e[t];
|
|
589
|
-
if (s !== '"' && s !== "'") {
|
|
590
|
-
throw new Error(`Expected quoted string, found "${s}"`);
|
|
591
|
-
}
|
|
592
|
-
t++;
|
|
593
|
-
while (t < e.length && e[t] !== s) {
|
|
594
|
-
n += e[t];
|
|
595
|
-
t++;
|
|
596
|
-
}
|
|
597
|
-
if (e[t] !== s) {
|
|
598
|
-
throw new Error(`Unterminated ${i} value`);
|
|
599
|
-
}
|
|
600
|
-
t++;
|
|
601
|
-
return [ t, n ];
|
|
602
|
-
}
|
|
603
|
-
readElementExp(e, t) {
|
|
604
|
-
t = S(e, t);
|
|
605
|
-
let i = "";
|
|
606
|
-
while (t < e.length && !/\s/.test(e[t])) {
|
|
607
|
-
i += e[t];
|
|
608
|
-
t++;
|
|
609
|
-
}
|
|
610
|
-
if (!this.suppressValidationErr && !r(i)) {
|
|
611
|
-
throw new Error(`Invalid element name: "${i}"`);
|
|
612
|
-
}
|
|
613
|
-
t = S(e, t);
|
|
614
|
-
let n = "";
|
|
615
|
-
if (e[t] === "E" && V(e, "MPTY", t)) t += 4; else if (e[t] === "A" && V(e, "NY", t)) t += 2; else if (e[t] === "(") {
|
|
616
|
-
t++;
|
|
617
|
-
while (t < e.length && e[t] !== ")") {
|
|
618
|
-
n += e[t];
|
|
619
|
-
t++;
|
|
620
|
-
}
|
|
621
|
-
if (e[t] !== ")") {
|
|
622
|
-
throw new Error("Unterminated content model");
|
|
623
|
-
}
|
|
624
|
-
} else if (!this.suppressValidationErr) {
|
|
625
|
-
throw new Error(`Invalid Element Expression, found "${e[t]}"`);
|
|
626
|
-
}
|
|
627
|
-
return {
|
|
628
|
-
elementName: i,
|
|
629
|
-
contentModel: n.trim(),
|
|
630
|
-
index: t
|
|
631
|
-
};
|
|
632
|
-
}
|
|
633
|
-
readAttlistExp(e, t) {
|
|
634
|
-
t = S(e, t);
|
|
635
|
-
let i = "";
|
|
636
|
-
while (t < e.length && !/\s/.test(e[t])) {
|
|
637
|
-
i += e[t];
|
|
638
|
-
t++;
|
|
639
|
-
}
|
|
640
|
-
D(i);
|
|
641
|
-
t = S(e, t);
|
|
642
|
-
let n = "";
|
|
643
|
-
while (t < e.length && !/\s/.test(e[t])) {
|
|
644
|
-
n += e[t];
|
|
645
|
-
t++;
|
|
646
|
-
}
|
|
647
|
-
if (!D(n)) {
|
|
648
|
-
throw new Error(`Invalid attribute name: "${n}"`);
|
|
649
|
-
}
|
|
650
|
-
t = S(e, t);
|
|
651
|
-
let s = "";
|
|
652
|
-
if (e.substring(t, t + 8).toUpperCase() === "NOTATION") {
|
|
653
|
-
s = "NOTATION";
|
|
654
|
-
t += 8;
|
|
655
|
-
t = S(e, t);
|
|
656
|
-
if (e[t] !== "(") {
|
|
657
|
-
throw new Error(`Expected '(', found "${e[t]}"`);
|
|
658
|
-
}
|
|
659
|
-
t++;
|
|
660
|
-
let i = [];
|
|
661
|
-
while (t < e.length && e[t] !== ")") {
|
|
662
|
-
let n = "";
|
|
663
|
-
while (t < e.length && e[t] !== "|" && e[t] !== ")") {
|
|
664
|
-
n += e[t];
|
|
665
|
-
t++;
|
|
666
|
-
}
|
|
667
|
-
n = n.trim();
|
|
668
|
-
if (!D(n)) {
|
|
669
|
-
throw new Error(`Invalid notation name: "${n}"`);
|
|
670
|
-
}
|
|
671
|
-
i.push(n);
|
|
672
|
-
if (e[t] === "|") {
|
|
673
|
-
t++;
|
|
674
|
-
t = S(e, t);
|
|
495
|
+
if (i === 0) {
|
|
496
|
+
break;
|
|
675
497
|
}
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
t++;
|
|
681
|
-
s += " (" + i.join("|") + ")";
|
|
682
|
-
} else {
|
|
683
|
-
while (t < e.length && !/\s/.test(e[t])) {
|
|
684
|
-
s += e[t];
|
|
685
|
-
t++;
|
|
686
|
-
}
|
|
687
|
-
const i = [ "CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS" ];
|
|
688
|
-
if (!this.suppressValidationErr && !i.includes(s.toUpperCase())) {
|
|
689
|
-
throw new Error(`Invalid attribute type: "${s}"`);
|
|
498
|
+
} else if (e[t] === "[") {
|
|
499
|
+
s = true;
|
|
500
|
+
} else {
|
|
501
|
+
o += e[t];
|
|
690
502
|
}
|
|
691
503
|
}
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
if (e.substring(t, t + 8).toUpperCase() === "#REQUIRED") {
|
|
695
|
-
r = "#REQUIRED";
|
|
696
|
-
t += 8;
|
|
697
|
-
} else if (e.substring(t, t + 7).toUpperCase() === "#IMPLIED") {
|
|
698
|
-
r = "#IMPLIED";
|
|
699
|
-
t += 7;
|
|
700
|
-
} else {
|
|
701
|
-
[t, r] = this.readIdentifierVal(e, t, "ATTLIST");
|
|
504
|
+
if (i !== 0) {
|
|
505
|
+
throw new Error(`Unclosed DOCTYPE`);
|
|
702
506
|
}
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
attributeName: n,
|
|
706
|
-
attributeType: s,
|
|
707
|
-
defaultValue: r,
|
|
708
|
-
index: t
|
|
709
|
-
};
|
|
507
|
+
} else {
|
|
508
|
+
throw new Error(`Invalid Tag instead of DOCTYPE`);
|
|
710
509
|
}
|
|
510
|
+
return {
|
|
511
|
+
entities: n,
|
|
512
|
+
i: t
|
|
513
|
+
};
|
|
711
514
|
}
|
|
712
515
|
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
516
|
+
function V(e, t) {
|
|
517
|
+
let n = "";
|
|
518
|
+
for (;t < e.length && (e[t] !== "'" && e[t] !== '"'); t++) {
|
|
519
|
+
n += e[t];
|
|
716
520
|
}
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
for (
|
|
722
|
-
|
|
521
|
+
n = n.trim();
|
|
522
|
+
if (n.indexOf(" ") !== -1) throw new Error("External entites are not supported");
|
|
523
|
+
const i = e[t++];
|
|
524
|
+
let s = "";
|
|
525
|
+
for (;t < e.length && e[t] !== i; t++) {
|
|
526
|
+
s += e[t];
|
|
723
527
|
}
|
|
724
|
-
return
|
|
528
|
+
return [ n, s, t ];
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
function j(e, t) {
|
|
532
|
+
if (e[t + 1] === "!" && e[t + 2] === "-" && e[t + 3] === "-") return true;
|
|
533
|
+
return false;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
function k(e, t) {
|
|
537
|
+
if (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") return true;
|
|
538
|
+
return false;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
function $(e, t) {
|
|
542
|
+
if (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") return true;
|
|
543
|
+
return false;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
function F(e, t) {
|
|
547
|
+
if (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") return true;
|
|
548
|
+
return false;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
function _(e, t) {
|
|
552
|
+
if (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") return true;
|
|
553
|
+
return false;
|
|
725
554
|
}
|
|
726
555
|
|
|
727
556
|
function D(e) {
|
|
728
|
-
if (
|
|
557
|
+
if (C.isName(e)) return e; else throw new Error(`Invalid entity name ${e}`);
|
|
729
558
|
}
|
|
730
559
|
|
|
731
|
-
|
|
560
|
+
var L = S;
|
|
732
561
|
|
|
733
|
-
const
|
|
562
|
+
const M = e(L);
|
|
734
563
|
|
|
735
|
-
const
|
|
564
|
+
const B = /^[-+]?0x[a-fA-F0-9]+$/;
|
|
565
|
+
|
|
566
|
+
const X = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/;
|
|
567
|
+
|
|
568
|
+
const G = {
|
|
736
569
|
hex: true,
|
|
737
570
|
leadingZeros: true,
|
|
738
571
|
decimalPoint: ".",
|
|
739
572
|
eNotation: true
|
|
740
573
|
};
|
|
741
574
|
|
|
742
|
-
function
|
|
743
|
-
t = Object.assign({},
|
|
575
|
+
function R(e, t = {}) {
|
|
576
|
+
t = Object.assign({}, G, t);
|
|
744
577
|
if (!e || typeof e !== "string") return e;
|
|
745
|
-
let
|
|
746
|
-
if (t.skipLike !== undefined && t.skipLike.test(
|
|
747
|
-
return
|
|
748
|
-
} else if (
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
const s = n[1] || "";
|
|
754
|
-
const r = n[2];
|
|
755
|
-
let o = L(n[3]);
|
|
756
|
-
const a = s ? e[r.length + 1] === "." : e[r.length] === ".";
|
|
757
|
-
if (!t.leadingZeros && (r.length > 1 || r.length === 1 && !a)) {
|
|
758
|
-
return e;
|
|
578
|
+
let n = e.trim();
|
|
579
|
+
if (t.skipLike !== undefined && t.skipLike.test(n)) return e; else if (e === "0") return 0; else if (t.hex && B.test(n)) {
|
|
580
|
+
return Z(n, 16);
|
|
581
|
+
} else if (n.search(/[eE]/) !== -1) {
|
|
582
|
+
const i = n.match(/^([-\+])?(0*)([0-9]*(\.[0-9]*)?[eE][-\+]?[0-9]+)$/);
|
|
583
|
+
if (i) {
|
|
584
|
+
if (t.leadingZeros) {
|
|
585
|
+
n = (i[1] || "") + i[3];
|
|
759
586
|
} else {
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
587
|
+
if (i[2] === "0" && i[3][0] === ".") {} else {
|
|
588
|
+
return e;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
return t.eNotation ? Number(n) : e;
|
|
592
|
+
} else {
|
|
593
|
+
return e;
|
|
594
|
+
}
|
|
595
|
+
} else {
|
|
596
|
+
const i = X.exec(n);
|
|
597
|
+
if (i) {
|
|
598
|
+
const s = i[1];
|
|
599
|
+
const r = i[2];
|
|
600
|
+
let o = U(i[3]);
|
|
601
|
+
if (!t.leadingZeros && r.length > 0 && s && n[2] !== ".") return e; else if (!t.leadingZeros && r.length > 0 && !s && n[1] !== ".") return e; else if (t.leadingZeros && r === e) return 0; else {
|
|
602
|
+
const i = Number(n);
|
|
603
|
+
const a = "" + i;
|
|
763
604
|
if (a.search(/[eE]/) !== -1) {
|
|
764
|
-
if (t.eNotation) return
|
|
765
|
-
} else if (
|
|
766
|
-
if (a === "0") return
|
|
605
|
+
if (t.eNotation) return i; else return e;
|
|
606
|
+
} else if (n.indexOf(".") !== -1) {
|
|
607
|
+
if (a === "0" && o === "") return i; else if (a === o) return i; else if (s && a === "-" + o) return i; else return e;
|
|
767
608
|
}
|
|
768
|
-
let l = r ? o : i;
|
|
769
609
|
if (r) {
|
|
770
|
-
return
|
|
610
|
+
return o === a || s + o === a ? i : e;
|
|
771
611
|
} else {
|
|
772
|
-
return
|
|
612
|
+
return n === a || n === s + a ? i : e;
|
|
773
613
|
}
|
|
774
614
|
}
|
|
775
615
|
} else {
|
|
@@ -778,51 +618,34 @@ function F(e, t = {}) {
|
|
|
778
618
|
}
|
|
779
619
|
}
|
|
780
620
|
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
function _(e, t, i) {
|
|
784
|
-
if (!i.eNotation) return e;
|
|
785
|
-
const n = t.match(M);
|
|
786
|
-
if (n) {
|
|
787
|
-
let s = n[1] || "";
|
|
788
|
-
const r = n[3].indexOf("e") === -1 ? "E" : "e";
|
|
789
|
-
const o = n[2];
|
|
790
|
-
const a = s ? e[o.length + 1] === r : e[o.length] === r;
|
|
791
|
-
if (o.length > 1 && a) return e; else if (o.length === 1 && (n[3].startsWith(`.${r}`) || n[3][0] === r)) {
|
|
792
|
-
return Number(t);
|
|
793
|
-
} else if (i.leadingZeros && !a) {
|
|
794
|
-
t = (n[1] || "") + n[3];
|
|
795
|
-
return Number(t);
|
|
796
|
-
} else return e;
|
|
797
|
-
} else {
|
|
798
|
-
return e;
|
|
799
|
-
}
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
function L(e) {
|
|
621
|
+
function U(e) {
|
|
803
622
|
if (e && e.indexOf(".") !== -1) {
|
|
804
623
|
e = e.replace(/0+$/, "");
|
|
805
|
-
if (e === ".") e = "0"; else if (e[0] === ".") e = "0" + e; else if (e[e.length - 1] === ".") e = e.
|
|
624
|
+
if (e === ".") e = "0"; else if (e[0] === ".") e = "0" + e; else if (e[e.length - 1] === ".") e = e.substr(0, e.length - 1);
|
|
806
625
|
return e;
|
|
807
626
|
}
|
|
808
627
|
return e;
|
|
809
628
|
}
|
|
810
629
|
|
|
811
|
-
function
|
|
630
|
+
function Z(e, t) {
|
|
812
631
|
if (parseInt) return parseInt(e, t); else if (Number.parseInt) return Number.parseInt(e, t); else if (window && window.parseInt) return window.parseInt(e, t); else throw new Error("parseInt, Number.parseInt, window.parseInt are not supported");
|
|
813
632
|
}
|
|
814
633
|
|
|
815
|
-
|
|
634
|
+
var Y = R;
|
|
635
|
+
|
|
636
|
+
const q = e(Y);
|
|
637
|
+
|
|
638
|
+
function W(e) {
|
|
816
639
|
if (typeof e === "function") {
|
|
817
640
|
return e;
|
|
818
641
|
}
|
|
819
642
|
if (Array.isArray(e)) {
|
|
820
643
|
return t => {
|
|
821
|
-
for (const
|
|
822
|
-
if (typeof
|
|
644
|
+
for (const n of e) {
|
|
645
|
+
if (typeof n === "string" && t === n) {
|
|
823
646
|
return true;
|
|
824
647
|
}
|
|
825
|
-
if (
|
|
648
|
+
if (n instanceof RegExp && n.test(t)) {
|
|
826
649
|
return true;
|
|
827
650
|
}
|
|
828
651
|
}
|
|
@@ -831,9 +654,23 @@ function R(e) {
|
|
|
831
654
|
return () => false;
|
|
832
655
|
}
|
|
833
656
|
|
|
657
|
+
var z = W;
|
|
658
|
+
|
|
659
|
+
const J = e(z);
|
|
660
|
+
|
|
834
661
|
"use strict";
|
|
835
662
|
|
|
836
|
-
|
|
663
|
+
const H = n;
|
|
664
|
+
|
|
665
|
+
const K = A;
|
|
666
|
+
|
|
667
|
+
const Q = L;
|
|
668
|
+
|
|
669
|
+
const ee = Y;
|
|
670
|
+
|
|
671
|
+
const te = z;
|
|
672
|
+
|
|
673
|
+
let ne = class OrderedObjParser {
|
|
837
674
|
constructor(e) {
|
|
838
675
|
this.options = e;
|
|
839
676
|
this.currentNode = null;
|
|
@@ -896,69 +733,56 @@ class OrderedObjParser {
|
|
|
896
733
|
},
|
|
897
734
|
num_dec: {
|
|
898
735
|
regex: /&#([0-9]{1,7});/g,
|
|
899
|
-
val: (e, t) => String.
|
|
736
|
+
val: (e, t) => String.fromCharCode(Number.parseInt(t, 10))
|
|
900
737
|
},
|
|
901
738
|
num_hex: {
|
|
902
739
|
regex: /&#x([0-9a-fA-F]{1,6});/g,
|
|
903
|
-
val: (e, t) => String.
|
|
740
|
+
val: (e, t) => String.fromCharCode(Number.parseInt(t, 16))
|
|
904
741
|
}
|
|
905
742
|
};
|
|
906
|
-
this.addExternalEntities =
|
|
907
|
-
this.parseXml =
|
|
908
|
-
this.parseTextData =
|
|
909
|
-
this.resolveNameSpace =
|
|
910
|
-
this.buildAttributesMap =
|
|
911
|
-
this.isItStopNode =
|
|
912
|
-
this.replaceEntitiesValue =
|
|
913
|
-
this.readStopNodeData =
|
|
914
|
-
this.saveTextToParentTag =
|
|
915
|
-
this.addChild =
|
|
916
|
-
this.ignoreAttributesFn =
|
|
917
|
-
if (this.options.stopNodes && this.options.stopNodes.length > 0) {
|
|
918
|
-
this.stopNodesExact = new Set;
|
|
919
|
-
this.stopNodesWildcard = new Set;
|
|
920
|
-
for (let e = 0; e < this.options.stopNodes.length; e++) {
|
|
921
|
-
const t = this.options.stopNodes[e];
|
|
922
|
-
if (typeof t !== "string") continue;
|
|
923
|
-
if (t.startsWith("*.")) {
|
|
924
|
-
this.stopNodesWildcard.add(t.substring(2));
|
|
925
|
-
} else {
|
|
926
|
-
this.stopNodesExact.add(t);
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
}
|
|
743
|
+
this.addExternalEntities = ie;
|
|
744
|
+
this.parseXml = le;
|
|
745
|
+
this.parseTextData = se;
|
|
746
|
+
this.resolveNameSpace = re;
|
|
747
|
+
this.buildAttributesMap = ae;
|
|
748
|
+
this.isItStopNode = he;
|
|
749
|
+
this.replaceEntitiesValue = fe;
|
|
750
|
+
this.readStopNodeData = me;
|
|
751
|
+
this.saveTextToParentTag = ce;
|
|
752
|
+
this.addChild = ue;
|
|
753
|
+
this.ignoreAttributesFn = te(this.options.ignoreAttributes);
|
|
930
754
|
}
|
|
931
|
-
}
|
|
755
|
+
};
|
|
932
756
|
|
|
933
|
-
function
|
|
757
|
+
function ie(e) {
|
|
934
758
|
const t = Object.keys(e);
|
|
935
|
-
for (let
|
|
936
|
-
const
|
|
937
|
-
this.lastEntities[
|
|
938
|
-
regex: new RegExp("&" +
|
|
939
|
-
val: e[
|
|
759
|
+
for (let n = 0; n < t.length; n++) {
|
|
760
|
+
const i = t[n];
|
|
761
|
+
this.lastEntities[i] = {
|
|
762
|
+
regex: new RegExp("&" + i + ";", "g"),
|
|
763
|
+
val: e[i]
|
|
940
764
|
};
|
|
941
765
|
}
|
|
942
766
|
}
|
|
943
767
|
|
|
944
|
-
function
|
|
768
|
+
function se(e, t, n, i, s, r, o) {
|
|
945
769
|
if (e !== undefined) {
|
|
946
|
-
if (this.options.trimValues && !
|
|
770
|
+
if (this.options.trimValues && !i) {
|
|
947
771
|
e = e.trim();
|
|
948
772
|
}
|
|
949
773
|
if (e.length > 0) {
|
|
950
774
|
if (!o) e = this.replaceEntitiesValue(e);
|
|
951
|
-
const
|
|
952
|
-
if (
|
|
775
|
+
const i = this.options.tagValueProcessor(t, e, n, s, r);
|
|
776
|
+
if (i === null || i === undefined) {
|
|
953
777
|
return e;
|
|
954
|
-
} else if (typeof
|
|
955
|
-
return
|
|
778
|
+
} else if (typeof i !== typeof e || i !== e) {
|
|
779
|
+
return i;
|
|
956
780
|
} else if (this.options.trimValues) {
|
|
957
|
-
return
|
|
781
|
+
return xe(e, this.options.parseTagValue, this.options.numberParseOptions);
|
|
958
782
|
} else {
|
|
959
783
|
const t = e.trim();
|
|
960
784
|
if (t === e) {
|
|
961
|
-
return
|
|
785
|
+
return xe(e, this.options.parseTagValue, this.options.numberParseOptions);
|
|
962
786
|
} else {
|
|
963
787
|
return e;
|
|
964
788
|
}
|
|
@@ -967,97 +791,96 @@ function B(e, t, i, n, s, r, o) {
|
|
|
967
791
|
}
|
|
968
792
|
}
|
|
969
793
|
|
|
970
|
-
function
|
|
794
|
+
function re(e) {
|
|
971
795
|
if (this.options.removeNSPrefix) {
|
|
972
796
|
const t = e.split(":");
|
|
973
|
-
const
|
|
797
|
+
const n = e.charAt(0) === "/" ? "/" : "";
|
|
974
798
|
if (t[0] === "xmlns") {
|
|
975
799
|
return "";
|
|
976
800
|
}
|
|
977
801
|
if (t.length === 2) {
|
|
978
|
-
e =
|
|
802
|
+
e = n + t[1];
|
|
979
803
|
}
|
|
980
804
|
}
|
|
981
805
|
return e;
|
|
982
806
|
}
|
|
983
807
|
|
|
984
|
-
const
|
|
808
|
+
const oe = new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?", "gm");
|
|
985
809
|
|
|
986
|
-
function
|
|
810
|
+
function ae(e, t, n) {
|
|
987
811
|
if (this.options.ignoreAttributes !== true && typeof e === "string") {
|
|
988
|
-
const
|
|
989
|
-
const
|
|
990
|
-
const
|
|
991
|
-
for (let e = 0; e <
|
|
992
|
-
const
|
|
993
|
-
if (this.ignoreAttributesFn(
|
|
812
|
+
const n = H.getAllMatches(e, oe);
|
|
813
|
+
const i = n.length;
|
|
814
|
+
const s = {};
|
|
815
|
+
for (let e = 0; e < i; e++) {
|
|
816
|
+
const i = this.resolveNameSpace(n[e][1]);
|
|
817
|
+
if (this.ignoreAttributesFn(i, t)) {
|
|
994
818
|
continue;
|
|
995
819
|
}
|
|
996
|
-
let
|
|
997
|
-
let o = this.options.attributeNamePrefix +
|
|
998
|
-
if (
|
|
820
|
+
let r = n[e][4];
|
|
821
|
+
let o = this.options.attributeNamePrefix + i;
|
|
822
|
+
if (i.length) {
|
|
999
823
|
if (this.options.transformAttributeName) {
|
|
1000
824
|
o = this.options.transformAttributeName(o);
|
|
1001
825
|
}
|
|
1002
826
|
if (o === "__proto__") o = "#__proto__";
|
|
1003
|
-
if (
|
|
827
|
+
if (r !== undefined) {
|
|
1004
828
|
if (this.options.trimValues) {
|
|
1005
|
-
|
|
829
|
+
r = r.trim();
|
|
1006
830
|
}
|
|
1007
|
-
|
|
1008
|
-
const e = this.options.attributeValueProcessor(
|
|
831
|
+
r = this.replaceEntitiesValue(r);
|
|
832
|
+
const e = this.options.attributeValueProcessor(i, r, t);
|
|
1009
833
|
if (e === null || e === undefined) {
|
|
1010
|
-
|
|
1011
|
-
} else if (typeof e !== typeof
|
|
1012
|
-
|
|
834
|
+
s[o] = r;
|
|
835
|
+
} else if (typeof e !== typeof r || e !== r) {
|
|
836
|
+
s[o] = e;
|
|
1013
837
|
} else {
|
|
1014
|
-
|
|
838
|
+
s[o] = xe(r, this.options.parseAttributeValue, this.options.numberParseOptions);
|
|
1015
839
|
}
|
|
1016
840
|
} else if (this.options.allowBooleanAttributes) {
|
|
1017
|
-
|
|
841
|
+
s[o] = true;
|
|
1018
842
|
}
|
|
1019
843
|
}
|
|
1020
844
|
}
|
|
1021
|
-
if (!Object.keys(
|
|
845
|
+
if (!Object.keys(s).length) {
|
|
1022
846
|
return;
|
|
1023
847
|
}
|
|
1024
848
|
if (this.options.attributesGroupName) {
|
|
1025
849
|
const e = {};
|
|
1026
|
-
e[this.options.attributesGroupName] =
|
|
850
|
+
e[this.options.attributesGroupName] = s;
|
|
1027
851
|
return e;
|
|
1028
852
|
}
|
|
1029
|
-
return
|
|
853
|
+
return s;
|
|
1030
854
|
}
|
|
1031
855
|
}
|
|
1032
856
|
|
|
1033
|
-
const
|
|
857
|
+
const le = function(e) {
|
|
1034
858
|
e = e.replace(/\r\n?/g, "\n");
|
|
1035
|
-
const t = new
|
|
1036
|
-
let
|
|
1037
|
-
let
|
|
859
|
+
const t = new K("!xml");
|
|
860
|
+
let n = t;
|
|
861
|
+
let i = "";
|
|
1038
862
|
let s = "";
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
let r = e.substring(o + 2, t).trim();
|
|
863
|
+
for (let r = 0; r < e.length; r++) {
|
|
864
|
+
const o = e[r];
|
|
865
|
+
if (o === "<") {
|
|
866
|
+
if (e[r + 1] === "/") {
|
|
867
|
+
const t = pe(e, ">", r, "Closing Tag is not closed.");
|
|
868
|
+
let o = e.substring(r + 2, t).trim();
|
|
1046
869
|
if (this.options.removeNSPrefix) {
|
|
1047
|
-
const e =
|
|
870
|
+
const e = o.indexOf(":");
|
|
1048
871
|
if (e !== -1) {
|
|
1049
|
-
|
|
872
|
+
o = o.substr(e + 1);
|
|
1050
873
|
}
|
|
1051
874
|
}
|
|
1052
875
|
if (this.options.transformTagName) {
|
|
1053
|
-
|
|
876
|
+
o = this.options.transformTagName(o);
|
|
1054
877
|
}
|
|
1055
|
-
if (
|
|
1056
|
-
|
|
878
|
+
if (n) {
|
|
879
|
+
i = this.saveTextToParentTag(i, n, s);
|
|
1057
880
|
}
|
|
1058
881
|
const a = s.substring(s.lastIndexOf(".") + 1);
|
|
1059
|
-
if (
|
|
1060
|
-
throw new Error(`Unpaired tag can not be used as closing tag: </${
|
|
882
|
+
if (o && this.options.unpairedTags.indexOf(o) !== -1) {
|
|
883
|
+
throw new Error(`Unpaired tag can not be used as closing tag: </${o}>`);
|
|
1061
884
|
}
|
|
1062
885
|
let l = 0;
|
|
1063
886
|
if (a && this.options.unpairedTags.indexOf(a) !== -1) {
|
|
@@ -1067,75 +890,74 @@ const q = function(e) {
|
|
|
1067
890
|
l = s.lastIndexOf(".");
|
|
1068
891
|
}
|
|
1069
892
|
s = s.substring(0, l);
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
} else if (e[
|
|
1074
|
-
let t =
|
|
893
|
+
n = this.tagsNodeStack.pop();
|
|
894
|
+
i = "";
|
|
895
|
+
r = t;
|
|
896
|
+
} else if (e[r + 1] === "?") {
|
|
897
|
+
let t = ge(e, r, false, "?>");
|
|
1075
898
|
if (!t) throw new Error("Pi Tag is not closed.");
|
|
1076
|
-
|
|
899
|
+
i = this.saveTextToParentTag(i, n, s);
|
|
1077
900
|
if (this.options.ignoreDeclaration && t.tagName === "?xml" || this.options.ignorePiTags) {} else {
|
|
1078
|
-
const e = new
|
|
901
|
+
const e = new K(t.tagName);
|
|
1079
902
|
e.add(this.options.textNodeName, "");
|
|
1080
903
|
if (t.tagName !== t.tagExp && t.attrExpPresent) {
|
|
1081
904
|
e[":@"] = this.buildAttributesMap(t.tagExp, s, t.tagName);
|
|
1082
905
|
}
|
|
1083
|
-
this.addChild(
|
|
906
|
+
this.addChild(n, e, s);
|
|
1084
907
|
}
|
|
1085
|
-
|
|
1086
|
-
} else if (e.substr(
|
|
1087
|
-
const t =
|
|
908
|
+
r = t.closeIndex + 1;
|
|
909
|
+
} else if (e.substr(r + 1, 3) === "!--") {
|
|
910
|
+
const t = pe(e, "--\x3e", r + 4, "Comment is not closed.");
|
|
1088
911
|
if (this.options.commentPropName) {
|
|
1089
|
-
const
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
[this.options.textNodeName]:
|
|
912
|
+
const o = e.substring(r + 4, t - 2);
|
|
913
|
+
i = this.saveTextToParentTag(i, n, s);
|
|
914
|
+
n.add(this.options.commentPropName, [ {
|
|
915
|
+
[this.options.textNodeName]: o
|
|
1093
916
|
} ]);
|
|
1094
917
|
}
|
|
1095
|
-
|
|
1096
|
-
} else if (e.substr(
|
|
1097
|
-
const t =
|
|
918
|
+
r = t;
|
|
919
|
+
} else if (e.substr(r + 1, 2) === "!D") {
|
|
920
|
+
const t = Q(e, r);
|
|
1098
921
|
this.docTypeEntities = t.entities;
|
|
1099
|
-
|
|
1100
|
-
} else if (e.substr(
|
|
1101
|
-
const t =
|
|
1102
|
-
const
|
|
1103
|
-
|
|
1104
|
-
let a = this.parseTextData(
|
|
922
|
+
r = t.i;
|
|
923
|
+
} else if (e.substr(r + 1, 2) === "![") {
|
|
924
|
+
const t = pe(e, "]]>", r, "CDATA is not closed.") - 2;
|
|
925
|
+
const o = e.substring(r + 9, t);
|
|
926
|
+
i = this.saveTextToParentTag(i, n, s);
|
|
927
|
+
let a = this.parseTextData(o, n.tagname, s, true, false, true, true);
|
|
1105
928
|
if (a == undefined) a = "";
|
|
1106
929
|
if (this.options.cdataPropName) {
|
|
1107
|
-
|
|
1108
|
-
[this.options.textNodeName]:
|
|
930
|
+
n.add(this.options.cdataPropName, [ {
|
|
931
|
+
[this.options.textNodeName]: o
|
|
1109
932
|
} ]);
|
|
1110
933
|
} else {
|
|
1111
|
-
|
|
934
|
+
n.add(this.options.textNodeName, a);
|
|
1112
935
|
}
|
|
1113
|
-
|
|
936
|
+
r = t + 2;
|
|
1114
937
|
} else {
|
|
1115
|
-
let
|
|
1116
|
-
let a =
|
|
1117
|
-
const l =
|
|
1118
|
-
let u =
|
|
1119
|
-
let f =
|
|
1120
|
-
let
|
|
938
|
+
let o = ge(e, r, this.options.removeNSPrefix);
|
|
939
|
+
let a = o.tagName;
|
|
940
|
+
const l = o.rawTagName;
|
|
941
|
+
let u = o.tagExp;
|
|
942
|
+
let f = o.attrExpPresent;
|
|
943
|
+
let c = o.closeIndex;
|
|
1121
944
|
if (this.options.transformTagName) {
|
|
1122
945
|
a = this.options.transformTagName(a);
|
|
1123
946
|
}
|
|
1124
|
-
if (
|
|
1125
|
-
if (
|
|
1126
|
-
|
|
947
|
+
if (n && i) {
|
|
948
|
+
if (n.tagname !== "!xml") {
|
|
949
|
+
i = this.saveTextToParentTag(i, n, s, false);
|
|
1127
950
|
}
|
|
1128
951
|
}
|
|
1129
|
-
const h =
|
|
952
|
+
const h = n;
|
|
1130
953
|
if (h && this.options.unpairedTags.indexOf(h.tagname) !== -1) {
|
|
1131
|
-
|
|
954
|
+
n = this.tagsNodeStack.pop();
|
|
1132
955
|
s = s.substring(0, s.lastIndexOf("."));
|
|
1133
956
|
}
|
|
1134
957
|
if (a !== t.tagname) {
|
|
1135
958
|
s += s ? "." + a : a;
|
|
1136
959
|
}
|
|
1137
|
-
|
|
1138
|
-
if (this.isItStopNode(this.stopNodesExact, this.stopNodesWildcard, s, a)) {
|
|
960
|
+
if (this.isItStopNode(this.options.stopNodes, s, a)) {
|
|
1139
961
|
let t = "";
|
|
1140
962
|
if (u.length > 0 && u.lastIndexOf("/") === u.length - 1) {
|
|
1141
963
|
if (a[a.length - 1] === "/") {
|
|
@@ -1145,25 +967,25 @@ const q = function(e) {
|
|
|
1145
967
|
} else {
|
|
1146
968
|
u = u.substr(0, u.length - 1);
|
|
1147
969
|
}
|
|
1148
|
-
|
|
970
|
+
r = o.closeIndex;
|
|
1149
971
|
} else if (this.options.unpairedTags.indexOf(a) !== -1) {
|
|
1150
|
-
|
|
972
|
+
r = o.closeIndex;
|
|
1151
973
|
} else {
|
|
1152
|
-
const
|
|
1153
|
-
if (!
|
|
1154
|
-
|
|
1155
|
-
t =
|
|
974
|
+
const n = this.readStopNodeData(e, l, c + 1);
|
|
975
|
+
if (!n) throw new Error(`Unexpected end of ${l}`);
|
|
976
|
+
r = n.i;
|
|
977
|
+
t = n.tagContent;
|
|
1156
978
|
}
|
|
1157
|
-
const
|
|
979
|
+
const i = new K(a);
|
|
1158
980
|
if (a !== u && f) {
|
|
1159
|
-
|
|
981
|
+
i[":@"] = this.buildAttributesMap(u, s, a);
|
|
1160
982
|
}
|
|
1161
983
|
if (t) {
|
|
1162
984
|
t = this.parseTextData(t, a, s, true, f, true, true);
|
|
1163
985
|
}
|
|
1164
986
|
s = s.substr(0, s.lastIndexOf("."));
|
|
1165
|
-
|
|
1166
|
-
this.addChild(
|
|
987
|
+
i.add(this.options.textNodeName, t);
|
|
988
|
+
this.addChild(n, i, s);
|
|
1167
989
|
} else {
|
|
1168
990
|
if (u.length > 0 && u.lastIndexOf("/") === u.length - 1) {
|
|
1169
991
|
if (a[a.length - 1] === "/") {
|
|
@@ -1176,57 +998,56 @@ const q = function(e) {
|
|
|
1176
998
|
if (this.options.transformTagName) {
|
|
1177
999
|
a = this.options.transformTagName(a);
|
|
1178
1000
|
}
|
|
1179
|
-
const e = new
|
|
1001
|
+
const e = new K(a);
|
|
1180
1002
|
if (a !== u && f) {
|
|
1181
1003
|
e[":@"] = this.buildAttributesMap(u, s, a);
|
|
1182
1004
|
}
|
|
1183
|
-
this.addChild(
|
|
1005
|
+
this.addChild(n, e, s);
|
|
1184
1006
|
s = s.substr(0, s.lastIndexOf("."));
|
|
1185
1007
|
} else {
|
|
1186
|
-
const e = new
|
|
1187
|
-
this.tagsNodeStack.push(
|
|
1008
|
+
const e = new K(a);
|
|
1009
|
+
this.tagsNodeStack.push(n);
|
|
1188
1010
|
if (a !== u && f) {
|
|
1189
1011
|
e[":@"] = this.buildAttributesMap(u, s, a);
|
|
1190
1012
|
}
|
|
1191
|
-
this.addChild(
|
|
1192
|
-
|
|
1013
|
+
this.addChild(n, e, s);
|
|
1014
|
+
n = e;
|
|
1193
1015
|
}
|
|
1194
|
-
|
|
1195
|
-
|
|
1016
|
+
i = "";
|
|
1017
|
+
r = c;
|
|
1196
1018
|
}
|
|
1197
1019
|
}
|
|
1198
1020
|
} else {
|
|
1199
|
-
|
|
1021
|
+
i += e[r];
|
|
1200
1022
|
}
|
|
1201
1023
|
}
|
|
1202
1024
|
return t.child;
|
|
1203
1025
|
};
|
|
1204
1026
|
|
|
1205
|
-
function
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
t
|
|
1210
|
-
e.addChild(t, n);
|
|
1027
|
+
function ue(e, t, n) {
|
|
1028
|
+
const i = this.options.updateTag(t.tagname, n, t[":@"]);
|
|
1029
|
+
if (i === false) {} else if (typeof i === "string") {
|
|
1030
|
+
t.tagname = i;
|
|
1031
|
+
e.addChild(t);
|
|
1211
1032
|
} else {
|
|
1212
|
-
e.addChild(t
|
|
1033
|
+
e.addChild(t);
|
|
1213
1034
|
}
|
|
1214
1035
|
}
|
|
1215
1036
|
|
|
1216
|
-
const
|
|
1037
|
+
const fe = function(e) {
|
|
1217
1038
|
if (this.options.processEntities) {
|
|
1218
1039
|
for (let t in this.docTypeEntities) {
|
|
1219
|
-
const
|
|
1220
|
-
e = e.replace(
|
|
1040
|
+
const n = this.docTypeEntities[t];
|
|
1041
|
+
e = e.replace(n.regx, n.val);
|
|
1221
1042
|
}
|
|
1222
1043
|
for (let t in this.lastEntities) {
|
|
1223
|
-
const
|
|
1224
|
-
e = e.replace(
|
|
1044
|
+
const n = this.lastEntities[t];
|
|
1045
|
+
e = e.replace(n.regex, n.val);
|
|
1225
1046
|
}
|
|
1226
1047
|
if (this.options.htmlEntities) {
|
|
1227
1048
|
for (let t in this.htmlEntities) {
|
|
1228
|
-
const
|
|
1229
|
-
e = e.replace(
|
|
1049
|
+
const n = this.htmlEntities[t];
|
|
1050
|
+
e = e.replace(n.regex, n.val);
|
|
1230
1051
|
}
|
|
1231
1052
|
}
|
|
1232
1053
|
e = e.replace(this.ampEntity.regex, this.ampEntity.val);
|
|
@@ -1234,34 +1055,37 @@ const K = function(e) {
|
|
|
1234
1055
|
return e;
|
|
1235
1056
|
};
|
|
1236
1057
|
|
|
1237
|
-
function
|
|
1058
|
+
function ce(e, t, n, i) {
|
|
1238
1059
|
if (e) {
|
|
1239
|
-
if (
|
|
1240
|
-
e = this.parseTextData(e, t.tagname,
|
|
1060
|
+
if (i === undefined) i = t.child.length === 0;
|
|
1061
|
+
e = this.parseTextData(e, t.tagname, n, false, t[":@"] ? Object.keys(t[":@"]).length !== 0 : false, i);
|
|
1241
1062
|
if (e !== undefined && e !== "") t.add(this.options.textNodeName, e);
|
|
1242
1063
|
e = "";
|
|
1243
1064
|
}
|
|
1244
1065
|
return e;
|
|
1245
1066
|
}
|
|
1246
1067
|
|
|
1247
|
-
function
|
|
1248
|
-
|
|
1249
|
-
|
|
1068
|
+
function he(e, t, n) {
|
|
1069
|
+
const i = "*." + n;
|
|
1070
|
+
for (const n in e) {
|
|
1071
|
+
const s = e[n];
|
|
1072
|
+
if (i === s || t === s) return true;
|
|
1073
|
+
}
|
|
1250
1074
|
return false;
|
|
1251
1075
|
}
|
|
1252
1076
|
|
|
1253
|
-
function
|
|
1254
|
-
let
|
|
1077
|
+
function de(e, t, n = ">") {
|
|
1078
|
+
let i;
|
|
1255
1079
|
let s = "";
|
|
1256
1080
|
for (let r = t; r < e.length; r++) {
|
|
1257
1081
|
let t = e[r];
|
|
1258
|
-
if (
|
|
1259
|
-
if (t ===
|
|
1082
|
+
if (i) {
|
|
1083
|
+
if (t === i) i = "";
|
|
1260
1084
|
} else if (t === '"' || t === "'") {
|
|
1261
|
-
|
|
1262
|
-
} else if (t ===
|
|
1263
|
-
if (
|
|
1264
|
-
if (e[r + 1] ===
|
|
1085
|
+
i = t;
|
|
1086
|
+
} else if (t === n[0]) {
|
|
1087
|
+
if (n[1]) {
|
|
1088
|
+
if (e[r + 1] === n[1]) {
|
|
1265
1089
|
return {
|
|
1266
1090
|
data: s,
|
|
1267
1091
|
index: r
|
|
@@ -1280,17 +1104,17 @@ function J(e, t, i = ">") {
|
|
|
1280
1104
|
}
|
|
1281
1105
|
}
|
|
1282
1106
|
|
|
1283
|
-
function
|
|
1284
|
-
const s = e.indexOf(t,
|
|
1107
|
+
function pe(e, t, n, i) {
|
|
1108
|
+
const s = e.indexOf(t, n);
|
|
1285
1109
|
if (s === -1) {
|
|
1286
|
-
throw new Error(
|
|
1110
|
+
throw new Error(i);
|
|
1287
1111
|
} else {
|
|
1288
1112
|
return s + t.length - 1;
|
|
1289
1113
|
}
|
|
1290
1114
|
}
|
|
1291
1115
|
|
|
1292
|
-
function
|
|
1293
|
-
const s =
|
|
1116
|
+
function ge(e, t, n, i = ">") {
|
|
1117
|
+
const s = de(e, t + 1, i);
|
|
1294
1118
|
if (!s) return;
|
|
1295
1119
|
let r = s.data;
|
|
1296
1120
|
const o = s.index;
|
|
@@ -1302,7 +1126,7 @@ function ee(e, t, i, n = ">") {
|
|
|
1302
1126
|
r = r.substring(a + 1).trimStart();
|
|
1303
1127
|
}
|
|
1304
1128
|
const f = l;
|
|
1305
|
-
if (
|
|
1129
|
+
if (n) {
|
|
1306
1130
|
const e = l.indexOf(":");
|
|
1307
1131
|
if (e !== -1) {
|
|
1308
1132
|
l = l.substr(e + 1);
|
|
@@ -1318,53 +1142,53 @@ function ee(e, t, i, n = ">") {
|
|
|
1318
1142
|
};
|
|
1319
1143
|
}
|
|
1320
1144
|
|
|
1321
|
-
function
|
|
1322
|
-
const
|
|
1145
|
+
function me(e, t, n) {
|
|
1146
|
+
const i = n;
|
|
1323
1147
|
let s = 1;
|
|
1324
|
-
for (;
|
|
1325
|
-
if (e[
|
|
1326
|
-
if (e[
|
|
1327
|
-
const r =
|
|
1328
|
-
let o = e.substring(
|
|
1148
|
+
for (;n < e.length; n++) {
|
|
1149
|
+
if (e[n] === "<") {
|
|
1150
|
+
if (e[n + 1] === "/") {
|
|
1151
|
+
const r = pe(e, ">", n, `${t} is not closed`);
|
|
1152
|
+
let o = e.substring(n + 2, r).trim();
|
|
1329
1153
|
if (o === t) {
|
|
1330
1154
|
s--;
|
|
1331
1155
|
if (s === 0) {
|
|
1332
1156
|
return {
|
|
1333
|
-
tagContent: e.substring(
|
|
1157
|
+
tagContent: e.substring(i, n),
|
|
1334
1158
|
i: r
|
|
1335
1159
|
};
|
|
1336
1160
|
}
|
|
1337
1161
|
}
|
|
1338
|
-
|
|
1339
|
-
} else if (e[
|
|
1340
|
-
const t =
|
|
1341
|
-
|
|
1342
|
-
} else if (e.substr(
|
|
1343
|
-
const t =
|
|
1344
|
-
|
|
1345
|
-
} else if (e.substr(
|
|
1346
|
-
const t =
|
|
1347
|
-
|
|
1162
|
+
n = r;
|
|
1163
|
+
} else if (e[n + 1] === "?") {
|
|
1164
|
+
const t = pe(e, "?>", n + 1, "StopNode is not closed.");
|
|
1165
|
+
n = t;
|
|
1166
|
+
} else if (e.substr(n + 1, 3) === "!--") {
|
|
1167
|
+
const t = pe(e, "--\x3e", n + 3, "StopNode is not closed.");
|
|
1168
|
+
n = t;
|
|
1169
|
+
} else if (e.substr(n + 1, 2) === "![") {
|
|
1170
|
+
const t = pe(e, "]]>", n, "StopNode is not closed.") - 2;
|
|
1171
|
+
n = t;
|
|
1348
1172
|
} else {
|
|
1349
|
-
const
|
|
1350
|
-
if (
|
|
1351
|
-
const e =
|
|
1352
|
-
if (e === t &&
|
|
1173
|
+
const i = ge(e, n, ">");
|
|
1174
|
+
if (i) {
|
|
1175
|
+
const e = i && i.tagName;
|
|
1176
|
+
if (e === t && i.tagExp[i.tagExp.length - 1] !== "/") {
|
|
1353
1177
|
s++;
|
|
1354
1178
|
}
|
|
1355
|
-
|
|
1179
|
+
n = i.closeIndex;
|
|
1356
1180
|
}
|
|
1357
1181
|
}
|
|
1358
1182
|
}
|
|
1359
1183
|
}
|
|
1360
1184
|
}
|
|
1361
1185
|
|
|
1362
|
-
function
|
|
1186
|
+
function xe(e, t, n) {
|
|
1363
1187
|
if (t && typeof e === "string") {
|
|
1364
1188
|
const t = e.trim();
|
|
1365
|
-
if (t === "true") return true; else if (t === "false") return false; else return
|
|
1189
|
+
if (t === "true") return true; else if (t === "false") return false; else return ee(e, n);
|
|
1366
1190
|
} else {
|
|
1367
|
-
if (
|
|
1191
|
+
if (H.isExist(e)) {
|
|
1368
1192
|
return e;
|
|
1369
1193
|
} else {
|
|
1370
1194
|
return "";
|
|
@@ -1372,34 +1196,35 @@ function ie(e, t, i) {
|
|
|
1372
1196
|
}
|
|
1373
1197
|
}
|
|
1374
1198
|
|
|
1375
|
-
|
|
1199
|
+
var Ne = ne;
|
|
1376
1200
|
|
|
1377
|
-
const
|
|
1201
|
+
const be = e(Ne);
|
|
1378
1202
|
|
|
1379
|
-
|
|
1380
|
-
|
|
1203
|
+
var Ee = {};
|
|
1204
|
+
|
|
1205
|
+
"use strict";
|
|
1206
|
+
|
|
1207
|
+
function ve(e, t) {
|
|
1208
|
+
return ye(e, t);
|
|
1381
1209
|
}
|
|
1382
1210
|
|
|
1383
|
-
function
|
|
1384
|
-
let
|
|
1211
|
+
function ye(e, t, n) {
|
|
1212
|
+
let i;
|
|
1385
1213
|
const s = {};
|
|
1386
1214
|
for (let r = 0; r < e.length; r++) {
|
|
1387
1215
|
const o = e[r];
|
|
1388
|
-
const a =
|
|
1216
|
+
const a = Te(o);
|
|
1389
1217
|
let l = "";
|
|
1390
|
-
if (
|
|
1218
|
+
if (n === undefined) l = a; else l = n + "." + a;
|
|
1391
1219
|
if (a === t.textNodeName) {
|
|
1392
|
-
if (
|
|
1220
|
+
if (i === undefined) i = o[a]; else i += "" + o[a];
|
|
1393
1221
|
} else if (a === undefined) {
|
|
1394
1222
|
continue;
|
|
1395
1223
|
} else if (o[a]) {
|
|
1396
|
-
let e =
|
|
1397
|
-
const
|
|
1398
|
-
if (o[ne] !== undefined) {
|
|
1399
|
-
e[ne] = o[ne];
|
|
1400
|
-
}
|
|
1224
|
+
let e = ye(o[a], t, l);
|
|
1225
|
+
const n = we(e, t);
|
|
1401
1226
|
if (o[":@"]) {
|
|
1402
|
-
|
|
1227
|
+
Oe(e, o[":@"], l, t);
|
|
1403
1228
|
} else if (Object.keys(e).length === 1 && e[t.textNodeName] !== undefined && !t.alwaysCreateTextNode) {
|
|
1404
1229
|
e = e[t.textNodeName];
|
|
1405
1230
|
} else if (Object.keys(e).length === 0) {
|
|
@@ -1411,7 +1236,7 @@ function re(e, t, i) {
|
|
|
1411
1236
|
}
|
|
1412
1237
|
s[a].push(e);
|
|
1413
1238
|
} else {
|
|
1414
|
-
if (t.isArray(a, l,
|
|
1239
|
+
if (t.isArray(a, l, n)) {
|
|
1415
1240
|
s[a] = [ e ];
|
|
1416
1241
|
} else {
|
|
1417
1242
|
s[a] = e;
|
|
@@ -1419,27 +1244,27 @@ function re(e, t, i) {
|
|
|
1419
1244
|
}
|
|
1420
1245
|
}
|
|
1421
1246
|
}
|
|
1422
|
-
if (typeof
|
|
1423
|
-
if (
|
|
1424
|
-
} else if (
|
|
1247
|
+
if (typeof i === "string") {
|
|
1248
|
+
if (i.length > 0) s[t.textNodeName] = i;
|
|
1249
|
+
} else if (i !== undefined) s[t.textNodeName] = i;
|
|
1425
1250
|
return s;
|
|
1426
1251
|
}
|
|
1427
1252
|
|
|
1428
|
-
function
|
|
1253
|
+
function Te(e) {
|
|
1429
1254
|
const t = Object.keys(e);
|
|
1430
1255
|
for (let e = 0; e < t.length; e++) {
|
|
1431
|
-
const
|
|
1432
|
-
if (
|
|
1256
|
+
const n = t[e];
|
|
1257
|
+
if (n !== ":@") return n;
|
|
1433
1258
|
}
|
|
1434
1259
|
}
|
|
1435
1260
|
|
|
1436
|
-
function
|
|
1261
|
+
function Oe(e, t, n, i) {
|
|
1437
1262
|
if (t) {
|
|
1438
1263
|
const s = Object.keys(t);
|
|
1439
1264
|
const r = s.length;
|
|
1440
1265
|
for (let o = 0; o < r; o++) {
|
|
1441
1266
|
const r = s[o];
|
|
1442
|
-
if (
|
|
1267
|
+
if (i.isArray(r, n + "." + r, true, true)) {
|
|
1443
1268
|
e[r] = [ t[r] ];
|
|
1444
1269
|
} else {
|
|
1445
1270
|
e[r] = t[r];
|
|
@@ -1448,40 +1273,50 @@ function ae(e, t, i, n) {
|
|
|
1448
1273
|
}
|
|
1449
1274
|
}
|
|
1450
1275
|
|
|
1451
|
-
function
|
|
1452
|
-
const {textNodeName:
|
|
1453
|
-
const
|
|
1454
|
-
if (
|
|
1276
|
+
function we(e, t) {
|
|
1277
|
+
const {textNodeName: n} = t;
|
|
1278
|
+
const i = Object.keys(e).length;
|
|
1279
|
+
if (i === 0) {
|
|
1455
1280
|
return true;
|
|
1456
1281
|
}
|
|
1457
|
-
if (
|
|
1282
|
+
if (i === 1 && (e[n] || typeof e[n] === "boolean" || e[n] === 0)) {
|
|
1458
1283
|
return true;
|
|
1459
1284
|
}
|
|
1460
1285
|
return false;
|
|
1461
1286
|
}
|
|
1462
1287
|
|
|
1463
|
-
|
|
1288
|
+
var Pe = Ee.prettify = ve;
|
|
1289
|
+
|
|
1290
|
+
const {buildOptions: Ae} = y;
|
|
1291
|
+
|
|
1292
|
+
const Ie = Ne;
|
|
1293
|
+
|
|
1294
|
+
const {prettify: Ce} = Ee;
|
|
1295
|
+
|
|
1296
|
+
const Se = t;
|
|
1297
|
+
|
|
1298
|
+
let Ve = class XMLParser {
|
|
1464
1299
|
constructor(e) {
|
|
1465
1300
|
this.externalEntities = {};
|
|
1466
|
-
this.options =
|
|
1301
|
+
this.options = Ae(e);
|
|
1467
1302
|
}
|
|
1468
1303
|
parse(e, t) {
|
|
1469
|
-
if (typeof e
|
|
1304
|
+
if (typeof e === "string") {} else if (e.toString) {
|
|
1470
1305
|
e = e.toString();
|
|
1471
|
-
} else
|
|
1306
|
+
} else {
|
|
1472
1307
|
throw new Error("XML data is accepted in String or Bytes[] form.");
|
|
1473
1308
|
}
|
|
1474
1309
|
if (t) {
|
|
1475
1310
|
if (t === true) t = {};
|
|
1476
|
-
const
|
|
1477
|
-
if (
|
|
1478
|
-
throw Error(`${
|
|
1311
|
+
const n = Se.validate(e, t);
|
|
1312
|
+
if (n !== true) {
|
|
1313
|
+
throw Error(`${n.err.msg}:${n.err.line}:${n.err.col}`);
|
|
1479
1314
|
}
|
|
1480
1315
|
}
|
|
1481
|
-
const
|
|
1482
|
-
|
|
1483
|
-
const
|
|
1484
|
-
if (this.options.preserveOrder ||
|
|
1316
|
+
const n = new Ie(this.options);
|
|
1317
|
+
n.addExternalEntities(this.externalEntities);
|
|
1318
|
+
const i = n.parseXml(e);
|
|
1319
|
+
if (this.options.preserveOrder || i === undefined) return i; else return Ce(i, this.options);
|
|
1485
1320
|
}
|
|
1486
1321
|
addEntity(e, t) {
|
|
1487
1322
|
if (t.indexOf("&") !== -1) {
|
|
@@ -1494,81 +1329,82 @@ class XMLParser {
|
|
|
1494
1329
|
this.externalEntities[e] = t;
|
|
1495
1330
|
}
|
|
1496
1331
|
}
|
|
1497
|
-
|
|
1498
|
-
return XmlNode.getMetaDataSymbol();
|
|
1499
|
-
}
|
|
1500
|
-
}
|
|
1332
|
+
};
|
|
1501
1333
|
|
|
1502
|
-
|
|
1334
|
+
var je = Ve;
|
|
1503
1335
|
|
|
1504
|
-
|
|
1505
|
-
|
|
1336
|
+
const ke = e(je);
|
|
1337
|
+
|
|
1338
|
+
const $e = "\n";
|
|
1339
|
+
|
|
1340
|
+
function Fe(e, t) {
|
|
1341
|
+
let n = "";
|
|
1506
1342
|
if (t.format && t.indentBy.length > 0) {
|
|
1507
|
-
|
|
1343
|
+
n = $e;
|
|
1508
1344
|
}
|
|
1509
|
-
return
|
|
1345
|
+
return _e(e, t, "", n);
|
|
1510
1346
|
}
|
|
1511
1347
|
|
|
1512
|
-
function
|
|
1348
|
+
function _e(e, t, n, i) {
|
|
1513
1349
|
let s = "";
|
|
1514
1350
|
let r = false;
|
|
1515
1351
|
for (let o = 0; o < e.length; o++) {
|
|
1516
1352
|
const a = e[o];
|
|
1517
|
-
const l =
|
|
1353
|
+
const l = De(a);
|
|
1518
1354
|
if (l === undefined) continue;
|
|
1519
1355
|
let u = "";
|
|
1520
|
-
if (
|
|
1356
|
+
if (n.length === 0) u = l; else u = `${n}.${l}`;
|
|
1521
1357
|
if (l === t.textNodeName) {
|
|
1522
1358
|
let e = a[l];
|
|
1523
|
-
if (!
|
|
1359
|
+
if (!Me(u, t)) {
|
|
1524
1360
|
e = t.tagValueProcessor(l, e);
|
|
1525
|
-
e =
|
|
1361
|
+
e = Be(e, t);
|
|
1526
1362
|
}
|
|
1527
1363
|
if (r) {
|
|
1528
|
-
s +=
|
|
1364
|
+
s += i;
|
|
1529
1365
|
}
|
|
1530
1366
|
s += e;
|
|
1531
1367
|
r = false;
|
|
1532
1368
|
continue;
|
|
1533
1369
|
} else if (l === t.cdataPropName) {
|
|
1534
1370
|
if (r) {
|
|
1535
|
-
s +=
|
|
1371
|
+
s += i;
|
|
1536
1372
|
}
|
|
1537
1373
|
s += `<![CDATA[${a[l][0][t.textNodeName]}]]>`;
|
|
1538
1374
|
r = false;
|
|
1539
1375
|
continue;
|
|
1540
1376
|
} else if (l === t.commentPropName) {
|
|
1541
|
-
s +=
|
|
1377
|
+
s += i + `\x3c!--${a[l][0][t.textNodeName]}--\x3e`;
|
|
1542
1378
|
r = true;
|
|
1543
1379
|
continue;
|
|
1544
1380
|
} else if (l[0] === "?") {
|
|
1545
|
-
const e =
|
|
1546
|
-
const
|
|
1381
|
+
const e = Le(a[":@"], t);
|
|
1382
|
+
const n = l === "?xml" ? "" : i;
|
|
1547
1383
|
let o = a[l][0][t.textNodeName];
|
|
1548
1384
|
o = o.length !== 0 ? " " + o : "";
|
|
1549
|
-
s +=
|
|
1385
|
+
s += n + `<${l}${o}${e}?>`;
|
|
1550
1386
|
r = true;
|
|
1551
1387
|
continue;
|
|
1552
1388
|
}
|
|
1553
|
-
let f =
|
|
1389
|
+
let f = i;
|
|
1554
1390
|
if (f !== "") {
|
|
1555
1391
|
f += t.indentBy;
|
|
1556
1392
|
}
|
|
1557
|
-
const
|
|
1558
|
-
const h =
|
|
1559
|
-
const
|
|
1393
|
+
const c = Le(a[":@"], t);
|
|
1394
|
+
const h = i + `<${l}${c}`;
|
|
1395
|
+
const d = _e(a[l], t, u, f);
|
|
1560
1396
|
if (t.unpairedTags.indexOf(l) !== -1) {
|
|
1561
1397
|
if (t.suppressUnpairedNode) s += h + ">"; else s += h + "/>";
|
|
1562
|
-
} else if ((!
|
|
1398
|
+
} else if ((!d || d.length === 0) && t.suppressEmptyNode) {
|
|
1563
1399
|
s += h + "/>";
|
|
1564
|
-
} else if (
|
|
1565
|
-
s += h + `>${
|
|
1400
|
+
} else if (d && d.endsWith(">")) {
|
|
1401
|
+
s += h + `>${d}${i}</${l}>`;
|
|
1566
1402
|
} else {
|
|
1567
1403
|
s += h + ">";
|
|
1568
|
-
if (
|
|
1569
|
-
s +=
|
|
1404
|
+
if (d && i !== "" && (d.includes("/>") || d.includes("</"))) {
|
|
1405
|
+
s += i + t.indentBy + d + i;
|
|
1570
1406
|
} else {
|
|
1571
|
-
s +=
|
|
1407
|
+
s += d;
|
|
1572
1408
|
}
|
|
1573
1409
|
s += `</${l}>`;
|
|
1574
1410
|
}
|
|
@@ -1577,54 +1413,62 @@ function de(e, t, i, n) {
|
|
|
1577
1413
|
return s;
|
|
1578
1414
|
}
|
|
1579
1415
|
|
|
1580
|
-
function
|
|
1416
|
+
function De(e) {
|
|
1581
1417
|
const t = Object.keys(e);
|
|
1582
|
-
for (let
|
|
1583
|
-
const
|
|
1584
|
-
if (!e.hasOwnProperty(
|
|
1585
|
-
if (
|
|
1418
|
+
for (let n = 0; n < t.length; n++) {
|
|
1419
|
+
const i = t[n];
|
|
1420
|
+
if (!e.hasOwnProperty(i)) continue;
|
|
1421
|
+
if (i !== ":@") return i;
|
|
1586
1422
|
}
|
|
1587
1423
|
}
|
|
1588
1424
|
|
|
1589
|
-
function
|
|
1590
|
-
let
|
|
1425
|
+
function Le(e, t) {
|
|
1426
|
+
let n = "";
|
|
1591
1427
|
if (e && !t.ignoreAttributes) {
|
|
1592
|
-
for (let
|
|
1593
|
-
if (!e.hasOwnProperty(
|
|
1594
|
-
let s = t.attributeValueProcessor(
|
|
1595
|
-
s =
|
|
1428
|
+
for (let i in e) {
|
|
1429
|
+
if (!e.hasOwnProperty(i)) continue;
|
|
1430
|
+
let s = t.attributeValueProcessor(i, e[i]);
|
|
1431
|
+
s = Be(s, t);
|
|
1596
1432
|
if (s === true && t.suppressBooleanAttributes) {
|
|
1597
|
-
|
|
1433
|
+
n += ` ${i.substr(t.attributeNamePrefix.length)}`;
|
|
1598
1434
|
} else {
|
|
1599
|
-
|
|
1435
|
+
n += ` ${i.substr(t.attributeNamePrefix.length)}="${s}"`;
|
|
1600
1436
|
}
|
|
1601
1437
|
}
|
|
1602
1438
|
}
|
|
1603
|
-
return
|
|
1439
|
+
return n;
|
|
1604
1440
|
}
|
|
1605
1441
|
|
|
1606
|
-
function
|
|
1442
|
+
function Me(e, t) {
|
|
1607
1443
|
e = e.substr(0, e.length - t.textNodeName.length - 1);
|
|
1608
|
-
let
|
|
1609
|
-
for (let
|
|
1610
|
-
if (t.stopNodes[
|
|
1444
|
+
let n = e.substr(e.lastIndexOf(".") + 1);
|
|
1445
|
+
for (let i in t.stopNodes) {
|
|
1446
|
+
if (t.stopNodes[i] === e || t.stopNodes[i] === "*." + n) return true;
|
|
1611
1447
|
}
|
|
1612
1448
|
return false;
|
|
1613
1449
|
}
|
|
1614
1450
|
|
|
1615
|
-
function
|
|
1451
|
+
function Be(e, t) {
|
|
1616
1452
|
if (e && e.length > 0 && t.processEntities) {
|
|
1617
|
-
for (let
|
|
1618
|
-
const
|
|
1619
|
-
e = e.replace(
|
|
1453
|
+
for (let n = 0; n < t.entities.length; n++) {
|
|
1454
|
+
const i = t.entities[n];
|
|
1455
|
+
e = e.replace(i.regex, i.val);
|
|
1620
1456
|
}
|
|
1621
1457
|
}
|
|
1622
1458
|
return e;
|
|
1623
1459
|
}
|
|
1624
1460
|
|
|
1461
|
+
var Xe = Fe;
|
|
1462
|
+
|
|
1463
|
+
const Ge = e(Xe);
|
|
1464
|
+
|
|
1625
1465
|
"use strict";
|
|
1626
1466
|
|
|
1627
|
-
const
|
|
1467
|
+
const Re = Xe;
|
|
1468
|
+
|
|
1469
|
+
const Ue = z;
|
|
1470
|
+
|
|
1471
|
+
const Ze = {
|
|
1628
1472
|
attributeNamePrefix: "@_",
|
|
1629
1473
|
attributesGroupName: false,
|
|
1630
1474
|
textNodeName: "#text",
|
|
@@ -1665,20 +1509,20 @@ const me = {
|
|
|
1665
1509
|
oneListGroup: false
|
|
1666
1510
|
};
|
|
1667
1511
|
|
|
1668
|
-
function
|
|
1669
|
-
this.options = Object.assign({},
|
|
1512
|
+
function Ye(e) {
|
|
1513
|
+
this.options = Object.assign({}, Ze, e);
|
|
1670
1514
|
if (this.options.ignoreAttributes === true || this.options.attributesGroupName) {
|
|
1671
1515
|
this.isAttribute = function() {
|
|
1672
1516
|
return false;
|
|
1673
1517
|
};
|
|
1674
1518
|
} else {
|
|
1675
|
-
this.ignoreAttributesFn =
|
|
1519
|
+
this.ignoreAttributesFn = Ue(this.options.ignoreAttributes);
|
|
1676
1520
|
this.attrPrefixLen = this.options.attributeNamePrefix.length;
|
|
1677
|
-
this.isAttribute =
|
|
1521
|
+
this.isAttribute = Je;
|
|
1678
1522
|
}
|
|
1679
|
-
this.processTextOrObjNode =
|
|
1523
|
+
this.processTextOrObjNode = qe;
|
|
1680
1524
|
if (this.options.format) {
|
|
1681
|
-
this.indentate =
|
|
1525
|
+
this.indentate = ze;
|
|
1682
1526
|
this.tagEndChar = ">\n";
|
|
1683
1527
|
this.newLine = "\n";
|
|
1684
1528
|
} else {
|
|
@@ -1690,9 +1534,9 @@ function xe(e) {
|
|
|
1690
1534
|
}
|
|
1691
1535
|
}
|
|
1692
1536
|
|
|
1693
|
-
|
|
1537
|
+
Ye.prototype.build = function(e) {
|
|
1694
1538
|
if (this.options.preserveOrder) {
|
|
1695
|
-
return
|
|
1539
|
+
return Re(e, this.options);
|
|
1696
1540
|
} else {
|
|
1697
1541
|
if (Array.isArray(e) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1) {
|
|
1698
1542
|
e = {
|
|
@@ -1703,10 +1547,10 @@ xe.prototype.build = function(e) {
|
|
|
1703
1547
|
}
|
|
1704
1548
|
};
|
|
1705
1549
|
|
|
1706
|
-
|
|
1707
|
-
let
|
|
1550
|
+
Ye.prototype.j2x = function(e, t, n) {
|
|
1551
|
+
let i = "";
|
|
1708
1552
|
let s = "";
|
|
1709
|
-
const r =
|
|
1553
|
+
const r = n.join(".");
|
|
1710
1554
|
for (let o in e) {
|
|
1711
1555
|
if (!Object.prototype.hasOwnProperty.call(e, o)) continue;
|
|
1712
1556
|
if (typeof e[o] === "undefined") {
|
|
@@ -1726,10 +1570,10 @@ xe.prototype.j2x = function(e, t, i) {
|
|
|
1726
1570
|
} else if (e[o] instanceof Date) {
|
|
1727
1571
|
s += this.buildTextValNode(e[o], o, "", t);
|
|
1728
1572
|
} else if (typeof e[o] !== "object") {
|
|
1729
|
-
const
|
|
1730
|
-
if (
|
|
1731
|
-
|
|
1732
|
-
} else if (!
|
|
1573
|
+
const n = this.isAttribute(o);
|
|
1574
|
+
if (n && !this.ignoreAttributesFn(n, r)) {
|
|
1575
|
+
i += this.buildAttrPairStr(n, "" + e[o]);
|
|
1576
|
+
} else if (!n) {
|
|
1733
1577
|
if (o === this.options.textNodeName) {
|
|
1734
1578
|
let t = this.options.tagValueProcessor(o, "" + e[o]);
|
|
1735
1579
|
s += this.replaceEntitiesValue(t);
|
|
@@ -1738,30 +1582,30 @@ xe.prototype.j2x = function(e, t, i) {
|
|
|
1738
1582
|
}
|
|
1739
1583
|
}
|
|
1740
1584
|
} else if (Array.isArray(e[o])) {
|
|
1741
|
-
const
|
|
1585
|
+
const i = e[o].length;
|
|
1742
1586
|
let r = "";
|
|
1743
1587
|
let a = "";
|
|
1744
|
-
for (let l = 0; l <
|
|
1745
|
-
const
|
|
1746
|
-
if (typeof
|
|
1588
|
+
for (let l = 0; l < i; l++) {
|
|
1589
|
+
const i = e[o][l];
|
|
1590
|
+
if (typeof i === "undefined") {} else if (i === null) {
|
|
1747
1591
|
if (o[0] === "?") s += this.indentate(t) + "<" + o + "?" + this.tagEndChar; else s += this.indentate(t) + "<" + o + "/" + this.tagEndChar;
|
|
1748
|
-
} else if (typeof
|
|
1592
|
+
} else if (typeof i === "object") {
|
|
1749
1593
|
if (this.options.oneListGroup) {
|
|
1750
|
-
const e = this.j2x(
|
|
1594
|
+
const e = this.j2x(i, t + 1, n.concat(o));
|
|
1751
1595
|
r += e.val;
|
|
1752
|
-
if (this.options.attributesGroupName &&
|
|
1596
|
+
if (this.options.attributesGroupName && i.hasOwnProperty(this.options.attributesGroupName)) {
|
|
1753
1597
|
a += e.attrStr;
|
|
1754
1598
|
}
|
|
1755
1599
|
} else {
|
|
1756
|
-
r += this.processTextOrObjNode(
|
|
1600
|
+
r += this.processTextOrObjNode(i, o, t, n);
|
|
1757
1601
|
}
|
|
1758
1602
|
} else {
|
|
1759
1603
|
if (this.options.oneListGroup) {
|
|
1760
|
-
let e = this.options.tagValueProcessor(o,
|
|
1604
|
+
let e = this.options.tagValueProcessor(o, i);
|
|
1761
1605
|
e = this.replaceEntitiesValue(e);
|
|
1762
1606
|
r += e;
|
|
1763
1607
|
} else {
|
|
1764
|
-
r += this.buildTextValNode(
|
|
1608
|
+
r += this.buildTextValNode(i, o, "", t);
|
|
1765
1609
|
}
|
|
1766
1610
|
}
|
|
1767
1611
|
}
|
|
@@ -1772,22 +1616,22 @@ xe.prototype.j2x = function(e, t, i) {
|
|
|
1772
1616
|
} else {
|
|
1773
1617
|
if (this.options.attributesGroupName && o === this.options.attributesGroupName) {
|
|
1774
1618
|
const t = Object.keys(e[o]);
|
|
1775
|
-
const
|
|
1776
|
-
for (let s = 0; s <
|
|
1777
|
-
|
|
1619
|
+
const n = t.length;
|
|
1620
|
+
for (let s = 0; s < n; s++) {
|
|
1621
|
+
i += this.buildAttrPairStr(t[s], "" + e[o][t[s]]);
|
|
1778
1622
|
}
|
|
1779
1623
|
} else {
|
|
1780
|
-
s += this.processTextOrObjNode(e[o], o, t,
|
|
1624
|
+
s += this.processTextOrObjNode(e[o], o, t, n);
|
|
1781
1625
|
}
|
|
1782
1626
|
}
|
|
1783
1627
|
}
|
|
1784
1628
|
return {
|
|
1785
|
-
attrStr:
|
|
1629
|
+
attrStr: i,
|
|
1786
1630
|
val: s
|
|
1787
1631
|
};
|
|
1788
1632
|
};
|
|
1789
1633
|
|
|
1790
|
-
|
|
1634
|
+
Ye.prototype.buildAttrPairStr = function(e, t) {
|
|
1791
1635
|
t = this.options.attributeValueProcessor(e, "" + t);
|
|
1792
1636
|
t = this.replaceEntitiesValue(t);
|
|
1793
1637
|
if (this.options.suppressBooleanAttributes && t === "true") {
|
|
@@ -1795,19 +1639,19 @@ xe.prototype.buildAttrPairStr = function(e, t) {
|
|
|
1795
1639
|
} else return " " + e + '="' + t + '"';
|
|
1796
1640
|
};
|
|
1797
1641
|
|
|
1798
|
-
function
|
|
1799
|
-
const s = this.j2x(e,
|
|
1642
|
+
function qe(e, t, n, i) {
|
|
1643
|
+
const s = this.j2x(e, n + 1, i.concat(t));
|
|
1800
1644
|
if (e[this.options.textNodeName] !== undefined && Object.keys(e).length === 1) {
|
|
1801
|
-
return this.buildTextValNode(e[this.options.textNodeName], t, s.attrStr,
|
|
1645
|
+
return this.buildTextValNode(e[this.options.textNodeName], t, s.attrStr, n);
|
|
1802
1646
|
} else {
|
|
1803
|
-
return this.buildObjectNode(s.val, t, s.attrStr,
|
|
1647
|
+
return this.buildObjectNode(s.val, t, s.attrStr, n);
|
|
1804
1648
|
}
|
|
1805
1649
|
}
|
|
1806
1650
|
|
|
1807
|
-
|
|
1651
|
+
Ye.prototype.buildObjectNode = function(e, t, n, i) {
|
|
1808
1652
|
if (e === "") {
|
|
1809
|
-
if (t[0] === "?") return this.indentate(
|
|
1810
|
-
return this.indentate(
|
|
1653
|
+
if (t[0] === "?") return this.indentate(i) + "<" + t + n + "?" + this.tagEndChar; else {
|
|
1654
|
+
return this.indentate(i) + "<" + t + n + this.closeTag(t) + this.tagEndChar;
|
|
1811
1655
|
}
|
|
1812
1656
|
} else {
|
|
1813
1657
|
let s = "</" + t + this.tagEndChar;
|
|
@@ -1816,17 +1660,17 @@ xe.prototype.buildObjectNode = function(e, t, i, n) {
|
|
|
1816
1660
|
r = "?";
|
|
1817
1661
|
s = "";
|
|
1818
1662
|
}
|
|
1819
|
-
if ((
|
|
1820
|
-
return this.indentate(
|
|
1663
|
+
if ((n || n === "") && e.indexOf("<") === -1) {
|
|
1664
|
+
return this.indentate(i) + "<" + t + n + r + ">" + e + s;
|
|
1821
1665
|
} else if (this.options.commentPropName !== false && t === this.options.commentPropName && r.length === 0) {
|
|
1822
|
-
return this.indentate(
|
|
1666
|
+
return this.indentate(i) + `\x3c!--${e}--\x3e` + this.newLine;
|
|
1823
1667
|
} else {
|
|
1824
|
-
return this.indentate(
|
|
1668
|
+
return this.indentate(i) + "<" + t + n + r + this.tagEndChar + e + this.indentate(i) + s;
|
|
1825
1669
|
}
|
|
1826
1670
|
}
|
|
1827
1671
|
};
|
|
1828
1672
|
|
|
1829
|
-
|
|
1673
|
+
Ye.prototype.closeTag = function(e) {
|
|
1830
1674
|
let t = "";
|
|
1831
1675
|
if (this.options.unpairedTags.indexOf(e) !== -1) {
|
|
1832
1676
|
if (!this.options.suppressUnpairedNode) t = "/";
|
|
@@ -1838,49 +1682,49 @@ xe.prototype.closeTag = function(e) {
|
|
|
1838
1682
|
return t;
|
|
1839
1683
|
};
|
|
1840
1684
|
|
|
1841
|
-
function
|
|
1685
|
+
function We(e, t, n, i) {
|
|
1842
1686
|
if (e !== "") {
|
|
1843
|
-
return this.buildObjectNode(e, t,
|
|
1687
|
+
return this.buildObjectNode(e, t, n, i);
|
|
1844
1688
|
} else {
|
|
1845
|
-
if (t[0] === "?") return this.indentate(
|
|
1846
|
-
return this.indentate(
|
|
1689
|
+
if (t[0] === "?") return this.indentate(i) + "<" + t + n + "?" + this.tagEndChar; else {
|
|
1690
|
+
return this.indentate(i) + "<" + t + n + "/" + this.tagEndChar;
|
|
1847
1691
|
}
|
|
1848
1692
|
}
|
|
1849
1693
|
}
|
|
1850
1694
|
|
|
1851
|
-
|
|
1695
|
+
Ye.prototype.buildTextValNode = function(e, t, n, i) {
|
|
1852
1696
|
if (this.options.cdataPropName !== false && t === this.options.cdataPropName) {
|
|
1853
|
-
return this.indentate(
|
|
1697
|
+
return this.indentate(i) + `<![CDATA[${e}]]>` + this.newLine;
|
|
1854
1698
|
} else if (this.options.commentPropName !== false && t === this.options.commentPropName) {
|
|
1855
|
-
return this.indentate(
|
|
1699
|
+
return this.indentate(i) + `\x3c!--${e}--\x3e` + this.newLine;
|
|
1856
1700
|
} else if (t[0] === "?") {
|
|
1857
|
-
return this.indentate(
|
|
1701
|
+
return this.indentate(i) + "<" + t + n + "?" + this.tagEndChar;
|
|
1858
1702
|
} else {
|
|
1859
1703
|
let s = this.options.tagValueProcessor(t, e);
|
|
1860
1704
|
s = this.replaceEntitiesValue(s);
|
|
1861
1705
|
if (s === "") {
|
|
1862
|
-
return this.indentate(
|
|
1706
|
+
return this.indentate(i) + "<" + t + n + this.closeTag(t) + this.tagEndChar;
|
|
1863
1707
|
} else {
|
|
1864
|
-
return this.indentate(
|
|
1708
|
+
return this.indentate(i) + "<" + t + n + ">" + s + "</" + t + this.tagEndChar;
|
|
1865
1709
|
}
|
|
1866
1710
|
}
|
|
1867
1711
|
};
|
|
1868
1712
|
|
|
1869
|
-
|
|
1713
|
+
Ye.prototype.replaceEntitiesValue = function(e) {
|
|
1870
1714
|
if (e && e.length > 0 && this.options.processEntities) {
|
|
1871
1715
|
for (let t = 0; t < this.options.entities.length; t++) {
|
|
1872
|
-
const
|
|
1873
|
-
e = e.replace(
|
|
1716
|
+
const n = this.options.entities[t];
|
|
1717
|
+
e = e.replace(n.regex, n.val);
|
|
1874
1718
|
}
|
|
1875
1719
|
}
|
|
1876
1720
|
return e;
|
|
1877
1721
|
};
|
|
1878
1722
|
|
|
1879
|
-
function
|
|
1723
|
+
function ze(e) {
|
|
1880
1724
|
return this.options.indentBy.repeat(e);
|
|
1881
1725
|
}
|
|
1882
1726
|
|
|
1883
|
-
function
|
|
1727
|
+
function Je(e) {
|
|
1884
1728
|
if (e.startsWith(this.options.attributeNamePrefix) && e !== this.options.textNodeName) {
|
|
1885
1729
|
return e.substr(this.attrPrefixLen);
|
|
1886
1730
|
} else {
|
|
@@ -1888,15 +1732,29 @@ function we(e) {
|
|
|
1888
1732
|
}
|
|
1889
1733
|
}
|
|
1890
1734
|
|
|
1735
|
+
var He = Ye;
|
|
1736
|
+
|
|
1737
|
+
const Ke = e(He);
|
|
1738
|
+
|
|
1891
1739
|
"use strict";
|
|
1892
1740
|
|
|
1893
|
-
const
|
|
1894
|
-
|
|
1741
|
+
const Qe = t;
|
|
1742
|
+
|
|
1743
|
+
const et = je;
|
|
1744
|
+
|
|
1745
|
+
const tt = He;
|
|
1746
|
+
|
|
1747
|
+
var nt = {
|
|
1748
|
+
XMLParser: et,
|
|
1749
|
+
XMLValidator: Qe,
|
|
1750
|
+
XMLBuilder: tt
|
|
1895
1751
|
};
|
|
1896
1752
|
|
|
1897
|
-
|
|
1753
|
+
const it = e(nt);
|
|
1754
|
+
|
|
1755
|
+
function st(e) {
|
|
1898
1756
|
try {
|
|
1899
|
-
|
|
1757
|
+
nt.XMLValidator.validate(e, {
|
|
1900
1758
|
allowBooleanAttributes: true
|
|
1901
1759
|
});
|
|
1902
1760
|
return true;
|
|
@@ -1905,4 +1763,4 @@ function ye(e) {
|
|
|
1905
1763
|
}
|
|
1906
1764
|
}
|
|
1907
1765
|
|
|
1908
|
-
export {
|
|
1766
|
+
export { st as IsXML };
|