@opentrainticketing/netex-deckplan-editor 1.0.5 → 1.0.6

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