@opentrainticketing/netex-deckplan-editor 1.0.1 → 1.0.2

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.
@@ -0,0 +1,2575 @@
1
+ import { defineComponent as ae, ref as $, computed as ye, resolveComponent as oe, createBlock as Q, openBlock as E, withCtx as ge, createVNode as G, createElementBlock as _, createCommentVNode as ve, Fragment as ee, renderList as te, createElementVNode as k, withDirectives as pe, toDisplayString as se, vModelText as Fe, normalizeClass as _e, vModelDynamic as De, vModelCheckbox as et, watch as $e, nextTick as tt } from "vue";
2
+ const Xe = ":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", st = Xe + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040", nt = "[" + Xe + "][" + st + "]*", it = new RegExp("^" + nt + "$");
3
+ function Ue(s, e) {
4
+ const t = [];
5
+ let n = e.exec(s);
6
+ for (; n; ) {
7
+ const i = [];
8
+ i.startIndex = e.lastIndex - n[0].length;
9
+ const r = n.length;
10
+ for (let o = 0; o < r; o++)
11
+ i.push(n[o]);
12
+ t.push(i), n = e.exec(s);
13
+ }
14
+ return t;
15
+ }
16
+ const be = function(s) {
17
+ const e = it.exec(s);
18
+ return !(e === null || typeof e > "u");
19
+ };
20
+ function rt(s) {
21
+ return typeof s < "u";
22
+ }
23
+ const ot = {
24
+ allowBooleanAttributes: !1,
25
+ //A tag can have attributes without any value
26
+ unpairedTags: []
27
+ };
28
+ function at(s, e) {
29
+ e = Object.assign({}, ot, e);
30
+ const t = [];
31
+ let n = !1, i = !1;
32
+ s[0] === "\uFEFF" && (s = s.substr(1));
33
+ for (let r = 0; r < s.length; r++)
34
+ if (s[r] === "<" && s[r + 1] === "?") {
35
+ if (r += 2, r = Ae(s, r), r.err) return r;
36
+ } else if (s[r] === "<") {
37
+ let o = r;
38
+ if (r++, s[r] === "!") {
39
+ r = Ie(s, r);
40
+ continue;
41
+ } else {
42
+ let c = !1;
43
+ s[r] === "/" && (c = !0, r++);
44
+ let a = "";
45
+ for (; r < s.length && s[r] !== ">" && s[r] !== " " && s[r] !== " " && s[r] !== `
46
+ ` && s[r] !== "\r"; r++)
47
+ a += s[r];
48
+ if (a = a.trim(), a[a.length - 1] === "/" && (a = a.substring(0, a.length - 1), r--), !pt(a)) {
49
+ let u;
50
+ return a.trim().length === 0 ? u = "Invalid space after '<'." : u = "Tag '" + a + "' is an invalid name.", x("InvalidTag", u, R(s, r));
51
+ }
52
+ const l = ut(s, r);
53
+ if (l === !1)
54
+ return x("InvalidAttr", "Attributes for '" + a + "' have open quote.", R(s, r));
55
+ let g = l.value;
56
+ if (r = l.index, g[g.length - 1] === "/") {
57
+ const u = r - g.length;
58
+ g = g.substring(0, g.length - 1);
59
+ const v = Ve(g, e);
60
+ if (v === !0)
61
+ n = !0;
62
+ else
63
+ return x(v.err.code, v.err.msg, R(s, u + v.err.line));
64
+ } else if (c)
65
+ if (l.tagClosed) {
66
+ if (g.trim().length > 0)
67
+ return x("InvalidTag", "Closing tag '" + a + "' can't have attributes or invalid starting.", R(s, o));
68
+ if (t.length === 0)
69
+ return x("InvalidTag", "Closing tag '" + a + "' has not been opened.", R(s, o));
70
+ {
71
+ const u = t.pop();
72
+ if (a !== u.tagName) {
73
+ let v = R(s, u.tagStartPos);
74
+ return x(
75
+ "InvalidTag",
76
+ "Expected closing tag '" + u.tagName + "' (opened in line " + v.line + ", col " + v.col + ") instead of closing tag '" + a + "'.",
77
+ R(s, o)
78
+ );
79
+ }
80
+ t.length == 0 && (i = !0);
81
+ }
82
+ } else return x("InvalidTag", "Closing tag '" + a + "' doesn't have proper closing.", R(s, r));
83
+ else {
84
+ const u = Ve(g, e);
85
+ if (u !== !0)
86
+ return x(u.err.code, u.err.msg, R(s, r - g.length + u.err.line));
87
+ if (i === !0)
88
+ return x("InvalidXml", "Multiple possible root nodes found.", R(s, r));
89
+ e.unpairedTags.indexOf(a) !== -1 || t.push({ tagName: a, tagStartPos: o }), n = !0;
90
+ }
91
+ for (r++; r < s.length; r++)
92
+ if (s[r] === "<")
93
+ if (s[r + 1] === "!") {
94
+ r++, r = Ie(s, r);
95
+ continue;
96
+ } else if (s[r + 1] === "?") {
97
+ if (r = Ae(s, ++r), r.err) return r;
98
+ } else
99
+ break;
100
+ else if (s[r] === "&") {
101
+ const u = ft(s, r);
102
+ if (u == -1)
103
+ return x("InvalidChar", "char '&' is not expected.", R(s, r));
104
+ r = u;
105
+ } else if (i === !0 && !Le(s[r]))
106
+ return x("InvalidXml", "Extra text at the end", R(s, r));
107
+ s[r] === "<" && r--;
108
+ }
109
+ } else {
110
+ if (Le(s[r]))
111
+ continue;
112
+ return x("InvalidChar", "char '" + s[r] + "' is not expected.", R(s, r));
113
+ }
114
+ if (n) {
115
+ if (t.length == 1)
116
+ return x("InvalidTag", "Unclosed tag '" + t[0].tagName + "'.", R(s, t[0].tagStartPos));
117
+ if (t.length > 0)
118
+ return x("InvalidXml", "Invalid '" + JSON.stringify(t.map((r) => r.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 });
119
+ } else return x("InvalidXml", "Start tag expected.", 1);
120
+ return !0;
121
+ }
122
+ function Le(s) {
123
+ return s === " " || s === " " || s === `
124
+ ` || s === "\r";
125
+ }
126
+ function Ae(s, e) {
127
+ const t = e;
128
+ for (; e < s.length; e++)
129
+ if (s[e] == "?" || s[e] == " ") {
130
+ const n = s.substr(t, e - t);
131
+ if (e > 5 && n === "xml")
132
+ return x("InvalidXml", "XML declaration allowed only at the start of the document.", R(s, e));
133
+ if (s[e] == "?" && s[e + 1] == ">") {
134
+ e++;
135
+ break;
136
+ } else
137
+ continue;
138
+ }
139
+ return e;
140
+ }
141
+ function Ie(s, e) {
142
+ if (s.length > e + 5 && s[e + 1] === "-" && s[e + 2] === "-") {
143
+ for (e += 3; e < s.length; e++)
144
+ if (s[e] === "-" && s[e + 1] === "-" && s[e + 2] === ">") {
145
+ e += 2;
146
+ break;
147
+ }
148
+ } else if (s.length > e + 8 && s[e + 1] === "D" && s[e + 2] === "O" && s[e + 3] === "C" && s[e + 4] === "T" && s[e + 5] === "Y" && s[e + 6] === "P" && s[e + 7] === "E") {
149
+ let t = 1;
150
+ for (e += 8; e < s.length; e++)
151
+ if (s[e] === "<")
152
+ t++;
153
+ else if (s[e] === ">" && (t--, t === 0))
154
+ break;
155
+ } else if (s.length > e + 9 && s[e + 1] === "[" && s[e + 2] === "C" && s[e + 3] === "D" && s[e + 4] === "A" && s[e + 5] === "T" && s[e + 6] === "A" && s[e + 7] === "[") {
156
+ for (e += 8; e < s.length; e++)
157
+ if (s[e] === "]" && s[e + 1] === "]" && s[e + 2] === ">") {
158
+ e += 2;
159
+ break;
160
+ }
161
+ }
162
+ return e;
163
+ }
164
+ const lt = '"', ct = "'";
165
+ function ut(s, e) {
166
+ let t = "", n = "", i = !1;
167
+ for (; e < s.length; e++) {
168
+ if (s[e] === lt || s[e] === ct)
169
+ n === "" ? n = s[e] : n !== s[e] || (n = "");
170
+ else if (s[e] === ">" && n === "") {
171
+ i = !0;
172
+ break;
173
+ }
174
+ t += s[e];
175
+ }
176
+ return n !== "" ? !1 : {
177
+ value: t,
178
+ index: e,
179
+ tagClosed: i
180
+ };
181
+ }
182
+ const dt = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
183
+ function Ve(s, e) {
184
+ const t = Ue(s, dt), n = {};
185
+ for (let i = 0; i < t.length; i++) {
186
+ if (t[i][1].length === 0)
187
+ return x("InvalidAttr", "Attribute '" + t[i][2] + "' has no space in starting.", ce(t[i]));
188
+ if (t[i][3] !== void 0 && t[i][4] === void 0)
189
+ return x("InvalidAttr", "Attribute '" + t[i][2] + "' is without value.", ce(t[i]));
190
+ if (t[i][3] === void 0 && !e.allowBooleanAttributes)
191
+ return x("InvalidAttr", "boolean attribute '" + t[i][2] + "' is not allowed.", ce(t[i]));
192
+ const r = t[i][2];
193
+ if (!gt(r))
194
+ return x("InvalidAttr", "Attribute '" + r + "' is an invalid name.", ce(t[i]));
195
+ if (!n.hasOwnProperty(r))
196
+ n[r] = 1;
197
+ else
198
+ return x("InvalidAttr", "Attribute '" + r + "' is repeated.", ce(t[i]));
199
+ }
200
+ return !0;
201
+ }
202
+ function ht(s, e) {
203
+ let t = /\d/;
204
+ for (s[e] === "x" && (e++, t = /[\da-fA-F]/); e < s.length; e++) {
205
+ if (s[e] === ";")
206
+ return e;
207
+ if (!s[e].match(t))
208
+ break;
209
+ }
210
+ return -1;
211
+ }
212
+ function ft(s, e) {
213
+ if (e++, s[e] === ";")
214
+ return -1;
215
+ if (s[e] === "#")
216
+ return e++, ht(s, e);
217
+ let t = 0;
218
+ for (; e < s.length; e++, t++)
219
+ if (!(s[e].match(/\w/) && t < 20)) {
220
+ if (s[e] === ";")
221
+ break;
222
+ return -1;
223
+ }
224
+ return e;
225
+ }
226
+ function x(s, e, t) {
227
+ return {
228
+ err: {
229
+ code: s,
230
+ msg: e,
231
+ line: t.line || t,
232
+ col: t.col
233
+ }
234
+ };
235
+ }
236
+ function gt(s) {
237
+ return be(s);
238
+ }
239
+ function pt(s) {
240
+ return be(s);
241
+ }
242
+ function R(s, e) {
243
+ const t = s.substring(0, e).split(/\r?\n/);
244
+ return {
245
+ line: t.length,
246
+ // column number is last line's length + 1, because column numbering starts at 1:
247
+ col: t[t.length - 1].length + 1
248
+ };
249
+ }
250
+ function ce(s) {
251
+ return s.startIndex + s[1].length;
252
+ }
253
+ const vt = {
254
+ preserveOrder: !1,
255
+ attributeNamePrefix: "@_",
256
+ attributesGroupName: !1,
257
+ textNodeName: "#text",
258
+ ignoreAttributes: !0,
259
+ removeNSPrefix: !1,
260
+ // remove NS from tag name or attribute name if true
261
+ allowBooleanAttributes: !1,
262
+ //a tag can have attributes without any value
263
+ //ignoreRootElement : false,
264
+ parseTagValue: !0,
265
+ parseAttributeValue: !1,
266
+ trimValues: !0,
267
+ //Trim string values of tag and attributes
268
+ cdataPropName: !1,
269
+ numberParseOptions: {
270
+ hex: !0,
271
+ leadingZeros: !0,
272
+ eNotation: !0
273
+ },
274
+ tagValueProcessor: function(s, e) {
275
+ return e;
276
+ },
277
+ attributeValueProcessor: function(s, e) {
278
+ return e;
279
+ },
280
+ stopNodes: [],
281
+ //nested tags will not be parsed even for errors
282
+ alwaysCreateTextNode: !1,
283
+ isArray: () => !1,
284
+ commentPropName: !1,
285
+ unpairedTags: [],
286
+ processEntities: !0,
287
+ htmlEntities: !1,
288
+ ignoreDeclaration: !1,
289
+ ignorePiTags: !1,
290
+ transformTagName: !1,
291
+ transformAttributeName: !1,
292
+ updateTag: function(s, e, t) {
293
+ return s;
294
+ },
295
+ // skipEmptyListItem: false
296
+ captureMetaData: !1
297
+ }, mt = function(s) {
298
+ return Object.assign({}, vt, s);
299
+ };
300
+ let me;
301
+ typeof Symbol != "function" ? me = "@@xmlMetadata" : me = Symbol("XML Node Metadata");
302
+ class J {
303
+ constructor(e) {
304
+ this.tagname = e, this.child = [], this[":@"] = {};
305
+ }
306
+ add(e, t) {
307
+ e === "__proto__" && (e = "#__proto__"), this.child.push({ [e]: t });
308
+ }
309
+ addChild(e, t) {
310
+ e.tagname === "__proto__" && (e.tagname = "#__proto__"), e[":@"] && Object.keys(e[":@"]).length > 0 ? this.child.push({ [e.tagname]: e.child, ":@": e[":@"] }) : this.child.push({ [e.tagname]: e.child }), t !== void 0 && (this.child[this.child.length - 1][me] = { startIndex: t });
311
+ }
312
+ /** symbol used for metadata */
313
+ static getMetaDataSymbol() {
314
+ return me;
315
+ }
316
+ }
317
+ class bt {
318
+ constructor(e) {
319
+ this.suppressValidationErr = !e;
320
+ }
321
+ readDocType(e, t) {
322
+ const n = {};
323
+ if (e[t + 3] === "O" && e[t + 4] === "C" && e[t + 5] === "T" && e[t + 6] === "Y" && e[t + 7] === "P" && e[t + 8] === "E") {
324
+ t = t + 9;
325
+ let i = 1, r = !1, o = !1, c = "";
326
+ for (; t < e.length; t++)
327
+ if (e[t] === "<" && !o) {
328
+ if (r && K(e, "!ENTITY", t)) {
329
+ t += 7;
330
+ let a, l;
331
+ [a, l, t] = this.readEntityExp(e, t + 1, this.suppressValidationErr), l.indexOf("&") === -1 && (n[a] = {
332
+ regx: RegExp(`&${a};`, "g"),
333
+ val: l
334
+ });
335
+ } else if (r && K(e, "!ELEMENT", t)) {
336
+ t += 8;
337
+ const { index: a } = this.readElementExp(e, t + 1);
338
+ t = a;
339
+ } else if (r && K(e, "!ATTLIST", t))
340
+ t += 8;
341
+ else if (r && K(e, "!NOTATION", t)) {
342
+ t += 9;
343
+ const { index: a } = this.readNotationExp(e, t + 1, this.suppressValidationErr);
344
+ t = a;
345
+ } else if (K(e, "!--", t)) o = !0;
346
+ else throw new Error("Invalid DOCTYPE");
347
+ i++, c = "";
348
+ } else if (e[t] === ">") {
349
+ if (o ? e[t - 1] === "-" && e[t - 2] === "-" && (o = !1, i--) : i--, i === 0)
350
+ break;
351
+ } else e[t] === "[" ? r = !0 : c += e[t];
352
+ if (i !== 0)
353
+ throw new Error("Unclosed DOCTYPE");
354
+ } else
355
+ throw new Error("Invalid Tag instead of DOCTYPE");
356
+ return { entities: n, i: t };
357
+ }
358
+ readEntityExp(e, t) {
359
+ t = O(e, t);
360
+ let n = "";
361
+ for (; t < e.length && !/\s/.test(e[t]) && e[t] !== '"' && e[t] !== "'"; )
362
+ n += e[t], t++;
363
+ if (ue(n), t = O(e, t), !this.suppressValidationErr) {
364
+ if (e.substring(t, t + 6).toUpperCase() === "SYSTEM")
365
+ throw new Error("External entities are not supported");
366
+ if (e[t] === "%")
367
+ throw new Error("Parameter entities are not supported");
368
+ }
369
+ let i = "";
370
+ return [t, i] = this.readIdentifierVal(e, t, "entity"), t--, [n, i, t];
371
+ }
372
+ readNotationExp(e, t) {
373
+ t = O(e, t);
374
+ let n = "";
375
+ for (; t < e.length && !/\s/.test(e[t]); )
376
+ n += e[t], t++;
377
+ !this.suppressValidationErr && ue(n), t = O(e, t);
378
+ const i = e.substring(t, t + 6).toUpperCase();
379
+ if (!this.suppressValidationErr && i !== "SYSTEM" && i !== "PUBLIC")
380
+ throw new Error(`Expected SYSTEM or PUBLIC, found "${i}"`);
381
+ t += i.length, t = O(e, t);
382
+ let r = null, o = null;
383
+ if (i === "PUBLIC")
384
+ [t, r] = this.readIdentifierVal(e, t, "publicIdentifier"), t = O(e, t), (e[t] === '"' || e[t] === "'") && ([t, o] = this.readIdentifierVal(e, t, "systemIdentifier"));
385
+ else if (i === "SYSTEM" && ([t, o] = this.readIdentifierVal(e, t, "systemIdentifier"), !this.suppressValidationErr && !o))
386
+ throw new Error("Missing mandatory system identifier for SYSTEM notation");
387
+ return { notationName: n, publicIdentifier: r, systemIdentifier: o, index: --t };
388
+ }
389
+ readIdentifierVal(e, t, n) {
390
+ let i = "";
391
+ const r = e[t];
392
+ if (r !== '"' && r !== "'")
393
+ throw new Error(`Expected quoted string, found "${r}"`);
394
+ for (t++; t < e.length && e[t] !== r; )
395
+ i += e[t], t++;
396
+ if (e[t] !== r)
397
+ throw new Error(`Unterminated ${n} value`);
398
+ return t++, [t, i];
399
+ }
400
+ readElementExp(e, t) {
401
+ t = O(e, t);
402
+ let n = "";
403
+ for (; t < e.length && !/\s/.test(e[t]); )
404
+ n += e[t], t++;
405
+ if (!this.suppressValidationErr && !be(n))
406
+ throw new Error(`Invalid element name: "${n}"`);
407
+ t = O(e, t);
408
+ let i = "";
409
+ if (e[t] === "E" && K(e, "MPTY", t)) t += 4;
410
+ else if (e[t] === "A" && K(e, "NY", t)) t += 2;
411
+ else if (e[t] === "(") {
412
+ for (t++; t < e.length && e[t] !== ")"; )
413
+ i += e[t], t++;
414
+ if (e[t] !== ")")
415
+ throw new Error("Unterminated content model");
416
+ } else if (!this.suppressValidationErr)
417
+ throw new Error(`Invalid Element Expression, found "${e[t]}"`);
418
+ return {
419
+ elementName: n,
420
+ contentModel: i.trim(),
421
+ index: t
422
+ };
423
+ }
424
+ readAttlistExp(e, t) {
425
+ t = O(e, t);
426
+ let n = "";
427
+ for (; t < e.length && !/\s/.test(e[t]); )
428
+ n += e[t], t++;
429
+ ue(n), t = O(e, t);
430
+ let i = "";
431
+ for (; t < e.length && !/\s/.test(e[t]); )
432
+ i += e[t], t++;
433
+ if (!ue(i))
434
+ throw new Error(`Invalid attribute name: "${i}"`);
435
+ t = O(e, t);
436
+ let r = "";
437
+ if (e.substring(t, t + 8).toUpperCase() === "NOTATION") {
438
+ if (r = "NOTATION", t += 8, t = O(e, t), e[t] !== "(")
439
+ throw new Error(`Expected '(', found "${e[t]}"`);
440
+ t++;
441
+ let c = [];
442
+ for (; t < e.length && e[t] !== ")"; ) {
443
+ let a = "";
444
+ for (; t < e.length && e[t] !== "|" && e[t] !== ")"; )
445
+ a += e[t], t++;
446
+ if (a = a.trim(), !ue(a))
447
+ throw new Error(`Invalid notation name: "${a}"`);
448
+ c.push(a), e[t] === "|" && (t++, t = O(e, t));
449
+ }
450
+ if (e[t] !== ")")
451
+ throw new Error("Unterminated list of notations");
452
+ t++, r += " (" + c.join("|") + ")";
453
+ } else {
454
+ for (; t < e.length && !/\s/.test(e[t]); )
455
+ r += e[t], t++;
456
+ const c = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"];
457
+ if (!this.suppressValidationErr && !c.includes(r.toUpperCase()))
458
+ throw new Error(`Invalid attribute type: "${r}"`);
459
+ }
460
+ t = O(e, t);
461
+ let o = "";
462
+ return e.substring(t, t + 8).toUpperCase() === "#REQUIRED" ? (o = "#REQUIRED", t += 8) : e.substring(t, t + 7).toUpperCase() === "#IMPLIED" ? (o = "#IMPLIED", t += 7) : [t, o] = this.readIdentifierVal(e, t, "ATTLIST"), {
463
+ elementName: n,
464
+ attributeName: i,
465
+ attributeType: r,
466
+ defaultValue: o,
467
+ index: t
468
+ };
469
+ }
470
+ }
471
+ const O = (s, e) => {
472
+ for (; e < s.length && /\s/.test(s[e]); )
473
+ e++;
474
+ return e;
475
+ };
476
+ function K(s, e, t) {
477
+ for (let n = 0; n < e.length; n++)
478
+ if (e[n] !== s[t + n + 1]) return !1;
479
+ return !0;
480
+ }
481
+ function ue(s) {
482
+ if (be(s))
483
+ return s;
484
+ throw new Error(`Invalid entity name ${s}`);
485
+ }
486
+ const Et = /^[-+]?0x[a-fA-F0-9]+$/, yt = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, Nt = {
487
+ hex: !0,
488
+ // oct: false,
489
+ leadingZeros: !0,
490
+ decimalPoint: ".",
491
+ eNotation: !0
492
+ //skipLike: /regex/
493
+ };
494
+ function wt(s, e = {}) {
495
+ if (e = Object.assign({}, Nt, e), !s || typeof s != "string") return s;
496
+ let t = s.trim();
497
+ if (e.skipLike !== void 0 && e.skipLike.test(t)) return s;
498
+ if (s === "0") return 0;
499
+ if (e.hex && Et.test(t))
500
+ return xt(t, 16);
501
+ if (t.includes("e") || t.includes("E"))
502
+ return _t(s, t, e);
503
+ {
504
+ const n = yt.exec(t);
505
+ if (n) {
506
+ const i = n[1] || "", r = n[2];
507
+ let o = kt(n[3]);
508
+ const c = i ? (
509
+ // 0., -00., 000.
510
+ s[r.length + 1] === "."
511
+ ) : s[r.length] === ".";
512
+ if (!e.leadingZeros && (r.length > 1 || r.length === 1 && !c))
513
+ return s;
514
+ {
515
+ const a = Number(t), l = String(a);
516
+ if (a === 0) return a;
517
+ if (l.search(/[eE]/) !== -1)
518
+ return e.eNotation ? a : s;
519
+ if (t.indexOf(".") !== -1)
520
+ return l === "0" || l === o || l === `${i}${o}` ? a : s;
521
+ let g = r ? o : t;
522
+ return r ? g === l || i + g === l ? a : s : g === l || g === i + l ? a : s;
523
+ }
524
+ } else
525
+ return s;
526
+ }
527
+ }
528
+ const St = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;
529
+ function _t(s, e, t) {
530
+ if (!t.eNotation) return s;
531
+ const n = e.match(St);
532
+ if (n) {
533
+ let i = n[1] || "";
534
+ const r = n[3].indexOf("e") === -1 ? "E" : "e", o = n[2], c = i ? (
535
+ // 0E.
536
+ s[o.length + 1] === r
537
+ ) : s[o.length] === r;
538
+ return o.length > 1 && c ? s : o.length === 1 && (n[3].startsWith(`.${r}`) || n[3][0] === r) ? Number(e) : t.leadingZeros && !c ? (e = (n[1] || "") + n[3], Number(e)) : s;
539
+ } else
540
+ return s;
541
+ }
542
+ function kt(s) {
543
+ return s && s.indexOf(".") !== -1 && (s = s.replace(/0+$/, ""), s === "." ? s = "0" : s[0] === "." ? s = "0" + s : s[s.length - 1] === "." && (s = s.substring(0, s.length - 1))), s;
544
+ }
545
+ function xt(s, e) {
546
+ if (parseInt) return parseInt(s, e);
547
+ if (Number.parseInt) return Number.parseInt(s, e);
548
+ if (window && window.parseInt) return window.parseInt(s, e);
549
+ throw new Error("parseInt, Number.parseInt, window.parseInt are not supported");
550
+ }
551
+ function We(s) {
552
+ return typeof s == "function" ? s : Array.isArray(s) ? (e) => {
553
+ for (const t of s)
554
+ if (typeof t == "string" && e === t || t instanceof RegExp && t.test(e))
555
+ return !0;
556
+ } : () => !1;
557
+ }
558
+ class Tt {
559
+ constructor(e) {
560
+ if (this.options = e, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = {
561
+ apos: { regex: /&(apos|#39|#x27);/g, val: "'" },
562
+ gt: { regex: /&(gt|#62|#x3E);/g, val: ">" },
563
+ lt: { regex: /&(lt|#60|#x3C);/g, val: "<" },
564
+ quot: { regex: /&(quot|#34|#x22);/g, val: '"' }
565
+ }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = {
566
+ space: { regex: /&(nbsp|#160);/g, val: " " },
567
+ // "lt" : { regex: /&(lt|#60);/g, val: "<" },
568
+ // "gt" : { regex: /&(gt|#62);/g, val: ">" },
569
+ // "amp" : { regex: /&(amp|#38);/g, val: "&" },
570
+ // "quot" : { regex: /&(quot|#34);/g, val: "\"" },
571
+ // "apos" : { regex: /&(apos|#39);/g, val: "'" },
572
+ cent: { regex: /&(cent|#162);/g, val: "¢" },
573
+ pound: { regex: /&(pound|#163);/g, val: "£" },
574
+ yen: { regex: /&(yen|#165);/g, val: "¥" },
575
+ euro: { regex: /&(euro|#8364);/g, val: "€" },
576
+ copyright: { regex: /&(copy|#169);/g, val: "©" },
577
+ reg: { regex: /&(reg|#174);/g, val: "®" },
578
+ inr: { regex: /&(inr|#8377);/g, val: "₹" },
579
+ num_dec: { regex: /&#([0-9]{1,7});/g, val: (t, n) => String.fromCodePoint(Number.parseInt(n, 10)) },
580
+ num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t, n) => String.fromCodePoint(Number.parseInt(n, 16)) }
581
+ }, this.addExternalEntities = Ct, this.parseXml = Vt, this.parseTextData = Pt, this.resolveNameSpace = Lt, this.buildAttributesMap = It, this.isItStopNode = Ft, this.replaceEntitiesValue = Rt, this.readStopNodeData = Xt, this.saveTextToParentTag = Ot, this.addChild = Mt, this.ignoreAttributesFn = We(this.options.ignoreAttributes), this.options.stopNodes && this.options.stopNodes.length > 0) {
582
+ this.stopNodesExact = /* @__PURE__ */ new Set(), this.stopNodesWildcard = /* @__PURE__ */ new Set();
583
+ for (let t = 0; t < this.options.stopNodes.length; t++) {
584
+ const n = this.options.stopNodes[t];
585
+ typeof n == "string" && (n.startsWith("*.") ? this.stopNodesWildcard.add(n.substring(2)) : this.stopNodesExact.add(n));
586
+ }
587
+ }
588
+ }
589
+ }
590
+ function Ct(s) {
591
+ const e = Object.keys(s);
592
+ for (let t = 0; t < e.length; t++) {
593
+ const n = e[t];
594
+ this.lastEntities[n] = {
595
+ regex: new RegExp("&" + n + ";", "g"),
596
+ val: s[n]
597
+ };
598
+ }
599
+ }
600
+ function Pt(s, e, t, n, i, r, o) {
601
+ if (s !== void 0 && (this.options.trimValues && !n && (s = s.trim()), s.length > 0)) {
602
+ o || (s = this.replaceEntitiesValue(s));
603
+ const c = this.options.tagValueProcessor(e, s, t, i, r);
604
+ return c == null ? s : typeof c != typeof s || c !== s ? c : this.options.trimValues ? we(s, this.options.parseTagValue, this.options.numberParseOptions) : s.trim() === s ? we(s, this.options.parseTagValue, this.options.numberParseOptions) : s;
605
+ }
606
+ }
607
+ function Lt(s) {
608
+ if (this.options.removeNSPrefix) {
609
+ const e = s.split(":"), t = s.charAt(0) === "/" ? "/" : "";
610
+ if (e[0] === "xmlns")
611
+ return "";
612
+ e.length === 2 && (s = t + e[1]);
613
+ }
614
+ return s;
615
+ }
616
+ const At = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
617
+ function It(s, e) {
618
+ if (this.options.ignoreAttributes !== !0 && typeof s == "string") {
619
+ const t = Ue(s, At), n = t.length, i = {};
620
+ for (let r = 0; r < n; r++) {
621
+ const o = this.resolveNameSpace(t[r][1]);
622
+ if (this.ignoreAttributesFn(o, e))
623
+ continue;
624
+ let c = t[r][4], a = this.options.attributeNamePrefix + o;
625
+ if (o.length)
626
+ if (this.options.transformAttributeName && (a = this.options.transformAttributeName(a)), a === "__proto__" && (a = "#__proto__"), c !== void 0) {
627
+ this.options.trimValues && (c = c.trim()), c = this.replaceEntitiesValue(c);
628
+ const l = this.options.attributeValueProcessor(o, c, e);
629
+ l == null ? i[a] = c : typeof l != typeof c || l !== c ? i[a] = l : i[a] = we(
630
+ c,
631
+ this.options.parseAttributeValue,
632
+ this.options.numberParseOptions
633
+ );
634
+ } else this.options.allowBooleanAttributes && (i[a] = !0);
635
+ }
636
+ if (!Object.keys(i).length)
637
+ return;
638
+ if (this.options.attributesGroupName) {
639
+ const r = {};
640
+ return r[this.options.attributesGroupName] = i, r;
641
+ }
642
+ return i;
643
+ }
644
+ }
645
+ const Vt = function(s) {
646
+ s = s.replace(/\r\n?/g, `
647
+ `);
648
+ const e = new J("!xml");
649
+ let t = e, n = "", i = "";
650
+ const r = new bt(this.options.processEntities);
651
+ for (let o = 0; o < s.length; o++)
652
+ if (s[o] === "<")
653
+ if (s[o + 1] === "/") {
654
+ const a = D(s, ">", o, "Closing Tag is not closed.");
655
+ let l = s.substring(o + 2, a).trim();
656
+ if (this.options.removeNSPrefix) {
657
+ const v = l.indexOf(":");
658
+ v !== -1 && (l = l.substr(v + 1));
659
+ }
660
+ this.options.transformTagName && (l = this.options.transformTagName(l)), t && (n = this.saveTextToParentTag(n, t, i));
661
+ const g = i.substring(i.lastIndexOf(".") + 1);
662
+ if (l && this.options.unpairedTags.indexOf(l) !== -1)
663
+ throw new Error(`Unpaired tag can not be used as closing tag: </${l}>`);
664
+ let u = 0;
665
+ g && this.options.unpairedTags.indexOf(g) !== -1 ? (u = i.lastIndexOf(".", i.lastIndexOf(".") - 1), this.tagsNodeStack.pop()) : u = i.lastIndexOf("."), i = i.substring(0, u), t = this.tagsNodeStack.pop(), n = "", o = a;
666
+ } else if (s[o + 1] === "?") {
667
+ let a = Ne(s, o, !1, "?>");
668
+ if (!a) throw new Error("Pi Tag is not closed.");
669
+ if (n = this.saveTextToParentTag(n, t, i), !(this.options.ignoreDeclaration && a.tagName === "?xml" || this.options.ignorePiTags)) {
670
+ const l = new J(a.tagName);
671
+ l.add(this.options.textNodeName, ""), a.tagName !== a.tagExp && a.attrExpPresent && (l[":@"] = this.buildAttributesMap(a.tagExp, i)), this.addChild(t, l, i, o);
672
+ }
673
+ o = a.closeIndex + 1;
674
+ } else if (s.substr(o + 1, 3) === "!--") {
675
+ const a = D(s, "-->", o + 4, "Comment is not closed.");
676
+ if (this.options.commentPropName) {
677
+ const l = s.substring(o + 4, a - 2);
678
+ n = this.saveTextToParentTag(n, t, i), t.add(this.options.commentPropName, [{ [this.options.textNodeName]: l }]);
679
+ }
680
+ o = a;
681
+ } else if (s.substr(o + 1, 2) === "!D") {
682
+ const a = r.readDocType(s, o);
683
+ this.docTypeEntities = a.entities, o = a.i;
684
+ } else if (s.substr(o + 1, 2) === "![") {
685
+ const a = D(s, "]]>", o, "CDATA is not closed.") - 2, l = s.substring(o + 9, a);
686
+ n = this.saveTextToParentTag(n, t, i);
687
+ let g = this.parseTextData(l, t.tagname, i, !0, !1, !0, !0);
688
+ g == null && (g = ""), this.options.cdataPropName ? t.add(this.options.cdataPropName, [{ [this.options.textNodeName]: l }]) : t.add(this.options.textNodeName, g), o = a + 2;
689
+ } else {
690
+ let a = Ne(s, o, this.options.removeNSPrefix), l = a.tagName;
691
+ const g = a.rawTagName;
692
+ let u = a.tagExp, v = a.attrExpPresent, y = a.closeIndex;
693
+ if (this.options.transformTagName) {
694
+ const N = this.options.transformTagName(l);
695
+ u === l && (u = N), l = N;
696
+ }
697
+ t && n && t.tagname !== "!xml" && (n = this.saveTextToParentTag(n, t, i, !1));
698
+ const P = t;
699
+ P && this.options.unpairedTags.indexOf(P.tagname) !== -1 && (t = this.tagsNodeStack.pop(), i = i.substring(0, i.lastIndexOf("."))), l !== e.tagname && (i += i ? "." + l : l);
700
+ const M = o;
701
+ if (this.isItStopNode(this.stopNodesExact, this.stopNodesWildcard, i, l)) {
702
+ let N = "";
703
+ if (u.length > 0 && u.lastIndexOf("/") === u.length - 1)
704
+ l[l.length - 1] === "/" ? (l = l.substr(0, l.length - 1), i = i.substr(0, i.length - 1), u = l) : u = u.substr(0, u.length - 1), o = a.closeIndex;
705
+ else if (this.options.unpairedTags.indexOf(l) !== -1)
706
+ o = a.closeIndex;
707
+ else {
708
+ const B = this.readStopNodeData(s, g, y + 1);
709
+ if (!B) throw new Error(`Unexpected end of ${g}`);
710
+ o = B.i, N = B.tagContent;
711
+ }
712
+ const X = new J(l);
713
+ l !== u && v && (X[":@"] = this.buildAttributesMap(
714
+ u,
715
+ i
716
+ )), N && (N = this.parseTextData(N, l, i, !0, v, !0, !0)), i = i.substr(0, i.lastIndexOf(".")), X.add(this.options.textNodeName, N), this.addChild(t, X, i, M);
717
+ } else {
718
+ if (u.length > 0 && u.lastIndexOf("/") === u.length - 1) {
719
+ if (l[l.length - 1] === "/" ? (l = l.substr(0, l.length - 1), i = i.substr(0, i.length - 1), u = l) : u = u.substr(0, u.length - 1), this.options.transformTagName) {
720
+ const X = this.options.transformTagName(l);
721
+ u === l && (u = X), l = X;
722
+ }
723
+ const N = new J(l);
724
+ l !== u && v && (N[":@"] = this.buildAttributesMap(u, i)), this.addChild(t, N, i, M), i = i.substr(0, i.lastIndexOf("."));
725
+ } else {
726
+ const N = new J(l);
727
+ this.tagsNodeStack.push(t), l !== u && v && (N[":@"] = this.buildAttributesMap(u, i)), this.addChild(t, N, i, M), t = N;
728
+ }
729
+ n = "", o = y;
730
+ }
731
+ }
732
+ else
733
+ n += s[o];
734
+ return e.child;
735
+ };
736
+ function Mt(s, e, t, n) {
737
+ this.options.captureMetaData || (n = void 0);
738
+ const i = this.options.updateTag(e.tagname, t, e[":@"]);
739
+ i === !1 || (typeof i == "string" && (e.tagname = i), s.addChild(e, n));
740
+ }
741
+ const Rt = function(s) {
742
+ if (this.options.processEntities) {
743
+ for (let e in this.docTypeEntities) {
744
+ const t = this.docTypeEntities[e];
745
+ s = s.replace(t.regx, t.val);
746
+ }
747
+ for (let e in this.lastEntities) {
748
+ const t = this.lastEntities[e];
749
+ s = s.replace(t.regex, t.val);
750
+ }
751
+ if (this.options.htmlEntities)
752
+ for (let e in this.htmlEntities) {
753
+ const t = this.htmlEntities[e];
754
+ s = s.replace(t.regex, t.val);
755
+ }
756
+ s = s.replace(this.ampEntity.regex, this.ampEntity.val);
757
+ }
758
+ return s;
759
+ };
760
+ function Ot(s, e, t, n) {
761
+ return s && (n === void 0 && (n = e.child.length === 0), s = this.parseTextData(
762
+ s,
763
+ e.tagname,
764
+ t,
765
+ !1,
766
+ e[":@"] ? Object.keys(e[":@"]).length !== 0 : !1,
767
+ n
768
+ ), s !== void 0 && s !== "" && e.add(this.options.textNodeName, s), s = ""), s;
769
+ }
770
+ function Ft(s, e, t, n) {
771
+ return !!(e && e.has(n) || s && s.has(t));
772
+ }
773
+ function $t(s, e, t = ">") {
774
+ let n, i = "";
775
+ for (let r = e; r < s.length; r++) {
776
+ let o = s[r];
777
+ if (n)
778
+ o === n && (n = "");
779
+ else if (o === '"' || o === "'")
780
+ n = o;
781
+ else if (o === t[0])
782
+ if (t[1]) {
783
+ if (s[r + 1] === t[1])
784
+ return {
785
+ data: i,
786
+ index: r
787
+ };
788
+ } else
789
+ return {
790
+ data: i,
791
+ index: r
792
+ };
793
+ else o === " " && (o = " ");
794
+ i += o;
795
+ }
796
+ }
797
+ function D(s, e, t, n) {
798
+ const i = s.indexOf(e, t);
799
+ if (i === -1)
800
+ throw new Error(n);
801
+ return i + e.length - 1;
802
+ }
803
+ function Ne(s, e, t, n = ">") {
804
+ const i = $t(s, e + 1, n);
805
+ if (!i) return;
806
+ let r = i.data;
807
+ const o = i.index, c = r.search(/\s/);
808
+ let a = r, l = !0;
809
+ c !== -1 && (a = r.substring(0, c), r = r.substring(c + 1).trimStart());
810
+ const g = a;
811
+ if (t) {
812
+ const u = a.indexOf(":");
813
+ u !== -1 && (a = a.substr(u + 1), l = a !== i.data.substr(u + 1));
814
+ }
815
+ return {
816
+ tagName: a,
817
+ tagExp: r,
818
+ closeIndex: o,
819
+ attrExpPresent: l,
820
+ rawTagName: g
821
+ };
822
+ }
823
+ function Xt(s, e, t) {
824
+ const n = t;
825
+ let i = 1;
826
+ for (; t < s.length; t++)
827
+ if (s[t] === "<")
828
+ if (s[t + 1] === "/") {
829
+ const r = D(s, ">", t, `${e} is not closed`);
830
+ if (s.substring(t + 2, r).trim() === e && (i--, i === 0))
831
+ return {
832
+ tagContent: s.substring(n, t),
833
+ i: r
834
+ };
835
+ t = r;
836
+ } else if (s[t + 1] === "?")
837
+ t = D(s, "?>", t + 1, "StopNode is not closed.");
838
+ else if (s.substr(t + 1, 3) === "!--")
839
+ t = D(s, "-->", t + 3, "StopNode is not closed.");
840
+ else if (s.substr(t + 1, 2) === "![")
841
+ t = D(s, "]]>", t, "StopNode is not closed.") - 2;
842
+ else {
843
+ const r = Ne(s, t, ">");
844
+ r && ((r && r.tagName) === e && r.tagExp[r.tagExp.length - 1] !== "/" && i++, t = r.closeIndex);
845
+ }
846
+ }
847
+ function we(s, e, t) {
848
+ if (e && typeof s == "string") {
849
+ const n = s.trim();
850
+ return n === "true" ? !0 : n === "false" ? !1 : wt(s, t);
851
+ } else
852
+ return rt(s) ? s : "";
853
+ }
854
+ const Ee = J.getMetaDataSymbol();
855
+ function Ut(s, e) {
856
+ return qe(s, e);
857
+ }
858
+ function qe(s, e, t) {
859
+ let n;
860
+ const i = {};
861
+ for (let r = 0; r < s.length; r++) {
862
+ const o = s[r], c = Wt(o);
863
+ let a = "";
864
+ if (t === void 0 ? a = c : a = t + "." + c, c === e.textNodeName)
865
+ n === void 0 ? n = o[c] : n += "" + o[c];
866
+ else {
867
+ if (c === void 0)
868
+ continue;
869
+ if (o[c]) {
870
+ let l = qe(o[c], e, a);
871
+ const g = Bt(l, e);
872
+ o[Ee] !== void 0 && (l[Ee] = o[Ee]), o[":@"] ? qt(l, o[":@"], a, e) : Object.keys(l).length === 1 && l[e.textNodeName] !== void 0 && !e.alwaysCreateTextNode ? l = l[e.textNodeName] : Object.keys(l).length === 0 && (e.alwaysCreateTextNode ? l[e.textNodeName] = "" : l = ""), i[c] !== void 0 && i.hasOwnProperty(c) ? (Array.isArray(i[c]) || (i[c] = [i[c]]), i[c].push(l)) : e.isArray(c, a, g) ? i[c] = [l] : i[c] = l;
873
+ }
874
+ }
875
+ }
876
+ return typeof n == "string" ? n.length > 0 && (i[e.textNodeName] = n) : n !== void 0 && (i[e.textNodeName] = n), i;
877
+ }
878
+ function Wt(s) {
879
+ const e = Object.keys(s);
880
+ for (let t = 0; t < e.length; t++) {
881
+ const n = e[t];
882
+ if (n !== ":@") return n;
883
+ }
884
+ }
885
+ function qt(s, e, t, n) {
886
+ if (e) {
887
+ const i = Object.keys(e), r = i.length;
888
+ for (let o = 0; o < r; o++) {
889
+ const c = i[o];
890
+ n.isArray(c, t + "." + c, !0, !0) ? s[c] = [e[c]] : s[c] = e[c];
891
+ }
892
+ }
893
+ }
894
+ function Bt(s, e) {
895
+ const { textNodeName: t } = e, n = Object.keys(s).length;
896
+ return !!(n === 0 || n === 1 && (s[t] || typeof s[t] == "boolean" || s[t] === 0));
897
+ }
898
+ class Se {
899
+ constructor(e) {
900
+ this.externalEntities = {}, this.options = mt(e);
901
+ }
902
+ /**
903
+ * Parse XML dats to JS object
904
+ * @param {string|Uint8Array} xmlData
905
+ * @param {boolean|Object} validationOption
906
+ */
907
+ parse(e, t) {
908
+ if (typeof e != "string" && e.toString)
909
+ e = e.toString();
910
+ else if (typeof e != "string")
911
+ throw new Error("XML data is accepted in String or Bytes[] form.");
912
+ if (t) {
913
+ t === !0 && (t = {});
914
+ const r = at(e, t);
915
+ if (r !== !0)
916
+ throw Error(`${r.err.msg}:${r.err.line}:${r.err.col}`);
917
+ }
918
+ const n = new Tt(this.options);
919
+ n.addExternalEntities(this.externalEntities);
920
+ const i = n.parseXml(e);
921
+ return this.options.preserveOrder || i === void 0 ? i : Ut(i, this.options);
922
+ }
923
+ /**
924
+ * Add Entity which is not by default supported by this library
925
+ * @param {string} key
926
+ * @param {string} value
927
+ */
928
+ addEntity(e, t) {
929
+ if (t.indexOf("&") !== -1)
930
+ throw new Error("Entity value can't have '&'");
931
+ if (e.indexOf("&") !== -1 || e.indexOf(";") !== -1)
932
+ throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");
933
+ if (t === "&")
934
+ throw new Error("An entity with value '&' is not permitted");
935
+ this.externalEntities[e] = t;
936
+ }
937
+ /**
938
+ * Returns a Symbol that can be used to access the metadata
939
+ * property on a node.
940
+ *
941
+ * If Symbol is not available in the environment, an ordinary property is used
942
+ * and the name of the property is here returned.
943
+ *
944
+ * The XMLMetaData property is only present when `captureMetaData`
945
+ * is true in the options.
946
+ */
947
+ static getMetaDataSymbol() {
948
+ return J.getMetaDataSymbol();
949
+ }
950
+ }
951
+ const Ht = `
952
+ `;
953
+ function Yt(s, e) {
954
+ let t = "";
955
+ return e.format && e.indentBy.length > 0 && (t = Ht), Be(s, e, "", t);
956
+ }
957
+ function Be(s, e, t, n) {
958
+ let i = "", r = !1;
959
+ for (let o = 0; o < s.length; o++) {
960
+ const c = s[o], a = Gt(c);
961
+ if (a === void 0) continue;
962
+ let l = "";
963
+ if (t.length === 0 ? l = a : l = `${t}.${a}`, a === e.textNodeName) {
964
+ let P = c[a];
965
+ zt(l, e) || (P = e.tagValueProcessor(a, P), P = He(P, e)), r && (i += n), i += P, r = !1;
966
+ continue;
967
+ } else if (a === e.cdataPropName) {
968
+ r && (i += n), i += `<![CDATA[${c[a][0][e.textNodeName]}]]>`, r = !1;
969
+ continue;
970
+ } else if (a === e.commentPropName) {
971
+ i += n + `<!--${c[a][0][e.textNodeName]}-->`, r = !0;
972
+ continue;
973
+ } else if (a[0] === "?") {
974
+ const P = Me(c[":@"], e), M = a === "?xml" ? "" : n;
975
+ let N = c[a][0][e.textNodeName];
976
+ N = N.length !== 0 ? " " + N : "", i += M + `<${a}${N}${P}?>`, r = !0;
977
+ continue;
978
+ }
979
+ let g = n;
980
+ g !== "" && (g += e.indentBy);
981
+ const u = Me(c[":@"], e), v = n + `<${a}${u}`, y = Be(c[a], e, l, g);
982
+ e.unpairedTags.indexOf(a) !== -1 ? e.suppressUnpairedNode ? i += v + ">" : i += v + "/>" : (!y || y.length === 0) && e.suppressEmptyNode ? i += v + "/>" : y && y.endsWith(">") ? i += v + `>${y}${n}</${a}>` : (i += v + ">", y && n !== "" && (y.includes("/>") || y.includes("</")) ? i += n + e.indentBy + y + n : i += y, i += `</${a}>`), r = !0;
983
+ }
984
+ return i;
985
+ }
986
+ function Gt(s) {
987
+ const e = Object.keys(s);
988
+ for (let t = 0; t < e.length; t++) {
989
+ const n = e[t];
990
+ if (s.hasOwnProperty(n) && n !== ":@")
991
+ return n;
992
+ }
993
+ }
994
+ function Me(s, e) {
995
+ let t = "";
996
+ if (s && !e.ignoreAttributes)
997
+ for (let n in s) {
998
+ if (!s.hasOwnProperty(n)) continue;
999
+ let i = e.attributeValueProcessor(n, s[n]);
1000
+ i = He(i, e), i === !0 && e.suppressBooleanAttributes ? t += ` ${n.substr(e.attributeNamePrefix.length)}` : t += ` ${n.substr(e.attributeNamePrefix.length)}="${i}"`;
1001
+ }
1002
+ return t;
1003
+ }
1004
+ function zt(s, e) {
1005
+ s = s.substr(0, s.length - e.textNodeName.length - 1);
1006
+ let t = s.substr(s.lastIndexOf(".") + 1);
1007
+ for (let n in e.stopNodes)
1008
+ if (e.stopNodes[n] === s || e.stopNodes[n] === "*." + t) return !0;
1009
+ return !1;
1010
+ }
1011
+ function He(s, e) {
1012
+ if (s && s.length > 0 && e.processEntities)
1013
+ for (let t = 0; t < e.entities.length; t++) {
1014
+ const n = e.entities[t];
1015
+ s = s.replace(n.regex, n.val);
1016
+ }
1017
+ return s;
1018
+ }
1019
+ const jt = {
1020
+ attributeNamePrefix: "@_",
1021
+ attributesGroupName: !1,
1022
+ textNodeName: "#text",
1023
+ ignoreAttributes: !0,
1024
+ cdataPropName: !1,
1025
+ format: !1,
1026
+ indentBy: " ",
1027
+ suppressEmptyNode: !1,
1028
+ suppressUnpairedNode: !0,
1029
+ suppressBooleanAttributes: !0,
1030
+ tagValueProcessor: function(s, e) {
1031
+ return e;
1032
+ },
1033
+ attributeValueProcessor: function(s, e) {
1034
+ return e;
1035
+ },
1036
+ preserveOrder: !1,
1037
+ commentPropName: !1,
1038
+ unpairedTags: [],
1039
+ entities: [
1040
+ { regex: new RegExp("&", "g"), val: "&amp;" },
1041
+ //it must be on top
1042
+ { regex: new RegExp(">", "g"), val: "&gt;" },
1043
+ { regex: new RegExp("<", "g"), val: "&lt;" },
1044
+ { regex: new RegExp("'", "g"), val: "&apos;" },
1045
+ { regex: new RegExp('"', "g"), val: "&quot;" }
1046
+ ],
1047
+ processEntities: !0,
1048
+ stopNodes: [],
1049
+ // transformTagName: false,
1050
+ // transformAttributeName: false,
1051
+ oneListGroup: !1
1052
+ };
1053
+ function q(s) {
1054
+ this.options = Object.assign({}, jt, s), this.options.ignoreAttributes === !0 || this.options.attributesGroupName ? this.isAttribute = function() {
1055
+ return !1;
1056
+ } : (this.ignoreAttributesFn = We(this.options.ignoreAttributes), this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = Qt), this.processTextOrObjNode = Zt, this.options.format ? (this.indentate = Kt, this.tagEndChar = `>
1057
+ `, this.newLine = `
1058
+ `) : (this.indentate = function() {
1059
+ return "";
1060
+ }, this.tagEndChar = ">", this.newLine = "");
1061
+ }
1062
+ q.prototype.build = function(s) {
1063
+ return this.options.preserveOrder ? Yt(s, this.options) : (Array.isArray(s) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (s = {
1064
+ [this.options.arrayNodeName]: s
1065
+ }), this.j2x(s, 0, []).val);
1066
+ };
1067
+ q.prototype.j2x = function(s, e, t) {
1068
+ let n = "", i = "";
1069
+ const r = t.join(".");
1070
+ for (let o in s)
1071
+ if (Object.prototype.hasOwnProperty.call(s, o))
1072
+ if (typeof s[o] > "u")
1073
+ this.isAttribute(o) && (i += "");
1074
+ else if (s[o] === null)
1075
+ this.isAttribute(o) || o === this.options.cdataPropName ? i += "" : o[0] === "?" ? i += this.indentate(e) + "<" + o + "?" + this.tagEndChar : i += this.indentate(e) + "<" + o + "/" + this.tagEndChar;
1076
+ else if (s[o] instanceof Date)
1077
+ i += this.buildTextValNode(s[o], o, "", e);
1078
+ else if (typeof s[o] != "object") {
1079
+ const c = this.isAttribute(o);
1080
+ if (c && !this.ignoreAttributesFn(c, r))
1081
+ n += this.buildAttrPairStr(c, "" + s[o]);
1082
+ else if (!c)
1083
+ if (o === this.options.textNodeName) {
1084
+ let a = this.options.tagValueProcessor(o, "" + s[o]);
1085
+ i += this.replaceEntitiesValue(a);
1086
+ } else
1087
+ i += this.buildTextValNode(s[o], o, "", e);
1088
+ } else if (Array.isArray(s[o])) {
1089
+ const c = s[o].length;
1090
+ let a = "", l = "";
1091
+ for (let g = 0; g < c; g++) {
1092
+ const u = s[o][g];
1093
+ if (!(typeof u > "u")) if (u === null)
1094
+ o[0] === "?" ? i += this.indentate(e) + "<" + o + "?" + this.tagEndChar : i += this.indentate(e) + "<" + o + "/" + this.tagEndChar;
1095
+ else if (typeof u == "object")
1096
+ if (this.options.oneListGroup) {
1097
+ const v = this.j2x(u, e + 1, t.concat(o));
1098
+ a += v.val, this.options.attributesGroupName && u.hasOwnProperty(this.options.attributesGroupName) && (l += v.attrStr);
1099
+ } else
1100
+ a += this.processTextOrObjNode(u, o, e, t);
1101
+ else if (this.options.oneListGroup) {
1102
+ let v = this.options.tagValueProcessor(o, u);
1103
+ v = this.replaceEntitiesValue(v), a += v;
1104
+ } else
1105
+ a += this.buildTextValNode(u, o, "", e);
1106
+ }
1107
+ this.options.oneListGroup && (a = this.buildObjectNode(a, o, l, e)), i += a;
1108
+ } else if (this.options.attributesGroupName && o === this.options.attributesGroupName) {
1109
+ const c = Object.keys(s[o]), a = c.length;
1110
+ for (let l = 0; l < a; l++)
1111
+ n += this.buildAttrPairStr(c[l], "" + s[o][c[l]]);
1112
+ } else
1113
+ i += this.processTextOrObjNode(s[o], o, e, t);
1114
+ return { attrStr: n, val: i };
1115
+ };
1116
+ q.prototype.buildAttrPairStr = function(s, e) {
1117
+ return e = this.options.attributeValueProcessor(s, "" + e), e = this.replaceEntitiesValue(e), this.options.suppressBooleanAttributes && e === "true" ? " " + s : " " + s + '="' + e + '"';
1118
+ };
1119
+ function Zt(s, e, t, n) {
1120
+ const i = this.j2x(s, t + 1, n.concat(e));
1121
+ return s[this.options.textNodeName] !== void 0 && Object.keys(s).length === 1 ? this.buildTextValNode(s[this.options.textNodeName], e, i.attrStr, t) : this.buildObjectNode(i.val, e, i.attrStr, t);
1122
+ }
1123
+ q.prototype.buildObjectNode = function(s, e, t, n) {
1124
+ if (s === "")
1125
+ return e[0] === "?" ? this.indentate(n) + "<" + e + t + "?" + this.tagEndChar : this.indentate(n) + "<" + e + t + this.closeTag(e) + this.tagEndChar;
1126
+ {
1127
+ let i = "</" + e + this.tagEndChar, r = "";
1128
+ return e[0] === "?" && (r = "?", i = ""), (t || t === "") && s.indexOf("<") === -1 ? this.indentate(n) + "<" + e + t + r + ">" + s + i : this.options.commentPropName !== !1 && e === this.options.commentPropName && r.length === 0 ? this.indentate(n) + `<!--${s}-->` + this.newLine : this.indentate(n) + "<" + e + t + r + this.tagEndChar + s + this.indentate(n) + i;
1129
+ }
1130
+ };
1131
+ q.prototype.closeTag = function(s) {
1132
+ let e = "";
1133
+ return this.options.unpairedTags.indexOf(s) !== -1 ? this.options.suppressUnpairedNode || (e = "/") : this.options.suppressEmptyNode ? e = "/" : e = `></${s}`, e;
1134
+ };
1135
+ q.prototype.buildTextValNode = function(s, e, t, n) {
1136
+ if (this.options.cdataPropName !== !1 && e === this.options.cdataPropName)
1137
+ return this.indentate(n) + `<![CDATA[${s}]]>` + this.newLine;
1138
+ if (this.options.commentPropName !== !1 && e === this.options.commentPropName)
1139
+ return this.indentate(n) + `<!--${s}-->` + this.newLine;
1140
+ if (e[0] === "?")
1141
+ return this.indentate(n) + "<" + e + t + "?" + this.tagEndChar;
1142
+ {
1143
+ let i = this.options.tagValueProcessor(e, s);
1144
+ return i = this.replaceEntitiesValue(i), i === "" ? this.indentate(n) + "<" + e + t + this.closeTag(e) + this.tagEndChar : this.indentate(n) + "<" + e + t + ">" + i + "</" + e + this.tagEndChar;
1145
+ }
1146
+ };
1147
+ q.prototype.replaceEntitiesValue = function(s) {
1148
+ if (s && s.length > 0 && this.options.processEntities)
1149
+ for (let e = 0; e < this.options.entities.length; e++) {
1150
+ const t = this.options.entities[e];
1151
+ s = s.replace(t.regex, t.val);
1152
+ }
1153
+ return s;
1154
+ };
1155
+ function Kt(s) {
1156
+ return this.options.indentBy.repeat(s);
1157
+ }
1158
+ function Qt(s) {
1159
+ return s.startsWith(this.options.attributeNamePrefix) && s !== this.options.textNodeName ? s.substr(this.attrPrefixLen) : !1;
1160
+ }
1161
+ class Jt {
1162
+ attr_id;
1163
+ attr_version;
1164
+ Label;
1165
+ constructor({
1166
+ Label: e,
1167
+ attr_id: t,
1168
+ attr_version: n
1169
+ }) {
1170
+ this.attr_id = t, this.attr_version = n, this.Label = e;
1171
+ }
1172
+ toXML() {
1173
+ return {
1174
+ attr_id: this.attr_id,
1175
+ attr_version: this.attr_version,
1176
+ Label: this.Label
1177
+ };
1178
+ }
1179
+ }
1180
+ class Dt {
1181
+ attr_ref;
1182
+ attr_version;
1183
+ constructor({ attr_ref: e, attr_version: t }) {
1184
+ this.attr_ref = e, this.attr_version = t;
1185
+ }
1186
+ toXML() {
1187
+ return {
1188
+ attr_ref: this.attr_ref,
1189
+ attr_version: this.attr_version
1190
+ };
1191
+ }
1192
+ }
1193
+ class Ye {
1194
+ value;
1195
+ constructor(e) {
1196
+ this.value = e?.text_value;
1197
+ }
1198
+ toXML() {
1199
+ return { text_value: this.value };
1200
+ }
1201
+ }
1202
+ function T(s, e) {
1203
+ return s ? Array.isArray(s) ? s.map((t) => new e(t)) : [new e(s)] : [];
1204
+ }
1205
+ function j(s) {
1206
+ return s.map((e) => e.toXML());
1207
+ }
1208
+ function W(s) {
1209
+ const e = {};
1210
+ return s.forEach((t) => {
1211
+ const i = t.constructor.xmlTagName ?? t.constructor.name;
1212
+ e[i] || (e[i] = []), e[i].push(t.toXML());
1213
+ }), e;
1214
+ }
1215
+ class he {
1216
+ attr_id;
1217
+ attr_version;
1218
+ Units;
1219
+ TicketingEquipmentRef;
1220
+ TicketValidatorEquipmentRef;
1221
+ constructor({
1222
+ attr_id: e,
1223
+ attr_version: t,
1224
+ Units: n,
1225
+ TicketingEquipmentRef: i = void 0,
1226
+ TicketValidatorEquipmentRef: r = void 0
1227
+ }) {
1228
+ this.attr_id = e, this.attr_version = t, this.Units = n, this.TicketingEquipmentRef = i, this.TicketValidatorEquipmentRef = r;
1229
+ }
1230
+ toXML() {
1231
+ return {
1232
+ attr_id: this.attr_id,
1233
+ attr_version: this.attr_version,
1234
+ Units: this.Units,
1235
+ TicketingEquipmentRef: this.TicketingEquipmentRef?.toXML(),
1236
+ TicketValidatorEquipmentRef: this.TicketValidatorEquipmentRef?.toXML()
1237
+ };
1238
+ }
1239
+ }
1240
+ class es {
1241
+ attr_id;
1242
+ attr_version;
1243
+ Name;
1244
+ PublicUse;
1245
+ TotalCapacity;
1246
+ actualVehicleEquipments;
1247
+ constructor({
1248
+ attr_id: e,
1249
+ attr_version: t,
1250
+ Name: n,
1251
+ PublicUse: i,
1252
+ TotalCapacity: r,
1253
+ actualVehicleEquipments: o
1254
+ }) {
1255
+ this.attr_id = e, this.attr_version = t, this.Name = n ? new Ye(n) : void 0, this.actualVehicleEquipments = o ? T(o.ActualVehicleEquipment, he) : [], this.PublicUse = i?.text_value, this.TotalCapacity = r?.text_value;
1256
+ }
1257
+ toXML() {
1258
+ return {
1259
+ attr_id: this.attr_id,
1260
+ attr_version: this.attr_version,
1261
+ Name: this.Name?.toXML
1262
+ };
1263
+ }
1264
+ }
1265
+ class Z {
1266
+ x;
1267
+ y;
1268
+ constructor(e, t) {
1269
+ this.x = e, this.y = t;
1270
+ }
1271
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1272
+ static fromXML(e) {
1273
+ const t = e?.Location?.pos;
1274
+ if (typeof t == "string") {
1275
+ const [n, i] = t.split(" ").map(Number);
1276
+ if (typeof n == "number" && typeof i == "number")
1277
+ return new Z(n, i);
1278
+ } else
1279
+ return new Z(0, 0);
1280
+ }
1281
+ toXML() {
1282
+ return {
1283
+ Location: {
1284
+ pos: `${this.x} ${this.y}`
1285
+ }
1286
+ };
1287
+ }
1288
+ }
1289
+ class Ge {
1290
+ static xmlTagName = "PassengerEntrance";
1291
+ attr_id;
1292
+ attr_version;
1293
+ Name;
1294
+ Label;
1295
+ Width;
1296
+ Height;
1297
+ actualVehicleEquipments;
1298
+ PublicUse;
1299
+ VehicleSide;
1300
+ SequenceFromFront;
1301
+ HeightFromGround;
1302
+ DeckEntranceType;
1303
+ IsEmergencyExit;
1304
+ HasDoor;
1305
+ IsAutomatic;
1306
+ Centroid;
1307
+ // sensorInEntrance: SensorInEntrance[]
1308
+ constructor({
1309
+ attr_id: e,
1310
+ attr_version: t,
1311
+ Name: n,
1312
+ Label: i,
1313
+ Width: r,
1314
+ Height: o,
1315
+ actualVehicleEquipments: c,
1316
+ PublicUse: a,
1317
+ VehicleSide: l,
1318
+ SequenceFromFront: g,
1319
+ HeightFromGround: u,
1320
+ DeckEntranceType: v,
1321
+ IsEmergencyExit: y,
1322
+ HasDoor: P,
1323
+ IsAutomatic: M,
1324
+ Centroid: N = void 0
1325
+ // sensorInEntrance,
1326
+ }) {
1327
+ this.attr_id = e, this.attr_version = t, this.Name = n ? new Ye(n) : void 0, this.Label = i?.text_value, this.Width = r?.text_value, this.Height = o?.text_value, this.actualVehicleEquipments = T(
1328
+ c?.ActualVehicleEquipment,
1329
+ he
1330
+ ), this.PublicUse = a?.text_value, this.VehicleSide = l?.text_value, this.SequenceFromFront = g?.text_value, this.HeightFromGround = u?.text_value, this.DeckEntranceType = v?.text_value, this.IsEmergencyExit = y?.text_value, this.HasDoor = P?.text_value, this.IsAutomatic = M?.text_value, this.Centroid = N ? Z.fromXML(N) : void 0;
1331
+ }
1332
+ toXML() {
1333
+ return {
1334
+ attr_id: this.attr_id,
1335
+ attr_version: this.attr_version,
1336
+ Name: this.Name?.toXML(),
1337
+ Label: this.Label,
1338
+ Width: this.Width,
1339
+ Height: this.Height,
1340
+ actualVehicleEquipments: {
1341
+ ActualVehicleEquipment: j(this.actualVehicleEquipments)
1342
+ },
1343
+ PublicUse: this.PublicUse,
1344
+ VehicleSide: this.VehicleSide,
1345
+ SequenceFromFront: this.SequenceFromFront,
1346
+ HeightFromGround: this.HeightFromGround,
1347
+ DeckEntranceType: this.DeckEntranceType,
1348
+ IsEmergencyExit: this.IsEmergencyExit,
1349
+ HasDoor: this.HasDoor,
1350
+ IsAutomatic: this.IsAutomatic,
1351
+ Centroid: this.Centroid?.toXML()
1352
+ // sensorInEntrance: {SensorInEntrance: serializeElements(this.sensorInEntrance)},
1353
+ };
1354
+ }
1355
+ getShape(e, t, n) {
1356
+ const i = (this.Width || 0.8) * e, r = 0.2 * e;
1357
+ let o = i, c = r;
1358
+ if ((this.VehicleSide === "front" || this.VehicleSide === "back") && (o = r, c = i), this.Centroid)
1359
+ return {
1360
+ x: this.Centroid.x * e,
1361
+ y: this.Centroid.y * e,
1362
+ width: o,
1363
+ height: c,
1364
+ fill: "orange",
1365
+ stroke: "darkorange",
1366
+ strokeWidth: 2,
1367
+ draggable: !0
1368
+ };
1369
+ let a = 0, l = 0;
1370
+ return this.VehicleSide === "leftSide" ? (a = (this.SequenceFromFront ?? 0) * e - o / 2 + 5, l = 5) : this.VehicleSide === "rightSide" ? (a = (this.SequenceFromFront ?? 0) * e - o / 2 + 5, l = n * e + 5 - c) : this.VehicleSide === "front" ? (a = 5, l = n * e / 2 + 5 - c / 2) : this.VehicleSide === "back" ? (a = t * e + 5 - o, l = n * e / 2 + 5 - c / 2) : (a = 5, l = 5), {
1371
+ x: a,
1372
+ y: l,
1373
+ width: o,
1374
+ height: c,
1375
+ fill: "orange",
1376
+ stroke: "darkorange",
1377
+ strokeWidth: 2,
1378
+ draggable: !0
1379
+ };
1380
+ }
1381
+ }
1382
+ class Re {
1383
+ attr_ref;
1384
+ attr_version;
1385
+ constructor({ attr_ref: e, attr_version: t }) {
1386
+ this.attr_ref = e, this.attr_version = t;
1387
+ }
1388
+ toXML() {
1389
+ return {
1390
+ attr_ref: this.attr_ref,
1391
+ attr_version: this.attr_version
1392
+ };
1393
+ }
1394
+ }
1395
+ class ts {
1396
+ attr_ref;
1397
+ attr_version;
1398
+ FromDeckEntranceRef;
1399
+ ToDeckEntranceRef;
1400
+ constructor({ attr_ref: e, attr_version: t, FromDeckEntranceRef: n, ToDeckEntranceRef: i }) {
1401
+ this.attr_ref = e, this.attr_version = t, this.FromDeckEntranceRef = new Re(n), this.ToDeckEntranceRef = new Re(i);
1402
+ }
1403
+ toXML() {
1404
+ return {
1405
+ attr_ref: this.attr_ref,
1406
+ attr_version: this.attr_version,
1407
+ FromDeckEntranceRef: this.FromDeckEntranceRef.toXML(),
1408
+ ToDeckEntranceRef: this.ToDeckEntranceRef.toXML()
1409
+ };
1410
+ }
1411
+ }
1412
+ class ss {
1413
+ attr_id;
1414
+ attr_version;
1415
+ Name;
1416
+ constructor({ attr_id: e, attr_version: t, Name: n }) {
1417
+ this.attr_id = e, this.attr_version = t, this.Name = n;
1418
+ }
1419
+ toXML() {
1420
+ return {
1421
+ attr_id: this.attr_id,
1422
+ Name: this.Name,
1423
+ attr_version: this.attr_version
1424
+ };
1425
+ }
1426
+ }
1427
+ class ns {
1428
+ attr_ref;
1429
+ attr_version;
1430
+ constructor({ attr_ref: e, attr_version: t }) {
1431
+ this.attr_ref = e, this.attr_version = t;
1432
+ }
1433
+ toXML() {
1434
+ return {
1435
+ attr_ref: this.attr_ref,
1436
+ attr_version: this.attr_version
1437
+ };
1438
+ }
1439
+ }
1440
+ class is {
1441
+ attr_ref;
1442
+ attr_version;
1443
+ validityConditions;
1444
+ Name;
1445
+ EntranceUsageType;
1446
+ EntranceSetting;
1447
+ ControlledLocking;
1448
+ constructor({ attr_ref: e, attr_version: t, validityConditions: n, Name: i, EntranceUsageType: r, EntranceSetting: o, ControlledLocking: c }) {
1449
+ this.attr_ref = e, this.attr_version = t, this.validityConditions = Object.entries(n).flatMap(([a, l]) => (a === "ValidityConditionRef" && l.map((g) => new ns(g)), a === "ValidityCondition" && l.map((g) => new ss(g)), [])), this.Name = i, this.EntranceUsageType = r, this.EntranceSetting = o, this.ControlledLocking = c;
1450
+ }
1451
+ toXML() {
1452
+ return {
1453
+ attr_ref: this.attr_ref,
1454
+ attr_version: this.attr_version,
1455
+ validityConditions: W(this.validityConditions),
1456
+ Name: this.Name,
1457
+ EntranceUsageType: this.EntranceUsageType,
1458
+ EntranceSetting: this.EntranceSetting,
1459
+ ControlledLocking: this.ControlledLocking
1460
+ };
1461
+ }
1462
+ }
1463
+ class rs {
1464
+ attr_ref;
1465
+ attr_version;
1466
+ LocatableSpotType;
1467
+ capacity;
1468
+ constructor({ attr_ref: e, attr_version: t, LocatableSpotType: n, capacity: i }) {
1469
+ this.attr_ref = e, this.attr_version = t, this.LocatableSpotType = n, this.capacity = i;
1470
+ }
1471
+ toXML() {
1472
+ return {
1473
+ attr_ref: this.attr_ref,
1474
+ attr_version: this.attr_version,
1475
+ LocatableSpotType: this.LocatableSpotType,
1476
+ capacity: this.capacity
1477
+ };
1478
+ }
1479
+ }
1480
+ class os {
1481
+ attr_id;
1482
+ label;
1483
+ constructor({ attr_id: e, Label: t }) {
1484
+ this.attr_id = e, this.label = t;
1485
+ }
1486
+ toXML() {
1487
+ return {
1488
+ attr_id: this.attr_id,
1489
+ label: this.label
1490
+ };
1491
+ }
1492
+ }
1493
+ class ze {
1494
+ attr_ref;
1495
+ attr_version;
1496
+ constructor({ attr_ref: e, attr_version: t }) {
1497
+ this.attr_ref = e, this.attr_version = t;
1498
+ }
1499
+ toXML() {
1500
+ return {
1501
+ attr_ref: this.attr_ref,
1502
+ attr_version: this.attr_version
1503
+ };
1504
+ }
1505
+ }
1506
+ class as {
1507
+ attr_id;
1508
+ label;
1509
+ //GeneralLabel[]
1510
+ constructor({ attr_id: e, Label: t }) {
1511
+ this.attr_id = e, this.label = t;
1512
+ }
1513
+ toXML() {
1514
+ return {
1515
+ attr_id: this.attr_id,
1516
+ label: this.label
1517
+ };
1518
+ }
1519
+ }
1520
+ class je {
1521
+ attr_ref;
1522
+ attr_version;
1523
+ constructor({ attr_ref: e, attr_version: t }) {
1524
+ this.attr_ref = e, this.attr_version = t;
1525
+ }
1526
+ toXML() {
1527
+ return {
1528
+ attr_ref: this.attr_ref,
1529
+ attr_version: this.attr_version
1530
+ };
1531
+ }
1532
+ }
1533
+ class ls {
1534
+ attr_id;
1535
+ attr_version;
1536
+ Label;
1537
+ Orientation;
1538
+ actualVehicleEquipments;
1539
+ SpotColumnRef;
1540
+ SpotRowRef;
1541
+ constructor({ attr_id: e, attr_version: t, Label: n, Orientation: i, actualVehicleEquipments: r, SpotColumnRef: o, SpotRowRef: c }) {
1542
+ this.attr_id = e, this.attr_version = t, this.Label = n, this.Orientation = i, this.actualVehicleEquipments = r ? T(r, he) : [], this.SpotColumnRef = o ? new ze(o) : void 0, this.SpotRowRef = c ? new je(c) : void 0;
1543
+ }
1544
+ toXML() {
1545
+ return {
1546
+ attr_id: this.attr_id,
1547
+ attr_version: this.attr_version,
1548
+ Label: this.Label,
1549
+ Orientation: this.Orientation,
1550
+ actualVehicleEquipments: { ActualVehicleEquipment: j(this.actualVehicleEquipments) },
1551
+ SpotColumnRef: this.SpotColumnRef?.toXML(),
1552
+ SpotRowRef: this.SpotRowRef?.toXML()
1553
+ };
1554
+ }
1555
+ }
1556
+ class cs {
1557
+ attr_ref;
1558
+ attr_version;
1559
+ constructor({ attr_ref: e, attr_version: t }) {
1560
+ this.attr_ref = e, this.attr_version = t;
1561
+ }
1562
+ toXML() {
1563
+ return {
1564
+ attr_ref: this.attr_ref,
1565
+ attr_version: this.attr_version
1566
+ };
1567
+ }
1568
+ }
1569
+ var F = /* @__PURE__ */ ((s) => (s.Occupied = "Occupied", s.Selected = "Selected", s.Filtered = "Filtered", s.Defect = "Defect", s.Undefined = "Undefined", s))(F || {});
1570
+ class de {
1571
+ static xmlTagName = "PassengerSpot";
1572
+ attr_id;
1573
+ attr_version;
1574
+ Label;
1575
+ Orientation;
1576
+ actualVehicleEquipments;
1577
+ SpotColumnRef;
1578
+ SpotRowRef;
1579
+ ByWindow;
1580
+ ByAisle;
1581
+ HasPower;
1582
+ Centroid;
1583
+ Width;
1584
+ Length;
1585
+ availability;
1586
+ constructor({
1587
+ attr_id: e,
1588
+ attr_version: t,
1589
+ Label: n,
1590
+ Orientation: i,
1591
+ actualVehicleEquipments: r,
1592
+ SpotColumnRef: o,
1593
+ SpotRowRef: c,
1594
+ ByWindow: a,
1595
+ ByAisle: l,
1596
+ HasPower: g,
1597
+ Centroid: u,
1598
+ Width: v,
1599
+ Length: y
1600
+ }) {
1601
+ this.attr_id = e, this.attr_version = t, this.Label = n || "", this.Orientation = i || void 0, this.actualVehicleEquipments = r ? T(r, he) : void 0, this.SpotColumnRef = o ? new ze(o) : void 0, this.SpotRowRef = c ? new je(c) : void 0, this.ByWindow = a, this.ByAisle = l, this.HasPower = g, this.Centroid = u ? Z.fromXML(u) : void 0, this.Width = v || 0.5, this.Length = y || 0.5;
1602
+ }
1603
+ toXML() {
1604
+ return {
1605
+ attr_id: this.attr_id,
1606
+ attr_version: this.attr_version,
1607
+ Label: this.Label ? { text_value: this.Label } : void 0,
1608
+ Orientation: this.Orientation ? { text_value: this.Orientation } : void 0,
1609
+ actualVehicleEquipments: this.actualVehicleEquipments ? W(this.actualVehicleEquipments) : void 0,
1610
+ SpotColumnRef: this.SpotColumnRef?.toXML(),
1611
+ SpotRowRef: this.SpotRowRef?.toXML(),
1612
+ ByWindow: this.ByWindow ? { text_value: this.ByWindow } : void 0,
1613
+ ByAisle: this.ByAisle ? { text_value: this.ByAisle } : void 0,
1614
+ HasPower: this.HasPower ? { text_value: this.HasPower } : void 0,
1615
+ Centroid: this.Centroid?.toXML(),
1616
+ Width: this.Width,
1617
+ Length: this.Length
1618
+ };
1619
+ }
1620
+ getFillColor() {
1621
+ switch (this.availability) {
1622
+ case F.Occupied:
1623
+ return "lightred";
1624
+ case F.Selected:
1625
+ return "lightgreen";
1626
+ case F.Filtered:
1627
+ return "lightgray";
1628
+ case F.Defect:
1629
+ return "black";
1630
+ case F.Undefined:
1631
+ return "lightyellow";
1632
+ default:
1633
+ return "lightgray";
1634
+ }
1635
+ }
1636
+ getStrokeColor() {
1637
+ switch (this.availability) {
1638
+ case F.Occupied:
1639
+ return "red";
1640
+ case F.Selected:
1641
+ return "green";
1642
+ case F.Filtered:
1643
+ return "gray";
1644
+ case F.Defect:
1645
+ return "black";
1646
+ case F.Undefined:
1647
+ return "#121212";
1648
+ default:
1649
+ return "#121212";
1650
+ }
1651
+ }
1652
+ getShape(e) {
1653
+ if (this.Centroid) {
1654
+ const t = this.Width * e, n = this.Length * e;
1655
+ return {
1656
+ x: (this.Centroid?.x ?? 1) * e - t / 2 + 5,
1657
+ y: (this.Centroid?.y ?? 1) * e - n / 2 + 5,
1658
+ width: t,
1659
+ height: n,
1660
+ fill: this.getFillColor(),
1661
+ stroke: this.getStrokeColor(),
1662
+ strokeWidth: 1,
1663
+ cornerRadius: 2,
1664
+ draggable: !0
1665
+ };
1666
+ }
1667
+ return {
1668
+ x: 0,
1669
+ y: 0,
1670
+ width: this.Width * e,
1671
+ height: this.Length * e,
1672
+ fill: "red",
1673
+ draggable: !0
1674
+ };
1675
+ }
1676
+ }
1677
+ class us {
1678
+ attr_ref;
1679
+ attr_version;
1680
+ constructor({ attr_ref: e, attr_version: t }) {
1681
+ this.attr_ref = e, this.attr_version = t;
1682
+ }
1683
+ toXML() {
1684
+ return {
1685
+ attr_ref: this.attr_ref,
1686
+ attr_version: this.attr_version
1687
+ };
1688
+ }
1689
+ }
1690
+ class Ze {
1691
+ value;
1692
+ constructor(e) {
1693
+ this.value = e;
1694
+ }
1695
+ toXML() {
1696
+ return this.value;
1697
+ }
1698
+ }
1699
+ class ds {
1700
+ attr_ref;
1701
+ attr_version;
1702
+ constructor({ attr_ref: e, attr_version: t }) {
1703
+ this.attr_ref = e, this.attr_version = t;
1704
+ }
1705
+ toXML() {
1706
+ return {
1707
+ attr_ref: this.attr_ref,
1708
+ attr_version: this.attr_version
1709
+ };
1710
+ }
1711
+ }
1712
+ class z {
1713
+ static xmlTagName = "PassengerSpace";
1714
+ attr_id;
1715
+ attr_version;
1716
+ Name;
1717
+ SmokingAllowed;
1718
+ StandingAllowed;
1719
+ PassengerSpaceType;
1720
+ passengerSpots;
1721
+ luggageSpots;
1722
+ // passengerVehicleSpots: (PassengerVehicleSpot | PassengerVehicleSpotRef)[]
1723
+ deckEntrances;
1724
+ deckEntranceUsage;
1725
+ deckEntranceCouples;
1726
+ deckSpaceCapacities;
1727
+ actualVehicleEquipments;
1728
+ ServiceFacilitySetRef;
1729
+ // spotAffinities: SpotAffinity[] | undefined
1730
+ Centroid;
1731
+ Polygon;
1732
+ PublicUse;
1733
+ TotalCapacity;
1734
+ FareClass;
1735
+ AirConditioned;
1736
+ constructor({
1737
+ attr_id: e,
1738
+ attr_version: t,
1739
+ Name: n,
1740
+ SmokingAllowed: i,
1741
+ StandingAllowed: r,
1742
+ PassengerSpaceType: o,
1743
+ passengerSpots: c,
1744
+ luggageSpots: a,
1745
+ deckEntrances: l,
1746
+ deckEntranceUsage: g,
1747
+ deckEntranceCouples: u,
1748
+ deckSpaceCapacities: v,
1749
+ actualVehicleEquipments: y,
1750
+ ServiceFacilitySetRef: P,
1751
+ // spotAffinities,
1752
+ Centroid: M,
1753
+ Polygon: N,
1754
+ PublicUse: X,
1755
+ TotalCapacity: B,
1756
+ FareClass: le,
1757
+ AirConditioned: ne
1758
+ }) {
1759
+ this.attr_id = e, this.attr_version = t, this.Name = n, this.SmokingAllowed = i, this.StandingAllowed = r, this.PassengerSpaceType = o, this.passengerSpots = c ? Object.entries(c).flatMap(([H, m]) => H === "PassengerSpot" ? T(m, de) : H === "PassengerSpotRef" ? T(m, us) : []) : [], this.luggageSpots = a ? Object.entries(a).flatMap(([H, m]) => H === "LuggageSpot" ? T(m, ls) : H === "LuggageSpotRef" ? T(m, cs) : []) : [], this.deckEntrances = T(l?.PassengerEntrance, Ge), this.deckEntranceUsage = T(g?.DeckEntranceUsage, is), this.deckEntranceCouples = T(u?.DeckEntranceCouple, ts), this.deckSpaceCapacities = T(v?.DeckSpaceCapacity, rs), this.actualVehicleEquipments = T(y?.ActualVehicleEquipment, he), this.ServiceFacilitySetRef = P ? new ds(P) : void 0, this.Centroid = M ? Z.fromXML(M) : void 0, this.Polygon = N ? new Ze(N) : void 0, this.PublicUse = X?.text_value, this.TotalCapacity = B?.text_value, this.FareClass = le?.text_value, this.AirConditioned = ne?.text_value;
1760
+ }
1761
+ toXML() {
1762
+ return {
1763
+ attr_id: this.attr_id,
1764
+ attr_version: this.attr_version,
1765
+ Name: this.Name,
1766
+ SmokingAllowed: this.SmokingAllowed,
1767
+ StandingAllowed: this.StandingAllowed,
1768
+ PassengerSpaceType: this.PassengerSpaceType,
1769
+ passengerSpots: this.passengerSpots ? W(this.passengerSpots) : "",
1770
+ luggageSpots: this.luggageSpots ? W(this.luggageSpots) : void 0,
1771
+ deckEntrances: this.deckEntrances ? W(this.deckEntrances) : void 0,
1772
+ deckEntranceUsage: this.deckEntranceUsage ? W(this.deckEntranceUsage) : void 0,
1773
+ deckEntranceCouples: this.deckEntranceCouples ? W(this.deckEntranceCouples) : void 0,
1774
+ deckSpaceCapacities: this.deckSpaceCapacities ? W(this.deckSpaceCapacities) : void 0,
1775
+ actualVehicleEquipments: this.actualVehicleEquipments ? W(this.actualVehicleEquipments) : void 0,
1776
+ ServiceFacilitySetRef: this.ServiceFacilitySetRef?.toXML(),
1777
+ Centroid: this.Centroid?.toXML(),
1778
+ Polygon: this.Polygon?.toXML(),
1779
+ PublicUse: this.PublicUse,
1780
+ TotalCapacity: this.TotalCapacity,
1781
+ FareClass: this.FareClass,
1782
+ AirConditioned: this.AirConditioned
1783
+ };
1784
+ }
1785
+ }
1786
+ class hs {
1787
+ attr_id;
1788
+ attr_version;
1789
+ Name;
1790
+ polygon;
1791
+ deckspaces;
1792
+ DeckLevelRef;
1793
+ spotRows;
1794
+ spotColumns;
1795
+ Width;
1796
+ Length;
1797
+ constructor({
1798
+ attr_id: e,
1799
+ attr_version: t,
1800
+ deckSpaces: n,
1801
+ spotRows: i = void 0,
1802
+ spotColumns: r = void 0,
1803
+ DeckLevelRef: o = void 0,
1804
+ Name: c = void 0,
1805
+ polygon: a = void 0,
1806
+ Width: l = void 0,
1807
+ Length: g = void 0
1808
+ }) {
1809
+ this.attr_id = e, this.attr_version = t, this.Name = c?.text_value || "", this.polygon = a ? new Ze(a) : void 0, this.DeckLevelRef = o ? new Dt(o) : void 0, this.Width = l?.text_value || 2.825, this.Length = g?.text_value || 26.4, this.deckspaces = n ? Object.entries(n).flatMap(([u, v]) => u === "OtherDeckSpace" ? T(v, es) : u === "PassengerSpace" ? T(v, z) : []) : [], this.spotRows = T(i?.SpotRow, as), this.spotColumns = T(r?.SpotColumn, os);
1810
+ }
1811
+ toXML() {
1812
+ return {
1813
+ attr_id: this.attr_id,
1814
+ attr_version: this.attr_version,
1815
+ spotRows: { SpotRow: j(this.spotRows) },
1816
+ spotColumns: { SpotColumn: j(this.spotColumns) },
1817
+ deckSpaces: W(this.deckspaces),
1818
+ DeckLevelRef: this.DeckLevelRef?.toXML(),
1819
+ polygon: this.polygon?.toXML(),
1820
+ Name: { text_value: this.Name },
1821
+ Width: { text_value: this.Width },
1822
+ Length: { text_value: this.Length }
1823
+ };
1824
+ }
1825
+ getBoundingBox() {
1826
+ const e = this.Length, t = this.Width;
1827
+ return { width: e, height: t };
1828
+ }
1829
+ getShape(e) {
1830
+ const { width: t, height: n } = this.getBoundingBox();
1831
+ return {
1832
+ x: 5,
1833
+ y: 5,
1834
+ width: t * e,
1835
+ height: n * e,
1836
+ fill: "white",
1837
+ stroke: "gray",
1838
+ strokeWidth: 2,
1839
+ cornerRadius: 5
1840
+ };
1841
+ }
1842
+ }
1843
+ class Ke {
1844
+ attr_id;
1845
+ attr_version;
1846
+ deckLevels;
1847
+ decks;
1848
+ constructor({
1849
+ attr_id: e,
1850
+ attr_version: t,
1851
+ decks: n = void 0,
1852
+ deckLevels: i = void 0
1853
+ }) {
1854
+ this.attr_id = e, this.attr_version = t, this.deckLevels = T(i?.DeckLevel, Jt), this.decks = T(n?.Deck, hs);
1855
+ }
1856
+ toXML() {
1857
+ return {
1858
+ attr_id: this.attr_id,
1859
+ attr_version: this.attr_version,
1860
+ decks: { Deck: j(this.decks) },
1861
+ deckLevels: { DeckLevel: j(this.deckLevels) }
1862
+ };
1863
+ }
1864
+ }
1865
+ const Qe = /* @__PURE__ */ ae({
1866
+ __name: "DeckVisualization",
1867
+ props: {
1868
+ deck: {
1869
+ type: Object,
1870
+ required: !0
1871
+ },
1872
+ availability: {
1873
+ type: Object
1874
+ },
1875
+ scale: {
1876
+ type: Number,
1877
+ required: !0
1878
+ },
1879
+ selectedElements: {
1880
+ type: Array,
1881
+ default: () => []
1882
+ }
1883
+ },
1884
+ emits: ["select", "area-select"],
1885
+ setup(s, { emit: e }) {
1886
+ const t = s, n = e, i = $(null), r = $(!1), o = $({ x: 0, y: 0 }), c = $([]), a = $(/* @__PURE__ */ new Map()), l = ye(() => t.deck.deckspaces?.flatMap((d) => d instanceof z ? d.passengerSpots?.filter((h) => h instanceof de) || [] : []).map((d) => {
1887
+ const h = d;
1888
+ return h.availability = t.availability && d.attr_id ? F[t.availability[d.attr_id] ?? "Undefined"] : F.Undefined, h;
1889
+ }) || []), g = ye(() => t.deck.deckspaces?.flatMap((d) => d instanceof z ? d.deckEntrances || [] : []) || []), u = (d) => t.selectedElements.includes(d) ? {
1890
+ stroke: "#68a691",
1891
+ strokeWidth: 3
1892
+ } : {}, v = (d, h) => {
1893
+ let f = 0, b = 0;
1894
+ const { width: w, height: I } = d.getBoundingBox();
1895
+ return f = Math.max(f, w), b = Math.max(b, I), {
1896
+ width: f * h + 10,
1897
+ height: b * h + 10
1898
+ };
1899
+ }, y = (d, h) => {
1900
+ r.value || (n("select", { element: h, ctrlKey: d.evt.ctrlKey || d.evt.metaKey }), d.cancelBubble = !0);
1901
+ }, P = (d) => {
1902
+ if (d.evt.ctrlKey || d.evt.metaKey || d.target === d.target.getStage()) {
1903
+ r.value = !0;
1904
+ const f = d.target.getStage().getPointerPosition(), b = d.target.getAbsoluteTransform().copy();
1905
+ b.invert();
1906
+ const w = b.point(f);
1907
+ o.value = { x: w.x, y: w.y }, i.value = {
1908
+ x: w.x,
1909
+ y: w.y,
1910
+ width: 0,
1911
+ height: 0,
1912
+ fill: "rgba(0, 255, 0, 0.3)",
1913
+ stroke: "#68a691",
1914
+ strokeWidth: 1
1915
+ };
1916
+ } else
1917
+ n("area-select", []);
1918
+ }, M = (d) => {
1919
+ if (!r.value) return;
1920
+ const f = d.target.getStage().getPointerPosition(), b = d.target.getAbsoluteTransform().copy();
1921
+ b.invert();
1922
+ const w = b.point(f);
1923
+ i.value.width = w.x - o.value.x, i.value.height = w.y - o.value.y;
1924
+ }, N = (d) => {
1925
+ if (!r.value) return;
1926
+ r.value = !1;
1927
+ const h = i.value;
1928
+ if (!h) return;
1929
+ const f = h.width > 0 ? h.x : h.x + h.width, b = h.height > 0 ? h.y : h.y + h.height, w = Math.abs(h.width), I = Math.abs(h.height), L = l.value.filter((V) => {
1930
+ const p = V.getShape(t.scale);
1931
+ return p.x < f + w && p.x + p.width > f && p.y < b + I && p.y + p.height > b;
1932
+ });
1933
+ L.length > 0 && n("area-select", L), i.value = null;
1934
+ }, X = (d, h) => {
1935
+ a.value.clear(), t.selectedElements.includes(h) && t.selectedElements.forEach((f) => {
1936
+ if (f instanceof de) {
1937
+ const b = f.getShape(t.scale);
1938
+ a.value.set(f, { x: b.x, y: b.y });
1939
+ }
1940
+ });
1941
+ }, B = (d, h) => {
1942
+ c.value = [];
1943
+ const f = d.target.getStage();
1944
+ d.target.getLayer();
1945
+ const b = l.value.filter((S) => S !== h && !t.selectedElements.includes(S)), w = d.target.x(), I = d.target.y(), L = 10;
1946
+ let V = w, p = I;
1947
+ b.forEach((S) => {
1948
+ const A = S.getShape(t.scale);
1949
+ Math.abs(w - A.x) < L && (V = A.x, c.value.push({
1950
+ points: [A.x, 0, A.x, f.height()],
1951
+ stroke: "red",
1952
+ strokeWidth: 1,
1953
+ dash: [4, 6]
1954
+ })), Math.abs(I - A.y) < L && (p = A.y, c.value.push({
1955
+ points: [0, A.y, f.width(), A.y],
1956
+ stroke: "red",
1957
+ strokeWidth: 1,
1958
+ dash: [4, 6]
1959
+ }));
1960
+ }), d.target.x(V), d.target.y(p);
1961
+ const C = a.value.get(h);
1962
+ if (C && t.selectedElements.includes(h)) {
1963
+ const S = V - C.x, A = p - C.y;
1964
+ t.selectedElements.forEach((Y) => {
1965
+ if (Y !== h && Y instanceof de) {
1966
+ const U = a.value.get(Y);
1967
+ U && ne(Y, U.x + S, U.y + A);
1968
+ }
1969
+ });
1970
+ }
1971
+ }, le = (d, h) => {
1972
+ c.value = [];
1973
+ const f = d.target.x(), b = d.target.y();
1974
+ ne(h, f, b), a.value.clear();
1975
+ }, ne = (d, h, f) => {
1976
+ d.Centroid ? (d.Centroid.x = (h - 5) / t.scale + d.Width / 2, d.Centroid.y = (f - 5) / t.scale + d.Length / 2) : d.Centroid = new Z(
1977
+ (h - 5) / t.scale + d.Width / 2,
1978
+ (f - 5) / t.scale + d.Length / 2
1979
+ );
1980
+ }, H = (d, h) => {
1981
+ const f = d.target.x(), b = d.target.y(), w = t.deck.Width * t.scale, I = t.deck.Length * t.scale, L = h.getShape(t.scale, t.deck.Length, t.deck.Width), V = L.width, p = L.height, C = 5, S = 5, A = C + I, Y = S + w, U = f + V / 2, ke = b + p / 2, xe = Math.abs(U - C), Te = Math.abs(U - A), Ce = Math.abs(ke - S), Pe = Math.abs(ke - Y), fe = Math.min(xe, Te, Ce, Pe);
1982
+ let ie = f, re = b;
1983
+ fe === Ce ? (re = S, ie = Math.max(C, Math.min(f, A - V))) : fe === Pe ? (re = Y - p, ie = Math.max(C, Math.min(f, A - V))) : fe === xe ? (ie = C, re = w / 2 + 5 - p / 2) : fe === Te && (ie = A - V, re = w / 2 + 5 - p / 2), d.target.x(ie), d.target.y(re), h.Centroid || (h.Centroid = new Z(0, 0)), h.Centroid.x = ie / t.scale, h.Centroid.y = re / t.scale;
1984
+ }, m = (d, h) => {
1985
+ const f = d.target.x(), b = d.target.y(), w = t.deck.Width * t.scale, I = t.deck.Length * t.scale, L = h.getShape(t.scale, t.deck.Length, t.deck.Width), V = L.width, p = L.height, C = 5, S = 5, A = C + I, Y = S + w, U = 1;
1986
+ Math.abs(b - S) < U ? (h.VehicleSide = "leftSide", h.SequenceFromFront = (f - C + V / 2) / t.scale) : Math.abs(b - (Y - p)) < U ? (h.VehicleSide = "rightSide", h.SequenceFromFront = (f - C + V / 2) / t.scale) : Math.abs(f - C) < U ? (h.VehicleSide = "front", h.SequenceFromFront = 0) : Math.abs(f - (A - V)) < U && (h.VehicleSide = "back", h.SequenceFromFront = t.deck.Length);
1987
+ };
1988
+ return (d, h) => {
1989
+ const f = oe("v-rect"), b = oe("v-text"), w = oe("v-group"), I = oe("v-line"), L = oe("v-layer"), V = oe("v-stage");
1990
+ return E(), Q(V, {
1991
+ config: v(s.deck, s.scale)
1992
+ }, {
1993
+ default: ge(() => [
1994
+ G(L, null, {
1995
+ default: ge(() => [
1996
+ G(f, {
1997
+ config: { ...s.deck.getShape(s.scale), y: 5, ...u(s.deck) },
1998
+ onClick: h[0] || (h[0] = (p) => y(p, s.deck))
1999
+ }, null, 8, ["config"]),
2000
+ G(f, {
2001
+ config: {
2002
+ x: 0,
2003
+ y: 0,
2004
+ width: s.deck.getShape(s.scale).width,
2005
+ height: s.deck.getShape(s.scale).height,
2006
+ fill: "transparent",
2007
+ listening: !0
2008
+ },
2009
+ onMousedown: P,
2010
+ onMousemove: M,
2011
+ onMouseup: N
2012
+ }, null, 8, ["config"]),
2013
+ (E(!0), _(ee, null, te(l.value, (p, C) => (E(), Q(w, {
2014
+ key: `seats-${C}`,
2015
+ config: {
2016
+ x: p.getShape(s.scale).x,
2017
+ y: p.getShape(s.scale).y,
2018
+ draggable: !0
2019
+ },
2020
+ onDragstart: (S) => X(S, p),
2021
+ onDragend: (S) => le(S, p),
2022
+ onDragmove: (S) => B(S, p),
2023
+ onClick: (S) => y(S, p)
2024
+ }, {
2025
+ default: ge(() => [
2026
+ G(f, {
2027
+ config: {
2028
+ width: p.getShape(s.scale).width,
2029
+ height: p.getShape(s.scale).height,
2030
+ fill: p.getShape(s.scale).fill,
2031
+ stroke: p.getShape(s.scale).stroke,
2032
+ strokeWidth: p.getShape(s.scale).strokeWidth,
2033
+ cornerRadius: p.getShape(s.scale).cornerRadius,
2034
+ ...u(p)
2035
+ }
2036
+ }, null, 8, ["config"]),
2037
+ G(b, {
2038
+ config: {
2039
+ width: p.getShape(s.scale).width,
2040
+ height: p.getShape(s.scale).height,
2041
+ text: p.Label,
2042
+ align: "center",
2043
+ verticalAlign: "middle",
2044
+ fontSize: Math.min(Math.min(p.getShape(s.scale).width, p.getShape(s.scale).height) / 2, 16),
2045
+ listening: !1
2046
+ }
2047
+ }, null, 8, ["config"])
2048
+ ]),
2049
+ _: 2
2050
+ }, 1032, ["config", "onDragstart", "onDragend", "onDragmove", "onClick"]))), 128)),
2051
+ (E(!0), _(ee, null, te(g.value, (p, C) => (E(), Q(w, {
2052
+ key: `entrance-${C}`,
2053
+ config: {
2054
+ x: p.getShape(s.scale, s.deck.Length, s.deck.Width).x,
2055
+ y: p.getShape(s.scale, s.deck.Length, s.deck.Width).y,
2056
+ draggable: !0
2057
+ },
2058
+ onDragmove: (S) => H(S, p),
2059
+ onDragend: (S) => m(S, p),
2060
+ onClick: (S) => y(S, p)
2061
+ }, {
2062
+ default: ge(() => [
2063
+ G(f, {
2064
+ config: {
2065
+ width: p.getShape(s.scale, s.deck.Length, s.deck.Width).width,
2066
+ height: p.getShape(s.scale, s.deck.Length, s.deck.Width).height,
2067
+ fill: p.getShape(s.scale, s.deck.Length, s.deck.Width).fill,
2068
+ stroke: p.getShape(s.scale, s.deck.Length, s.deck.Width).stroke,
2069
+ strokeWidth: p.getShape(s.scale, s.deck.Length, s.deck.Width).strokeWidth,
2070
+ ...u(p)
2071
+ }
2072
+ }, null, 8, ["config"])
2073
+ ]),
2074
+ _: 2
2075
+ }, 1032, ["config", "onDragmove", "onDragend", "onClick"]))), 128)),
2076
+ i.value ? (E(), Q(f, {
2077
+ key: 0,
2078
+ config: { ...i.value, listening: !1 }
2079
+ }, null, 8, ["config"])) : ve("", !0),
2080
+ (E(!0), _(ee, null, te(c.value, (p, C) => (E(), Q(I, {
2081
+ key: `guide-${C}`,
2082
+ config: p
2083
+ }, null, 8, ["config"]))), 128))
2084
+ ]),
2085
+ _: 1
2086
+ })
2087
+ ]),
2088
+ _: 1
2089
+ }, 8, ["config"]);
2090
+ };
2091
+ }
2092
+ }), fs = { class: "flex flex-col h-full" }, gs = { class: "flex p-4 w-full items-center justify-center gap-10" }, ps = { for: "scale-slider" }, vs = { style: { display: "flex", "flex-direction": "row", "overflow-x": "auto", gap: "20px", padding: "20px" } }, ms = ["onClick"], Je = /* @__PURE__ */ ae({
2093
+ __name: "WagonVisualization",
2094
+ props: {
2095
+ deckPlans: {
2096
+ type: Array,
2097
+ required: !1
2098
+ },
2099
+ selectedElements: {
2100
+ type: Array,
2101
+ default: () => []
2102
+ }
2103
+ },
2104
+ setup(s) {
2105
+ const e = $(20);
2106
+ return (t, n) => (E(), _("div", fs, [
2107
+ k("div", gs, [
2108
+ k("label", ps, "Scale: " + se(e.value), 1),
2109
+ pe(k("input", {
2110
+ id: "scale-slider",
2111
+ type: "range",
2112
+ min: "10",
2113
+ max: "50",
2114
+ "onUpdate:modelValue": n[0] || (n[0] = (i) => e.value = i)
2115
+ }, null, 512), [
2116
+ [
2117
+ Fe,
2118
+ e.value,
2119
+ void 0,
2120
+ { number: !0 }
2121
+ ]
2122
+ ])
2123
+ ]),
2124
+ k("div", vs, [
2125
+ (E(!0), _(ee, null, te(s.deckPlans, (i, r) => (E(), _("div", {
2126
+ key: `deckplan-${r}`
2127
+ }, [
2128
+ k("h3", null, se(i.attr_id), 1),
2129
+ (E(!0), _(ee, null, te(i.decks, (o, c) => (E(), _("div", {
2130
+ key: `deck-${c}`
2131
+ }, [
2132
+ k("h4", {
2133
+ onClick: (a) => t.$emit("select", { element: o, ctrlKey: !1 }),
2134
+ class: _e(`${s.selectedElements.includes(o) ? "text-ott-accent" : ""} cursor-pointer`)
2135
+ }, se(o.Name), 11, ms),
2136
+ G(Qe, {
2137
+ deck: o,
2138
+ scale: e.value,
2139
+ selectedElements: s.selectedElements,
2140
+ onSelect: n[1] || (n[1] = (a) => t.$emit("select", a)),
2141
+ onAreaSelect: n[2] || (n[2] = (a) => t.$emit("area-select", a))
2142
+ }, null, 8, ["deck", "scale", "selectedElements"])
2143
+ ]))), 128))
2144
+ ]))), 128))
2145
+ ])
2146
+ ]));
2147
+ }
2148
+ }), bs = { class: "bg-ott-bg-primary p-4" }, Es = { class: "flex justify-between items-center mb-4" }, ys = { key: 0 }, Ns = ["for"], ws = ["id", "onUpdate:modelValue", "type"], Ss = ["id", "onUpdate:modelValue"], _s = { key: 2 }, ks = ["id", "onUpdate:modelValue"], xs = { key: 3 }, Ts = { key: 4 }, Cs = { key: 1 }, Ps = /* @__PURE__ */ ae({
2149
+ __name: "ObjectProperties",
2150
+ props: {
2151
+ element: {
2152
+ type: Object,
2153
+ default: null
2154
+ }
2155
+ },
2156
+ emits: ["delete"],
2157
+ setup(s) {
2158
+ return (e, t) => (E(), _("div", bs, [
2159
+ k("div", Es, [
2160
+ t[1] || (t[1] = k("h3", { class: "font-bold" }, "Properties", -1)),
2161
+ s.element ? (E(), _("button", {
2162
+ key: 0,
2163
+ class: "ott-button border-ott-error! text-ott-error!",
2164
+ onClick: t[0] || (t[0] = (n) => e.$emit("delete", s.element))
2165
+ }, " Delete ")) : ve("", !0)
2166
+ ]),
2167
+ s.element ? (E(), _("div", ys, [
2168
+ (E(!0), _(ee, null, te(s.element, (n, i) => (E(), _("div", {
2169
+ key: i,
2170
+ class: "flex items-center mb-10"
2171
+ }, [
2172
+ k("label", {
2173
+ for: i,
2174
+ class: "min-w-[150px] font-bold"
2175
+ }, se(i), 9, Ns),
2176
+ typeof n == "string" || typeof n == "number" ? pe((E(), _("input", {
2177
+ key: 0,
2178
+ id: i,
2179
+ "onUpdate:modelValue": (r) => s.element[i] = r,
2180
+ type: typeof n == "number" ? "number" : "text"
2181
+ }, null, 8, ws)), [
2182
+ [De, s.element[i]]
2183
+ ]) : typeof n == "boolean" ? pe((E(), _("input", {
2184
+ key: 1,
2185
+ id: i,
2186
+ "onUpdate:modelValue": (r) => s.element[i] = r,
2187
+ type: "checkbox"
2188
+ }, null, 8, Ss)), [
2189
+ [et, s.element[i]]
2190
+ ]) : n && typeof n == "object" && n.value !== void 0 ? (E(), _("span", _s, [
2191
+ pe(k("input", {
2192
+ id: i,
2193
+ "onUpdate:modelValue": (r) => n.value = r,
2194
+ type: "text"
2195
+ }, null, 8, ks), [
2196
+ [Fe, n.value]
2197
+ ])
2198
+ ])) : n && Array.isArray(n) ? (E(), _("span", xs, se(n.length) + " elements ", 1)) : (E(), _("span", Ts, se(n), 1))
2199
+ ]))), 128))
2200
+ ])) : (E(), _("div", Cs, [...t[2] || (t[2] = [
2201
+ k("p", null, "Select an element to view properties.", -1)
2202
+ ])]))
2203
+ ]));
2204
+ }
2205
+ }), Ls = (s, e) => {
2206
+ const t = s.__vccOpts || s;
2207
+ for (const [n, i] of e)
2208
+ t[n] = i;
2209
+ return t;
2210
+ }, As = /* @__PURE__ */ Ls(Ps, [["__scopeId", "data-v-7c2c07dd"]]), Is = { class: "flex flex-col gap-2 p-4 bg-white flex-1" }, Vs = { class: "flex flex-col gap-2" }, Ms = /* @__PURE__ */ ae({
2211
+ __name: "ElementCatalog",
2212
+ emits: ["add-seat", "add-door"],
2213
+ setup(s) {
2214
+ return (e, t) => (E(), _("div", Is, [
2215
+ t[2] || (t[2] = k("h3", { class: "font-bold mb-2" }, "Catalog", -1)),
2216
+ k("div", Vs, [
2217
+ k("button", {
2218
+ class: "ott-button w-fit text-left",
2219
+ onClick: t[0] || (t[0] = (n) => e.$emit("add-seat"))
2220
+ }, " + Add Seat "),
2221
+ k("button", {
2222
+ class: "ott-button w-fit text-left",
2223
+ onClick: t[1] || (t[1] = (n) => e.$emit("add-door"))
2224
+ }, " + Add Door ")
2225
+ ])
2226
+ ]));
2227
+ }
2228
+ }), Rs = { class: "h-full overflow-y-auto bg-gray-100 p-4 font-mono text-sm" }, Os = ["id"], Fs = /* @__PURE__ */ ae({
2229
+ __name: "XmlViewer",
2230
+ props: {
2231
+ xml: {
2232
+ type: String,
2233
+ required: !0
2234
+ },
2235
+ selectedId: {
2236
+ type: String,
2237
+ default: null
2238
+ }
2239
+ },
2240
+ setup(s) {
2241
+ const e = s, t = ye(() => e.xml.split(`
2242
+ `)), n = $(null), i = (o) => n.value ? o >= n.value.start && o <= n.value.end : !1, r = () => {
2243
+ if (!e.selectedId) {
2244
+ n.value = null;
2245
+ return;
2246
+ }
2247
+ const o = t.value.findIndex((a) => a.includes(`id="${e.selectedId}"`));
2248
+ if (o === -1) {
2249
+ n.value = null;
2250
+ return;
2251
+ }
2252
+ const c = t.value[o];
2253
+ if (c) {
2254
+ if (c.trim().endsWith("/>"))
2255
+ n.value = { start: o, end: o };
2256
+ else {
2257
+ const a = c.match(/<(\w+)/);
2258
+ if (a) {
2259
+ const l = a[1];
2260
+ let g = 1, u = o;
2261
+ for (let v = o + 1; v < t.value.length; v++) {
2262
+ const y = t.value[v];
2263
+ if (y && !y.match(new RegExp(`<${l}.*/>`)) && (y.match(new RegExp(`<${l}`)) ? g++ : y.match(new RegExp(`</${l}>`)) && g--, g === 0)) {
2264
+ u = v;
2265
+ break;
2266
+ }
2267
+ }
2268
+ n.value = { start: o, end: u };
2269
+ } else
2270
+ n.value = { start: o, end: o };
2271
+ }
2272
+ tt(() => {
2273
+ document.getElementById(`line-${o}`)?.scrollIntoView({ behavior: "smooth", block: "center" });
2274
+ });
2275
+ }
2276
+ };
2277
+ return $e(() => [e.selectedId, e.xml], () => {
2278
+ r();
2279
+ }, { immediate: !0 }), (o, c) => (E(), _("div", Rs, [
2280
+ (E(!0), _(ee, null, te(t.value, (a, l) => (E(), _("div", {
2281
+ key: l,
2282
+ id: `line-${l}`,
2283
+ class: _e({ "bg-yellow-200": i(l) })
2284
+ }, [
2285
+ k("pre", null, se(a), 1)
2286
+ ], 10, Os))), 128))
2287
+ ]));
2288
+ }
2289
+ }), $s = (s) => {
2290
+ const t = new Se({
2291
+ ignoreAttributes: !1,
2292
+ attributeNamePrefix: "attr_",
2293
+ removeNSPrefix: !0
2294
+ }).parse(s);
2295
+ return console.log(t), T(
2296
+ t.PublicationDelivery.dataObjects.CompositeFrame.frames.ResourceFrame.deckPlans.DeckPlan,
2297
+ Ke
2298
+ );
2299
+ }, Xs = { class: "flex flex-col h-full" }, Us = { class: "p-4 border-b border-b-ott-bg-dark flex gap-2 items-center bg-ott-bg-primary" }, Ws = { class: "flex-1 flex overflow-hidden" }, qs = { class: "flex-1 overflow-hidden" }, Bs = { class: "flex flex-row h-75 border-t border-ott-bg-dark" }, Hs = /* @__PURE__ */ ae({
2300
+ __name: "DeckplanEditor",
2301
+ setup(s, { expose: e }) {
2302
+ const t = $(null), n = $([]), i = $([]), r = $(null), o = $(!1), c = $(""), a = () => {
2303
+ if (!o.value || !r.value) return;
2304
+ r.value.PublicationDelivery.dataObjects.CompositeFrame.frames.ResourceFrame.deckPlans.DeckPlan = j(n.value);
2305
+ const m = new q({
2306
+ ignoreAttributes: !1,
2307
+ textNodeName: "text_value",
2308
+ attributeNamePrefix: "attr_",
2309
+ format: !0
2310
+ });
2311
+ c.value = m.build(r.value);
2312
+ }, l = () => {
2313
+ o.value = !o.value, o.value && a();
2314
+ };
2315
+ $e(n, () => {
2316
+ a();
2317
+ }, { deep: !0 });
2318
+ const g = ({ element: m, ctrlKey: d }) => {
2319
+ if (d) {
2320
+ const h = i.value.indexOf(m);
2321
+ if (h > -1)
2322
+ i.value.splice(h, 1);
2323
+ else {
2324
+ if (i.value.length > 0 && i.value[0].constructor !== m.constructor)
2325
+ return;
2326
+ i.value.push(m);
2327
+ }
2328
+ } else
2329
+ i.value = [m];
2330
+ }, u = (m) => {
2331
+ i.value = m;
2332
+ }, v = (m) => {
2333
+ const d = m.target;
2334
+ t.value = d.files ? d.files[0] : null;
2335
+ };
2336
+ function y() {
2337
+ if (t.value) {
2338
+ const m = new FileReader();
2339
+ m.addEventListener("load", (d) => {
2340
+ const h = d.target?.result;
2341
+ if (typeof h != "string") return;
2342
+ const f = new Se({
2343
+ ignoreAttributes: !1,
2344
+ attributeNamePrefix: "attr_",
2345
+ removeNSPrefix: !0
2346
+ });
2347
+ r.value = f.parse(h), n.value = $s(h), n.value = [...n.value];
2348
+ }), m.readAsText(t.value);
2349
+ }
2350
+ }
2351
+ function P() {
2352
+ if (t.value) {
2353
+ r.value.PublicationDelivery.dataObjects.CompositeFrame.frames.ResourceFrame.deckPlans.DeckPlan = j(n.value);
2354
+ const d = new q({
2355
+ ignoreAttributes: !1,
2356
+ textNodeName: "text_value",
2357
+ attributeNamePrefix: "attr_"
2358
+ }).build(r.value), h = new Blob([d], { type: "text/xml" }), f = document.createElement("a");
2359
+ f.href = URL.createObjectURL(h), f.download = "Demo.xml", f.click();
2360
+ }
2361
+ }
2362
+ const M = () => n.value.length > 0 && n.value[0]?.decks.length && n.value[0]?.decks?.length > 0 ? n.value[0].decks[0] : null, N = () => {
2363
+ const m = M();
2364
+ if (!m) return;
2365
+ const d = m.deckspaces?.find((f) => f instanceof z);
2366
+ if (!d) {
2367
+ console.warn("No PassengerSpace found to add seat to");
2368
+ return;
2369
+ }
2370
+ const h = new de({
2371
+ attr_id: `seat_${Date.now()}`,
2372
+ attr_version: "1",
2373
+ Label: "",
2374
+ Orientation: "forwards",
2375
+ actualVehicleEquipments: [],
2376
+ SpotColumnRef: null,
2377
+ SpotRowRef: null,
2378
+ ByWindow: !1,
2379
+ ByAisle: !1,
2380
+ HasPower: !1,
2381
+ Centroid: { x: 1, y: 1 },
2382
+ // Default position
2383
+ Width: 0.5,
2384
+ Length: 0.5
2385
+ });
2386
+ d.passengerSpots || (d.passengerSpots = []), d.passengerSpots.push(h);
2387
+ }, X = () => {
2388
+ const m = M();
2389
+ if (!m) return;
2390
+ const d = m.deckspaces?.find((f) => f instanceof z);
2391
+ if (!d) {
2392
+ console.warn("No PassengerSpace found to add door to");
2393
+ return;
2394
+ }
2395
+ const h = new Ge({
2396
+ attr_id: `door_${Date.now()}`,
2397
+ attr_version: "1",
2398
+ Name: { text_value: "New Door" },
2399
+ Width: { text_value: 1 },
2400
+ VehicleSide: { text_value: "leftSide" },
2401
+ SequenceFromFront: { text_value: 0 },
2402
+ DeckEntranceType: { text_value: "external" },
2403
+ actualVehicleEquipments: { ActualVehicleEquipment: [] },
2404
+ Label: void 0,
2405
+ Height: void 0,
2406
+ PublicUse: void 0,
2407
+ HeightFromGround: void 0,
2408
+ IsEmergencyExit: void 0,
2409
+ HasDoor: void 0,
2410
+ IsAutomatic: void 0,
2411
+ Centroid: void 0
2412
+ });
2413
+ d.deckEntrances || (d.deckEntrances = []), d.deckEntrances.push(h);
2414
+ }, B = (m) => {
2415
+ n.value.forEach((d) => {
2416
+ d.decks.forEach((h) => {
2417
+ h.deckspaces?.forEach((f) => {
2418
+ if (f instanceof z) {
2419
+ if (f.passengerSpots) {
2420
+ const b = f.passengerSpots.indexOf(m);
2421
+ b > -1 && f.passengerSpots.splice(b, 1);
2422
+ }
2423
+ if (f.deckEntrances) {
2424
+ const b = f.deckEntrances.indexOf(m);
2425
+ b > -1 && f.deckEntrances.splice(b, 1);
2426
+ }
2427
+ }
2428
+ });
2429
+ });
2430
+ }), i.value = [];
2431
+ };
2432
+ function le() {
2433
+ return r.value ? (r.value.PublicationDelivery.dataObjects.CompositeFrame.frames.ResourceFrame.deckPlans.DeckPlan = j(n.value), new q({
2434
+ ignoreAttributes: !1,
2435
+ textNodeName: "text_value",
2436
+ attributeNamePrefix: "attr_",
2437
+ format: !0
2438
+ }).build(r.value)) : null;
2439
+ }
2440
+ function ne() {
2441
+ return new z({
2442
+ attr_id: `ps-${Date.now()}`,
2443
+ attr_version: "1",
2444
+ Name: void 0,
2445
+ SmokingAllowed: void 0,
2446
+ StandingAllowed: void 0,
2447
+ PassengerSpaceType: "seatingArea",
2448
+ passengerSpots: {
2449
+ PassengerSpot: [],
2450
+ PassengerSpotRef: []
2451
+ },
2452
+ luggageSpots: {
2453
+ LuggageSpot: [],
2454
+ LuggageSpotRef: []
2455
+ },
2456
+ deckEntrances: {
2457
+ PassengerEntrance: []
2458
+ },
2459
+ deckEntranceUsage: {
2460
+ DeckEntranceUsage: []
2461
+ },
2462
+ deckEntranceCouples: {
2463
+ DeckEntranceCouple: []
2464
+ },
2465
+ deckSpaceCapacities: {
2466
+ DeckSpaceCapacity: []
2467
+ },
2468
+ actualVehicleEquipments: {
2469
+ ActualVehicleEquipment: []
2470
+ },
2471
+ ServiceFacilitySetRef: void 0,
2472
+ Centroid: void 0,
2473
+ Polygon: void 0,
2474
+ PublicUse: void 0,
2475
+ TotalCapacity: void 0,
2476
+ FareClass: void 0,
2477
+ AirConditioned: void 0
2478
+ });
2479
+ }
2480
+ function H(m) {
2481
+ const h = new Se({
2482
+ ignoreAttributes: !1,
2483
+ attributeNamePrefix: "attr_",
2484
+ removeNSPrefix: !0,
2485
+ alwaysCreateTextNode: !1
2486
+ }).parse(m);
2487
+ r.value = h;
2488
+ const f = T(h.PublicationDelivery.dataObjects.CompositeFrame.frames.ResourceFrame.deckPlans.DeckPlan, Ke);
2489
+ f.forEach((b) => {
2490
+ b.decks.forEach((w) => {
2491
+ if (!w.deckspaces || w.deckspaces.length === 0) {
2492
+ w.deckspaces = [ne()];
2493
+ return;
2494
+ }
2495
+ const I = [];
2496
+ w.deckspaces.forEach((L) => {
2497
+ L instanceof z ? I.push(L) : (L?.passengerSpots || L?.PassengerSpaceType) && I.push(new z(L));
2498
+ }), w.deckspaces = I;
2499
+ });
2500
+ }), n.value = f;
2501
+ }
2502
+ return e({
2503
+ exportXml: le,
2504
+ loadXml: H
2505
+ }), (m, d) => (E(), _("div", Xs, [
2506
+ k("div", Us, [
2507
+ k("input", {
2508
+ ref: "inputRef",
2509
+ class: "ott-button",
2510
+ type: "file",
2511
+ multiple: "",
2512
+ onChange: v,
2513
+ accept: "text/xml"
2514
+ }, null, 544),
2515
+ k("button", {
2516
+ onClick: y,
2517
+ class: "ott-button"
2518
+ }, "Load"),
2519
+ k("button", {
2520
+ onClick: P,
2521
+ class: "ott-button"
2522
+ }, "Save"),
2523
+ k("button", {
2524
+ onClick: l,
2525
+ class: _e(["ott-button", { "bg-ott-accent text-white": o.value }])
2526
+ }, "XML", 2)
2527
+ ]),
2528
+ k("div", Ws, [
2529
+ k("div", qs, [
2530
+ n.value.length > 0 ? (E(), Q(Je, {
2531
+ key: 0,
2532
+ deckPlans: n.value,
2533
+ selectedElements: i.value,
2534
+ onSelect: g,
2535
+ onAreaSelect: u
2536
+ }, null, 8, ["deckPlans", "selectedElements"])) : ve("", !0)
2537
+ ]),
2538
+ o.value ? (E(), Q(Fs, {
2539
+ key: 0,
2540
+ xml: c.value,
2541
+ selectedId: i.value[0]?.attr_id,
2542
+ class: "w-1/3 border-l border-ott-bg-dark"
2543
+ }, null, 8, ["xml", "selectedId"])) : ve("", !0)
2544
+ ]),
2545
+ k("div", Bs, [
2546
+ G(As, {
2547
+ element: i.value.length === 1 ? i.value[0] : null,
2548
+ class: "flex-1 overflow-y-auto",
2549
+ onDelete: B
2550
+ }, null, 8, ["element"]),
2551
+ G(Ms, {
2552
+ class: "w-50 border-l border-ott-bg-dark",
2553
+ onAddSeat: N,
2554
+ onAddDoor: X
2555
+ })
2556
+ ])
2557
+ ]));
2558
+ }
2559
+ }), Oe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2560
+ __proto__: null,
2561
+ DeckVisualization: Qe,
2562
+ DeckplanEditor: Hs,
2563
+ WagonVisualization: Je
2564
+ }, Symbol.toStringTag, { value: "Module" }));
2565
+ function Ys(s) {
2566
+ for (const e in Oe)
2567
+ s.component(e, Oe[e]);
2568
+ }
2569
+ const zs = { install: Ys };
2570
+ export {
2571
+ Qe as DeckVisualization,
2572
+ Hs as DeckplanEditor,
2573
+ Je as WagonVisualization,
2574
+ zs as default
2575
+ };