@eyeon/map 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -1
- package/dist/assets/MapViewer.css +1 -1
- package/dist/assets/index.css +1 -1
- package/dist/chunks/MapViewer.js +1745 -356
- package/dist/chunks/MapViewer.js.map +1 -1
- package/dist/chunks/stacking.js +1321 -0
- package/dist/chunks/stacking.js.map +1 -0
- package/dist/core/geometry/index.d.ts +41 -4
- package/dist/core/geometry/index.d.ts.map +1 -1
- package/dist/core/hostChrome.d.ts +20 -0
- package/dist/core/hostChrome.d.ts.map +1 -0
- package/dist/core/import/index.d.ts +48 -3
- package/dist/core/import/index.d.ts.map +1 -1
- package/dist/core/import/svgStyle.d.ts +21 -0
- package/dist/core/import/svgStyle.d.ts.map +1 -0
- package/dist/core/import/svgTransform.d.ts +49 -0
- package/dist/core/import/svgTransform.d.ts.map +1 -0
- package/dist/core/index.d.ts +3 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +207 -266
- package/dist/core/index.js.map +1 -1
- package/dist/core/layerStyles.d.ts +28 -0
- package/dist/core/layerStyles.d.ts.map +1 -0
- package/dist/core/publish/index.d.ts +8 -2
- package/dist/core/publish/index.d.ts.map +1 -1
- package/dist/core/routing/graph-tools.d.ts +5 -1
- package/dist/core/routing/graph-tools.d.ts.map +1 -1
- package/dist/core/stacking.d.ts +61 -0
- package/dist/core/stacking.d.ts.map +1 -0
- package/dist/core/types.d.ts +27 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/editor/MapEditor.d.ts +28 -16
- package/dist/editor/MapEditor.d.ts.map +1 -1
- package/dist/editor/canvas/EditorCanvas.d.ts +15 -3
- package/dist/editor/canvas/EditorCanvas.d.ts.map +1 -1
- package/dist/editor/canvas/coords.d.ts +21 -0
- package/dist/editor/canvas/coords.d.ts.map +1 -0
- package/dist/editor/draftOps.d.ts +19 -0
- package/dist/editor/draftOps.d.ts.map +1 -0
- package/dist/editor/geometryEdit.d.ts +34 -0
- package/dist/editor/geometryEdit.d.ts.map +1 -0
- package/dist/editor/index.css +1281 -145
- package/dist/editor/index.d.ts +8 -2
- package/dist/editor/index.d.ts.map +1 -1
- package/dist/editor/index.js +2293 -585
- package/dist/editor/index.js.map +1 -1
- package/dist/editor/labels.d.ts +5 -0
- package/dist/editor/labels.d.ts.map +1 -0
- package/dist/editor/panels/FloorsPanel.d.ts +60 -0
- package/dist/editor/panels/FloorsPanel.d.ts.map +1 -0
- package/dist/editor/panels/ImportReviewPanel.d.ts +22 -0
- package/dist/editor/panels/ImportReviewPanel.d.ts.map +1 -0
- package/dist/editor/panels/Inspector.d.ts +4 -2
- package/dist/editor/panels/Inspector.d.ts.map +1 -1
- package/dist/editor/panels/LeftRail.d.ts +19 -6
- package/dist/editor/panels/LeftRail.d.ts.map +1 -1
- package/dist/editor/panels/PreviewOverlay.d.ts +11 -2
- package/dist/editor/panels/PreviewOverlay.d.ts.map +1 -1
- package/dist/editor/portalSurface.d.ts +11 -0
- package/dist/editor/portalSurface.d.ts.map +1 -0
- package/dist/editor/previewDocument.d.ts +9 -0
- package/dist/editor/previewDocument.d.ts.map +1 -0
- package/dist/editor/tools.d.ts +20 -0
- package/dist/editor/tools.d.ts.map +1 -0
- package/dist/test-maps/shops-at-south-town/BASE - Shops At South Town.ai +26780 -26
- package/dist/test-maps/shops-at-south-town/LF - Shops At South Town.ai +4487 -2
- package/dist/test-maps/shops-at-south-town/SVG/BASE - Shops At South Town.svg +567 -0
- package/dist/test-maps/shops-at-south-town/SVG/LF - Shops At South Town.svg +238 -0
- package/dist/test-maps/shops-at-south-town/SVG/UF - Shops At South Town.svg +276 -0
- package/dist/test-maps/shops-at-south-town/UF - Shops At South Town.ai +4228 -1
- package/dist/viewer/MapViewer.d.ts +14 -3
- package/dist/viewer/MapViewer.d.ts.map +1 -1
- package/dist/viewer/camera.d.ts +34 -0
- package/dist/viewer/camera.d.ts.map +1 -0
- package/dist/viewer/components/CameraRig.d.ts +18 -0
- package/dist/viewer/components/CameraRig.d.ts.map +1 -0
- package/dist/viewer/components/LevelMeshes.d.ts +6 -1
- package/dist/viewer/components/LevelMeshes.d.ts.map +1 -1
- package/dist/viewer/components/MapScene.d.ts +6 -1
- package/dist/viewer/components/MapScene.d.ts.map +1 -1
- package/dist/viewer/components/SvgVectorLayer.d.ts +18 -0
- package/dist/viewer/components/SvgVectorLayer.d.ts.map +1 -0
- package/dist/viewer/index.css +124 -35
- package/dist/viewer/index.d.ts +4 -0
- package/dist/viewer/index.d.ts.map +1 -1
- package/dist/viewer/index.js +9 -4
- package/dist/viewer/index.js.map +1 -1
- package/dist/viewer/ui/MapControls.d.ts +14 -0
- package/dist/viewer/ui/MapControls.d.ts.map +1 -0
- package/dist/viewer/ui/RuntimeChrome.d.ts +3 -3
- package/dist/viewer/ui/RuntimeChrome.d.ts.map +1 -1
- package/package.json +17 -7
- package/dist/chunks/graph-tools.js +0 -153
- package/dist/chunks/graph-tools.js.map +0 -1
- package/dist/chunks/pathfinding.js +0 -343
- package/dist/chunks/pathfinding.js.map +0 -1
|
@@ -0,0 +1,1321 @@
|
|
|
1
|
+
import ge from "ngraph.graph";
|
|
2
|
+
import ke from "ngraph.path";
|
|
3
|
+
const J = {
|
|
4
|
+
MAP_STYLE: "2D",
|
|
5
|
+
MAP_BACKGROUND_COLOR: "#FFFFFF",
|
|
6
|
+
ACCENT_COLOR: "#2563eb",
|
|
7
|
+
STORE_DEFAULT_COLOR: "#e2e8f0",
|
|
8
|
+
STORE_TEXT_COLOR: "#1e293b",
|
|
9
|
+
STORE_HEIGHT: 4,
|
|
10
|
+
WALL_COLOR: "#64748b",
|
|
11
|
+
WALL_THICKNESS: 0.4,
|
|
12
|
+
BOUNDARY_COLOR: "#334155",
|
|
13
|
+
BOUNDARY_THICKNESS: 0.6,
|
|
14
|
+
BASE_COLOR: "#ffffff",
|
|
15
|
+
OVERLAY_COLOR: "#000000",
|
|
16
|
+
OVERLAY_OPACITY: 0.15,
|
|
17
|
+
PARKING_ZONE_COLOR: "#cbd5e1",
|
|
18
|
+
GREEN_AREA_COLOR: "#86efac",
|
|
19
|
+
WATER_COLOR: "#7dd3fc",
|
|
20
|
+
WALKABLE_COLOR: "#f8fafc",
|
|
21
|
+
KIOSK_SIZE: 12,
|
|
22
|
+
ZOOM_STEP: 0.5,
|
|
23
|
+
CAMERA_MAX_DISTANCE: 2e3,
|
|
24
|
+
CAMERA_MIN_DISTANCE: 50
|
|
25
|
+
}, be = "#f5f5f5";
|
|
26
|
+
function Ie(...e) {
|
|
27
|
+
const t = Object.assign({}, J, ...e.filter(Boolean));
|
|
28
|
+
return t.MAP_BACKGROUND_COLOR.toLowerCase() === be && (t.MAP_BACKGROUND_COLOR = J.MAP_BACKGROUND_COLOR), t;
|
|
29
|
+
}
|
|
30
|
+
const ve = [
|
|
31
|
+
"unit",
|
|
32
|
+
"amenity",
|
|
33
|
+
"kiosk_screen",
|
|
34
|
+
"connector",
|
|
35
|
+
"entrance",
|
|
36
|
+
"parking_zone"
|
|
37
|
+
], H = 1e4, mt = 2.5;
|
|
38
|
+
function pt(e) {
|
|
39
|
+
return e === "PORTAL" ? "editor" : "viewer";
|
|
40
|
+
}
|
|
41
|
+
const Me = {
|
|
42
|
+
search: !0,
|
|
43
|
+
amenities: !0,
|
|
44
|
+
floors: !0,
|
|
45
|
+
zoomReset: !0,
|
|
46
|
+
kioskOrigin: !1,
|
|
47
|
+
fetchDraft: !1
|
|
48
|
+
}, Se = {
|
|
49
|
+
WEBSITE: Me,
|
|
50
|
+
/** Assign mode: click shapes, no public directory chrome. */
|
|
51
|
+
PORTAL_ASSIGN: {
|
|
52
|
+
search: !1,
|
|
53
|
+
amenities: !1,
|
|
54
|
+
floors: !0,
|
|
55
|
+
zoomReset: !0,
|
|
56
|
+
kioskOrigin: !1,
|
|
57
|
+
fetchDraft: !1
|
|
58
|
+
},
|
|
59
|
+
DISPLAY_APP: {
|
|
60
|
+
search: !1,
|
|
61
|
+
amenities: !1,
|
|
62
|
+
floors: !0,
|
|
63
|
+
zoomReset: !0,
|
|
64
|
+
kioskOrigin: !0,
|
|
65
|
+
fetchDraft: !1
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
function yt(e) {
|
|
69
|
+
return Se[e];
|
|
70
|
+
}
|
|
71
|
+
function gt(e) {
|
|
72
|
+
return e !== "PORTAL";
|
|
73
|
+
}
|
|
74
|
+
const F = {
|
|
75
|
+
"green-area": {
|
|
76
|
+
fill: "#C4DDAB",
|
|
77
|
+
renderOrder: 2,
|
|
78
|
+
extrudeHeight: 1
|
|
79
|
+
},
|
|
80
|
+
"water-area": {
|
|
81
|
+
fill: "#5cc0f9",
|
|
82
|
+
renderOrder: 2,
|
|
83
|
+
extrudeHeight: 1
|
|
84
|
+
},
|
|
85
|
+
"parking-lane": {
|
|
86
|
+
fill: "#F6F6F6",
|
|
87
|
+
renderOrder: 2,
|
|
88
|
+
extrudeHeight: 1
|
|
89
|
+
},
|
|
90
|
+
"parking-line": {
|
|
91
|
+
stroke: "#DDDDDD",
|
|
92
|
+
strokeWidth: 0.6,
|
|
93
|
+
renderOrder: 6,
|
|
94
|
+
extrudeHeight: 0.5
|
|
95
|
+
},
|
|
96
|
+
"parking-icon": {
|
|
97
|
+
fill: "#CCCCCC",
|
|
98
|
+
renderOrder: 7,
|
|
99
|
+
extrudeHeight: 1
|
|
100
|
+
},
|
|
101
|
+
/** v1 kept SVG fill; house default for maps that omit a fill. */
|
|
102
|
+
"walking-path": {
|
|
103
|
+
fill: "#F1EFEA",
|
|
104
|
+
renderOrder: 2,
|
|
105
|
+
extrudeHeight: 1
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
function ee(e) {
|
|
109
|
+
return e.toLowerCase().replace(/[-_]+/g, " ").replace(/\s+/g, " ").trim();
|
|
110
|
+
}
|
|
111
|
+
function ue(e) {
|
|
112
|
+
if (!e) return null;
|
|
113
|
+
const t = ee(e);
|
|
114
|
+
if (!t) return null;
|
|
115
|
+
const n = Object.keys(F).sort((s, i) => i.length - s.length);
|
|
116
|
+
for (const s of n) {
|
|
117
|
+
const i = ee(s);
|
|
118
|
+
if (t === i || t.startsWith(`${i} `) || t === `${i}s` || t.startsWith(`${i}s `)) return F[s];
|
|
119
|
+
}
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
function kt(e, t) {
|
|
123
|
+
return e.map((n) => ({ x: n.x, y: t - n.y }));
|
|
124
|
+
}
|
|
125
|
+
function Y(e, t) {
|
|
126
|
+
const n = e.x - t.x, s = e.y - t.y;
|
|
127
|
+
return Math.hypot(n, s);
|
|
128
|
+
}
|
|
129
|
+
function we(e) {
|
|
130
|
+
if (e.length === 0)
|
|
131
|
+
return { minX: 0, minY: 0, maxX: 0, maxY: 0 };
|
|
132
|
+
let t = e[0].x, n = e[0].y, s = e[0].x, i = e[0].y;
|
|
133
|
+
for (let r = 1; r < e.length; r++) {
|
|
134
|
+
const l = e[r];
|
|
135
|
+
l.x < t && (t = l.x), l.y < n && (n = l.y), l.x > s && (s = l.x), l.y > i && (i = l.y);
|
|
136
|
+
}
|
|
137
|
+
return { minX: t, minY: n, maxX: s, maxY: i };
|
|
138
|
+
}
|
|
139
|
+
function bt(e, t) {
|
|
140
|
+
return {
|
|
141
|
+
minX: Math.min(e.minX, t.minX),
|
|
142
|
+
minY: Math.min(e.minY, t.minY),
|
|
143
|
+
maxX: Math.max(e.maxX, t.maxX),
|
|
144
|
+
maxY: Math.max(e.maxY, t.maxY)
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function Ce(e) {
|
|
148
|
+
if (e.length === 0) return { x: 0, y: 0 };
|
|
149
|
+
let t = 0, n = 0;
|
|
150
|
+
for (const s of e)
|
|
151
|
+
t += s.x, n += s.y;
|
|
152
|
+
return { x: t / e.length, y: n / e.length };
|
|
153
|
+
}
|
|
154
|
+
function Ae(e, t) {
|
|
155
|
+
let n = !1;
|
|
156
|
+
for (let s = 0, i = t.length - 1; s < t.length; i = s++) {
|
|
157
|
+
const r = t[s].x, l = t[s].y, c = t[i].x, o = t[i].y;
|
|
158
|
+
l > e.y != o > e.y && e.x < (c - r) * (e.y - l) / (o - l + Number.EPSILON) + r && (n = !n);
|
|
159
|
+
}
|
|
160
|
+
return n;
|
|
161
|
+
}
|
|
162
|
+
function It(e, t) {
|
|
163
|
+
return t.some((n) => Ae(e, n));
|
|
164
|
+
}
|
|
165
|
+
function Le(e, t, n) {
|
|
166
|
+
const s = n.x - t.x, i = n.y - t.y, r = s * s + i * i;
|
|
167
|
+
if (r === 0)
|
|
168
|
+
return { point: { ...t }, t: 0, distance: Y(e, t) };
|
|
169
|
+
let l = ((e.x - t.x) * s + (e.y - t.y) * i) / r;
|
|
170
|
+
l = Math.max(0, Math.min(1, l));
|
|
171
|
+
const c = { x: t.x + l * s, y: t.y + l * i };
|
|
172
|
+
return { point: c, t: l, distance: Y(e, c) };
|
|
173
|
+
}
|
|
174
|
+
function vt(e, t) {
|
|
175
|
+
if (t.length < 2) return null;
|
|
176
|
+
let n = null;
|
|
177
|
+
for (let s = 0; s < t.length - 1; s++) {
|
|
178
|
+
const i = Le(e, t[s], t[s + 1]);
|
|
179
|
+
(!n || i.distance < n.distance) && (n = { point: i.point, segmentIndex: s, distance: i.distance });
|
|
180
|
+
}
|
|
181
|
+
return n;
|
|
182
|
+
}
|
|
183
|
+
function te(e, t, n, s, i = 8) {
|
|
184
|
+
const r = [];
|
|
185
|
+
for (let l = 0; l <= i; l++) {
|
|
186
|
+
const c = l / i, o = 1 - c;
|
|
187
|
+
r.push({
|
|
188
|
+
x: o * o * o * e.x + 3 * o * o * c * t.x + 3 * o * c * c * n.x + c * c * c * s.x,
|
|
189
|
+
y: o * o * o * e.y + 3 * o * o * c * t.y + 3 * o * c * c * n.y + c * c * c * s.y
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
return r;
|
|
193
|
+
}
|
|
194
|
+
function ne(e, t, n, s = 6) {
|
|
195
|
+
const i = [];
|
|
196
|
+
for (let r = 0; r <= s; r++) {
|
|
197
|
+
const l = r / s, c = 1 - l;
|
|
198
|
+
i.push({
|
|
199
|
+
x: c * c * e.x + 2 * c * l * t.x + l * l * n.x,
|
|
200
|
+
y: c * c * e.y + 2 * c * l * t.y + l * l * n.y
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
return i;
|
|
204
|
+
}
|
|
205
|
+
const Oe = 8;
|
|
206
|
+
function Ne(e, t, n, s, i, r, l) {
|
|
207
|
+
if (e.x === l.x && e.y === l.y) return [{ ...e }];
|
|
208
|
+
let c = Math.abs(t), o = Math.abs(n);
|
|
209
|
+
if (c === 0 || o === 0 || !Number.isFinite(c) || !Number.isFinite(o))
|
|
210
|
+
return [{ ...e }, { ...l }];
|
|
211
|
+
const m = s % 360 * Math.PI / 180, p = Math.cos(m), a = Math.sin(m), k = (e.x - l.x) / 2, u = (e.y - l.y) / 2, d = p * k + a * u, f = -a * k + p * u, h = d * d / (c * c) + f * f / (o * o);
|
|
212
|
+
if (h > 1) {
|
|
213
|
+
const L = Math.sqrt(h);
|
|
214
|
+
c *= L, o *= L;
|
|
215
|
+
}
|
|
216
|
+
const g = c * c, x = o * o, y = g * x - g * f * f - x * d * d, b = g * f * f + x * d * d, I = Math.sqrt(Math.max(0, y / b)) * (i === r ? -1 : 1), v = I * c * f / o, M = -I * o * d / c, R = p * v - a * M + (e.x + l.x) / 2, S = a * v + p * M + (e.y + l.y) / 2, E = (d - v) / c, C = (f - M) / o, _ = (-d - v) / c, A = (-f - M) / o, B = Math.atan2(C, E);
|
|
217
|
+
let w = Math.atan2(E * A - C * _, E * _ + C * A);
|
|
218
|
+
!r && w > 0 ? w -= 2 * Math.PI : r && w < 0 && (w += 2 * Math.PI);
|
|
219
|
+
const X = Math.abs(w) / (Math.PI / 2) * Oe, D = Math.max(1, Math.round(X)), P = [{ ...e }];
|
|
220
|
+
for (let L = 1; L <= D; L++) {
|
|
221
|
+
const Z = B + w * L / D, q = Math.cos(Z), Q = Math.sin(Z);
|
|
222
|
+
P.push({
|
|
223
|
+
x: R + c * p * q - o * a * Q,
|
|
224
|
+
y: S + c * a * q + o * p * Q
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
return P[P.length - 1] = { ...l }, P;
|
|
228
|
+
}
|
|
229
|
+
const _e = /[\s,]/;
|
|
230
|
+
function fe(e) {
|
|
231
|
+
const t = [];
|
|
232
|
+
let n = 0, s = "", i = 0;
|
|
233
|
+
for (; n < e.length; ) {
|
|
234
|
+
const r = e[n];
|
|
235
|
+
if (_e.test(r)) {
|
|
236
|
+
n++;
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
if (r >= "a" && r <= "z" || r >= "A" && r <= "Z") {
|
|
240
|
+
s = r, i = 0, t.push(r), n++;
|
|
241
|
+
continue;
|
|
242
|
+
}
|
|
243
|
+
const l = s === "A" || s === "a" ? i % 7 : -1;
|
|
244
|
+
if ((l === 3 || l === 4) && (r === "0" || r === "1")) {
|
|
245
|
+
t.push(r), n++, i++;
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
const c = n;
|
|
249
|
+
let o = 0;
|
|
250
|
+
for ((r === "+" || r === "-") && n++; n < e.length && e[n] >= "0" && e[n] <= "9"; )
|
|
251
|
+
n++, o++;
|
|
252
|
+
if (e[n] === ".")
|
|
253
|
+
for (n++; n < e.length && e[n] >= "0" && e[n] <= "9"; )
|
|
254
|
+
n++, o++;
|
|
255
|
+
if (o > 0 && (e[n] === "e" || e[n] === "E")) {
|
|
256
|
+
const m = n;
|
|
257
|
+
if (n++, (e[n] === "+" || e[n] === "-") && n++, n < e.length && e[n] >= "0" && e[n] <= "9")
|
|
258
|
+
for (; n < e.length && e[n] >= "0" && e[n] <= "9"; ) n++;
|
|
259
|
+
else
|
|
260
|
+
n = m;
|
|
261
|
+
}
|
|
262
|
+
if (o === 0) {
|
|
263
|
+
n = c + 1;
|
|
264
|
+
continue;
|
|
265
|
+
}
|
|
266
|
+
t.push(e.slice(c, n)), i++;
|
|
267
|
+
}
|
|
268
|
+
return t;
|
|
269
|
+
}
|
|
270
|
+
function de(e) {
|
|
271
|
+
const t = fe(e), n = [];
|
|
272
|
+
let s = [], i = 0, r = 0, l = 0, c = 0, o = null, m = 0, p = "";
|
|
273
|
+
const a = () => Number(t[m++]);
|
|
274
|
+
for (; m < t.length; ) {
|
|
275
|
+
const k = t[m];
|
|
276
|
+
switch (/[a-zA-Z]/.test(k) && (p = k, m++), p) {
|
|
277
|
+
case "M":
|
|
278
|
+
case "m": {
|
|
279
|
+
const u = p === "m", d = a(), f = a();
|
|
280
|
+
i = u ? i + d : d, r = u ? r + f : f, s.length > 0 && n.push(s), s = [{ x: i, y: r }], l = i, c = r, o = null, p = u ? "l" : "L";
|
|
281
|
+
break;
|
|
282
|
+
}
|
|
283
|
+
case "L":
|
|
284
|
+
case "l": {
|
|
285
|
+
const u = p === "l", d = a(), f = a();
|
|
286
|
+
i = u ? i + d : d, r = u ? r + f : f, s.push({ x: i, y: r }), o = null;
|
|
287
|
+
break;
|
|
288
|
+
}
|
|
289
|
+
case "H":
|
|
290
|
+
case "h": {
|
|
291
|
+
const u = p === "h", d = a();
|
|
292
|
+
i = u ? i + d : d, s.push({ x: i, y: r }), o = null;
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
295
|
+
case "V":
|
|
296
|
+
case "v": {
|
|
297
|
+
const u = p === "v", d = a();
|
|
298
|
+
r = u ? r + d : d, s.push({ x: i, y: r }), o = null;
|
|
299
|
+
break;
|
|
300
|
+
}
|
|
301
|
+
case "C":
|
|
302
|
+
case "c": {
|
|
303
|
+
const u = p === "c", d = u ? i + a() : a(), f = u ? r + a() : a(), h = u ? i + a() : a(), g = u ? r + a() : a(), x = u ? i + a() : a(), y = u ? r + a() : a(), b = te(
|
|
304
|
+
{ x: i, y: r },
|
|
305
|
+
{ x: d, y: f },
|
|
306
|
+
{ x: h, y: g },
|
|
307
|
+
{ x, y }
|
|
308
|
+
);
|
|
309
|
+
s.push(...b.slice(1)), o = { x: h, y: g }, i = x, r = y;
|
|
310
|
+
break;
|
|
311
|
+
}
|
|
312
|
+
case "Q":
|
|
313
|
+
case "q": {
|
|
314
|
+
const u = p === "q", d = u ? i + a() : a(), f = u ? r + a() : a(), h = u ? i + a() : a(), g = u ? r + a() : a(), x = ne(
|
|
315
|
+
{ x: i, y: r },
|
|
316
|
+
{ x: d, y: f },
|
|
317
|
+
{ x: h, y: g }
|
|
318
|
+
);
|
|
319
|
+
s.push(...x.slice(1)), o = { x: d, y: f }, i = h, r = g;
|
|
320
|
+
break;
|
|
321
|
+
}
|
|
322
|
+
case "S":
|
|
323
|
+
case "s": {
|
|
324
|
+
const u = p === "s", d = o ? 2 * i - o.x : i, f = o ? 2 * r - o.y : r, h = u ? i + a() : a(), g = u ? r + a() : a(), x = u ? i + a() : a(), y = u ? r + a() : a(), b = te(
|
|
325
|
+
{ x: i, y: r },
|
|
326
|
+
{ x: d, y: f },
|
|
327
|
+
{ x: h, y: g },
|
|
328
|
+
{ x, y }
|
|
329
|
+
);
|
|
330
|
+
s.push(...b.slice(1)), o = { x: h, y: g }, i = x, r = y;
|
|
331
|
+
break;
|
|
332
|
+
}
|
|
333
|
+
case "T":
|
|
334
|
+
case "t": {
|
|
335
|
+
const u = p === "t", d = o ? 2 * i - o.x : i, f = o ? 2 * r - o.y : r, h = u ? i + a() : a(), g = u ? r + a() : a(), x = ne(
|
|
336
|
+
{ x: i, y: r },
|
|
337
|
+
{ x: d, y: f },
|
|
338
|
+
{ x: h, y: g }
|
|
339
|
+
);
|
|
340
|
+
s.push(...x.slice(1)), o = { x: d, y: f }, i = h, r = g;
|
|
341
|
+
break;
|
|
342
|
+
}
|
|
343
|
+
case "A":
|
|
344
|
+
case "a": {
|
|
345
|
+
const u = p === "a", d = a(), f = a(), h = a(), g = a() !== 0, x = a() !== 0, y = u ? i + a() : a(), b = u ? r + a() : a(), I = Ne(
|
|
346
|
+
{ x: i, y: r },
|
|
347
|
+
d,
|
|
348
|
+
f,
|
|
349
|
+
h,
|
|
350
|
+
g,
|
|
351
|
+
x,
|
|
352
|
+
{ x: y, y: b }
|
|
353
|
+
);
|
|
354
|
+
s.push(...I.slice(1)), o = null, i = y, r = b;
|
|
355
|
+
break;
|
|
356
|
+
}
|
|
357
|
+
case "Z":
|
|
358
|
+
case "z": {
|
|
359
|
+
s.push({ x: l, y: c }), n.push(s), s = [], i = l, r = c, o = null;
|
|
360
|
+
break;
|
|
361
|
+
}
|
|
362
|
+
default:
|
|
363
|
+
m++;
|
|
364
|
+
break;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
return s.length > 0 && n.push(s), n;
|
|
368
|
+
}
|
|
369
|
+
function Re(e) {
|
|
370
|
+
const t = e.match(
|
|
371
|
+
/^\s*M\s*(-?\d*\.?\d+(?:e[-+]?\d+)?)[\s,]+(-?\d*\.?\d+(?:e[-+]?\d+)?)/i
|
|
372
|
+
);
|
|
373
|
+
if (!t) return null;
|
|
374
|
+
const n = Number(t[1]), s = Number(t[2]);
|
|
375
|
+
return Number.isFinite(n) && Number.isFinite(s) ? { x: n, y: s } : null;
|
|
376
|
+
}
|
|
377
|
+
function Ee(e) {
|
|
378
|
+
var i, r;
|
|
379
|
+
const t = (i = e.paths[0]) == null ? void 0 : i.d;
|
|
380
|
+
if (!t || e.polygons.length === 0) return !1;
|
|
381
|
+
const n = Re(t), s = (r = e.polygons[0]) == null ? void 0 : r[0];
|
|
382
|
+
return !n || !s ? !1 : Math.abs(n.x - s.x) > 0.01 || Math.abs(n.y - s.y) > 0.01;
|
|
383
|
+
}
|
|
384
|
+
function he(e) {
|
|
385
|
+
if (!Ee(e)) return e;
|
|
386
|
+
const t = e.paths.flatMap((n) => de(n.d));
|
|
387
|
+
return t.length === 0 ? e : { paths: e.paths, polygons: t };
|
|
388
|
+
}
|
|
389
|
+
function Pe(e) {
|
|
390
|
+
const t = e.map((s) => ({
|
|
391
|
+
d: s,
|
|
392
|
+
closed: /z/i.test(s)
|
|
393
|
+
})), n = e.flatMap((s) => de(s));
|
|
394
|
+
return { paths: t, polygons: n };
|
|
395
|
+
}
|
|
396
|
+
function V(e) {
|
|
397
|
+
const t = e.polygons.flat();
|
|
398
|
+
return we(t);
|
|
399
|
+
}
|
|
400
|
+
function Te(e) {
|
|
401
|
+
return Ce(e.polygons.flat());
|
|
402
|
+
}
|
|
403
|
+
function Mt(e, t, n = 0, s = [15, 45, 90]) {
|
|
404
|
+
const i = t.x - e.x, r = t.y - e.y, l = Math.hypot(i, r);
|
|
405
|
+
if (l === 0) return { ...t };
|
|
406
|
+
const o = Math.atan2(r, i) * 180 / Math.PI - n;
|
|
407
|
+
let m = o, p = 1 / 0;
|
|
408
|
+
for (const k of s) {
|
|
409
|
+
const u = Math.round(o / k) * k, d = Math.abs(o - u);
|
|
410
|
+
d < p && (p = d, m = u);
|
|
411
|
+
}
|
|
412
|
+
const a = (m + n) * Math.PI / 180;
|
|
413
|
+
return {
|
|
414
|
+
x: e.x + Math.cos(a) * l,
|
|
415
|
+
y: e.y + Math.sin(a) * l
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
function St(e, t) {
|
|
419
|
+
return Math.atan2(t.y - e.y, t.x - e.x) * 180 / Math.PI;
|
|
420
|
+
}
|
|
421
|
+
function De(e) {
|
|
422
|
+
if (!e) return null;
|
|
423
|
+
const t = e.trim().split(/[\s,]+/).map(Number);
|
|
424
|
+
return t.length !== 4 || t.some((n) => Number.isNaN(n)) ? null : { x: t[0], y: t[1], width: t[2], height: t[3] };
|
|
425
|
+
}
|
|
426
|
+
const Fe = {
|
|
427
|
+
fill: "fill",
|
|
428
|
+
"fill-opacity": "fill-opacity",
|
|
429
|
+
stroke: "stroke",
|
|
430
|
+
"stroke-width": "stroke-width",
|
|
431
|
+
"stroke-opacity": "stroke-opacity",
|
|
432
|
+
opacity: "opacity"
|
|
433
|
+
};
|
|
434
|
+
function Ye(e) {
|
|
435
|
+
const t = {};
|
|
436
|
+
for (const n of e.split(";")) {
|
|
437
|
+
const s = n.indexOf(":");
|
|
438
|
+
if (s === -1) continue;
|
|
439
|
+
const i = n.slice(0, s).trim().toLowerCase(), r = n.slice(s + 1).trim();
|
|
440
|
+
i && r && (t[i] = r);
|
|
441
|
+
}
|
|
442
|
+
return t;
|
|
443
|
+
}
|
|
444
|
+
function $e(e) {
|
|
445
|
+
const t = /* @__PURE__ */ new Map(), n = e.replace(/\/\*[\s\S]*?\*\//g, "");
|
|
446
|
+
for (const s of n.matchAll(/([^{]+)\{([^}]*)\}/g)) {
|
|
447
|
+
const i = s[1].split(",").map((l) => l.trim()), r = Ye(s[2]);
|
|
448
|
+
for (const l of i) {
|
|
449
|
+
const c = l.match(/^\.([a-zA-Z0-9_-]+)$/);
|
|
450
|
+
if (!c) continue;
|
|
451
|
+
const o = c[1];
|
|
452
|
+
t.set(o, {
|
|
453
|
+
...t.get(o) || {},
|
|
454
|
+
...r
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
return t;
|
|
459
|
+
}
|
|
460
|
+
function Xe(e, t) {
|
|
461
|
+
const n = {};
|
|
462
|
+
for (const s of e.split(/\s+/).map((i) => i.trim()).filter(Boolean))
|
|
463
|
+
Object.assign(n, t.get(s) || {});
|
|
464
|
+
return n;
|
|
465
|
+
}
|
|
466
|
+
function Be(e) {
|
|
467
|
+
const t = [], n = e.replace(/<!--[\s\S]*?-->/g, "");
|
|
468
|
+
for (const i of n.matchAll(/<style\b[^>]*>([\s\S]*?)<\/style>/gi))
|
|
469
|
+
t.push(i[1]);
|
|
470
|
+
if (t.length === 0) return e;
|
|
471
|
+
const s = /* @__PURE__ */ new Map();
|
|
472
|
+
for (const i of t)
|
|
473
|
+
for (const [r, l] of $e(i))
|
|
474
|
+
s.set(r, { ...s.get(r) || {}, ...l });
|
|
475
|
+
return s.size === 0 ? e : e.replace(
|
|
476
|
+
/<(path|polygon|polyline|line|rect|g|circle|ellipse)\b([^>]*)>/gi,
|
|
477
|
+
(i, r, l) => {
|
|
478
|
+
const c = /\/\s*$/.test(l), o = l.replace(/\/\s*$/, ""), m = o.match(/\bclass\s*=\s*["']([^"']*)["']/i);
|
|
479
|
+
if (!m) return i;
|
|
480
|
+
const p = Xe(m[1], s);
|
|
481
|
+
let a = o;
|
|
482
|
+
for (const [k, u] of Object.entries(p)) {
|
|
483
|
+
const d = Fe[k];
|
|
484
|
+
d && (new RegExp(`\\b${d}\\s*=`, "i").test(a) || (a += ` ${d}="${u}"`));
|
|
485
|
+
}
|
|
486
|
+
return `<${r}${a}${c ? " /" : ""}>`;
|
|
487
|
+
}
|
|
488
|
+
);
|
|
489
|
+
}
|
|
490
|
+
function se(e) {
|
|
491
|
+
var c, o, m, p, a;
|
|
492
|
+
const t = {}, n = (c = e.match(/\bfill\s*=\s*["']([^"']*)["']/i)) == null ? void 0 : c[1], s = (o = e.match(/\bstroke\s*=\s*["']([^"']*)["']/i)) == null ? void 0 : o[1], i = (m = e.match(/\bstroke-width\s*=\s*["']?(-?[\d.]+)/i)) == null ? void 0 : m[1], r = (p = e.match(/\bopacity\s*=\s*["']?(-?[\d.]+)/i)) == null ? void 0 : p[1], l = (a = e.match(/\bfill-opacity\s*=\s*["']?(-?[\d.]+)/i)) == null ? void 0 : a[1];
|
|
493
|
+
return n && n.toLowerCase() !== "none" && (t.fill = n), s && s.toLowerCase() !== "none" && (t.stroke = s), i != null && !Number.isNaN(Number(i)) && (t.strokeWidth = Number(i)), r != null && !Number.isNaN(Number(r)) ? t.opacity = Number(r) : l != null && !Number.isNaN(Number(l)) && (t.opacity = Number(l)), t;
|
|
494
|
+
}
|
|
495
|
+
function z(e, t) {
|
|
496
|
+
return {
|
|
497
|
+
fill: t.fill ?? e.fill,
|
|
498
|
+
stroke: t.stroke ?? e.stroke,
|
|
499
|
+
strokeWidth: t.strokeWidth ?? e.strokeWidth,
|
|
500
|
+
opacity: t.opacity ?? e.opacity
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
const K = { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 };
|
|
504
|
+
function $(e, t) {
|
|
505
|
+
return {
|
|
506
|
+
a: e.a * t.a + e.c * t.b,
|
|
507
|
+
b: e.b * t.a + e.d * t.b,
|
|
508
|
+
c: e.a * t.c + e.c * t.d,
|
|
509
|
+
d: e.b * t.c + e.d * t.d,
|
|
510
|
+
e: e.a * t.e + e.c * t.f + e.e,
|
|
511
|
+
f: e.b * t.e + e.d * t.f + e.f
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
function ze(e, t) {
|
|
515
|
+
return {
|
|
516
|
+
x: e.a * t.x + e.c * t.y + e.e,
|
|
517
|
+
y: e.b * t.x + e.d * t.y + e.f
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
function We(e, t = 1e-9) {
|
|
521
|
+
return Math.abs(e.a - 1) < t && Math.abs(e.b) < t && Math.abs(e.c) < t && Math.abs(e.d - 1) < t && Math.abs(e.e) < t && Math.abs(e.f) < t;
|
|
522
|
+
}
|
|
523
|
+
function W(e, t) {
|
|
524
|
+
return { a: 1, b: 0, c: 0, d: 1, e, f: t };
|
|
525
|
+
}
|
|
526
|
+
function Ge(e) {
|
|
527
|
+
const t = e * Math.PI / 180, n = Math.cos(t), s = Math.sin(t);
|
|
528
|
+
return { a: n, b: s, c: -s, d: n, e: 0, f: 0 };
|
|
529
|
+
}
|
|
530
|
+
function He(e, t) {
|
|
531
|
+
switch (e) {
|
|
532
|
+
case "matrix":
|
|
533
|
+
return t.length < 6 ? null : { a: t[0], b: t[1], c: t[2], d: t[3], e: t[4], f: t[5] };
|
|
534
|
+
case "translate":
|
|
535
|
+
return t.length < 1 ? null : W(t[0], t[1] ?? 0);
|
|
536
|
+
case "scale": {
|
|
537
|
+
if (t.length < 1) return null;
|
|
538
|
+
const n = t[0], s = t[1] ?? n;
|
|
539
|
+
return { a: n, b: 0, c: 0, d: s, e: 0, f: 0 };
|
|
540
|
+
}
|
|
541
|
+
case "rotate": {
|
|
542
|
+
if (t.length < 1) return null;
|
|
543
|
+
const n = Ge(t[0]);
|
|
544
|
+
if (t.length < 3) return n;
|
|
545
|
+
const s = t[1], i = t[2];
|
|
546
|
+
return $(
|
|
547
|
+
$(W(s, i), n),
|
|
548
|
+
W(-s, -i)
|
|
549
|
+
);
|
|
550
|
+
}
|
|
551
|
+
case "skewx":
|
|
552
|
+
return t.length < 1 ? null : { a: 1, b: 0, c: Math.tan(t[0] * Math.PI / 180), d: 1, e: 0, f: 0 };
|
|
553
|
+
case "skewy":
|
|
554
|
+
return t.length < 1 ? null : { a: 1, b: Math.tan(t[0] * Math.PI / 180), c: 0, d: 1, e: 0, f: 0 };
|
|
555
|
+
default:
|
|
556
|
+
return null;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
const oe = /([a-zA-Z]+)\s*\(([^)]*)\)/g;
|
|
560
|
+
function ie(e) {
|
|
561
|
+
if (!e) return K;
|
|
562
|
+
let t = K;
|
|
563
|
+
oe.lastIndex = 0;
|
|
564
|
+
let n;
|
|
565
|
+
for (; (n = oe.exec(e)) !== null; ) {
|
|
566
|
+
const s = n[1].toLowerCase(), i = n[2].trim().split(/[\s,]+/).filter(Boolean).map(Number);
|
|
567
|
+
if (i.some((l) => Number.isNaN(l))) continue;
|
|
568
|
+
const r = He(s, i);
|
|
569
|
+
r && (t = $(t, r));
|
|
570
|
+
}
|
|
571
|
+
return t;
|
|
572
|
+
}
|
|
573
|
+
function T(e) {
|
|
574
|
+
if (!Number.isFinite(e)) return "0";
|
|
575
|
+
const t = Math.round(e * 1e4) / 1e4;
|
|
576
|
+
return Object.is(t, -0) ? "0" : String(t);
|
|
577
|
+
}
|
|
578
|
+
function Ke(e, t, n, s) {
|
|
579
|
+
const i = s * Math.PI / 180, r = Math.cos(i), l = Math.sin(i), c = r * t, o = l * t, m = -l * n, p = r * n, a = e.a * c + e.c * o, k = e.b * c + e.d * o, u = e.a * m + e.c * p, d = e.b * m + e.d * p, f = (a + d) / 2, h = (a - d) / 2, g = (k + u) / 2, x = (k - u) / 2, y = Math.hypot(f, x), b = Math.hypot(h, g), I = Math.abs(y + b), v = Math.abs(y - b), M = Math.atan2(g, h), S = (Math.atan2(x, f) + M) / 2 * (180 / Math.PI);
|
|
580
|
+
return { rx: I, ry: v, phiDeg: S };
|
|
581
|
+
}
|
|
582
|
+
function Ve(e, t) {
|
|
583
|
+
if (!e || We(t)) return e;
|
|
584
|
+
const n = fe(e), s = [], i = t.a * t.d - t.b * t.c < 0;
|
|
585
|
+
let r = 0, l = "", c = 0, o = 0, m = 0, p = 0;
|
|
586
|
+
const a = () => {
|
|
587
|
+
const d = Number(n[r++]);
|
|
588
|
+
return Number.isNaN(d) ? 0 : d;
|
|
589
|
+
}, k = (d, ...f) => {
|
|
590
|
+
s.push(d + (f.length ? " " + f.map(T).join(" ") : ""));
|
|
591
|
+
}, u = (d, f) => {
|
|
592
|
+
const h = ze(t, { x: d, y: f });
|
|
593
|
+
return [h.x, h.y];
|
|
594
|
+
};
|
|
595
|
+
for (; r < n.length; ) {
|
|
596
|
+
const d = n[r];
|
|
597
|
+
switch (/[a-zA-Z]/.test(d) && (l = d, r++), l) {
|
|
598
|
+
case "M":
|
|
599
|
+
case "m": {
|
|
600
|
+
const f = l === "m", h = a(), g = a();
|
|
601
|
+
c = f ? c + h : h, o = f ? o + g : g, m = c, p = o, k("M", ...u(c, o)), l = f ? "l" : "L";
|
|
602
|
+
break;
|
|
603
|
+
}
|
|
604
|
+
case "L":
|
|
605
|
+
case "l": {
|
|
606
|
+
const f = l === "l", h = a(), g = a();
|
|
607
|
+
c = f ? c + h : h, o = f ? o + g : g, k("L", ...u(c, o));
|
|
608
|
+
break;
|
|
609
|
+
}
|
|
610
|
+
case "H":
|
|
611
|
+
case "h": {
|
|
612
|
+
const f = l === "h", h = a();
|
|
613
|
+
c = f ? c + h : h, k("L", ...u(c, o));
|
|
614
|
+
break;
|
|
615
|
+
}
|
|
616
|
+
case "V":
|
|
617
|
+
case "v": {
|
|
618
|
+
const f = l === "v", h = a();
|
|
619
|
+
o = f ? o + h : h, k("L", ...u(c, o));
|
|
620
|
+
break;
|
|
621
|
+
}
|
|
622
|
+
case "C":
|
|
623
|
+
case "c": {
|
|
624
|
+
const f = l === "c", h = f ? c + a() : a(), g = f ? o + a() : a(), x = f ? c + a() : a(), y = f ? o + a() : a(), b = f ? c + a() : a(), I = f ? o + a() : a();
|
|
625
|
+
k("C", ...u(h, g), ...u(x, y), ...u(b, I)), c = b, o = I;
|
|
626
|
+
break;
|
|
627
|
+
}
|
|
628
|
+
case "S":
|
|
629
|
+
case "s": {
|
|
630
|
+
const f = l === "s", h = f ? c + a() : a(), g = f ? o + a() : a(), x = f ? c + a() : a(), y = f ? o + a() : a();
|
|
631
|
+
k("S", ...u(h, g), ...u(x, y)), c = x, o = y;
|
|
632
|
+
break;
|
|
633
|
+
}
|
|
634
|
+
case "Q":
|
|
635
|
+
case "q": {
|
|
636
|
+
const f = l === "q", h = f ? c + a() : a(), g = f ? o + a() : a(), x = f ? c + a() : a(), y = f ? o + a() : a();
|
|
637
|
+
k("Q", ...u(h, g), ...u(x, y)), c = x, o = y;
|
|
638
|
+
break;
|
|
639
|
+
}
|
|
640
|
+
case "T":
|
|
641
|
+
case "t": {
|
|
642
|
+
const f = l === "t", h = f ? c + a() : a(), g = f ? o + a() : a();
|
|
643
|
+
k("T", ...u(h, g)), c = h, o = g;
|
|
644
|
+
break;
|
|
645
|
+
}
|
|
646
|
+
case "A":
|
|
647
|
+
case "a": {
|
|
648
|
+
const f = l === "a", h = a(), g = a(), x = a(), y = a(), b = a(), I = f ? c + a() : a(), v = f ? o + a() : a(), M = Ke(t, h, g, x), [R, S] = u(I, v);
|
|
649
|
+
s.push(
|
|
650
|
+
`A ${T(M.rx)} ${T(M.ry)} ${T(M.phiDeg)} ${y ? 1 : 0} ${(b ? 1 : 0) ^ (i ? 1 : 0)} ${T(R)} ${T(S)}`
|
|
651
|
+
), c = I, o = v;
|
|
652
|
+
break;
|
|
653
|
+
}
|
|
654
|
+
case "Z":
|
|
655
|
+
case "z": {
|
|
656
|
+
s.push("Z"), c = m, o = p;
|
|
657
|
+
break;
|
|
658
|
+
}
|
|
659
|
+
default:
|
|
660
|
+
r++;
|
|
661
|
+
break;
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
return s.join(" ");
|
|
665
|
+
}
|
|
666
|
+
const Ue = [
|
|
667
|
+
{ prefix: "walkable", kind: "walkable" },
|
|
668
|
+
{ prefix: "void", kind: "void" },
|
|
669
|
+
{ prefix: "unit", kind: "unit" },
|
|
670
|
+
{ prefix: "store", kind: "unit" },
|
|
671
|
+
// v1 compatibility
|
|
672
|
+
{ prefix: "wall", kind: "wall" },
|
|
673
|
+
{ prefix: "boundary", kind: "boundary" },
|
|
674
|
+
{ prefix: "outer-wall", kind: "wall" },
|
|
675
|
+
{ prefix: "amenity-", kind: "amenity" },
|
|
676
|
+
{ prefix: "kiosk-", kind: "kiosk_screen" },
|
|
677
|
+
{ prefix: "escalator-", kind: "connector" },
|
|
678
|
+
{ prefix: "elevator-", kind: "connector" },
|
|
679
|
+
{ prefix: "stairs-", kind: "connector" },
|
|
680
|
+
{ prefix: "entrance-", kind: "entrance" },
|
|
681
|
+
{ prefix: "zone-", kind: "zone" },
|
|
682
|
+
{ prefix: "label-", kind: "label" },
|
|
683
|
+
{ prefix: "floorplate", kind: "floorplate" },
|
|
684
|
+
{ prefix: "base", kind: "floorplate" },
|
|
685
|
+
{ prefix: "decor", kind: "decor" },
|
|
686
|
+
{ prefix: "special-shape", kind: "decor" },
|
|
687
|
+
{ prefix: "overlay", kind: "decor" },
|
|
688
|
+
{ prefix: "green-area", kind: "green_area" },
|
|
689
|
+
{ prefix: "parking-lane", kind: "parking_zone" },
|
|
690
|
+
{ prefix: "parking-line", kind: "decor" },
|
|
691
|
+
{ prefix: "parking-icon", kind: "parking_icon" },
|
|
692
|
+
{ prefix: "walking-path", kind: "walkable" },
|
|
693
|
+
{ prefix: "water", kind: "water" }
|
|
694
|
+
], je = [
|
|
695
|
+
{ prefix: "parking-zone", kind: "parking_zone" },
|
|
696
|
+
{ prefix: "parking-lane", kind: "parking_zone" },
|
|
697
|
+
{ prefix: "parking-line", kind: "decor" },
|
|
698
|
+
{ prefix: "parking-icon", kind: "parking_icon" },
|
|
699
|
+
{ prefix: "green-area", kind: "green_area" },
|
|
700
|
+
{ prefix: "water", kind: "water" },
|
|
701
|
+
{ prefix: "walking-path", kind: "walkable" },
|
|
702
|
+
{ prefix: "decor", kind: "decor" },
|
|
703
|
+
{ prefix: "entrance-", kind: "entrance" },
|
|
704
|
+
{ prefix: "unit", kind: "unit" },
|
|
705
|
+
{ prefix: "store", kind: "unit" },
|
|
706
|
+
{ prefix: "interactive-", kind: "unit" },
|
|
707
|
+
{ prefix: "walkable", kind: "walkable" },
|
|
708
|
+
{ prefix: "void", kind: "void" },
|
|
709
|
+
{ prefix: "amenity-", kind: "amenity" },
|
|
710
|
+
{ prefix: "kiosk-", kind: "kiosk_screen" },
|
|
711
|
+
// Connectors also appear in outdoor artboards (car-park decks, ramps).
|
|
712
|
+
{ prefix: "escalator-", kind: "connector" },
|
|
713
|
+
{ prefix: "elevator-", kind: "connector" },
|
|
714
|
+
{ prefix: "stairs-", kind: "connector" }
|
|
715
|
+
], Ze = "route-path", qe = [
|
|
716
|
+
...ve,
|
|
717
|
+
"walkable",
|
|
718
|
+
"void"
|
|
719
|
+
], Qe = 8;
|
|
720
|
+
function Je(e, t = "floor") {
|
|
721
|
+
if (ye(e))
|
|
722
|
+
return { kind: null, guessed: !1 };
|
|
723
|
+
const n = e.toLowerCase(), s = t === "base" ? je : Ue;
|
|
724
|
+
for (const { prefix: i, kind: r } of s)
|
|
725
|
+
if (n === i || n.startsWith(i))
|
|
726
|
+
return { kind: r, guessed: !1 };
|
|
727
|
+
return n.startsWith("interactive") ? { kind: "unit", guessed: !0 } : { kind: null, guessed: !1 };
|
|
728
|
+
}
|
|
729
|
+
function xe(e) {
|
|
730
|
+
return e.toLowerCase().replace(/[-_]+/g, " ").replace(/\s+/g, " ").trim();
|
|
731
|
+
}
|
|
732
|
+
function U(e) {
|
|
733
|
+
return /non[-_ ]?interactive/i.test(e);
|
|
734
|
+
}
|
|
735
|
+
function me(e) {
|
|
736
|
+
return U(e) ? !1 : /^interactive( items)?( \d+)?$/.test(xe(e));
|
|
737
|
+
}
|
|
738
|
+
function pe(e) {
|
|
739
|
+
const t = xe(e);
|
|
740
|
+
return t === "stores" || t === "store layer" || t === "units" || t === "unit layer";
|
|
741
|
+
}
|
|
742
|
+
function ye(e) {
|
|
743
|
+
return me(e) || U(e) || pe(e);
|
|
744
|
+
}
|
|
745
|
+
function G(e) {
|
|
746
|
+
return e.interactiveContainer || e.nonInteractiveContainer || e.storeFolder;
|
|
747
|
+
}
|
|
748
|
+
function N(e, t) {
|
|
749
|
+
const n = e.match(new RegExp(`\\b${t}\\s*=\\s*["']([^"']*)["']`, "i"));
|
|
750
|
+
return n ? n[1] : null;
|
|
751
|
+
}
|
|
752
|
+
function O(e, t) {
|
|
753
|
+
const n = e.match(new RegExp(`\\b${t}\\s*=\\s*["']?(-?[\\d.]+)`, "i"));
|
|
754
|
+
return n ? Number(n[1]) : 0;
|
|
755
|
+
}
|
|
756
|
+
function re(e) {
|
|
757
|
+
return /\bdata-interactive\s*=\s*["']?(true|1|yes)/i.test(e);
|
|
758
|
+
}
|
|
759
|
+
function et(e) {
|
|
760
|
+
return [N(e, "id"), N(e, "data-name")].filter(
|
|
761
|
+
(t) => !!t
|
|
762
|
+
);
|
|
763
|
+
}
|
|
764
|
+
function tt(e) {
|
|
765
|
+
return e.some(U) ? { interactiveContainer: !1, nonInteractiveContainer: !0, storeFolder: !1 } : e.some(me) ? { interactiveContainer: !0, nonInteractiveContainer: !1, storeFolder: !1 } : e.some(pe) ? { interactiveContainer: !1, nonInteractiveContainer: !1, storeFolder: !0 } : { interactiveContainer: !1, nonInteractiveContainer: !1, storeFolder: !1 };
|
|
766
|
+
}
|
|
767
|
+
function nt(e) {
|
|
768
|
+
const t = e.trim().split(/[\s,]+/).map(Number);
|
|
769
|
+
if (t.length < 4) return "";
|
|
770
|
+
let n = `M ${t[0]} ${t[1]}`;
|
|
771
|
+
for (let s = 2; s < t.length; s += 2)
|
|
772
|
+
n += ` L ${t[s]} ${t[s + 1]}`;
|
|
773
|
+
return n += " Z", n;
|
|
774
|
+
}
|
|
775
|
+
function st(e, t, n, s) {
|
|
776
|
+
return `M ${e} ${t} L ${n} ${s}`;
|
|
777
|
+
}
|
|
778
|
+
function ot(e, t) {
|
|
779
|
+
if (e === "path")
|
|
780
|
+
return N(t, "d") ?? void 0;
|
|
781
|
+
if (e === "polygon" || e === "polyline") {
|
|
782
|
+
const n = N(t, "points");
|
|
783
|
+
return n ? nt(n) : void 0;
|
|
784
|
+
}
|
|
785
|
+
if (e === "line")
|
|
786
|
+
return st(
|
|
787
|
+
O(t, "x1"),
|
|
788
|
+
O(t, "y1"),
|
|
789
|
+
O(t, "x2"),
|
|
790
|
+
O(t, "y2")
|
|
791
|
+
);
|
|
792
|
+
if (e === "rect") {
|
|
793
|
+
const n = O(t, "x"), s = O(t, "y"), i = O(t, "width"), r = O(t, "height");
|
|
794
|
+
return `M ${n} ${s} L ${n + i} ${s} L ${n + i} ${s + r} L ${n} ${s + r} Z`;
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
function it(e) {
|
|
798
|
+
const t = Be(e).replace(/<!--[\s\S]*?-->/g, ""), n = t.match(/viewBox\s*=\s*["']([^"']+)["']/i), s = De(n == null ? void 0 : n[1]), i = [], r = [], l = [], c = [];
|
|
799
|
+
let o = 0;
|
|
800
|
+
const m = () => {
|
|
801
|
+
for (let y = c.length - 1; y >= 0; y--) {
|
|
802
|
+
const b = c[y].style;
|
|
803
|
+
if (b.fill || b.stroke || b.strokeWidth != null || b.opacity != null)
|
|
804
|
+
break;
|
|
805
|
+
}
|
|
806
|
+
let x = {};
|
|
807
|
+
for (const y of c)
|
|
808
|
+
x = z(x, y.style);
|
|
809
|
+
return x;
|
|
810
|
+
}, p = () => {
|
|
811
|
+
for (let x = c.length - 1; x >= 0; x--) {
|
|
812
|
+
if (c[x].nonInteractiveContainer) return !1;
|
|
813
|
+
if (c[x].interactiveContainer || c[x].storeFolder) return !0;
|
|
814
|
+
}
|
|
815
|
+
return !1;
|
|
816
|
+
}, a = () => c.length > 0 ? c[c.length - 1].matrix : K, k = () => {
|
|
817
|
+
for (let x = c.length - 1; x >= 0; x--) {
|
|
818
|
+
const y = c[x];
|
|
819
|
+
if (!G(y) && y.id) {
|
|
820
|
+
y.hasNamedChild = !0;
|
|
821
|
+
return;
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
}, u = () => {
|
|
825
|
+
for (let x = c.length - 1; x >= 0; x--) {
|
|
826
|
+
const y = c[x];
|
|
827
|
+
if (!G(y) && y.id)
|
|
828
|
+
return y;
|
|
829
|
+
}
|
|
830
|
+
return null;
|
|
831
|
+
}, d = (x) => {
|
|
832
|
+
G(x) || !x.id || x.collectedPaths.length === 0 || (x.hasNamedChild && l.push(
|
|
833
|
+
`Group ${x.id} mixes named children with ${x.collectedPaths.length} unnamed path(s); the unnamed paths were merged into a single shape "${x.id}" — give them ids if they are separate shapes`
|
|
834
|
+
), i.push({
|
|
835
|
+
id: x.id,
|
|
836
|
+
tag: "g",
|
|
837
|
+
d: x.collectedPaths.join(" "),
|
|
838
|
+
interactive: x.inInteractive,
|
|
839
|
+
style: z(m(), x.style)
|
|
840
|
+
}));
|
|
841
|
+
}, f = (x, y) => {
|
|
842
|
+
if (y) {
|
|
843
|
+
if (x === "polyline" || x === "polygon") {
|
|
844
|
+
r.push(y.replace(/\s*Z\s*$/i, ""));
|
|
845
|
+
return;
|
|
846
|
+
}
|
|
847
|
+
r.push(y);
|
|
848
|
+
}
|
|
849
|
+
}, h = /<(\/?)(path|polygon|polyline|line|rect|g)\b([^>]*)(\/?)>/gi;
|
|
850
|
+
let g;
|
|
851
|
+
for (; (g = h.exec(t)) !== null; ) {
|
|
852
|
+
const x = g[1] === "/", y = g[2].toLowerCase(), b = g[3] ?? "", I = g[4] === "/" || /\/\s*$/.test(b);
|
|
853
|
+
if (x) {
|
|
854
|
+
if (y === "g") {
|
|
855
|
+
const A = c.pop();
|
|
856
|
+
A && d(A);
|
|
857
|
+
}
|
|
858
|
+
continue;
|
|
859
|
+
}
|
|
860
|
+
if (y === "g") {
|
|
861
|
+
const A = N(b, "id"), B = et(b), { interactiveContainer: w, nonInteractiveContainer: X, storeFolder: D } = tt(B), P = p();
|
|
862
|
+
A && k();
|
|
863
|
+
const L = {
|
|
864
|
+
id: A,
|
|
865
|
+
interactiveContainer: w,
|
|
866
|
+
nonInteractiveContainer: X,
|
|
867
|
+
storeFolder: D,
|
|
868
|
+
inInteractive: w || D || re(b) || P && !X,
|
|
869
|
+
collectedPaths: [],
|
|
870
|
+
style: se(b),
|
|
871
|
+
matrix: $(a(), ie(N(b, "transform"))),
|
|
872
|
+
hasNamedChild: !1
|
|
873
|
+
};
|
|
874
|
+
I || c.push(L);
|
|
875
|
+
continue;
|
|
876
|
+
}
|
|
877
|
+
const v = N(b, "id"), M = ot(y, b), R = $(a(), ie(N(b, "transform"))), S = M && Ve(M, R), E = re(b) || p(), C = z(m(), se(b));
|
|
878
|
+
if (v && v.toLowerCase().startsWith(Ze)) {
|
|
879
|
+
f(y, S);
|
|
880
|
+
continue;
|
|
881
|
+
}
|
|
882
|
+
if (v) {
|
|
883
|
+
k(), S && i.push({ id: v, tag: y, d: S, interactive: E, style: C });
|
|
884
|
+
continue;
|
|
885
|
+
}
|
|
886
|
+
if (!S) continue;
|
|
887
|
+
const _ = u();
|
|
888
|
+
_ ? (_.collectedPaths.push(S), !_.style.fill && C.fill && (_.style = C)) : E && (o += 1, i.push({
|
|
889
|
+
id: `interactive-anon-${o}`,
|
|
890
|
+
tag: y,
|
|
891
|
+
d: S,
|
|
892
|
+
interactive: !0,
|
|
893
|
+
style: C
|
|
894
|
+
}));
|
|
895
|
+
}
|
|
896
|
+
for (; c.length > 0; )
|
|
897
|
+
d(c.pop());
|
|
898
|
+
return { viewbox: s, elements: i, routePathDs: r, warnings: l };
|
|
899
|
+
}
|
|
900
|
+
function rt(e) {
|
|
901
|
+
return e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 80);
|
|
902
|
+
}
|
|
903
|
+
function ct(e, t) {
|
|
904
|
+
var i, r, l, c;
|
|
905
|
+
const n = ue(t), s = {};
|
|
906
|
+
return n != null && n.fill ? s.fill = n.fill : (i = e.style) != null && i.fill && (s.fill = e.style.fill), n != null && n.stroke ? s.stroke = n.stroke : (r = e.style) != null && r.stroke && (s.stroke = e.style.stroke), (n == null ? void 0 : n.strokeWidth) != null ? s.strokeWidth = n.strokeWidth : ((l = e.style) == null ? void 0 : l.strokeWidth) != null && (s.strokeWidth = e.style.strokeWidth), ((c = e.style) == null ? void 0 : c.opacity) != null && (s.opacity = e.style.opacity), (n == null ? void 0 : n.extrudeHeight) != null && (s.extrudeHeight = n.extrudeHeight), s;
|
|
907
|
+
}
|
|
908
|
+
function at(e, t) {
|
|
909
|
+
return e == null && t == null ? !0 : e == null || t == null ? !1 : Math.abs(e.x - t.x) < 0.01 && Math.abs(e.y - t.y) < 0.01 && Math.abs(e.width - t.width) < 0.01 && Math.abs(e.height - t.height) < 0.01;
|
|
910
|
+
}
|
|
911
|
+
function wt(e, t = "floor", n = {}) {
|
|
912
|
+
const s = it(e), i = [], r = [], l = [], c = [...s.warnings], o = [];
|
|
913
|
+
let m = 0, p = 0, a = 0;
|
|
914
|
+
const k = n.previousViewbox != null && s.viewbox != null && !at(n.previousViewbox, s.viewbox);
|
|
915
|
+
k && c.push(
|
|
916
|
+
"SVG viewBox differs from the stored artboard — re-upload blocked until the designer restores the original viewBox"
|
|
917
|
+
);
|
|
918
|
+
for (const u of s.elements) {
|
|
919
|
+
if (ye(u.id)) continue;
|
|
920
|
+
let { kind: d, guessed: f } = Je(u.id, t);
|
|
921
|
+
u.interactive && !d && (d = "unit", f = !0);
|
|
922
|
+
const h = {
|
|
923
|
+
sourceSvgId: u.id,
|
|
924
|
+
kind: d,
|
|
925
|
+
guessed: f
|
|
926
|
+
};
|
|
927
|
+
if (!d)
|
|
928
|
+
if (r.push(u.id), t === "floor")
|
|
929
|
+
d = "decor", h.kind = "decor", h.message = "No matching prefix; imported as decor (floor mode)";
|
|
930
|
+
else {
|
|
931
|
+
h.message = "No matching prefix; skipped (outdoor decor stays in SVG)", i.push(h);
|
|
932
|
+
continue;
|
|
933
|
+
}
|
|
934
|
+
if (!u.d) {
|
|
935
|
+
c.push(`Element ${u.id} has no drawable geometry`);
|
|
936
|
+
continue;
|
|
937
|
+
}
|
|
938
|
+
if (t === "base") {
|
|
939
|
+
const y = ue(u.id) != null;
|
|
940
|
+
if (!(!y && (qe.includes(d) || !!u.interactive))) {
|
|
941
|
+
i.push({
|
|
942
|
+
...h,
|
|
943
|
+
message: y ? "Static decoration — rendered from outdoor SVG" : "Decoration — not persisted; rendered from outdoor SVG"
|
|
944
|
+
});
|
|
945
|
+
continue;
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
f && (l.push(h), h.message = h.message ?? "Guessed kind from interactive/fallback rule"), i.push(h), d === "walkable" && m++, d === "void" && p++, d === "unit" && a++;
|
|
949
|
+
const g = Pe([u.d]), x = V(g);
|
|
950
|
+
o.push({
|
|
951
|
+
key: rt(u.id),
|
|
952
|
+
kind: d,
|
|
953
|
+
geometry: g,
|
|
954
|
+
bbox: x,
|
|
955
|
+
sourceSvgId: u.id,
|
|
956
|
+
style: ct(u, u.id)
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
return t === "floor" && m === 0 && c.push(
|
|
960
|
+
"No walkable layer found — auto-skeleton will be unavailable for this level"
|
|
961
|
+
), {
|
|
962
|
+
report: {
|
|
963
|
+
classified: i,
|
|
964
|
+
unrecognized: r,
|
|
965
|
+
guessed: l,
|
|
966
|
+
walkableCount: m,
|
|
967
|
+
voidCount: p,
|
|
968
|
+
unitCount: a,
|
|
969
|
+
warnings: c
|
|
970
|
+
},
|
|
971
|
+
shapes: o,
|
|
972
|
+
viewbox: s.viewbox,
|
|
973
|
+
routePathDs: s.routePathDs,
|
|
974
|
+
viewBoxChanged: k
|
|
975
|
+
};
|
|
976
|
+
}
|
|
977
|
+
function Ct(e, t, n, s = {}) {
|
|
978
|
+
const i = s.driftThreshold ?? Qe, r = new Map(
|
|
979
|
+
t.filter((o) => o.sourceSvgId).map((o) => [o.sourceSvgId, o])
|
|
980
|
+
), l = /* @__PURE__ */ new Set(), c = [];
|
|
981
|
+
for (const o of e) {
|
|
982
|
+
const m = r.get(o.sourceSvgId);
|
|
983
|
+
if (l.add(o.sourceSvgId), !m)
|
|
984
|
+
c.push({
|
|
985
|
+
sourceSvgId: o.sourceSvgId,
|
|
986
|
+
change: "added",
|
|
987
|
+
newKind: o.kind
|
|
988
|
+
});
|
|
989
|
+
else if (m.kind !== o.kind)
|
|
990
|
+
c.push({
|
|
991
|
+
sourceSvgId: o.sourceSvgId,
|
|
992
|
+
change: "kind_changed",
|
|
993
|
+
existingShapeId: m.id,
|
|
994
|
+
existingKind: m.kind,
|
|
995
|
+
newKind: o.kind,
|
|
996
|
+
preserve: { key: m.key, assignment: !0, anchors: !0 },
|
|
997
|
+
geometryLocked: m.geometryLocked
|
|
998
|
+
});
|
|
999
|
+
else {
|
|
1000
|
+
let p = "unchanged";
|
|
1001
|
+
if (m.bbox) {
|
|
1002
|
+
const a = (m.bbox.minX + m.bbox.maxX) / 2, k = (m.bbox.minY + m.bbox.maxY) / 2, u = Te(o.geometry);
|
|
1003
|
+
Math.hypot(u.x - a, u.y - k) > i && (p = "moved");
|
|
1004
|
+
}
|
|
1005
|
+
c.push({
|
|
1006
|
+
sourceSvgId: o.sourceSvgId,
|
|
1007
|
+
change: p,
|
|
1008
|
+
existingShapeId: m.id,
|
|
1009
|
+
existingKind: m.kind,
|
|
1010
|
+
newKind: o.kind,
|
|
1011
|
+
preserve: { key: m.key, assignment: !0, anchors: !0 },
|
|
1012
|
+
geometryLocked: m.geometryLocked
|
|
1013
|
+
});
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
for (const o of t)
|
|
1017
|
+
o.sourceSvgId && !l.has(o.sourceSvgId) && c.push({
|
|
1018
|
+
sourceSvgId: o.sourceSvgId,
|
|
1019
|
+
change: "removed",
|
|
1020
|
+
existingShapeId: o.id,
|
|
1021
|
+
existingKind: o.kind,
|
|
1022
|
+
geometryLocked: o.geometryLocked
|
|
1023
|
+
});
|
|
1024
|
+
return {
|
|
1025
|
+
items: c,
|
|
1026
|
+
shapes: e,
|
|
1027
|
+
viewbox: n
|
|
1028
|
+
};
|
|
1029
|
+
}
|
|
1030
|
+
function lt(e, t, n = []) {
|
|
1031
|
+
const s = ge(), i = new Map(e.map((o) => [o.id, o])), r = new Map(n.map((o) => [o.id, o])), l = e.map((o) => ({
|
|
1032
|
+
id: o.id,
|
|
1033
|
+
levelId: o.levelId,
|
|
1034
|
+
x: o.x,
|
|
1035
|
+
y: o.y,
|
|
1036
|
+
kind: o.kind,
|
|
1037
|
+
shapeId: o.shapeId,
|
|
1038
|
+
connectorId: o.connectorId
|
|
1039
|
+
}));
|
|
1040
|
+
for (const o of l)
|
|
1041
|
+
s.addNode(o.id, o);
|
|
1042
|
+
const c = [];
|
|
1043
|
+
for (const o of t) {
|
|
1044
|
+
const m = i.get(o.fromAnchorId), p = i.get(o.toAnchorId);
|
|
1045
|
+
if (!m || !p) continue;
|
|
1046
|
+
let a = o.weight;
|
|
1047
|
+
a == null && (a = Y(m, p), m.levelId !== p.levelId && (a += H));
|
|
1048
|
+
let k = o.accessible;
|
|
1049
|
+
if (o.kind === "connector" && m.connectorId != null) {
|
|
1050
|
+
const d = r.get(m.connectorId);
|
|
1051
|
+
d && (k = d.accessible);
|
|
1052
|
+
}
|
|
1053
|
+
const u = {
|
|
1054
|
+
id: o.id,
|
|
1055
|
+
from: o.fromAnchorId,
|
|
1056
|
+
to: o.toAnchorId,
|
|
1057
|
+
weight: a,
|
|
1058
|
+
directed: o.directed,
|
|
1059
|
+
accessible: k,
|
|
1060
|
+
kind: o.kind
|
|
1061
|
+
};
|
|
1062
|
+
c.push(u), s.addLink(o.fromAnchorId, o.toAnchorId, u), o.directed || s.addLink(o.toAnchorId, o.fromAnchorId, u);
|
|
1063
|
+
}
|
|
1064
|
+
return { graph: s, nodes: l, edges: c, anchorById: i };
|
|
1065
|
+
}
|
|
1066
|
+
function ut(e, t, n, s = {}) {
|
|
1067
|
+
const { graph: i, anchorById: r } = e;
|
|
1068
|
+
if (!r.has(t) || !r.has(n))
|
|
1069
|
+
return null;
|
|
1070
|
+
const c = ke.nba(i, {
|
|
1071
|
+
distance(u, d, f) {
|
|
1072
|
+
const h = f.data;
|
|
1073
|
+
return s.accessibleOnly && h && !h.accessible ? Number.POSITIVE_INFINITY : (h == null ? void 0 : h.weight) ?? 1;
|
|
1074
|
+
},
|
|
1075
|
+
heuristic(u, d) {
|
|
1076
|
+
const f = r.get(u.id), h = r.get(d.id);
|
|
1077
|
+
if (!f || !h) return 0;
|
|
1078
|
+
let g = Y(f, h);
|
|
1079
|
+
return f.levelId !== h.levelId && (g += H), g;
|
|
1080
|
+
}
|
|
1081
|
+
}).find(t, n);
|
|
1082
|
+
if (!c || c.length === 0) return null;
|
|
1083
|
+
const m = c.reverse().map((u) => u.id), p = [], a = [];
|
|
1084
|
+
let k = 0;
|
|
1085
|
+
for (let u = 0; u < m.length; u++) {
|
|
1086
|
+
const d = r.get(m[u]);
|
|
1087
|
+
if (p.push({ x: d.x, y: d.y, levelId: d.levelId }), u > 0) {
|
|
1088
|
+
const f = r.get(m[u - 1]);
|
|
1089
|
+
k += Y(f, d), f.levelId !== d.levelId && (k += H, a.push({
|
|
1090
|
+
fromLevelId: f.levelId,
|
|
1091
|
+
toLevelId: d.levelId,
|
|
1092
|
+
connectorId: d.connectorId ?? f.connectorId
|
|
1093
|
+
}));
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
return { anchorIds: m, points: p, totalWeight: k, levelChanges: a };
|
|
1097
|
+
}
|
|
1098
|
+
function At(e, t, n, s = {}) {
|
|
1099
|
+
let i = null;
|
|
1100
|
+
for (const r of n) {
|
|
1101
|
+
const l = ut(e, t, r, s);
|
|
1102
|
+
l && (!i || l.totalWeight < i.totalWeight) && (i = l);
|
|
1103
|
+
}
|
|
1104
|
+
return i;
|
|
1105
|
+
}
|
|
1106
|
+
function Lt(e) {
|
|
1107
|
+
const t = Ie(e.theme), n = new Map(
|
|
1108
|
+
e.assignments.map((c) => [c.shapeId, c])
|
|
1109
|
+
), s = e.resolveSvgUrl ?? ((c) => c), i = e.levels.filter((c) => c.isActive).sort((c, o) => c.ordering - o.ordering).map((c) => {
|
|
1110
|
+
const o = e.shapes.filter((p) => p.levelId === c.id).map((p) => {
|
|
1111
|
+
const a = he(p.geometry);
|
|
1112
|
+
return {
|
|
1113
|
+
...p,
|
|
1114
|
+
geometry: a,
|
|
1115
|
+
bbox: a === p.geometry ? p.bbox : V(a),
|
|
1116
|
+
assignment: n.get(p.id) ?? null
|
|
1117
|
+
};
|
|
1118
|
+
}), m = e.anchors.filter((p) => p.levelId === c.id);
|
|
1119
|
+
return {
|
|
1120
|
+
id: c.id,
|
|
1121
|
+
buildingId: c.buildingId,
|
|
1122
|
+
kind: c.kind,
|
|
1123
|
+
name: c.name,
|
|
1124
|
+
levelIndex: c.levelIndex,
|
|
1125
|
+
ordering: c.ordering,
|
|
1126
|
+
sourceSvgUrl: s(c.sourceSvgKey) ?? c.sourceSvgUrl ?? null,
|
|
1127
|
+
viewbox: c.sourceViewbox,
|
|
1128
|
+
transform: c.transform,
|
|
1129
|
+
shapes: o,
|
|
1130
|
+
anchors: m
|
|
1131
|
+
};
|
|
1132
|
+
}), { nodes: r, edges: l } = lt(
|
|
1133
|
+
e.anchors,
|
|
1134
|
+
e.edges,
|
|
1135
|
+
e.connectors
|
|
1136
|
+
);
|
|
1137
|
+
return {
|
|
1138
|
+
version: 2,
|
|
1139
|
+
revisionId: e.revisionId,
|
|
1140
|
+
revisionNumber: e.revisionNumber,
|
|
1141
|
+
centerId: e.centerId,
|
|
1142
|
+
mapId: e.mapId,
|
|
1143
|
+
theme: t,
|
|
1144
|
+
baseSvgUrl: e.baseSvgUrl,
|
|
1145
|
+
baseViewbox: e.baseViewbox,
|
|
1146
|
+
buildings: e.buildings,
|
|
1147
|
+
levels: i,
|
|
1148
|
+
connectors: e.connectors,
|
|
1149
|
+
amenities: e.amenities.filter((c) => c.isActive),
|
|
1150
|
+
graph: { nodes: r, edges: l },
|
|
1151
|
+
responsiveOverrides: e.responsiveOverrides,
|
|
1152
|
+
publishedAt: e.publishedAt ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
1153
|
+
};
|
|
1154
|
+
}
|
|
1155
|
+
function Ot(e) {
|
|
1156
|
+
let t = !1;
|
|
1157
|
+
const n = e.levels.map((s) => {
|
|
1158
|
+
let i = !1;
|
|
1159
|
+
const r = s.shapes.map((l) => {
|
|
1160
|
+
const c = he(l.geometry);
|
|
1161
|
+
return c === l.geometry ? l : (i = !0, {
|
|
1162
|
+
...l,
|
|
1163
|
+
geometry: c,
|
|
1164
|
+
bbox: V(c)
|
|
1165
|
+
});
|
|
1166
|
+
});
|
|
1167
|
+
return i ? (t = !0, { ...s, shapes: r }) : s;
|
|
1168
|
+
});
|
|
1169
|
+
return t ? { ...e, levels: n } : e;
|
|
1170
|
+
}
|
|
1171
|
+
function ft(e, t) {
|
|
1172
|
+
return e.ordering - t.ordering || e.levelIndex - t.levelIndex;
|
|
1173
|
+
}
|
|
1174
|
+
function ce(e) {
|
|
1175
|
+
return e.kind === "outdoor";
|
|
1176
|
+
}
|
|
1177
|
+
function dt(e, t) {
|
|
1178
|
+
const n = e.filter(ce), s = t == null ? null : e.find((i) => i.id === t) ?? null;
|
|
1179
|
+
return !s || ce(s) || n.some((i) => i.id === s.id) ? n : [...n, s];
|
|
1180
|
+
}
|
|
1181
|
+
function j(e) {
|
|
1182
|
+
return e.filter((t) => t.kind === "floor").slice().sort(ft);
|
|
1183
|
+
}
|
|
1184
|
+
function Nt(e) {
|
|
1185
|
+
return j(e);
|
|
1186
|
+
}
|
|
1187
|
+
function _t(e) {
|
|
1188
|
+
return j(e).length > 1;
|
|
1189
|
+
}
|
|
1190
|
+
function Rt(e) {
|
|
1191
|
+
var t, n;
|
|
1192
|
+
return ((t = j(e).at(-1)) == null ? void 0 : t.id) ?? ((n = e[0]) == null ? void 0 : n.id) ?? null;
|
|
1193
|
+
}
|
|
1194
|
+
function ae(e) {
|
|
1195
|
+
return {
|
|
1196
|
+
minX: e.x,
|
|
1197
|
+
minY: e.y,
|
|
1198
|
+
maxX: e.x + e.width,
|
|
1199
|
+
maxY: e.y + e.height,
|
|
1200
|
+
cx: e.x + e.width / 2,
|
|
1201
|
+
cy: e.y + e.height / 2,
|
|
1202
|
+
size: Math.max(e.width, e.height, 100)
|
|
1203
|
+
};
|
|
1204
|
+
}
|
|
1205
|
+
function le(e, t) {
|
|
1206
|
+
const n = Math.min(e.minX, t.minX), s = Math.min(e.minY, t.minY), i = Math.max(e.maxX, t.maxX), r = Math.max(e.maxY, t.maxY);
|
|
1207
|
+
return {
|
|
1208
|
+
minX: n,
|
|
1209
|
+
minY: s,
|
|
1210
|
+
maxX: i,
|
|
1211
|
+
maxY: r,
|
|
1212
|
+
cx: (n + i) / 2,
|
|
1213
|
+
cy: (s + r) / 2,
|
|
1214
|
+
size: Math.max(i - n, r - s, 100)
|
|
1215
|
+
};
|
|
1216
|
+
}
|
|
1217
|
+
function Et(e, t, n) {
|
|
1218
|
+
let s = n ? ae(n) : null;
|
|
1219
|
+
for (const i of dt(e, t)) {
|
|
1220
|
+
if (i.viewbox) {
|
|
1221
|
+
const r = ae(i.viewbox);
|
|
1222
|
+
s = s ? le(s, r) : r;
|
|
1223
|
+
}
|
|
1224
|
+
for (const r of i.shapes) {
|
|
1225
|
+
const l = {
|
|
1226
|
+
minX: r.bbox.minX,
|
|
1227
|
+
minY: r.bbox.minY,
|
|
1228
|
+
maxX: r.bbox.maxX,
|
|
1229
|
+
maxY: r.bbox.maxY,
|
|
1230
|
+
cx: (r.bbox.minX + r.bbox.maxX) / 2,
|
|
1231
|
+
cy: (r.bbox.minY + r.bbox.maxY) / 2,
|
|
1232
|
+
size: Math.max(
|
|
1233
|
+
r.bbox.maxX - r.bbox.minX,
|
|
1234
|
+
r.bbox.maxY - r.bbox.minY,
|
|
1235
|
+
100
|
|
1236
|
+
)
|
|
1237
|
+
};
|
|
1238
|
+
s = s ? le(s, l) : l;
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
return s ?? { minX: 0, minY: 0, maxX: 500, maxY: 500, cx: 250, cy: 250, size: 500 };
|
|
1242
|
+
}
|
|
1243
|
+
function Pt(e, t) {
|
|
1244
|
+
if (!e && !t) return { x: 0, y: 0, width: 1e3, height: 800 };
|
|
1245
|
+
if (!e) return t;
|
|
1246
|
+
if (!t) return e;
|
|
1247
|
+
const n = Math.min(e.x, t.x), s = Math.min(e.y, t.y), i = Math.max(e.x + e.width, t.x + t.width), r = Math.max(e.y + e.height, t.y + t.height);
|
|
1248
|
+
return { x: n, y: s, width: i - n, height: r - s };
|
|
1249
|
+
}
|
|
1250
|
+
export {
|
|
1251
|
+
ee as $,
|
|
1252
|
+
Ct as A,
|
|
1253
|
+
le as B,
|
|
1254
|
+
At as C,
|
|
1255
|
+
mt as D,
|
|
1256
|
+
ut as E,
|
|
1257
|
+
H as F,
|
|
1258
|
+
kt as G,
|
|
1259
|
+
Nt as H,
|
|
1260
|
+
K as I,
|
|
1261
|
+
j as J,
|
|
1262
|
+
V as K,
|
|
1263
|
+
Te as L,
|
|
1264
|
+
wt as M,
|
|
1265
|
+
Be as N,
|
|
1266
|
+
Ee as O,
|
|
1267
|
+
We as P,
|
|
1268
|
+
me as Q,
|
|
1269
|
+
ye as R,
|
|
1270
|
+
F as S,
|
|
1271
|
+
U as T,
|
|
1272
|
+
ce as U,
|
|
1273
|
+
pe as V,
|
|
1274
|
+
z as W,
|
|
1275
|
+
Ie as X,
|
|
1276
|
+
$ as Y,
|
|
1277
|
+
he as Z,
|
|
1278
|
+
xe as _,
|
|
1279
|
+
de as a,
|
|
1280
|
+
Ot as a0,
|
|
1281
|
+
it as a1,
|
|
1282
|
+
ie as a2,
|
|
1283
|
+
De as a3,
|
|
1284
|
+
Ae as a4,
|
|
1285
|
+
Le as a5,
|
|
1286
|
+
se as a6,
|
|
1287
|
+
ue as a7,
|
|
1288
|
+
_t as a8,
|
|
1289
|
+
Mt as a9,
|
|
1290
|
+
fe as aa,
|
|
1291
|
+
Ve as ab,
|
|
1292
|
+
Pt as ac,
|
|
1293
|
+
ae as ad,
|
|
1294
|
+
dt as ae,
|
|
1295
|
+
J as b,
|
|
1296
|
+
Qe as c,
|
|
1297
|
+
Y as d,
|
|
1298
|
+
qe as e,
|
|
1299
|
+
ve as f,
|
|
1300
|
+
St as g,
|
|
1301
|
+
ze as h,
|
|
1302
|
+
gt as i,
|
|
1303
|
+
Ne as j,
|
|
1304
|
+
te as k,
|
|
1305
|
+
ne as l,
|
|
1306
|
+
pt as m,
|
|
1307
|
+
vt as n,
|
|
1308
|
+
we as o,
|
|
1309
|
+
It as p,
|
|
1310
|
+
bt as q,
|
|
1311
|
+
Et as r,
|
|
1312
|
+
Pe as s,
|
|
1313
|
+
Ce as t,
|
|
1314
|
+
Je as u,
|
|
1315
|
+
yt as v,
|
|
1316
|
+
ft as w,
|
|
1317
|
+
Lt as x,
|
|
1318
|
+
lt as y,
|
|
1319
|
+
Rt as z
|
|
1320
|
+
};
|
|
1321
|
+
//# sourceMappingURL=stacking.js.map
|