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