@opentrainticketing/netex-deckplan-editor 1.0.9 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/netex-deckplan-editor-vue.es.js +2189 -1399
- package/dist/netex-deckplan-editor.es.js +4618 -3828
- package/dist/netex-deckplan-editor.umd.js +19 -19
- package/package.json +4 -4
|
@@ -1,256 +1,267 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
const
|
|
5
|
-
let
|
|
6
|
-
for (;
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
for (let
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { defineComponent as rt, ref as W, computed as ct, resolveComponent as lt, openBlock as b, createBlock as nt, withCtx as yt, createVNode as Y, createElementBlock as x, Fragment as K, renderList as Z, createCommentVNode as vt, createElementVNode as w, toDisplayString as D, withDirectives as bt, vModelText as Gt, normalizeClass as st, vModelDynamic as de, vModelCheckbox as fe, watch as zt, nextTick as pe, reactive as It, mergeProps as ge, withModifiers as wt } from "vue";
|
|
2
|
+
const Ht = ":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", me = Ht + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040", ye = "[" + Ht + "][" + me + "]*", be = new RegExp("^" + ye + "$");
|
|
3
|
+
function Yt(n, t) {
|
|
4
|
+
const e = [];
|
|
5
|
+
let s = t.exec(n);
|
|
6
|
+
for (; s; ) {
|
|
7
|
+
const r = [];
|
|
8
|
+
r.startIndex = t.lastIndex - s[0].length;
|
|
9
|
+
const i = s.length;
|
|
10
|
+
for (let l = 0; l < i; l++)
|
|
11
|
+
r.push(s[l]);
|
|
12
|
+
e.push(r), s = t.exec(n);
|
|
13
13
|
}
|
|
14
|
-
return
|
|
14
|
+
return e;
|
|
15
15
|
}
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
return !(
|
|
16
|
+
const Nt = function(n) {
|
|
17
|
+
const t = be.exec(n);
|
|
18
|
+
return !(t === null || typeof t > "u");
|
|
19
19
|
};
|
|
20
|
-
function
|
|
21
|
-
return typeof
|
|
22
|
-
}
|
|
23
|
-
const
|
|
20
|
+
function ve(n) {
|
|
21
|
+
return typeof n < "u";
|
|
22
|
+
}
|
|
23
|
+
const Pt = [
|
|
24
|
+
// '__proto__',
|
|
25
|
+
// 'constructor',
|
|
26
|
+
// 'prototype',
|
|
27
|
+
"hasOwnProperty",
|
|
28
|
+
"toString",
|
|
29
|
+
"valueOf",
|
|
30
|
+
"__defineGetter__",
|
|
31
|
+
"__defineSetter__",
|
|
32
|
+
"__lookupGetter__",
|
|
33
|
+
"__lookupSetter__"
|
|
34
|
+
], Kt = ["__proto__", "constructor", "prototype"], Ee = {
|
|
24
35
|
allowBooleanAttributes: !1,
|
|
25
36
|
//A tag can have attributes without any value
|
|
26
37
|
unpairedTags: []
|
|
27
38
|
};
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
let
|
|
32
|
-
|
|
33
|
-
for (let
|
|
34
|
-
if (
|
|
35
|
-
if (
|
|
36
|
-
} else if (
|
|
37
|
-
let
|
|
38
|
-
if (
|
|
39
|
-
|
|
39
|
+
function Ne(n, t) {
|
|
40
|
+
t = Object.assign({}, Ee, t);
|
|
41
|
+
const e = [];
|
|
42
|
+
let s = !1, r = !1;
|
|
43
|
+
n[0] === "\uFEFF" && (n = n.substr(1));
|
|
44
|
+
for (let i = 0; i < n.length; i++)
|
|
45
|
+
if (n[i] === "<" && n[i + 1] === "?") {
|
|
46
|
+
if (i += 2, i = Rt(n, i), i.err) return i;
|
|
47
|
+
} else if (n[i] === "<") {
|
|
48
|
+
let l = i;
|
|
49
|
+
if (i++, n[i] === "!") {
|
|
50
|
+
i = Ft(n, i);
|
|
40
51
|
continue;
|
|
41
52
|
} else {
|
|
42
|
-
let
|
|
43
|
-
|
|
53
|
+
let o = !1;
|
|
54
|
+
n[i] === "/" && (o = !0, i++);
|
|
44
55
|
let a = "";
|
|
45
|
-
for (;
|
|
46
|
-
` &&
|
|
47
|
-
a +=
|
|
48
|
-
if (a = a.trim(), a[a.length - 1] === "/" && (a = a.substring(0, a.length - 1),
|
|
56
|
+
for (; i < n.length && n[i] !== ">" && n[i] !== " " && n[i] !== " " && n[i] !== `
|
|
57
|
+
` && n[i] !== "\r"; i++)
|
|
58
|
+
a += n[i];
|
|
59
|
+
if (a = a.trim(), a[a.length - 1] === "/" && (a = a.substring(0, a.length - 1), i--), !Te(a)) {
|
|
49
60
|
let d;
|
|
50
|
-
return a.trim().length === 0 ? d = "Invalid space after '<'." : d = "Tag '" + a + "' is an invalid name.", T("InvalidTag", d,
|
|
61
|
+
return a.trim().length === 0 ? d = "Invalid space after '<'." : d = "Tag '" + a + "' is an invalid name.", T("InvalidTag", d, V(n, i));
|
|
51
62
|
}
|
|
52
|
-
const
|
|
53
|
-
if (
|
|
54
|
-
return T("InvalidAttr", "Attributes for '" + a + "' have open quote.",
|
|
55
|
-
let h =
|
|
56
|
-
if (
|
|
57
|
-
const d =
|
|
63
|
+
const c = xe(n, i);
|
|
64
|
+
if (c === !1)
|
|
65
|
+
return T("InvalidAttr", "Attributes for '" + a + "' have open quote.", V(n, i));
|
|
66
|
+
let h = c.value;
|
|
67
|
+
if (i = c.index, h[h.length - 1] === "/") {
|
|
68
|
+
const d = i - h.length;
|
|
58
69
|
h = h.substring(0, h.length - 1);
|
|
59
|
-
const f =
|
|
70
|
+
const f = Wt(h, t);
|
|
60
71
|
if (f === !0)
|
|
61
|
-
|
|
72
|
+
s = !0;
|
|
62
73
|
else
|
|
63
|
-
return T(f.err.code, f.err.msg,
|
|
64
|
-
} else if (
|
|
65
|
-
if (
|
|
74
|
+
return T(f.err.code, f.err.msg, V(n, d + f.err.line));
|
|
75
|
+
} else if (o)
|
|
76
|
+
if (c.tagClosed) {
|
|
66
77
|
if (h.trim().length > 0)
|
|
67
|
-
return T("InvalidTag", "Closing tag '" + a + "' can't have attributes or invalid starting.",
|
|
68
|
-
if (
|
|
69
|
-
return T("InvalidTag", "Closing tag '" + a + "' has not been opened.",
|
|
78
|
+
return T("InvalidTag", "Closing tag '" + a + "' can't have attributes or invalid starting.", V(n, l));
|
|
79
|
+
if (e.length === 0)
|
|
80
|
+
return T("InvalidTag", "Closing tag '" + a + "' has not been opened.", V(n, l));
|
|
70
81
|
{
|
|
71
|
-
const d =
|
|
82
|
+
const d = e.pop();
|
|
72
83
|
if (a !== d.tagName) {
|
|
73
|
-
let f =
|
|
84
|
+
let f = V(n, d.tagStartPos);
|
|
74
85
|
return T(
|
|
75
86
|
"InvalidTag",
|
|
76
87
|
"Expected closing tag '" + d.tagName + "' (opened in line " + f.line + ", col " + f.col + ") instead of closing tag '" + a + "'.",
|
|
77
|
-
|
|
88
|
+
V(n, l)
|
|
78
89
|
);
|
|
79
90
|
}
|
|
80
|
-
|
|
91
|
+
e.length == 0 && (r = !0);
|
|
81
92
|
}
|
|
82
|
-
} else return T("InvalidTag", "Closing tag '" + a + "' doesn't have proper closing.",
|
|
93
|
+
} else return T("InvalidTag", "Closing tag '" + a + "' doesn't have proper closing.", V(n, i));
|
|
83
94
|
else {
|
|
84
|
-
const d =
|
|
95
|
+
const d = Wt(h, t);
|
|
85
96
|
if (d !== !0)
|
|
86
|
-
return T(d.err.code, d.err.msg,
|
|
87
|
-
if (
|
|
88
|
-
return T("InvalidXml", "Multiple possible root nodes found.",
|
|
89
|
-
|
|
97
|
+
return T(d.err.code, d.err.msg, V(n, i - h.length + d.err.line));
|
|
98
|
+
if (r === !0)
|
|
99
|
+
return T("InvalidXml", "Multiple possible root nodes found.", V(n, i));
|
|
100
|
+
t.unpairedTags.indexOf(a) !== -1 || e.push({ tagName: a, tagStartPos: l }), s = !0;
|
|
90
101
|
}
|
|
91
|
-
for (
|
|
92
|
-
if (
|
|
93
|
-
if (
|
|
94
|
-
|
|
102
|
+
for (i++; i < n.length; i++)
|
|
103
|
+
if (n[i] === "<")
|
|
104
|
+
if (n[i + 1] === "!") {
|
|
105
|
+
i++, i = Ft(n, i);
|
|
95
106
|
continue;
|
|
96
|
-
} else if (
|
|
97
|
-
if (
|
|
107
|
+
} else if (n[i + 1] === "?") {
|
|
108
|
+
if (i = Rt(n, ++i), i.err) return i;
|
|
98
109
|
} else
|
|
99
110
|
break;
|
|
100
|
-
else if (
|
|
101
|
-
const d =
|
|
111
|
+
else if (n[i] === "&") {
|
|
112
|
+
const d = _e(n, i);
|
|
102
113
|
if (d == -1)
|
|
103
|
-
return T("InvalidChar", "char '&' is not expected.",
|
|
104
|
-
|
|
105
|
-
} else if (
|
|
106
|
-
return T("InvalidXml", "Extra text at the end",
|
|
107
|
-
|
|
114
|
+
return T("InvalidChar", "char '&' is not expected.", V(n, i));
|
|
115
|
+
i = d;
|
|
116
|
+
} else if (r === !0 && !Vt(n[i]))
|
|
117
|
+
return T("InvalidXml", "Extra text at the end", V(n, i));
|
|
118
|
+
n[i] === "<" && i--;
|
|
108
119
|
}
|
|
109
120
|
} else {
|
|
110
|
-
if (
|
|
121
|
+
if (Vt(n[i]))
|
|
111
122
|
continue;
|
|
112
|
-
return T("InvalidChar", "char '" +
|
|
123
|
+
return T("InvalidChar", "char '" + n[i] + "' is not expected.", V(n, i));
|
|
113
124
|
}
|
|
114
|
-
if (
|
|
115
|
-
if (
|
|
116
|
-
return T("InvalidTag", "Unclosed tag '" +
|
|
117
|
-
if (
|
|
118
|
-
return T("InvalidXml", "Invalid '" + JSON.stringify(
|
|
125
|
+
if (s) {
|
|
126
|
+
if (e.length == 1)
|
|
127
|
+
return T("InvalidTag", "Unclosed tag '" + e[0].tagName + "'.", V(n, e[0].tagStartPos));
|
|
128
|
+
if (e.length > 0)
|
|
129
|
+
return T("InvalidXml", "Invalid '" + JSON.stringify(e.map((i) => i.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 });
|
|
119
130
|
} else return T("InvalidXml", "Start tag expected.", 1);
|
|
120
131
|
return !0;
|
|
121
132
|
}
|
|
122
|
-
function
|
|
123
|
-
return
|
|
124
|
-
` ||
|
|
125
|
-
}
|
|
126
|
-
function
|
|
127
|
-
const
|
|
128
|
-
for (;
|
|
129
|
-
if (t
|
|
130
|
-
const
|
|
131
|
-
if (
|
|
132
|
-
return T("InvalidXml", "XML declaration allowed only at the start of the document.",
|
|
133
|
-
if (t
|
|
134
|
-
|
|
133
|
+
function Vt(n) {
|
|
134
|
+
return n === " " || n === " " || n === `
|
|
135
|
+
` || n === "\r";
|
|
136
|
+
}
|
|
137
|
+
function Rt(n, t) {
|
|
138
|
+
const e = t;
|
|
139
|
+
for (; t < n.length; t++)
|
|
140
|
+
if (n[t] == "?" || n[t] == " ") {
|
|
141
|
+
const s = n.substr(e, t - e);
|
|
142
|
+
if (t > 5 && s === "xml")
|
|
143
|
+
return T("InvalidXml", "XML declaration allowed only at the start of the document.", V(n, t));
|
|
144
|
+
if (n[t] == "?" && n[t + 1] == ">") {
|
|
145
|
+
t++;
|
|
135
146
|
break;
|
|
136
147
|
} else
|
|
137
148
|
continue;
|
|
138
149
|
}
|
|
139
|
-
return
|
|
150
|
+
return t;
|
|
140
151
|
}
|
|
141
|
-
function
|
|
142
|
-
if (
|
|
143
|
-
for (
|
|
144
|
-
if (t
|
|
145
|
-
|
|
152
|
+
function Ft(n, t) {
|
|
153
|
+
if (n.length > t + 5 && n[t + 1] === "-" && n[t + 2] === "-") {
|
|
154
|
+
for (t += 3; t < n.length; t++)
|
|
155
|
+
if (n[t] === "-" && n[t + 1] === "-" && n[t + 2] === ">") {
|
|
156
|
+
t += 2;
|
|
146
157
|
break;
|
|
147
158
|
}
|
|
148
|
-
} else if (
|
|
149
|
-
let
|
|
150
|
-
for (
|
|
151
|
-
if (t
|
|
152
|
-
|
|
153
|
-
else if (t
|
|
159
|
+
} else if (n.length > t + 8 && n[t + 1] === "D" && n[t + 2] === "O" && n[t + 3] === "C" && n[t + 4] === "T" && n[t + 5] === "Y" && n[t + 6] === "P" && n[t + 7] === "E") {
|
|
160
|
+
let e = 1;
|
|
161
|
+
for (t += 8; t < n.length; t++)
|
|
162
|
+
if (n[t] === "<")
|
|
163
|
+
e++;
|
|
164
|
+
else if (n[t] === ">" && (e--, e === 0))
|
|
154
165
|
break;
|
|
155
|
-
} else if (
|
|
156
|
-
for (
|
|
157
|
-
if (t
|
|
158
|
-
|
|
166
|
+
} else if (n.length > t + 9 && n[t + 1] === "[" && n[t + 2] === "C" && n[t + 3] === "D" && n[t + 4] === "A" && n[t + 5] === "T" && n[t + 6] === "A" && n[t + 7] === "[") {
|
|
167
|
+
for (t += 8; t < n.length; t++)
|
|
168
|
+
if (n[t] === "]" && n[t + 1] === "]" && n[t + 2] === ">") {
|
|
169
|
+
t += 2;
|
|
159
170
|
break;
|
|
160
171
|
}
|
|
161
172
|
}
|
|
162
|
-
return
|
|
173
|
+
return t;
|
|
163
174
|
}
|
|
164
|
-
const
|
|
165
|
-
function
|
|
166
|
-
let
|
|
167
|
-
for (;
|
|
168
|
-
if (t
|
|
169
|
-
|
|
170
|
-
else if (t
|
|
171
|
-
|
|
175
|
+
const we = '"', Se = "'";
|
|
176
|
+
function xe(n, t) {
|
|
177
|
+
let e = "", s = "", r = !1;
|
|
178
|
+
for (; t < n.length; t++) {
|
|
179
|
+
if (n[t] === we || n[t] === Se)
|
|
180
|
+
s === "" ? s = n[t] : s !== n[t] || (s = "");
|
|
181
|
+
else if (n[t] === ">" && s === "") {
|
|
182
|
+
r = !0;
|
|
172
183
|
break;
|
|
173
184
|
}
|
|
174
|
-
|
|
185
|
+
e += n[t];
|
|
175
186
|
}
|
|
176
|
-
return
|
|
177
|
-
value:
|
|
178
|
-
index:
|
|
179
|
-
tagClosed:
|
|
187
|
+
return s !== "" ? !1 : {
|
|
188
|
+
value: e,
|
|
189
|
+
index: t,
|
|
190
|
+
tagClosed: r
|
|
180
191
|
};
|
|
181
192
|
}
|
|
182
|
-
const
|
|
183
|
-
function
|
|
184
|
-
const
|
|
185
|
-
for (let
|
|
186
|
-
if (
|
|
187
|
-
return T("InvalidAttr", "Attribute '" +
|
|
188
|
-
if (
|
|
189
|
-
return T("InvalidAttr", "Attribute '" +
|
|
190
|
-
if (
|
|
191
|
-
return T("InvalidAttr", "boolean attribute '" +
|
|
192
|
-
const
|
|
193
|
-
if (!
|
|
194
|
-
return T("InvalidAttr", "Attribute '" +
|
|
195
|
-
if (!
|
|
196
|
-
|
|
193
|
+
const ke = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
|
|
194
|
+
function Wt(n, t) {
|
|
195
|
+
const e = Yt(n, ke), s = {};
|
|
196
|
+
for (let r = 0; r < e.length; r++) {
|
|
197
|
+
if (e[r][1].length === 0)
|
|
198
|
+
return T("InvalidAttr", "Attribute '" + e[r][2] + "' has no space in starting.", dt(e[r]));
|
|
199
|
+
if (e[r][3] !== void 0 && e[r][4] === void 0)
|
|
200
|
+
return T("InvalidAttr", "Attribute '" + e[r][2] + "' is without value.", dt(e[r]));
|
|
201
|
+
if (e[r][3] === void 0 && !t.allowBooleanAttributes)
|
|
202
|
+
return T("InvalidAttr", "boolean attribute '" + e[r][2] + "' is not allowed.", dt(e[r]));
|
|
203
|
+
const i = e[r][2];
|
|
204
|
+
if (!Pe(i))
|
|
205
|
+
return T("InvalidAttr", "Attribute '" + i + "' is an invalid name.", dt(e[r]));
|
|
206
|
+
if (!Object.prototype.hasOwnProperty.call(s, i))
|
|
207
|
+
s[i] = 1;
|
|
197
208
|
else
|
|
198
|
-
return T("InvalidAttr", "Attribute '" +
|
|
209
|
+
return T("InvalidAttr", "Attribute '" + i + "' is repeated.", dt(e[r]));
|
|
199
210
|
}
|
|
200
211
|
return !0;
|
|
201
212
|
}
|
|
202
|
-
function
|
|
203
|
-
let
|
|
204
|
-
for (t
|
|
205
|
-
if (t
|
|
206
|
-
return
|
|
207
|
-
if (!t
|
|
213
|
+
function Ce(n, t) {
|
|
214
|
+
let e = /\d/;
|
|
215
|
+
for (n[t] === "x" && (t++, e = /[\da-fA-F]/); t < n.length; t++) {
|
|
216
|
+
if (n[t] === ";")
|
|
217
|
+
return t;
|
|
218
|
+
if (!n[t].match(e))
|
|
208
219
|
break;
|
|
209
220
|
}
|
|
210
221
|
return -1;
|
|
211
222
|
}
|
|
212
|
-
function
|
|
213
|
-
if (
|
|
223
|
+
function _e(n, t) {
|
|
224
|
+
if (t++, n[t] === ";")
|
|
214
225
|
return -1;
|
|
215
|
-
if (t
|
|
216
|
-
return
|
|
217
|
-
let
|
|
218
|
-
for (;
|
|
219
|
-
if (!(t
|
|
220
|
-
if (t
|
|
226
|
+
if (n[t] === "#")
|
|
227
|
+
return t++, Ce(n, t);
|
|
228
|
+
let e = 0;
|
|
229
|
+
for (; t < n.length; t++, e++)
|
|
230
|
+
if (!(n[t].match(/\w/) && e < 20)) {
|
|
231
|
+
if (n[t] === ";")
|
|
221
232
|
break;
|
|
222
233
|
return -1;
|
|
223
234
|
}
|
|
224
|
-
return
|
|
235
|
+
return t;
|
|
225
236
|
}
|
|
226
|
-
function T(t, e
|
|
237
|
+
function T(n, t, e) {
|
|
227
238
|
return {
|
|
228
239
|
err: {
|
|
229
|
-
code:
|
|
230
|
-
msg:
|
|
231
|
-
line:
|
|
232
|
-
col:
|
|
240
|
+
code: n,
|
|
241
|
+
msg: t,
|
|
242
|
+
line: e.line || e,
|
|
243
|
+
col: e.col
|
|
233
244
|
}
|
|
234
245
|
};
|
|
235
246
|
}
|
|
236
|
-
function
|
|
237
|
-
return
|
|
247
|
+
function Pe(n) {
|
|
248
|
+
return Nt(n);
|
|
238
249
|
}
|
|
239
|
-
function
|
|
240
|
-
return
|
|
250
|
+
function Te(n) {
|
|
251
|
+
return Nt(n);
|
|
241
252
|
}
|
|
242
|
-
function
|
|
243
|
-
const
|
|
253
|
+
function V(n, t) {
|
|
254
|
+
const e = n.substring(0, t).split(/\r?\n/);
|
|
244
255
|
return {
|
|
245
|
-
line:
|
|
256
|
+
line: e.length,
|
|
246
257
|
// column number is last line's length + 1, because column numbering starts at 1:
|
|
247
|
-
col:
|
|
258
|
+
col: e[e.length - 1].length + 1
|
|
248
259
|
};
|
|
249
260
|
}
|
|
250
|
-
function
|
|
251
|
-
return
|
|
261
|
+
function dt(n) {
|
|
262
|
+
return n.startIndex + n[1].length;
|
|
252
263
|
}
|
|
253
|
-
const
|
|
264
|
+
const Zt = (n) => Pt.includes(n) ? "__" + n : n, Ae = {
|
|
254
265
|
preserveOrder: !1,
|
|
255
266
|
attributeNamePrefix: "@_",
|
|
256
267
|
attributesGroupName: !1,
|
|
@@ -271,11 +282,11 @@ const Et = {
|
|
|
271
282
|
leadingZeros: !0,
|
|
272
283
|
eNotation: !0
|
|
273
284
|
},
|
|
274
|
-
tagValueProcessor: function(
|
|
275
|
-
return
|
|
285
|
+
tagValueProcessor: function(n, t) {
|
|
286
|
+
return t;
|
|
276
287
|
},
|
|
277
|
-
attributeValueProcessor: function(
|
|
278
|
-
return
|
|
288
|
+
attributeValueProcessor: function(n, t) {
|
|
289
|
+
return t;
|
|
279
290
|
},
|
|
280
291
|
stopNodes: [],
|
|
281
292
|
//nested tags will not be parsed even for errors
|
|
@@ -289,275 +300,788 @@ const Et = {
|
|
|
289
300
|
ignorePiTags: !1,
|
|
290
301
|
transformTagName: !1,
|
|
291
302
|
transformAttributeName: !1,
|
|
292
|
-
updateTag: function(t, e
|
|
293
|
-
return
|
|
303
|
+
updateTag: function(n, t, e) {
|
|
304
|
+
return n;
|
|
294
305
|
},
|
|
295
306
|
// skipEmptyListItem: false
|
|
296
|
-
captureMetaData: !1
|
|
297
|
-
|
|
298
|
-
|
|
307
|
+
captureMetaData: !1,
|
|
308
|
+
maxNestedTags: 100,
|
|
309
|
+
strictReservedNames: !0,
|
|
310
|
+
jPath: !0,
|
|
311
|
+
// if true, pass jPath string to callbacks; if false, pass matcher instance
|
|
312
|
+
onDangerousProperty: Zt
|
|
299
313
|
};
|
|
300
|
-
|
|
301
|
-
typeof
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
314
|
+
function Le(n, t) {
|
|
315
|
+
if (typeof n != "string")
|
|
316
|
+
return;
|
|
317
|
+
const e = n.toLowerCase();
|
|
318
|
+
if (Pt.some((s) => e === s.toLowerCase()))
|
|
319
|
+
throw new Error(
|
|
320
|
+
`[SECURITY] Invalid ${t}: "${n}" is a reserved JavaScript keyword that could cause prototype pollution`
|
|
321
|
+
);
|
|
322
|
+
if (Kt.some((s) => e === s.toLowerCase()))
|
|
323
|
+
throw new Error(
|
|
324
|
+
`[SECURITY] Invalid ${t}: "${n}" is a reserved JavaScript keyword that could cause prototype pollution`
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
function Jt(n) {
|
|
328
|
+
return typeof n == "boolean" ? {
|
|
329
|
+
enabled: n,
|
|
330
|
+
// true or false
|
|
331
|
+
maxEntitySize: 1e4,
|
|
332
|
+
maxExpansionDepth: 10,
|
|
333
|
+
maxTotalExpansions: 1e3,
|
|
334
|
+
maxExpandedLength: 1e5,
|
|
335
|
+
maxEntityCount: 100,
|
|
336
|
+
allowedTags: null,
|
|
337
|
+
tagFilter: null
|
|
338
|
+
} : typeof n == "object" && n !== null ? {
|
|
339
|
+
enabled: n.enabled !== !1,
|
|
340
|
+
maxEntitySize: Math.max(1, n.maxEntitySize ?? 1e4),
|
|
341
|
+
maxExpansionDepth: Math.max(1, n.maxExpansionDepth ?? 10),
|
|
342
|
+
maxTotalExpansions: Math.max(1, n.maxTotalExpansions ?? 1e3),
|
|
343
|
+
maxExpandedLength: Math.max(1, n.maxExpandedLength ?? 1e5),
|
|
344
|
+
maxEntityCount: Math.max(1, n.maxEntityCount ?? 100),
|
|
345
|
+
allowedTags: n.allowedTags ?? null,
|
|
346
|
+
tagFilter: n.tagFilter ?? null
|
|
347
|
+
} : Jt(!0);
|
|
348
|
+
}
|
|
349
|
+
const $e = function(n) {
|
|
350
|
+
const t = Object.assign({}, Ae, n), e = [
|
|
351
|
+
{ value: t.attributeNamePrefix, name: "attributeNamePrefix" },
|
|
352
|
+
{ value: t.attributesGroupName, name: "attributesGroupName" },
|
|
353
|
+
{ value: t.textNodeName, name: "textNodeName" },
|
|
354
|
+
{ value: t.cdataPropName, name: "cdataPropName" },
|
|
355
|
+
{ value: t.commentPropName, name: "commentPropName" }
|
|
356
|
+
];
|
|
357
|
+
for (const { value: s, name: r } of e)
|
|
358
|
+
s && Le(s, r);
|
|
359
|
+
return t.onDangerousProperty === null && (t.onDangerousProperty = Zt), t.processEntities = Jt(t.processEntities), t.stopNodes && Array.isArray(t.stopNodes) && (t.stopNodes = t.stopNodes.map((s) => typeof s == "string" && s.startsWith("*.") ? ".." + s.substring(2) : s)), t;
|
|
360
|
+
};
|
|
361
|
+
let Et;
|
|
362
|
+
typeof Symbol != "function" ? Et = "@@xmlMetadata" : Et = Symbol("XML Node Metadata");
|
|
363
|
+
class Q {
|
|
364
|
+
constructor(t) {
|
|
365
|
+
this.tagname = t, this.child = [], this[":@"] = /* @__PURE__ */ Object.create(null);
|
|
305
366
|
}
|
|
306
|
-
add(
|
|
307
|
-
|
|
367
|
+
add(t, e) {
|
|
368
|
+
t === "__proto__" && (t = "#__proto__"), this.child.push({ [t]: e });
|
|
308
369
|
}
|
|
309
|
-
addChild(
|
|
310
|
-
|
|
370
|
+
addChild(t, e) {
|
|
371
|
+
t.tagname === "__proto__" && (t.tagname = "#__proto__"), t[":@"] && Object.keys(t[":@"]).length > 0 ? this.child.push({ [t.tagname]: t.child, ":@": t[":@"] }) : this.child.push({ [t.tagname]: t.child }), e !== void 0 && (this.child[this.child.length - 1][Et] = { startIndex: e });
|
|
311
372
|
}
|
|
312
373
|
/** symbol used for metadata */
|
|
313
374
|
static getMetaDataSymbol() {
|
|
314
|
-
return
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
class
|
|
318
|
-
constructor(
|
|
319
|
-
this.suppressValidationErr = !
|
|
320
|
-
}
|
|
321
|
-
readDocType(
|
|
322
|
-
const
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
375
|
+
return Et;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
class Me {
|
|
379
|
+
constructor(t) {
|
|
380
|
+
this.suppressValidationErr = !t, this.options = t;
|
|
381
|
+
}
|
|
382
|
+
readDocType(t, e) {
|
|
383
|
+
const s = /* @__PURE__ */ Object.create(null);
|
|
384
|
+
let r = 0;
|
|
385
|
+
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") {
|
|
386
|
+
e = e + 9;
|
|
387
|
+
let i = 1, l = !1, o = !1, a = "";
|
|
388
|
+
for (; e < t.length; e++)
|
|
389
|
+
if (t[e] === "<" && !o) {
|
|
390
|
+
if (l && et(t, "!ENTITY", e)) {
|
|
391
|
+
e += 7;
|
|
392
|
+
let c, h;
|
|
393
|
+
if ([c, h, e] = this.readEntityExp(t, e + 1, this.suppressValidationErr), h.indexOf("&") === -1) {
|
|
394
|
+
if (this.options.enabled !== !1 && this.options.maxEntityCount != null && r >= this.options.maxEntityCount)
|
|
395
|
+
throw new Error(
|
|
396
|
+
`Entity count (${r + 1}) exceeds maximum allowed (${this.options.maxEntityCount})`
|
|
397
|
+
);
|
|
398
|
+
const d = c.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
399
|
+
s[c] = {
|
|
400
|
+
regx: RegExp(`&${d};`, "g"),
|
|
401
|
+
val: h
|
|
402
|
+
}, r++;
|
|
403
|
+
}
|
|
404
|
+
} else if (l && et(t, "!ELEMENT", e)) {
|
|
405
|
+
e += 8;
|
|
406
|
+
const { index: c } = this.readElementExp(t, e + 1);
|
|
407
|
+
e = c;
|
|
408
|
+
} else if (l && et(t, "!ATTLIST", e))
|
|
409
|
+
e += 8;
|
|
410
|
+
else if (l && et(t, "!NOTATION", e)) {
|
|
411
|
+
e += 9;
|
|
412
|
+
const { index: c } = this.readNotationExp(t, e + 1, this.suppressValidationErr);
|
|
413
|
+
e = c;
|
|
414
|
+
} else if (et(t, "!--", e)) o = !0;
|
|
346
415
|
else throw new Error("Invalid DOCTYPE");
|
|
347
|
-
i++,
|
|
348
|
-
} else if (e
|
|
349
|
-
if (o ? e
|
|
416
|
+
i++, a = "";
|
|
417
|
+
} else if (t[e] === ">") {
|
|
418
|
+
if (o ? t[e - 1] === "-" && t[e - 2] === "-" && (o = !1, i--) : i--, i === 0)
|
|
350
419
|
break;
|
|
351
|
-
} else e
|
|
420
|
+
} else t[e] === "[" ? l = !0 : a += t[e];
|
|
352
421
|
if (i !== 0)
|
|
353
422
|
throw new Error("Unclosed DOCTYPE");
|
|
354
423
|
} else
|
|
355
424
|
throw new Error("Invalid Tag instead of DOCTYPE");
|
|
356
|
-
return { entities:
|
|
357
|
-
}
|
|
358
|
-
readEntityExp(
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
for (;
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
425
|
+
return { entities: s, i: e };
|
|
426
|
+
}
|
|
427
|
+
readEntityExp(t, e) {
|
|
428
|
+
e = R(t, e);
|
|
429
|
+
const s = e;
|
|
430
|
+
for (; e < t.length && !/\s/.test(t[e]) && t[e] !== '"' && t[e] !== "'"; )
|
|
431
|
+
e++;
|
|
432
|
+
let r = t.substring(s, e);
|
|
433
|
+
if (ft(r), e = R(t, e), !this.suppressValidationErr) {
|
|
434
|
+
if (t.substring(e, e + 6).toUpperCase() === "SYSTEM")
|
|
365
435
|
throw new Error("External entities are not supported");
|
|
366
|
-
if (e
|
|
436
|
+
if (t[e] === "%")
|
|
367
437
|
throw new Error("Parameter entities are not supported");
|
|
368
438
|
}
|
|
369
439
|
let i = "";
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
const
|
|
440
|
+
if ([e, i] = this.readIdentifierVal(t, e, "entity"), this.options.enabled !== !1 && this.options.maxEntitySize != null && i.length > this.options.maxEntitySize)
|
|
441
|
+
throw new Error(
|
|
442
|
+
`Entity "${r}" size (${i.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`
|
|
443
|
+
);
|
|
444
|
+
return e--, [r, i, e];
|
|
445
|
+
}
|
|
446
|
+
readNotationExp(t, e) {
|
|
447
|
+
e = R(t, e);
|
|
448
|
+
const s = e;
|
|
449
|
+
for (; e < t.length && !/\s/.test(t[e]); )
|
|
450
|
+
e++;
|
|
451
|
+
let r = t.substring(s, e);
|
|
452
|
+
!this.suppressValidationErr && ft(r), e = R(t, e);
|
|
453
|
+
const i = t.substring(e, e + 6).toUpperCase();
|
|
379
454
|
if (!this.suppressValidationErr && i !== "SYSTEM" && i !== "PUBLIC")
|
|
380
455
|
throw new Error(`Expected SYSTEM or PUBLIC, found "${i}"`);
|
|
381
|
-
|
|
382
|
-
let
|
|
456
|
+
e += i.length, e = R(t, e);
|
|
457
|
+
let l = null, o = null;
|
|
383
458
|
if (i === "PUBLIC")
|
|
384
|
-
[
|
|
385
|
-
else if (i === "SYSTEM" && ([
|
|
459
|
+
[e, l] = this.readIdentifierVal(t, e, "publicIdentifier"), e = R(t, e), (t[e] === '"' || t[e] === "'") && ([e, o] = this.readIdentifierVal(t, e, "systemIdentifier"));
|
|
460
|
+
else if (i === "SYSTEM" && ([e, o] = this.readIdentifierVal(t, e, "systemIdentifier"), !this.suppressValidationErr && !o))
|
|
386
461
|
throw new Error("Missing mandatory system identifier for SYSTEM notation");
|
|
387
|
-
return { notationName:
|
|
462
|
+
return { notationName: r, publicIdentifier: l, systemIdentifier: o, index: --e };
|
|
388
463
|
}
|
|
389
|
-
readIdentifierVal(e, s
|
|
390
|
-
let
|
|
391
|
-
const
|
|
392
|
-
if (
|
|
393
|
-
throw new Error(`Expected quoted string, found "${
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
464
|
+
readIdentifierVal(t, e, s) {
|
|
465
|
+
let r = "";
|
|
466
|
+
const i = t[e];
|
|
467
|
+
if (i !== '"' && i !== "'")
|
|
468
|
+
throw new Error(`Expected quoted string, found "${i}"`);
|
|
469
|
+
e++;
|
|
470
|
+
const l = e;
|
|
471
|
+
for (; e < t.length && t[e] !== i; )
|
|
472
|
+
e++;
|
|
473
|
+
if (r = t.substring(l, e), t[e] !== i)
|
|
474
|
+
throw new Error(`Unterminated ${s} value`);
|
|
475
|
+
return e++, [e, r];
|
|
476
|
+
}
|
|
477
|
+
readElementExp(t, e) {
|
|
478
|
+
e = R(t, e);
|
|
479
|
+
const s = e;
|
|
480
|
+
for (; e < t.length && !/\s/.test(t[e]); )
|
|
481
|
+
e++;
|
|
482
|
+
let r = t.substring(s, e);
|
|
483
|
+
if (!this.suppressValidationErr && !Nt(r))
|
|
484
|
+
throw new Error(`Invalid element name: "${r}"`);
|
|
485
|
+
e = R(t, e);
|
|
408
486
|
let i = "";
|
|
409
|
-
if (e
|
|
410
|
-
else if (e
|
|
411
|
-
else if (e
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
487
|
+
if (t[e] === "E" && et(t, "MPTY", e)) e += 4;
|
|
488
|
+
else if (t[e] === "A" && et(t, "NY", e)) e += 2;
|
|
489
|
+
else if (t[e] === "(") {
|
|
490
|
+
e++;
|
|
491
|
+
const l = e;
|
|
492
|
+
for (; e < t.length && t[e] !== ")"; )
|
|
493
|
+
e++;
|
|
494
|
+
if (i = t.substring(l, e), t[e] !== ")")
|
|
415
495
|
throw new Error("Unterminated content model");
|
|
416
496
|
} else if (!this.suppressValidationErr)
|
|
417
|
-
throw new Error(`Invalid Element Expression, found "${e
|
|
497
|
+
throw new Error(`Invalid Element Expression, found "${t[e]}"`);
|
|
418
498
|
return {
|
|
419
|
-
elementName:
|
|
499
|
+
elementName: r,
|
|
420
500
|
contentModel: i.trim(),
|
|
421
|
-
index:
|
|
501
|
+
index: e
|
|
422
502
|
};
|
|
423
503
|
}
|
|
424
|
-
readAttlistExp(
|
|
425
|
-
|
|
426
|
-
let
|
|
427
|
-
for (;
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
if (!
|
|
504
|
+
readAttlistExp(t, e) {
|
|
505
|
+
e = R(t, e);
|
|
506
|
+
let s = e;
|
|
507
|
+
for (; e < t.length && !/\s/.test(t[e]); )
|
|
508
|
+
e++;
|
|
509
|
+
let r = t.substring(s, e);
|
|
510
|
+
for (ft(r), e = R(t, e), s = e; e < t.length && !/\s/.test(t[e]); )
|
|
511
|
+
e++;
|
|
512
|
+
let i = t.substring(s, e);
|
|
513
|
+
if (!ft(i))
|
|
434
514
|
throw new Error(`Invalid attribute name: "${i}"`);
|
|
435
|
-
|
|
436
|
-
let
|
|
437
|
-
if (
|
|
438
|
-
if (
|
|
439
|
-
throw new Error(`Expected '(', found "${e
|
|
440
|
-
|
|
441
|
-
let
|
|
442
|
-
for (;
|
|
443
|
-
|
|
444
|
-
for (;
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
515
|
+
e = R(t, e);
|
|
516
|
+
let l = "";
|
|
517
|
+
if (t.substring(e, e + 8).toUpperCase() === "NOTATION") {
|
|
518
|
+
if (l = "NOTATION", e += 8, e = R(t, e), t[e] !== "(")
|
|
519
|
+
throw new Error(`Expected '(', found "${t[e]}"`);
|
|
520
|
+
e++;
|
|
521
|
+
let a = [];
|
|
522
|
+
for (; e < t.length && t[e] !== ")"; ) {
|
|
523
|
+
const c = e;
|
|
524
|
+
for (; e < t.length && t[e] !== "|" && t[e] !== ")"; )
|
|
525
|
+
e++;
|
|
526
|
+
let h = t.substring(c, e);
|
|
527
|
+
if (h = h.trim(), !ft(h))
|
|
528
|
+
throw new Error(`Invalid notation name: "${h}"`);
|
|
529
|
+
a.push(h), t[e] === "|" && (e++, e = R(t, e));
|
|
449
530
|
}
|
|
450
|
-
if (e
|
|
531
|
+
if (t[e] !== ")")
|
|
451
532
|
throw new Error("Unterminated list of notations");
|
|
452
|
-
|
|
533
|
+
e++, l += " (" + a.join("|") + ")";
|
|
453
534
|
} else {
|
|
454
|
-
|
|
455
|
-
|
|
535
|
+
const a = e;
|
|
536
|
+
for (; e < t.length && !/\s/.test(t[e]); )
|
|
537
|
+
e++;
|
|
538
|
+
l += t.substring(a, e);
|
|
456
539
|
const c = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"];
|
|
457
|
-
if (!this.suppressValidationErr && !c.includes(
|
|
458
|
-
throw new Error(`Invalid attribute type: "${
|
|
540
|
+
if (!this.suppressValidationErr && !c.includes(l.toUpperCase()))
|
|
541
|
+
throw new Error(`Invalid attribute type: "${l}"`);
|
|
459
542
|
}
|
|
460
|
-
|
|
543
|
+
e = R(t, e);
|
|
461
544
|
let o = "";
|
|
462
|
-
return
|
|
463
|
-
elementName:
|
|
545
|
+
return t.substring(e, e + 8).toUpperCase() === "#REQUIRED" ? (o = "#REQUIRED", e += 8) : t.substring(e, e + 7).toUpperCase() === "#IMPLIED" ? (o = "#IMPLIED", e += 7) : [e, o] = this.readIdentifierVal(t, e, "ATTLIST"), {
|
|
546
|
+
elementName: r,
|
|
464
547
|
attributeName: i,
|
|
465
|
-
attributeType:
|
|
548
|
+
attributeType: l,
|
|
466
549
|
defaultValue: o,
|
|
467
|
-
index:
|
|
550
|
+
index: e
|
|
468
551
|
};
|
|
469
552
|
}
|
|
470
553
|
}
|
|
471
|
-
const
|
|
472
|
-
for (;
|
|
473
|
-
|
|
474
|
-
return
|
|
554
|
+
const R = (n, t) => {
|
|
555
|
+
for (; t < n.length && /\s/.test(n[t]); )
|
|
556
|
+
t++;
|
|
557
|
+
return t;
|
|
475
558
|
};
|
|
476
|
-
function
|
|
477
|
-
for (let
|
|
478
|
-
if (
|
|
559
|
+
function et(n, t, e) {
|
|
560
|
+
for (let s = 0; s < t.length; s++)
|
|
561
|
+
if (t[s] !== n[e + s + 1]) return !1;
|
|
479
562
|
return !0;
|
|
480
563
|
}
|
|
481
|
-
function
|
|
482
|
-
if (
|
|
483
|
-
return
|
|
484
|
-
throw new Error(`Invalid entity name ${
|
|
564
|
+
function ft(n) {
|
|
565
|
+
if (Nt(n))
|
|
566
|
+
return n;
|
|
567
|
+
throw new Error(`Invalid entity name ${n}`);
|
|
485
568
|
}
|
|
486
|
-
const
|
|
569
|
+
const Oe = /^[-+]?0x[a-fA-F0-9]+$/, Ie = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, Ve = {
|
|
487
570
|
hex: !0,
|
|
488
571
|
// oct: false,
|
|
489
572
|
leadingZeros: !0,
|
|
490
573
|
decimalPoint: ".",
|
|
491
|
-
eNotation: !0
|
|
492
|
-
//skipLike: /regex
|
|
574
|
+
eNotation: !0,
|
|
575
|
+
//skipLike: /regex/,
|
|
576
|
+
infinity: "original"
|
|
577
|
+
// "null", "infinity" (Infinity type), "string" ("Infinity" (the string literal))
|
|
493
578
|
};
|
|
494
|
-
function
|
|
495
|
-
if (
|
|
496
|
-
let
|
|
497
|
-
if (e.
|
|
498
|
-
if (t
|
|
499
|
-
if (e
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
const
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
579
|
+
function Re(n, t = {}) {
|
|
580
|
+
if (t = Object.assign({}, Ve, t), !n || typeof n != "string") return n;
|
|
581
|
+
let e = n.trim();
|
|
582
|
+
if (e.length === 0) return n;
|
|
583
|
+
if (t.skipLike !== void 0 && t.skipLike.test(e)) return n;
|
|
584
|
+
if (e === "0") return 0;
|
|
585
|
+
if (t.hex && Oe.test(e))
|
|
586
|
+
return Ue(e, 16);
|
|
587
|
+
if (isFinite(e)) {
|
|
588
|
+
if (e.includes("e") || e.includes("E"))
|
|
589
|
+
return We(n, e, t);
|
|
590
|
+
{
|
|
591
|
+
const s = Ie.exec(e);
|
|
592
|
+
if (s) {
|
|
593
|
+
const r = s[1] || "", i = s[2];
|
|
594
|
+
let l = Xe(s[3]);
|
|
595
|
+
const o = r ? (
|
|
596
|
+
// 0., -00., 000.
|
|
597
|
+
n[i.length + 1] === "."
|
|
598
|
+
) : n[i.length] === ".";
|
|
599
|
+
if (!t.leadingZeros && (i.length > 1 || i.length === 1 && !o))
|
|
600
|
+
return n;
|
|
601
|
+
{
|
|
602
|
+
const a = Number(e), c = String(a);
|
|
603
|
+
if (a === 0) return a;
|
|
604
|
+
if (c.search(/[eE]/) !== -1)
|
|
605
|
+
return t.eNotation ? a : n;
|
|
606
|
+
if (e.indexOf(".") !== -1)
|
|
607
|
+
return c === "0" || c === l || c === `${r}${l}` ? a : n;
|
|
608
|
+
let h = i ? l : e;
|
|
609
|
+
return i ? h === c || r + h === c ? a : n : h === c || h === r + c ? a : n;
|
|
610
|
+
}
|
|
611
|
+
} else
|
|
612
|
+
return n;
|
|
613
|
+
}
|
|
614
|
+
} else return Be(n, Number(e), t);
|
|
527
615
|
}
|
|
528
|
-
const
|
|
529
|
-
function
|
|
530
|
-
if (!
|
|
531
|
-
const
|
|
532
|
-
if (
|
|
533
|
-
let
|
|
534
|
-
const
|
|
616
|
+
const Fe = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;
|
|
617
|
+
function We(n, t, e) {
|
|
618
|
+
if (!e.eNotation) return n;
|
|
619
|
+
const s = t.match(Fe);
|
|
620
|
+
if (s) {
|
|
621
|
+
let r = s[1] || "";
|
|
622
|
+
const i = s[3].indexOf("e") === -1 ? "E" : "e", l = s[2], o = r ? (
|
|
535
623
|
// 0E.
|
|
536
|
-
|
|
537
|
-
) :
|
|
538
|
-
return
|
|
624
|
+
n[l.length + 1] === i
|
|
625
|
+
) : n[l.length] === i;
|
|
626
|
+
return l.length > 1 && o ? n : l.length === 1 && (s[3].startsWith(`.${i}`) || s[3][0] === i) ? Number(t) : l.length > 0 ? e.leadingZeros && !o ? (t = (s[1] || "") + s[3], Number(t)) : n : Number(t);
|
|
539
627
|
} else
|
|
540
|
-
return
|
|
628
|
+
return n;
|
|
541
629
|
}
|
|
542
|
-
function
|
|
543
|
-
return
|
|
630
|
+
function Xe(n) {
|
|
631
|
+
return n && n.indexOf(".") !== -1 && (n = n.replace(/0+$/, ""), n === "." ? n = "0" : n[0] === "." ? n = "0" + n : n[n.length - 1] === "." && (n = n.substring(0, n.length - 1))), n;
|
|
544
632
|
}
|
|
545
|
-
function
|
|
546
|
-
if (parseInt) return parseInt(
|
|
547
|
-
if (Number.parseInt) return Number.parseInt(
|
|
548
|
-
if (window && window.parseInt) return window.parseInt(
|
|
633
|
+
function Ue(n, t) {
|
|
634
|
+
if (parseInt) return parseInt(n, t);
|
|
635
|
+
if (Number.parseInt) return Number.parseInt(n, t);
|
|
636
|
+
if (window && window.parseInt) return window.parseInt(n, t);
|
|
549
637
|
throw new Error("parseInt, Number.parseInt, window.parseInt are not supported");
|
|
550
638
|
}
|
|
551
|
-
function
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
639
|
+
function Be(n, t, e) {
|
|
640
|
+
const s = t === 1 / 0;
|
|
641
|
+
switch (e.infinity.toLowerCase()) {
|
|
642
|
+
case "null":
|
|
643
|
+
return null;
|
|
644
|
+
case "infinity":
|
|
645
|
+
return t;
|
|
646
|
+
// Return Infinity or -Infinity
|
|
647
|
+
case "string":
|
|
648
|
+
return s ? "Infinity" : "-Infinity";
|
|
649
|
+
case "original":
|
|
650
|
+
default:
|
|
651
|
+
return n;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
function qe(n) {
|
|
655
|
+
return typeof n == "function" ? n : Array.isArray(n) ? (t) => {
|
|
656
|
+
for (const e of n)
|
|
657
|
+
if (typeof e == "string" && t === e || e instanceof RegExp && e.test(t))
|
|
555
658
|
return !0;
|
|
556
659
|
} : () => !1;
|
|
557
660
|
}
|
|
558
|
-
class
|
|
559
|
-
|
|
560
|
-
|
|
661
|
+
class ut {
|
|
662
|
+
/**
|
|
663
|
+
* Create a new Expression
|
|
664
|
+
* @param {string} pattern - Pattern string (e.g., "root.users.user", "..user[id]")
|
|
665
|
+
* @param {Object} options - Configuration options
|
|
666
|
+
* @param {string} options.separator - Path separator (default: '.')
|
|
667
|
+
*/
|
|
668
|
+
constructor(t, e = {}) {
|
|
669
|
+
this.pattern = t, this.separator = e.separator || ".", this.segments = this._parse(t), this._hasDeepWildcard = this.segments.some((s) => s.type === "deep-wildcard"), this._hasAttributeCondition = this.segments.some((s) => s.attrName !== void 0), this._hasPositionSelector = this.segments.some((s) => s.position !== void 0);
|
|
670
|
+
}
|
|
671
|
+
/**
|
|
672
|
+
* Parse pattern string into segments
|
|
673
|
+
* @private
|
|
674
|
+
* @param {string} pattern - Pattern to parse
|
|
675
|
+
* @returns {Array} Array of segment objects
|
|
676
|
+
*/
|
|
677
|
+
_parse(t) {
|
|
678
|
+
const e = [];
|
|
679
|
+
let s = 0, r = "";
|
|
680
|
+
for (; s < t.length; )
|
|
681
|
+
t[s] === this.separator ? s + 1 < t.length && t[s + 1] === this.separator ? (r.trim() && (e.push(this._parseSegment(r.trim())), r = ""), e.push({ type: "deep-wildcard" }), s += 2) : (r.trim() && e.push(this._parseSegment(r.trim())), r = "", s++) : (r += t[s], s++);
|
|
682
|
+
return r.trim() && e.push(this._parseSegment(r.trim())), e;
|
|
683
|
+
}
|
|
684
|
+
/**
|
|
685
|
+
* Parse a single segment
|
|
686
|
+
* @private
|
|
687
|
+
* @param {string} part - Segment string (e.g., "user", "ns::user", "user[id]", "ns::user:first")
|
|
688
|
+
* @returns {Object} Segment object
|
|
689
|
+
*/
|
|
690
|
+
_parseSegment(t) {
|
|
691
|
+
const e = { type: "tag" };
|
|
692
|
+
let s = null, r = t;
|
|
693
|
+
const i = t.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);
|
|
694
|
+
if (i && (r = i[1] + i[3], i[2])) {
|
|
695
|
+
const h = i[2].slice(1, -1);
|
|
696
|
+
h && (s = h);
|
|
697
|
+
}
|
|
698
|
+
let l, o = r;
|
|
699
|
+
if (r.includes("::")) {
|
|
700
|
+
const h = r.indexOf("::");
|
|
701
|
+
if (l = r.substring(0, h).trim(), o = r.substring(h + 2).trim(), !l)
|
|
702
|
+
throw new Error(`Invalid namespace in pattern: ${t}`);
|
|
703
|
+
}
|
|
704
|
+
let a, c = null;
|
|
705
|
+
if (o.includes(":")) {
|
|
706
|
+
const h = o.lastIndexOf(":"), d = o.substring(0, h).trim(), f = o.substring(h + 1).trim();
|
|
707
|
+
["first", "last", "odd", "even"].includes(f) || /^nth\(\d+\)$/.test(f) ? (a = d, c = f) : a = o;
|
|
708
|
+
} else
|
|
709
|
+
a = o;
|
|
710
|
+
if (!a)
|
|
711
|
+
throw new Error(`Invalid segment pattern: ${t}`);
|
|
712
|
+
if (e.tag = a, l && (e.namespace = l), s)
|
|
713
|
+
if (s.includes("=")) {
|
|
714
|
+
const h = s.indexOf("=");
|
|
715
|
+
e.attrName = s.substring(0, h).trim(), e.attrValue = s.substring(h + 1).trim();
|
|
716
|
+
} else
|
|
717
|
+
e.attrName = s.trim();
|
|
718
|
+
if (c) {
|
|
719
|
+
const h = c.match(/^nth\((\d+)\)$/);
|
|
720
|
+
h ? (e.position = "nth", e.positionValue = parseInt(h[1], 10)) : e.position = c;
|
|
721
|
+
}
|
|
722
|
+
return e;
|
|
723
|
+
}
|
|
724
|
+
/**
|
|
725
|
+
* Get the number of segments
|
|
726
|
+
* @returns {number}
|
|
727
|
+
*/
|
|
728
|
+
get length() {
|
|
729
|
+
return this.segments.length;
|
|
730
|
+
}
|
|
731
|
+
/**
|
|
732
|
+
* Check if expression contains deep wildcard
|
|
733
|
+
* @returns {boolean}
|
|
734
|
+
*/
|
|
735
|
+
hasDeepWildcard() {
|
|
736
|
+
return this._hasDeepWildcard;
|
|
737
|
+
}
|
|
738
|
+
/**
|
|
739
|
+
* Check if expression has attribute conditions
|
|
740
|
+
* @returns {boolean}
|
|
741
|
+
*/
|
|
742
|
+
hasAttributeCondition() {
|
|
743
|
+
return this._hasAttributeCondition;
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* Check if expression has position selectors
|
|
747
|
+
* @returns {boolean}
|
|
748
|
+
*/
|
|
749
|
+
hasPositionSelector() {
|
|
750
|
+
return this._hasPositionSelector;
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
753
|
+
* Get string representation
|
|
754
|
+
* @returns {string}
|
|
755
|
+
*/
|
|
756
|
+
toString() {
|
|
757
|
+
return this.pattern;
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
const je = /* @__PURE__ */ new Set(["push", "pop", "reset", "updateCurrent", "restore"]);
|
|
761
|
+
class Tt {
|
|
762
|
+
/**
|
|
763
|
+
* Create a new Matcher
|
|
764
|
+
* @param {Object} options - Configuration options
|
|
765
|
+
* @param {string} options.separator - Default path separator (default: '.')
|
|
766
|
+
*/
|
|
767
|
+
constructor(t = {}) {
|
|
768
|
+
this.separator = t.separator || ".", this.path = [], this.siblingStacks = [];
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* Push a new tag onto the path
|
|
772
|
+
* @param {string} tagName - Name of the tag
|
|
773
|
+
* @param {Object} attrValues - Attribute key-value pairs for current node (optional)
|
|
774
|
+
* @param {string} namespace - Namespace for the tag (optional)
|
|
775
|
+
*/
|
|
776
|
+
push(t, e = null, s = null) {
|
|
777
|
+
if (this.path.length > 0) {
|
|
778
|
+
const h = this.path[this.path.length - 1];
|
|
779
|
+
h.values = void 0;
|
|
780
|
+
}
|
|
781
|
+
const r = this.path.length;
|
|
782
|
+
this.siblingStacks[r] || (this.siblingStacks[r] = /* @__PURE__ */ new Map());
|
|
783
|
+
const i = this.siblingStacks[r], l = s ? `${s}:${t}` : t, o = i.get(l) || 0;
|
|
784
|
+
let a = 0;
|
|
785
|
+
for (const h of i.values())
|
|
786
|
+
a += h;
|
|
787
|
+
i.set(l, o + 1);
|
|
788
|
+
const c = {
|
|
789
|
+
tag: t,
|
|
790
|
+
position: a,
|
|
791
|
+
counter: o
|
|
792
|
+
};
|
|
793
|
+
s != null && (c.namespace = s), e != null && (c.values = e), this.path.push(c);
|
|
794
|
+
}
|
|
795
|
+
/**
|
|
796
|
+
* Pop the last tag from the path
|
|
797
|
+
* @returns {Object|undefined} The popped node
|
|
798
|
+
*/
|
|
799
|
+
pop() {
|
|
800
|
+
if (this.path.length === 0)
|
|
801
|
+
return;
|
|
802
|
+
const t = this.path.pop();
|
|
803
|
+
return this.siblingStacks.length > this.path.length + 1 && (this.siblingStacks.length = this.path.length + 1), t;
|
|
804
|
+
}
|
|
805
|
+
/**
|
|
806
|
+
* Update current node's attribute values
|
|
807
|
+
* Useful when attributes are parsed after push
|
|
808
|
+
* @param {Object} attrValues - Attribute values
|
|
809
|
+
*/
|
|
810
|
+
updateCurrent(t) {
|
|
811
|
+
if (this.path.length > 0) {
|
|
812
|
+
const e = this.path[this.path.length - 1];
|
|
813
|
+
t != null && (e.values = t);
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* Get current tag name
|
|
818
|
+
* @returns {string|undefined}
|
|
819
|
+
*/
|
|
820
|
+
getCurrentTag() {
|
|
821
|
+
return this.path.length > 0 ? this.path[this.path.length - 1].tag : void 0;
|
|
822
|
+
}
|
|
823
|
+
/**
|
|
824
|
+
* Get current namespace
|
|
825
|
+
* @returns {string|undefined}
|
|
826
|
+
*/
|
|
827
|
+
getCurrentNamespace() {
|
|
828
|
+
return this.path.length > 0 ? this.path[this.path.length - 1].namespace : void 0;
|
|
829
|
+
}
|
|
830
|
+
/**
|
|
831
|
+
* Get current node's attribute value
|
|
832
|
+
* @param {string} attrName - Attribute name
|
|
833
|
+
* @returns {*} Attribute value or undefined
|
|
834
|
+
*/
|
|
835
|
+
getAttrValue(t) {
|
|
836
|
+
return this.path.length === 0 ? void 0 : this.path[this.path.length - 1].values?.[t];
|
|
837
|
+
}
|
|
838
|
+
/**
|
|
839
|
+
* Check if current node has an attribute
|
|
840
|
+
* @param {string} attrName - Attribute name
|
|
841
|
+
* @returns {boolean}
|
|
842
|
+
*/
|
|
843
|
+
hasAttr(t) {
|
|
844
|
+
if (this.path.length === 0) return !1;
|
|
845
|
+
const e = this.path[this.path.length - 1];
|
|
846
|
+
return e.values !== void 0 && t in e.values;
|
|
847
|
+
}
|
|
848
|
+
/**
|
|
849
|
+
* Get current node's sibling position (child index in parent)
|
|
850
|
+
* @returns {number}
|
|
851
|
+
*/
|
|
852
|
+
getPosition() {
|
|
853
|
+
return this.path.length === 0 ? -1 : this.path[this.path.length - 1].position ?? 0;
|
|
854
|
+
}
|
|
855
|
+
/**
|
|
856
|
+
* Get current node's repeat counter (occurrence count of this tag name)
|
|
857
|
+
* @returns {number}
|
|
858
|
+
*/
|
|
859
|
+
getCounter() {
|
|
860
|
+
return this.path.length === 0 ? -1 : this.path[this.path.length - 1].counter ?? 0;
|
|
861
|
+
}
|
|
862
|
+
/**
|
|
863
|
+
* Get current node's sibling index (alias for getPosition for backward compatibility)
|
|
864
|
+
* @returns {number}
|
|
865
|
+
* @deprecated Use getPosition() or getCounter() instead
|
|
866
|
+
*/
|
|
867
|
+
getIndex() {
|
|
868
|
+
return this.getPosition();
|
|
869
|
+
}
|
|
870
|
+
/**
|
|
871
|
+
* Get current path depth
|
|
872
|
+
* @returns {number}
|
|
873
|
+
*/
|
|
874
|
+
getDepth() {
|
|
875
|
+
return this.path.length;
|
|
876
|
+
}
|
|
877
|
+
/**
|
|
878
|
+
* Get path as string
|
|
879
|
+
* @param {string} separator - Optional separator (uses default if not provided)
|
|
880
|
+
* @param {boolean} includeNamespace - Whether to include namespace in output (default: true)
|
|
881
|
+
* @returns {string}
|
|
882
|
+
*/
|
|
883
|
+
toString(t, e = !0) {
|
|
884
|
+
const s = t || this.separator;
|
|
885
|
+
return this.path.map((r) => e && r.namespace ? `${r.namespace}:${r.tag}` : r.tag).join(s);
|
|
886
|
+
}
|
|
887
|
+
/**
|
|
888
|
+
* Get path as array of tag names
|
|
889
|
+
* @returns {string[]}
|
|
890
|
+
*/
|
|
891
|
+
toArray() {
|
|
892
|
+
return this.path.map((t) => t.tag);
|
|
893
|
+
}
|
|
894
|
+
/**
|
|
895
|
+
* Reset the path to empty
|
|
896
|
+
*/
|
|
897
|
+
reset() {
|
|
898
|
+
this.path = [], this.siblingStacks = [];
|
|
899
|
+
}
|
|
900
|
+
/**
|
|
901
|
+
* Match current path against an Expression
|
|
902
|
+
* @param {Expression} expression - The expression to match against
|
|
903
|
+
* @returns {boolean} True if current path matches the expression
|
|
904
|
+
*/
|
|
905
|
+
matches(t) {
|
|
906
|
+
const e = t.segments;
|
|
907
|
+
return e.length === 0 ? !1 : t.hasDeepWildcard() ? this._matchWithDeepWildcard(e) : this._matchSimple(e);
|
|
908
|
+
}
|
|
909
|
+
/**
|
|
910
|
+
* Match simple path (no deep wildcards)
|
|
911
|
+
* @private
|
|
912
|
+
*/
|
|
913
|
+
_matchSimple(t) {
|
|
914
|
+
if (this.path.length !== t.length)
|
|
915
|
+
return !1;
|
|
916
|
+
for (let e = 0; e < t.length; e++) {
|
|
917
|
+
const s = t[e], r = this.path[e], i = e === this.path.length - 1;
|
|
918
|
+
if (!this._matchSegment(s, r, i))
|
|
919
|
+
return !1;
|
|
920
|
+
}
|
|
921
|
+
return !0;
|
|
922
|
+
}
|
|
923
|
+
/**
|
|
924
|
+
* Match path with deep wildcards
|
|
925
|
+
* @private
|
|
926
|
+
*/
|
|
927
|
+
_matchWithDeepWildcard(t) {
|
|
928
|
+
let e = this.path.length - 1, s = t.length - 1;
|
|
929
|
+
for (; s >= 0 && e >= 0; ) {
|
|
930
|
+
const r = t[s];
|
|
931
|
+
if (r.type === "deep-wildcard") {
|
|
932
|
+
if (s--, s < 0)
|
|
933
|
+
return !0;
|
|
934
|
+
const i = t[s];
|
|
935
|
+
let l = !1;
|
|
936
|
+
for (let o = e; o >= 0; o--) {
|
|
937
|
+
const a = o === this.path.length - 1;
|
|
938
|
+
if (this._matchSegment(i, this.path[o], a)) {
|
|
939
|
+
e = o - 1, s--, l = !0;
|
|
940
|
+
break;
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
if (!l)
|
|
944
|
+
return !1;
|
|
945
|
+
} else {
|
|
946
|
+
const i = e === this.path.length - 1;
|
|
947
|
+
if (!this._matchSegment(r, this.path[e], i))
|
|
948
|
+
return !1;
|
|
949
|
+
e--, s--;
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
return s < 0;
|
|
953
|
+
}
|
|
954
|
+
/**
|
|
955
|
+
* Match a single segment against a node
|
|
956
|
+
* @private
|
|
957
|
+
* @param {Object} segment - Segment from Expression
|
|
958
|
+
* @param {Object} node - Node from path
|
|
959
|
+
* @param {boolean} isCurrentNode - Whether this is the current (last) node
|
|
960
|
+
* @returns {boolean}
|
|
961
|
+
*/
|
|
962
|
+
_matchSegment(t, e, s) {
|
|
963
|
+
if (t.tag !== "*" && t.tag !== e.tag || t.namespace !== void 0 && t.namespace !== "*" && t.namespace !== e.namespace)
|
|
964
|
+
return !1;
|
|
965
|
+
if (t.attrName !== void 0) {
|
|
966
|
+
if (!s || !e.values || !(t.attrName in e.values))
|
|
967
|
+
return !1;
|
|
968
|
+
if (t.attrValue !== void 0) {
|
|
969
|
+
const r = e.values[t.attrName];
|
|
970
|
+
if (String(r) !== String(t.attrValue))
|
|
971
|
+
return !1;
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
if (t.position !== void 0) {
|
|
975
|
+
if (!s)
|
|
976
|
+
return !1;
|
|
977
|
+
const r = e.counter ?? 0;
|
|
978
|
+
if (t.position === "first" && r !== 0)
|
|
979
|
+
return !1;
|
|
980
|
+
if (t.position === "odd" && r % 2 !== 1)
|
|
981
|
+
return !1;
|
|
982
|
+
if (t.position === "even" && r % 2 !== 0)
|
|
983
|
+
return !1;
|
|
984
|
+
if (t.position === "nth" && r !== t.positionValue)
|
|
985
|
+
return !1;
|
|
986
|
+
}
|
|
987
|
+
return !0;
|
|
988
|
+
}
|
|
989
|
+
/**
|
|
990
|
+
* Create a snapshot of current state
|
|
991
|
+
* @returns {Object} State snapshot
|
|
992
|
+
*/
|
|
993
|
+
snapshot() {
|
|
994
|
+
return {
|
|
995
|
+
path: this.path.map((t) => ({ ...t })),
|
|
996
|
+
siblingStacks: this.siblingStacks.map((t) => new Map(t))
|
|
997
|
+
};
|
|
998
|
+
}
|
|
999
|
+
/**
|
|
1000
|
+
* Restore state from snapshot
|
|
1001
|
+
* @param {Object} snapshot - State snapshot
|
|
1002
|
+
*/
|
|
1003
|
+
restore(t) {
|
|
1004
|
+
this.path = t.path.map((e) => ({ ...e })), this.siblingStacks = t.siblingStacks.map((e) => new Map(e));
|
|
1005
|
+
}
|
|
1006
|
+
/**
|
|
1007
|
+
* Return a read-only view of this matcher.
|
|
1008
|
+
*
|
|
1009
|
+
* The returned object exposes all query/inspection methods but throws a
|
|
1010
|
+
* TypeError if any state-mutating method is called (`push`, `pop`, `reset`,
|
|
1011
|
+
* `updateCurrent`, `restore`). Property reads (e.g. `.path`, `.separator`)
|
|
1012
|
+
* are allowed but the returned arrays/objects are frozen so callers cannot
|
|
1013
|
+
* mutate internal state through them either.
|
|
1014
|
+
*
|
|
1015
|
+
* @returns {ReadOnlyMatcher} A proxy that forwards read operations and blocks writes.
|
|
1016
|
+
*
|
|
1017
|
+
* @example
|
|
1018
|
+
* const matcher = new Matcher();
|
|
1019
|
+
* matcher.push("root", {});
|
|
1020
|
+
*
|
|
1021
|
+
* const ro = matcher.readOnly();
|
|
1022
|
+
* ro.matches(expr); // ✓ works
|
|
1023
|
+
* ro.getCurrentTag(); // ✓ works
|
|
1024
|
+
* ro.push("child", {}); // ✗ throws TypeError
|
|
1025
|
+
* ro.reset(); // ✗ throws TypeError
|
|
1026
|
+
*/
|
|
1027
|
+
readOnly() {
|
|
1028
|
+
const t = this;
|
|
1029
|
+
return new Proxy(t, {
|
|
1030
|
+
get(e, s, r) {
|
|
1031
|
+
if (je.has(s))
|
|
1032
|
+
return () => {
|
|
1033
|
+
throw new TypeError(
|
|
1034
|
+
`Cannot call '${s}' on a read-only Matcher. Obtain a writable instance to mutate state.`
|
|
1035
|
+
);
|
|
1036
|
+
};
|
|
1037
|
+
const i = Reflect.get(e, s, r);
|
|
1038
|
+
return s === "path" || s === "siblingStacks" ? Object.freeze(
|
|
1039
|
+
Array.isArray(i) ? i.map(
|
|
1040
|
+
(l) => l instanceof Map ? Object.freeze(new Map(l)) : Object.freeze({ ...l })
|
|
1041
|
+
// freeze a copy of each node
|
|
1042
|
+
) : i
|
|
1043
|
+
) : typeof i == "function" ? i.bind(e) : i;
|
|
1044
|
+
},
|
|
1045
|
+
// Prevent any property assignment on the read-only view
|
|
1046
|
+
set(e, s) {
|
|
1047
|
+
throw new TypeError(
|
|
1048
|
+
`Cannot set property '${String(s)}' on a read-only Matcher.`
|
|
1049
|
+
);
|
|
1050
|
+
},
|
|
1051
|
+
// Prevent property deletion
|
|
1052
|
+
deleteProperty(e, s) {
|
|
1053
|
+
throw new TypeError(
|
|
1054
|
+
`Cannot delete property '${String(s)}' from a read-only Matcher.`
|
|
1055
|
+
);
|
|
1056
|
+
}
|
|
1057
|
+
});
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
function Ge(n, t) {
|
|
1061
|
+
if (!n) return {};
|
|
1062
|
+
const e = t.attributesGroupName ? n[t.attributesGroupName] : n;
|
|
1063
|
+
if (!e) return {};
|
|
1064
|
+
const s = {};
|
|
1065
|
+
for (const r in e)
|
|
1066
|
+
if (r.startsWith(t.attributeNamePrefix)) {
|
|
1067
|
+
const i = r.substring(t.attributeNamePrefix.length);
|
|
1068
|
+
s[i] = e[r];
|
|
1069
|
+
} else
|
|
1070
|
+
s[r] = e[r];
|
|
1071
|
+
return s;
|
|
1072
|
+
}
|
|
1073
|
+
function ze(n) {
|
|
1074
|
+
if (!n || typeof n != "string") return;
|
|
1075
|
+
const t = n.indexOf(":");
|
|
1076
|
+
if (t !== -1 && t > 0) {
|
|
1077
|
+
const e = n.substring(0, t);
|
|
1078
|
+
if (e !== "xmlns")
|
|
1079
|
+
return e;
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
class He {
|
|
1083
|
+
constructor(t) {
|
|
1084
|
+
if (this.options = t, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = {
|
|
561
1085
|
apos: { regex: /&(apos|#39|#x27);/g, val: "'" },
|
|
562
1086
|
gt: { regex: /&(gt|#62|#x3E);/g, val: ">" },
|
|
563
1087
|
lt: { regex: /&(lt|#60|#x3C);/g, val: "<" },
|
|
@@ -576,363 +1100,451 @@ class At {
|
|
|
576
1100
|
copyright: { regex: /&(copy|#169);/g, val: "©" },
|
|
577
1101
|
reg: { regex: /&(reg|#174);/g, val: "®" },
|
|
578
1102
|
inr: { regex: /&(inr|#8377);/g, val: "₹" },
|
|
579
|
-
num_dec: { regex: /&#([0-9]{1,7});/g, val: (
|
|
580
|
-
num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (
|
|
581
|
-
}, this.addExternalEntities =
|
|
582
|
-
this.
|
|
583
|
-
for (let
|
|
584
|
-
const
|
|
585
|
-
typeof
|
|
1103
|
+
num_dec: { regex: /&#([0-9]{1,7});/g, val: (e, s) => Xt(s, 10, "&#") },
|
|
1104
|
+
num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (e, s) => Xt(s, 16, "&#x") }
|
|
1105
|
+
}, this.addExternalEntities = Ye, this.parseXml = De, this.parseTextData = Ke, this.resolveNameSpace = Ze, this.buildAttributesMap = Qe, this.isItStopNode = sn, this.replaceEntitiesValue = en, this.readStopNodeData = on, this.saveTextToParentTag = nn, this.addChild = tn, this.ignoreAttributesFn = qe(this.options.ignoreAttributes), this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.matcher = new Tt(), this.readonlyMatcher = this.matcher.readOnly(), this.isCurrentNodeStopNode = !1, this.options.stopNodes && this.options.stopNodes.length > 0) {
|
|
1106
|
+
this.stopNodeExpressions = [];
|
|
1107
|
+
for (let e = 0; e < this.options.stopNodes.length; e++) {
|
|
1108
|
+
const s = this.options.stopNodes[e];
|
|
1109
|
+
typeof s == "string" ? this.stopNodeExpressions.push(new ut(s)) : s instanceof ut && this.stopNodeExpressions.push(s);
|
|
586
1110
|
}
|
|
587
1111
|
}
|
|
588
1112
|
}
|
|
589
1113
|
}
|
|
590
|
-
function
|
|
591
|
-
const
|
|
592
|
-
for (let
|
|
593
|
-
const
|
|
594
|
-
this.lastEntities[
|
|
595
|
-
regex: new RegExp("&" +
|
|
596
|
-
val:
|
|
1114
|
+
function Ye(n) {
|
|
1115
|
+
const t = Object.keys(n);
|
|
1116
|
+
for (let e = 0; e < t.length; e++) {
|
|
1117
|
+
const s = t[e], r = s.replace(/[.\-+*:]/g, "\\.");
|
|
1118
|
+
this.lastEntities[s] = {
|
|
1119
|
+
regex: new RegExp("&" + r + ";", "g"),
|
|
1120
|
+
val: n[s]
|
|
597
1121
|
};
|
|
598
1122
|
}
|
|
599
1123
|
}
|
|
600
|
-
function
|
|
601
|
-
if (
|
|
602
|
-
|
|
603
|
-
const
|
|
604
|
-
return
|
|
1124
|
+
function Ke(n, t, e, s, r, i, l) {
|
|
1125
|
+
if (n !== void 0 && (this.options.trimValues && !s && (n = n.trim()), n.length > 0)) {
|
|
1126
|
+
l || (n = this.replaceEntitiesValue(n, t, e));
|
|
1127
|
+
const o = this.options.jPath ? e.toString() : e, a = this.options.tagValueProcessor(t, n, o, r, i);
|
|
1128
|
+
return a == null ? n : typeof a != typeof n || a !== n ? a : this.options.trimValues ? Ct(n, this.options.parseTagValue, this.options.numberParseOptions) : n.trim() === n ? Ct(n, this.options.parseTagValue, this.options.numberParseOptions) : n;
|
|
605
1129
|
}
|
|
606
1130
|
}
|
|
607
|
-
function
|
|
1131
|
+
function Ze(n) {
|
|
608
1132
|
if (this.options.removeNSPrefix) {
|
|
609
|
-
const
|
|
610
|
-
if (
|
|
1133
|
+
const t = n.split(":"), e = n.charAt(0) === "/" ? "/" : "";
|
|
1134
|
+
if (t[0] === "xmlns")
|
|
611
1135
|
return "";
|
|
612
|
-
|
|
1136
|
+
t.length === 2 && (n = e + t[1]);
|
|
613
1137
|
}
|
|
614
|
-
return
|
|
1138
|
+
return n;
|
|
615
1139
|
}
|
|
616
|
-
const
|
|
617
|
-
function
|
|
618
|
-
if (this.options.ignoreAttributes !== !0 && typeof
|
|
619
|
-
const s =
|
|
620
|
-
for (let
|
|
621
|
-
const
|
|
622
|
-
if (
|
|
1140
|
+
const Je = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
|
|
1141
|
+
function Qe(n, t, e) {
|
|
1142
|
+
if (this.options.ignoreAttributes !== !0 && typeof n == "string") {
|
|
1143
|
+
const s = Yt(n, Je), r = s.length, i = {}, l = {};
|
|
1144
|
+
for (let o = 0; o < r; o++) {
|
|
1145
|
+
const a = this.resolveNameSpace(s[o][1]), c = s[o][4];
|
|
1146
|
+
if (a.length && c !== void 0) {
|
|
1147
|
+
let h = c;
|
|
1148
|
+
this.options.trimValues && (h = h.trim()), h = this.replaceEntitiesValue(h, e, this.readonlyMatcher), l[a] = h;
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
Object.keys(l).length > 0 && typeof t == "object" && t.updateCurrent && t.updateCurrent(l);
|
|
1152
|
+
for (let o = 0; o < r; o++) {
|
|
1153
|
+
const a = this.resolveNameSpace(s[o][1]), c = this.options.jPath ? t.toString() : this.readonlyMatcher;
|
|
1154
|
+
if (this.ignoreAttributesFn(a, c))
|
|
623
1155
|
continue;
|
|
624
|
-
let
|
|
625
|
-
if (
|
|
626
|
-
if (this.options.transformAttributeName && (
|
|
627
|
-
this.options.trimValues && (
|
|
628
|
-
const
|
|
629
|
-
|
|
630
|
-
|
|
1156
|
+
let h = s[o][4], d = this.options.attributeNamePrefix + a;
|
|
1157
|
+
if (a.length)
|
|
1158
|
+
if (this.options.transformAttributeName && (d = this.options.transformAttributeName(d)), d = Qt(d, this.options), h !== void 0) {
|
|
1159
|
+
this.options.trimValues && (h = h.trim()), h = this.replaceEntitiesValue(h, e, this.readonlyMatcher);
|
|
1160
|
+
const f = this.options.jPath ? t.toString() : this.readonlyMatcher, y = this.options.attributeValueProcessor(a, h, f);
|
|
1161
|
+
y == null ? i[d] = h : typeof y != typeof h || y !== h ? i[d] = y : i[d] = Ct(
|
|
1162
|
+
h,
|
|
631
1163
|
this.options.parseAttributeValue,
|
|
632
1164
|
this.options.numberParseOptions
|
|
633
1165
|
);
|
|
634
|
-
} else this.options.allowBooleanAttributes && (i[
|
|
1166
|
+
} else this.options.allowBooleanAttributes && (i[d] = !0);
|
|
635
1167
|
}
|
|
636
1168
|
if (!Object.keys(i).length)
|
|
637
1169
|
return;
|
|
638
1170
|
if (this.options.attributesGroupName) {
|
|
639
|
-
const
|
|
640
|
-
return
|
|
1171
|
+
const o = {};
|
|
1172
|
+
return o[this.options.attributesGroupName] = i, o;
|
|
641
1173
|
}
|
|
642
1174
|
return i;
|
|
643
1175
|
}
|
|
644
1176
|
}
|
|
645
|
-
const
|
|
646
|
-
|
|
1177
|
+
const De = function(n) {
|
|
1178
|
+
n = n.replace(/\r\n?/g, `
|
|
647
1179
|
`);
|
|
648
|
-
const
|
|
649
|
-
let
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
1180
|
+
const t = new Q("!xml");
|
|
1181
|
+
let e = t, s = "";
|
|
1182
|
+
this.matcher.reset(), this.entityExpansionCount = 0, this.currentExpandedLength = 0;
|
|
1183
|
+
const r = new Me(this.options.processEntities);
|
|
1184
|
+
for (let i = 0; i < n.length; i++)
|
|
1185
|
+
if (n[i] === "<")
|
|
1186
|
+
if (n[i + 1] === "/") {
|
|
1187
|
+
const o = it(n, ">", i, "Closing Tag is not closed.");
|
|
1188
|
+
let a = n.substring(i + 2, o).trim();
|
|
656
1189
|
if (this.options.removeNSPrefix) {
|
|
657
|
-
const
|
|
658
|
-
|
|
1190
|
+
const h = a.indexOf(":");
|
|
1191
|
+
h !== -1 && (a = a.substr(h + 1));
|
|
659
1192
|
}
|
|
660
|
-
this.options.transformTagName
|
|
661
|
-
const
|
|
662
|
-
if (
|
|
663
|
-
throw new Error(`Unpaired tag can not be used as closing tag: </${
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
if (
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
l.add(this.options.textNodeName, ""), a.tagName !== a.tagExp && a.attrExpPresent && (l[":@"] = this.buildAttributesMap(a.tagExp, i)), this.addChild(s, l, i, o);
|
|
1193
|
+
a = St(this.options.transformTagName, a, "", this.options).tagName, e && (s = this.saveTextToParentTag(s, e, this.readonlyMatcher));
|
|
1194
|
+
const c = this.matcher.getCurrentTag();
|
|
1195
|
+
if (a && this.options.unpairedTags.indexOf(a) !== -1)
|
|
1196
|
+
throw new Error(`Unpaired tag can not be used as closing tag: </${a}>`);
|
|
1197
|
+
c && this.options.unpairedTags.indexOf(c) !== -1 && (this.matcher.pop(), this.tagsNodeStack.pop()), this.matcher.pop(), this.isCurrentNodeStopNode = !1, e = this.tagsNodeStack.pop(), s = "", i = o;
|
|
1198
|
+
} else if (n[i + 1] === "?") {
|
|
1199
|
+
let o = kt(n, i, !1, "?>");
|
|
1200
|
+
if (!o) throw new Error("Pi Tag is not closed.");
|
|
1201
|
+
if (s = this.saveTextToParentTag(s, e, this.readonlyMatcher), !(this.options.ignoreDeclaration && o.tagName === "?xml" || this.options.ignorePiTags)) {
|
|
1202
|
+
const a = new Q(o.tagName);
|
|
1203
|
+
a.add(this.options.textNodeName, ""), o.tagName !== o.tagExp && o.attrExpPresent && (a[":@"] = this.buildAttributesMap(o.tagExp, this.matcher, o.tagName)), this.addChild(e, a, this.readonlyMatcher, i);
|
|
672
1204
|
}
|
|
673
|
-
|
|
674
|
-
} else if (
|
|
675
|
-
const
|
|
1205
|
+
i = o.closeIndex + 1;
|
|
1206
|
+
} else if (n.substr(i + 1, 3) === "!--") {
|
|
1207
|
+
const o = it(n, "-->", i + 4, "Comment is not closed.");
|
|
676
1208
|
if (this.options.commentPropName) {
|
|
677
|
-
const
|
|
678
|
-
|
|
1209
|
+
const a = n.substring(i + 4, o - 2);
|
|
1210
|
+
s = this.saveTextToParentTag(s, e, this.readonlyMatcher), e.add(this.options.commentPropName, [{ [this.options.textNodeName]: a }]);
|
|
679
1211
|
}
|
|
680
|
-
|
|
681
|
-
} else if (
|
|
682
|
-
const
|
|
683
|
-
this.docTypeEntities =
|
|
684
|
-
} else if (
|
|
685
|
-
const
|
|
686
|
-
|
|
687
|
-
let
|
|
688
|
-
|
|
1212
|
+
i = o;
|
|
1213
|
+
} else if (n.substr(i + 1, 2) === "!D") {
|
|
1214
|
+
const o = r.readDocType(n, i);
|
|
1215
|
+
this.docTypeEntities = o.entities, i = o.i;
|
|
1216
|
+
} else if (n.substr(i + 1, 2) === "![") {
|
|
1217
|
+
const o = it(n, "]]>", i, "CDATA is not closed.") - 2, a = n.substring(i + 9, o);
|
|
1218
|
+
s = this.saveTextToParentTag(s, e, this.readonlyMatcher);
|
|
1219
|
+
let c = this.parseTextData(a, e.tagname, this.readonlyMatcher, !0, !1, !0, !0);
|
|
1220
|
+
c == null && (c = ""), this.options.cdataPropName ? e.add(this.options.cdataPropName, [{ [this.options.textNodeName]: a }]) : e.add(this.options.textNodeName, c), i = o + 2;
|
|
689
1221
|
} else {
|
|
690
|
-
let
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
const S = this.options.transformTagName(l);
|
|
695
|
-
d === l && (d = S), l = S;
|
|
1222
|
+
let o = kt(n, i, this.options.removeNSPrefix);
|
|
1223
|
+
if (!o) {
|
|
1224
|
+
const _ = n.substring(Math.max(0, i - 50), Math.min(n.length, i + 50));
|
|
1225
|
+
throw new Error(`readTagExp returned undefined at position ${i}. Context: "${_}"`);
|
|
696
1226
|
}
|
|
697
|
-
|
|
698
|
-
const
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
1227
|
+
let a = o.tagName;
|
|
1228
|
+
const c = o.rawTagName;
|
|
1229
|
+
let h = o.tagExp, d = o.attrExpPresent, f = o.closeIndex;
|
|
1230
|
+
if ({ tagName: a, tagExp: h } = St(this.options.transformTagName, a, h, this.options), this.options.strictReservedNames && (a === this.options.commentPropName || a === this.options.cdataPropName || a === this.options.textNodeName || a === this.options.attributesGroupName))
|
|
1231
|
+
throw new Error(`Invalid tag name: ${a}`);
|
|
1232
|
+
e && s && e.tagname !== "!xml" && (s = this.saveTextToParentTag(s, e, this.readonlyMatcher, !1));
|
|
1233
|
+
const y = e;
|
|
1234
|
+
y && this.options.unpairedTags.indexOf(y.tagname) !== -1 && (e = this.tagsNodeStack.pop(), this.matcher.pop());
|
|
1235
|
+
let C = !1;
|
|
1236
|
+
h.length > 0 && h.lastIndexOf("/") === h.length - 1 && (C = !0, a[a.length - 1] === "/" ? (a = a.substr(0, a.length - 1), h = a) : h = h.substr(0, h.length - 1), d = a !== h);
|
|
1237
|
+
let E = null, L;
|
|
1238
|
+
L = ze(c), a !== t.tagname && this.matcher.push(a, {}, L), a !== h && d && (E = this.buildAttributesMap(h, this.matcher, a), E && Ge(E, this.options)), a !== t.tagname && (this.isCurrentNodeStopNode = this.isItStopNode(this.stopNodeExpressions, this.matcher));
|
|
1239
|
+
const X = i;
|
|
1240
|
+
if (this.isCurrentNodeStopNode) {
|
|
1241
|
+
let _ = "";
|
|
1242
|
+
if (C)
|
|
1243
|
+
i = o.closeIndex;
|
|
1244
|
+
else if (this.options.unpairedTags.indexOf(a) !== -1)
|
|
1245
|
+
i = o.closeIndex;
|
|
707
1246
|
else {
|
|
708
|
-
const
|
|
709
|
-
if (!
|
|
710
|
-
|
|
1247
|
+
const q = this.readStopNodeData(n, c, f + 1);
|
|
1248
|
+
if (!q) throw new Error(`Unexpected end of ${c}`);
|
|
1249
|
+
i = q.i, _ = q.tagContent;
|
|
711
1250
|
}
|
|
712
|
-
const
|
|
713
|
-
|
|
714
|
-
d,
|
|
715
|
-
i
|
|
716
|
-
)), S && (S = this.parseTextData(S, l, i, !0, f, !0, !0)), i = i.substr(0, i.lastIndexOf(".")), F.add(this.options.textNodeName, S), this.addChild(s, F, i, V);
|
|
1251
|
+
const G = new Q(a);
|
|
1252
|
+
E && (G[":@"] = E), G.add(this.options.textNodeName, _), this.matcher.pop(), this.isCurrentNodeStopNode = !1, this.addChild(e, G, this.readonlyMatcher, X);
|
|
717
1253
|
} else {
|
|
718
|
-
if (
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
const
|
|
724
|
-
|
|
1254
|
+
if (C) {
|
|
1255
|
+
({ tagName: a, tagExp: h } = St(this.options.transformTagName, a, h, this.options));
|
|
1256
|
+
const _ = new Q(a);
|
|
1257
|
+
E && (_[":@"] = E), this.addChild(e, _, this.readonlyMatcher, X), this.matcher.pop(), this.isCurrentNodeStopNode = !1;
|
|
1258
|
+
} else if (this.options.unpairedTags.indexOf(a) !== -1) {
|
|
1259
|
+
const _ = new Q(a);
|
|
1260
|
+
E && (_[":@"] = E), this.addChild(e, _, this.readonlyMatcher, X), this.matcher.pop(), this.isCurrentNodeStopNode = !1, i = o.closeIndex;
|
|
1261
|
+
continue;
|
|
725
1262
|
} else {
|
|
726
|
-
const
|
|
727
|
-
this.tagsNodeStack.
|
|
1263
|
+
const _ = new Q(a);
|
|
1264
|
+
if (this.tagsNodeStack.length > this.options.maxNestedTags)
|
|
1265
|
+
throw new Error("Maximum nested tags exceeded");
|
|
1266
|
+
this.tagsNodeStack.push(e), E && (_[":@"] = E), this.addChild(e, _, this.readonlyMatcher, X), e = _;
|
|
728
1267
|
}
|
|
729
|
-
|
|
1268
|
+
s = "", i = f;
|
|
730
1269
|
}
|
|
731
1270
|
}
|
|
732
1271
|
else
|
|
733
|
-
|
|
734
|
-
return
|
|
1272
|
+
s += n[i];
|
|
1273
|
+
return t.child;
|
|
735
1274
|
};
|
|
736
|
-
function
|
|
737
|
-
this.options.captureMetaData || (
|
|
738
|
-
const i = this.options.updateTag(
|
|
739
|
-
i === !1 || (typeof i == "string" && (
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
1275
|
+
function tn(n, t, e, s) {
|
|
1276
|
+
this.options.captureMetaData || (s = void 0);
|
|
1277
|
+
const r = this.options.jPath ? e.toString() : e, i = this.options.updateTag(t.tagname, r, t[":@"]);
|
|
1278
|
+
i === !1 || (typeof i == "string" && (t.tagname = i), n.addChild(t, s));
|
|
1279
|
+
}
|
|
1280
|
+
function en(n, t, e) {
|
|
1281
|
+
const s = this.options.processEntities;
|
|
1282
|
+
if (!s || !s.enabled)
|
|
1283
|
+
return n;
|
|
1284
|
+
if (s.allowedTags) {
|
|
1285
|
+
const r = this.options.jPath ? e.toString() : e;
|
|
1286
|
+
if (!(Array.isArray(s.allowedTags) ? s.allowedTags.includes(t) : s.allowedTags(t, r)))
|
|
1287
|
+
return n;
|
|
1288
|
+
}
|
|
1289
|
+
if (s.tagFilter) {
|
|
1290
|
+
const r = this.options.jPath ? e.toString() : e;
|
|
1291
|
+
if (!s.tagFilter(t, r))
|
|
1292
|
+
return n;
|
|
1293
|
+
}
|
|
1294
|
+
for (const r of Object.keys(this.docTypeEntities)) {
|
|
1295
|
+
const i = this.docTypeEntities[r], l = n.match(i.regx);
|
|
1296
|
+
if (l) {
|
|
1297
|
+
if (this.entityExpansionCount += l.length, s.maxTotalExpansions && this.entityExpansionCount > s.maxTotalExpansions)
|
|
1298
|
+
throw new Error(
|
|
1299
|
+
`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${s.maxTotalExpansions}`
|
|
1300
|
+
);
|
|
1301
|
+
const o = n.length;
|
|
1302
|
+
if (n = n.replace(i.regx, i.val), s.maxExpandedLength && (this.currentExpandedLength += n.length - o, this.currentExpandedLength > s.maxExpandedLength))
|
|
1303
|
+
throw new Error(
|
|
1304
|
+
`Total expanded content size exceeded: ${this.currentExpandedLength} > ${s.maxExpandedLength}`
|
|
1305
|
+
);
|
|
750
1306
|
}
|
|
751
|
-
if (this.options.htmlEntities)
|
|
752
|
-
for (let e in this.htmlEntities) {
|
|
753
|
-
const s = this.htmlEntities[e];
|
|
754
|
-
t = t.replace(s.regex, s.val);
|
|
755
|
-
}
|
|
756
|
-
t = t.replace(this.ampEntity.regex, this.ampEntity.val);
|
|
757
1307
|
}
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
1308
|
+
for (const r of Object.keys(this.lastEntities)) {
|
|
1309
|
+
const i = this.lastEntities[r], l = n.match(i.regex);
|
|
1310
|
+
if (l && (this.entityExpansionCount += l.length, s.maxTotalExpansions && this.entityExpansionCount > s.maxTotalExpansions))
|
|
1311
|
+
throw new Error(
|
|
1312
|
+
`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${s.maxTotalExpansions}`
|
|
1313
|
+
);
|
|
1314
|
+
n = n.replace(i.regex, i.val);
|
|
1315
|
+
}
|
|
1316
|
+
if (n.indexOf("&") === -1) return n;
|
|
1317
|
+
if (this.options.htmlEntities)
|
|
1318
|
+
for (const r of Object.keys(this.htmlEntities)) {
|
|
1319
|
+
const i = this.htmlEntities[r], l = n.match(i.regex);
|
|
1320
|
+
if (l && (this.entityExpansionCount += l.length, s.maxTotalExpansions && this.entityExpansionCount > s.maxTotalExpansions))
|
|
1321
|
+
throw new Error(
|
|
1322
|
+
`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${s.maxTotalExpansions}`
|
|
1323
|
+
);
|
|
1324
|
+
n = n.replace(i.regex, i.val);
|
|
1325
|
+
}
|
|
1326
|
+
return n = n.replace(this.ampEntity.regex, this.ampEntity.val), n;
|
|
1327
|
+
}
|
|
1328
|
+
function nn(n, t, e, s) {
|
|
1329
|
+
return n && (s === void 0 && (s = t.child.length === 0), n = this.parseTextData(
|
|
1330
|
+
n,
|
|
1331
|
+
t.tagname,
|
|
1332
|
+
e,
|
|
765
1333
|
!1,
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
),
|
|
769
|
-
}
|
|
770
|
-
function
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
1334
|
+
t[":@"] ? Object.keys(t[":@"]).length !== 0 : !1,
|
|
1335
|
+
s
|
|
1336
|
+
), n !== void 0 && n !== "" && t.add(this.options.textNodeName, n), n = ""), n;
|
|
1337
|
+
}
|
|
1338
|
+
function sn(n, t) {
|
|
1339
|
+
if (!n || n.length === 0) return !1;
|
|
1340
|
+
for (let e = 0; e < n.length; e++)
|
|
1341
|
+
if (t.matches(n[e]))
|
|
1342
|
+
return !0;
|
|
1343
|
+
return !1;
|
|
1344
|
+
}
|
|
1345
|
+
function rn(n, t, e = ">") {
|
|
1346
|
+
let s, r = "";
|
|
1347
|
+
for (let i = t; i < n.length; i++) {
|
|
1348
|
+
let l = n[i];
|
|
1349
|
+
if (s)
|
|
1350
|
+
l === s && (s = "");
|
|
1351
|
+
else if (l === '"' || l === "'")
|
|
1352
|
+
s = l;
|
|
1353
|
+
else if (l === e[0])
|
|
1354
|
+
if (e[1]) {
|
|
1355
|
+
if (n[i + 1] === e[1])
|
|
784
1356
|
return {
|
|
785
|
-
data:
|
|
786
|
-
index:
|
|
1357
|
+
data: r,
|
|
1358
|
+
index: i
|
|
787
1359
|
};
|
|
788
1360
|
} else
|
|
789
1361
|
return {
|
|
790
|
-
data:
|
|
791
|
-
index:
|
|
1362
|
+
data: r,
|
|
1363
|
+
index: i
|
|
792
1364
|
};
|
|
793
|
-
else
|
|
794
|
-
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
function
|
|
798
|
-
const
|
|
799
|
-
if (
|
|
800
|
-
throw new Error(
|
|
801
|
-
return
|
|
802
|
-
}
|
|
803
|
-
function
|
|
804
|
-
const
|
|
805
|
-
if (!
|
|
806
|
-
let
|
|
807
|
-
const
|
|
808
|
-
let a =
|
|
809
|
-
|
|
1365
|
+
else l === " " && (l = " ");
|
|
1366
|
+
r += l;
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
function it(n, t, e, s) {
|
|
1370
|
+
const r = n.indexOf(t, e);
|
|
1371
|
+
if (r === -1)
|
|
1372
|
+
throw new Error(s);
|
|
1373
|
+
return r + t.length - 1;
|
|
1374
|
+
}
|
|
1375
|
+
function kt(n, t, e, s = ">") {
|
|
1376
|
+
const r = rn(n, t + 1, s);
|
|
1377
|
+
if (!r) return;
|
|
1378
|
+
let i = r.data;
|
|
1379
|
+
const l = r.index, o = i.search(/\s/);
|
|
1380
|
+
let a = i, c = !0;
|
|
1381
|
+
o !== -1 && (a = i.substring(0, o), i = i.substring(o + 1).trimStart());
|
|
810
1382
|
const h = a;
|
|
811
|
-
if (
|
|
1383
|
+
if (e) {
|
|
812
1384
|
const d = a.indexOf(":");
|
|
813
|
-
d !== -1 && (a = a.substr(d + 1),
|
|
1385
|
+
d !== -1 && (a = a.substr(d + 1), c = a !== r.data.substr(d + 1));
|
|
814
1386
|
}
|
|
815
1387
|
return {
|
|
816
1388
|
tagName: a,
|
|
817
|
-
tagExp:
|
|
818
|
-
closeIndex:
|
|
819
|
-
attrExpPresent:
|
|
1389
|
+
tagExp: i,
|
|
1390
|
+
closeIndex: l,
|
|
1391
|
+
attrExpPresent: c,
|
|
820
1392
|
rawTagName: h
|
|
821
1393
|
};
|
|
822
1394
|
}
|
|
823
|
-
function
|
|
824
|
-
const
|
|
825
|
-
let
|
|
826
|
-
for (;
|
|
827
|
-
if (
|
|
828
|
-
if (
|
|
829
|
-
const
|
|
830
|
-
if (
|
|
1395
|
+
function on(n, t, e) {
|
|
1396
|
+
const s = e;
|
|
1397
|
+
let r = 1;
|
|
1398
|
+
for (; e < n.length; e++)
|
|
1399
|
+
if (n[e] === "<")
|
|
1400
|
+
if (n[e + 1] === "/") {
|
|
1401
|
+
const i = it(n, ">", e, `${t} is not closed`);
|
|
1402
|
+
if (n.substring(e + 2, i).trim() === t && (r--, r === 0))
|
|
831
1403
|
return {
|
|
832
|
-
tagContent:
|
|
833
|
-
i
|
|
1404
|
+
tagContent: n.substring(s, e),
|
|
1405
|
+
i
|
|
834
1406
|
};
|
|
835
|
-
|
|
836
|
-
} else if (
|
|
837
|
-
|
|
838
|
-
else if (
|
|
839
|
-
|
|
840
|
-
else if (
|
|
841
|
-
|
|
1407
|
+
e = i;
|
|
1408
|
+
} else if (n[e + 1] === "?")
|
|
1409
|
+
e = it(n, "?>", e + 1, "StopNode is not closed.");
|
|
1410
|
+
else if (n.substr(e + 1, 3) === "!--")
|
|
1411
|
+
e = it(n, "-->", e + 3, "StopNode is not closed.");
|
|
1412
|
+
else if (n.substr(e + 1, 2) === "![")
|
|
1413
|
+
e = it(n, "]]>", e, "StopNode is not closed.") - 2;
|
|
842
1414
|
else {
|
|
843
|
-
const
|
|
844
|
-
|
|
1415
|
+
const i = kt(n, e, ">");
|
|
1416
|
+
i && ((i && i.tagName) === t && i.tagExp[i.tagExp.length - 1] !== "/" && r++, e = i.closeIndex);
|
|
845
1417
|
}
|
|
846
1418
|
}
|
|
847
|
-
function
|
|
848
|
-
if (
|
|
849
|
-
const
|
|
850
|
-
return
|
|
1419
|
+
function Ct(n, t, e) {
|
|
1420
|
+
if (t && typeof n == "string") {
|
|
1421
|
+
const s = n.trim();
|
|
1422
|
+
return s === "true" ? !0 : s === "false" ? !1 : Re(n, e);
|
|
851
1423
|
} else
|
|
852
|
-
return
|
|
1424
|
+
return ve(n) ? n : "";
|
|
1425
|
+
}
|
|
1426
|
+
function Xt(n, t, e) {
|
|
1427
|
+
const s = Number.parseInt(n, t);
|
|
1428
|
+
return s >= 0 && s <= 1114111 ? String.fromCodePoint(s) : e + n + ";";
|
|
1429
|
+
}
|
|
1430
|
+
function St(n, t, e, s) {
|
|
1431
|
+
if (n) {
|
|
1432
|
+
const r = n(t);
|
|
1433
|
+
e === t && (e = r), t = r;
|
|
1434
|
+
}
|
|
1435
|
+
return t = Qt(t, s), { tagName: t, tagExp: e };
|
|
1436
|
+
}
|
|
1437
|
+
function Qt(n, t) {
|
|
1438
|
+
if (Kt.includes(n))
|
|
1439
|
+
throw new Error(`[SECURITY] Invalid name: "${n}" is a reserved JavaScript keyword that could cause prototype pollution`);
|
|
1440
|
+
return Pt.includes(n) ? t.onDangerousProperty(n) : n;
|
|
1441
|
+
}
|
|
1442
|
+
const xt = Q.getMetaDataSymbol();
|
|
1443
|
+
function an(n, t) {
|
|
1444
|
+
if (!n || typeof n != "object") return {};
|
|
1445
|
+
if (!t) return n;
|
|
1446
|
+
const e = {};
|
|
1447
|
+
for (const s in n)
|
|
1448
|
+
if (s.startsWith(t)) {
|
|
1449
|
+
const r = s.substring(t.length);
|
|
1450
|
+
e[r] = n[s];
|
|
1451
|
+
} else
|
|
1452
|
+
e[s] = n[s];
|
|
1453
|
+
return e;
|
|
853
1454
|
}
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
return Ye(t, e);
|
|
1455
|
+
function ln(n, t, e, s) {
|
|
1456
|
+
return Dt(n, t, e, s);
|
|
857
1457
|
}
|
|
858
|
-
function
|
|
859
|
-
let
|
|
1458
|
+
function Dt(n, t, e, s) {
|
|
1459
|
+
let r;
|
|
860
1460
|
const i = {};
|
|
861
|
-
for (let
|
|
862
|
-
const o =
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
1461
|
+
for (let l = 0; l < n.length; l++) {
|
|
1462
|
+
const o = n[l], a = cn(o);
|
|
1463
|
+
if (a !== void 0 && a !== t.textNodeName) {
|
|
1464
|
+
const c = an(
|
|
1465
|
+
o[":@"] || {},
|
|
1466
|
+
t.attributeNamePrefix
|
|
1467
|
+
);
|
|
1468
|
+
e.push(a, c);
|
|
1469
|
+
}
|
|
1470
|
+
if (a === t.textNodeName)
|
|
1471
|
+
r === void 0 ? r = o[a] : r += "" + o[a];
|
|
866
1472
|
else {
|
|
867
|
-
if (
|
|
1473
|
+
if (a === void 0)
|
|
868
1474
|
continue;
|
|
869
|
-
if (o[
|
|
870
|
-
let
|
|
871
|
-
const h =
|
|
872
|
-
|
|
1475
|
+
if (o[a]) {
|
|
1476
|
+
let c = Dt(o[a], t, e, s);
|
|
1477
|
+
const h = un(c, t);
|
|
1478
|
+
if (o[":@"] ? hn(c, o[":@"], s, t) : Object.keys(c).length === 1 && c[t.textNodeName] !== void 0 && !t.alwaysCreateTextNode ? c = c[t.textNodeName] : Object.keys(c).length === 0 && (t.alwaysCreateTextNode ? c[t.textNodeName] = "" : c = ""), o[xt] !== void 0 && typeof c == "object" && c !== null && (c[xt] = o[xt]), i[a] !== void 0 && Object.prototype.hasOwnProperty.call(i, a))
|
|
1479
|
+
Array.isArray(i[a]) || (i[a] = [i[a]]), i[a].push(c);
|
|
1480
|
+
else {
|
|
1481
|
+
const d = t.jPath ? s.toString() : s;
|
|
1482
|
+
t.isArray(a, d, h) ? i[a] = [c] : i[a] = c;
|
|
1483
|
+
}
|
|
1484
|
+
a !== void 0 && a !== t.textNodeName && e.pop();
|
|
873
1485
|
}
|
|
874
1486
|
}
|
|
875
1487
|
}
|
|
876
|
-
return typeof
|
|
1488
|
+
return typeof r == "string" ? r.length > 0 && (i[t.textNodeName] = r) : r !== void 0 && (i[t.textNodeName] = r), i;
|
|
877
1489
|
}
|
|
878
|
-
function
|
|
879
|
-
const
|
|
880
|
-
for (let
|
|
881
|
-
const
|
|
882
|
-
if (
|
|
1490
|
+
function cn(n) {
|
|
1491
|
+
const t = Object.keys(n);
|
|
1492
|
+
for (let e = 0; e < t.length; e++) {
|
|
1493
|
+
const s = t[e];
|
|
1494
|
+
if (s !== ":@") return s;
|
|
883
1495
|
}
|
|
884
1496
|
}
|
|
885
|
-
function
|
|
886
|
-
if (
|
|
887
|
-
const
|
|
888
|
-
for (let
|
|
889
|
-
const
|
|
890
|
-
|
|
1497
|
+
function hn(n, t, e, s) {
|
|
1498
|
+
if (t) {
|
|
1499
|
+
const r = Object.keys(t), i = r.length;
|
|
1500
|
+
for (let l = 0; l < i; l++) {
|
|
1501
|
+
const o = r[l], a = o.startsWith(s.attributeNamePrefix) ? o.substring(s.attributeNamePrefix.length) : o, c = s.jPath ? e.toString() + "." + a : e;
|
|
1502
|
+
s.isArray(o, c, !0, !0) ? n[o] = [t[o]] : n[o] = t[o];
|
|
891
1503
|
}
|
|
892
1504
|
}
|
|
893
1505
|
}
|
|
894
|
-
function
|
|
895
|
-
const { textNodeName:
|
|
896
|
-
return !!(
|
|
1506
|
+
function un(n, t) {
|
|
1507
|
+
const { textNodeName: e } = t, s = Object.keys(n).length;
|
|
1508
|
+
return !!(s === 0 || s === 1 && (n[e] || typeof n[e] == "boolean" || n[e] === 0));
|
|
897
1509
|
}
|
|
898
|
-
class
|
|
899
|
-
constructor(
|
|
900
|
-
this.externalEntities = {}, this.options =
|
|
1510
|
+
class te {
|
|
1511
|
+
constructor(t) {
|
|
1512
|
+
this.externalEntities = {}, this.options = $e(t);
|
|
901
1513
|
}
|
|
902
1514
|
/**
|
|
903
1515
|
* Parse XML dats to JS object
|
|
904
1516
|
* @param {string|Uint8Array} xmlData
|
|
905
1517
|
* @param {boolean|Object} validationOption
|
|
906
1518
|
*/
|
|
907
|
-
parse(
|
|
908
|
-
if (typeof
|
|
909
|
-
|
|
910
|
-
else if (typeof
|
|
1519
|
+
parse(t, e) {
|
|
1520
|
+
if (typeof t != "string" && t.toString)
|
|
1521
|
+
t = t.toString();
|
|
1522
|
+
else if (typeof t != "string")
|
|
911
1523
|
throw new Error("XML data is accepted in String or Bytes[] form.");
|
|
912
|
-
if (
|
|
913
|
-
|
|
914
|
-
const
|
|
915
|
-
if (
|
|
916
|
-
throw Error(`${
|
|
1524
|
+
if (e) {
|
|
1525
|
+
e === !0 && (e = {});
|
|
1526
|
+
const i = Ne(t, e);
|
|
1527
|
+
if (i !== !0)
|
|
1528
|
+
throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`);
|
|
917
1529
|
}
|
|
918
|
-
const
|
|
919
|
-
|
|
920
|
-
const
|
|
921
|
-
return this.options.preserveOrder ||
|
|
1530
|
+
const s = new He(this.options);
|
|
1531
|
+
s.addExternalEntities(this.externalEntities);
|
|
1532
|
+
const r = s.parseXml(t);
|
|
1533
|
+
return this.options.preserveOrder || r === void 0 ? r : ln(r, this.options, s.matcher, s.readonlyMatcher);
|
|
922
1534
|
}
|
|
923
1535
|
/**
|
|
924
1536
|
* Add Entity which is not by default supported by this library
|
|
925
1537
|
* @param {string} key
|
|
926
1538
|
* @param {string} value
|
|
927
1539
|
*/
|
|
928
|
-
addEntity(
|
|
929
|
-
if (
|
|
1540
|
+
addEntity(t, e) {
|
|
1541
|
+
if (e.indexOf("&") !== -1)
|
|
930
1542
|
throw new Error("Entity value can't have '&'");
|
|
931
|
-
if (
|
|
1543
|
+
if (t.indexOf("&") !== -1 || t.indexOf(";") !== -1)
|
|
932
1544
|
throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");
|
|
933
|
-
if (
|
|
1545
|
+
if (e === "&")
|
|
934
1546
|
throw new Error("An entity with value '&' is not permitted");
|
|
935
|
-
this.externalEntities[
|
|
1547
|
+
this.externalEntities[t] = e;
|
|
936
1548
|
}
|
|
937
1549
|
/**
|
|
938
1550
|
* Returns a Symbol that can be used to access the metadata
|
|
@@ -945,78 +1557,149 @@ class _e {
|
|
|
945
1557
|
* is true in the options.
|
|
946
1558
|
*/
|
|
947
1559
|
static getMetaDataSymbol() {
|
|
948
|
-
return
|
|
1560
|
+
return Q.getMetaDataSymbol();
|
|
949
1561
|
}
|
|
950
1562
|
}
|
|
951
|
-
const
|
|
1563
|
+
const dn = `
|
|
952
1564
|
`;
|
|
953
|
-
function
|
|
954
|
-
let
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
1565
|
+
function fn(n, t) {
|
|
1566
|
+
let e = "";
|
|
1567
|
+
t.format && t.indentBy.length > 0 && (e = dn);
|
|
1568
|
+
const s = [];
|
|
1569
|
+
if (t.stopNodes && Array.isArray(t.stopNodes))
|
|
1570
|
+
for (let i = 0; i < t.stopNodes.length; i++) {
|
|
1571
|
+
const l = t.stopNodes[i];
|
|
1572
|
+
typeof l == "string" ? s.push(new ut(l)) : l instanceof ut && s.push(l);
|
|
1573
|
+
}
|
|
1574
|
+
const r = new Tt();
|
|
1575
|
+
return ee(n, t, e, r, s);
|
|
1576
|
+
}
|
|
1577
|
+
function ee(n, t, e, s, r) {
|
|
1578
|
+
let i = "", l = !1;
|
|
1579
|
+
if (t.maxNestedTags && s.getDepth() > t.maxNestedTags)
|
|
1580
|
+
throw new Error("Maximum nested tags exceeded");
|
|
1581
|
+
if (!Array.isArray(n)) {
|
|
1582
|
+
if (n != null) {
|
|
1583
|
+
let o = n.toString();
|
|
1584
|
+
return o = _t(o, t), o;
|
|
1585
|
+
}
|
|
1586
|
+
return "";
|
|
1587
|
+
}
|
|
1588
|
+
for (let o = 0; o < n.length; o++) {
|
|
1589
|
+
const a = n[o], c = se(a);
|
|
1590
|
+
if (c === void 0) continue;
|
|
1591
|
+
const h = pn(a[":@"], t);
|
|
1592
|
+
s.push(c, h);
|
|
1593
|
+
const d = mn(s, r);
|
|
1594
|
+
if (c === t.textNodeName) {
|
|
1595
|
+
let L = a[c];
|
|
1596
|
+
d || (L = t.tagValueProcessor(c, L), L = _t(L, t)), l && (i += e), i += L, l = !1, s.pop();
|
|
966
1597
|
continue;
|
|
967
|
-
} else if (
|
|
968
|
-
|
|
1598
|
+
} else if (c === t.cdataPropName) {
|
|
1599
|
+
l && (i += e), i += `<![CDATA[${a[c][0][t.textNodeName]}]]>`, l = !1, s.pop();
|
|
969
1600
|
continue;
|
|
970
|
-
} else if (
|
|
971
|
-
i +=
|
|
1601
|
+
} else if (c === t.commentPropName) {
|
|
1602
|
+
i += e + `<!--${a[c][0][t.textNodeName]}-->`, l = !0, s.pop();
|
|
972
1603
|
continue;
|
|
973
|
-
} else if (
|
|
974
|
-
const
|
|
975
|
-
let
|
|
976
|
-
|
|
1604
|
+
} else if (c[0] === "?") {
|
|
1605
|
+
const L = Ut(a[":@"], t, d), X = c === "?xml" ? "" : e;
|
|
1606
|
+
let _ = a[c][0][t.textNodeName];
|
|
1607
|
+
_ = _.length !== 0 ? " " + _ : "", i += X + `<${c}${_}${L}?>`, l = !0, s.pop();
|
|
977
1608
|
continue;
|
|
978
1609
|
}
|
|
979
|
-
let
|
|
980
|
-
|
|
981
|
-
const
|
|
982
|
-
|
|
1610
|
+
let f = e;
|
|
1611
|
+
f !== "" && (f += t.indentBy);
|
|
1612
|
+
const y = Ut(a[":@"], t, d), C = e + `<${c}${y}`;
|
|
1613
|
+
let E;
|
|
1614
|
+
d ? E = ne(a[c], t) : E = ee(a[c], t, f, s, r), t.unpairedTags.indexOf(c) !== -1 ? t.suppressUnpairedNode ? i += C + ">" : i += C + "/>" : (!E || E.length === 0) && t.suppressEmptyNode ? i += C + "/>" : E && E.endsWith(">") ? i += C + `>${E}${e}</${c}>` : (i += C + ">", E && e !== "" && (E.includes("/>") || E.includes("</")) ? i += e + t.indentBy + E + e : i += E, i += `</${c}>`), l = !0, s.pop();
|
|
983
1615
|
}
|
|
984
1616
|
return i;
|
|
985
1617
|
}
|
|
986
|
-
function
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
1618
|
+
function pn(n, t) {
|
|
1619
|
+
if (!n || t.ignoreAttributes) return null;
|
|
1620
|
+
const e = {};
|
|
1621
|
+
let s = !1;
|
|
1622
|
+
for (let r in n) {
|
|
1623
|
+
if (!Object.prototype.hasOwnProperty.call(n, r)) continue;
|
|
1624
|
+
const i = r.startsWith(t.attributeNamePrefix) ? r.substr(t.attributeNamePrefix.length) : r;
|
|
1625
|
+
e[i] = n[r], s = !0;
|
|
1626
|
+
}
|
|
1627
|
+
return s ? e : null;
|
|
1628
|
+
}
|
|
1629
|
+
function ne(n, t) {
|
|
1630
|
+
if (!Array.isArray(n))
|
|
1631
|
+
return n != null ? n.toString() : "";
|
|
1632
|
+
let e = "";
|
|
1633
|
+
for (let s = 0; s < n.length; s++) {
|
|
1634
|
+
const r = n[s], i = se(r);
|
|
1635
|
+
if (i === t.textNodeName)
|
|
1636
|
+
e += r[i];
|
|
1637
|
+
else if (i === t.cdataPropName)
|
|
1638
|
+
e += r[i][0][t.textNodeName];
|
|
1639
|
+
else if (i === t.commentPropName)
|
|
1640
|
+
e += r[i][0][t.textNodeName];
|
|
1641
|
+
else {
|
|
1642
|
+
if (i && i[0] === "?")
|
|
1643
|
+
continue;
|
|
1644
|
+
if (i) {
|
|
1645
|
+
const l = gn(r[":@"], t), o = ne(r[i], t);
|
|
1646
|
+
!o || o.length === 0 ? e += `<${i}${l}/>` : e += `<${i}${l}>${o}</${i}>`;
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
return e;
|
|
1651
|
+
}
|
|
1652
|
+
function gn(n, t) {
|
|
1653
|
+
let e = "";
|
|
1654
|
+
if (n && !t.ignoreAttributes)
|
|
1655
|
+
for (let s in n) {
|
|
1656
|
+
if (!Object.prototype.hasOwnProperty.call(n, s)) continue;
|
|
1657
|
+
let r = n[s];
|
|
1658
|
+
r === !0 && t.suppressBooleanAttributes ? e += ` ${s.substr(t.attributeNamePrefix.length)}` : e += ` ${s.substr(t.attributeNamePrefix.length)}="${r}"`;
|
|
1659
|
+
}
|
|
1660
|
+
return e;
|
|
1661
|
+
}
|
|
1662
|
+
function se(n) {
|
|
1663
|
+
const t = Object.keys(n);
|
|
1664
|
+
for (let e = 0; e < t.length; e++) {
|
|
1665
|
+
const s = t[e];
|
|
1666
|
+
if (Object.prototype.hasOwnProperty.call(n, s) && s !== ":@")
|
|
1667
|
+
return s;
|
|
992
1668
|
}
|
|
993
1669
|
}
|
|
994
|
-
function
|
|
1670
|
+
function Ut(n, t, e) {
|
|
995
1671
|
let s = "";
|
|
996
|
-
if (
|
|
997
|
-
for (let
|
|
998
|
-
if (!
|
|
999
|
-
let i
|
|
1000
|
-
i =
|
|
1672
|
+
if (n && !t.ignoreAttributes)
|
|
1673
|
+
for (let r in n) {
|
|
1674
|
+
if (!Object.prototype.hasOwnProperty.call(n, r)) continue;
|
|
1675
|
+
let i;
|
|
1676
|
+
e ? i = n[r] : (i = t.attributeValueProcessor(r, n[r]), i = _t(i, t)), i === !0 && t.suppressBooleanAttributes ? s += ` ${r.substr(t.attributeNamePrefix.length)}` : s += ` ${r.substr(t.attributeNamePrefix.length)}="${i}"`;
|
|
1001
1677
|
}
|
|
1002
1678
|
return s;
|
|
1003
1679
|
}
|
|
1004
|
-
function
|
|
1005
|
-
t
|
|
1006
|
-
let
|
|
1007
|
-
|
|
1008
|
-
|
|
1680
|
+
function mn(n, t) {
|
|
1681
|
+
if (!t || t.length === 0) return !1;
|
|
1682
|
+
for (let e = 0; e < t.length; e++)
|
|
1683
|
+
if (n.matches(t[e]))
|
|
1684
|
+
return !0;
|
|
1009
1685
|
return !1;
|
|
1010
1686
|
}
|
|
1011
|
-
function
|
|
1012
|
-
if (
|
|
1013
|
-
for (let
|
|
1014
|
-
const
|
|
1015
|
-
|
|
1687
|
+
function _t(n, t) {
|
|
1688
|
+
if (n && n.length > 0 && t.processEntities)
|
|
1689
|
+
for (let e = 0; e < t.entities.length; e++) {
|
|
1690
|
+
const s = t.entities[e];
|
|
1691
|
+
n = n.replace(s.regex, s.val);
|
|
1016
1692
|
}
|
|
1017
|
-
return
|
|
1693
|
+
return n;
|
|
1018
1694
|
}
|
|
1019
|
-
|
|
1695
|
+
function yn(n) {
|
|
1696
|
+
return typeof n == "function" ? n : Array.isArray(n) ? (t) => {
|
|
1697
|
+
for (const e of n)
|
|
1698
|
+
if (typeof e == "string" && t === e || e instanceof RegExp && e.test(t))
|
|
1699
|
+
return !0;
|
|
1700
|
+
} : () => !1;
|
|
1701
|
+
}
|
|
1702
|
+
const bn = {
|
|
1020
1703
|
attributeNamePrefix: "@_",
|
|
1021
1704
|
attributesGroupName: !1,
|
|
1022
1705
|
textNodeName: "#text",
|
|
@@ -1027,11 +1710,11 @@ const Jt = {
|
|
|
1027
1710
|
suppressEmptyNode: !1,
|
|
1028
1711
|
suppressUnpairedNode: !0,
|
|
1029
1712
|
suppressBooleanAttributes: !0,
|
|
1030
|
-
tagValueProcessor: function(
|
|
1031
|
-
return
|
|
1713
|
+
tagValueProcessor: function(n, t) {
|
|
1714
|
+
return t;
|
|
1032
1715
|
},
|
|
1033
|
-
attributeValueProcessor: function(
|
|
1034
|
-
return
|
|
1716
|
+
attributeValueProcessor: function(n, t) {
|
|
1717
|
+
return t;
|
|
1035
1718
|
},
|
|
1036
1719
|
preserveOrder: !1,
|
|
1037
1720
|
commentPropName: !1,
|
|
@@ -1048,126 +1731,238 @@ const Jt = {
|
|
|
1048
1731
|
stopNodes: [],
|
|
1049
1732
|
// transformTagName: false,
|
|
1050
1733
|
// transformAttributeName: false,
|
|
1051
|
-
oneListGroup: !1
|
|
1734
|
+
oneListGroup: !1,
|
|
1735
|
+
maxNestedTags: 100,
|
|
1736
|
+
jPath: !0
|
|
1737
|
+
// When true, callbacks receive string jPath; when false, receive Matcher instance
|
|
1052
1738
|
};
|
|
1053
|
-
function
|
|
1054
|
-
this.options = Object.assign({},
|
|
1739
|
+
function F(n) {
|
|
1740
|
+
if (this.options = Object.assign({}, bn, n), this.options.stopNodes && Array.isArray(this.options.stopNodes) && (this.options.stopNodes = this.options.stopNodes.map((t) => typeof t == "string" && t.startsWith("*.") ? ".." + t.substring(2) : t)), this.stopNodeExpressions = [], this.options.stopNodes && Array.isArray(this.options.stopNodes))
|
|
1741
|
+
for (let t = 0; t < this.options.stopNodes.length; t++) {
|
|
1742
|
+
const e = this.options.stopNodes[t];
|
|
1743
|
+
typeof e == "string" ? this.stopNodeExpressions.push(new ut(e)) : e instanceof ut && this.stopNodeExpressions.push(e);
|
|
1744
|
+
}
|
|
1745
|
+
this.options.ignoreAttributes === !0 || this.options.attributesGroupName ? this.isAttribute = function() {
|
|
1055
1746
|
return !1;
|
|
1056
|
-
} : (this.ignoreAttributesFn =
|
|
1747
|
+
} : (this.ignoreAttributesFn = yn(this.options.ignoreAttributes), this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = Nn), this.processTextOrObjNode = vn, this.options.format ? (this.indentate = En, this.tagEndChar = `>
|
|
1057
1748
|
`, this.newLine = `
|
|
1058
1749
|
`) : (this.indentate = function() {
|
|
1059
1750
|
return "";
|
|
1060
1751
|
}, this.tagEndChar = ">", this.newLine = "");
|
|
1061
1752
|
}
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1753
|
+
F.prototype.build = function(n) {
|
|
1754
|
+
if (this.options.preserveOrder)
|
|
1755
|
+
return fn(n, this.options);
|
|
1756
|
+
{
|
|
1757
|
+
Array.isArray(n) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (n = {
|
|
1758
|
+
[this.options.arrayNodeName]: n
|
|
1759
|
+
});
|
|
1760
|
+
const t = new Tt();
|
|
1761
|
+
return this.j2x(n, 0, t).val;
|
|
1762
|
+
}
|
|
1066
1763
|
};
|
|
1067
|
-
|
|
1068
|
-
let
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
this.isAttribute(o)
|
|
1076
|
-
else if (
|
|
1077
|
-
|
|
1078
|
-
else if (
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1764
|
+
F.prototype.j2x = function(n, t, e) {
|
|
1765
|
+
let s = "", r = "";
|
|
1766
|
+
if (this.options.maxNestedTags && e.getDepth() >= this.options.maxNestedTags)
|
|
1767
|
+
throw new Error("Maximum nested tags exceeded");
|
|
1768
|
+
const i = this.options.jPath ? e.toString() : e, l = this.checkStopNode(e);
|
|
1769
|
+
for (let o in n)
|
|
1770
|
+
if (Object.prototype.hasOwnProperty.call(n, o))
|
|
1771
|
+
if (typeof n[o] > "u")
|
|
1772
|
+
this.isAttribute(o) && (r += "");
|
|
1773
|
+
else if (n[o] === null)
|
|
1774
|
+
this.isAttribute(o) || o === this.options.cdataPropName ? r += "" : o[0] === "?" ? r += this.indentate(t) + "<" + o + "?" + this.tagEndChar : r += this.indentate(t) + "<" + o + "/" + this.tagEndChar;
|
|
1775
|
+
else if (n[o] instanceof Date)
|
|
1776
|
+
r += this.buildTextValNode(n[o], o, "", t, e);
|
|
1777
|
+
else if (typeof n[o] != "object") {
|
|
1778
|
+
const a = this.isAttribute(o);
|
|
1779
|
+
if (a && !this.ignoreAttributesFn(a, i))
|
|
1780
|
+
s += this.buildAttrPairStr(a, "" + n[o], l);
|
|
1781
|
+
else if (!a)
|
|
1083
1782
|
if (o === this.options.textNodeName) {
|
|
1084
|
-
let
|
|
1085
|
-
|
|
1086
|
-
} else
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1783
|
+
let c = this.options.tagValueProcessor(o, "" + n[o]);
|
|
1784
|
+
r += this.replaceEntitiesValue(c);
|
|
1785
|
+
} else {
|
|
1786
|
+
e.push(o);
|
|
1787
|
+
const c = this.checkStopNode(e);
|
|
1788
|
+
if (e.pop(), c) {
|
|
1789
|
+
const h = "" + n[o];
|
|
1790
|
+
h === "" ? r += this.indentate(t) + "<" + o + this.closeTag(o) + this.tagEndChar : r += this.indentate(t) + "<" + o + ">" + h + "</" + o + this.tagEndChar;
|
|
1791
|
+
} else
|
|
1792
|
+
r += this.buildTextValNode(n[o], o, "", t, e);
|
|
1793
|
+
}
|
|
1794
|
+
} else if (Array.isArray(n[o])) {
|
|
1795
|
+
const a = n[o].length;
|
|
1796
|
+
let c = "", h = "";
|
|
1797
|
+
for (let d = 0; d < a; d++) {
|
|
1798
|
+
const f = n[o][d];
|
|
1799
|
+
if (!(typeof f > "u")) if (f === null)
|
|
1800
|
+
o[0] === "?" ? r += this.indentate(t) + "<" + o + "?" + this.tagEndChar : r += this.indentate(t) + "<" + o + "/" + this.tagEndChar;
|
|
1801
|
+
else if (typeof f == "object")
|
|
1096
1802
|
if (this.options.oneListGroup) {
|
|
1097
|
-
|
|
1098
|
-
|
|
1803
|
+
e.push(o);
|
|
1804
|
+
const y = this.j2x(f, t + 1, e);
|
|
1805
|
+
e.pop(), c += y.val, this.options.attributesGroupName && f.hasOwnProperty(this.options.attributesGroupName) && (h += y.attrStr);
|
|
1099
1806
|
} else
|
|
1100
|
-
|
|
1807
|
+
c += this.processTextOrObjNode(f, o, t, e);
|
|
1101
1808
|
else if (this.options.oneListGroup) {
|
|
1102
|
-
let
|
|
1103
|
-
|
|
1104
|
-
} else
|
|
1105
|
-
|
|
1809
|
+
let y = this.options.tagValueProcessor(o, f);
|
|
1810
|
+
y = this.replaceEntitiesValue(y), c += y;
|
|
1811
|
+
} else {
|
|
1812
|
+
e.push(o);
|
|
1813
|
+
const y = this.checkStopNode(e);
|
|
1814
|
+
if (e.pop(), y) {
|
|
1815
|
+
const C = "" + f;
|
|
1816
|
+
C === "" ? c += this.indentate(t) + "<" + o + this.closeTag(o) + this.tagEndChar : c += this.indentate(t) + "<" + o + ">" + C + "</" + o + this.tagEndChar;
|
|
1817
|
+
} else
|
|
1818
|
+
c += this.buildTextValNode(f, o, "", t, e);
|
|
1819
|
+
}
|
|
1106
1820
|
}
|
|
1107
|
-
this.options.oneListGroup && (
|
|
1821
|
+
this.options.oneListGroup && (c = this.buildObjectNode(c, o, h, t)), r += c;
|
|
1108
1822
|
} else if (this.options.attributesGroupName && o === this.options.attributesGroupName) {
|
|
1109
|
-
const
|
|
1110
|
-
for (let
|
|
1111
|
-
|
|
1823
|
+
const a = Object.keys(n[o]), c = a.length;
|
|
1824
|
+
for (let h = 0; h < c; h++)
|
|
1825
|
+
s += this.buildAttrPairStr(a[h], "" + n[o][a[h]], l);
|
|
1112
1826
|
} else
|
|
1113
|
-
|
|
1114
|
-
return { attrStr:
|
|
1827
|
+
r += this.processTextOrObjNode(n[o], o, t, e);
|
|
1828
|
+
return { attrStr: s, val: r };
|
|
1115
1829
|
};
|
|
1116
|
-
|
|
1117
|
-
return e = this.options.attributeValueProcessor(
|
|
1830
|
+
F.prototype.buildAttrPairStr = function(n, t, e) {
|
|
1831
|
+
return e || (t = this.options.attributeValueProcessor(n, "" + t), t = this.replaceEntitiesValue(t)), this.options.suppressBooleanAttributes && t === "true" ? " " + n : " " + n + '="' + t + '"';
|
|
1118
1832
|
};
|
|
1119
|
-
function
|
|
1120
|
-
const
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1833
|
+
function vn(n, t, e, s) {
|
|
1834
|
+
const r = this.extractAttributes(n);
|
|
1835
|
+
if (s.push(t, r), this.checkStopNode(s)) {
|
|
1836
|
+
const o = this.buildRawContent(n), a = this.buildAttributesForStopNode(n);
|
|
1837
|
+
return s.pop(), this.buildObjectNode(o, t, a, e);
|
|
1838
|
+
}
|
|
1839
|
+
const l = this.j2x(n, e + 1, s);
|
|
1840
|
+
return s.pop(), n[this.options.textNodeName] !== void 0 && Object.keys(n).length === 1 ? this.buildTextValNode(n[this.options.textNodeName], t, l.attrStr, e, s) : this.buildObjectNode(l.val, t, l.attrStr, e);
|
|
1841
|
+
}
|
|
1842
|
+
F.prototype.extractAttributes = function(n) {
|
|
1843
|
+
if (!n || typeof n != "object") return null;
|
|
1844
|
+
const t = {};
|
|
1845
|
+
let e = !1;
|
|
1846
|
+
if (this.options.attributesGroupName && n[this.options.attributesGroupName]) {
|
|
1847
|
+
const s = n[this.options.attributesGroupName];
|
|
1848
|
+
for (let r in s) {
|
|
1849
|
+
if (!Object.prototype.hasOwnProperty.call(s, r)) continue;
|
|
1850
|
+
const i = r.startsWith(this.options.attributeNamePrefix) ? r.substring(this.options.attributeNamePrefix.length) : r;
|
|
1851
|
+
t[i] = s[r], e = !0;
|
|
1852
|
+
}
|
|
1853
|
+
} else
|
|
1854
|
+
for (let s in n) {
|
|
1855
|
+
if (!Object.prototype.hasOwnProperty.call(n, s)) continue;
|
|
1856
|
+
const r = this.isAttribute(s);
|
|
1857
|
+
r && (t[r] = n[s], e = !0);
|
|
1858
|
+
}
|
|
1859
|
+
return e ? t : null;
|
|
1860
|
+
};
|
|
1861
|
+
F.prototype.buildRawContent = function(n) {
|
|
1862
|
+
if (typeof n == "string")
|
|
1863
|
+
return n;
|
|
1864
|
+
if (typeof n != "object" || n === null)
|
|
1865
|
+
return String(n);
|
|
1866
|
+
if (n[this.options.textNodeName] !== void 0)
|
|
1867
|
+
return n[this.options.textNodeName];
|
|
1868
|
+
let t = "";
|
|
1869
|
+
for (let e in n) {
|
|
1870
|
+
if (!Object.prototype.hasOwnProperty.call(n, e) || this.isAttribute(e) || this.options.attributesGroupName && e === this.options.attributesGroupName) continue;
|
|
1871
|
+
const s = n[e];
|
|
1872
|
+
if (e === this.options.textNodeName)
|
|
1873
|
+
t += s;
|
|
1874
|
+
else if (Array.isArray(s)) {
|
|
1875
|
+
for (let r of s)
|
|
1876
|
+
if (typeof r == "string" || typeof r == "number")
|
|
1877
|
+
t += `<${e}>${r}</${e}>`;
|
|
1878
|
+
else if (typeof r == "object" && r !== null) {
|
|
1879
|
+
const i = this.buildRawContent(r), l = this.buildAttributesForStopNode(r);
|
|
1880
|
+
i === "" ? t += `<${e}${l}/>` : t += `<${e}${l}>${i}</${e}>`;
|
|
1881
|
+
}
|
|
1882
|
+
} else if (typeof s == "object" && s !== null) {
|
|
1883
|
+
const r = this.buildRawContent(s), i = this.buildAttributesForStopNode(s);
|
|
1884
|
+
r === "" ? t += `<${e}${i}/>` : t += `<${e}${i}>${r}</${e}>`;
|
|
1885
|
+
} else
|
|
1886
|
+
t += `<${e}>${s}</${e}>`;
|
|
1887
|
+
}
|
|
1888
|
+
return t;
|
|
1889
|
+
};
|
|
1890
|
+
F.prototype.buildAttributesForStopNode = function(n) {
|
|
1891
|
+
if (!n || typeof n != "object") return "";
|
|
1892
|
+
let t = "";
|
|
1893
|
+
if (this.options.attributesGroupName && n[this.options.attributesGroupName]) {
|
|
1894
|
+
const e = n[this.options.attributesGroupName];
|
|
1895
|
+
for (let s in e) {
|
|
1896
|
+
if (!Object.prototype.hasOwnProperty.call(e, s)) continue;
|
|
1897
|
+
const r = s.startsWith(this.options.attributeNamePrefix) ? s.substring(this.options.attributeNamePrefix.length) : s, i = e[s];
|
|
1898
|
+
i === !0 && this.options.suppressBooleanAttributes ? t += " " + r : t += " " + r + '="' + i + '"';
|
|
1899
|
+
}
|
|
1900
|
+
} else
|
|
1901
|
+
for (let e in n) {
|
|
1902
|
+
if (!Object.prototype.hasOwnProperty.call(n, e)) continue;
|
|
1903
|
+
const s = this.isAttribute(e);
|
|
1904
|
+
if (s) {
|
|
1905
|
+
const r = n[e];
|
|
1906
|
+
r === !0 && this.options.suppressBooleanAttributes ? t += " " + s : t += " " + s + '="' + r + '"';
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
return t;
|
|
1910
|
+
};
|
|
1911
|
+
F.prototype.buildObjectNode = function(n, t, e, s) {
|
|
1912
|
+
if (n === "")
|
|
1913
|
+
return t[0] === "?" ? this.indentate(s) + "<" + t + e + "?" + this.tagEndChar : this.indentate(s) + "<" + t + e + this.closeTag(t) + this.tagEndChar;
|
|
1126
1914
|
{
|
|
1127
|
-
let
|
|
1128
|
-
return
|
|
1915
|
+
let r = "</" + t + this.tagEndChar, i = "";
|
|
1916
|
+
return t[0] === "?" && (i = "?", r = ""), (e || e === "") && n.indexOf("<") === -1 ? this.indentate(s) + "<" + t + e + i + ">" + n + r : this.options.commentPropName !== !1 && t === this.options.commentPropName && i.length === 0 ? this.indentate(s) + `<!--${n}-->` + this.newLine : this.indentate(s) + "<" + t + e + i + this.tagEndChar + n + this.indentate(s) + r;
|
|
1129
1917
|
}
|
|
1130
1918
|
};
|
|
1131
|
-
|
|
1132
|
-
let
|
|
1133
|
-
return this.options.unpairedTags.indexOf(
|
|
1919
|
+
F.prototype.closeTag = function(n) {
|
|
1920
|
+
let t = "";
|
|
1921
|
+
return this.options.unpairedTags.indexOf(n) !== -1 ? this.options.suppressUnpairedNode || (t = "/") : this.options.suppressEmptyNode ? t = "/" : t = `></${n}`, t;
|
|
1134
1922
|
};
|
|
1135
|
-
|
|
1136
|
-
if (this.
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1923
|
+
F.prototype.checkStopNode = function(n) {
|
|
1924
|
+
if (!this.stopNodeExpressions || this.stopNodeExpressions.length === 0) return !1;
|
|
1925
|
+
for (let t = 0; t < this.stopNodeExpressions.length; t++)
|
|
1926
|
+
if (n.matches(this.stopNodeExpressions[t]))
|
|
1927
|
+
return !0;
|
|
1928
|
+
return !1;
|
|
1929
|
+
};
|
|
1930
|
+
F.prototype.buildTextValNode = function(n, t, e, s, r) {
|
|
1931
|
+
if (this.options.cdataPropName !== !1 && t === this.options.cdataPropName)
|
|
1932
|
+
return this.indentate(s) + `<![CDATA[${n}]]>` + this.newLine;
|
|
1933
|
+
if (this.options.commentPropName !== !1 && t === this.options.commentPropName)
|
|
1934
|
+
return this.indentate(s) + `<!--${n}-->` + this.newLine;
|
|
1935
|
+
if (t[0] === "?")
|
|
1936
|
+
return this.indentate(s) + "<" + t + e + "?" + this.tagEndChar;
|
|
1142
1937
|
{
|
|
1143
|
-
let i = this.options.tagValueProcessor(
|
|
1144
|
-
return i = this.replaceEntitiesValue(i), i === "" ? this.indentate(
|
|
1938
|
+
let i = this.options.tagValueProcessor(t, n);
|
|
1939
|
+
return i = this.replaceEntitiesValue(i), i === "" ? this.indentate(s) + "<" + t + e + this.closeTag(t) + this.tagEndChar : this.indentate(s) + "<" + t + e + ">" + i + "</" + t + this.tagEndChar;
|
|
1145
1940
|
}
|
|
1146
1941
|
};
|
|
1147
|
-
|
|
1148
|
-
if (
|
|
1149
|
-
for (let
|
|
1150
|
-
const
|
|
1151
|
-
|
|
1942
|
+
F.prototype.replaceEntitiesValue = function(n) {
|
|
1943
|
+
if (n && n.length > 0 && this.options.processEntities)
|
|
1944
|
+
for (let t = 0; t < this.options.entities.length; t++) {
|
|
1945
|
+
const e = this.options.entities[t];
|
|
1946
|
+
n = n.replace(e.regex, e.val);
|
|
1152
1947
|
}
|
|
1153
|
-
return
|
|
1948
|
+
return n;
|
|
1154
1949
|
};
|
|
1155
|
-
function
|
|
1156
|
-
return this.options.indentBy.repeat(
|
|
1950
|
+
function En(n) {
|
|
1951
|
+
return this.options.indentBy.repeat(n);
|
|
1157
1952
|
}
|
|
1158
|
-
function
|
|
1159
|
-
return
|
|
1953
|
+
function Nn(n) {
|
|
1954
|
+
return n.startsWith(this.options.attributeNamePrefix) && n !== this.options.textNodeName ? n.substr(this.attrPrefixLen) : !1;
|
|
1160
1955
|
}
|
|
1161
|
-
class
|
|
1956
|
+
class wn {
|
|
1162
1957
|
attr_id;
|
|
1163
1958
|
attr_version;
|
|
1164
1959
|
Label;
|
|
1165
1960
|
constructor({
|
|
1166
|
-
Label:
|
|
1167
|
-
attr_id:
|
|
1168
|
-
attr_version:
|
|
1961
|
+
Label: t,
|
|
1962
|
+
attr_id: e,
|
|
1963
|
+
attr_version: s
|
|
1169
1964
|
}) {
|
|
1170
|
-
this.attr_id =
|
|
1965
|
+
this.attr_id = e, this.attr_version = s, this.Label = t;
|
|
1171
1966
|
}
|
|
1172
1967
|
toXML() {
|
|
1173
1968
|
return {
|
|
@@ -1177,11 +1972,11 @@ class ss {
|
|
|
1177
1972
|
};
|
|
1178
1973
|
}
|
|
1179
1974
|
}
|
|
1180
|
-
class
|
|
1975
|
+
class Sn {
|
|
1181
1976
|
attr_ref;
|
|
1182
1977
|
attr_version;
|
|
1183
|
-
constructor({ attr_ref:
|
|
1184
|
-
this.attr_ref =
|
|
1978
|
+
constructor({ attr_ref: t, attr_version: e }) {
|
|
1979
|
+
this.attr_ref = t, this.attr_version = e;
|
|
1185
1980
|
}
|
|
1186
1981
|
toXML() {
|
|
1187
1982
|
return {
|
|
@@ -1190,42 +1985,42 @@ class ns {
|
|
|
1190
1985
|
};
|
|
1191
1986
|
}
|
|
1192
1987
|
}
|
|
1193
|
-
class
|
|
1988
|
+
class ie {
|
|
1194
1989
|
value;
|
|
1195
|
-
constructor(
|
|
1196
|
-
this.value =
|
|
1990
|
+
constructor(t) {
|
|
1991
|
+
this.value = t?.text_value;
|
|
1197
1992
|
}
|
|
1198
1993
|
toXML() {
|
|
1199
1994
|
return { text_value: this.value };
|
|
1200
1995
|
}
|
|
1201
1996
|
}
|
|
1202
|
-
function
|
|
1203
|
-
return
|
|
1997
|
+
function A(n, t) {
|
|
1998
|
+
return n ? Array.isArray(n) ? n.map((e) => new t(e)) : [new t(n)] : [];
|
|
1204
1999
|
}
|
|
1205
|
-
function
|
|
1206
|
-
return
|
|
2000
|
+
function J(n) {
|
|
2001
|
+
return n.map((t) => t.toXML());
|
|
1207
2002
|
}
|
|
1208
|
-
function
|
|
1209
|
-
const
|
|
1210
|
-
return
|
|
1211
|
-
const
|
|
1212
|
-
|
|
1213
|
-
}),
|
|
2003
|
+
function j(n) {
|
|
2004
|
+
const t = {};
|
|
2005
|
+
return n.forEach((e) => {
|
|
2006
|
+
const r = e.constructor.xmlTagName ?? e.constructor.name;
|
|
2007
|
+
t[r] || (t[r] = []), t[r].push(e.toXML());
|
|
2008
|
+
}), t;
|
|
1214
2009
|
}
|
|
1215
|
-
class
|
|
2010
|
+
class gt {
|
|
1216
2011
|
attr_id;
|
|
1217
2012
|
attr_version;
|
|
1218
2013
|
Units;
|
|
1219
2014
|
TicketingEquipmentRef;
|
|
1220
2015
|
TicketValidatorEquipmentRef;
|
|
1221
2016
|
constructor({
|
|
1222
|
-
attr_id:
|
|
1223
|
-
attr_version:
|
|
1224
|
-
Units:
|
|
1225
|
-
TicketingEquipmentRef:
|
|
1226
|
-
TicketValidatorEquipmentRef:
|
|
2017
|
+
attr_id: t,
|
|
2018
|
+
attr_version: e,
|
|
2019
|
+
Units: s,
|
|
2020
|
+
TicketingEquipmentRef: r = void 0,
|
|
2021
|
+
TicketValidatorEquipmentRef: i = void 0
|
|
1227
2022
|
}) {
|
|
1228
|
-
this.attr_id =
|
|
2023
|
+
this.attr_id = t, this.attr_version = e, this.Units = s, this.TicketingEquipmentRef = r, this.TicketValidatorEquipmentRef = i;
|
|
1229
2024
|
}
|
|
1230
2025
|
toXML() {
|
|
1231
2026
|
return {
|
|
@@ -1237,7 +2032,7 @@ class ge {
|
|
|
1237
2032
|
};
|
|
1238
2033
|
}
|
|
1239
2034
|
}
|
|
1240
|
-
class
|
|
2035
|
+
class xn {
|
|
1241
2036
|
attr_id;
|
|
1242
2037
|
attr_version;
|
|
1243
2038
|
Name;
|
|
@@ -1245,14 +2040,14 @@ class is {
|
|
|
1245
2040
|
TotalCapacity;
|
|
1246
2041
|
actualVehicleEquipments;
|
|
1247
2042
|
constructor({
|
|
1248
|
-
attr_id:
|
|
1249
|
-
attr_version:
|
|
1250
|
-
Name:
|
|
1251
|
-
PublicUse:
|
|
1252
|
-
TotalCapacity:
|
|
1253
|
-
actualVehicleEquipments:
|
|
2043
|
+
attr_id: t,
|
|
2044
|
+
attr_version: e,
|
|
2045
|
+
Name: s,
|
|
2046
|
+
PublicUse: r,
|
|
2047
|
+
TotalCapacity: i,
|
|
2048
|
+
actualVehicleEquipments: l
|
|
1254
2049
|
}) {
|
|
1255
|
-
this.attr_id =
|
|
2050
|
+
this.attr_id = t, this.attr_version = e, this.Name = s ? new ie(s) : void 0, this.actualVehicleEquipments = l ? A(l.ActualVehicleEquipment, gt) : [], this.PublicUse = r?.text_value, this.TotalCapacity = i?.text_value;
|
|
1256
2051
|
}
|
|
1257
2052
|
toXML() {
|
|
1258
2053
|
return {
|
|
@@ -1262,21 +2057,21 @@ class is {
|
|
|
1262
2057
|
};
|
|
1263
2058
|
}
|
|
1264
2059
|
}
|
|
1265
|
-
class
|
|
2060
|
+
class tt {
|
|
1266
2061
|
x;
|
|
1267
2062
|
y;
|
|
1268
|
-
constructor(
|
|
1269
|
-
this.x =
|
|
2063
|
+
constructor(t, e) {
|
|
2064
|
+
this.x = t, this.y = e;
|
|
1270
2065
|
}
|
|
1271
2066
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1272
|
-
static fromXML(
|
|
1273
|
-
const
|
|
1274
|
-
if (typeof
|
|
1275
|
-
const [
|
|
1276
|
-
if (typeof
|
|
1277
|
-
return new
|
|
2067
|
+
static fromXML(t) {
|
|
2068
|
+
const e = t?.Location?.pos;
|
|
2069
|
+
if (typeof e == "string") {
|
|
2070
|
+
const [s, r] = e.split(" ").map(Number);
|
|
2071
|
+
if (typeof s == "number" && typeof r == "number")
|
|
2072
|
+
return new tt(s, r);
|
|
1278
2073
|
} else
|
|
1279
|
-
return new
|
|
2074
|
+
return new tt(0, 0);
|
|
1280
2075
|
}
|
|
1281
2076
|
toXML() {
|
|
1282
2077
|
return {
|
|
@@ -1286,7 +2081,7 @@ class Q {
|
|
|
1286
2081
|
};
|
|
1287
2082
|
}
|
|
1288
2083
|
}
|
|
1289
|
-
class
|
|
2084
|
+
class re {
|
|
1290
2085
|
static xmlTagName = "PassengerEntrance";
|
|
1291
2086
|
attr_id;
|
|
1292
2087
|
attr_version;
|
|
@@ -1306,28 +2101,28 @@ class Ke {
|
|
|
1306
2101
|
Centroid;
|
|
1307
2102
|
// sensorInEntrance: SensorInEntrance[]
|
|
1308
2103
|
constructor({
|
|
1309
|
-
attr_id:
|
|
1310
|
-
attr_version:
|
|
1311
|
-
Name:
|
|
1312
|
-
Label:
|
|
1313
|
-
Width:
|
|
1314
|
-
Height:
|
|
1315
|
-
actualVehicleEquipments:
|
|
2104
|
+
attr_id: t,
|
|
2105
|
+
attr_version: e,
|
|
2106
|
+
Name: s,
|
|
2107
|
+
Label: r,
|
|
2108
|
+
Width: i,
|
|
2109
|
+
Height: l,
|
|
2110
|
+
actualVehicleEquipments: o,
|
|
1316
2111
|
PublicUse: a,
|
|
1317
|
-
VehicleSide:
|
|
2112
|
+
VehicleSide: c,
|
|
1318
2113
|
SequenceFromFront: h,
|
|
1319
2114
|
HeightFromGround: d,
|
|
1320
2115
|
DeckEntranceType: f,
|
|
1321
2116
|
IsEmergencyExit: y,
|
|
1322
|
-
HasDoor:
|
|
1323
|
-
IsAutomatic:
|
|
1324
|
-
Centroid:
|
|
2117
|
+
HasDoor: C,
|
|
2118
|
+
IsAutomatic: E,
|
|
2119
|
+
Centroid: L = void 0
|
|
1325
2120
|
// sensorInEntrance,
|
|
1326
2121
|
}) {
|
|
1327
|
-
this.attr_id =
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
), this.PublicUse = a?.text_value, this.VehicleSide =
|
|
2122
|
+
this.attr_id = t, this.attr_version = e, this.Name = s ? new ie(s) : void 0, this.Label = r?.text_value, this.Width = i?.text_value, this.Height = l?.text_value, this.actualVehicleEquipments = A(
|
|
2123
|
+
o?.ActualVehicleEquipment,
|
|
2124
|
+
gt
|
|
2125
|
+
), this.PublicUse = a?.text_value, this.VehicleSide = c?.text_value, this.SequenceFromFront = h?.text_value, this.HeightFromGround = d?.text_value, this.DeckEntranceType = f?.text_value, this.IsEmergencyExit = y?.text_value, this.HasDoor = C?.text_value, this.IsAutomatic = E?.text_value, this.Centroid = L ? tt.fromXML(L) : void 0;
|
|
1331
2126
|
}
|
|
1332
2127
|
toXML() {
|
|
1333
2128
|
return {
|
|
@@ -1338,7 +2133,7 @@ class Ke {
|
|
|
1338
2133
|
Width: this.Width,
|
|
1339
2134
|
Height: this.Height,
|
|
1340
2135
|
actualVehicleEquipments: {
|
|
1341
|
-
ActualVehicleEquipment:
|
|
2136
|
+
ActualVehicleEquipment: J(this.actualVehicleEquipments)
|
|
1342
2137
|
},
|
|
1343
2138
|
PublicUse: this.PublicUse,
|
|
1344
2139
|
VehicleSide: this.VehicleSide,
|
|
@@ -1352,27 +2147,27 @@ class Ke {
|
|
|
1352
2147
|
// sensorInEntrance: {SensorInEntrance: serializeElements(this.sensorInEntrance)},
|
|
1353
2148
|
};
|
|
1354
2149
|
}
|
|
1355
|
-
getShape(e, s
|
|
1356
|
-
const
|
|
1357
|
-
let
|
|
1358
|
-
if ((this.VehicleSide === "front" || this.VehicleSide === "back") && (
|
|
1359
|
-
let h = (this.Centroid?.x ?? 0) *
|
|
1360
|
-
return this.VehicleSide === "leftSide" ? d = (this.Centroid?.y ?? 0) *
|
|
2150
|
+
getShape(t, e, s) {
|
|
2151
|
+
const r = (this.Width || 0.8) * t, i = 0.2 * t;
|
|
2152
|
+
let l = r, o = i, a = 0, c = 0;
|
|
2153
|
+
if ((this.VehicleSide === "front" || this.VehicleSide === "back") && (l = i, o = r), this.Centroid) {
|
|
2154
|
+
let h = (this.Centroid?.x ?? 0) * t, d = (this.Centroid?.y ?? 0) * t;
|
|
2155
|
+
return this.VehicleSide === "leftSide" ? d = (this.Centroid?.y ?? 0) * t - o / 2 : this.VehicleSide === "rightSide" ? d = (this.Centroid?.y ?? 0) * t + o / 2 : this.VehicleSide === "front" ? h = (this.Centroid?.x ?? 0) * t - l / 2 : this.VehicleSide === "back" && (h = (this.Centroid?.x ?? 0) * t + l / 2), {
|
|
1361
2156
|
x: h,
|
|
1362
2157
|
y: d,
|
|
1363
|
-
width:
|
|
1364
|
-
height:
|
|
2158
|
+
width: l,
|
|
2159
|
+
height: o,
|
|
1365
2160
|
fill: "orange",
|
|
1366
2161
|
stroke: "darkorange",
|
|
1367
2162
|
strokeWidth: 2,
|
|
1368
2163
|
draggable: !0
|
|
1369
2164
|
};
|
|
1370
2165
|
}
|
|
1371
|
-
return this.VehicleSide === "leftSide" ? (a = (this.SequenceFromFront ?? 0) *
|
|
2166
|
+
return this.VehicleSide === "leftSide" ? (a = (this.SequenceFromFront ?? 0) * t - l / 2 + 5, c = 5) : this.VehicleSide === "rightSide" ? (a = (this.SequenceFromFront ?? 0) * t - l / 2 + 5, c = s * t + 5 - o) : this.VehicleSide === "front" ? (a = 5, c = s * t / 2 + 5 - o / 2) : this.VehicleSide === "back" ? (a = e * t + 5 - l, c = s * t / 2 + 5 - o / 2) : (a = 5, c = 5), {
|
|
1372
2167
|
x: a,
|
|
1373
|
-
y:
|
|
1374
|
-
width:
|
|
1375
|
-
height:
|
|
2168
|
+
y: c,
|
|
2169
|
+
width: l,
|
|
2170
|
+
height: o,
|
|
1376
2171
|
fill: "orange",
|
|
1377
2172
|
stroke: "darkorange",
|
|
1378
2173
|
strokeWidth: 2,
|
|
@@ -1380,11 +2175,11 @@ class Ke {
|
|
|
1380
2175
|
};
|
|
1381
2176
|
}
|
|
1382
2177
|
}
|
|
1383
|
-
class
|
|
2178
|
+
class Bt {
|
|
1384
2179
|
attr_ref;
|
|
1385
2180
|
attr_version;
|
|
1386
|
-
constructor({ attr_ref:
|
|
1387
|
-
this.attr_ref =
|
|
2181
|
+
constructor({ attr_ref: t, attr_version: e }) {
|
|
2182
|
+
this.attr_ref = t, this.attr_version = e;
|
|
1388
2183
|
}
|
|
1389
2184
|
toXML() {
|
|
1390
2185
|
return {
|
|
@@ -1393,13 +2188,13 @@ class $e {
|
|
|
1393
2188
|
};
|
|
1394
2189
|
}
|
|
1395
2190
|
}
|
|
1396
|
-
class
|
|
2191
|
+
class kn {
|
|
1397
2192
|
attr_ref;
|
|
1398
2193
|
attr_version;
|
|
1399
2194
|
FromDeckEntranceRef;
|
|
1400
2195
|
ToDeckEntranceRef;
|
|
1401
|
-
constructor({ attr_ref:
|
|
1402
|
-
this.attr_ref =
|
|
2196
|
+
constructor({ attr_ref: t, attr_version: e, FromDeckEntranceRef: s, ToDeckEntranceRef: r }) {
|
|
2197
|
+
this.attr_ref = t, this.attr_version = e, this.FromDeckEntranceRef = new Bt(s), this.ToDeckEntranceRef = new Bt(r);
|
|
1403
2198
|
}
|
|
1404
2199
|
toXML() {
|
|
1405
2200
|
return {
|
|
@@ -1410,12 +2205,12 @@ class rs {
|
|
|
1410
2205
|
};
|
|
1411
2206
|
}
|
|
1412
2207
|
}
|
|
1413
|
-
class
|
|
2208
|
+
class Cn {
|
|
1414
2209
|
attr_id;
|
|
1415
2210
|
attr_version;
|
|
1416
2211
|
Name;
|
|
1417
|
-
constructor({ attr_id:
|
|
1418
|
-
this.attr_id =
|
|
2212
|
+
constructor({ attr_id: t, attr_version: e, Name: s }) {
|
|
2213
|
+
this.attr_id = t, this.attr_version = e, this.Name = s;
|
|
1419
2214
|
}
|
|
1420
2215
|
toXML() {
|
|
1421
2216
|
return {
|
|
@@ -1425,11 +2220,11 @@ class os {
|
|
|
1425
2220
|
};
|
|
1426
2221
|
}
|
|
1427
2222
|
}
|
|
1428
|
-
class
|
|
2223
|
+
class _n {
|
|
1429
2224
|
attr_ref;
|
|
1430
2225
|
attr_version;
|
|
1431
|
-
constructor({ attr_ref:
|
|
1432
|
-
this.attr_ref =
|
|
2226
|
+
constructor({ attr_ref: t, attr_version: e }) {
|
|
2227
|
+
this.attr_ref = t, this.attr_version = e;
|
|
1433
2228
|
}
|
|
1434
2229
|
toXML() {
|
|
1435
2230
|
return {
|
|
@@ -1438,7 +2233,7 @@ class as {
|
|
|
1438
2233
|
};
|
|
1439
2234
|
}
|
|
1440
2235
|
}
|
|
1441
|
-
class
|
|
2236
|
+
class Pn {
|
|
1442
2237
|
attr_ref;
|
|
1443
2238
|
attr_version;
|
|
1444
2239
|
validityConditions;
|
|
@@ -1446,14 +2241,14 @@ class ls {
|
|
|
1446
2241
|
EntranceUsageType;
|
|
1447
2242
|
EntranceSetting;
|
|
1448
2243
|
ControlledLocking;
|
|
1449
|
-
constructor({ attr_ref:
|
|
1450
|
-
this.attr_ref =
|
|
2244
|
+
constructor({ attr_ref: t, attr_version: e, validityConditions: s, Name: r, EntranceUsageType: i, EntranceSetting: l, ControlledLocking: o }) {
|
|
2245
|
+
this.attr_ref = t, this.attr_version = e, this.validityConditions = Object.entries(s).flatMap(([a, c]) => (a === "ValidityConditionRef" && c.map((h) => new _n(h)), a === "ValidityCondition" && c.map((h) => new Cn(h)), [])), this.Name = r, this.EntranceUsageType = i, this.EntranceSetting = l, this.ControlledLocking = o;
|
|
1451
2246
|
}
|
|
1452
2247
|
toXML() {
|
|
1453
2248
|
return {
|
|
1454
2249
|
attr_ref: this.attr_ref,
|
|
1455
2250
|
attr_version: this.attr_version,
|
|
1456
|
-
validityConditions:
|
|
2251
|
+
validityConditions: j(this.validityConditions),
|
|
1457
2252
|
Name: this.Name,
|
|
1458
2253
|
EntranceUsageType: this.EntranceUsageType,
|
|
1459
2254
|
EntranceSetting: this.EntranceSetting,
|
|
@@ -1461,13 +2256,13 @@ class ls {
|
|
|
1461
2256
|
};
|
|
1462
2257
|
}
|
|
1463
2258
|
}
|
|
1464
|
-
class
|
|
2259
|
+
class Tn {
|
|
1465
2260
|
attr_ref;
|
|
1466
2261
|
attr_version;
|
|
1467
2262
|
LocatableSpotType;
|
|
1468
2263
|
capacity;
|
|
1469
|
-
constructor({ attr_ref:
|
|
1470
|
-
this.attr_ref =
|
|
2264
|
+
constructor({ attr_ref: t, attr_version: e, LocatableSpotType: s, capacity: r }) {
|
|
2265
|
+
this.attr_ref = t, this.attr_version = e, this.LocatableSpotType = s, this.capacity = r;
|
|
1471
2266
|
}
|
|
1472
2267
|
toXML() {
|
|
1473
2268
|
return {
|
|
@@ -1478,11 +2273,11 @@ class cs {
|
|
|
1478
2273
|
};
|
|
1479
2274
|
}
|
|
1480
2275
|
}
|
|
1481
|
-
class
|
|
2276
|
+
class An {
|
|
1482
2277
|
attr_id;
|
|
1483
2278
|
label;
|
|
1484
|
-
constructor({ attr_id:
|
|
1485
|
-
this.attr_id =
|
|
2279
|
+
constructor({ attr_id: t, Label: e }) {
|
|
2280
|
+
this.attr_id = t, this.label = e;
|
|
1486
2281
|
}
|
|
1487
2282
|
toXML() {
|
|
1488
2283
|
return {
|
|
@@ -1491,11 +2286,11 @@ class ds {
|
|
|
1491
2286
|
};
|
|
1492
2287
|
}
|
|
1493
2288
|
}
|
|
1494
|
-
class
|
|
2289
|
+
class oe {
|
|
1495
2290
|
attr_ref;
|
|
1496
2291
|
attr_version;
|
|
1497
|
-
constructor({ attr_ref:
|
|
1498
|
-
this.attr_ref =
|
|
2292
|
+
constructor({ attr_ref: t, attr_version: e }) {
|
|
2293
|
+
this.attr_ref = t, this.attr_version = e;
|
|
1499
2294
|
}
|
|
1500
2295
|
toXML() {
|
|
1501
2296
|
return {
|
|
@@ -1504,12 +2299,12 @@ class Ze {
|
|
|
1504
2299
|
};
|
|
1505
2300
|
}
|
|
1506
2301
|
}
|
|
1507
|
-
class
|
|
2302
|
+
class Ln {
|
|
1508
2303
|
attr_id;
|
|
1509
2304
|
label;
|
|
1510
2305
|
//GeneralLabel[]
|
|
1511
|
-
constructor({ attr_id:
|
|
1512
|
-
this.attr_id =
|
|
2306
|
+
constructor({ attr_id: t, Label: e }) {
|
|
2307
|
+
this.attr_id = t, this.label = e;
|
|
1513
2308
|
}
|
|
1514
2309
|
toXML() {
|
|
1515
2310
|
return {
|
|
@@ -1518,11 +2313,11 @@ class us {
|
|
|
1518
2313
|
};
|
|
1519
2314
|
}
|
|
1520
2315
|
}
|
|
1521
|
-
class
|
|
2316
|
+
class ae {
|
|
1522
2317
|
attr_ref;
|
|
1523
2318
|
attr_version;
|
|
1524
|
-
constructor({ attr_ref:
|
|
1525
|
-
this.attr_ref =
|
|
2319
|
+
constructor({ attr_ref: t, attr_version: e }) {
|
|
2320
|
+
this.attr_ref = t, this.attr_version = e;
|
|
1526
2321
|
}
|
|
1527
2322
|
toXML() {
|
|
1528
2323
|
return {
|
|
@@ -1531,7 +2326,7 @@ class Qe {
|
|
|
1531
2326
|
};
|
|
1532
2327
|
}
|
|
1533
2328
|
}
|
|
1534
|
-
class
|
|
2329
|
+
class $n {
|
|
1535
2330
|
attr_id;
|
|
1536
2331
|
attr_version;
|
|
1537
2332
|
Label;
|
|
@@ -1539,8 +2334,8 @@ class hs {
|
|
|
1539
2334
|
actualVehicleEquipments;
|
|
1540
2335
|
SpotColumnRef;
|
|
1541
2336
|
SpotRowRef;
|
|
1542
|
-
constructor({ attr_id:
|
|
1543
|
-
this.attr_id =
|
|
2337
|
+
constructor({ attr_id: t, attr_version: e, Label: s, Orientation: r, actualVehicleEquipments: i, SpotColumnRef: l, SpotRowRef: o }) {
|
|
2338
|
+
this.attr_id = t, this.attr_version = e, this.Label = s, this.Orientation = r, this.actualVehicleEquipments = i ? A(i, gt) : [], this.SpotColumnRef = l ? new oe(l) : void 0, this.SpotRowRef = o ? new ae(o) : void 0;
|
|
1544
2339
|
}
|
|
1545
2340
|
toXML() {
|
|
1546
2341
|
return {
|
|
@@ -1548,17 +2343,17 @@ class hs {
|
|
|
1548
2343
|
attr_version: this.attr_version,
|
|
1549
2344
|
Label: this.Label,
|
|
1550
2345
|
Orientation: this.Orientation,
|
|
1551
|
-
actualVehicleEquipments: { ActualVehicleEquipment:
|
|
2346
|
+
actualVehicleEquipments: { ActualVehicleEquipment: J(this.actualVehicleEquipments) },
|
|
1552
2347
|
SpotColumnRef: this.SpotColumnRef?.toXML(),
|
|
1553
2348
|
SpotRowRef: this.SpotRowRef?.toXML()
|
|
1554
2349
|
};
|
|
1555
2350
|
}
|
|
1556
2351
|
}
|
|
1557
|
-
class
|
|
2352
|
+
class Mn {
|
|
1558
2353
|
attr_ref;
|
|
1559
2354
|
attr_version;
|
|
1560
|
-
constructor({ attr_ref:
|
|
1561
|
-
this.attr_ref =
|
|
2355
|
+
constructor({ attr_ref: t, attr_version: e }) {
|
|
2356
|
+
this.attr_ref = t, this.attr_version = e;
|
|
1562
2357
|
}
|
|
1563
2358
|
toXML() {
|
|
1564
2359
|
return {
|
|
@@ -1567,8 +2362,8 @@ class fs {
|
|
|
1567
2362
|
};
|
|
1568
2363
|
}
|
|
1569
2364
|
}
|
|
1570
|
-
var
|
|
1571
|
-
class
|
|
2365
|
+
var pt = /* @__PURE__ */ ((n) => (n.Occupied = "Occupied", n.Selected = "Selected", n.Filtered = "Filtered", n.Defect = "Defect", n.Undefined = "Undefined", n))(pt || {});
|
|
2366
|
+
class ht {
|
|
1572
2367
|
static xmlTagName = "PassengerSpot";
|
|
1573
2368
|
attr_id;
|
|
1574
2369
|
attr_version;
|
|
@@ -1585,21 +2380,21 @@ class ce {
|
|
|
1585
2380
|
Length;
|
|
1586
2381
|
availability;
|
|
1587
2382
|
constructor({
|
|
1588
|
-
attr_id:
|
|
1589
|
-
attr_version:
|
|
1590
|
-
Label:
|
|
1591
|
-
Orientation:
|
|
1592
|
-
actualVehicleEquipments:
|
|
1593
|
-
SpotColumnRef:
|
|
1594
|
-
SpotRowRef:
|
|
2383
|
+
attr_id: t,
|
|
2384
|
+
attr_version: e,
|
|
2385
|
+
Label: s,
|
|
2386
|
+
Orientation: r,
|
|
2387
|
+
actualVehicleEquipments: i,
|
|
2388
|
+
SpotColumnRef: l,
|
|
2389
|
+
SpotRowRef: o,
|
|
1595
2390
|
ByWindow: a,
|
|
1596
|
-
ByAisle:
|
|
2391
|
+
ByAisle: c,
|
|
1597
2392
|
HasPower: h,
|
|
1598
2393
|
Centroid: d,
|
|
1599
2394
|
Width: f,
|
|
1600
2395
|
Length: y
|
|
1601
2396
|
}) {
|
|
1602
|
-
this.attr_id =
|
|
2397
|
+
this.attr_id = t, this.attr_version = e, this.Label = s || "", this.Orientation = r || void 0, this.actualVehicleEquipments = i ? A(i, gt) : void 0, this.SpotColumnRef = l ? new oe(l) : void 0, this.SpotRowRef = o ? new ae(o) : void 0, this.ByWindow = a, this.ByAisle = c, this.HasPower = h, this.Centroid = d ? tt.fromXML(d) : void 0, this.Width = f || 0.5, this.Length = y || 0.5;
|
|
1603
2398
|
}
|
|
1604
2399
|
toXML() {
|
|
1605
2400
|
return {
|
|
@@ -1607,7 +2402,7 @@ class ce {
|
|
|
1607
2402
|
attr_version: this.attr_version,
|
|
1608
2403
|
Label: this.Label ? { text_value: this.Label } : void 0,
|
|
1609
2404
|
Orientation: this.Orientation ? { text_value: this.Orientation } : void 0,
|
|
1610
|
-
actualVehicleEquipments: this.actualVehicleEquipments ?
|
|
2405
|
+
actualVehicleEquipments: this.actualVehicleEquipments ? j(this.actualVehicleEquipments) : void 0,
|
|
1611
2406
|
SpotColumnRef: this.SpotColumnRef?.toXML(),
|
|
1612
2407
|
SpotRowRef: this.SpotRowRef?.toXML(),
|
|
1613
2408
|
ByWindow: this.ByWindow ? { text_value: this.ByWindow } : void 0,
|
|
@@ -1619,17 +2414,17 @@ class ce {
|
|
|
1619
2414
|
};
|
|
1620
2415
|
}
|
|
1621
2416
|
getClasses() {
|
|
1622
|
-
const
|
|
1623
|
-
return this.ByWindow &&
|
|
2417
|
+
const t = [];
|
|
2418
|
+
return this.ByWindow && t.push("seat__by-window"), this.ByAisle && t.push("seat__by-aisle"), this.HasPower && t.push("seat__has-power"), this.Orientation && t.push(`seat__orientation-${this.Orientation}`), this.availability && t.push(`seat__availability-${this.availability.toLowerCase()}`), t.join(" ");
|
|
1624
2419
|
}
|
|
1625
|
-
getShape(
|
|
2420
|
+
getShape(t) {
|
|
1626
2421
|
if (this.Centroid) {
|
|
1627
|
-
const
|
|
2422
|
+
const e = this.Width * t, s = this.Length * t;
|
|
1628
2423
|
return {
|
|
1629
|
-
x: (this.Centroid?.x ?? 1) *
|
|
1630
|
-
y: (this.Centroid?.y ?? 1) *
|
|
1631
|
-
width:
|
|
1632
|
-
height:
|
|
2424
|
+
x: (this.Centroid?.x ?? 1) * t - e / 2 + 5,
|
|
2425
|
+
y: (this.Centroid?.y ?? 1) * t - s / 2 + 5,
|
|
2426
|
+
width: e,
|
|
2427
|
+
height: s,
|
|
1633
2428
|
fill: "lightgray",
|
|
1634
2429
|
stroke: "gray",
|
|
1635
2430
|
strokeWidth: 1,
|
|
@@ -1640,18 +2435,18 @@ class ce {
|
|
|
1640
2435
|
return {
|
|
1641
2436
|
x: 0,
|
|
1642
2437
|
y: 0,
|
|
1643
|
-
width: this.Width *
|
|
1644
|
-
height: this.Length *
|
|
2438
|
+
width: this.Width * t,
|
|
2439
|
+
height: this.Length * t,
|
|
1645
2440
|
fill: "red",
|
|
1646
2441
|
draggable: !0
|
|
1647
2442
|
};
|
|
1648
2443
|
}
|
|
1649
2444
|
}
|
|
1650
|
-
class
|
|
2445
|
+
class On {
|
|
1651
2446
|
attr_ref;
|
|
1652
2447
|
attr_version;
|
|
1653
|
-
constructor({ attr_ref:
|
|
1654
|
-
this.attr_ref =
|
|
2448
|
+
constructor({ attr_ref: t, attr_version: e }) {
|
|
2449
|
+
this.attr_ref = t, this.attr_version = e;
|
|
1655
2450
|
}
|
|
1656
2451
|
toXML() {
|
|
1657
2452
|
return {
|
|
@@ -1660,20 +2455,20 @@ class gs {
|
|
|
1660
2455
|
};
|
|
1661
2456
|
}
|
|
1662
2457
|
}
|
|
1663
|
-
class
|
|
2458
|
+
class le {
|
|
1664
2459
|
value;
|
|
1665
|
-
constructor(
|
|
1666
|
-
this.value =
|
|
2460
|
+
constructor(t) {
|
|
2461
|
+
this.value = t;
|
|
1667
2462
|
}
|
|
1668
2463
|
toXML() {
|
|
1669
2464
|
return this.value;
|
|
1670
2465
|
}
|
|
1671
2466
|
}
|
|
1672
|
-
class
|
|
2467
|
+
class In {
|
|
1673
2468
|
attr_ref;
|
|
1674
2469
|
attr_version;
|
|
1675
|
-
constructor({ attr_ref:
|
|
1676
|
-
this.attr_ref =
|
|
2470
|
+
constructor({ attr_ref: t, attr_version: e }) {
|
|
2471
|
+
this.attr_ref = t, this.attr_version = e;
|
|
1677
2472
|
}
|
|
1678
2473
|
toXML() {
|
|
1679
2474
|
return {
|
|
@@ -1682,7 +2477,7 @@ class ps {
|
|
|
1682
2477
|
};
|
|
1683
2478
|
}
|
|
1684
2479
|
}
|
|
1685
|
-
class
|
|
2480
|
+
class B {
|
|
1686
2481
|
static xmlTagName = "PassengerSpace";
|
|
1687
2482
|
attr_id;
|
|
1688
2483
|
attr_version;
|
|
@@ -1707,29 +2502,29 @@ class W {
|
|
|
1707
2502
|
FareClass;
|
|
1708
2503
|
AirConditioned;
|
|
1709
2504
|
constructor({
|
|
1710
|
-
attr_id:
|
|
1711
|
-
attr_version:
|
|
1712
|
-
Name:
|
|
1713
|
-
SmokingAllowed:
|
|
1714
|
-
StandingAllowed:
|
|
1715
|
-
PassengerSpaceType:
|
|
1716
|
-
passengerSpots:
|
|
2505
|
+
attr_id: t,
|
|
2506
|
+
attr_version: e,
|
|
2507
|
+
Name: s,
|
|
2508
|
+
SmokingAllowed: r,
|
|
2509
|
+
StandingAllowed: i,
|
|
2510
|
+
PassengerSpaceType: l,
|
|
2511
|
+
passengerSpots: o,
|
|
1717
2512
|
luggageSpots: a,
|
|
1718
|
-
deckEntrances:
|
|
2513
|
+
deckEntrances: c,
|
|
1719
2514
|
deckEntranceUsage: h,
|
|
1720
2515
|
deckEntranceCouples: d,
|
|
1721
2516
|
deckSpaceCapacities: f,
|
|
1722
2517
|
actualVehicleEquipments: y,
|
|
1723
|
-
ServiceFacilitySetRef:
|
|
2518
|
+
ServiceFacilitySetRef: C,
|
|
1724
2519
|
// spotAffinities,
|
|
1725
|
-
Centroid:
|
|
1726
|
-
Polygon:
|
|
1727
|
-
PublicUse:
|
|
1728
|
-
TotalCapacity:
|
|
1729
|
-
FareClass:
|
|
1730
|
-
AirConditioned:
|
|
2520
|
+
Centroid: E,
|
|
2521
|
+
Polygon: L,
|
|
2522
|
+
PublicUse: X,
|
|
2523
|
+
TotalCapacity: _,
|
|
2524
|
+
FareClass: G,
|
|
2525
|
+
AirConditioned: q
|
|
1731
2526
|
}) {
|
|
1732
|
-
this.attr_id =
|
|
2527
|
+
this.attr_id = t, this.attr_version = e, this.Name = s, this.SmokingAllowed = r, this.StandingAllowed = i, this.PassengerSpaceType = l, this.passengerSpots = o ? Object.entries(o).flatMap(([z, v]) => z === "PassengerSpot" ? A(v, ht) : z === "PassengerSpotRef" ? A(v, On) : []) : [], this.luggageSpots = a ? Object.entries(a).flatMap(([z, v]) => z === "LuggageSpot" ? A(v, $n) : z === "LuggageSpotRef" ? A(v, Mn) : []) : [], this.deckEntrances = A(c?.PassengerEntrance, re), this.deckEntranceUsage = A(h?.DeckEntranceUsage, Pn), this.deckEntranceCouples = A(d?.DeckEntranceCouple, kn), this.deckSpaceCapacities = A(f?.DeckSpaceCapacity, Tn), this.actualVehicleEquipments = A(y?.ActualVehicleEquipment, gt), this.ServiceFacilitySetRef = C ? new In(C) : void 0, this.Centroid = E ? tt.fromXML(E) : void 0, this.Polygon = L ? new le(L) : void 0, this.PublicUse = X?.text_value, this.TotalCapacity = _?.text_value, this.FareClass = G?.text_value, this.AirConditioned = q?.text_value;
|
|
1733
2528
|
}
|
|
1734
2529
|
toXML() {
|
|
1735
2530
|
return {
|
|
@@ -1739,13 +2534,13 @@ class W {
|
|
|
1739
2534
|
SmokingAllowed: this.SmokingAllowed,
|
|
1740
2535
|
StandingAllowed: this.StandingAllowed,
|
|
1741
2536
|
PassengerSpaceType: this.PassengerSpaceType,
|
|
1742
|
-
passengerSpots: this.passengerSpots ?
|
|
1743
|
-
luggageSpots: this.luggageSpots ?
|
|
1744
|
-
deckEntrances: this.deckEntrances ?
|
|
1745
|
-
deckEntranceUsage: this.deckEntranceUsage ?
|
|
1746
|
-
deckEntranceCouples: this.deckEntranceCouples ?
|
|
1747
|
-
deckSpaceCapacities: this.deckSpaceCapacities ?
|
|
1748
|
-
actualVehicleEquipments: this.actualVehicleEquipments ?
|
|
2537
|
+
passengerSpots: this.passengerSpots ? j(this.passengerSpots) : "",
|
|
2538
|
+
luggageSpots: this.luggageSpots ? j(this.luggageSpots) : void 0,
|
|
2539
|
+
deckEntrances: this.deckEntrances ? j(this.deckEntrances) : void 0,
|
|
2540
|
+
deckEntranceUsage: this.deckEntranceUsage ? j(this.deckEntranceUsage) : void 0,
|
|
2541
|
+
deckEntranceCouples: this.deckEntranceCouples ? j(this.deckEntranceCouples) : void 0,
|
|
2542
|
+
deckSpaceCapacities: this.deckSpaceCapacities ? j(this.deckSpaceCapacities) : void 0,
|
|
2543
|
+
actualVehicleEquipments: this.actualVehicleEquipments ? j(this.actualVehicleEquipments) : void 0,
|
|
1749
2544
|
ServiceFacilitySetRef: this.ServiceFacilitySetRef?.toXML(),
|
|
1750
2545
|
Centroid: this.Centroid?.toXML(),
|
|
1751
2546
|
Polygon: this.Polygon?.toXML(),
|
|
@@ -1756,7 +2551,7 @@ class W {
|
|
|
1756
2551
|
};
|
|
1757
2552
|
}
|
|
1758
2553
|
}
|
|
1759
|
-
class
|
|
2554
|
+
class Vn {
|
|
1760
2555
|
attr_id;
|
|
1761
2556
|
attr_version;
|
|
1762
2557
|
Name;
|
|
@@ -1768,26 +2563,26 @@ class vs {
|
|
|
1768
2563
|
Width;
|
|
1769
2564
|
Length;
|
|
1770
2565
|
constructor({
|
|
1771
|
-
attr_id:
|
|
1772
|
-
attr_version:
|
|
1773
|
-
deckSpaces:
|
|
1774
|
-
spotRows:
|
|
1775
|
-
spotColumns:
|
|
1776
|
-
DeckLevelRef:
|
|
1777
|
-
Name:
|
|
2566
|
+
attr_id: t,
|
|
2567
|
+
attr_version: e,
|
|
2568
|
+
deckSpaces: s,
|
|
2569
|
+
spotRows: r = void 0,
|
|
2570
|
+
spotColumns: i = void 0,
|
|
2571
|
+
DeckLevelRef: l = void 0,
|
|
2572
|
+
Name: o = void 0,
|
|
1778
2573
|
polygon: a = void 0,
|
|
1779
|
-
Width:
|
|
2574
|
+
Width: c = void 0,
|
|
1780
2575
|
Length: h = void 0
|
|
1781
2576
|
}) {
|
|
1782
|
-
this.attr_id =
|
|
2577
|
+
this.attr_id = t, this.attr_version = e, this.Name = o ?? "", this.polygon = a ? new le(a) : void 0, this.DeckLevelRef = l ? new Sn(l) : void 0, this.Width = c ?? 2.825, this.Length = h ?? 26.4, this.deckspaces = s ? Object.entries(s).flatMap(([d, f]) => d === "OtherDeckSpace" ? A(f, xn) : d === "PassengerSpace" ? A(f, B) : []) : [], this.spotRows = A(r?.SpotRow, Ln), this.spotColumns = A(i?.SpotColumn, An);
|
|
1783
2578
|
}
|
|
1784
2579
|
toXML() {
|
|
1785
2580
|
return {
|
|
1786
2581
|
attr_id: this.attr_id,
|
|
1787
2582
|
attr_version: this.attr_version,
|
|
1788
|
-
spotRows: { SpotRow:
|
|
1789
|
-
spotColumns: { SpotColumn:
|
|
1790
|
-
deckSpaces:
|
|
2583
|
+
spotRows: { SpotRow: J(this.spotRows) },
|
|
2584
|
+
spotColumns: { SpotColumn: J(this.spotColumns) },
|
|
2585
|
+
deckSpaces: j(this.deckspaces),
|
|
1791
2586
|
DeckLevelRef: this.DeckLevelRef?.toXML(),
|
|
1792
2587
|
polygon: this.polygon?.toXML(),
|
|
1793
2588
|
Name: this.Name,
|
|
@@ -1796,16 +2591,16 @@ class vs {
|
|
|
1796
2591
|
};
|
|
1797
2592
|
}
|
|
1798
2593
|
getBoundingBox() {
|
|
1799
|
-
const
|
|
1800
|
-
return { width:
|
|
2594
|
+
const t = this.Length, e = this.Width;
|
|
2595
|
+
return { width: t, height: e };
|
|
1801
2596
|
}
|
|
1802
|
-
getShape(
|
|
1803
|
-
const { width:
|
|
2597
|
+
getShape(t) {
|
|
2598
|
+
const { width: e, height: s } = this.getBoundingBox();
|
|
1804
2599
|
return {
|
|
1805
2600
|
x: 5,
|
|
1806
2601
|
y: 5,
|
|
1807
|
-
width:
|
|
1808
|
-
height:
|
|
2602
|
+
width: e * t,
|
|
2603
|
+
height: s * t,
|
|
1809
2604
|
fill: "white",
|
|
1810
2605
|
stroke: "gray",
|
|
1811
2606
|
strokeWidth: 2,
|
|
@@ -1813,29 +2608,29 @@ class vs {
|
|
|
1813
2608
|
};
|
|
1814
2609
|
}
|
|
1815
2610
|
}
|
|
1816
|
-
class
|
|
2611
|
+
class ce {
|
|
1817
2612
|
attr_id;
|
|
1818
2613
|
attr_version;
|
|
1819
2614
|
deckLevels;
|
|
1820
2615
|
decks;
|
|
1821
2616
|
constructor({
|
|
1822
|
-
attr_id:
|
|
1823
|
-
attr_version:
|
|
1824
|
-
decks:
|
|
1825
|
-
deckLevels:
|
|
2617
|
+
attr_id: t,
|
|
2618
|
+
attr_version: e,
|
|
2619
|
+
decks: s = void 0,
|
|
2620
|
+
deckLevels: r = void 0
|
|
1826
2621
|
}) {
|
|
1827
|
-
this.attr_id =
|
|
2622
|
+
this.attr_id = t, this.attr_version = e, this.deckLevels = A(r?.DeckLevel, wn), this.decks = A(s?.Deck, Vn);
|
|
1828
2623
|
}
|
|
1829
2624
|
toXML() {
|
|
1830
2625
|
return {
|
|
1831
2626
|
attr_id: this.attr_id,
|
|
1832
2627
|
attr_version: this.attr_version,
|
|
1833
|
-
decks: { Deck:
|
|
1834
|
-
deckLevels: { DeckLevel:
|
|
2628
|
+
decks: { Deck: J(this.decks) },
|
|
2629
|
+
deckLevels: { DeckLevel: J(this.deckLevels) }
|
|
1835
2630
|
};
|
|
1836
2631
|
}
|
|
1837
2632
|
}
|
|
1838
|
-
const
|
|
2633
|
+
const he = /* @__PURE__ */ rt({
|
|
1839
2634
|
__name: "DeckVisualization",
|
|
1840
2635
|
props: {
|
|
1841
2636
|
deck: {
|
|
@@ -1855,31 +2650,31 @@ const et = /* @__PURE__ */ ne({
|
|
|
1855
2650
|
}
|
|
1856
2651
|
},
|
|
1857
2652
|
emits: ["select", "area-select"],
|
|
1858
|
-
setup(
|
|
1859
|
-
const
|
|
1860
|
-
const
|
|
1861
|
-
return
|
|
1862
|
-
}) || []), h =
|
|
2653
|
+
setup(n, { emit: t }) {
|
|
2654
|
+
const e = n, s = t, r = W(null), i = W(!1), l = W({ x: 0, y: 0 }), o = W([]), a = W(/* @__PURE__ */ new Map()), c = ct(() => e.deck.deckspaces?.flatMap((u) => u instanceof B ? u.passengerSpots?.filter((p) => p instanceof ht) || [] : []).map((u) => {
|
|
2655
|
+
const p = u;
|
|
2656
|
+
return p.availability = e.availability && u.attr_id ? pt[e.availability[u.attr_id] ?? "Undefined"] : pt.Undefined, p;
|
|
2657
|
+
}) || []), h = ct(() => e.deck.deckspaces?.flatMap((u) => u instanceof B ? u.deckEntrances || [] : []) || []), d = (u) => e.selectedElements.includes(u) ? {
|
|
1863
2658
|
stroke: "#68a691",
|
|
1864
2659
|
strokeWidth: 3
|
|
1865
|
-
} : {}, f = (u,
|
|
1866
|
-
let
|
|
1867
|
-
const { width:
|
|
1868
|
-
return
|
|
1869
|
-
width:
|
|
1870
|
-
height:
|
|
2660
|
+
} : {}, f = (u, p) => {
|
|
2661
|
+
let g = 0, N = 0;
|
|
2662
|
+
const { width: S, height: O } = u.getBoundingBox();
|
|
2663
|
+
return g = Math.max(g, S), N = Math.max(N, O), {
|
|
2664
|
+
width: g * p + 10,
|
|
2665
|
+
height: N * p + 10
|
|
1871
2666
|
};
|
|
1872
|
-
}, y = (u,
|
|
1873
|
-
|
|
1874
|
-
},
|
|
2667
|
+
}, y = (u, p) => {
|
|
2668
|
+
i.value || (s("select", { element: p, ctrlKey: u.evt.ctrlKey || u.evt.metaKey }), u.cancelBubble = !0);
|
|
2669
|
+
}, C = (u) => {
|
|
1875
2670
|
if (u.evt.ctrlKey || u.evt.metaKey || u.target === u.target.getStage()) {
|
|
1876
|
-
|
|
1877
|
-
const
|
|
1878
|
-
|
|
1879
|
-
const
|
|
1880
|
-
|
|
1881
|
-
x:
|
|
1882
|
-
y:
|
|
2671
|
+
i.value = !0;
|
|
2672
|
+
const g = u.target.getStage().getPointerPosition(), N = u.target.getAbsoluteTransform().copy();
|
|
2673
|
+
N.invert();
|
|
2674
|
+
const S = N.point(g);
|
|
2675
|
+
l.value = { x: S.x, y: S.y }, r.value = {
|
|
2676
|
+
x: S.x,
|
|
2677
|
+
y: S.y,
|
|
1883
2678
|
width: 0,
|
|
1884
2679
|
height: 0,
|
|
1885
2680
|
fill: "rgba(0, 255, 0, 0.3)",
|
|
@@ -1887,170 +2682,170 @@ const et = /* @__PURE__ */ ne({
|
|
|
1887
2682
|
strokeWidth: 1
|
|
1888
2683
|
};
|
|
1889
2684
|
} else
|
|
1890
|
-
|
|
1891
|
-
},
|
|
1892
|
-
if (!
|
|
1893
|
-
const
|
|
1894
|
-
|
|
1895
|
-
const
|
|
1896
|
-
|
|
1897
|
-
},
|
|
1898
|
-
if (!
|
|
1899
|
-
|
|
1900
|
-
const u =
|
|
2685
|
+
s("area-select", []);
|
|
2686
|
+
}, E = (u) => {
|
|
2687
|
+
if (!i.value) return;
|
|
2688
|
+
const g = u.target.getStage().getPointerPosition(), N = u.target.getAbsoluteTransform().copy();
|
|
2689
|
+
N.invert();
|
|
2690
|
+
const S = N.point(g);
|
|
2691
|
+
r.value.width = S.x - l.value.x, r.value.height = S.y - l.value.y;
|
|
2692
|
+
}, L = () => {
|
|
2693
|
+
if (!i.value) return;
|
|
2694
|
+
i.value = !1;
|
|
2695
|
+
const u = r.value;
|
|
1901
2696
|
if (!u) return;
|
|
1902
|
-
const
|
|
1903
|
-
const
|
|
1904
|
-
return
|
|
2697
|
+
const p = u.width > 0 ? u.x : u.x + u.width, g = u.height > 0 ? u.y : u.y + u.height, N = Math.abs(u.width), S = Math.abs(u.height), O = c.value.filter((M) => {
|
|
2698
|
+
const P = M.getShape(e.scale);
|
|
2699
|
+
return P.x < p + N && P.x + P.width > p && P.y < g + S && P.y + P.height > g;
|
|
1905
2700
|
});
|
|
1906
|
-
|
|
1907
|
-
},
|
|
1908
|
-
a.value.clear(),
|
|
1909
|
-
if (
|
|
1910
|
-
const
|
|
1911
|
-
a.value.set(
|
|
2701
|
+
O.length > 0 && s("area-select", O), r.value = null;
|
|
2702
|
+
}, X = (u, p) => {
|
|
2703
|
+
a.value.clear(), e.selectedElements.includes(p) && e.selectedElements.forEach((g) => {
|
|
2704
|
+
if (g instanceof ht) {
|
|
2705
|
+
const N = g.getShape(e.scale);
|
|
2706
|
+
a.value.set(g, { x: N.x, y: N.y });
|
|
1912
2707
|
}
|
|
1913
2708
|
});
|
|
1914
|
-
},
|
|
1915
|
-
|
|
1916
|
-
const
|
|
1917
|
-
let
|
|
1918
|
-
|
|
1919
|
-
const
|
|
1920
|
-
Math.abs(
|
|
1921
|
-
points: [
|
|
2709
|
+
}, _ = (u, p) => {
|
|
2710
|
+
o.value = [];
|
|
2711
|
+
const g = u.target.getStage(), N = c.value.filter((k) => k !== p && !e.selectedElements.includes(k)), S = u.target.x(), O = u.target.y(), M = 10;
|
|
2712
|
+
let P = S, m = O;
|
|
2713
|
+
N.forEach((k) => {
|
|
2714
|
+
const I = k.getShape(e.scale);
|
|
2715
|
+
Math.abs(S - I.x) < M && (P = I.x, o.value.push({
|
|
2716
|
+
points: [I.x, 0, I.x, g.height()],
|
|
1922
2717
|
stroke: "red",
|
|
1923
2718
|
strokeWidth: 1,
|
|
1924
2719
|
dash: [4, 6]
|
|
1925
|
-
})), Math.abs(
|
|
1926
|
-
points: [0,
|
|
2720
|
+
})), Math.abs(O - I.y) < M && (m = I.y, o.value.push({
|
|
2721
|
+
points: [0, I.y, g.width(), I.y],
|
|
1927
2722
|
stroke: "red",
|
|
1928
2723
|
strokeWidth: 1,
|
|
1929
2724
|
dash: [4, 6]
|
|
1930
2725
|
}));
|
|
1931
|
-
}), u.target.x(
|
|
1932
|
-
const
|
|
1933
|
-
if (
|
|
1934
|
-
const
|
|
1935
|
-
|
|
1936
|
-
if (
|
|
1937
|
-
const
|
|
1938
|
-
|
|
2726
|
+
}), u.target.x(P), u.target.y(m);
|
|
2727
|
+
const $ = a.value.get(p);
|
|
2728
|
+
if ($ && e.selectedElements.includes(p)) {
|
|
2729
|
+
const k = P - $.x, I = m - $.y;
|
|
2730
|
+
e.selectedElements.forEach((H) => {
|
|
2731
|
+
if (H !== p && H instanceof ht) {
|
|
2732
|
+
const U = a.value.get(H);
|
|
2733
|
+
U && q(H, U.x + k, U.y + I);
|
|
1939
2734
|
}
|
|
1940
2735
|
});
|
|
1941
2736
|
}
|
|
1942
|
-
},
|
|
1943
|
-
|
|
1944
|
-
const
|
|
1945
|
-
|
|
1946
|
-
},
|
|
1947
|
-
u.Centroid ? (u.Centroid.x = (
|
|
1948
|
-
(
|
|
1949
|
-
(
|
|
2737
|
+
}, G = (u, p) => {
|
|
2738
|
+
o.value = [];
|
|
2739
|
+
const g = u.target.x(), N = u.target.y();
|
|
2740
|
+
q(p, g, N), a.value.clear();
|
|
2741
|
+
}, q = (u, p, g) => {
|
|
2742
|
+
u.Centroid ? (u.Centroid.x = (p - 5) / e.scale + u.Width / 2, u.Centroid.y = (g - 5) / e.scale + u.Length / 2) : u.Centroid = new tt(
|
|
2743
|
+
(p - 5) / e.scale + u.Width / 2,
|
|
2744
|
+
(g - 5) / e.scale + u.Length / 2
|
|
1950
2745
|
);
|
|
1951
|
-
},
|
|
1952
|
-
const
|
|
1953
|
-
let
|
|
1954
|
-
|
|
1955
|
-
},
|
|
1956
|
-
const
|
|
1957
|
-
Math.abs(
|
|
2746
|
+
}, z = (u, p) => {
|
|
2747
|
+
const g = u.target.x(), N = u.target.y(), S = e.deck.Width * e.scale, O = e.deck.Length * e.scale, M = p.getShape(e.scale, e.deck.Length, e.deck.Width), P = M.width, m = M.height, $ = 5, k = 5, I = $ + O, H = k + S, U = g + P / 2, At = N + m / 2, Lt = Math.abs(U - $), $t = Math.abs(U - I), Mt = Math.abs(At - k), Ot = Math.abs(At - H), mt = Math.min(Lt, $t, Mt, Ot);
|
|
2748
|
+
let ot = g, at = N;
|
|
2749
|
+
mt === Mt ? (at = k, ot = Math.max($, Math.min(g, I - P))) : mt === Ot ? (at = H - m, ot = Math.max($, Math.min(g, I - P))) : mt === Lt ? (ot = $, at = S / 2 + 5 - m / 2) : mt === $t && (ot = I - P, at = S / 2 + 5 - m / 2), u.target.x(ot), u.target.y(at), p.Centroid || (p.Centroid = new tt(0, 0)), p.Centroid.x = ot / e.scale, p.Centroid.y = at / e.scale;
|
|
2750
|
+
}, v = (u, p) => {
|
|
2751
|
+
const g = u.target.x(), N = u.target.y(), S = e.deck.Width * e.scale, O = e.deck.Length * e.scale, M = p.getShape(e.scale, e.deck.Length, e.deck.Width), P = M.width, m = M.height, $ = 5, k = 5, I = $ + O, H = k + S, U = 1;
|
|
2752
|
+
Math.abs(N - k) < U ? (p.VehicleSide = "leftSide", p.SequenceFromFront = (g - $ + P / 2) / e.scale) : Math.abs(N - (H - m)) < U ? (p.VehicleSide = "rightSide", p.SequenceFromFront = (g - $ + P / 2) / e.scale) : Math.abs(g - $) < U ? (p.VehicleSide = "front", p.SequenceFromFront = 0) : Math.abs(g - (I - P)) < U && (p.VehicleSide = "back", p.SequenceFromFront = e.deck.Length);
|
|
1958
2753
|
};
|
|
1959
|
-
return (u,
|
|
1960
|
-
const
|
|
1961
|
-
return
|
|
1962
|
-
config: f(
|
|
2754
|
+
return (u, p) => {
|
|
2755
|
+
const g = lt("v-rect"), N = lt("v-text"), S = lt("v-group"), O = lt("v-line"), M = lt("v-layer"), P = lt("v-stage");
|
|
2756
|
+
return b(), nt(P, {
|
|
2757
|
+
config: f(n.deck, n.scale)
|
|
1963
2758
|
}, {
|
|
1964
|
-
default:
|
|
1965
|
-
|
|
1966
|
-
default:
|
|
1967
|
-
|
|
1968
|
-
config: { ...
|
|
1969
|
-
onClick:
|
|
2759
|
+
default: yt(() => [
|
|
2760
|
+
Y(M, null, {
|
|
2761
|
+
default: yt(() => [
|
|
2762
|
+
Y(g, {
|
|
2763
|
+
config: { ...n.deck.getShape(n.scale), y: 5, ...d(n.deck) },
|
|
2764
|
+
onClick: p[0] || (p[0] = (m) => y(m, n.deck))
|
|
1970
2765
|
}, null, 8, ["config"]),
|
|
1971
|
-
|
|
2766
|
+
Y(g, {
|
|
1972
2767
|
config: {
|
|
1973
2768
|
x: 0,
|
|
1974
2769
|
y: 0,
|
|
1975
|
-
width:
|
|
1976
|
-
height:
|
|
2770
|
+
width: n.deck.getShape(n.scale).width,
|
|
2771
|
+
height: n.deck.getShape(n.scale).height,
|
|
1977
2772
|
fill: "transparent",
|
|
1978
2773
|
listening: !0
|
|
1979
2774
|
},
|
|
1980
|
-
onMousedown:
|
|
1981
|
-
onMousemove:
|
|
1982
|
-
onMouseup:
|
|
2775
|
+
onMousedown: C,
|
|
2776
|
+
onMousemove: E,
|
|
2777
|
+
onMouseup: L
|
|
1983
2778
|
}, null, 8, ["config"]),
|
|
1984
|
-
(
|
|
1985
|
-
key: `seats-${
|
|
2779
|
+
(b(!0), x(K, null, Z(c.value, (m, $) => (b(), nt(S, {
|
|
2780
|
+
key: `seats-${$}`,
|
|
1986
2781
|
config: {
|
|
1987
|
-
x:
|
|
1988
|
-
y:
|
|
2782
|
+
x: m.getShape(n.scale).x,
|
|
2783
|
+
y: m.getShape(n.scale).y,
|
|
1989
2784
|
draggable: !0
|
|
1990
2785
|
},
|
|
1991
|
-
onDragstart: (
|
|
1992
|
-
onDragend: (
|
|
1993
|
-
onDragmove: (
|
|
1994
|
-
onClick: (
|
|
2786
|
+
onDragstart: (k) => X(k, m),
|
|
2787
|
+
onDragend: (k) => G(k, m),
|
|
2788
|
+
onDragmove: (k) => _(k, m),
|
|
2789
|
+
onClick: (k) => y(k, m)
|
|
1995
2790
|
}, {
|
|
1996
|
-
default:
|
|
1997
|
-
|
|
2791
|
+
default: yt(() => [
|
|
2792
|
+
Y(g, {
|
|
1998
2793
|
config: {
|
|
1999
|
-
width:
|
|
2000
|
-
height:
|
|
2001
|
-
fill:
|
|
2002
|
-
stroke:
|
|
2003
|
-
strokeWidth:
|
|
2004
|
-
cornerRadius:
|
|
2005
|
-
...d(
|
|
2794
|
+
width: m.getShape(n.scale).width,
|
|
2795
|
+
height: m.getShape(n.scale).height,
|
|
2796
|
+
fill: m.getShape(n.scale).fill,
|
|
2797
|
+
stroke: m.getShape(n.scale).stroke,
|
|
2798
|
+
strokeWidth: m.getShape(n.scale).strokeWidth,
|
|
2799
|
+
cornerRadius: m.getShape(n.scale).cornerRadius,
|
|
2800
|
+
...d(m)
|
|
2006
2801
|
}
|
|
2007
2802
|
}, null, 8, ["config"]),
|
|
2008
|
-
|
|
2803
|
+
Y(N, {
|
|
2009
2804
|
config: {
|
|
2010
|
-
width:
|
|
2011
|
-
height:
|
|
2012
|
-
text:
|
|
2805
|
+
width: m.getShape(n.scale).width,
|
|
2806
|
+
height: m.getShape(n.scale).height,
|
|
2807
|
+
text: m.Label,
|
|
2013
2808
|
align: "center",
|
|
2014
2809
|
verticalAlign: "middle",
|
|
2015
|
-
fontSize: Math.min(Math.min(
|
|
2810
|
+
fontSize: Math.min(Math.min(m.getShape(n.scale).width, m.getShape(n.scale).height) / 2, 16),
|
|
2016
2811
|
listening: !1
|
|
2017
2812
|
}
|
|
2018
2813
|
}, null, 8, ["config"])
|
|
2019
2814
|
]),
|
|
2020
2815
|
_: 2
|
|
2021
2816
|
}, 1032, ["config", "onDragstart", "onDragend", "onDragmove", "onClick"]))), 128)),
|
|
2022
|
-
(
|
|
2023
|
-
key: `entrance-${
|
|
2817
|
+
(b(!0), x(K, null, Z(h.value, (m, $) => (b(), nt(S, {
|
|
2818
|
+
key: `entrance-${$}`,
|
|
2024
2819
|
config: {
|
|
2025
|
-
x:
|
|
2026
|
-
y:
|
|
2820
|
+
x: m.getShape(n.scale, n.deck.Length, n.deck.Width).x,
|
|
2821
|
+
y: m.getShape(n.scale, n.deck.Length, n.deck.Width).y,
|
|
2027
2822
|
draggable: !0
|
|
2028
2823
|
},
|
|
2029
|
-
onDragmove: (
|
|
2030
|
-
onDragend: (
|
|
2031
|
-
onClick: (
|
|
2824
|
+
onDragmove: (k) => z(k, m),
|
|
2825
|
+
onDragend: (k) => v(k, m),
|
|
2826
|
+
onClick: (k) => y(k, m)
|
|
2032
2827
|
}, {
|
|
2033
|
-
default:
|
|
2034
|
-
|
|
2828
|
+
default: yt(() => [
|
|
2829
|
+
Y(g, {
|
|
2035
2830
|
config: {
|
|
2036
|
-
width:
|
|
2037
|
-
height:
|
|
2038
|
-
fill:
|
|
2039
|
-
stroke:
|
|
2040
|
-
strokeWidth:
|
|
2041
|
-
...d(
|
|
2831
|
+
width: m.getShape(n.scale, n.deck.Length, n.deck.Width).width,
|
|
2832
|
+
height: m.getShape(n.scale, n.deck.Length, n.deck.Width).height,
|
|
2833
|
+
fill: m.getShape(n.scale, n.deck.Length, n.deck.Width).fill,
|
|
2834
|
+
stroke: m.getShape(n.scale, n.deck.Length, n.deck.Width).stroke,
|
|
2835
|
+
strokeWidth: m.getShape(n.scale, n.deck.Length, n.deck.Width).strokeWidth,
|
|
2836
|
+
...d(m)
|
|
2042
2837
|
}
|
|
2043
2838
|
}, null, 8, ["config"])
|
|
2044
2839
|
]),
|
|
2045
2840
|
_: 2
|
|
2046
2841
|
}, 1032, ["config", "onDragmove", "onDragend", "onClick"]))), 128)),
|
|
2047
|
-
|
|
2842
|
+
r.value ? (b(), nt(g, {
|
|
2048
2843
|
key: 0,
|
|
2049
|
-
config: { ...
|
|
2050
|
-
}, null, 8, ["config"])) :
|
|
2051
|
-
(
|
|
2052
|
-
key: `guide-${
|
|
2053
|
-
config:
|
|
2844
|
+
config: { ...r.value, listening: !1 }
|
|
2845
|
+
}, null, 8, ["config"])) : vt("", !0),
|
|
2846
|
+
(b(!0), x(K, null, Z(o.value, (m, $) => (b(), nt(O, {
|
|
2847
|
+
key: `guide-${$}`,
|
|
2848
|
+
config: m
|
|
2054
2849
|
}, null, 8, ["config"]))), 128))
|
|
2055
2850
|
]),
|
|
2056
2851
|
_: 1
|
|
@@ -2060,7 +2855,7 @@ const et = /* @__PURE__ */ ne({
|
|
|
2060
2855
|
}, 8, ["config"]);
|
|
2061
2856
|
};
|
|
2062
2857
|
}
|
|
2063
|
-
}),
|
|
2858
|
+
}), Rn = { class: "flex flex-col h-full" }, Fn = { class: "flex p-4 w-full items-center justify-center gap-10" }, Wn = { for: "scale-slider" }, Xn = { style: { display: "flex", "flex-direction": "row", "overflow-x": "auto", gap: "20px", padding: "20px" } }, Un = ["onClick"], ue = /* @__PURE__ */ rt({
|
|
2064
2859
|
__name: "WagonVisualization",
|
|
2065
2860
|
props: {
|
|
2066
2861
|
deckPlans: {
|
|
@@ -2072,51 +2867,51 @@ const et = /* @__PURE__ */ ne({
|
|
|
2072
2867
|
default: () => []
|
|
2073
2868
|
}
|
|
2074
2869
|
},
|
|
2075
|
-
setup(
|
|
2076
|
-
const
|
|
2077
|
-
return (
|
|
2078
|
-
w("div",
|
|
2079
|
-
w("label",
|
|
2080
|
-
|
|
2870
|
+
setup(n) {
|
|
2871
|
+
const t = W(20);
|
|
2872
|
+
return (e, s) => (b(), x("div", Rn, [
|
|
2873
|
+
w("div", Fn, [
|
|
2874
|
+
w("label", Wn, "Scale: " + D(t.value), 1),
|
|
2875
|
+
bt(w("input", {
|
|
2081
2876
|
id: "scale-slider",
|
|
2082
2877
|
type: "range",
|
|
2083
2878
|
min: "10",
|
|
2084
2879
|
max: "50",
|
|
2085
|
-
"onUpdate:modelValue":
|
|
2880
|
+
"onUpdate:modelValue": s[0] || (s[0] = (r) => t.value = r)
|
|
2086
2881
|
}, null, 512), [
|
|
2087
2882
|
[
|
|
2088
|
-
|
|
2089
|
-
|
|
2883
|
+
Gt,
|
|
2884
|
+
t.value,
|
|
2090
2885
|
void 0,
|
|
2091
2886
|
{ number: !0 }
|
|
2092
2887
|
]
|
|
2093
2888
|
])
|
|
2094
2889
|
]),
|
|
2095
|
-
w("div",
|
|
2096
|
-
(
|
|
2097
|
-
key: `deckplan-${
|
|
2890
|
+
w("div", Xn, [
|
|
2891
|
+
(b(!0), x(K, null, Z(n.deckPlans, (r, i) => (b(), x("div", {
|
|
2892
|
+
key: `deckplan-${i}`
|
|
2098
2893
|
}, [
|
|
2099
|
-
w("h3", null,
|
|
2100
|
-
(
|
|
2101
|
-
key: `deck-${
|
|
2894
|
+
w("h3", null, D(r.attr_id), 1),
|
|
2895
|
+
(b(!0), x(K, null, Z(r.decks, (l, o) => (b(), x("div", {
|
|
2896
|
+
key: `deck-${o}`
|
|
2102
2897
|
}, [
|
|
2103
2898
|
w("h4", {
|
|
2104
|
-
onClick: (a) =>
|
|
2105
|
-
class:
|
|
2106
|
-
},
|
|
2107
|
-
|
|
2108
|
-
deck:
|
|
2109
|
-
scale:
|
|
2110
|
-
selectedElements:
|
|
2111
|
-
onSelect:
|
|
2112
|
-
onAreaSelect:
|
|
2899
|
+
onClick: (a) => e.$emit("select", { element: l, ctrlKey: !1 }),
|
|
2900
|
+
class: st(`${n.selectedElements.includes(l) ? "text-ott-accent" : ""} cursor-pointer`)
|
|
2901
|
+
}, D(l.Name), 11, Un),
|
|
2902
|
+
Y(he, {
|
|
2903
|
+
deck: l,
|
|
2904
|
+
scale: t.value,
|
|
2905
|
+
selectedElements: n.selectedElements,
|
|
2906
|
+
onSelect: s[1] || (s[1] = (a) => e.$emit("select", a)),
|
|
2907
|
+
onAreaSelect: s[2] || (s[2] = (a) => e.$emit("area-select", a))
|
|
2113
2908
|
}, null, 8, ["deck", "scale", "selectedElements"])
|
|
2114
2909
|
]))), 128))
|
|
2115
2910
|
]))), 128))
|
|
2116
2911
|
])
|
|
2117
2912
|
]));
|
|
2118
2913
|
}
|
|
2119
|
-
}),
|
|
2914
|
+
}), Bn = { class: "bg-ott-bg-primary p-4" }, qn = { class: "flex justify-between items-center mb-4" }, jn = { key: 0 }, Gn = ["for"], zn = ["id", "onUpdate:modelValue", "type"], Hn = ["id", "onUpdate:modelValue"], Yn = { key: 2 }, Kn = ["id", "onUpdate:modelValue"], Zn = { key: 3 }, Jn = { key: 4 }, Qn = { key: 1 }, Dn = /* @__PURE__ */ rt({
|
|
2120
2915
|
__name: "ObjectProperties",
|
|
2121
2916
|
props: {
|
|
2122
2917
|
element: {
|
|
@@ -2125,78 +2920,78 @@ const et = /* @__PURE__ */ ne({
|
|
|
2125
2920
|
}
|
|
2126
2921
|
},
|
|
2127
2922
|
emits: ["delete"],
|
|
2128
|
-
setup(
|
|
2129
|
-
return (
|
|
2130
|
-
w("div",
|
|
2131
|
-
|
|
2132
|
-
|
|
2923
|
+
setup(n) {
|
|
2924
|
+
return (t, e) => (b(), x("div", Bn, [
|
|
2925
|
+
w("div", qn, [
|
|
2926
|
+
e[1] || (e[1] = w("h3", { class: "font-bold" }, "Properties", -1)),
|
|
2927
|
+
n.element ? (b(), x("button", {
|
|
2133
2928
|
key: 0,
|
|
2134
2929
|
class: "ott-button border-ott-error! text-ott-error!",
|
|
2135
|
-
onClick:
|
|
2136
|
-
}, " Delete ")) :
|
|
2930
|
+
onClick: e[0] || (e[0] = (s) => t.$emit("delete", n.element))
|
|
2931
|
+
}, " Delete ")) : vt("", !0)
|
|
2137
2932
|
]),
|
|
2138
|
-
|
|
2139
|
-
(
|
|
2140
|
-
key:
|
|
2933
|
+
n.element ? (b(), x("div", jn, [
|
|
2934
|
+
(b(!0), x(K, null, Z(n.element, (s, r) => (b(), x("div", {
|
|
2935
|
+
key: r,
|
|
2141
2936
|
class: "flex items-center mb-10"
|
|
2142
2937
|
}, [
|
|
2143
2938
|
w("label", {
|
|
2144
|
-
for:
|
|
2939
|
+
for: r,
|
|
2145
2940
|
class: "min-w-[150px] font-bold"
|
|
2146
|
-
},
|
|
2147
|
-
typeof
|
|
2941
|
+
}, D(r), 9, Gn),
|
|
2942
|
+
typeof s == "string" || typeof s == "number" ? bt((b(), x("input", {
|
|
2148
2943
|
key: 0,
|
|
2149
|
-
id:
|
|
2150
|
-
"onUpdate:modelValue": (
|
|
2151
|
-
type: typeof
|
|
2152
|
-
}, null, 8,
|
|
2153
|
-
[
|
|
2154
|
-
]) : typeof
|
|
2944
|
+
id: r,
|
|
2945
|
+
"onUpdate:modelValue": (i) => n.element[r] = i,
|
|
2946
|
+
type: typeof s == "number" ? "number" : "text"
|
|
2947
|
+
}, null, 8, zn)), [
|
|
2948
|
+
[de, n.element[r]]
|
|
2949
|
+
]) : typeof s == "boolean" ? bt((b(), x("input", {
|
|
2155
2950
|
key: 1,
|
|
2156
|
-
id:
|
|
2157
|
-
"onUpdate:modelValue": (
|
|
2951
|
+
id: r,
|
|
2952
|
+
"onUpdate:modelValue": (i) => n.element[r] = i,
|
|
2158
2953
|
type: "checkbox"
|
|
2159
|
-
}, null, 8,
|
|
2160
|
-
[
|
|
2161
|
-
]) :
|
|
2162
|
-
|
|
2163
|
-
id:
|
|
2164
|
-
"onUpdate:modelValue": (
|
|
2954
|
+
}, null, 8, Hn)), [
|
|
2955
|
+
[fe, n.element[r]]
|
|
2956
|
+
]) : s && typeof s == "object" && s.value !== void 0 ? (b(), x("span", Yn, [
|
|
2957
|
+
bt(w("input", {
|
|
2958
|
+
id: r,
|
|
2959
|
+
"onUpdate:modelValue": (i) => s.value = i,
|
|
2165
2960
|
type: "text"
|
|
2166
|
-
}, null, 8,
|
|
2167
|
-
[
|
|
2961
|
+
}, null, 8, Kn), [
|
|
2962
|
+
[Gt, s.value]
|
|
2168
2963
|
])
|
|
2169
|
-
])) :
|
|
2964
|
+
])) : s && Array.isArray(s) ? (b(), x("span", Zn, D(s.length) + " elements ", 1)) : (b(), x("span", Jn, D(s), 1))
|
|
2170
2965
|
]))), 128))
|
|
2171
|
-
])) : (
|
|
2966
|
+
])) : (b(), x("div", Qn, [...e[2] || (e[2] = [
|
|
2172
2967
|
w("p", null, "Select an element to view properties.", -1)
|
|
2173
2968
|
])]))
|
|
2174
2969
|
]));
|
|
2175
2970
|
}
|
|
2176
|
-
}),
|
|
2177
|
-
const
|
|
2178
|
-
for (const [
|
|
2179
|
-
s
|
|
2180
|
-
return
|
|
2181
|
-
},
|
|
2971
|
+
}), ts = (n, t) => {
|
|
2972
|
+
const e = n.__vccOpts || n;
|
|
2973
|
+
for (const [s, r] of t)
|
|
2974
|
+
e[s] = r;
|
|
2975
|
+
return e;
|
|
2976
|
+
}, es = /* @__PURE__ */ ts(Dn, [["__scopeId", "data-v-1987e529"]]), ns = { class: "flex flex-col gap-2 p-4 bg-white flex-1" }, ss = { class: "flex flex-col gap-2" }, is = /* @__PURE__ */ rt({
|
|
2182
2977
|
__name: "ElementCatalog",
|
|
2183
2978
|
emits: ["add-seat", "add-door"],
|
|
2184
|
-
setup(
|
|
2185
|
-
return (
|
|
2186
|
-
|
|
2187
|
-
w("div",
|
|
2979
|
+
setup(n) {
|
|
2980
|
+
return (t, e) => (b(), x("div", ns, [
|
|
2981
|
+
e[2] || (e[2] = w("h3", { class: "font-bold mb-2" }, "Catalog", -1)),
|
|
2982
|
+
w("div", ss, [
|
|
2188
2983
|
w("button", {
|
|
2189
2984
|
class: "ott-button w-fit text-left",
|
|
2190
|
-
onClick:
|
|
2985
|
+
onClick: e[0] || (e[0] = (s) => t.$emit("add-seat"))
|
|
2191
2986
|
}, " + Add Seat "),
|
|
2192
2987
|
w("button", {
|
|
2193
2988
|
class: "ott-button w-fit text-left",
|
|
2194
|
-
onClick:
|
|
2989
|
+
onClick: e[1] || (e[1] = (s) => t.$emit("add-door"))
|
|
2195
2990
|
}, " + Add Door ")
|
|
2196
2991
|
])
|
|
2197
2992
|
]));
|
|
2198
2993
|
}
|
|
2199
|
-
}),
|
|
2994
|
+
}), rs = { class: "h-full overflow-y-auto bg-gray-100 p-4 font-mono text-sm" }, os = ["id"], as = /* @__PURE__ */ rt({
|
|
2200
2995
|
__name: "XmlViewer",
|
|
2201
2996
|
props: {
|
|
2202
2997
|
xml: {
|
|
@@ -2208,137 +3003,132 @@ const et = /* @__PURE__ */ ne({
|
|
|
2208
3003
|
default: null
|
|
2209
3004
|
}
|
|
2210
3005
|
},
|
|
2211
|
-
setup(
|
|
2212
|
-
const
|
|
2213
|
-
`)),
|
|
2214
|
-
if (!
|
|
2215
|
-
|
|
3006
|
+
setup(n) {
|
|
3007
|
+
const t = n, e = ct(() => t.xml.split(`
|
|
3008
|
+
`)), s = W(null), r = (l) => s.value ? l >= s.value.start && l <= s.value.end : !1, i = () => {
|
|
3009
|
+
if (!t.selectedId) {
|
|
3010
|
+
s.value = null;
|
|
2216
3011
|
return;
|
|
2217
3012
|
}
|
|
2218
|
-
const
|
|
2219
|
-
if (
|
|
2220
|
-
|
|
3013
|
+
const l = e.value.findIndex((a) => a.includes(`id="${t.selectedId}"`));
|
|
3014
|
+
if (l === -1) {
|
|
3015
|
+
s.value = null;
|
|
2221
3016
|
return;
|
|
2222
3017
|
}
|
|
2223
|
-
const
|
|
2224
|
-
if (
|
|
2225
|
-
if (
|
|
2226
|
-
|
|
3018
|
+
const o = e.value[l];
|
|
3019
|
+
if (o) {
|
|
3020
|
+
if (o.trim().endsWith("/>"))
|
|
3021
|
+
s.value = { start: l, end: l };
|
|
2227
3022
|
else {
|
|
2228
|
-
const a =
|
|
3023
|
+
const a = o.match(/<(\w+)/);
|
|
2229
3024
|
if (a) {
|
|
2230
|
-
const
|
|
2231
|
-
let h = 1, d =
|
|
2232
|
-
for (let f =
|
|
2233
|
-
const y =
|
|
2234
|
-
if (y && !y.match(new RegExp(`<${
|
|
3025
|
+
const c = a[1];
|
|
3026
|
+
let h = 1, d = l;
|
|
3027
|
+
for (let f = l + 1; f < e.value.length; f++) {
|
|
3028
|
+
const y = e.value[f];
|
|
3029
|
+
if (y && !y.match(new RegExp(`<${c}.*/>`)) && (y.match(new RegExp(`<${c}`)) ? h++ : y.match(new RegExp(`</${c}>`)) && h--, h === 0)) {
|
|
2235
3030
|
d = f;
|
|
2236
3031
|
break;
|
|
2237
3032
|
}
|
|
2238
3033
|
}
|
|
2239
|
-
|
|
3034
|
+
s.value = { start: l, end: d };
|
|
2240
3035
|
} else
|
|
2241
|
-
|
|
3036
|
+
s.value = { start: l, end: l };
|
|
2242
3037
|
}
|
|
2243
|
-
|
|
2244
|
-
document.getElementById(`line-${
|
|
3038
|
+
pe(() => {
|
|
3039
|
+
document.getElementById(`line-${l}`)?.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
2245
3040
|
});
|
|
2246
3041
|
}
|
|
2247
3042
|
};
|
|
2248
|
-
return
|
|
2249
|
-
|
|
2250
|
-
}, { immediate: !0 }), (
|
|
2251
|
-
(
|
|
2252
|
-
key:
|
|
2253
|
-
id: `line-${
|
|
2254
|
-
class:
|
|
3043
|
+
return zt(() => [t.selectedId, t.xml], () => {
|
|
3044
|
+
i();
|
|
3045
|
+
}, { immediate: !0 }), (l, o) => (b(), x("div", rs, [
|
|
3046
|
+
(b(!0), x(K, null, Z(e.value, (a, c) => (b(), x("div", {
|
|
3047
|
+
key: c,
|
|
3048
|
+
id: `line-${c}`,
|
|
3049
|
+
class: st({ "bg-yellow-200": r(c) })
|
|
2255
3050
|
}, [
|
|
2256
|
-
w("pre", null,
|
|
2257
|
-
], 10,
|
|
3051
|
+
w("pre", null, D(a), 1)
|
|
3052
|
+
], 10, os))), 128))
|
|
2258
3053
|
]));
|
|
2259
3054
|
}
|
|
2260
|
-
}),
|
|
2261
|
-
const
|
|
3055
|
+
}), ls = (n) => {
|
|
3056
|
+
const e = new te({
|
|
2262
3057
|
ignoreAttributes: !1,
|
|
2263
3058
|
attributeNamePrefix: "attr_",
|
|
3059
|
+
textNodeName: "text_value",
|
|
2264
3060
|
removeNSPrefix: !0
|
|
2265
|
-
}).parse(
|
|
2266
|
-
return
|
|
2267
|
-
|
|
2268
|
-
|
|
3061
|
+
}).parse(n);
|
|
3062
|
+
return A(
|
|
3063
|
+
e.PublicationDelivery.dataObjects.CompositeFrame.frames.ResourceFrame.deckPlans.DeckPlan,
|
|
3064
|
+
ce
|
|
2269
3065
|
);
|
|
2270
|
-
},
|
|
3066
|
+
}, cs = { class: "flex flex-col h-full" }, hs = { class: "p-4 border-b border-b-ott-bg-dark flex gap-2 items-center bg-ott-bg-primary" }, us = { class: "flex-1 flex overflow-hidden" }, ds = { class: "flex-1 overflow-hidden" }, fs = { class: "flex flex-row h-75 border-t border-ott-bg-dark" }, ps = /* @__PURE__ */ rt({
|
|
2271
3067
|
__name: "DeckplanEditor",
|
|
2272
|
-
setup(
|
|
2273
|
-
const
|
|
2274
|
-
if (!
|
|
2275
|
-
|
|
2276
|
-
const
|
|
3068
|
+
setup(n, { expose: t }) {
|
|
3069
|
+
const e = W(null), s = W([]), r = W([]), i = W(null), l = W(!1), o = W(""), a = () => {
|
|
3070
|
+
if (!l.value || !i.value) return;
|
|
3071
|
+
i.value.PublicationDelivery.dataObjects.CompositeFrame.frames.ResourceFrame.deckPlans.DeckPlan = J(s.value);
|
|
3072
|
+
const v = new F({
|
|
2277
3073
|
ignoreAttributes: !1,
|
|
2278
3074
|
textNodeName: "text_value",
|
|
2279
3075
|
attributeNamePrefix: "attr_",
|
|
2280
3076
|
format: !0
|
|
2281
3077
|
});
|
|
2282
|
-
|
|
2283
|
-
},
|
|
2284
|
-
|
|
3078
|
+
o.value = v.build(i.value);
|
|
3079
|
+
}, c = () => {
|
|
3080
|
+
l.value = !l.value, l.value && a();
|
|
2285
3081
|
};
|
|
2286
|
-
|
|
3082
|
+
zt(s, () => {
|
|
2287
3083
|
a();
|
|
2288
3084
|
}, { deep: !0 });
|
|
2289
|
-
const h = ({ element:
|
|
3085
|
+
const h = ({ element: v, ctrlKey: u }) => {
|
|
2290
3086
|
if (u) {
|
|
2291
|
-
const
|
|
2292
|
-
if (
|
|
2293
|
-
|
|
3087
|
+
const p = r.value.indexOf(v);
|
|
3088
|
+
if (p > -1)
|
|
3089
|
+
r.value.splice(p, 1);
|
|
2294
3090
|
else {
|
|
2295
|
-
if (
|
|
3091
|
+
if (r.value.length > 0 && r.value[0].constructor !== v.constructor)
|
|
2296
3092
|
return;
|
|
2297
|
-
|
|
3093
|
+
r.value.push(v);
|
|
2298
3094
|
}
|
|
2299
3095
|
} else
|
|
2300
|
-
|
|
2301
|
-
}, d = (
|
|
2302
|
-
|
|
2303
|
-
}, f = (
|
|
2304
|
-
const u =
|
|
2305
|
-
|
|
3096
|
+
r.value = [v];
|
|
3097
|
+
}, d = (v) => {
|
|
3098
|
+
r.value = v;
|
|
3099
|
+
}, f = (v) => {
|
|
3100
|
+
const u = v.target;
|
|
3101
|
+
e.value = u.files ? u.files[0] : null;
|
|
2306
3102
|
};
|
|
2307
3103
|
function y() {
|
|
2308
|
-
if (
|
|
2309
|
-
const
|
|
2310
|
-
|
|
2311
|
-
const
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
ignoreAttributes: !1,
|
|
2315
|
-
attributeNamePrefix: "attr_",
|
|
2316
|
-
removeNSPrefix: !0
|
|
2317
|
-
});
|
|
2318
|
-
r.value = p.parse(g), n.value = qs(g), n.value = [...n.value];
|
|
2319
|
-
}), b.readAsText(s.value);
|
|
3104
|
+
if (e.value) {
|
|
3105
|
+
const v = new FileReader();
|
|
3106
|
+
v.addEventListener("load", (u) => {
|
|
3107
|
+
const p = u.target?.result;
|
|
3108
|
+
typeof p == "string" && (s.value = ls(p), s.value = [...s.value]);
|
|
3109
|
+
}), v.readAsText(e.value);
|
|
2320
3110
|
}
|
|
2321
3111
|
}
|
|
2322
|
-
function
|
|
2323
|
-
if (
|
|
2324
|
-
|
|
2325
|
-
const u = new
|
|
3112
|
+
function C() {
|
|
3113
|
+
if (e.value) {
|
|
3114
|
+
i.value.PublicationDelivery.dataObjects.CompositeFrame.frames.ResourceFrame.deckPlans.DeckPlan = J(s.value);
|
|
3115
|
+
const u = new F({
|
|
2326
3116
|
ignoreAttributes: !1,
|
|
2327
3117
|
textNodeName: "text_value",
|
|
2328
3118
|
attributeNamePrefix: "attr_"
|
|
2329
|
-
}).build(
|
|
2330
|
-
|
|
3119
|
+
}).build(i.value), p = new Blob([u], { type: "text/xml" }), g = document.createElement("a");
|
|
3120
|
+
g.href = URL.createObjectURL(p), g.download = "Demo.xml", g.click();
|
|
2331
3121
|
}
|
|
2332
3122
|
}
|
|
2333
|
-
const
|
|
2334
|
-
const
|
|
2335
|
-
if (!
|
|
2336
|
-
const u =
|
|
3123
|
+
const E = () => s.value.length > 0 && s.value[0]?.decks.length && s.value[0]?.decks?.length > 0 ? s.value[0].decks[0] : null, L = () => {
|
|
3124
|
+
const v = E();
|
|
3125
|
+
if (!v) return;
|
|
3126
|
+
const u = v.deckspaces?.find((g) => g instanceof B);
|
|
2337
3127
|
if (!u) {
|
|
2338
3128
|
console.warn("No PassengerSpace found to add seat to");
|
|
2339
3129
|
return;
|
|
2340
3130
|
}
|
|
2341
|
-
const
|
|
3131
|
+
const p = new ht({
|
|
2342
3132
|
attr_id: `seat_${Date.now()}`,
|
|
2343
3133
|
attr_version: "1",
|
|
2344
3134
|
Label: "",
|
|
@@ -2354,16 +3144,16 @@ const et = /* @__PURE__ */ ne({
|
|
|
2354
3144
|
Width: 0.5,
|
|
2355
3145
|
Length: 0.5
|
|
2356
3146
|
});
|
|
2357
|
-
u.passengerSpots || (u.passengerSpots = []), u.passengerSpots.push(
|
|
2358
|
-
},
|
|
2359
|
-
const
|
|
2360
|
-
if (!
|
|
2361
|
-
const u =
|
|
3147
|
+
u.passengerSpots || (u.passengerSpots = []), u.passengerSpots.push(p);
|
|
3148
|
+
}, X = () => {
|
|
3149
|
+
const v = E();
|
|
3150
|
+
if (!v) return;
|
|
3151
|
+
const u = v.deckspaces?.find((g) => g instanceof B);
|
|
2362
3152
|
if (!u) {
|
|
2363
3153
|
console.warn("No PassengerSpace found to add door to");
|
|
2364
3154
|
return;
|
|
2365
3155
|
}
|
|
2366
|
-
const
|
|
3156
|
+
const p = new re({
|
|
2367
3157
|
attr_id: `door_${Date.now()}`,
|
|
2368
3158
|
attr_version: "1",
|
|
2369
3159
|
Name: { text_value: "New Door" },
|
|
@@ -2381,35 +3171,35 @@ const et = /* @__PURE__ */ ne({
|
|
|
2381
3171
|
IsAutomatic: void 0,
|
|
2382
3172
|
Centroid: void 0
|
|
2383
3173
|
});
|
|
2384
|
-
u.deckEntrances || (u.deckEntrances = []), u.deckEntrances.push(
|
|
2385
|
-
},
|
|
2386
|
-
|
|
2387
|
-
u.decks.forEach((
|
|
2388
|
-
|
|
2389
|
-
if (
|
|
2390
|
-
if (
|
|
2391
|
-
const
|
|
2392
|
-
|
|
3174
|
+
u.deckEntrances || (u.deckEntrances = []), u.deckEntrances.push(p);
|
|
3175
|
+
}, _ = (v) => {
|
|
3176
|
+
s.value.forEach((u) => {
|
|
3177
|
+
u.decks.forEach((p) => {
|
|
3178
|
+
p.deckspaces?.forEach((g) => {
|
|
3179
|
+
if (g instanceof B) {
|
|
3180
|
+
if (g.passengerSpots) {
|
|
3181
|
+
const N = g.passengerSpots.indexOf(v);
|
|
3182
|
+
N > -1 && g.passengerSpots.splice(N, 1);
|
|
2393
3183
|
}
|
|
2394
|
-
if (
|
|
2395
|
-
const
|
|
2396
|
-
|
|
3184
|
+
if (g.deckEntrances) {
|
|
3185
|
+
const N = g.deckEntrances.indexOf(v);
|
|
3186
|
+
N > -1 && g.deckEntrances.splice(N, 1);
|
|
2397
3187
|
}
|
|
2398
3188
|
}
|
|
2399
3189
|
});
|
|
2400
3190
|
});
|
|
2401
|
-
}),
|
|
3191
|
+
}), r.value = [];
|
|
2402
3192
|
};
|
|
2403
|
-
function
|
|
2404
|
-
return
|
|
3193
|
+
function G() {
|
|
3194
|
+
return i.value ? (i.value.PublicationDelivery.dataObjects.CompositeFrame.frames.ResourceFrame.deckPlans.DeckPlan = J(s.value), new F({
|
|
2405
3195
|
ignoreAttributes: !1,
|
|
2406
3196
|
textNodeName: "text_value",
|
|
2407
3197
|
attributeNamePrefix: "attr_",
|
|
2408
3198
|
format: !0
|
|
2409
|
-
}).build(
|
|
3199
|
+
}).build(i.value)) : null;
|
|
2410
3200
|
}
|
|
2411
|
-
function
|
|
2412
|
-
return new
|
|
3201
|
+
function q() {
|
|
3202
|
+
return new B({
|
|
2413
3203
|
attr_id: `ps-${Date.now()}`,
|
|
2414
3204
|
attr_version: "1",
|
|
2415
3205
|
Name: void 0,
|
|
@@ -2448,33 +3238,33 @@ const et = /* @__PURE__ */ ne({
|
|
|
2448
3238
|
AirConditioned: void 0
|
|
2449
3239
|
});
|
|
2450
3240
|
}
|
|
2451
|
-
function
|
|
2452
|
-
const
|
|
3241
|
+
function z(v) {
|
|
3242
|
+
const p = new te({
|
|
2453
3243
|
ignoreAttributes: !1,
|
|
2454
3244
|
attributeNamePrefix: "attr_",
|
|
2455
3245
|
removeNSPrefix: !0,
|
|
2456
3246
|
alwaysCreateTextNode: !1
|
|
2457
|
-
}).parse(
|
|
2458
|
-
|
|
2459
|
-
const
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
if (!
|
|
2463
|
-
|
|
3247
|
+
}).parse(v);
|
|
3248
|
+
i.value = p;
|
|
3249
|
+
const g = A(p.PublicationDelivery.dataObjects.CompositeFrame.frames.ResourceFrame.deckPlans.DeckPlan, ce);
|
|
3250
|
+
g.forEach((N) => {
|
|
3251
|
+
N.decks.forEach((S) => {
|
|
3252
|
+
if (!S.deckspaces || S.deckspaces.length === 0) {
|
|
3253
|
+
S.deckspaces = [q()];
|
|
2464
3254
|
return;
|
|
2465
3255
|
}
|
|
2466
|
-
const
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
}),
|
|
3256
|
+
const O = [];
|
|
3257
|
+
S.deckspaces.forEach((M) => {
|
|
3258
|
+
M instanceof B ? O.push(M) : (M?.passengerSpots || M?.PassengerSpaceType) && O.push(new B(M));
|
|
3259
|
+
}), S.deckspaces = O;
|
|
2470
3260
|
});
|
|
2471
|
-
}),
|
|
3261
|
+
}), s.value = g;
|
|
2472
3262
|
}
|
|
2473
|
-
return
|
|
2474
|
-
exportXml:
|
|
2475
|
-
loadXml:
|
|
2476
|
-
}), (
|
|
2477
|
-
w("div",
|
|
3263
|
+
return t({
|
|
3264
|
+
exportXml: G,
|
|
3265
|
+
loadXml: z
|
|
3266
|
+
}), (v, u) => (b(), x("div", cs, [
|
|
3267
|
+
w("div", hs, [
|
|
2478
3268
|
w("input", {
|
|
2479
3269
|
ref: "inputRef",
|
|
2480
3270
|
class: "ott-button",
|
|
@@ -2488,51 +3278,51 @@ const et = /* @__PURE__ */ ne({
|
|
|
2488
3278
|
class: "ott-button"
|
|
2489
3279
|
}, "Load"),
|
|
2490
3280
|
w("button", {
|
|
2491
|
-
onClick:
|
|
3281
|
+
onClick: C,
|
|
2492
3282
|
class: "ott-button"
|
|
2493
3283
|
}, "Save"),
|
|
2494
3284
|
w("button", {
|
|
2495
|
-
onClick:
|
|
2496
|
-
class:
|
|
3285
|
+
onClick: c,
|
|
3286
|
+
class: st(["ott-button", { "bg-ott-accent text-white": l.value }])
|
|
2497
3287
|
}, "XML", 2)
|
|
2498
3288
|
]),
|
|
2499
|
-
w("div",
|
|
2500
|
-
w("div",
|
|
2501
|
-
|
|
3289
|
+
w("div", us, [
|
|
3290
|
+
w("div", ds, [
|
|
3291
|
+
s.value.length > 0 ? (b(), nt(ue, {
|
|
2502
3292
|
key: 0,
|
|
2503
|
-
deckPlans:
|
|
2504
|
-
selectedElements:
|
|
3293
|
+
deckPlans: s.value,
|
|
3294
|
+
selectedElements: r.value,
|
|
2505
3295
|
onSelect: h,
|
|
2506
3296
|
onAreaSelect: d
|
|
2507
|
-
}, null, 8, ["deckPlans", "selectedElements"])) :
|
|
3297
|
+
}, null, 8, ["deckPlans", "selectedElements"])) : vt("", !0)
|
|
2508
3298
|
]),
|
|
2509
|
-
|
|
3299
|
+
l.value ? (b(), nt(as, {
|
|
2510
3300
|
key: 0,
|
|
2511
|
-
xml:
|
|
2512
|
-
selectedId:
|
|
3301
|
+
xml: o.value,
|
|
3302
|
+
selectedId: r.value[0]?.attr_id,
|
|
2513
3303
|
class: "w-1/3 border-l border-ott-bg-dark"
|
|
2514
|
-
}, null, 8, ["xml", "selectedId"])) :
|
|
3304
|
+
}, null, 8, ["xml", "selectedId"])) : vt("", !0)
|
|
2515
3305
|
]),
|
|
2516
|
-
w("div",
|
|
2517
|
-
|
|
2518
|
-
element:
|
|
3306
|
+
w("div", fs, [
|
|
3307
|
+
Y(es, {
|
|
3308
|
+
element: r.value.length === 1 ? r.value[0] : null,
|
|
2519
3309
|
class: "flex-1 overflow-y-auto",
|
|
2520
|
-
onDelete:
|
|
3310
|
+
onDelete: _
|
|
2521
3311
|
}, null, 8, ["element"]),
|
|
2522
|
-
|
|
3312
|
+
Y(is, {
|
|
2523
3313
|
class: "w-50 border-l border-ott-bg-dark",
|
|
2524
|
-
onAddSeat:
|
|
2525
|
-
onAddDoor:
|
|
3314
|
+
onAddSeat: L,
|
|
3315
|
+
onAddDoor: X
|
|
2526
3316
|
})
|
|
2527
3317
|
])
|
|
2528
3318
|
]));
|
|
2529
3319
|
}
|
|
2530
|
-
}),
|
|
3320
|
+
}), qt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2531
3321
|
__proto__: null,
|
|
2532
|
-
DeckVisualization:
|
|
2533
|
-
DeckplanEditor:
|
|
2534
|
-
WagonVisualization:
|
|
2535
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
3322
|
+
DeckVisualization: he,
|
|
3323
|
+
DeckplanEditor: ps,
|
|
3324
|
+
WagonVisualization: ue
|
|
3325
|
+
}, Symbol.toStringTag, { value: "Module" })), gs = ["width", "height"], ms = ["transform"], ys = ["transform", "onClick"], bs = ["transform"], vs = ["width", "height"], Es = ["x", "width", "height"], Ns = ["transform"], ws = ["x", "y", "font-size"], Ss = ["transform", "onClick"], xs = ["width", "height"], ks = /* @__PURE__ */ rt({
|
|
2536
3326
|
__name: "DeckRendering",
|
|
2537
3327
|
props: {
|
|
2538
3328
|
deck: { type: Object, required: !0 },
|
|
@@ -2543,120 +3333,120 @@ const et = /* @__PURE__ */ ne({
|
|
|
2543
3333
|
vertical: { type: Boolean, default: !1 }
|
|
2544
3334
|
},
|
|
2545
3335
|
emits: ["select"],
|
|
2546
|
-
setup(
|
|
2547
|
-
const
|
|
2548
|
-
() =>
|
|
2549
|
-
(h) => h instanceof
|
|
3336
|
+
setup(n, { emit: t }) {
|
|
3337
|
+
const e = n, s = It(/* @__PURE__ */ new Map()), r = It(/* @__PURE__ */ new Map()), i = t, l = ct(() => e.deck.deckspaces?.flatMap((h) => h instanceof B ? h.passengerSpots?.filter((d) => d instanceof ht) || [] : []).map((h) => (h.availability = e.availability && h.attr_id ? pt[e.availability[h.attr_id] ?? "Undefined"] : pt.Undefined, h)) || []), o = ct(
|
|
3338
|
+
() => e.deck.deckspaces?.flatMap(
|
|
3339
|
+
(h) => h instanceof B ? h.deckEntrances ?? [] : []
|
|
2550
3340
|
) ?? []
|
|
2551
|
-
), a =
|
|
2552
|
-
const { width: h, height: d } =
|
|
3341
|
+
), a = ct(() => {
|
|
3342
|
+
const { width: h, height: d } = e.deck.getBoundingBox();
|
|
2553
3343
|
return {
|
|
2554
|
-
width: h *
|
|
2555
|
-
height: d *
|
|
3344
|
+
width: h * e.scale + 10,
|
|
3345
|
+
height: d * e.scale + 10
|
|
2556
3346
|
};
|
|
2557
3347
|
});
|
|
2558
|
-
function
|
|
2559
|
-
|
|
3348
|
+
function c(h, d) {
|
|
3349
|
+
i("select", { element: d, ctrlKey: h.ctrlKey || h.metaKey });
|
|
2560
3350
|
}
|
|
2561
|
-
return (h, d) => (
|
|
2562
|
-
width:
|
|
2563
|
-
height:
|
|
3351
|
+
return (h, d) => (b(), x("svg", {
|
|
3352
|
+
width: n.vertical ? a.value.height : a.value.width,
|
|
3353
|
+
height: n.vertical ? a.value.width : a.value.height,
|
|
2564
3354
|
class: "vehicle-frame",
|
|
2565
3355
|
style: { "user-select": "none" }
|
|
2566
3356
|
}, [
|
|
2567
3357
|
w("g", {
|
|
2568
|
-
class:
|
|
3358
|
+
class: st(`${n.vertical ? "vehicle-frame--vertical" : ""}`),
|
|
2569
3359
|
transform: `rotate(
|
|
2570
|
-
${
|
|
3360
|
+
${n.vertical ? 90 : 0},
|
|
2571
3361
|
${a.value.height / 2},
|
|
2572
3362
|
${a.value.height / 2}
|
|
2573
3363
|
)`
|
|
2574
3364
|
}, [
|
|
2575
|
-
w("rect",
|
|
2576
|
-
onClick: d[0] || (d[0] =
|
|
3365
|
+
w("rect", ge({ ...n.deck.getShape(n.scale), y: 5 }, {
|
|
3366
|
+
onClick: d[0] || (d[0] = wt((f) => c(f, n.deck), ["stop"])),
|
|
2577
3367
|
class: "vehicle-deck"
|
|
2578
3368
|
}), null, 16),
|
|
2579
|
-
(
|
|
3369
|
+
(b(!0), x(K, null, Z(l.value, (f, y) => (b(), x("g", {
|
|
2580
3370
|
key: `seat-${y}`,
|
|
2581
|
-
transform: `translate(${
|
|
2582
|
-
${
|
|
2583
|
-
onClick:
|
|
2584
|
-
class:
|
|
3371
|
+
transform: `translate(${s.get(f)?.x ?? f.getShape(n.scale).x},
|
|
3372
|
+
${s.get(f)?.y ?? f.getShape(n.scale).y})`,
|
|
3373
|
+
onClick: wt((C) => c(C, f), ["stop"]),
|
|
3374
|
+
class: st(`seat ${f.getClasses()}`)
|
|
2585
3375
|
}, [
|
|
2586
3376
|
w("g", {
|
|
2587
3377
|
class: "seat__container",
|
|
2588
|
-
transform: `rotate( ${f.Orientation === "forwards" ? 180 : 0}, ${f.getShape(
|
|
3378
|
+
transform: `rotate( ${f.Orientation === "forwards" ? 180 : 0}, ${f.getShape(n.scale).width / 2}, ${f.getShape(n.scale).height / 2})`
|
|
2589
3379
|
}, [
|
|
2590
3380
|
w("rect", {
|
|
2591
|
-
width: f.getShape(
|
|
2592
|
-
height: f.getShape(
|
|
2593
|
-
class:
|
|
2594
|
-
}, null, 8,
|
|
3381
|
+
width: f.getShape(n.scale).width,
|
|
3382
|
+
height: f.getShape(n.scale).height,
|
|
3383
|
+
class: st("seat__base")
|
|
3384
|
+
}, null, 8, vs),
|
|
2595
3385
|
w("rect", {
|
|
2596
|
-
x: f.getShape(
|
|
3386
|
+
x: f.getShape(n.scale).width * 0.9,
|
|
2597
3387
|
y: "0",
|
|
2598
|
-
width: f.getShape(
|
|
2599
|
-
height: f.getShape(
|
|
3388
|
+
width: f.getShape(n.scale).width * 0.2,
|
|
3389
|
+
height: f.getShape(n.scale).height,
|
|
2600
3390
|
rx: "6",
|
|
2601
3391
|
ry: "6",
|
|
2602
|
-
class:
|
|
3392
|
+
class: st(["seat__backrest", "seat__backrest"]),
|
|
2603
3393
|
"pointer-events": "none"
|
|
2604
|
-
}, null, 8,
|
|
2605
|
-
], 8,
|
|
3394
|
+
}, null, 8, Es)
|
|
3395
|
+
], 8, bs),
|
|
2606
3396
|
w("g", {
|
|
2607
3397
|
class: "seat__text-container",
|
|
2608
3398
|
transform: `rotate(
|
|
2609
|
-
${
|
|
2610
|
-
${f.getShape(
|
|
2611
|
-
${f.getShape(
|
|
3399
|
+
${n.vertical ? -90 : 0},
|
|
3400
|
+
${f.getShape(n.scale).width / 2},
|
|
3401
|
+
${f.getShape(n.scale).height / 2}
|
|
2612
3402
|
)`
|
|
2613
3403
|
}, [
|
|
2614
3404
|
w("text", {
|
|
2615
|
-
x: f.getShape(
|
|
2616
|
-
y: f.getShape(
|
|
3405
|
+
x: f.getShape(n.scale).width / 2,
|
|
3406
|
+
y: f.getShape(n.scale).height / 2,
|
|
2617
3407
|
"text-anchor": "middle",
|
|
2618
3408
|
"dominant-baseline": "middle",
|
|
2619
3409
|
class: "seat__text",
|
|
2620
3410
|
"font-size": Math.max(
|
|
2621
|
-
Math.min(f.getShape(
|
|
3411
|
+
Math.min(f.getShape(n.scale).width, f.getShape(n.scale).height) / 3,
|
|
2622
3412
|
10
|
|
2623
3413
|
),
|
|
2624
3414
|
"pointer-events": "none"
|
|
2625
|
-
},
|
|
2626
|
-
], 8,
|
|
2627
|
-
], 10,
|
|
2628
|
-
(
|
|
3415
|
+
}, D(f.Label), 9, ws)
|
|
3416
|
+
], 8, Ns)
|
|
3417
|
+
], 10, ys))), 128)),
|
|
3418
|
+
(b(!0), x(K, null, Z(o.value, (f, y) => (b(), x("g", {
|
|
2629
3419
|
key: `entrance-${y}`,
|
|
2630
|
-
transform: `translate(${
|
|
2631
|
-
${
|
|
2632
|
-
onClick:
|
|
3420
|
+
transform: `translate(${r.get(f)?.x ?? f.getShape(n.scale, n.deck.Length, n.deck.Width).x},
|
|
3421
|
+
${r.get(f)?.y ?? f.getShape(n.scale, n.deck.Length, n.deck.Width).y})`,
|
|
3422
|
+
onClick: wt((C) => c(C, f), ["stop"])
|
|
2633
3423
|
}, [
|
|
2634
3424
|
w("rect", {
|
|
2635
|
-
width: f.getShape(
|
|
2636
|
-
height: f.getShape(
|
|
3425
|
+
width: f.getShape(n.scale, n.deck.Length, n.deck.Width).width,
|
|
3426
|
+
height: f.getShape(n.scale, n.deck.Length, n.deck.Width).height,
|
|
2637
3427
|
class: "door"
|
|
2638
|
-
}, null, 8,
|
|
2639
|
-
], 8,
|
|
2640
|
-
], 10,
|
|
2641
|
-
], 8,
|
|
3428
|
+
}, null, 8, xs)
|
|
3429
|
+
], 8, Ss))), 128))
|
|
3430
|
+
], 10, ms)
|
|
3431
|
+
], 8, gs));
|
|
2642
3432
|
}
|
|
2643
|
-
}),
|
|
3433
|
+
}), jt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2644
3434
|
__proto__: null,
|
|
2645
|
-
DeckplanRenderer:
|
|
3435
|
+
DeckplanRenderer: ks
|
|
2646
3436
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2647
|
-
function
|
|
2648
|
-
for (const
|
|
2649
|
-
|
|
2650
|
-
for (const
|
|
2651
|
-
|
|
3437
|
+
function Cs(n) {
|
|
3438
|
+
for (const t in qt)
|
|
3439
|
+
n.component(t, qt[t]);
|
|
3440
|
+
for (const t in jt)
|
|
3441
|
+
n.component(t, jt[t]);
|
|
2652
3442
|
}
|
|
2653
|
-
const
|
|
3443
|
+
const Ps = { install: Cs };
|
|
2654
3444
|
export {
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
3445
|
+
he as DeckVisualization,
|
|
3446
|
+
ps as DeckplanEditor,
|
|
3447
|
+
ks as DeckplanRenderer,
|
|
3448
|
+
pt as PassengerSpotAvailability,
|
|
3449
|
+
ue as WagonVisualization,
|
|
3450
|
+
Ps as default,
|
|
3451
|
+
ls as parseNeTEx
|
|
2662
3452
|
};
|