@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.
Files changed (139) hide show
  1. package/README.md +18 -1
  2. package/dist/assets/MapViewer.css +1 -1
  3. package/dist/assets/index.css +1 -1
  4. package/dist/chunks/MapViewer.js +1988 -358
  5. package/dist/chunks/MapViewer.js.map +1 -1
  6. package/dist/chunks/graph-tools.js +202 -109
  7. package/dist/chunks/graph-tools.js.map +1 -1
  8. package/dist/chunks/stacking.js +1426 -0
  9. package/dist/chunks/stacking.js.map +1 -0
  10. package/dist/core/filletPolygon.d.ts +10 -0
  11. package/dist/core/filletPolygon.d.ts.map +1 -0
  12. package/dist/core/geometry/index.d.ts +41 -4
  13. package/dist/core/geometry/index.d.ts.map +1 -1
  14. package/dist/core/hostChrome.d.ts +20 -0
  15. package/dist/core/hostChrome.d.ts.map +1 -0
  16. package/dist/core/import/index.d.ts +52 -3
  17. package/dist/core/import/index.d.ts.map +1 -1
  18. package/dist/core/import/svgStyle.d.ts +21 -0
  19. package/dist/core/import/svgStyle.d.ts.map +1 -0
  20. package/dist/core/import/svgTransform.d.ts +49 -0
  21. package/dist/core/import/svgTransform.d.ts.map +1 -0
  22. package/dist/core/index.d.ts +6 -0
  23. package/dist/core/index.d.ts.map +1 -1
  24. package/dist/core/index.js +89 -279
  25. package/dist/core/index.js.map +1 -1
  26. package/dist/core/layerStyles.d.ts +44 -0
  27. package/dist/core/layerStyles.d.ts.map +1 -0
  28. package/dist/core/mediaUrl.d.ts +3 -0
  29. package/dist/core/mediaUrl.d.ts.map +1 -0
  30. package/dist/core/outdoorDecoration.d.ts +16 -0
  31. package/dist/core/outdoorDecoration.d.ts.map +1 -0
  32. package/dist/core/publish/index.d.ts +8 -2
  33. package/dist/core/publish/index.d.ts.map +1 -1
  34. package/dist/core/routing/graph-tools.d.ts +28 -2
  35. package/dist/core/routing/graph-tools.d.ts.map +1 -1
  36. package/dist/core/routing/pathfinding.d.ts.map +1 -1
  37. package/dist/core/stacking.d.ts +61 -0
  38. package/dist/core/stacking.d.ts.map +1 -0
  39. package/dist/core/types.d.ts +31 -0
  40. package/dist/core/types.d.ts.map +1 -1
  41. package/dist/editor/MapEditor.d.ts +28 -16
  42. package/dist/editor/MapEditor.d.ts.map +1 -1
  43. package/dist/editor/canvas/EditorCanvas.d.ts +56 -6
  44. package/dist/editor/canvas/EditorCanvas.d.ts.map +1 -1
  45. package/dist/editor/canvas/OutdoorSvgUnderlay.d.ts +7 -0
  46. package/dist/editor/canvas/OutdoorSvgUnderlay.d.ts.map +1 -0
  47. package/dist/editor/canvas/coords.d.ts +51 -0
  48. package/dist/editor/canvas/coords.d.ts.map +1 -0
  49. package/dist/editor/canvas/editorFill.d.ts +10 -0
  50. package/dist/editor/canvas/editorFill.d.ts.map +1 -0
  51. package/dist/editor/canvas/editorHover.d.ts +14 -0
  52. package/dist/editor/canvas/editorHover.d.ts.map +1 -0
  53. package/dist/editor/canvas/underlayHint.d.ts +5 -0
  54. package/dist/editor/canvas/underlayHint.d.ts.map +1 -0
  55. package/dist/editor/connectorAssignments.d.ts +64 -0
  56. package/dist/editor/connectorAssignments.d.ts.map +1 -0
  57. package/dist/editor/draftOps.d.ts +22 -0
  58. package/dist/editor/draftOps.d.ts.map +1 -0
  59. package/dist/editor/editorSectionReturn.d.ts +12 -0
  60. package/dist/editor/editorSectionReturn.d.ts.map +1 -0
  61. package/dist/editor/floorsListReturn.d.ts +5 -0
  62. package/dist/editor/floorsListReturn.d.ts.map +1 -0
  63. package/dist/editor/geometryEdit.d.ts +54 -0
  64. package/dist/editor/geometryEdit.d.ts.map +1 -0
  65. package/dist/editor/hexColor.d.ts +4 -0
  66. package/dist/editor/hexColor.d.ts.map +1 -0
  67. package/dist/editor/history.d.ts +31 -0
  68. package/dist/editor/history.d.ts.map +1 -0
  69. package/dist/editor/index.css +1497 -143
  70. package/dist/editor/index.d.ts +9 -3
  71. package/dist/editor/index.d.ts.map +1 -1
  72. package/dist/editor/index.js +6377 -601
  73. package/dist/editor/index.js.map +1 -1
  74. package/dist/editor/labelText.d.ts +15 -0
  75. package/dist/editor/labelText.d.ts.map +1 -0
  76. package/dist/editor/labels.d.ts +5 -0
  77. package/dist/editor/labels.d.ts.map +1 -0
  78. package/dist/editor/panels/ConnectorAssign.d.ts +12 -0
  79. package/dist/editor/panels/ConnectorAssign.d.ts.map +1 -0
  80. package/dist/editor/panels/FloorsPanel.d.ts +64 -0
  81. package/dist/editor/panels/FloorsPanel.d.ts.map +1 -0
  82. package/dist/editor/panels/ImportReviewPanel.d.ts +22 -0
  83. package/dist/editor/panels/ImportReviewPanel.d.ts.map +1 -0
  84. package/dist/editor/panels/Inspector.d.ts +6 -3
  85. package/dist/editor/panels/Inspector.d.ts.map +1 -1
  86. package/dist/editor/panels/LeftRail.d.ts +26 -11
  87. package/dist/editor/panels/LeftRail.d.ts.map +1 -1
  88. package/dist/editor/panels/PreviewOverlay.d.ts +11 -2
  89. package/dist/editor/panels/PreviewOverlay.d.ts.map +1 -1
  90. package/dist/editor/pathRings.d.ts +79 -0
  91. package/dist/editor/pathRings.d.ts.map +1 -0
  92. package/dist/editor/portalSurface.d.ts +37 -0
  93. package/dist/editor/portalSurface.d.ts.map +1 -0
  94. package/dist/editor/previewDocument.d.ts +9 -0
  95. package/dist/editor/previewDocument.d.ts.map +1 -0
  96. package/dist/editor/railAssignments.d.ts +22 -0
  97. package/dist/editor/railAssignments.d.ts.map +1 -0
  98. package/dist/editor/routeStubs.d.ts +103 -0
  99. package/dist/editor/routeStubs.d.ts.map +1 -0
  100. package/dist/editor/snapPoint.d.ts +5 -0
  101. package/dist/editor/snapPoint.d.ts.map +1 -0
  102. package/dist/editor/splitJoin.d.ts +78 -0
  103. package/dist/editor/splitJoin.d.ts.map +1 -0
  104. package/dist/editor/tools.d.ts +49 -0
  105. package/dist/editor/tools.d.ts.map +1 -0
  106. package/dist/test-maps/shops-at-south-town/BASE - Shops At South Town.ai +26703 -28
  107. package/dist/test-maps/shops-at-south-town/LF - Shops At South Town.ai +4459 -0
  108. package/dist/test-maps/shops-at-south-town/SVG/BASE - Shops At South Town.svg +567 -0
  109. package/dist/test-maps/shops-at-south-town/SVG/LF - Shops At South Town.svg +238 -0
  110. package/dist/test-maps/shops-at-south-town/SVG/UF - Shops At South Town.svg +276 -0
  111. package/dist/test-maps/shops-at-south-town/UF - Shops At South Town.ai +4131 -1
  112. package/dist/ui/ModernSelect.d.ts +14 -0
  113. package/dist/ui/ModernSelect.d.ts.map +1 -0
  114. package/dist/ui/selectSearch.d.ts +9 -0
  115. package/dist/ui/selectSearch.d.ts.map +1 -0
  116. package/dist/viewer/MapViewer.d.ts +14 -3
  117. package/dist/viewer/MapViewer.d.ts.map +1 -1
  118. package/dist/viewer/camera.d.ts +37 -0
  119. package/dist/viewer/camera.d.ts.map +1 -0
  120. package/dist/viewer/components/CameraRig.d.ts +18 -0
  121. package/dist/viewer/components/CameraRig.d.ts.map +1 -0
  122. package/dist/viewer/components/LevelMeshes.d.ts +6 -1
  123. package/dist/viewer/components/LevelMeshes.d.ts.map +1 -1
  124. package/dist/viewer/components/MapScene.d.ts +6 -1
  125. package/dist/viewer/components/MapScene.d.ts.map +1 -1
  126. package/dist/viewer/components/SvgVectorLayer.d.ts +18 -0
  127. package/dist/viewer/components/SvgVectorLayer.d.ts.map +1 -0
  128. package/dist/viewer/index.css +236 -37
  129. package/dist/viewer/index.d.ts +4 -0
  130. package/dist/viewer/index.d.ts.map +1 -1
  131. package/dist/viewer/index.js +9 -4
  132. package/dist/viewer/index.js.map +1 -1
  133. package/dist/viewer/ui/MapControls.d.ts +22 -0
  134. package/dist/viewer/ui/MapControls.d.ts.map +1 -0
  135. package/dist/viewer/ui/RuntimeChrome.d.ts +3 -3
  136. package/dist/viewer/ui/RuntimeChrome.d.ts.map +1 -1
  137. package/package.json +7 -3
  138. package/dist/chunks/pathfinding.js +0 -343
  139. package/dist/chunks/pathfinding.js.map +0 -1
