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