@@ -1,16 +1,228 @@
1
- import { jsx as t, jsxs as g } from "react/jsx-runtime";
2
- import { useMemo as T, useState as R, useEffect as z, Suspense as U } from "react";
3
- import { f as X, e as K, q as W } from "./pathfinding.js";
4
- import { Canvas as j } from "@react-three/fiber";
5
- import { OrthographicCamera as q, OrbitControls as V } from "@react-three/drei";
6
- import * as S from "three";
7
- function Q(l, i, a) {
8
- if (a) return a;
1
+ import { jsx as R, jsxs as te, Fragment as Ye } from "react/jsx-runtime";
2
+ import { useRef as he, useState as ae, useMemo as re, useCallback as be, useEffect as le, useImperativeHandle as $e, Suspense as Ze } from "react";
3
+ import { B as Qe, ad as Ke, d as Je, ac as We, x as et, E as tt, W as nt, J as ot, T as rt, R as st, M as Oe, U as _e, ab as it, am as at, l as ct, Q as Ne, af as lt, a2 as Be, t as De, al as Te, s as ut, Y as ft, z as mt } from "./stacking.js";
4
+ import { useThree as ht, Canvas as dt } from "@react-three/fiber";
5
+ import { Text as pt, OrthographicCamera as yt, OrbitControls as gt } from "@react-three/drei";
6
+ import * as ue from "three";
7
+ import { Loader as bt, FileLoader as xt, Matrix3 as ge, Vector2 as Q, Vector3 as Ae, Box2 as wt, ShapeUtils as kt, Shape as At, Path as Ee, BufferGeometry as Mt, Float32BufferAttribute as Ce, SRGBColorSpace as It, ShapePath as ye } from "three";
8
+ import { createPortal as Nt } from "react-dom";
9
+ function Tt({
10
+ levels: l,
11
+ activeLevelId: i,
12
+ onActiveLevelChange: M,
13
+ onZoomIn: I,
14
+ onZoomOut: N,
15
+ onReset: h,
16
+ showFloors: B = !0,
17
+ showZoomReset: W = !0,
18
+ floorOptions: p,
19
+ alwaysShowFloors: k = !1
20
+ }) {
21
+ const z = p ?? Qe(l), O = B && (k ? z.length > 0 : Ke(l));
22
+ return !O && !W ? null : /* @__PURE__ */ R("div", { className: "eyeon-map-controls", children: /* @__PURE__ */ te("div", { className: "eyeon-map-controls__stack", children: [
23
+ O && /* @__PURE__ */ R("div", { className: "eyeon-map-controls__floors", role: "tablist", "aria-label": "Floors", children: z.map((C) => {
24
+ const V = C.id === i;
25
+ return /* @__PURE__ */ R(
26
+ "button",
27
+ {
28
+ type: "button",
29
+ role: "tab",
30
+ "aria-selected": V,
31
+ className: V ? "eyeon-map-controls__floor is-active" : "eyeon-map-controls__floor",
32
+ onClick: () => M(C.id),
33
+ children: C.name
34
+ },
35
+ C.id
36
+ );
37
+ }) }),
38
+ W && /* @__PURE__ */ te(Ye, { children: [
39
+ /* @__PURE__ */ R(
40
+ "button",
41
+ {
42
+ type: "button",
43
+ className: "eyeon-map-controls__reset",
44
+ onClick: h,
45
+ "aria-label": "Reset map",
46
+ children: "Reset"
47
+ }
48
+ ),
49
+ /* @__PURE__ */ te("div", { className: "eyeon-map-controls__zoom", children: [
50
+ /* @__PURE__ */ R(
51
+ "button",
52
+ {
53
+ type: "button",
54
+ className: "eyeon-map-controls__zoom-btn",
55
+ onClick: N,
56
+ "aria-label": "Zoom out",
57
+ children: "−"
58
+ }
59
+ ),
60
+ /* @__PURE__ */ R(
61
+ "button",
62
+ {
63
+ type: "button",
64
+ className: "eyeon-map-controls__zoom-btn",
65
+ onClick: I,
66
+ "aria-label": "Zoom in",
67
+ children: "+"
68
+ }
69
+ )
70
+ ] })
71
+ ] })
72
+ ] }) });
73
+ }
74
+ const Et = 8;
75
+ function Ct(l, i) {
76
+ const M = i.trim().toLowerCase();
77
+ return M ? l.filter((I) => I.label.toLowerCase().includes(M)) : l;
78
+ }
79
+ function St(l, i) {
80
+ return i ?? l >= Et;
81
+ }
82
+ function Ge({
83
+ value: l,
84
+ options: i,
85
+ onChange: M,
86
+ disabled: I = !1,
87
+ placeholder: N = "Select…",
88
+ searchable: h,
89
+ ariaLabel: B
90
+ }) {
91
+ const W = he(null), p = he(null), k = he(null), z = he(null), [O, C] = ae(!1), [V, P] = ae(""), [g, u] = ae(null), E = St(i.length, h), y = i.find((w) => w.value === l), m = re(
92
+ () => Ct(i, V),
93
+ [i, V]
94
+ ), v = be(() => {
95
+ C(!1), P("");
96
+ }, []), U = be(() => {
97
+ const w = p.current;
98
+ if (!w) return;
99
+ const T = w.getBoundingClientRect(), _ = window.innerHeight - T.bottom - 8, q = T.top - 8, Y = Math.min(280, Math.max(_, q, 120)), G = _ < 160 && q > _;
100
+ u({
101
+ top: G ? Math.max(8, T.top - Y - 4) : T.bottom + 4,
102
+ left: T.left,
103
+ width: Math.max(T.width, 160),
104
+ maxHeight: Y
105
+ });
106
+ }, []);
107
+ le(() => {
108
+ if (!O) {
109
+ u(null);
110
+ return;
111
+ }
112
+ U();
113
+ const w = (q) => {
114
+ var G, K;
115
+ const Y = q.target;
116
+ (G = W.current) != null && G.contains(Y) || (K = k.current) != null && K.contains(Y) || v();
117
+ }, T = (q) => {
118
+ q.key === "Escape" && v();
119
+ }, _ = () => U();
120
+ return document.addEventListener("mousedown", w), document.addEventListener("keydown", T), window.addEventListener("resize", _), window.addEventListener("scroll", _, !0), () => {
121
+ document.removeEventListener("mousedown", w), document.removeEventListener("keydown", T), window.removeEventListener("resize", _), window.removeEventListener("scroll", _, !0);
122
+ };
123
+ }, [O, v, U]), le(() => {
124
+ !O || !E || requestAnimationFrame(() => {
125
+ var w;
126
+ return (w = z.current) == null ? void 0 : w.focus();
127
+ });
128
+ }, [O, E]);
129
+ const d = O && g && !I ? Nt(
130
+ /* @__PURE__ */ te(
131
+ "div",
132
+ {
133
+ ref: k,
134
+ className: "eyeon-map-select__menu",
135
+ role: "listbox",
136
+ "aria-label": B,
137
+ style: {
138
+ top: g.top,
139
+ left: g.left,
140
+ width: g.width,
141
+ maxHeight: g.maxHeight
142
+ },
143
+ children: [
144
+ E ? /* @__PURE__ */ R(
145
+ "input",
146
+ {
147
+ ref: z,
148
+ className: "eyeon-map-select__search",
149
+ type: "search",
150
+ placeholder: "Search…",
151
+ value: V,
152
+ "aria-label": "Search options",
153
+ onChange: (w) => P(w.target.value),
154
+ onKeyDown: (w) => w.stopPropagation()
155
+ }
156
+ ) : null,
157
+ /* @__PURE__ */ R("ul", { className: "eyeon-map-select__list", children: m.length === 0 ? /* @__PURE__ */ R("li", { className: "eyeon-map-select__empty", children: "No matches" }) : m.map((w) => {
158
+ const T = w.value === l;
159
+ return /* @__PURE__ */ R("li", { role: "option", "aria-selected": T, children: /* @__PURE__ */ R(
160
+ "button",
161
+ {
162
+ type: "button",
163
+ className: T ? "eyeon-map-select__option is-active" : "eyeon-map-select__option",
164
+ onMouseDown: (_) => _.preventDefault(),
165
+ onClick: () => {
166
+ M(w.value), v();
167
+ },
168
+ children: w.label
169
+ }
170
+ ) }, w.value);
171
+ }) })
172
+ ]
173
+ }
174
+ ),
175
+ document.body
176
+ ) : null;
177
+ return /* @__PURE__ */ te("div", { ref: W, className: "eyeon-map-select", children: [
178
+ /* @__PURE__ */ te(
179
+ "button",
180
+ {
181
+ ref: p,
182
+ type: "button",
183
+ className: "eyeon-map-select__trigger",
184
+ "aria-label": B,
185
+ "aria-expanded": O,
186
+ "aria-haspopup": "listbox",
187
+ disabled: I,
188
+ onClick: () => {
189
+ I || C((w) => !w);
190
+ },
191
+ children: [
192
+ /* @__PURE__ */ R("span", { className: y ? void 0 : "eyeon-map-select__placeholder", children: (y == null ? void 0 : y.label) ?? N }),
193
+ /* @__PURE__ */ R(
194
+ "svg",
195
+ {
196
+ className: "eyeon-map-select__chevron",
197
+ width: "12",
198
+ height: "12",
199
+ viewBox: "0 0 12 12",
200
+ "aria-hidden": !0,
201
+ children: /* @__PURE__ */ R(
202
+ "path",
203
+ {
204
+ d: "M2.5 4.5 6 8l3.5-3.5",
205
+ fill: "none",
206
+ stroke: "currentColor",
207
+ strokeWidth: "1.5",
208
+ strokeLinecap: "round",
209
+ strokeLinejoin: "round"
210
+ }
211
+ )
212
+ }
213
+ )
214
+ ]
215
+ }
216
+ ),
217
+ d
218
+ ] });
219
+ }
220
+ function vt(l, i, M) {
221
+ if (l === "walkable") return nt;
222
+ if (M) return M;
9
223
  switch (l) {
10
224
  case "unit":
11
225
  return i.STORE_DEFAULT_COLOR;
12
- case "walkable":
13
- return i.WALKABLE_COLOR;
14
226
  case "wall":
15
227
  case "boundary":
16
228
  return i.WALL_COLOR;
@@ -28,375 +240,1768 @@ function Q(l, i, a) {
28
240
  return "#e2e8f0";
29
241
  }
30
242
  }
31
- function Z(l) {
243
+ function Ot(l) {
32
244
  if (l.length < 3) return null;
33
- const i = new S.Shape();
245
+ const i = new ue.Shape();
34
246
  i.moveTo(l[0].x, l[0].y);
35
- for (let a = 1; a < l.length; a++)
36
- i.lineTo(l[a].x, l[a].y);
247
+ for (let M = 1; M < l.length; M++)
248
+ i.lineTo(l[M].x, l[M].y);
37
249
  return i.closePath(), i;
38
250
  }
39
- function J({
251
+ function _t({
40
252
  level: l,
41
253
  theme: i,
42
- is3d: a,
43
- selectedRetailerId: p,
44
- onSelectShape: k
254
+ is3d: M,
255
+ selectedRetailerId: I,
256
+ onSelectShape: N,
257
+ interactiveOnly: h = !1
45
258
  }) {
46
- const y = T(() => l.shapes.filter((o) => o.kind !== "void").map((o) => {
47
- var _;
48
- const A = o.geometry.polygons.map(Z).filter((b) => b != null);
49
- if (A.length === 0) return null;
50
- const s = p != null && ((_ = o.assignment) == null ? void 0 : _.retailerId) === p, v = s ? i.ACCENT_COLOR : Q(o.kind, i, o.style.fill), n = a && (o.kind === "unit" || o.kind === "wall") ? o.style.extrudeHeight ?? (o.kind === "unit" ? i.STORE_HEIGHT : 2) : 0;
51
- return { shape: o, threeShapes: A, color: v, extrude: n, selected: s };
52
- }).filter(Boolean), [l, i, a, p]);
53
- return /* @__PURE__ */ t("group", { children: y.map(({ shape: o, threeShapes: h, color: A, extrude: s, selected: v }) => /* @__PURE__ */ t("group", { children: h.map((n, _) => /* @__PURE__ */ g(
54
- "mesh",
55
- {
56
- position: [0, 0, o.zIndex * 0.01],
57
- onClick: (b) => {
58
- b.stopPropagation(), (o.kind === "unit" || o.kind === "amenity" || o.kind === "kiosk_screen" || o.kind === "entrance") && (k == null || k(o.id));
59
- },
60
- children: [
61
- s > 0 ? /* @__PURE__ */ t(
62
- "extrudeGeometry",
63
- {
64
- args: [
65
- n,
66
- { depth: s, bevelEnabled: !1 }
67
- ]
68
- }
69
- ) : /* @__PURE__ */ t("shapeGeometry", { args: [n] }),
70
- /* @__PURE__ */ t(
71
- "meshBasicMaterial",
72
- {
73
- color: A,
74
- transparent: o.style.transparent || o.kind === "amenity",
75
- opacity: o.style.opacity ?? (o.kind === "amenity" ? 0.01 : 1),
76
- side: S.DoubleSide
77
- }
78
- ),
79
- v && /* @__PURE__ */ g("lineSegments", { children: [
80
- /* @__PURE__ */ t(
81
- "edgesGeometry",
259
+ const B = re(() => l.shapes.filter((p) => p.kind !== "void").filter((p) => {
260
+ var k, z;
261
+ return !(p.kind === "label" && ((z = (k = p.label) == null ? void 0 : k.text) != null && z.trim()));
262
+ }).filter(
263
+ (p) => {
264
+ var k, z;
265
+ return !h || Je.includes(p.kind) || p.kind === "label" && !!((z = (k = p.label) == null ? void 0 : k.text) != null && z.trim()) || p.kind === "walkable" && !We(p.sourceSvgId);
266
+ }
267
+ ).filter((p) => !p.orphanedAt).map((p) => {
268
+ var g;
269
+ const k = p.kind === "unit" ? i.STORE_RADIUS : 0, O = p.geometry.polygons.map(
270
+ (u) => k > 0 ? et(u, k) : u
271
+ ).map(Ot).filter((u) => u != null);
272
+ if (O.length === 0) return null;
273
+ const C = I != null && ((g = p.assignment) == null ? void 0 : g.retailerId) === I, V = C ? i.ACCENT_COLOR : vt(p.kind, i, p.style.fill), P = M && (p.kind === "unit" || p.kind === "wall") ? p.style.extrudeHeight ?? (p.kind === "unit" ? i.STORE_HEIGHT : 2) : 0;
274
+ return { shape: p, threeShapes: O, color: V, extrude: P, selected: C };
275
+ }).filter(Boolean), [l, i, M, I, h]), W = re(
276
+ () => l.shapes.filter(
277
+ (p) => {
278
+ var k, z;
279
+ return !p.orphanedAt && p.kind === "label" && !!((z = (k = p.label) == null ? void 0 : k.text) != null && z.trim());
280
+ }
281
+ ),
282
+ [l.shapes]
283
+ );
284
+ return /* @__PURE__ */ te("group", { children: [
285
+ W.map((p) => {
286
+ const k = tt(p.geometry);
287
+ return /* @__PURE__ */ R(
288
+ pt,
289
+ {
290
+ position: [k.minX, k.maxY, 0.15],
291
+ fontSize: p.label.size ?? 24,
292
+ color: p.label.color ?? i.STORE_TEXT_COLOR,
293
+ anchorX: "left",
294
+ anchorY: "bottom",
295
+ scale: [1, -1, 1],
296
+ children: p.label.text
297
+ },
298
+ `label-${p.id}`
299
+ );
300
+ }),
301
+ B.map(({ shape: p, threeShapes: k, color: z, extrude: O, selected: C }) => /* @__PURE__ */ R("group", { children: k.map((V, P) => /* @__PURE__ */ te(
302
+ "mesh",
303
+ {
304
+ position: [0, 0, p.zIndex * 0.01],
305
+ onClick: (g) => {
306
+ g.stopPropagation(), (p.kind === "unit" || p.kind === "amenity" || p.kind === "kiosk_screen" || p.kind === "entrance" || p.kind === "parking_zone") && (N == null || N(p.id));
307
+ },
308
+ children: [
309
+ O > 0 ? /* @__PURE__ */ R(
310
+ "extrudeGeometry",
82
311
  {
83
312
  args: [
84
- s > 0 ? new S.ExtrudeGeometry(n, {
85
- depth: s,
86
- bevelEnabled: !1
87
- }) : new S.ShapeGeometry(n)
313
+ V,
314
+ { depth: O, bevelEnabled: !1 }
88
315
  ]
89
316
  }
317
+ ) : /* @__PURE__ */ R("shapeGeometry", { args: [V] }),
318
+ /* @__PURE__ */ R(
319
+ "meshBasicMaterial",
320
+ {
321
+ color: z,
322
+ transparent: p.style.transparent || p.kind === "amenity",
323
+ opacity: p.style.opacity ?? (p.kind === "amenity" ? 0.01 : 1),
324
+ side: ue.DoubleSide
325
+ }
90
326
  ),
91
- /* @__PURE__ */ t("lineBasicMaterial", { color: i.ACCENT_COLOR })
92
- ] })
93
- ]
94
- },
95
- `${o.id}-${_}`
96
- )) }, o.id)) });
327
+ C && /* @__PURE__ */ te("lineSegments", { children: [
328
+ /* @__PURE__ */ R(
329
+ "edgesGeometry",
330
+ {
331
+ args: [
332
+ O > 0 ? new ue.ExtrudeGeometry(V, {
333
+ depth: O,
334
+ bevelEnabled: !1
335
+ }) : new ue.ShapeGeometry(V)
336
+ ]
337
+ }
338
+ ),
339
+ /* @__PURE__ */ R("lineBasicMaterial", { color: i.ACCENT_COLOR })
340
+ ] })
341
+ ]
342
+ },
343
+ `${p.id}-${P}`
344
+ )) }, p.id))
345
+ ] });
97
346
  }
98
- function ee({
347
+ function Pt({
99
348
  route: l,
100
349
  activeLevelId: i,
101
- color: a
350
+ color: M
102
351
  }) {
103
- const p = T(() => l.points.filter((y) => i == null || y.levelId === i).map((y) => new S.Vector3(y.x, y.y, 2)), [l, i]);
104
- if (p.length < 2) return null;
105
- const k = new S.CatmullRomCurve3(p);
106
- return /* @__PURE__ */ g("mesh", { children: [
107
- /* @__PURE__ */ t("tubeGeometry", { args: [k, Math.max(p.length * 4, 8), 1.5, 8, !1] }),
108
- /* @__PURE__ */ t("meshBasicMaterial", { color: a })
352
+ const I = re(() => l.points.filter((h) => i == null || h.levelId === i).map((h) => new ue.Vector3(h.x, h.y, 2)), [l, i]);
353
+ if (I.length < 2) return null;
354
+ const N = new ue.CatmullRomCurve3(I);
355
+ return /* @__PURE__ */ te("mesh", { children: [
356
+ /* @__PURE__ */ R("tubeGeometry", { args: [N, Math.max(I.length * 4, 8), 1.5, 8, !1] }),
357
+ /* @__PURE__ */ R("meshBasicMaterial", { color: M })
109
358
  ] });
110
359
  }
111
- function ne({
360
+ const Rt = It;
361
+ class Me extends bt {
362
+ /**
363
+ * Constructs a new SVG loader.
364
+ *
365
+ * @param {LoadingManager} [manager] - The loading manager.
366
+ */
367
+ constructor(i) {
368
+ super(i), this.defaultDPI = 90, this.defaultUnit = "px";
369
+ }
370
+ /**
371
+ * Starts loading from the given URL and passes the loaded SVG asset
372
+ * to the `onLoad()` callback.
373
+ *
374
+ * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
375
+ * @param {function({paths:Array<ShapePath>,xml:string})} onLoad - Executed when the loading process has been finished.
376
+ * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
377
+ * @param {onErrorCallback} onError - Executed when errors occur.
378
+ */
379
+ load(i, M, I, N) {
380
+ const h = this, B = new xt(h.manager);
381
+ B.setPath(h.path), B.setRequestHeader(h.requestHeader), B.setWithCredentials(h.withCredentials), B.load(i, function(W) {
382
+ try {
383
+ M(h.parse(W));
384
+ } catch (p) {
385
+ N ? N(p) : console.error(p), h.manager.itemError(i);
386
+ }
387
+ }, I, N);
388
+ }
389
+ /**
390
+ * Parses the given SVG data and returns the resulting data.
391
+ *
392
+ * @param {string} text - The raw SVG data as a string.
393
+ * @return {{paths:Array<ShapePath>,xml:string}} An object holding an array of shape paths and the
394
+ * SVG XML document.
395
+ */
396
+ parse(i) {
397
+ const M = this;
398
+ function I(r, o) {
399
+ if (r.nodeType !== 1) return;
400
+ const t = v(r);
401
+ let e = !1, c = null;
402
+ switch (r.nodeName) {
403
+ case "svg":
404
+ o = P(r, o);
405
+ break;
406
+ case "style":
407
+ h(r);
408
+ break;
409
+ case "g":
410
+ o = P(r, o);
411
+ break;
412
+ case "path":
413
+ o = P(r, o), r.hasAttribute("d") && (c = N(r));
414
+ break;
415
+ case "rect":
416
+ o = P(r, o), c = p(r);
417
+ break;
418
+ case "polygon":
419
+ o = P(r, o), c = k(r);
420
+ break;
421
+ case "polyline":
422
+ o = P(r, o), c = z(r);
423
+ break;
424
+ case "circle":
425
+ o = P(r, o), c = O(r);
426
+ break;
427
+ case "ellipse":
428
+ o = P(r, o), c = C(r);
429
+ break;
430
+ case "line":
431
+ o = P(r, o), c = V(r);
432
+ break;
433
+ case "defs":
434
+ e = !0;
435
+ break;
436
+ case "use":
437
+ o = P(r, o);
438
+ const S = (r.getAttributeNS("http://www.w3.org/1999/xlink", "href") || "").substring(1), L = r.viewportElement.getElementById(S);
439
+ L ? I(L, o) : console.warn("SVGLoader: 'use node' references non-existent node id: " + S);
440
+ break;
441
+ }
442
+ c && (o.fill !== void 0 && o.fill !== "none" && c.color.setStyle(o.fill, Rt), d(c, ie), G.push(c), c.userData = { node: r, style: o });
443
+ const b = r.childNodes;
444
+ for (let a = 0; a < b.length; a++) {
445
+ const S = b[a];
446
+ e && S.nodeName !== "style" && S.nodeName !== "defs" || I(S, o);
447
+ }
448
+ t && (Z.pop(), Z.length > 0 ? ie.copy(Z[Z.length - 1]) : ie.identity());
449
+ }
450
+ function N(r) {
451
+ const o = new ye(), t = new Q(), e = new Q(), c = new Q();
452
+ let b = !0, a = !1;
453
+ const S = r.getAttribute("d");
454
+ if (S === "" || S === "none") return null;
455
+ const L = S.match(/[a-df-z][^a-df-z]*/ig);
456
+ for (let D = 0, f = L.length; D < f; D++) {
457
+ const A = L[D], F = A.charAt(0), j = A.slice(1).trim();
458
+ b === !0 && (a = !0, b = !1);
459
+ let s;
460
+ switch (F) {
461
+ case "M":
462
+ s = u(j);
463
+ for (let n = 0, H = s.length; n < H; n += 2)
464
+ t.x = s[n + 0], t.y = s[n + 1], e.x = t.x, e.y = t.y, n === 0 ? o.moveTo(t.x, t.y) : o.lineTo(t.x, t.y), n === 0 && c.copy(t);
465
+ break;
466
+ case "H":
467
+ s = u(j);
468
+ for (let n = 0, H = s.length; n < H; n++)
469
+ t.x = s[n], e.x = t.x, e.y = t.y, o.lineTo(t.x, t.y), n === 0 && a === !0 && c.copy(t);
470
+ break;
471
+ case "V":
472
+ s = u(j);
473
+ for (let n = 0, H = s.length; n < H; n++)
474
+ t.y = s[n], e.x = t.x, e.y = t.y, o.lineTo(t.x, t.y), n === 0 && a === !0 && c.copy(t);
475
+ break;
476
+ case "L":
477
+ s = u(j);
478
+ for (let n = 0, H = s.length; n < H; n += 2)
479
+ t.x = s[n + 0], t.y = s[n + 1], e.x = t.x, e.y = t.y, o.lineTo(t.x, t.y), n === 0 && a === !0 && c.copy(t);
480
+ break;
481
+ case "C":
482
+ s = u(j);
483
+ for (let n = 0, H = s.length; n < H; n += 6)
484
+ o.bezierCurveTo(
485
+ s[n + 0],
486
+ s[n + 1],
487
+ s[n + 2],
488
+ s[n + 3],
489
+ s[n + 4],
490
+ s[n + 5]
491
+ ), e.x = s[n + 2], e.y = s[n + 3], t.x = s[n + 4], t.y = s[n + 5], n === 0 && a === !0 && c.copy(t);
492
+ break;
493
+ case "S":
494
+ s = u(j);
495
+ for (let n = 0, H = s.length; n < H; n += 4)
496
+ o.bezierCurveTo(
497
+ g(t.x, e.x),
498
+ g(t.y, e.y),
499
+ s[n + 0],
500
+ s[n + 1],
501
+ s[n + 2],
502
+ s[n + 3]
503
+ ), e.x = s[n + 0], e.y = s[n + 1], t.x = s[n + 2], t.y = s[n + 3], n === 0 && a === !0 && c.copy(t);
504
+ break;
505
+ case "Q":
506
+ s = u(j);
507
+ for (let n = 0, H = s.length; n < H; n += 4)
508
+ o.quadraticCurveTo(
509
+ s[n + 0],
510
+ s[n + 1],
511
+ s[n + 2],
512
+ s[n + 3]
513
+ ), e.x = s[n + 0], e.y = s[n + 1], t.x = s[n + 2], t.y = s[n + 3], n === 0 && a === !0 && c.copy(t);
514
+ break;
515
+ case "T":
516
+ s = u(j);
517
+ for (let n = 0, H = s.length; n < H; n += 2) {
518
+ const $ = g(t.x, e.x), ce = g(t.y, e.y);
519
+ o.quadraticCurveTo(
520
+ $,
521
+ ce,
522
+ s[n + 0],
523
+ s[n + 1]
524
+ ), e.x = $, e.y = ce, t.x = s[n + 0], t.y = s[n + 1], n === 0 && a === !0 && c.copy(t);
525
+ }
526
+ break;
527
+ case "A":
528
+ s = u(j, [3, 4], 7);
529
+ for (let n = 0, H = s.length; n < H; n += 7) {
530
+ if (s[n + 5] == t.x && s[n + 6] == t.y) continue;
531
+ const $ = t.clone();
532
+ t.x = s[n + 5], t.y = s[n + 6], e.x = t.x, e.y = t.y, B(
533
+ o,
534
+ s[n],
535
+ s[n + 1],
536
+ s[n + 2],
537
+ s[n + 3],
538
+ s[n + 4],
539
+ $,
540
+ t
541
+ ), n === 0 && a === !0 && c.copy(t);
542
+ }
543
+ break;
544
+ case "m":
545
+ s = u(j);
546
+ for (let n = 0, H = s.length; n < H; n += 2)
547
+ t.x += s[n + 0], t.y += s[n + 1], e.x = t.x, e.y = t.y, n === 0 ? o.moveTo(t.x, t.y) : o.lineTo(t.x, t.y), n === 0 && c.copy(t);
548
+ break;
549
+ case "h":
550
+ s = u(j);
551
+ for (let n = 0, H = s.length; n < H; n++)
552
+ t.x += s[n], e.x = t.x, e.y = t.y, o.lineTo(t.x, t.y), n === 0 && a === !0 && c.copy(t);
553
+ break;
554
+ case "v":
555
+ s = u(j);
556
+ for (let n = 0, H = s.length; n < H; n++)
557
+ t.y += s[n], e.x = t.x, e.y = t.y, o.lineTo(t.x, t.y), n === 0 && a === !0 && c.copy(t);
558
+ break;
559
+ case "l":
560
+ s = u(j);
561
+ for (let n = 0, H = s.length; n < H; n += 2)
562
+ t.x += s[n + 0], t.y += s[n + 1], e.x = t.x, e.y = t.y, o.lineTo(t.x, t.y), n === 0 && a === !0 && c.copy(t);
563
+ break;
564
+ case "c":
565
+ s = u(j);
566
+ for (let n = 0, H = s.length; n < H; n += 6)
567
+ o.bezierCurveTo(
568
+ t.x + s[n + 0],
569
+ t.y + s[n + 1],
570
+ t.x + s[n + 2],
571
+ t.y + s[n + 3],
572
+ t.x + s[n + 4],
573
+ t.y + s[n + 5]
574
+ ), e.x = t.x + s[n + 2], e.y = t.y + s[n + 3], t.x += s[n + 4], t.y += s[n + 5], n === 0 && a === !0 && c.copy(t);
575
+ break;
576
+ case "s":
577
+ s = u(j);
578
+ for (let n = 0, H = s.length; n < H; n += 4)
579
+ o.bezierCurveTo(
580
+ g(t.x, e.x),
581
+ g(t.y, e.y),
582
+ t.x + s[n + 0],
583
+ t.y + s[n + 1],
584
+ t.x + s[n + 2],
585
+ t.y + s[n + 3]
586
+ ), e.x = t.x + s[n + 0], e.y = t.y + s[n + 1], t.x += s[n + 2], t.y += s[n + 3], n === 0 && a === !0 && c.copy(t);
587
+ break;
588
+ case "q":
589
+ s = u(j);
590
+ for (let n = 0, H = s.length; n < H; n += 4)
591
+ o.quadraticCurveTo(
592
+ t.x + s[n + 0],
593
+ t.y + s[n + 1],
594
+ t.x + s[n + 2],
595
+ t.y + s[n + 3]
596
+ ), e.x = t.x + s[n + 0], e.y = t.y + s[n + 1], t.x += s[n + 2], t.y += s[n + 3], n === 0 && a === !0 && c.copy(t);
597
+ break;
598
+ case "t":
599
+ s = u(j);
600
+ for (let n = 0, H = s.length; n < H; n += 2) {
601
+ const $ = g(t.x, e.x), ce = g(t.y, e.y);
602
+ o.quadraticCurveTo(
603
+ $,
604
+ ce,
605
+ t.x + s[n + 0],
606
+ t.y + s[n + 1]
607
+ ), e.x = $, e.y = ce, t.x = t.x + s[n + 0], t.y = t.y + s[n + 1], n === 0 && a === !0 && c.copy(t);
608
+ }
609
+ break;
610
+ case "a":
611
+ s = u(j, [3, 4], 7);
612
+ for (let n = 0, H = s.length; n < H; n += 7) {
613
+ if (s[n + 5] == 0 && s[n + 6] == 0) continue;
614
+ const $ = t.clone();
615
+ t.x += s[n + 5], t.y += s[n + 6], e.x = t.x, e.y = t.y, B(
616
+ o,
617
+ s[n],
618
+ s[n + 1],
619
+ s[n + 2],
620
+ s[n + 3],
621
+ s[n + 4],
622
+ $,
623
+ t
624
+ ), n === 0 && a === !0 && c.copy(t);
625
+ }
626
+ break;
627
+ case "Z":
628
+ case "z":
629
+ o.currentPath.autoClose = !0, o.currentPath.curves.length > 0 && (t.copy(c), o.currentPath.currentPoint.copy(t), b = !0);
630
+ break;
631
+ default:
632
+ console.warn(A);
633
+ }
634
+ a = !1;
635
+ }
636
+ return o;
637
+ }
638
+ function h(r) {
639
+ if (!(!r.sheet || !r.sheet.cssRules || !r.sheet.cssRules.length))
640
+ for (let o = 0; o < r.sheet.cssRules.length; o++) {
641
+ const t = r.sheet.cssRules[o];
642
+ if (t.type !== 1) continue;
643
+ const e = t.selectorText.split(/,/gm).filter(Boolean).map((c) => c.trim());
644
+ for (let c = 0; c < e.length; c++) {
645
+ const b = Object.fromEntries(
646
+ Object.entries(t.style).filter(([, a]) => a !== "")
647
+ );
648
+ K[e[c]] = Object.assign(
649
+ K[e[c]] || {},
650
+ b
651
+ );
652
+ }
653
+ }
654
+ }
655
+ function B(r, o, t, e, c, b, a, S) {
656
+ if (o == 0 || t == 0) {
657
+ r.lineTo(S.x, S.y);
658
+ return;
659
+ }
660
+ e = e * Math.PI / 180, o = Math.abs(o), t = Math.abs(t);
661
+ const L = (a.x - S.x) / 2, D = (a.y - S.y) / 2, f = Math.cos(e) * L + Math.sin(e) * D, A = -Math.sin(e) * L + Math.cos(e) * D;
662
+ let F = o * o, j = t * t;
663
+ const s = f * f, n = A * A, H = s / F + n / j;
664
+ if (H > 1) {
665
+ const ke = Math.sqrt(H);
666
+ o = ke * o, t = ke * t, F = o * o, j = t * t;
667
+ }
668
+ const $ = F * n + j * s, ce = (F * j - $) / $;
669
+ let me = Math.sqrt(Math.max(0, ce));
670
+ c === b && (me = -me);
671
+ const se = me * o * A / t, pe = -me * t * f / o, xe = Math.cos(e) * se - Math.sin(e) * pe + (a.x + S.x) / 2, Pe = Math.sin(e) * se + Math.cos(e) * pe + (a.y + S.y) / 2, we = W(1, 0, (f - se) / o, (A - pe) / t), Ie = W((f - se) / o, (A - pe) / t, (-f - se) / o, (-A - pe) / t) % (Math.PI * 2);
672
+ r.currentPath.absellipse(xe, Pe, o, t, we, we + Ie, b === 0, e);
673
+ }
674
+ function W(r, o, t, e) {
675
+ const c = r * t + o * e, b = Math.sqrt(r * r + o * o) * Math.sqrt(t * t + e * e);
676
+ let a = Math.acos(Math.max(-1, Math.min(1, c / b)));
677
+ return r * e - o * t < 0 && (a = -a), a;
678
+ }
679
+ function p(r) {
680
+ const o = m(r.getAttribute("x") || 0), t = m(r.getAttribute("y") || 0), e = m(r.getAttribute("rx") || r.getAttribute("ry") || 0), c = m(r.getAttribute("ry") || r.getAttribute("rx") || 0), b = m(r.getAttribute("width")), a = m(r.getAttribute("height")), S = 1 - 0.551915024494, L = new ye();
681
+ return L.moveTo(o + e, t), L.lineTo(o + b - e, t), (e !== 0 || c !== 0) && L.bezierCurveTo(
682
+ o + b - e * S,
683
+ t,
684
+ o + b,
685
+ t + c * S,
686
+ o + b,
687
+ t + c
688
+ ), L.lineTo(o + b, t + a - c), (e !== 0 || c !== 0) && L.bezierCurveTo(
689
+ o + b,
690
+ t + a - c * S,
691
+ o + b - e * S,
692
+ t + a,
693
+ o + b - e,
694
+ t + a
695
+ ), L.lineTo(o + e, t + a), (e !== 0 || c !== 0) && L.bezierCurveTo(
696
+ o + e * S,
697
+ t + a,
698
+ o,
699
+ t + a - c * S,
700
+ o,
701
+ t + a - c
702
+ ), L.lineTo(o, t + c), (e !== 0 || c !== 0) && L.bezierCurveTo(o, t + c * S, o + e * S, t, o + e, t), L;
703
+ }
704
+ function k(r) {
705
+ function o(b, a, S) {
706
+ const L = m(a), D = m(S);
707
+ c === 0 ? e.moveTo(L, D) : e.lineTo(L, D), c++;
708
+ }
709
+ const t = /([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g, e = new ye();
710
+ let c = 0;
711
+ return r.getAttribute("points").replace(t, o), e.currentPath.autoClose = !0, e;
712
+ }
713
+ function z(r) {
714
+ function o(b, a, S) {
715
+ const L = m(a), D = m(S);
716
+ c === 0 ? e.moveTo(L, D) : e.lineTo(L, D), c++;
717
+ }
718
+ const t = /([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g, e = new ye();
719
+ let c = 0;
720
+ return r.getAttribute("points").replace(t, o), e.currentPath.autoClose = !1, e;
721
+ }
722
+ function O(r) {
723
+ const o = m(r.getAttribute("cx") || 0), t = m(r.getAttribute("cy") || 0), e = m(r.getAttribute("r") || 0), c = new Ee();
724
+ c.absarc(o, t, e, 0, Math.PI * 2);
725
+ const b = new ye();
726
+ return b.subPaths.push(c), b;
727
+ }
728
+ function C(r) {
729
+ const o = m(r.getAttribute("cx") || 0), t = m(r.getAttribute("cy") || 0), e = m(r.getAttribute("rx") || 0), c = m(r.getAttribute("ry") || 0), b = new Ee();
730
+ b.absellipse(o, t, e, c, 0, Math.PI * 2);
731
+ const a = new ye();
732
+ return a.subPaths.push(b), a;
733
+ }
734
+ function V(r) {
735
+ const o = m(r.getAttribute("x1") || 0), t = m(r.getAttribute("y1") || 0), e = m(r.getAttribute("x2") || 0), c = m(r.getAttribute("y2") || 0), b = new ye();
736
+ return b.moveTo(o, t), b.lineTo(e, c), b.currentPath.autoClose = !1, b;
737
+ }
738
+ function P(r, o) {
739
+ o = Object.assign({}, o);
740
+ let t = {};
741
+ if (r.hasAttribute("class")) {
742
+ const a = r.getAttribute("class").split(/\s/).filter(Boolean).map((S) => S.trim());
743
+ for (let S = 0; S < a.length; S++)
744
+ t = Object.assign(t, K["." + a[S]]);
745
+ }
746
+ r.hasAttribute("id") && (t = Object.assign(t, K["#" + r.getAttribute("id")]));
747
+ function e(a, S, L) {
748
+ L === void 0 && (L = function(f) {
749
+ return f.startsWith("url") && console.warn("SVGLoader: url access in attributes is not implemented."), f;
750
+ }), r.hasAttribute(a) && (o[S] = L(r.getAttribute(a))), t[a] && (o[S] = L(t[a])), r.style && r.style[a] !== "" && (o[S] = L(r.style[a]));
751
+ }
752
+ function c(a) {
753
+ return Math.max(0, Math.min(1, m(a)));
754
+ }
755
+ function b(a) {
756
+ return Math.max(0, m(a));
757
+ }
758
+ return e("fill", "fill"), e("fill-opacity", "fillOpacity", c), e("fill-rule", "fillRule"), e("opacity", "opacity", c), e("stroke", "stroke"), e("stroke-opacity", "strokeOpacity", c), e("stroke-width", "strokeWidth", b), e("stroke-linejoin", "strokeLineJoin"), e("stroke-linecap", "strokeLineCap"), e("stroke-miterlimit", "strokeMiterLimit", b), e("visibility", "visibility"), o;
759
+ }
760
+ function g(r, o) {
761
+ return r - (o - r);
762
+ }
763
+ function u(r, o, t) {
764
+ if (typeof r != "string")
765
+ throw new TypeError("Invalid input: " + typeof r);
766
+ const e = {
767
+ WHITESPACE: /[ \t\r\n]/,
768
+ DIGIT: /[\d]/,
769
+ SIGN: /[-+]/,
770
+ POINT: /\./,
771
+ COMMA: /,/,
772
+ EXP: /e/i,
773
+ FLAGS: /[01]/
774
+ }, c = 0, b = 1, a = 2, S = 3;
775
+ let L = c, D = !0, f = "", A = "";
776
+ const F = [];
777
+ function j($, ce, me) {
778
+ const se = new SyntaxError('Unexpected character "' + $ + '" at index ' + ce + ".");
779
+ throw se.partial = me, se;
780
+ }
781
+ function s() {
782
+ f !== "" && (A === "" ? F.push(Number(f)) : F.push(Number(f) * Math.pow(10, Number(A)))), f = "", A = "";
783
+ }
784
+ let n;
785
+ const H = r.length;
786
+ for (let $ = 0; $ < H; $++) {
787
+ if (n = r[$], Array.isArray(o) && o.includes(F.length % t) && e.FLAGS.test(n)) {
788
+ L = b, f = n, s();
789
+ continue;
790
+ }
791
+ if (L === c) {
792
+ if (e.WHITESPACE.test(n))
793
+ continue;
794
+ if (e.DIGIT.test(n) || e.SIGN.test(n)) {
795
+ L = b, f = n;
796
+ continue;
797
+ }
798
+ if (e.POINT.test(n)) {
799
+ L = a, f = n;
800
+ continue;
801
+ }
802
+ e.COMMA.test(n) && (D && j(n, $, F), D = !0);
803
+ }
804
+ if (L === b) {
805
+ if (e.DIGIT.test(n)) {
806
+ f += n;
807
+ continue;
808
+ }
809
+ if (e.POINT.test(n)) {
810
+ f += n, L = a;
811
+ continue;
812
+ }
813
+ if (e.EXP.test(n)) {
814
+ L = S;
815
+ continue;
816
+ }
817
+ e.SIGN.test(n) && f.length === 1 && e.SIGN.test(f[0]) && j(n, $, F);
818
+ }
819
+ if (L === a) {
820
+ if (e.DIGIT.test(n)) {
821
+ f += n;
822
+ continue;
823
+ }
824
+ if (e.EXP.test(n)) {
825
+ L = S;
826
+ continue;
827
+ }
828
+ e.POINT.test(n) && f[f.length - 1] === "." && j(n, $, F);
829
+ }
830
+ if (L === S) {
831
+ if (e.DIGIT.test(n)) {
832
+ A += n;
833
+ continue;
834
+ }
835
+ if (e.SIGN.test(n)) {
836
+ if (A === "") {
837
+ A += n;
838
+ continue;
839
+ }
840
+ A.length === 1 && e.SIGN.test(A) && j(n, $, F);
841
+ }
842
+ }
843
+ e.WHITESPACE.test(n) ? (s(), L = c, D = !1) : e.COMMA.test(n) ? (s(), L = c, D = !0) : e.SIGN.test(n) ? (s(), L = b, f = n) : e.POINT.test(n) ? (s(), L = a, f = n) : j(n, $, F);
844
+ }
845
+ return s(), F;
846
+ }
847
+ const E = ["mm", "cm", "in", "pt", "pc", "px"], y = {
848
+ mm: {
849
+ mm: 1,
850
+ cm: 0.1,
851
+ in: 1 / 25.4,
852
+ pt: 72 / 25.4,
853
+ pc: 6 / 25.4,
854
+ px: -1
855
+ },
856
+ cm: {
857
+ mm: 10,
858
+ cm: 1,
859
+ in: 1 / 2.54,
860
+ pt: 72 / 2.54,
861
+ pc: 6 / 2.54,
862
+ px: -1
863
+ },
864
+ in: {
865
+ mm: 25.4,
866
+ cm: 2.54,
867
+ in: 1,
868
+ pt: 72,
869
+ pc: 6,
870
+ px: -1
871
+ },
872
+ pt: {
873
+ mm: 25.4 / 72,
874
+ cm: 2.54 / 72,
875
+ in: 1 / 72,
876
+ pt: 1,
877
+ pc: 6 / 72,
878
+ px: -1
879
+ },
880
+ pc: {
881
+ mm: 25.4 / 6,
882
+ cm: 2.54 / 6,
883
+ in: 1 / 6,
884
+ pt: 72 / 6,
885
+ pc: 1,
886
+ px: -1
887
+ },
888
+ px: {
889
+ px: 1
890
+ }
891
+ };
892
+ function m(r) {
893
+ let o = "px";
894
+ if (typeof r == "string" || r instanceof String)
895
+ for (let e = 0, c = E.length; e < c; e++) {
896
+ const b = E[e];
897
+ if (r.endsWith(b)) {
898
+ o = b, r = r.substring(0, r.length - b.length);
899
+ break;
900
+ }
901
+ }
902
+ let t;
903
+ return o === "px" && M.defaultUnit !== "px" ? t = y.in[M.defaultUnit] / M.defaultDPI : (t = y[o][M.defaultUnit], t < 0 && (t = y[o].in * M.defaultDPI)), t * parseFloat(r);
904
+ }
905
+ function v(r) {
906
+ if (!(r.hasAttribute("transform") || r.nodeName === "use" && (r.hasAttribute("x") || r.hasAttribute("y"))))
907
+ return null;
908
+ const o = U(r);
909
+ return Z.length > 0 && o.premultiply(Z[Z.length - 1]), ie.copy(o), Z.push(o), o;
910
+ }
911
+ function U(r) {
912
+ const o = new ge(), t = oe;
913
+ if (r.nodeName === "use" && (r.hasAttribute("x") || r.hasAttribute("y"))) {
914
+ const e = m(r.getAttribute("x")), c = m(r.getAttribute("y"));
915
+ o.translate(e, c);
916
+ }
917
+ if (r.hasAttribute("transform")) {
918
+ const e = r.getAttribute("transform").split(")");
919
+ for (let c = e.length - 1; c >= 0; c--) {
920
+ const b = e[c].trim();
921
+ if (b === "") continue;
922
+ const a = b.indexOf("("), S = b.length;
923
+ if (a > 0 && a < S) {
924
+ const L = b.slice(0, a), D = u(b.slice(a + 1));
925
+ switch (t.identity(), L) {
926
+ case "translate":
927
+ if (D.length >= 1) {
928
+ const f = D[0];
929
+ let A = 0;
930
+ D.length >= 2 && (A = D[1]), t.translate(f, A);
931
+ }
932
+ break;
933
+ case "rotate":
934
+ if (D.length >= 1) {
935
+ let f = 0, A = 0, F = 0;
936
+ f = D[0] * Math.PI / 180, D.length >= 3 && (A = D[1], F = D[2]), J.makeTranslation(-A, -F), X.makeRotation(f), x.multiplyMatrices(X, J), J.makeTranslation(A, F), t.multiplyMatrices(J, x);
937
+ }
938
+ break;
939
+ case "scale":
940
+ if (D.length >= 1) {
941
+ const f = D[0];
942
+ let A = f;
943
+ D.length >= 2 && (A = D[1]), t.scale(f, A);
944
+ }
945
+ break;
946
+ case "skewX":
947
+ D.length === 1 && t.set(
948
+ 1,
949
+ Math.tan(D[0] * Math.PI / 180),
950
+ 0,
951
+ 0,
952
+ 1,
953
+ 0,
954
+ 0,
955
+ 0,
956
+ 1
957
+ );
958
+ break;
959
+ case "skewY":
960
+ D.length === 1 && t.set(
961
+ 1,
962
+ 0,
963
+ 0,
964
+ Math.tan(D[0] * Math.PI / 180),
965
+ 1,
966
+ 0,
967
+ 0,
968
+ 0,
969
+ 1
970
+ );
971
+ break;
972
+ case "matrix":
973
+ D.length === 6 && t.set(
974
+ D[0],
975
+ D[2],
976
+ D[4],
977
+ D[1],
978
+ D[3],
979
+ D[5],
980
+ 0,
981
+ 0,
982
+ 1
983
+ );
984
+ break;
985
+ }
986
+ }
987
+ o.premultiply(t);
988
+ }
989
+ }
990
+ return o;
991
+ }
992
+ function d(r, o) {
993
+ function t(a) {
994
+ ee.set(a.x, a.y, 1).applyMatrix3(o), a.set(ee.x, ee.y);
995
+ }
996
+ function e(a) {
997
+ const S = a.xRadius, L = a.yRadius, D = Math.cos(a.aRotation), f = Math.sin(a.aRotation), A = new Ae(S * D, S * f, 0), F = new Ae(-L * f, L * D, 0), j = A.applyMatrix3(o), s = F.applyMatrix3(o), n = oe.set(
998
+ j.x,
999
+ s.x,
1000
+ 0,
1001
+ j.y,
1002
+ s.y,
1003
+ 0,
1004
+ 0,
1005
+ 0,
1006
+ 1
1007
+ ), H = J.copy(n).invert(), me = X.copy(H).transpose().multiply(H).elements, se = Y(me[0], me[1], me[4]), pe = Math.sqrt(se.rt1), xe = Math.sqrt(se.rt2);
1008
+ if (a.xRadius = 1 / pe, a.yRadius = 1 / xe, a.aRotation = Math.atan2(se.sn, se.cs), !((a.aEndAngle - a.aStartAngle) % (2 * Math.PI) < Number.EPSILON)) {
1009
+ const we = J.set(
1010
+ pe,
1011
+ 0,
1012
+ 0,
1013
+ 0,
1014
+ xe,
1015
+ 0,
1016
+ 0,
1017
+ 0,
1018
+ 1
1019
+ ), Ie = X.set(
1020
+ se.cs,
1021
+ se.sn,
1022
+ 0,
1023
+ -se.sn,
1024
+ se.cs,
1025
+ 0,
1026
+ 0,
1027
+ 0,
1028
+ 1
1029
+ ), ke = we.multiply(Ie).multiply(n), Re = (Le) => {
1030
+ const { x: qe, y: Xe } = new Ae(Math.cos(Le), Math.sin(Le), 0).applyMatrix3(ke);
1031
+ return Math.atan2(Xe, qe);
1032
+ };
1033
+ a.aStartAngle = Re(a.aStartAngle), a.aEndAngle = Re(a.aEndAngle), w(o) && (a.aClockwise = !a.aClockwise);
1034
+ }
1035
+ }
1036
+ function c(a) {
1037
+ const S = _(o), L = q(o);
1038
+ a.xRadius *= S, a.yRadius *= L;
1039
+ const D = S > Number.EPSILON ? Math.atan2(o.elements[1], o.elements[0]) : Math.atan2(-o.elements[3], o.elements[4]);
1040
+ a.aRotation += D, w(o) && (a.aStartAngle *= -1, a.aEndAngle *= -1, a.aClockwise = !a.aClockwise);
1041
+ }
1042
+ const b = r.subPaths;
1043
+ for (let a = 0, S = b.length; a < S; a++) {
1044
+ const D = b[a].curves;
1045
+ for (let f = 0; f < D.length; f++) {
1046
+ const A = D[f];
1047
+ A.isLineCurve ? (t(A.v1), t(A.v2)) : A.isCubicBezierCurve ? (t(A.v0), t(A.v1), t(A.v2), t(A.v3)) : A.isQuadraticBezierCurve ? (t(A.v0), t(A.v1), t(A.v2)) : A.isEllipseCurve && (ne.set(A.aX, A.aY), t(ne), A.aX = ne.x, A.aY = ne.y, T(o) ? e(A) : c(A));
1048
+ }
1049
+ }
1050
+ }
1051
+ function w(r) {
1052
+ const o = r.elements;
1053
+ return o[0] * o[4] - o[1] * o[3] < 0;
1054
+ }
1055
+ function T(r) {
1056
+ const o = r.elements, t = o[0] * o[3] + o[1] * o[4];
1057
+ if (t === 0) return !1;
1058
+ const e = _(r), c = q(r);
1059
+ return Math.abs(t / (e * c)) > Number.EPSILON;
1060
+ }
1061
+ function _(r) {
1062
+ const o = r.elements;
1063
+ return Math.sqrt(o[0] * o[0] + o[1] * o[1]);
1064
+ }
1065
+ function q(r) {
1066
+ const o = r.elements;
1067
+ return Math.sqrt(o[3] * o[3] + o[4] * o[4]);
1068
+ }
1069
+ function Y(r, o, t) {
1070
+ let e, c, b, a, S;
1071
+ const L = r + t, D = r - t, f = Math.sqrt(D * D + 4 * o * o);
1072
+ return L > 0 ? (e = 0.5 * (L + f), S = 1 / e, c = r * S * t - o * S * o) : L < 0 ? c = 0.5 * (L - f) : (e = 0.5 * f, c = -0.5 * f), D > 0 ? b = D + f : b = D - f, Math.abs(b) > 2 * Math.abs(o) ? (S = -2 * o / b, a = 1 / Math.sqrt(1 + S * S), b = S * a) : Math.abs(o) === 0 ? (b = 1, a = 0) : (S = -0.5 * b / o, b = 1 / Math.sqrt(1 + S * S), a = S * b), D > 0 && (S = b, b = -a, a = S), { rt1: e, rt2: c, cs: b, sn: a };
1073
+ }
1074
+ const G = [], K = {}, Z = [], oe = new ge(), J = new ge(), X = new ge(), x = new ge(), ne = new Q(), ee = new Ae(), ie = new ge(), de = new DOMParser().parseFromString(i, "image/svg+xml");
1075
+ return I(de.documentElement, {
1076
+ fill: "#000",
1077
+ fillOpacity: 1,
1078
+ strokeOpacity: 1,
1079
+ strokeWidth: 1,
1080
+ strokeLineJoin: "miter",
1081
+ strokeLineCap: "butt",
1082
+ strokeMiterLimit: 4
1083
+ }), { paths: G, xml: de.documentElement };
1084
+ }
1085
+ /**
1086
+ * Creates from the given shape path and array of shapes.
1087
+ *
1088
+ * @param {ShapePath} shapePath - The shape path.
1089
+ * @return {Array<Shape>} An array of shapes.
1090
+ */
1091
+ static createShapes(i) {
1092
+ const I = {
1093
+ ORIGIN: 0,
1094
+ DESTINATION: 1,
1095
+ BETWEEN: 2,
1096
+ LEFT: 3,
1097
+ RIGHT: 4,
1098
+ BEHIND: 5,
1099
+ BEYOND: 6
1100
+ }, N = {
1101
+ loc: I.ORIGIN,
1102
+ t: 0
1103
+ };
1104
+ function h(g, u, E, y) {
1105
+ const m = g.x, v = u.x, U = E.x, d = y.x, w = g.y, T = u.y, _ = E.y, q = y.y, Y = (d - U) * (w - _) - (q - _) * (m - U), G = (v - m) * (w - _) - (T - w) * (m - U), K = (q - _) * (v - m) - (d - U) * (T - w), Z = Y / K, oe = G / K;
1106
+ if (K === 0 && Y !== 0 || Z <= 0 || Z >= 1 || oe < 0 || oe > 1)
1107
+ return null;
1108
+ if (Y === 0 && K === 0) {
1109
+ for (let J = 0; J < 2; J++)
1110
+ if (B(J === 0 ? E : y, g, u), N.loc == I.ORIGIN) {
1111
+ const X = J === 0 ? E : y;
1112
+ return { x: X.x, y: X.y, t: N.t };
1113
+ } else if (N.loc == I.BETWEEN) {
1114
+ const X = +(m + N.t * (v - m)).toPrecision(10), x = +(w + N.t * (T - w)).toPrecision(10);
1115
+ return { x: X, y: x, t: N.t };
1116
+ }
1117
+ return null;
1118
+ } else {
1119
+ for (let x = 0; x < 2; x++)
1120
+ if (B(x === 0 ? E : y, g, u), N.loc == I.ORIGIN) {
1121
+ const ne = x === 0 ? E : y;
1122
+ return { x: ne.x, y: ne.y, t: N.t };
1123
+ }
1124
+ const J = +(m + Z * (v - m)).toPrecision(10), X = +(w + Z * (T - w)).toPrecision(10);
1125
+ return { x: J, y: X, t: Z };
1126
+ }
1127
+ }
1128
+ function B(g, u, E) {
1129
+ const y = E.x - u.x, m = E.y - u.y, v = g.x - u.x, U = g.y - u.y, d = y * U - v * m;
1130
+ if (g.x === u.x && g.y === u.y) {
1131
+ N.loc = I.ORIGIN, N.t = 0;
1132
+ return;
1133
+ }
1134
+ if (g.x === E.x && g.y === E.y) {
1135
+ N.loc = I.DESTINATION, N.t = 1;
1136
+ return;
1137
+ }
1138
+ if (d < -Number.EPSILON) {
1139
+ N.loc = I.LEFT;
1140
+ return;
1141
+ }
1142
+ if (d > Number.EPSILON) {
1143
+ N.loc = I.RIGHT;
1144
+ return;
1145
+ }
1146
+ if (y * v < 0 || m * U < 0) {
1147
+ N.loc = I.BEHIND;
1148
+ return;
1149
+ }
1150
+ if (Math.sqrt(y * y + m * m) < Math.sqrt(v * v + U * U)) {
1151
+ N.loc = I.BEYOND;
1152
+ return;
1153
+ }
1154
+ let w;
1155
+ y !== 0 ? w = v / y : w = U / m, N.loc = I.BETWEEN, N.t = w;
1156
+ }
1157
+ function W(g, u) {
1158
+ const E = [], y = [];
1159
+ for (let m = 1; m < g.length; m++) {
1160
+ const v = g[m - 1], U = g[m];
1161
+ for (let d = 1; d < u.length; d++) {
1162
+ const w = u[d - 1], T = u[d], _ = h(v, U, w, T);
1163
+ _ !== null && E.find((q) => q.t <= _.t + Number.EPSILON && q.t >= _.t - Number.EPSILON) === void 0 && (E.push(_), y.push(new Q(_.x, _.y)));
1164
+ }
1165
+ }
1166
+ return y;
1167
+ }
1168
+ function p(g, u, E) {
1169
+ const y = new Q();
1170
+ u.getCenter(y);
1171
+ const m = [];
1172
+ return E.forEach((v) => {
1173
+ v.boundingBox.containsPoint(y) && W(g, v.points).forEach((d) => {
1174
+ m.push({ identifier: v.identifier, isCW: v.isCW, point: d });
1175
+ });
1176
+ }), m.sort((v, U) => v.point.x - U.point.x), m;
1177
+ }
1178
+ function k(g, u, E, y, m) {
1179
+ (m == null || m === "") && (m = "nonzero");
1180
+ const v = new Q();
1181
+ g.boundingBox.getCenter(v);
1182
+ const U = [new Q(E, v.y), new Q(y, v.y)], d = p(U, g.boundingBox, u);
1183
+ d.sort((G, K) => G.point.x - K.point.x);
1184
+ const w = [], T = [];
1185
+ d.forEach((G) => {
1186
+ G.identifier === g.identifier ? w.push(G) : T.push(G);
1187
+ });
1188
+ const _ = w[0].point.x, q = [];
1189
+ let Y = 0;
1190
+ for (; Y < T.length && T[Y].point.x < _; )
1191
+ q.length > 0 && q[q.length - 1] === T[Y].identifier ? q.pop() : q.push(T[Y].identifier), Y++;
1192
+ if (q.push(g.identifier), m === "evenodd") {
1193
+ const G = q.length % 2 === 0, K = q[q.length - 2];
1194
+ return { identifier: g.identifier, isHole: G, for: K };
1195
+ } else if (m === "nonzero") {
1196
+ let G = !0, K = null, Z = null;
1197
+ for (let oe = 0; oe < q.length; oe++) {
1198
+ const J = q[oe];
1199
+ G ? (Z = u[J].isCW, G = !1, K = J) : Z !== u[J].isCW && (Z = u[J].isCW, G = !0);
1200
+ }
1201
+ return { identifier: g.identifier, isHole: G, for: K };
1202
+ } else
1203
+ console.warn('fill-rule: "' + m + '" is currently not implemented.');
1204
+ }
1205
+ let z = 999999999, O = -999999999, C = i.subPaths.map((g) => {
1206
+ const u = g.getPoints();
1207
+ let E = -999999999, y = 999999999, m = -999999999, v = 999999999;
1208
+ for (let U = 0; U < u.length; U++) {
1209
+ const d = u[U];
1210
+ d.y > E && (E = d.y), d.y < y && (y = d.y), d.x > m && (m = d.x), d.x < v && (v = d.x);
1211
+ }
1212
+ return O <= m && (O = m + 1), z >= v && (z = v - 1), { curves: g.curves, points: u, isCW: kt.isClockWise(u), identifier: -1, boundingBox: new wt(new Q(v, y), new Q(m, E)) };
1213
+ });
1214
+ C = C.filter((g) => g.points.length > 1);
1215
+ for (let g = 0; g < C.length; g++)
1216
+ C[g].identifier = g;
1217
+ const V = C.map((g) => k(g, C, z, O, i.userData ? i.userData.style.fillRule : void 0)), P = [];
1218
+ return C.forEach((g) => {
1219
+ if (!V[g.identifier].isHole) {
1220
+ const E = new At();
1221
+ E.curves = g.curves, V.filter((m) => m.isHole && m.for === g.identifier).forEach((m) => {
1222
+ const v = C[m.identifier], U = new Ee();
1223
+ U.curves = v.curves, E.holes.push(U);
1224
+ }), P.push(E);
1225
+ }
1226
+ }), P;
1227
+ }
1228
+ /**
1229
+ * Returns a stroke style object from the given parameters.
1230
+ *
1231
+ * @param {number} [width=1] - The stroke width.
1232
+ * @param {string} [color='#000'] - The stroke color, as returned by {@link Color#getStyle}.
1233
+ * @param {'round'|'bevel'|'miter'|'miter-limit'} [lineJoin='miter'] - The line join style.
1234
+ * @param {'round'|'square'|'butt'} [lineCap='butt'] - The line cap style.
1235
+ * @param {number} [miterLimit=4] - Maximum join length, in multiples of the `width` parameter (join is truncated if it exceeds that distance).
1236
+ * @return {Object} The style object.
1237
+ */
1238
+ static getStrokeStyle(i, M, I, N, h) {
1239
+ return i = i !== void 0 ? i : 1, M = M !== void 0 ? M : "#000", I = I !== void 0 ? I : "miter", N = N !== void 0 ? N : "butt", h = h !== void 0 ? h : 4, {
1240
+ strokeColor: M,
1241
+ strokeWidth: i,
1242
+ strokeLineJoin: I,
1243
+ strokeLineCap: N,
1244
+ strokeMiterLimit: h
1245
+ };
1246
+ }
1247
+ /**
1248
+ * Creates a stroke from an array of points.
1249
+ *
1250
+ * @param {Array<Vector2>} points - The points in 2D space. Minimum 2 points. The path can be open or closed (last point equals to first point).
1251
+ * @param {Object} style - Object with SVG properties as returned by `SVGLoader.getStrokeStyle()`, or `SVGLoader.parse()` in the `path.userData.style` object.
1252
+ * @param {number} [arcDivisions=12] - Arc divisions for round joins and endcaps.
1253
+ * @param {number} [minDistance=0.001] - Points closer to this distance will be merged.
1254
+ * @return {?BufferGeometry} The stroke geometry. UV coordinates are generated ('u' along path. 'v' across it, from left to right).
1255
+ * Returns `null` if not geometry was generated.
1256
+ */
1257
+ static pointsToStroke(i, M, I, N) {
1258
+ const h = [], B = [], W = [];
1259
+ if (Me.pointsToStrokeWithBuffers(i, M, I, N, h, B, W) === 0)
1260
+ return null;
1261
+ const p = new Mt();
1262
+ return p.setAttribute("position", new Ce(h, 3)), p.setAttribute("normal", new Ce(B, 3)), p.setAttribute("uv", new Ce(W, 2)), p;
1263
+ }
1264
+ /**
1265
+ * Creates a stroke from an array of points.
1266
+ *
1267
+ * @param {Array<Vector2>} points - The points in 2D space. Minimum 2 points.
1268
+ * @param {Object} style - Object with SVG properties as returned by `SVGLoader.getStrokeStyle()`, or `SVGLoader.parse()` in the `path.userData.style` object.
1269
+ * @param {number} [arcDivisions=12] - Arc divisions for round joins and endcaps.
1270
+ * @param {number} [minDistance=0.001] - Points closer to this distance will be merged.
1271
+ * @param {Array<number>} vertices - An array holding vertices.
1272
+ * @param {Array<number>} normals - An array holding normals.
1273
+ * @param {Array<number>} uvs - An array holding uvs.
1274
+ * @param {number} [vertexOffset=0] - The vertex offset.
1275
+ * @return {number} The number of vertices.
1276
+ */
1277
+ static pointsToStrokeWithBuffers(i, M, I, N, h, B, W, p) {
1278
+ const k = new Q(), z = new Q(), O = new Q(), C = new Q(), V = new Q(), P = new Q(), g = new Q(), u = new Q(), E = new Q(), y = new Q(), m = new Q(), v = new Q(), U = new Q(), d = new Q(), w = new Q(), T = new Q(), _ = new Q();
1279
+ I = I !== void 0 ? I : 12, N = N !== void 0 ? N : 1e-3, p = p !== void 0 ? p : 0, i = D(i);
1280
+ const q = i.length;
1281
+ if (q < 2) return 0;
1282
+ const Y = i[0].equals(i[q - 1]);
1283
+ let G, K = i[0], Z;
1284
+ const oe = M.strokeWidth / 2, J = 1 / (q - 1);
1285
+ let X = 0, x, ne, ee, ie, de = !1, fe = 0, r = p * 3, o = p * 2;
1286
+ t(i[0], i[1], k).multiplyScalar(oe), u.copy(i[0]).sub(k), E.copy(i[0]).add(k), y.copy(u), m.copy(E);
1287
+ for (let f = 1; f < q; f++) {
1288
+ G = i[f], f === q - 1 ? Y ? Z = i[1] : Z = void 0 : Z = i[f + 1];
1289
+ const A = k;
1290
+ if (t(K, G, A), O.copy(A).multiplyScalar(oe), v.copy(G).sub(O), U.copy(G).add(O), x = X + J, ne = !1, Z !== void 0) {
1291
+ t(G, Z, z), O.copy(z).multiplyScalar(oe), d.copy(G).sub(O), w.copy(G).add(O), ee = !0, O.subVectors(Z, K), A.dot(O) < 0 && (ee = !1), f === 1 && (de = ee), O.subVectors(Z, G), O.normalize();
1292
+ const F = Math.abs(A.dot(O));
1293
+ if (F > Number.EPSILON) {
1294
+ const j = oe / F;
1295
+ O.multiplyScalar(-j), C.subVectors(G, K), V.copy(C).setLength(j).add(O), T.copy(V).negate();
1296
+ const s = V.length(), n = C.length();
1297
+ C.divideScalar(n), P.subVectors(Z, G);
1298
+ const H = P.length();
1299
+ switch (P.divideScalar(H), C.dot(T) < n && P.dot(T) < H && (ne = !0), _.copy(V).add(G), T.add(G), ie = !1, ne ? ee ? (w.copy(T), U.copy(T)) : (d.copy(T), v.copy(T)) : b(), M.strokeLineJoin) {
1300
+ case "bevel":
1301
+ a(ee, ne, x);
1302
+ break;
1303
+ case "round":
1304
+ S(ee, ne), ee ? c(G, v, d, x, 0) : c(G, w, U, x, 1);
1305
+ break;
1306
+ case "miter":
1307
+ case "miter-clip":
1308
+ default:
1309
+ const $ = oe * M.strokeMiterLimit / s;
1310
+ if ($ < 1)
1311
+ if (M.strokeLineJoin !== "miter-clip") {
1312
+ a(ee, ne, x);
1313
+ break;
1314
+ } else
1315
+ S(ee, ne), ee ? (P.subVectors(_, v).multiplyScalar($).add(v), g.subVectors(_, d).multiplyScalar($).add(d), e(v, x, 0), e(P, x, 0), e(G, x, 0.5), e(G, x, 0.5), e(P, x, 0), e(g, x, 0), e(G, x, 0.5), e(g, x, 0), e(d, x, 0)) : (P.subVectors(_, U).multiplyScalar($).add(U), g.subVectors(_, w).multiplyScalar($).add(w), e(U, x, 1), e(P, x, 1), e(G, x, 0.5), e(G, x, 0.5), e(P, x, 1), e(g, x, 1), e(G, x, 0.5), e(g, x, 1), e(w, x, 1));
1316
+ else
1317
+ ne ? (ee ? (e(E, X, 1), e(u, X, 0), e(_, x, 0), e(E, X, 1), e(_, x, 0), e(T, x, 1)) : (e(E, X, 1), e(u, X, 0), e(_, x, 1), e(u, X, 0), e(T, x, 0), e(_, x, 1)), ee ? d.copy(_) : w.copy(_)) : ee ? (e(v, x, 0), e(_, x, 0), e(G, x, 0.5), e(G, x, 0.5), e(_, x, 0), e(d, x, 0)) : (e(U, x, 1), e(_, x, 1), e(G, x, 0.5), e(G, x, 0.5), e(_, x, 1), e(w, x, 1)), ie = !0;
1318
+ break;
1319
+ }
1320
+ } else
1321
+ b();
1322
+ } else
1323
+ b();
1324
+ !Y && f === q - 1 && L(i[0], y, m, ee, !0, X), X = x, K = G, u.copy(d), E.copy(w);
1325
+ }
1326
+ if (!Y)
1327
+ L(G, v, U, ee, !1, x);
1328
+ else if (ne && h) {
1329
+ let f = _, A = T;
1330
+ de !== ee && (f = T, A = _), ee ? (ie || de) && (A.toArray(h, 0 * 3), A.toArray(h, 3 * 3), ie && f.toArray(h, 1 * 3)) : (ie || !de) && (A.toArray(h, 1 * 3), A.toArray(h, 3 * 3), ie && f.toArray(h, 0 * 3));
1331
+ }
1332
+ return fe;
1333
+ function t(f, A, F) {
1334
+ return F.subVectors(A, f), F.set(-F.y, F.x).normalize();
1335
+ }
1336
+ function e(f, A, F) {
1337
+ h && (h[r] = f.x, h[r + 1] = f.y, h[r + 2] = 0, B && (B[r] = 0, B[r + 1] = 0, B[r + 2] = 1), r += 3, W && (W[o] = A, W[o + 1] = F, o += 2)), fe += 3;
1338
+ }
1339
+ function c(f, A, F, j, s) {
1340
+ k.copy(A).sub(f).normalize(), z.copy(F).sub(f).normalize();
1341
+ let n = Math.PI;
1342
+ const H = k.dot(z);
1343
+ Math.abs(H) < 1 && (n = Math.abs(Math.acos(H))), n /= I, O.copy(A);
1344
+ for (let $ = 0, ce = I - 1; $ < ce; $++)
1345
+ C.copy(O).rotateAround(f, n), e(O, j, s), e(C, j, s), e(f, j, 0.5), O.copy(C);
1346
+ e(C, j, s), e(F, j, s), e(f, j, 0.5);
1347
+ }
1348
+ function b() {
1349
+ e(E, X, 1), e(u, X, 0), e(v, x, 0), e(E, X, 1), e(v, x, 0), e(U, x, 1);
1350
+ }
1351
+ function a(f, A, F) {
1352
+ A ? f ? (e(E, X, 1), e(u, X, 0), e(v, x, 0), e(E, X, 1), e(v, x, 0), e(T, x, 1), e(v, F, 0), e(d, F, 0), e(T, F, 0.5)) : (e(E, X, 1), e(u, X, 0), e(U, x, 1), e(u, X, 0), e(T, x, 0), e(U, x, 1), e(U, F, 1), e(T, F, 0), e(w, F, 1)) : f ? (e(v, F, 0), e(d, F, 0), e(G, F, 0.5)) : (e(U, F, 1), e(w, F, 0), e(G, F, 0.5));
1353
+ }
1354
+ function S(f, A) {
1355
+ A && (f ? (e(E, X, 1), e(u, X, 0), e(v, x, 0), e(E, X, 1), e(v, x, 0), e(T, x, 1), e(v, X, 0), e(G, x, 0.5), e(T, x, 1), e(G, x, 0.5), e(d, X, 0), e(T, x, 1)) : (e(E, X, 1), e(u, X, 0), e(U, x, 1), e(u, X, 0), e(T, x, 0), e(U, x, 1), e(U, X, 1), e(T, x, 0), e(G, x, 0.5), e(G, x, 0.5), e(T, x, 0), e(w, X, 1)));
1356
+ }
1357
+ function L(f, A, F, j, s, n) {
1358
+ switch (M.strokeLineCap) {
1359
+ case "round":
1360
+ s ? c(f, F, A, n, 0.5) : c(f, A, F, n, 0.5);
1361
+ break;
1362
+ case "square":
1363
+ if (s)
1364
+ k.subVectors(A, f), z.set(k.y, -k.x), O.addVectors(k, z).add(f), C.subVectors(z, k).add(f), j ? (O.toArray(h, 1 * 3), C.toArray(h, 0 * 3), C.toArray(h, 3 * 3)) : (O.toArray(h, 1 * 3), W[3 * 2 + 1] === 1 ? C.toArray(h, 3 * 3) : O.toArray(h, 3 * 3), C.toArray(h, 0 * 3));
1365
+ else {
1366
+ k.subVectors(F, f), z.set(k.y, -k.x), O.addVectors(k, z).add(f), C.subVectors(z, k).add(f);
1367
+ const H = h.length;
1368
+ j ? (O.toArray(h, H - 1 * 3), C.toArray(h, H - 2 * 3), C.toArray(h, H - 4 * 3)) : (C.toArray(h, H - 2 * 3), O.toArray(h, H - 1 * 3), C.toArray(h, H - 4 * 3));
1369
+ }
1370
+ break;
1371
+ }
1372
+ }
1373
+ function D(f) {
1374
+ let A = !1;
1375
+ for (let j = 1, s = f.length - 1; j < s; j++)
1376
+ if (f[j].distanceTo(f[j + 1]) < N) {
1377
+ A = !0;
1378
+ break;
1379
+ }
1380
+ if (!A) return f;
1381
+ const F = [];
1382
+ F.push(f[0]);
1383
+ for (let j = 1, s = f.length - 1; j < s; j++)
1384
+ f[j].distanceTo(f[j + 1]) >= N && F.push(f[j]);
1385
+ return F.push(f[f.length - 1]), F;
1386
+ }
1387
+ }
1388
+ }
1389
+ const Lt = -2;
1390
+ function Bt(l) {
1391
+ if (!l || l.nodeType !== 1) return;
1392
+ let i = l;
1393
+ for (; i; ) {
1394
+ const M = i.getAttribute("id");
1395
+ if (M) return M;
1396
+ i = i.parentElement;
1397
+ }
1398
+ }
1399
+ function Se(l) {
1400
+ if (!l) return !1;
1401
+ let i = l;
1402
+ for (; i; ) {
1403
+ const M = i.getAttribute("id") ?? "", I = i.getAttribute("data-name") ?? "";
1404
+ if (Oe(M) || Oe(I) || _e(M) || _e(I)) return !0;
1405
+ i = i.parentElement;
1406
+ }
1407
+ return !1;
1408
+ }
1409
+ function Dt({
1410
+ url: l,
1411
+ suppressIds: i,
1412
+ imageProxyUrl: M,
1413
+ is3d: I = !1
1414
+ }) {
1415
+ const [N, h] = ae(null);
1416
+ le(() => {
1417
+ let W = !1;
1418
+ const p = it(l, M);
1419
+ return fetch(p).then((k) => {
1420
+ if (!k.ok) throw new Error(`SVG fetch ${k.status}`);
1421
+ return k.text();
1422
+ }).then((k) => {
1423
+ if (W) return;
1424
+ const z = ot(k), O = new Me();
1425
+ h(O.parse(z));
1426
+ }).catch((k) => {
1427
+ W || (h(null), console.warn(
1428
+ `[eyeon-map] Outdoor SVG failed to load from ${p}. If this is a cross-origin error, pass \`imageProxyUrl\` to MapViewer.`,
1429
+ k
1430
+ ));
1431
+ }), () => {
1432
+ W = !0;
1433
+ };
1434
+ }, [l, M]);
1435
+ const B = re(() => {
1436
+ var k, z, O;
1437
+ if (!N) return [];
1438
+ const W = [];
1439
+ let p = 0;
1440
+ for (const C of N.paths) {
1441
+ const V = (k = C.userData) == null ? void 0 : k.node, P = Bt(V);
1442
+ if (P != null && P.toLowerCase().startsWith("route-path") || P && (rt(P) || st(P)) || P && (i != null && i.has(P)) || Se(V) && !P || P && (Oe(P) || _e(P)) || V && Se(V) && P && (i != null && i.has(P)) || V && Se(V)) continue;
1443
+ const g = Me.createShapes(C);
1444
+ if (g.length === 0) continue;
1445
+ const u = We(P), E = new ue.Color();
1446
+ u != null && u.fill ? E.set(u.fill) : C.color ? E.copy(C.color) : E.set("#cccccc"), u != null && u.stroke && !u.fill && E.set(u.stroke);
1447
+ const y = typeof ((O = (z = C.userData) == null ? void 0 : z.style) == null ? void 0 : O.opacity) == "number" ? C.userData.style.opacity : 1, m = I && (u == null ? void 0 : u.extrudeHeight) != null ? u.extrudeHeight : 0;
1448
+ W.push({
1449
+ key: `${P ?? "path"}-${p++}`,
1450
+ shapes: g,
1451
+ color: E,
1452
+ opacity: y,
1453
+ extrude: m,
1454
+ renderOrder: (u == null ? void 0 : u.renderOrder) ?? 2
1455
+ });
1456
+ }
1457
+ return W;
1458
+ }, [N, i, I]);
1459
+ return !N || B.length === 0 ? null : /* @__PURE__ */ R("group", { position: [0, 0, Lt], renderOrder: -20, children: B.map(
1460
+ (W) => W.shapes.map((p, k) => /* @__PURE__ */ te("mesh", { renderOrder: W.renderOrder, children: [
1461
+ W.extrude > 0 ? /* @__PURE__ */ R(
1462
+ "extrudeGeometry",
1463
+ {
1464
+ args: [p, { depth: W.extrude, bevelEnabled: !1 }]
1465
+ }
1466
+ ) : /* @__PURE__ */ R("shapeGeometry", { args: [p] }),
1467
+ /* @__PURE__ */ R(
1468
+ "meshBasicMaterial",
1469
+ {
1470
+ color: W.color,
1471
+ transparent: W.opacity < 1,
1472
+ opacity: W.opacity,
1473
+ depthWrite: !1,
1474
+ toneMapped: !1,
1475
+ side: ue.DoubleSide
1476
+ }
1477
+ )
1478
+ ] }, `${W.key}-${k}`))
1479
+ ) });
1480
+ }
1481
+ const Gt = [1, -1, 1];
1482
+ function zt(l) {
1483
+ return {
1484
+ ...l,
1485
+ minY: -l.maxY,
1486
+ maxY: -l.minY,
1487
+ cy: -l.cy
1488
+ };
1489
+ }
1490
+ function ze(l, i, M, I) {
1491
+ const N = Math.max(l, 1) / Math.max(M, 1), h = Math.max(i, 1) / Math.max(I, 1);
1492
+ return Math.min(N, h);
1493
+ }
1494
+ function Ve(l) {
1495
+ return {
1496
+ width: Math.max(l.maxX - l.minX, 1),
1497
+ height: Math.max(l.maxY - l.minY, 1)
1498
+ };
1499
+ }
1500
+ const Vt = 240;
1501
+ function Ft(l) {
1502
+ return 1 - (1 - Math.min(1, Math.max(0, l))) ** 3;
1503
+ }
1504
+ function jt(l, i, M) {
1505
+ return l + (i - l) * M;
1506
+ }
1507
+ function Ht(l, i, M, I, N) {
1508
+ const h = 1 + Math.min(Math.max(M, 0.15), 1) * 0.5, B = i > 0 ? l * h : l / h;
1509
+ return Math.min(N, Math.max(I, B));
1510
+ }
1511
+ const Ut = 0, Fe = 1, ve = 2, Wt = 0, qt = 1, je = 2;
1512
+ function Xt(l) {
1513
+ return l ? { LEFT: Ut, MIDDLE: Fe, RIGHT: ve } : { LEFT: ve, MIDDLE: Fe, RIGHT: ve };
1514
+ }
1515
+ function Yt(l) {
1516
+ return l ? { ONE: Wt, TWO: je } : { ONE: qt, TWO: je };
1517
+ }
1518
+ function $t({
1519
+ bounds: l,
1520
+ theme: i,
1521
+ is3d: M,
1522
+ controlsRef: I,
1523
+ cameraRef: N
1524
+ }) {
1525
+ const { camera: h, size: B, invalidate: W } = ht(), p = he(!1), k = he(null), z = be(() => {
1526
+ k.current != null && (cancelAnimationFrame(k.current), k.current = null);
1527
+ }, []), O = be(
1528
+ (g) => {
1529
+ if (!(h instanceof ue.OrthographicCamera)) return;
1530
+ z();
1531
+ const u = h.zoom;
1532
+ if (u === g) return;
1533
+ const E = performance.now(), y = (m) => {
1534
+ if (!(h instanceof ue.OrthographicCamera)) return;
1535
+ const v = Math.min(1, (m - E) / Vt);
1536
+ if (h.zoom = jt(u, g, Ft(v)), h.updateProjectionMatrix(), W(), v < 1) {
1537
+ k.current = requestAnimationFrame(y);
1538
+ return;
1539
+ }
1540
+ k.current = null;
1541
+ };
1542
+ k.current = requestAnimationFrame(y);
1543
+ },
1544
+ [h, z, W]
1545
+ ), C = be(() => {
1546
+ z();
1547
+ const g = I.current, { width: u, height: E } = Ve(l);
1548
+ if (h.up.set(0, 1, 0), h instanceof ue.OrthographicCamera && !M) {
1549
+ const y = ze(B.width, B.height, u, E);
1550
+ h.position.set(l.cx, l.cy, 500), h.zoom = y, h.updateProjectionMatrix();
1551
+ } else
1552
+ h.position.set(l.cx, l.cy - l.size * 0.35, l.size * 0.85), h.lookAt(l.cx, l.cy, 0);
1553
+ g && (g.target.set(l.cx, l.cy, 0), g.update()), W();
1554
+ }, [
1555
+ l.cx,
1556
+ l.cy,
1557
+ l.maxX,
1558
+ l.maxY,
1559
+ l.minX,
1560
+ l.minY,
1561
+ l.size,
1562
+ h,
1563
+ I,
1564
+ W,
1565
+ M,
1566
+ B.height,
1567
+ B.width,
1568
+ z
1569
+ ]), V = he(C);
1570
+ V.current = C;
1571
+ const P = be(
1572
+ (g) => {
1573
+ p.current = !0;
1574
+ const u = I.current;
1575
+ if (h instanceof ue.OrthographicCamera && !M) {
1576
+ const { width: E, height: y } = Ve(l), m = ze(B.width, B.height, E, y);
1577
+ O(
1578
+ Ht(
1579
+ h.zoom,
1580
+ g,
1581
+ i.ZOOM_STEP,
1582
+ m * 0.2,
1583
+ m * 10
1584
+ )
1585
+ );
1586
+ } else if (u) {
1587
+ const E = h.position.clone().sub(u.target), y = 1 + Math.min(Math.max(i.ZOOM_STEP, 0.15), 1) * 0.5, m = g > 0 ? E.length() / y : E.length() * y;
1588
+ E.setLength(
1589
+ Math.min(i.CAMERA_MAX_DISTANCE, Math.max(i.CAMERA_MIN_DISTANCE, m))
1590
+ ), h.position.copy(u.target).add(E);
1591
+ }
1592
+ u == null || u.update(), W();
1593
+ },
1594
+ [O, l, h, I, W, M, B.height, B.width, i]
1595
+ );
1596
+ return le(() => () => z(), [z]), $e(
1597
+ N,
1598
+ () => ({
1599
+ zoomIn: () => P(1),
1600
+ zoomOut: () => P(-1),
1601
+ reset: () => {
1602
+ p.current = !1, C();
1603
+ }
1604
+ }),
1605
+ [C, P]
1606
+ ), le(() => {
1607
+ B.width < 2 || B.height < 2 || (p.current = !1, V.current());
1608
+ }, [l.cx, l.cy, l.maxX, l.maxY, l.minX, l.minY, M]), le(() => {
1609
+ B.width < 2 || B.height < 2 || p.current || V.current();
1610
+ }, [B.height, B.width]), null;
1611
+ }
1612
+ const Zt = -1, He = [0, 1, 0], Qt = [1, 2], Kt = { antialias: !0 };
1613
+ function Jt({
112
1614
  doc: l,
113
1615
  theme: i,
114
- activeLevelId: a,
115
- route: p,
116
- selectedRetailerId: k,
117
- onSelectShape: y
1616
+ activeLevelId: M,
1617
+ route: I,
1618
+ selectedRetailerId: N,
1619
+ cameraRef: h,
1620
+ onSelectShape: B,
1621
+ imageProxyUrl: W,
1622
+ eventSource: p
118
1623
  }) {
119
- const o = i.MAP_STYLE === "3D", h = T(() => {
120
- let s = 1 / 0, v = 1 / 0, n = -1 / 0, _ = -1 / 0;
121
- for (const b of l.levels)
122
- if (!(a != null && b.id !== a && b.kind !== "outdoor"))
123
- for (const x of b.shapes)
124
- s = Math.min(s, x.bbox.minX), v = Math.min(v, x.bbox.minY), n = Math.max(n, x.bbox.maxX), _ = Math.max(_, x.bbox.maxY);
125
- return Number.isFinite(s) ? {
126
- cx: (s + n) / 2,
127
- cy: (v + _) / 2,
128
- size: Math.max(n - s, _ - v, 100)
129
- } : { cx: 0, cy: 0, size: 500 };
130
- }, [l, a]), A = 800 / h.size;
131
- return /* @__PURE__ */ g(
132
- j,
1624
+ const k = i.MAP_STYLE === "3D", z = he(null), O = re(
1625
+ () => at(l.levels, M),
1626
+ [l.levels, M]
1627
+ ), C = re(
1628
+ () => ct(l.levels, M, l.baseViewbox),
1629
+ [l.levels, l.baseViewbox, M]
1630
+ ), V = re(
1631
+ () => zt(C),
1632
+ [
1633
+ C.cx,
1634
+ C.cy,
1635
+ C.maxX,
1636
+ C.maxY,
1637
+ C.minX,
1638
+ C.minY,
1639
+ C.size
1640
+ ]
1641
+ ), P = re(
1642
+ () => [V.cx, V.cy, 500],
1643
+ [V.cx, V.cy]
1644
+ ), g = re(
1645
+ () => [V.cx, V.cy, 0],
1646
+ [V.cx, V.cy]
1647
+ ), u = re(
1648
+ () => [V.cx, V.cy - V.size * 0.35, V.size * 0.85],
1649
+ [V.cx, V.cy, V.size]
1650
+ ), E = re(() => Xt(k), [k]), y = re(() => Yt(k), [k]), m = re(
1651
+ () => l.levels.find((w) => Ne(w)) ?? null,
1652
+ [l.levels]
1653
+ ), v = (m == null ? void 0 : m.sourceSvgUrl) ?? l.baseSvgUrl ?? null, U = re(() => m ? lt(m.shapes, { omitStaticLayers: !0 }) : /* @__PURE__ */ new Set(), [m]), d = O.some((w) => Ne(w));
1654
+ return /* @__PURE__ */ te(
1655
+ dt,
133
1656
  {
134
1657
  style: { width: "100%", height: "100%", background: i.MAP_BACKGROUND_COLOR },
135
- orthographic: !o,
136
- camera: o ? { position: [h.cx, h.cy - h.size, h.size], fov: 50, near: 1, far: 1e4 } : void 0,
1658
+ eventSource: p ?? void 0,
1659
+ eventPrefix: "offset",
1660
+ orthographic: !k,
1661
+ dpr: Qt,
1662
+ flat: !0,
1663
+ gl: Kt,
1664
+ camera: k ? {
1665
+ position: u,
1666
+ fov: 50,
1667
+ near: 1,
1668
+ far: 1e4,
1669
+ up: He
1670
+ } : void 0,
137
1671
  children: [
138
- !o && /* @__PURE__ */ t(
139
- q,
1672
+ !k && /* @__PURE__ */ R(
1673
+ yt,
140
1674
  {
141
1675
  makeDefault: !0,
142
- position: [h.cx, h.cy, 500],
143
- zoom: A,
1676
+ position: P,
1677
+ up: He,
144
1678
  near: 0.1,
145
1679
  far: 5e3
146
1680
  }
147
1681
  ),
148
- /* @__PURE__ */ t("ambientLight", { intensity: 0.85 }),
149
- /* @__PURE__ */ t("directionalLight", { position: [200, 400, 200], intensity: 0.4 }),
150
- l.levels.map((s) => s.kind === "outdoor" || a == null || s.id === a ? /* @__PURE__ */ t(
151
- J,
152
- {
153
- level: s,
154
- theme: i,
155
- is3d: o,
156
- selectedRetailerId: k,
157
- onSelectShape: (n) => y == null ? void 0 : y(n, s.id)
158
- },
159
- s.id
160
- ) : null),
161
- p && /* @__PURE__ */ t(ee, { route: p, activeLevelId: a, color: i.ACCENT_COLOR }),
162
- /* @__PURE__ */ t(
163
- V,
1682
+ /* @__PURE__ */ R("color", { attach: "background", args: [i.MAP_BACKGROUND_COLOR] }),
1683
+ /* @__PURE__ */ R("ambientLight", { intensity: 4, color: "#c4c4c4" }),
1684
+ /* @__PURE__ */ R("directionalLight", { position: [0, 400, 0], color: "#ffffff", intensity: 0.3 }),
1685
+ /* @__PURE__ */ R("directionalLight", { position: [0, 0, 400], color: "#c4c4c4", intensity: 0.2 }),
1686
+ /* @__PURE__ */ R("directionalLight", { position: [0, 0, -400], color: "#c4c4c4", intensity: 0.2 }),
1687
+ /* @__PURE__ */ te("group", { scale: Gt, children: [
1688
+ d && v ? /* @__PURE__ */ R(
1689
+ Dt,
1690
+ {
1691
+ url: v,
1692
+ suppressIds: U,
1693
+ imageProxyUrl: W,
1694
+ is3d: k
1695
+ }
1696
+ ) : null,
1697
+ O.map((w) => {
1698
+ const T = Ne(w), _ = w.transform;
1699
+ return /* @__PURE__ */ R(
1700
+ "group",
1701
+ {
1702
+ position: [
1703
+ _.translateX,
1704
+ _.translateY,
1705
+ T ? Zt : 0
1706
+ ],
1707
+ rotation: [0, 0, _.rotate * Math.PI / 180],
1708
+ scale: _.scale || 1,
1709
+ children: /* @__PURE__ */ R(
1710
+ _t,
1711
+ {
1712
+ level: w,
1713
+ theme: i,
1714
+ is3d: k,
1715
+ selectedRetailerId: N,
1716
+ interactiveOnly: T && !!v,
1717
+ onSelectShape: (q) => B == null ? void 0 : B(q, w.id)
1718
+ }
1719
+ )
1720
+ },
1721
+ w.id
1722
+ );
1723
+ }),
1724
+ I && /* @__PURE__ */ R(
1725
+ Pt,
1726
+ {
1727
+ route: I,
1728
+ activeLevelId: M,
1729
+ color: i.ACCENT_COLOR
1730
+ }
1731
+ )
1732
+ ] }),
1733
+ /* @__PURE__ */ R(
1734
+ gt,
164
1735
  {
165
- enableRotate: o,
1736
+ ref: z,
1737
+ makeDefault: !0,
1738
+ enableDamping: !1,
1739
+ enableRotate: k,
166
1740
  enablePan: !0,
167
- target: [h.cx, h.cy, 0],
1741
+ screenSpacePanning: !0,
1742
+ mouseButtons: E,
1743
+ touches: y,
1744
+ target: g,
168
1745
  maxDistance: i.CAMERA_MAX_DISTANCE,
169
1746
  minDistance: i.CAMERA_MIN_DISTANCE
170
1747
  }
1748
+ ),
1749
+ /* @__PURE__ */ R(
1750
+ $t,
1751
+ {
1752
+ bounds: V,
1753
+ theme: i,
1754
+ is3d: k,
1755
+ controlsRef: z,
1756
+ cameraRef: h
1757
+ }
171
1758
  )
172
1759
  ]
173
1760
  }
174
1761
  );
175
1762
  }
176
- function te({
1763
+ function Ue(l, i) {
1764
+ var M, I;
1765
+ return ((M = l.assignment) == null ? void 0 : M.customLabel) || i || l.label.text || ((I = l.assignment) == null ? void 0 : I.unitNumber) || l.key;
1766
+ }
1767
+ function en({
177
1768
  doc: l,
178
1769
  amenities: i,
179
- searchOpen: a,
180
- onSearchOpenChange: p,
181
- activeLevelId: k,
182
- onActiveLevelChange: y,
183
- fromAnchorId: o,
184
- toAnchorId: h,
185
- onFromChange: A,
186
- onToChange: s,
187
- accessibleOnly: v,
188
- onAccessibleOnlyChange: n,
189
- route: _
1770
+ onActiveLevelChange: M,
1771
+ fromAnchorId: I,
1772
+ toAnchorId: N,
1773
+ onFromChange: h,
1774
+ onToChange: B,
1775
+ accessibleOnly: W,
1776
+ onAccessibleOnlyChange: p,
1777
+ route: k,
1778
+ showSearch: z = !0,
1779
+ showAmenities: O = !0
190
1780
  }) {
191
- const [b, x] = R(""), [P, D] = R(null), E = T(() => {
192
- var f, d;
193
- const e = [];
194
- for (const N of l.levels)
195
- for (const I of N.shapes) {
196
- const M = N.anchors.find((w) => w.shapeId === I.id) ?? null;
197
- if (I.kind === "unit" && ((f = I.assignment) != null && f.retailerId) && e.push({
198
- id: `store-${I.id}`,
199
- label: I.assignment.customLabel || I.label.text || I.key,
200
- group: N.name,
201
- anchorId: (M == null ? void 0 : M.id) ?? null,
202
- levelId: N.id,
203
- kind: "store"
204
- }), I.kind === "amenity" && ((d = I.assignment) != null && d.amenityId)) {
205
- const w = i.find((B) => B.id === I.assignment.amenityId);
206
- e.push({
207
- id: `amenity-${I.id}`,
208
- label: (w == null ? void 0 : w.name) ?? I.key,
1781
+ const [C, V] = ae(""), [P, g] = ae(null), u = re(() => {
1782
+ var w;
1783
+ const d = [];
1784
+ for (const T of l.levels)
1785
+ for (const _ of T.shapes) {
1786
+ const q = T.anchors.find((Y) => Y.shapeId === _.id) ?? null;
1787
+ if (_.kind === "unit" && d.push({
1788
+ id: `store-${_.id}`,
1789
+ label: Ue(_),
1790
+ group: T.name,
1791
+ anchorId: (q == null ? void 0 : q.id) ?? null,
1792
+ levelId: T.id,
1793
+ kind: "store",
1794
+ amenityId: null
1795
+ }), _.kind === "amenity" && ((w = _.assignment) != null && w.amenityId)) {
1796
+ const Y = i.find((G) => G.id === _.assignment.amenityId);
1797
+ d.push({
1798
+ id: `amenity-${_.id}`,
1799
+ label: Ue(_, Y == null ? void 0 : Y.name),
209
1800
  group: "Amenities",
210
- anchorId: (M == null ? void 0 : M.id) ?? null,
211
- levelId: N.id,
212
- kind: "amenity"
1801
+ anchorId: (q == null ? void 0 : q.id) ?? null,
1802
+ levelId: T.id,
1803
+ kind: "amenity",
1804
+ amenityId: (Y == null ? void 0 : Y.id) ?? _.assignment.amenityId
213
1805
  });
214
1806
  }
215
1807
  }
216
- return e;
217
- }, [l, i]), G = T(() => {
218
- const e = b.trim().toLowerCase();
219
- return e ? E.filter((f) => f.label.toLowerCase().includes(e)) : E;
220
- }, [E, b]), $ = T(() => {
221
- const e = /* @__PURE__ */ new Map();
222
- for (const f of G) {
223
- const d = e.get(f.group) ?? [];
224
- d.push(f), e.set(f.group, d);
225
- }
226
- return Array.from(e.entries());
227
- }, [G]), L = E.filter((e) => e.anchorId != null);
228
- return /* @__PURE__ */ g("div", { className: "eyeon-map-chrome", children: [
229
- /* @__PURE__ */ g("div", { className: "eyeon-map-chrome__top", children: [
230
- /* @__PURE__ */ t(
231
- "button",
1808
+ return d;
1809
+ }, [l, i]), E = re(() => {
1810
+ const d = C.trim().toLowerCase();
1811
+ return d ? u.filter((w) => w.label.toLowerCase().includes(d)) : u;
1812
+ }, [u, C]), y = re(() => {
1813
+ const d = /* @__PURE__ */ new Map();
1814
+ for (const w of E) {
1815
+ const T = d.get(w.group) ?? [];
1816
+ T.push(w), d.set(w.group, T);
1817
+ }
1818
+ return Array.from(d.entries());
1819
+ }, [E]), m = u.filter((d) => d.anchorId != null), v = C.trim().length > 0, U = (d) => {
1820
+ g(d), d.anchorId != null && (B(d.anchorId), M(d.levelId));
1821
+ };
1822
+ return !z && !(O && i.length > 0) ? null : /* @__PURE__ */ te("div", { className: "eyeon-map-chrome", children: [
1823
+ /* @__PURE__ */ te("div", { className: "eyeon-map-chrome__top", children: [
1824
+ z && /* @__PURE__ */ R(
1825
+ "input",
232
1826
  {
233
- type: "button",
234
- className: "eyeon-map-chrome__search-toggle",
235
- onClick: () => p(!a),
236
- "aria-expanded": a,
237
- children: a ? "Close" : "Search"
1827
+ type: "search",
1828
+ className: "eyeon-map-chrome__search-input",
1829
+ placeholder: "Search...",
1830
+ "aria-label": "Search...",
1831
+ value: C,
1832
+ onChange: (d) => V(d.target.value)
238
1833
  }
239
1834
  ),
240
- /* @__PURE__ */ t("div", { className: "eyeon-map-chrome__amenities", children: i.map((e) => /* @__PURE__ */ t(
1835
+ O && i.length > 0 && /* @__PURE__ */ R("div", { className: "eyeon-map-chrome__amenities", children: i.map((d) => /* @__PURE__ */ R(
241
1836
  "button",
242
1837
  {
243
1838
  type: "button",
244
1839
  className: "eyeon-map-chrome__amenity",
245
- title: e.name,
1840
+ "aria-label": d.name,
246
1841
  onClick: () => {
247
- const f = E.find(
248
- (d) => d.kind === "amenity" && d.label === e.name && d.anchorId != null
1842
+ const w = u.find(
1843
+ (T) => T.kind === "amenity" && T.amenityId === d.id && T.anchorId != null
249
1844
  );
250
- (f == null ? void 0 : f.anchorId) != null && (s(f.anchorId), y(f.levelId));
1845
+ w && U(w);
251
1846
  },
252
- children: e.builtinIcon ? /* @__PURE__ */ t("span", { className: "eyeon-map-chrome__amenity-icon", children: e.builtinIcon }) : /* @__PURE__ */ t("span", { className: "eyeon-map-chrome__amenity-label", children: e.name.slice(0, 2) })
1847
+ children: d.builtinIcon ? /* @__PURE__ */ R("span", { className: "eyeon-map-chrome__amenity-icon", children: d.builtinIcon }) : /* @__PURE__ */ R("span", { className: "eyeon-map-chrome__amenity-label", children: d.name.slice(0, 2) })
253
1848
  },
254
- e.id
1849
+ d.id
255
1850
  )) })
256
1851
  ] }),
257
- a && /* @__PURE__ */ g("div", { className: "eyeon-map-chrome__panel", children: [
258
- /* @__PURE__ */ t(
259
- "input",
260
- {
261
- className: "eyeon-map-chrome__search-input",
262
- placeholder: "Search stores & amenities",
263
- value: b,
264
- onChange: (e) => x(e.target.value),
265
- autoFocus: !0
266
- }
267
- ),
268
- /* @__PURE__ */ t("div", { className: "eyeon-map-chrome__groups", children: $.map(([e, f]) => /* @__PURE__ */ g("div", { className: "eyeon-map-chrome__group", children: [
269
- /* @__PURE__ */ t("div", { className: "eyeon-map-chrome__group-title", children: e }),
270
- f.map((d) => /* @__PURE__ */ t(
1852
+ z && v && /* @__PURE__ */ te("div", { className: "eyeon-map-chrome__panel", children: [
1853
+ /* @__PURE__ */ R("div", { className: "eyeon-map-chrome__groups", children: y.length === 0 ? /* @__PURE__ */ R("div", { className: "eyeon-map-chrome__empty", children: "No matching stores" }) : y.map(([d, w]) => /* @__PURE__ */ te("div", { className: "eyeon-map-chrome__group", children: [
1854
+ /* @__PURE__ */ R("div", { className: "eyeon-map-chrome__group-title", children: d }),
1855
+ w.map((T) => /* @__PURE__ */ R(
271
1856
  "button",
272
1857
  {
273
1858
  type: "button",
274
- className: "eyeon-map-chrome__item",
275
- onClick: () => {
276
- D(d), d.anchorId != null && (s(d.anchorId), y(d.levelId));
277
- },
278
- children: d.label
1859
+ className: (P == null ? void 0 : P.id) === T.id ? "eyeon-map-chrome__item is-selected" : "eyeon-map-chrome__item",
1860
+ onClick: () => U(T),
1861
+ children: T.label
279
1862
  },
280
- d.id
1863
+ T.id
281
1864
  ))
282
- ] }, e)) }),
283
- P && /* @__PURE__ */ g("div", { className: "eyeon-map-chrome__detail", children: [
284
- /* @__PURE__ */ t("div", { className: "eyeon-map-chrome__detail-title", children: P.label }),
285
- /* @__PURE__ */ t("div", { className: "eyeon-map-chrome__detail-meta", children: P.group })
1865
+ ] }, d)) }),
1866
+ P && /* @__PURE__ */ te("div", { className: "eyeon-map-chrome__detail", children: [
1867
+ /* @__PURE__ */ R("div", { className: "eyeon-map-chrome__detail-title", children: P.label }),
1868
+ /* @__PURE__ */ R("div", { className: "eyeon-map-chrome__detail-meta", children: P.group })
286
1869
  ] }),
287
- /* @__PURE__ */ g("div", { className: "eyeon-map-chrome__route", children: [
288
- /* @__PURE__ */ g("label", { children: [
1870
+ /* @__PURE__ */ te("div", { className: "eyeon-map-chrome__route", children: [
1871
+ /* @__PURE__ */ te("label", { children: [
289
1872
  "From",
290
- /* @__PURE__ */ g(
291
- "select",
1873
+ /* @__PURE__ */ R(
1874
+ Ge,
292
1875
  {
293
- value: o ?? "",
294
- onChange: (e) => A(e.target.value ? Number(e.target.value) : null),
295
- children: [
296
- /* @__PURE__ */ t("option", { value: "", children: "Select start" }),
297
- L.map((e) => /* @__PURE__ */ t("option", { value: e.anchorId, children: e.label }, e.id))
298
- ]
1876
+ ariaLabel: "From",
1877
+ value: I != null ? String(I) : "",
1878
+ placeholder: "Select start",
1879
+ searchable: !0,
1880
+ options: m.map((d) => ({
1881
+ value: String(d.anchorId),
1882
+ label: `${d.label} · ${d.group}`
1883
+ })),
1884
+ onChange: (d) => h(d ? Number(d) : null)
299
1885
  }
300
1886
  )
301
1887
  ] }),
302
- /* @__PURE__ */ g("label", { children: [
1888
+ /* @__PURE__ */ te("label", { children: [
303
1889
  "To",
304
- /* @__PURE__ */ g(
305
- "select",
1890
+ /* @__PURE__ */ R(
1891
+ Ge,
306
1892
  {
307
- value: h ?? "",
308
- onChange: (e) => s(e.target.value ? Number(e.target.value) : null),
309
- children: [
310
- /* @__PURE__ */ t("option", { value: "", children: "Select destination" }),
311
- L.map((e) => /* @__PURE__ */ t("option", { value: e.anchorId, children: e.label }, e.id))
312
- ]
1893
+ ariaLabel: "To",
1894
+ value: N != null ? String(N) : "",
1895
+ placeholder: "Select destination",
1896
+ searchable: !0,
1897
+ options: m.map((d) => ({
1898
+ value: String(d.anchorId),
1899
+ label: `${d.label} · ${d.group}`
1900
+ })),
1901
+ onChange: (d) => B(d ? Number(d) : null)
313
1902
  }
314
1903
  )
315
1904
  ] }),
316
- /* @__PURE__ */ g("label", { className: "eyeon-map-chrome__accessible", children: [
317
- /* @__PURE__ */ t(
1905
+ /* @__PURE__ */ te("label", { className: "eyeon-map-chrome__accessible", children: [
1906
+ /* @__PURE__ */ R(
318
1907
  "input",
319
1908
  {
320
1909
  type: "checkbox",
321
- checked: v,
322
- onChange: (e) => n(e.target.checked)
1910
+ checked: W,
1911
+ onChange: (d) => p(d.target.checked)
323
1912
  }
324
1913
  ),
325
1914
  "Accessible route"
326
1915
  ] }),
327
- _ && /* @__PURE__ */ t("div", { className: "eyeon-map-chrome__route-meta", children: _.levelChanges.length > 0 ? `${_.levelChanges.length} level change(s)` : "Same level" })
1916
+ k && /* @__PURE__ */ R("div", { className: "eyeon-map-chrome__route-meta", children: k.levelChanges.length > 0 ? `${k.levelChanges.length} level change(s)` : "Same level" })
328
1917
  ] })
329
- ] }),
330
- /* @__PURE__ */ t("div", { className: "eyeon-map-chrome__floors", children: l.levels.filter((e) => e.kind === "floor").map((e) => /* @__PURE__ */ t(
331
- "button",
332
- {
333
- type: "button",
334
- className: e.id === k ? "eyeon-map-chrome__floor is-active" : "eyeon-map-chrome__floor",
335
- onClick: () => y(e.id),
336
- children: e.name
337
- },
338
- e.id
339
- )) })
1918
+ ] })
340
1919
  ] });
341
1920
  }
342
- async function ie(l) {
343
- const i = l.replace(/\/$/, ""), a = await fetch(`${i}/v1/map/document`, { credentials: "include" });
344
- if (!a.ok)
345
- throw new Error(`Failed to load map document (${a.status})`);
346
- return a.json();
1921
+ async function tn(l, i, M) {
1922
+ const I = l.replace(/\/$/, ""), N = new URLSearchParams();
1923
+ i != null && i > 0 && N.set("center_id", String(i)), M && N.set("draft", "1");
1924
+ const h = N.toString(), B = await fetch(`${I}/v1/map/document${h ? `?${h}` : ""}`, {
1925
+ credentials: "include"
1926
+ });
1927
+ if (!B.ok)
1928
+ throw new Error(`Failed to load map document (${B.status})`);
1929
+ return B.json();
347
1930
  }
348
- function ce(l) {
1931
+ function un(l) {
349
1932
  const {
350
1933
  document: i,
351
- webApiURI: a,
352
- role: p = "WP_SITE",
353
- kioskId: k = null,
354
- selectedRetailerId: y = null,
355
- themeOverrides: o,
356
- onExtractedAmenities: h,
357
- createRouteRef: A,
358
- className: s,
359
- style: v
360
- } = l, [n, _] = R(i ?? null), [b, x] = R(null), [P, D] = R(null), [E, G] = R(null), [$, L] = R(null), [e, f] = R(!1), [d, N] = R(null), [I, M] = R(!1);
361
- z(() => {
1934
+ webApiURI: M,
1935
+ centerId: I,
1936
+ host: N = "WEBSITE",
1937
+ kioskId: h = null,
1938
+ selectedRetailerId: B = null,
1939
+ themeOverrides: W,
1940
+ onExtractedAmenities: p,
1941
+ createRouteRef: k,
1942
+ className: z,
1943
+ style: O,
1944
+ activeLevelId: C,
1945
+ onActiveLevelChange: V,
1946
+ routeOnSelect: P = !0,
1947
+ imageProxyUrl: g
1948
+ } = l, [u, E] = ae(i ?? null), y = re(
1949
+ () => u ? Be(u) : null,
1950
+ [u]
1951
+ ), [m, v] = ae(null), [U, d] = ae(null), [w, T] = ae(null), [_, q] = ae(null), [Y, G] = ae(!1), [K, Z] = ae(() => i ? De(Be(i).levels) : null), oe = he(null), J = he(null), X = C ?? K, x = (r) => {
1952
+ Z(r), r != null && (V == null || V(r));
1953
+ };
1954
+ le(() => {
362
1955
  if (i) {
363
- _(i);
1956
+ E(i);
364
1957
  return;
365
1958
  }
366
- if (!a) return;
1959
+ if (!M) return;
367
1960
  let r = !1;
368
- return ie(a).then((c) => {
369
- r || _(c);
370
- }).catch((c) => {
371
- r || x(c instanceof Error ? c.message : String(c));
1961
+ const o = Te(N).fetchDraft;
1962
+ return tn(M, I, o).then((t) => {
1963
+ r || E(t);
1964
+ }).catch((t) => {
1965
+ r || v(t instanceof Error ? t.message : String(t));
372
1966
  }), () => {
373
1967
  r = !0;
374
1968
  };
375
- }, [i, a]), z(() => {
376
- var c;
377
- if (!n) return;
378
- d == null && n.levels.length > 0 && N(n.levels[0].id);
379
- const r = /* @__PURE__ */ new Set();
380
- for (const u of n.levels)
381
- for (const m of u.shapes)
382
- if (m.kind === "amenity" && ((c = m.assignment) == null ? void 0 : c.amenityId) != null) {
383
- const C = n.amenities.find((O) => O.id === m.assignment.amenityId);
384
- C && r.add(C.code);
1969
+ }, [i, M, I, N]), le(() => {
1970
+ var t;
1971
+ if (!y) return;
1972
+ const r = new Set(y.levels.map((e) => e.id));
1973
+ (X == null || !r.has(X)) && x(De(y.levels));
1974
+ const o = /* @__PURE__ */ new Set();
1975
+ for (const e of y.levels)
1976
+ for (const c of e.shapes)
1977
+ if (c.kind === "amenity" && ((t = c.assignment) == null ? void 0 : t.amenityId) != null) {
1978
+ const b = y.amenities.find((a) => a.id === c.assignment.amenityId);
1979
+ b && o.add(b.code);
385
1980
  }
386
- h == null || h(Array.from(r));
387
- }, [n, d, h]), z(() => {
1981
+ p == null || p(Array.from(o));
1982
+ }, [y, X, p]), le(() => {
388
1983
  var r;
389
- if (!(!n || p !== "DISPLAY_APP" || k == null)) {
390
- for (const c of n.levels)
391
- for (const u of c.shapes)
392
- if (u.kind === "kiosk_screen" && ((r = u.assignment) == null ? void 0 : r.kioskId) === k) {
393
- const m = c.anchors.find((C) => C.shapeId === u.id);
394
- m && G(m.id);
1984
+ if (!(!y || B == null)) {
1985
+ for (const o of y.levels)
1986
+ for (const t of o.shapes)
1987
+ if (((r = t.assignment) == null ? void 0 : r.retailerId) === B) {
1988
+ x(o.id);
1989
+ return;
395
1990
  }
396
1991
  }
397
- }, [n, p, k]);
398
- const w = T(() => n ? X(
399
- n.graph.nodes.map((r) => ({
1992
+ }, [y, B]), le(() => {
1993
+ var r;
1994
+ if (!(!y || !Te(N).kioskOrigin || h == null)) {
1995
+ for (const o of y.levels)
1996
+ for (const t of o.shapes)
1997
+ if (t.kind === "kiosk_screen" && ((r = t.assignment) == null ? void 0 : r.kioskId) === h) {
1998
+ const e = o.anchors.find((c) => c.shapeId === t.id);
1999
+ e && T(e.id);
2000
+ }
2001
+ }
2002
+ }, [y, N, h]);
2003
+ const ne = re(() => y ? ut(
2004
+ y.graph.nodes.map((r) => ({
400
2005
  id: r.id,
401
2006
  levelId: r.levelId,
402
2007
  shapeId: r.shapeId,
@@ -405,9 +2010,9 @@ function ce(l) {
405
2010
  y: r.y,
406
2011
  connectorId: r.connectorId
407
2012
  })),
408
- n.graph.edges.map((r) => ({
2013
+ y.graph.edges.map((r) => ({
409
2014
  id: r.id,
410
- mapId: n.mapId,
2015
+ mapId: y.mapId,
411
2016
  fromAnchorId: r.from,
412
2017
  toAnchorId: r.to,
413
2018
  weight: r.weight,
@@ -415,106 +2020,129 @@ function ce(l) {
415
2020
  accessible: r.accessible,
416
2021
  kind: r.kind
417
2022
  })),
418
- n.connectors
419
- ) : null, [n]), B = (r, c) => {
420
- if (!w || r == null || c == null) {
421
- D(null);
2023
+ y.connectors
2024
+ ) : null, [y]), ee = (r, o) => {
2025
+ if (!ne || r == null || o == null) {
2026
+ d(null);
422
2027
  return;
423
2028
  }
424
- const u = W(w, r, c, { accessibleOnly: e });
425
- D(u);
2029
+ const t = mt(ne, r, o, { accessibleOnly: Y });
2030
+ d(t);
426
2031
  };
427
- z(() => {
428
- B(E, $);
429
- }, [E, $, e, w]), z(() => {
430
- !A || !n || (A.current = {
2032
+ le(() => {
2033
+ ee(w, _);
2034
+ }, [w, _, Y, ne]), le(() => {
2035
+ !k || !y || (k.current = {
431
2036
  createRouteToStore(r) {
432
- var c;
433
- for (const u of n.levels)
434
- for (const m of u.shapes)
435
- if (((c = m.assignment) == null ? void 0 : c.retailerId) === r) {
436
- const C = u.anchors.find((O) => O.shapeId === m.id);
437
- C && (L(C.id), N(u.id));
2037
+ var o;
2038
+ for (const t of y.levels)
2039
+ for (const e of t.shapes)
2040
+ if (((o = e.assignment) == null ? void 0 : o.retailerId) === r) {
2041
+ const c = t.anchors.find((b) => b.shapeId === e.id);
2042
+ c && (q(c.id), x(t.id));
438
2043
  }
439
2044
  },
440
2045
  createRouteToAmenity(r) {
441
- var u;
442
- const c = n.amenities.find((m) => m.code === r);
443
- if (c) {
444
- for (const m of n.levels)
445
- for (const C of m.shapes)
446
- if (((u = C.assignment) == null ? void 0 : u.amenityId) === c.id) {
447
- const O = m.anchors.find((H) => H.shapeId === C.id);
448
- if (O) {
449
- L(O.id), N(m.id);
2046
+ var t;
2047
+ const o = y.amenities.find((e) => e.code === r);
2048
+ if (o) {
2049
+ for (const e of y.levels)
2050
+ for (const c of e.shapes)
2051
+ if (((t = c.assignment) == null ? void 0 : t.amenityId) === o.id) {
2052
+ const b = e.anchors.find((a) => a.shapeId === c.id);
2053
+ if (b) {
2054
+ q(b.id), x(e.id);
450
2055
  return;
451
2056
  }
452
2057
  }
453
2058
  }
454
2059
  },
455
2060
  clearRoute() {
456
- L(null), D(null);
2061
+ q(null), d(null);
457
2062
  }
458
2063
  });
459
- }, [A, n]);
460
- const F = {
461
- ...K,
462
- ...(n == null ? void 0 : n.theme) ?? {},
463
- ...o ?? {}
464
- };
465
- if (b)
466
- return /* @__PURE__ */ t("div", { className: `eyeon-map-viewer eyeon-map-viewer--error ${s ?? ""}`, style: v, children: /* @__PURE__ */ t("div", { className: "eyeon-map-viewer__error", children: b }) });
467
- if (!n)
468
- return /* @__PURE__ */ t("div", { className: `eyeon-map-viewer eyeon-map-viewer--loading ${s ?? ""}`, style: v, children: /* @__PURE__ */ t("div", { className: "eyeon-map-viewer__loading", children: "Loading map…" }) });
469
- const Y = n.amenities.filter(
470
- (r) => n.levels.some(
471
- (c) => c.shapes.some((u) => {
472
- var m;
473
- return ((m = u.assignment) == null ? void 0 : m.amenityId) === r.id;
2064
+ }, [k, y]);
2065
+ const ie = ft(y == null ? void 0 : y.theme, W);
2066
+ if (m)
2067
+ return /* @__PURE__ */ R("div", { className: `eyeon-map-viewer eyeon-map-viewer--error ${z ?? ""}`, style: O, children: /* @__PURE__ */ R("div", { className: "eyeon-map-viewer__error", children: m }) });
2068
+ if (!y)
2069
+ return /* @__PURE__ */ R("div", { className: `eyeon-map-viewer eyeon-map-viewer--loading ${z ?? ""}`, style: O, children: /* @__PURE__ */ R("div", { className: "eyeon-map-viewer__loading", children: "Loading map…" }) });
2070
+ const de = y.amenities.filter(
2071
+ (r) => y.levels.some(
2072
+ (o) => o.shapes.some((t) => {
2073
+ var e;
2074
+ return ((e = t.assignment) == null ? void 0 : e.amenityId) === r.id;
474
2075
  })
475
2076
  )
476
- );
477
- return /* @__PURE__ */ g(
2077
+ ), fe = Te(N);
2078
+ return /* @__PURE__ */ te(
478
2079
  "div",
479
2080
  {
480
- className: `eyeon-map-viewer eyeon-map-viewer--${p} ${s ?? ""}`,
2081
+ className: `eyeon-map-viewer eyeon-map-viewer--${N} ${z ?? ""}`,
481
2082
  style: {
482
- ...v,
483
- "--map-accent": F.ACCENT_COLOR,
484
- "--map-bg": F.MAP_BACKGROUND_COLOR
2083
+ ...O,
2084
+ "--map-accent": ie.ACCENT_COLOR,
2085
+ "--map-bg": ie.MAP_BACKGROUND_COLOR
485
2086
  },
486
2087
  children: [
487
- p !== "DISPLAY_APP" && /* @__PURE__ */ t(
488
- te,
2088
+ (fe.search || fe.amenities) && /* @__PURE__ */ R(
2089
+ en,
2090
+ {
2091
+ doc: y,
2092
+ amenities: de,
2093
+ activeLevelId: X,
2094
+ onActiveLevelChange: x,
2095
+ fromAnchorId: w,
2096
+ toAnchorId: _,
2097
+ onFromChange: T,
2098
+ onToChange: q,
2099
+ accessibleOnly: Y,
2100
+ onAccessibleOnlyChange: G,
2101
+ route: U,
2102
+ showSearch: fe.search,
2103
+ showAmenities: fe.amenities
2104
+ }
2105
+ ),
2106
+ /* @__PURE__ */ R(
2107
+ Tt,
489
2108
  {
490
- doc: n,
491
- amenities: Y,
492
- searchOpen: I,
493
- onSearchOpenChange: M,
494
- activeLevelId: d,
495
- onActiveLevelChange: N,
496
- fromAnchorId: E,
497
- toAnchorId: $,
498
- onFromChange: G,
499
- onToChange: L,
500
- accessibleOnly: e,
501
- onAccessibleOnlyChange: f,
502
- route: P
2109
+ levels: y.levels,
2110
+ activeLevelId: X,
2111
+ onActiveLevelChange: x,
2112
+ onZoomIn: () => {
2113
+ var r;
2114
+ return (r = oe.current) == null ? void 0 : r.zoomIn();
2115
+ },
2116
+ onZoomOut: () => {
2117
+ var r;
2118
+ return (r = oe.current) == null ? void 0 : r.zoomOut();
2119
+ },
2120
+ onReset: () => {
2121
+ var r;
2122
+ return (r = oe.current) == null ? void 0 : r.reset();
2123
+ },
2124
+ showFloors: fe.floors,
2125
+ showZoomReset: fe.zoomReset
503
2126
  }
504
2127
  ),
505
- /* @__PURE__ */ t("div", { className: "eyeon-map-viewer__canvas", children: /* @__PURE__ */ t(U, { fallback: null, children: /* @__PURE__ */ t(
506
- ne,
2128
+ /* @__PURE__ */ R("div", { ref: J, className: "eyeon-map-viewer__canvas", children: /* @__PURE__ */ R(Ze, { fallback: null, children: /* @__PURE__ */ R(
2129
+ Jt,
507
2130
  {
508
- doc: n,
509
- theme: F,
510
- activeLevelId: d,
511
- route: P,
512
- selectedRetailerId: y,
513
- onSelectShape: (r, c) => {
514
- var C;
515
- N(c);
516
- const u = n.levels.find((O) => O.id === c), m = u == null ? void 0 : u.anchors.find((O) => O.shapeId === r);
517
- m && L(m.id), (C = l.onSelectShape) == null || C.call(l, r);
2131
+ doc: y,
2132
+ theme: ie,
2133
+ activeLevelId: X,
2134
+ route: U,
2135
+ selectedRetailerId: B,
2136
+ cameraRef: oe,
2137
+ eventSource: J,
2138
+ imageProxyUrl: g,
2139
+ onSelectShape: (r, o) => {
2140
+ var t;
2141
+ if (x(o), P) {
2142
+ const e = y.levels.find((b) => b.id === o), c = e == null ? void 0 : e.anchors.find((b) => b.shapeId === r);
2143
+ c && q(c.id);
2144
+ }
2145
+ (t = l.onSelectShape) == null || t.call(l, r);
518
2146
  }
519
2147
  }
520
2148
  ) }) })
@@ -523,8 +2151,10 @@ function ce(l) {
523
2151
  );
524
2152
  }
525
2153
  export {
526
- ne as M,
527
- te as R,
528
- ce as a
2154
+ Tt as M,
2155
+ en as R,
2156
+ Jt as a,
2157
+ un as b,
2158
+ Ge as c
529
2159
  };
530
2160
  //# sourceMappingURL=MapViewer.js.map