@rio-cloud/rio-uikit 2.3.0-beta.3 → 2.3.0

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 (83) hide show
  1. package/Table.js +10 -9
  2. package/TableNext.js +10 -9
  3. package/TableRowActionsDropdown.d.ts +2 -0
  4. package/TableRowActionsDropdown.js +5 -0
  5. package/TableRowActionsDropdown.js.map +1 -0
  6. package/components/dropdown/ButtonDropdown.d.ts +4 -0
  7. package/components/dropdown/ButtonDropdown.js +82 -80
  8. package/components/dropdown/ButtonDropdown.js.map +1 -1
  9. package/components/map/components/Map.js +199 -180
  10. package/components/map/components/Map.js.map +1 -1
  11. package/components/map/components/MapContext.d.ts +2 -0
  12. package/components/map/components/MapContext.js +6 -4
  13. package/components/map/components/MapContext.js.map +1 -1
  14. package/components/map/components/features/MapZoom.js +19 -19
  15. package/components/map/components/features/MapZoom.js.map +1 -1
  16. package/components/map/utils/mapTypes.d.ts +6 -0
  17. package/components/map/utils/mapTypes.js.map +1 -1
  18. package/components/map/utils/mapUtils.d.ts +2 -0
  19. package/components/map/utils/mapUtils.js +4 -0
  20. package/components/map/utils/mapUtils.js.map +1 -1
  21. package/components/table/Table.d.ts +3 -1
  22. package/components/table/Table.js +225 -205
  23. package/components/table/Table.js.map +1 -1
  24. package/components/table/Table.types.d.ts +49 -0
  25. package/components/table/TableExpandedRow.d.ts +4 -0
  26. package/components/table/TableExpandedRow.js +69 -66
  27. package/components/table/TableExpandedRow.js.map +1 -1
  28. package/components/table/TableGroupRow.d.ts +3 -1
  29. package/components/table/TableGroupRow.js +15 -14
  30. package/components/table/TableGroupRow.js.map +1 -1
  31. package/components/table/TableHeader.d.ts +1 -9
  32. package/components/table/TableHeader.js +83 -67
  33. package/components/table/TableHeader.js.map +1 -1
  34. package/components/table/TableRow.d.ts +7 -1
  35. package/components/table/TableRow.js +75 -72
  36. package/components/table/TableRow.js.map +1 -1
  37. package/components/table/TableRowActionsDropdown.d.ts +11 -0
  38. package/components/table/TableRowActionsDropdown.js +22 -0
  39. package/components/table/TableRowActionsDropdown.js.map +1 -0
  40. package/components/table/TableStickyRowButton.d.ts +25 -0
  41. package/components/table/TableStickyRowButton.js +32 -0
  42. package/components/table/TableStickyRowButton.js.map +1 -0
  43. package/components/table/TableToolbar.d.ts +24 -3
  44. package/components/table/TableToolbar.js +78 -37
  45. package/components/table/TableToolbar.js.map +1 -1
  46. package/components/table/TableViewToggles.js +5 -5
  47. package/components/table/TableViewToggles.js.map +1 -1
  48. package/components/table/context/TableInteractionContext.d.ts +3 -0
  49. package/components/table/context/TableInteractionContext.js.map +1 -1
  50. package/components/table/context/TableRenderContext.d.ts +1 -0
  51. package/components/table/context/TableRenderContext.js.map +1 -1
  52. package/components/table/layout/useMeasuredColumnMaxWidths.js +52 -54
  53. package/components/table/layout/useMeasuredColumnMaxWidths.js.map +1 -1
  54. package/components/table/layout/useTableLayout.d.ts +4 -1
  55. package/components/table/layout/useTableLayout.js +54 -48
  56. package/components/table/layout/useTableLayout.js.map +1 -1
  57. package/components/table/layout/useTableVirtualization.js +51 -56
  58. package/components/table/layout/useTableVirtualization.js.map +1 -1
  59. package/components/table/model/resolveResponsiveViewType.d.ts +2 -0
  60. package/components/table/model/resolveResponsiveViewType.js +27 -0
  61. package/components/table/model/resolveResponsiveViewType.js.map +1 -0
  62. package/components/table/render/header/TableHeaderSelectionCell.d.ts +1 -0
  63. package/components/table/render/header/TableHeaderSelectionCell.js +13 -12
  64. package/components/table/render/header/TableHeaderSelectionCell.js.map +1 -1
  65. package/components/table/runtime/useResponsiveResolvedViewType.d.ts +23 -0
  66. package/components/table/runtime/useResponsiveResolvedViewType.js +22 -0
  67. package/components/table/runtime/useResponsiveResolvedViewType.js.map +1 -0
  68. package/components/table/selection/useInternalTableSelectionState.d.ts +2 -0
  69. package/components/table/selection/useInternalTableSelectionState.js +27 -17
  70. package/components/table/selection/useInternalTableSelectionState.js.map +1 -1
  71. package/components/table/selection/useTableSelection.d.ts +5 -1
  72. package/components/table/selection/useTableSelection.js +37 -26
  73. package/components/table/selection/useTableSelection.js.map +1 -1
  74. package/components/table/shared/parsePixelSize.d.ts +2 -0
  75. package/components/table/shared/parsePixelSize.js +13 -0
  76. package/components/table/shared/parsePixelSize.js.map +1 -0
  77. package/hooks/useResizeObserver.d.ts +25 -6
  78. package/hooks/useResizeObserver.js +20 -18
  79. package/hooks/useResizeObserver.js.map +1 -1
  80. package/package.json +10 -10
  81. package/version.d.ts +1 -1
  82. package/version.js +2 -2
  83. package/version.js.map +1 -1
@@ -1,225 +1,244 @@
1
- import { jsx as l, jsxs as xe } from "react/jsx-runtime";
2
- import { useRef as C, useState as m, useEffect as p } from "react";
3
- import { isEmpty as Ze } from "es-toolkit/compat";
4
- import { isEqual as Fe } from "es-toolkit/predicate";
5
- import { DEFAULT_MAX_ZOOM as ie, MAP_TYPE_DEFAULT as P, DEFAULT_PIXEL_RATIO as Be, DEFAULT_MIN_ZOOM as ke, MAP_LAYER_ROAD_RESTRICTIONS as le, MAP_TYPE_NIGHT as F, MAP_TYPE_FLEET_STYLE as He, MAP_TYPE_SATELLITE as Ue, MAP_TYPE_TERRAIN as ze, MAP_LAYER_INCIDENTS as je, MAP_LAYER_TRAFFIC as Ve } from "./constants.js";
6
- import { removeEventListenerMap as We, addEventListenerMap as qe } from "../utils/eventHandling.js";
7
- import { MapContext as Ge } from "./MapContext.js";
8
- import { getMapBounds as Ke, createUtils as Xe } from "../utils/mapUtils.js";
9
- import { getHereUi as $e } from "../utils/mapUi.js";
10
- import Je from "../../../hooks/useDarkMode.js";
11
- import Qe from "./features/MapZoom.js";
12
- import et from "./features/layers/MapOverlayLayers.js";
13
- import tt from "./MapSize.js";
14
- import nt from "./MapPosition.js";
15
- import at from "./MapElements.js";
16
- import { getPlatform as ot, getBaseLayer as rt, getEngineType as st } from "../utils/rendering.js";
17
- const it = "map-disable-marker-pointer-events", lt = 140, r = (me) => {
1
+ import { jsx as c, jsxs as Fe } from "react/jsx-runtime";
2
+ import { useRef as I, useState as i, useEffect as l } from "react";
3
+ import { isEmpty as Be } from "es-toolkit/compat";
4
+ import { isEqual as ke } from "es-toolkit/predicate";
5
+ import { DEFAULT_MAX_ZOOM as ce, MAP_TYPE_DEFAULT as y, DEFAULT_PIXEL_RATIO as He, DEFAULT_MIN_ZOOM as Ue, MAP_LAYER_ROAD_RESTRICTIONS as pe, MAP_TYPE_NIGHT as k, MAP_TYPE_FLEET_STYLE as ze, MAP_TYPE_SATELLITE as je, MAP_TYPE_TERRAIN as Ve, MAP_LAYER_INCIDENTS as We, MAP_LAYER_TRAFFIC as qe } from "./constants.js";
6
+ import { removeEventListenerMap as Ge, addEventListenerMap as Ke } from "../utils/eventHandling.js";
7
+ import { MapContext as Xe } from "./MapContext.js";
8
+ import { getMapBounds as $e, createUtils as Je } from "../utils/mapUtils.js";
9
+ import { getHereUi as Qe } from "../utils/mapUi.js";
10
+ import et from "../../../hooks/useDarkMode.js";
11
+ import tt from "./features/MapZoom.js";
12
+ import nt from "./features/layers/MapOverlayLayers.js";
13
+ import at from "./MapSize.js";
14
+ import ot from "./MapPosition.js";
15
+ import rt from "./MapElements.js";
16
+ import { getPlatform as st, getBaseLayer as it, getEngineType as lt } from "../utils/rendering.js";
17
+ const mt = "map-disable-marker-pointer-events", ct = 140, s = (ue) => {
18
18
  const {
19
- children: pe,
20
- credentials: B,
21
- width: k,
22
- height: U,
23
- language: ce = "en",
24
- center: z,
25
- zoom: j,
26
- zoomAnimation: V = !1,
27
- boundingBox: y,
28
- hideClusterSettings: Ee = !1,
29
- hideMapLayerSettings: ue = !1,
30
- disableMapEvents: W,
31
- disableBehavior: q = !1,
32
- disableZoomMomentum: de = !0,
19
+ children: Ee,
20
+ credentials: U,
21
+ width: z,
22
+ height: j,
23
+ language: de = "en",
24
+ center: V,
25
+ zoom: W,
26
+ zoomAnimation: q = !1,
27
+ boundingBox: S,
28
+ hideClusterSettings: ve = !1,
29
+ hideMapLayerSettings: fe = !1,
30
+ disableMapEvents: G,
31
+ disableBehavior: K = !1,
32
+ disableZoomMomentum: X = !0,
33
+ enableFractionalZoom: b = !1,
33
34
  eventListenerMap: he,
34
- mapType: L = P,
35
- mapLayer: c = [],
36
- showCluster: S = !0,
37
- showScaleBar: ve = !1,
38
- onMapLayerChange: Me = () => {
35
+ mapType: L = y,
36
+ mapLayer: p = [],
37
+ showCluster: w = !0,
38
+ showScaleBar: Me = !1,
39
+ onMapLayerChange: Le = () => {
39
40
  },
40
- onMapTypeChange: fe = () => {
41
+ onMapTypeChange: Te = () => {
41
42
  },
42
- onShowClusterChange: Le = () => {
43
+ onShowClusterChange: ge = () => {
43
44
  },
44
- onZoomIn: Te = () => {
45
+ onZoomIn: _e = () => {
45
46
  },
46
- onZoomOut: ge = () => {
47
+ onZoomOut: Ae = () => {
47
48
  },
48
- onIncidentsChange: _e = () => {
49
+ onIncidentsChange: Re = () => {
49
50
  },
50
- mapSettingsTooltip: Ae,
51
- mapSettings: G,
52
- enableWebGL: E = !0,
53
- enableDevicePixelRatio: K = !0,
54
- enableMarkerIconCache: Re = !0,
55
- disableMarkerPointerEventsWhileZooming: u = !1,
56
- pixelRatio: X = Be,
57
- minZoom: T = ke,
58
- maxZoom: I = ie
59
- } = me;
60
- let b = I;
61
- T > I && (b = ie, console.error("Invalid condition for zoom limits: min <= max)"));
62
- const w = C(null), d = C(), $ = C(!1), O = C(u), [Ce, Pe] = m(!1), [t, ye] = m(), [a, Se] = m(L), [o, J] = m(c), [Q, ee] = m(S), te = K && window.devicePixelRatio || X, i = /* @__PURE__ */ ((e) => e === "nb" ? "no" : e)(ce.split("-")[0].toLowerCase()), h = (e) => {
63
- if (e && !O.current)
51
+ mapSettingsTooltip: Pe,
52
+ mapSettings: $,
53
+ enableWebGL: u = !0,
54
+ enableDevicePixelRatio: J = !0,
55
+ enableMarkerIconCache: Ce = !0,
56
+ disableMarkerPointerEventsWhileZooming: E = !1,
57
+ pixelRatio: Q = He,
58
+ minZoom: T = Ue,
59
+ maxZoom: O = ce
60
+ } = ue;
61
+ let D = O;
62
+ T > O && (D = ce, console.error("Invalid condition for zoom limits: min <= max)"));
63
+ const g = I(null), d = I(), ee = I(!1), N = I(E), [Ie, ye] = i(!1), [Se, _] = i(!1), [t, be] = i(), [o, we] = i(L), [r, te] = i(p), [ne, ae] = i(w), oe = J && window.devicePixelRatio || Q, m = /* @__PURE__ */ ((e) => e === "nb" ? "no" : e)(de.split("-")[0].toLowerCase()), v = (e) => {
64
+ if (e && !N.current)
64
65
  return;
65
- const s = w.current;
66
- s && (s.classList.toggle(it, e), $.current = e);
67
- }, v = () => {
66
+ const a = g.current;
67
+ a && (a.classList.toggle(mt, e), ee.current = e);
68
+ }, f = () => {
68
69
  d.current !== void 0 && (window.clearTimeout(d.current), d.current = void 0);
69
- }, ne = () => {
70
- v(), d.current = window.setTimeout(() => {
71
- h(!1), d.current = void 0;
72
- }, lt);
73
- }, ae = () => {
74
- O.current && (v(), $.current || h(!0));
70
+ }, re = () => {
71
+ f(), d.current = window.setTimeout(() => {
72
+ v(!1), _(!1), d.current = void 0;
73
+ }, ct);
74
+ }, se = () => {
75
+ _(!0), f(), N.current && !ee.current && v(!0);
75
76
  };
76
- p(() => {
77
- O.current = u;
78
- }, [u]), p(() => {
79
- let e = [], s = () => {
77
+ l(() => {
78
+ N.current = E;
79
+ }, [E]), l(() => {
80
+ const e = g.current;
81
+ if (!e)
82
+ return;
83
+ const a = () => {
84
+ se(), re();
85
+ };
86
+ return e.addEventListener("wheel", a, { passive: !0, capture: !0 }), () => {
87
+ e.removeEventListener("wheel", a, { capture: !0 });
80
88
  };
81
- t?.map ? (e = t.map.getObjects(), console.debug("re-initialize here map")) : console.debug("initialize here map"), t?.map && (console.debug("disposing previous map"), We(t.map), t.mapEvents && t.mapEvents.dispose(), t.map.dispose());
82
- const A = y && Ke(y), M = ot(B), f = st(a, E), Y = M.createDefaultLayers({ engineType: f, lg: i, pois: !0 });
83
- return rt({
84
- baseLayerName: a,
85
- defaultLayers: Y,
86
- enableWebGL: E,
87
- platform: M,
88
- engineType: f,
89
- vehicleRestrictions: o.includes(le),
90
- language: i,
89
+ }, []), l(() => {
90
+ let e = [], a = () => {
91
+ };
92
+ t?.map ? (e = t.map.getObjects(), console.debug("re-initialize here map")) : console.debug("initialize here map"), t?.map && (console.debug("disposing previous map"), Ge(t.map), t.mapEvents && t.mapEvents.dispose(), t.map.dispose());
93
+ const P = S && $e(S), h = st(U), M = lt(o, u), x = h.createDefaultLayers({ engineType: M, lg: m, pois: !0 });
94
+ return it({
95
+ baseLayerName: o,
96
+ defaultLayers: x,
97
+ enableWebGL: u,
98
+ platform: h,
99
+ engineType: M,
100
+ vehicleRestrictions: r.includes(pe),
101
+ language: m,
91
102
  minZoom: T,
92
- maxZoom: b
93
- }).then((x) => {
94
- const re = () => {
95
- ae();
96
- }, se = () => {
97
- ne();
98
- }, n = new H.Map(w.current, x.baseLayer, {
99
- zoom: j,
100
- center: z,
101
- bounds: A,
102
- engineType: f,
103
- pixelRatio: te,
103
+ maxZoom: D
104
+ }).then((F) => {
105
+ const le = () => {
106
+ se();
107
+ }, me = () => {
108
+ re();
109
+ }, n = new H.Map(g.current, F.baseLayer, {
110
+ zoom: W,
111
+ center: V,
112
+ bounds: P,
113
+ engineType: M,
114
+ pixelRatio: oe,
104
115
  fixedCenter: !0
105
116
  });
106
- x.overlayLayer && n.addLayer(x.overlayLayer), Pe(!0);
107
- let Z = !1, R;
108
- W || (Z = new H.mapevents.MapEvents(n)), W || q || (R = new H.mapevents.Behavior(Z), R.disable(H.mapevents.Behavior.Feature.FRACTIONAL_ZOOM), de && R.disable(H.mapevents.Behavior.Feature.ZOOM_MOMENTUM)), qe(n, he, n), n.addEventListener("mapviewchangestart", re), n.addEventListener("mapviewchangeend", se);
109
- const Ye = $e(n, Y, ve, i);
110
- ye({
111
- credentials: B,
112
- defaultLayers: Y,
117
+ F.overlayLayer && n.addLayer(F.overlayLayer), ye(!0);
118
+ let B = !1, C;
119
+ G || (B = new H.mapevents.MapEvents(n)), G || K || (C = new H.mapevents.Behavior(B), b || C.disable(H.mapevents.Behavior.Feature.FRACTIONAL_ZOOM), X && C.disable(H.mapevents.Behavior.Feature.ZOOM_MOMENTUM)), Ke(n, he, n), n.addEventListener("mapviewchangestart", le), n.addEventListener("mapviewchangeend", me);
120
+ const xe = Qe(n, x, Me, m);
121
+ be({
122
+ credentials: U,
123
+ defaultLayers: x,
113
124
  map: n,
114
- mapEvents: Z,
115
- behavior: R,
116
- platform: M,
117
- ui: Ye,
118
- utils: Xe(n),
125
+ mapEvents: B,
126
+ behavior: C,
127
+ platform: h,
128
+ ui: xe,
129
+ utils: Je(n),
119
130
  // Put settings back into the map API object so the invoking service
120
131
  // can check on these settings for instance inside a test
121
132
  settings: {
122
- enableWebGL: E,
123
- baseLayer: a,
124
- activeLayers: o,
125
- showCluster: Q,
133
+ enableWebGL: u,
134
+ baseLayer: o,
135
+ activeLayers: r,
136
+ showCluster: ne,
126
137
  minZoom: T,
127
- maxZoom: b
138
+ maxZoom: D
128
139
  }
129
- }), e && n.addObjects(e), s = () => {
130
- n.removeEventListener("mapviewchangestart", re), n.removeEventListener("mapviewchangeend", se);
140
+ }), e && n.addObjects(e), a = () => {
141
+ n.removeEventListener("mapviewchangestart", le), n.removeEventListener("mapviewchangeend", me);
131
142
  };
132
143
  }), () => {
133
- s(), v(), h(!1);
144
+ a(), f(), v(!1), _(!1);
134
145
  };
135
- }, [E, K, i, a, T, I]), p(() => (u || (v(), h(!1)), () => {
136
- v(), h(!1);
137
- }), [u]);
138
- const D = Je();
139
- p(() => {
140
- D && a === P ? g(F) : !D && a === F && g(P);
141
- }, [D, i]), p(() => g(L), [L]);
142
- const [Ie, be] = m(c);
143
- Fe(c, Ie) || (J(c), be(c)), p(() => ee(S), [S]);
144
- const g = (e) => {
145
- Se(e), fe(e, L);
146
- }, we = (e) => {
147
- const s = (M) => o.filter((f) => f !== M), A = o.includes(e) ? s(e) : [...o, e];
148
- J(A), Me(A, o);
149
- }, Oe = (e) => {
150
- ee(e), Le(e);
151
- }, oe = () => {
146
+ }, [
147
+ u,
148
+ J,
149
+ m,
150
+ o,
151
+ T,
152
+ O,
153
+ X,
154
+ b
155
+ ]), l(() => (E || (f(), v(!1)), () => {
156
+ f(), v(!1), _(!1);
157
+ }), [E]);
158
+ const Y = et();
159
+ l(() => {
160
+ Y && o === y ? A(k) : !Y && o === k && A(y);
161
+ }, [Y, m]), l(() => A(L), [L]);
162
+ const [Oe, De] = i(p);
163
+ ke(p, Oe) || (te(p), De(p)), l(() => ae(w), [w]);
164
+ const A = (e) => {
165
+ we(e), Te(e, L);
166
+ }, Ne = (e) => {
167
+ const a = (h) => r.filter((M) => M !== h), P = r.includes(e) ? a(e) : [...r, e];
168
+ te(P), Le(P, r);
169
+ }, Ye = (e) => {
170
+ ae(e), ge(e);
171
+ }, ie = () => {
152
172
  document.querySelector(".AssetTree")?.classList.add("pointer-events-none");
153
- }, N = () => {
173
+ }, Z = () => {
154
174
  document.querySelector(".AssetTree")?.classList.remove("pointer-events-none");
155
- }, _ = {};
156
- U && (_.height = U), k && (_.width = k);
157
- const De = Ze(_) ? "height-100pct" : "", Ne = () => {
158
- ae(), ne();
159
- };
160
- return /* @__PURE__ */ l(
175
+ }, R = {};
176
+ j && (R.height = j), z && (R.width = z);
177
+ const Ze = Be(R) ? "height-100pct" : "";
178
+ return /* @__PURE__ */ c(
161
179
  "div",
162
180
  {
163
- className: `Map position-relative map-type-${a.toLowerCase()} ${De}`,
164
- style: _,
165
- ref: w,
166
- onWheelCapture: Ne,
167
- onTouchStart: oe,
168
- onTouchEnd: N,
169
- onMouseEnter: oe,
170
- onMouseOut: N,
171
- onBlur: N,
172
- children: Ce && t && /* @__PURE__ */ xe(
173
- Ge.Provider,
181
+ className: `Map position-relative map-type-${o.toLowerCase()} ${Ze}`,
182
+ style: R,
183
+ ref: g,
184
+ onTouchStart: ie,
185
+ onTouchEnd: Z,
186
+ onMouseEnter: ie,
187
+ onMouseOut: Z,
188
+ onBlur: Z,
189
+ children: Ie && t && /* @__PURE__ */ Fe(
190
+ Xe.Provider,
174
191
  {
175
192
  value: {
176
193
  api: t,
177
- language: i,
178
- enableWebGL: E,
179
- enableMarkerIconCache: Re,
180
- showCluster: Q,
181
- activeLayers: o,
182
- baseLayer: a,
183
- hideMapLayerSettings: ue,
184
- hideClusterSettings: Ee,
185
- onMapTypeChange: g,
186
- onMapLayerChange: we,
187
- onShowClusterChange: Oe,
188
- mapSettingsTooltip: Ae,
189
- onIncidentsChange: _e,
190
- devicePixelRatio: te
194
+ language: m,
195
+ enableWebGL: u,
196
+ enableMarkerIconCache: Ce,
197
+ enableFractionalZoom: b,
198
+ isZoomInteractionActive: Se,
199
+ showCluster: ne,
200
+ activeLayers: r,
201
+ baseLayer: o,
202
+ hideMapLayerSettings: fe,
203
+ hideClusterSettings: ve,
204
+ onMapTypeChange: A,
205
+ onMapLayerChange: Ne,
206
+ onShowClusterChange: Ye,
207
+ mapSettingsTooltip: Pe,
208
+ onIncidentsChange: Re,
209
+ devicePixelRatio: oe
191
210
  },
192
211
  children: [
193
- /* @__PURE__ */ l(nt, { api: t, boundingBox: y, center: z, zoomAnimation: V }),
194
- /* @__PURE__ */ l(tt, { api: t }),
195
- /* @__PURE__ */ l(
196
- Qe,
212
+ /* @__PURE__ */ c(ot, { api: t, boundingBox: S, center: V, zoomAnimation: q }),
213
+ /* @__PURE__ */ c(at, { api: t }),
214
+ /* @__PURE__ */ c(
215
+ tt,
197
216
  {
198
- zoom: j,
199
- hideZoomButtons: q,
200
- onZoomIn: Te,
201
- onZoomOut: ge,
202
- zoomAnimation: V
217
+ zoom: W,
218
+ hideZoomButtons: K,
219
+ onZoomIn: _e,
220
+ onZoomOut: Ae,
221
+ zoomAnimation: q
203
222
  }
204
223
  ),
205
- G && G,
206
- /* @__PURE__ */ l(et, { layers: o }),
207
- /* @__PURE__ */ l(at, { api: t, children: pe })
224
+ $ && $,
225
+ /* @__PURE__ */ c(nt, { layers: r }),
226
+ /* @__PURE__ */ c(rt, { api: t, children: Ee })
208
227
  ]
209
228
  }
210
229
  )
211
230
  }
212
231
  );
213
232
  };
214
- r.TYPE_DEFAULT = P;
215
- r.TYPE_FLEET_STYLE = He;
216
- r.TYPE_SATELLITE = Ue;
217
- r.TYPE_TERRAIN = ze;
218
- r.TYPE_NIGHT = F;
219
- r.LAYER_INCIDENTS = je;
220
- r.LAYER_TRAFFIC = Ve;
221
- r.LAYER_ROAD_RESTRICTIONS = le;
233
+ s.TYPE_DEFAULT = y;
234
+ s.TYPE_FLEET_STYLE = ze;
235
+ s.TYPE_SATELLITE = je;
236
+ s.TYPE_TERRAIN = Ve;
237
+ s.TYPE_NIGHT = k;
238
+ s.LAYER_INCIDENTS = We;
239
+ s.LAYER_TRAFFIC = qe;
240
+ s.LAYER_ROAD_RESTRICTIONS = pe;
222
241
  export {
223
- r as default
242
+ s as default
224
243
  };
225
244
  //# sourceMappingURL=Map.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Map.js","sources":["../../../../src/components/map/components/Map.tsx"],"sourcesContent":["import { useRef, useState, useEffect, type CSSProperties } from 'react';\nimport { isEmpty } from 'es-toolkit/compat';\nimport { isEqual } from 'es-toolkit/predicate';\n\nimport {\n MAP_TYPE_DEFAULT,\n MAP_TYPE_FLEET_STYLE,\n MAP_TYPE_SATELLITE,\n MAP_TYPE_TERRAIN,\n MAP_TYPE_NIGHT,\n MAP_LAYER_INCIDENTS,\n MAP_LAYER_TRAFFIC,\n MAP_LAYER_ROAD_RESTRICTIONS,\n DEFAULT_MIN_ZOOM,\n DEFAULT_MAX_ZOOM,\n DEFAULT_PIXEL_RATIO,\n} from './constants';\n\nimport { addEventListenerMap, removeEventListenerMap } from '../utils/eventHandling';\nimport { MapContext } from './MapContext';\nimport { createUtils, getMapBounds } from '../utils/mapUtils';\nimport { getHereUi } from '../utils/mapUi';\nimport useDarkMode from '../../../hooks/useDarkMode';\nimport MapZoom from './features/MapZoom';\nimport MapOverlayLayers from './features/layers/MapOverlayLayers';\nimport MapSize from './MapSize';\nimport MapPosition from './MapPosition';\nimport MapElements from './MapElements';\nimport type { MapApi, MapLayer, MapProps, MapType } from '../utils/mapTypes';\nimport { getPlatform, getEngineType, getBaseLayer } from '../utils/rendering';\n\nconst MARKER_POINTER_EVENTS_DISABLED_CLASS = 'map-disable-marker-pointer-events';\nconst MARKER_POINTER_EVENTS_RESET_DELAY_MS = 140;\n\nconst Map = (props: MapProps) => {\n const {\n children,\n credentials,\n width,\n height,\n language: lang = 'en',\n center,\n zoom,\n zoomAnimation = false,\n boundingBox,\n hideClusterSettings = false,\n hideMapLayerSettings = false,\n disableMapEvents,\n disableBehavior = false,\n disableZoomMomentum = true,\n eventListenerMap,\n mapType = MAP_TYPE_DEFAULT,\n mapLayer = [],\n showCluster: externalShowCluster = true,\n showScaleBar = false,\n onMapLayerChange = () => {},\n onMapTypeChange = () => {},\n onShowClusterChange = () => {},\n onZoomIn = () => {},\n onZoomOut = () => {},\n onIncidentsChange = () => {},\n mapSettingsTooltip,\n mapSettings,\n enableWebGL = true,\n enableDevicePixelRatio = true,\n enableMarkerIconCache = true,\n disableMarkerPointerEventsWhileZooming = false,\n pixelRatio = DEFAULT_PIXEL_RATIO,\n minZoom = DEFAULT_MIN_ZOOM,\n maxZoom = DEFAULT_MAX_ZOOM,\n } = props;\n\n let safeMaxZoom = maxZoom;\n\n if (minZoom > maxZoom) {\n // Avoid crashing the map for invalid zoom limits\n safeMaxZoom = DEFAULT_MAX_ZOOM;\n console.error('Invalid condition for zoom limits: min <= max)');\n }\n\n const mapRef = useRef<HTMLDivElement>(null);\n const markerPointerEventsResetTimeoutRef = useRef<number | undefined>();\n const markerPointerEventsDisabledRef = useRef(false);\n const disableMarkerPointerEventsWhileZoomingRef = useRef(disableMarkerPointerEventsWhileZooming);\n\n const [isMapInitialized, setMapInitialized] = useState(false);\n\n const [api, setApi] = useState<MapApi>();\n\n const [baseLayer, setBaseLayer] = useState<MapType>(mapType);\n const [activeLayers, setActiveLayers] = useState<MapLayer[]>(mapLayer);\n const [showCluster, setShowCluster] = useState(externalShowCluster);\n\n const devicePixelRatio = enableDevicePixelRatio ? window.devicePixelRatio || pixelRatio : pixelRatio;\n\n // Only short locale is supported by HERE Map\n const language = (locale => (locale === 'nb' ? 'no' : locale))(lang.split('-')[0].toLowerCase());\n\n const setMarkerPointerEventsDisabled = (disabled: boolean) => {\n if (disabled && !disableMarkerPointerEventsWhileZoomingRef.current) {\n return;\n }\n\n const mapElement = mapRef.current;\n\n if (!mapElement) {\n return;\n }\n\n mapElement.classList.toggle(MARKER_POINTER_EVENTS_DISABLED_CLASS, disabled);\n markerPointerEventsDisabledRef.current = disabled;\n };\n\n const clearMarkerPointerEventsResetTimeout = () => {\n if (markerPointerEventsResetTimeoutRef.current !== undefined) {\n window.clearTimeout(markerPointerEventsResetTimeoutRef.current);\n markerPointerEventsResetTimeoutRef.current = undefined;\n }\n };\n\n const scheduleMarkerPointerEventsEnable = () => {\n clearMarkerPointerEventsResetTimeout();\n markerPointerEventsResetTimeoutRef.current = window.setTimeout(() => {\n setMarkerPointerEventsDisabled(false);\n markerPointerEventsResetTimeoutRef.current = undefined;\n }, MARKER_POINTER_EVENTS_RESET_DELAY_MS);\n };\n\n const temporarilyDisableMarkerPointerEvents = () => {\n if (!disableMarkerPointerEventsWhileZoomingRef.current) {\n return;\n }\n\n clearMarkerPointerEventsResetTimeout();\n\n if (!markerPointerEventsDisabledRef.current) {\n setMarkerPointerEventsDisabled(true);\n }\n };\n\n useEffect(() => {\n disableMarkerPointerEventsWhileZoomingRef.current = disableMarkerPointerEventsWhileZooming;\n }, [disableMarkerPointerEventsWhileZooming]);\n\n useEffect(() => {\n let allMapObjects: H.map.Object[] = [];\n let removeMapViewChangeListeners = () => {};\n\n if (api?.map) {\n allMapObjects = api.map.getObjects();\n console.debug('re-initialize here map');\n } else {\n console.debug('initialize here map');\n }\n\n if (api?.map) {\n // Cleanup any previously initialized map before doing anything else\n console.debug('disposing previous map');\n removeEventListenerMap(api.map);\n\n if (api.mapEvents) {\n api.mapEvents.dispose();\n }\n\n api.map.dispose();\n }\n\n const bounds = boundingBox && getMapBounds(boundingBox);\n\n // Initialize communication with the platform\n const platform = getPlatform(credentials);\n\n // Specify engine type. In this example, we use HARP rendering engine, which is capable\n // of rendering vector data using the style configuration exported from the HERE Style Editor.\n // HARP engine is not the default engine, and it's not included in the mapsjs-core.js module.\n // To use this engine, you need to include mapsjs-harp.js file to your HTML page\n const engineType = getEngineType(baseLayer, enableWebGL);\n\n // Obtain the default map types from the platform object\n // @ts-expect-error-next-line: according to the Here docs, the engine type exists\n // see https://www.here.com/docs/bundle/maps-api-for-javascript-developer-guide/page/topics/harp-migrate.html\n const defaultLayers = platform.createDefaultLayers({ engineType, lg: language, pois: true });\n\n getBaseLayer({\n baseLayerName: baseLayer,\n defaultLayers,\n enableWebGL,\n platform,\n engineType,\n vehicleRestrictions: activeLayers.includes(MAP_LAYER_ROAD_RESTRICTIONS),\n language,\n minZoom,\n maxZoom: safeMaxZoom,\n }).then(defaultLayerMap => {\n const handleMapViewChangeStart = () => {\n temporarilyDisableMarkerPointerEvents();\n };\n\n const handleMapViewChangeEnd = () => {\n scheduleMarkerPointerEventsEnable();\n };\n\n // Initialize the map\n const hereMap = new H.Map(mapRef.current as Element, defaultLayerMap.baseLayer, {\n zoom,\n center,\n bounds,\n engineType,\n pixelRatio: devicePixelRatio,\n fixedCenter: true,\n });\n\n if (defaultLayerMap.overlayLayer) {\n // Special case for satellite map where we render street labels and road signs as well as additional pois as vector data\n // hereMap.setBaseLayer(defaultLayerMap.baseLayer);\n hereMap.addLayer(defaultLayerMap.overlayLayer);\n }\n\n setMapInitialized(true);\n\n let hereMapEvents: H.mapevents.MapEvents | false = false;\n let hereBehavior: H.mapevents.Behavior | undefined;\n\n if (!disableMapEvents) {\n // Enable the map event system\n hereMapEvents = new H.mapevents.MapEvents(hereMap);\n }\n\n if (!(disableMapEvents || disableBehavior)) {\n hereBehavior = new H.mapevents.Behavior(hereMapEvents as H.mapevents.MapEvents);\n // @ts-expect-error-next-line\n hereBehavior.disable(H.mapevents.Behavior.Feature.FRACTIONAL_ZOOM);\n\n if (disableZoomMomentum) {\n // Disable the inertia that occurs on WebGL maps when scrolling/zooming.\n // This resulted in a very high scroll sensitivity.\n // @ts-expect-error-next-line\n hereBehavior.disable(H.mapevents.Behavior.Feature.ZOOM_MOMENTUM);\n }\n }\n\n addEventListenerMap(hereMap, eventListenerMap, hereMap);\n hereMap.addEventListener('mapviewchangestart', handleMapViewChangeStart as EventListener);\n hereMap.addEventListener('mapviewchangeend', handleMapViewChangeEnd as EventListener);\n\n const hereUi = getHereUi(hereMap, defaultLayers, showScaleBar, language);\n\n // The api will be passed to services when using a render function.\n // This allows the service to access the map internals\n setApi({\n credentials,\n defaultLayers,\n map: hereMap,\n mapEvents: hereMapEvents,\n behavior: hereBehavior,\n platform,\n ui: hereUi,\n utils: createUtils(hereMap),\n // Put settings back into the map API object so the invoking service\n // can check on these settings for instance inside a test\n settings: {\n enableWebGL,\n baseLayer,\n activeLayers,\n showCluster,\n minZoom,\n maxZoom: safeMaxZoom,\n },\n });\n\n if (allMapObjects) {\n // If the base layer changed, re-add all previous objects again,\n // otherwise the map would be empty\n hereMap.addObjects(allMapObjects);\n }\n\n removeMapViewChangeListeners = () => {\n hereMap.removeEventListener('mapviewchangestart', handleMapViewChangeStart as EventListener);\n hereMap.removeEventListener('mapviewchangeend', handleMapViewChangeEnd as EventListener);\n };\n });\n\n return () => {\n removeMapViewChangeListeners();\n clearMarkerPointerEventsResetTimeout();\n setMarkerPointerEventsDisabled(false);\n };\n }, [enableWebGL, enableDevicePixelRatio, language, baseLayer, minZoom, maxZoom]);\n\n useEffect(() => {\n if (!disableMarkerPointerEventsWhileZooming) {\n clearMarkerPointerEventsResetTimeout();\n setMarkerPointerEventsDisabled(false);\n }\n\n return () => {\n clearMarkerPointerEventsResetTimeout();\n setMarkerPointerEventsDisabled(false);\n };\n }, [disableMarkerPointerEventsWhileZooming]);\n\n const isDarkMode = useDarkMode();\n useEffect(() => {\n // Toggle night map only if current map type is default\n if (isDarkMode && baseLayer === MAP_TYPE_DEFAULT) {\n handleMapTypeChange(MAP_TYPE_NIGHT);\n }\n // Toggle back to default map only if current map type is night\n else if (!isDarkMode && baseLayer === MAP_TYPE_NIGHT) {\n handleMapTypeChange(MAP_TYPE_DEFAULT);\n }\n }, [isDarkMode, language]);\n\n // Update MapType from outside\n useEffect(() => handleMapTypeChange(mapType), [mapType]);\n\n // Update MapLayer from outside\n const [previousMapLayer, setPreviousMapLayer] = useState(mapLayer);\n if (!isEqual(mapLayer, previousMapLayer)) {\n setActiveLayers(mapLayer);\n setPreviousMapLayer(mapLayer);\n }\n\n // Update Cluster setting from outside\n useEffect(() => setShowCluster(externalShowCluster), [externalShowCluster]);\n\n const handleMapTypeChange = (newMapType: MapType) => {\n setBaseLayer(newMapType);\n onMapTypeChange(newMapType, mapType);\n };\n\n const handleMapLayerChange = (layer: MapLayer) => {\n const removeLayer = (layerToRemove: string) => activeLayers.filter(item => item !== layerToRemove);\n const newActiveLayers = activeLayers.includes(layer) ? removeLayer(layer) : [...activeLayers, layer];\n setActiveLayers(newActiveLayers);\n onMapLayerChange(newActiveLayers, activeLayers);\n };\n\n const handleShowClusterChange = (newShowCluster: boolean) => {\n setShowCluster(newShowCluster);\n onShowClusterChange(newShowCluster);\n };\n\n // Note: For performance reasons, we deactivate pointer events and hence CSS style recalculation for the\n // the body. Having for instance many assets in the tree causes a performance loss when clicking on the map\n // to move it and zoom in/out since the map triggers a style invalidation and recalculation and\n // due to the nature of the AssetTree with it's hundreds DOM nodes, applying the CSS selectors\n // takes time.\n const handleMapInteractionStart = () => {\n document.querySelector('.AssetTree')?.classList.add('pointer-events-none');\n };\n const handleMapInteractionEnd = () => {\n document.querySelector('.AssetTree')?.classList.remove('pointer-events-none');\n };\n\n const style: CSSProperties = {};\n if (height) {\n style.height = height;\n }\n if (width) {\n style.width = width;\n }\n const autoHeightClass = isEmpty(style) ? 'height-100pct' : '';\n\n const handleMapWheelCapture = () => {\n temporarilyDisableMarkerPointerEvents();\n scheduleMarkerPointerEventsEnable();\n };\n\n return (\n <div\n className={`Map position-relative map-type-${baseLayer.toLowerCase()} ${autoHeightClass}`}\n style={style}\n ref={mapRef}\n onWheelCapture={handleMapWheelCapture}\n onTouchStart={handleMapInteractionStart}\n onTouchEnd={handleMapInteractionEnd}\n onMouseEnter={handleMapInteractionStart}\n onMouseOut={handleMapInteractionEnd}\n onBlur={handleMapInteractionEnd}\n >\n {isMapInitialized && api && (\n <MapContext.Provider\n value={{\n api,\n language,\n enableWebGL,\n enableMarkerIconCache,\n showCluster,\n activeLayers,\n baseLayer,\n hideMapLayerSettings,\n hideClusterSettings,\n onMapTypeChange: handleMapTypeChange,\n onMapLayerChange: handleMapLayerChange,\n onShowClusterChange: handleShowClusterChange,\n mapSettingsTooltip,\n onIncidentsChange,\n devicePixelRatio,\n }}\n >\n <MapPosition api={api} boundingBox={boundingBox} center={center} zoomAnimation={zoomAnimation} />\n <MapSize api={api} />\n <MapZoom\n zoom={zoom}\n hideZoomButtons={disableBehavior}\n onZoomIn={onZoomIn}\n onZoomOut={onZoomOut}\n zoomAnimation={zoomAnimation}\n />\n {mapSettings && mapSettings}\n <MapOverlayLayers layers={activeLayers} />\n <MapElements api={api}>{children}</MapElements>\n </MapContext.Provider>\n )}\n </div>\n );\n};\n\nMap.TYPE_DEFAULT = MAP_TYPE_DEFAULT;\nMap.TYPE_FLEET_STYLE = MAP_TYPE_FLEET_STYLE;\nMap.TYPE_SATELLITE = MAP_TYPE_SATELLITE;\nMap.TYPE_TERRAIN = MAP_TYPE_TERRAIN;\nMap.TYPE_NIGHT = MAP_TYPE_NIGHT;\n\nMap.LAYER_INCIDENTS = MAP_LAYER_INCIDENTS;\nMap.LAYER_TRAFFIC = MAP_LAYER_TRAFFIC;\nMap.LAYER_ROAD_RESTRICTIONS = MAP_LAYER_ROAD_RESTRICTIONS;\n\nexport default Map;\n"],"names":["MARKER_POINTER_EVENTS_DISABLED_CLASS","MARKER_POINTER_EVENTS_RESET_DELAY_MS","Map","props","children","credentials","width","height","lang","center","zoom","zoomAnimation","boundingBox","hideClusterSettings","hideMapLayerSettings","disableMapEvents","disableBehavior","disableZoomMomentum","eventListenerMap","mapType","MAP_TYPE_DEFAULT","mapLayer","externalShowCluster","showScaleBar","onMapLayerChange","onMapTypeChange","onShowClusterChange","onZoomIn","onZoomOut","onIncidentsChange","mapSettingsTooltip","mapSettings","enableWebGL","enableDevicePixelRatio","enableMarkerIconCache","disableMarkerPointerEventsWhileZooming","pixelRatio","DEFAULT_PIXEL_RATIO","minZoom","DEFAULT_MIN_ZOOM","maxZoom","DEFAULT_MAX_ZOOM","safeMaxZoom","mapRef","useRef","markerPointerEventsResetTimeoutRef","markerPointerEventsDisabledRef","disableMarkerPointerEventsWhileZoomingRef","isMapInitialized","setMapInitialized","useState","api","setApi","baseLayer","setBaseLayer","activeLayers","setActiveLayers","showCluster","setShowCluster","devicePixelRatio","language","locale","setMarkerPointerEventsDisabled","disabled","mapElement","clearMarkerPointerEventsResetTimeout","scheduleMarkerPointerEventsEnable","temporarilyDisableMarkerPointerEvents","useEffect","allMapObjects","removeMapViewChangeListeners","removeEventListenerMap","bounds","getMapBounds","platform","getPlatform","engineType","getEngineType","defaultLayers","getBaseLayer","MAP_LAYER_ROAD_RESTRICTIONS","defaultLayerMap","handleMapViewChangeStart","handleMapViewChangeEnd","hereMap","hereMapEvents","hereBehavior","addEventListenerMap","hereUi","getHereUi","createUtils","isDarkMode","useDarkMode","handleMapTypeChange","MAP_TYPE_NIGHT","previousMapLayer","setPreviousMapLayer","isEqual","newMapType","handleMapLayerChange","layer","removeLayer","layerToRemove","item","newActiveLayers","handleShowClusterChange","newShowCluster","handleMapInteractionStart","handleMapInteractionEnd","style","autoHeightClass","isEmpty","handleMapWheelCapture","jsx","jsxs","MapContext","MapPosition","MapSize","MapZoom","MapOverlayLayers","MapElements","MAP_TYP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AIhB;AAEAF,EAAI,eAAekB;AACnBlB,EAAI,mBAAmBuH;AACvBvH,EAAI,iBAAiBwH;AACrBxH,EAAI,eAAeyH;AACnBzH,EAAI,aAAa4F;AAEjB5F,EAAI,kBAAkB0H;AACtB1H,EAAI,gBAAgB2H;AACpB3H,EAAI,0BAA0B8E;"}
1
+ {"version":3,"file":"Map.js","sources":["../../../../src/components/map/components/Map.tsx"],"sourcesContent":["import { useRef, useState, useEffect, type CSSProperties } from 'react';\nimport { isEmpty } from 'es-toolkit/compat';\nimport { isEqual } from 'es-toolkit/predicate';\n\nimport {\n MAP_TYPE_DEFAULT,\n MAP_TYPE_FLEET_STYLE,\n MAP_TYPE_SATELLITE,\n MAP_TYPE_TERRAIN,\n MAP_TYPE_NIGHT,\n MAP_LAYER_INCIDENTS,\n MAP_LAYER_TRAFFIC,\n MAP_LAYER_ROAD_RESTRICTIONS,\n DEFAULT_MIN_ZOOM,\n DEFAULT_MAX_ZOOM,\n DEFAULT_PIXEL_RATIO,\n} from './constants';\n\nimport { addEventListenerMap, removeEventListenerMap } from '../utils/eventHandling';\nimport { MapContext } from './MapContext';\nimport { createUtils, getMapBounds } from '../utils/mapUtils';\nimport { getHereUi } from '../utils/mapUi';\nimport useDarkMode from '../../../hooks/useDarkMode';\nimport MapZoom from './features/MapZoom';\nimport MapOverlayLayers from './features/layers/MapOverlayLayers';\nimport MapSize from './MapSize';\nimport MapPosition from './MapPosition';\nimport MapElements from './MapElements';\nimport type { MapApi, MapLayer, MapProps, MapType } from '../utils/mapTypes';\nimport { getPlatform, getEngineType, getBaseLayer } from '../utils/rendering';\n\nconst MARKER_POINTER_EVENTS_DISABLED_CLASS = 'map-disable-marker-pointer-events';\nconst MARKER_POINTER_EVENTS_RESET_DELAY_MS = 140;\n\nconst Map = (props: MapProps) => {\n const {\n children,\n credentials,\n width,\n height,\n language: lang = 'en',\n center,\n zoom,\n zoomAnimation = false,\n boundingBox,\n hideClusterSettings = false,\n hideMapLayerSettings = false,\n disableMapEvents,\n disableBehavior = false,\n disableZoomMomentum = true,\n enableFractionalZoom = false,\n eventListenerMap,\n mapType = MAP_TYPE_DEFAULT,\n mapLayer = [],\n showCluster: externalShowCluster = true,\n showScaleBar = false,\n onMapLayerChange = () => {},\n onMapTypeChange = () => {},\n onShowClusterChange = () => {},\n onZoomIn = () => {},\n onZoomOut = () => {},\n onIncidentsChange = () => {},\n mapSettingsTooltip,\n mapSettings,\n enableWebGL = true,\n enableDevicePixelRatio = true,\n enableMarkerIconCache = true,\n disableMarkerPointerEventsWhileZooming = false,\n pixelRatio = DEFAULT_PIXEL_RATIO,\n minZoom = DEFAULT_MIN_ZOOM,\n maxZoom = DEFAULT_MAX_ZOOM,\n } = props;\n\n let safeMaxZoom = maxZoom;\n\n if (minZoom > maxZoom) {\n // Avoid crashing the map for invalid zoom limits\n safeMaxZoom = DEFAULT_MAX_ZOOM;\n console.error('Invalid condition for zoom limits: min <= max)');\n }\n\n const mapRef = useRef<HTMLDivElement>(null);\n const markerPointerEventsResetTimeoutRef = useRef<number | undefined>();\n const markerPointerEventsDisabledRef = useRef(false);\n const disableMarkerPointerEventsWhileZoomingRef = useRef(disableMarkerPointerEventsWhileZooming);\n\n const [isMapInitialized, setMapInitialized] = useState(false);\n const [isZoomInteractionActive, setIsZoomInteractionActive] = useState(false);\n\n const [api, setApi] = useState<MapApi>();\n\n const [baseLayer, setBaseLayer] = useState<MapType>(mapType);\n const [activeLayers, setActiveLayers] = useState<MapLayer[]>(mapLayer);\n const [showCluster, setShowCluster] = useState(externalShowCluster);\n\n const devicePixelRatio = enableDevicePixelRatio ? window.devicePixelRatio || pixelRatio : pixelRatio;\n\n // Only short locale is supported by HERE Map\n const language = (locale => (locale === 'nb' ? 'no' : locale))(lang.split('-')[0].toLowerCase());\n\n const setMarkerPointerEventsDisabled = (disabled: boolean) => {\n if (disabled && !disableMarkerPointerEventsWhileZoomingRef.current) {\n return;\n }\n\n const mapElement = mapRef.current;\n\n if (!mapElement) {\n return;\n }\n\n mapElement.classList.toggle(MARKER_POINTER_EVENTS_DISABLED_CLASS, disabled);\n markerPointerEventsDisabledRef.current = disabled;\n };\n\n const clearMarkerPointerEventsResetTimeout = () => {\n if (markerPointerEventsResetTimeoutRef.current !== undefined) {\n window.clearTimeout(markerPointerEventsResetTimeoutRef.current);\n markerPointerEventsResetTimeoutRef.current = undefined;\n }\n };\n\n const scheduleMarkerPointerEventsEnable = () => {\n clearMarkerPointerEventsResetTimeout();\n markerPointerEventsResetTimeoutRef.current = window.setTimeout(() => {\n setMarkerPointerEventsDisabled(false);\n setIsZoomInteractionActive(false);\n markerPointerEventsResetTimeoutRef.current = undefined;\n }, MARKER_POINTER_EVENTS_RESET_DELAY_MS);\n };\n\n const temporarilyDisableMarkerPointerEvents = () => {\n setIsZoomInteractionActive(true);\n\n clearMarkerPointerEventsResetTimeout();\n\n if (disableMarkerPointerEventsWhileZoomingRef.current && !markerPointerEventsDisabledRef.current) {\n setMarkerPointerEventsDisabled(true);\n }\n };\n\n useEffect(() => {\n disableMarkerPointerEventsWhileZoomingRef.current = disableMarkerPointerEventsWhileZooming;\n }, [disableMarkerPointerEventsWhileZooming]);\n\n useEffect(() => {\n const mapElement = mapRef.current;\n\n if (!mapElement) {\n return;\n }\n\n const handleWheel = () => {\n temporarilyDisableMarkerPointerEvents();\n scheduleMarkerPointerEventsEnable();\n };\n\n mapElement.addEventListener('wheel', handleWheel, { passive: true, capture: true });\n\n return () => {\n mapElement.removeEventListener('wheel', handleWheel, { capture: true });\n };\n }, []);\n\n useEffect(() => {\n let allMapObjects: H.map.Object[] = [];\n let removeMapViewChangeListeners = () => {};\n\n if (api?.map) {\n allMapObjects = api.map.getObjects();\n console.debug('re-initialize here map');\n } else {\n console.debug('initialize here map');\n }\n\n if (api?.map) {\n // Cleanup any previously initialized map before doing anything else\n console.debug('disposing previous map');\n removeEventListenerMap(api.map);\n\n if (api.mapEvents) {\n api.mapEvents.dispose();\n }\n\n api.map.dispose();\n }\n\n const bounds = boundingBox && getMapBounds(boundingBox);\n\n // Initialize communication with the platform\n const platform = getPlatform(credentials);\n\n // Specify engine type. In this example, we use HARP rendering engine, which is capable\n // of rendering vector data using the style configuration exported from the HERE Style Editor.\n // HARP engine is not the default engine, and it's not included in the mapsjs-core.js module.\n // To use this engine, you need to include mapsjs-harp.js file to your HTML page\n const engineType = getEngineType(baseLayer, enableWebGL);\n\n // Obtain the default map types from the platform object\n // @ts-expect-error-next-line: according to the Here docs, the engine type exists\n // see https://www.here.com/docs/bundle/maps-api-for-javascript-developer-guide/page/topics/harp-migrate.html\n const defaultLayers = platform.createDefaultLayers({ engineType, lg: language, pois: true });\n\n getBaseLayer({\n baseLayerName: baseLayer,\n defaultLayers,\n enableWebGL,\n platform,\n engineType,\n vehicleRestrictions: activeLayers.includes(MAP_LAYER_ROAD_RESTRICTIONS),\n language,\n minZoom,\n maxZoom: safeMaxZoom,\n }).then(defaultLayerMap => {\n const handleMapViewChangeStart = () => {\n temporarilyDisableMarkerPointerEvents();\n };\n\n const handleMapViewChangeEnd = () => {\n scheduleMarkerPointerEventsEnable();\n };\n\n // Initialize the map\n const hereMap = new H.Map(mapRef.current as Element, defaultLayerMap.baseLayer, {\n zoom,\n center,\n bounds,\n engineType,\n pixelRatio: devicePixelRatio,\n fixedCenter: true,\n });\n\n if (defaultLayerMap.overlayLayer) {\n // Special case for satellite map where we render street labels and road signs as well as additional pois as vector data\n // hereMap.setBaseLayer(defaultLayerMap.baseLayer);\n hereMap.addLayer(defaultLayerMap.overlayLayer);\n }\n\n setMapInitialized(true);\n\n let hereMapEvents: H.mapevents.MapEvents | false = false;\n let hereBehavior: H.mapevents.Behavior | undefined;\n\n if (!disableMapEvents) {\n // Enable the map event system\n hereMapEvents = new H.mapevents.MapEvents(hereMap);\n }\n\n if (!(disableMapEvents || disableBehavior)) {\n hereBehavior = new H.mapevents.Behavior(hereMapEvents as H.mapevents.MapEvents);\n if (!enableFractionalZoom) {\n // Fractional zoom feels less predictable with mouse wheels in some setups,\n // but keeping it enabled can noticeably improve trackpad zoom smoothness.\n // @ts-expect-error-next-line\n hereBehavior.disable(H.mapevents.Behavior.Feature.FRACTIONAL_ZOOM);\n }\n\n if (disableZoomMomentum) {\n // Disable the inertia that occurs on WebGL maps when scrolling/zooming.\n // This resulted in a very high scroll sensitivity.\n // @ts-expect-error-next-line\n hereBehavior.disable(H.mapevents.Behavior.Feature.ZOOM_MOMENTUM);\n }\n }\n\n addEventListenerMap(hereMap, eventListenerMap, hereMap);\n hereMap.addEventListener('mapviewchangestart', handleMapViewChangeStart as EventListener);\n hereMap.addEventListener('mapviewchangeend', handleMapViewChangeEnd as EventListener);\n\n const hereUi = getHereUi(hereMap, defaultLayers, showScaleBar, language);\n\n // The api will be passed to services when using a render function.\n // This allows the service to access the map internals\n setApi({\n credentials,\n defaultLayers,\n map: hereMap,\n mapEvents: hereMapEvents,\n behavior: hereBehavior,\n platform,\n ui: hereUi,\n utils: createUtils(hereMap),\n // Put settings back into the map API object so the invoking service\n // can check on these settings for instance inside a test\n settings: {\n enableWebGL,\n baseLayer,\n activeLayers,\n showCluster,\n minZoom,\n maxZoom: safeMaxZoom,\n },\n });\n\n if (allMapObjects) {\n // If the base layer changed, re-add all previous objects again,\n // otherwise the map would be empty\n hereMap.addObjects(allMapObjects);\n }\n\n removeMapViewChangeListeners = () => {\n hereMap.removeEventListener('mapviewchangestart', handleMapViewChangeStart as EventListener);\n hereMap.removeEventListener('mapviewchangeend', handleMapViewChangeEnd as EventListener);\n };\n });\n\n return () => {\n removeMapViewChangeListeners();\n clearMarkerPointerEventsResetTimeout();\n setMarkerPointerEventsDisabled(false);\n setIsZoomInteractionActive(false);\n };\n }, [\n enableWebGL,\n enableDevicePixelRatio,\n language,\n baseLayer,\n minZoom,\n maxZoom,\n disableZoomMomentum,\n enableFractionalZoom,\n ]);\n\n useEffect(() => {\n if (!disableMarkerPointerEventsWhileZooming) {\n clearMarkerPointerEventsResetTimeout();\n setMarkerPointerEventsDisabled(false);\n }\n\n return () => {\n clearMarkerPointerEventsResetTimeout();\n setMarkerPointerEventsDisabled(false);\n setIsZoomInteractionActive(false);\n };\n }, [disableMarkerPointerEventsWhileZooming]);\n\n const isDarkMode = useDarkMode();\n useEffect(() => {\n // Toggle night map only if current map type is default\n if (isDarkMode && baseLayer === MAP_TYPE_DEFAULT) {\n handleMapTypeChange(MAP_TYPE_NIGHT);\n }\n // Toggle back to default map only if current map type is night\n else if (!isDarkMode && baseLayer === MAP_TYPE_NIGHT) {\n handleMapTypeChange(MAP_TYPE_DEFAULT);\n }\n }, [isDarkMode, language]);\n\n // Update MapType from outside\n useEffect(() => handleMapTypeChange(mapType), [mapType]);\n\n // Update MapLayer from outside\n const [previousMapLayer, setPreviousMapLayer] = useState(mapLayer);\n if (!isEqual(mapLayer, previousMapLayer)) {\n setActiveLayers(mapLayer);\n setPreviousMapLayer(mapLayer);\n }\n\n // Update Cluster setting from outside\n useEffect(() => setShowCluster(externalShowCluster), [externalShowCluster]);\n\n const handleMapTypeChange = (newMapType: MapType) => {\n setBaseLayer(newMapType);\n onMapTypeChange(newMapType, mapType);\n };\n\n const handleMapLayerChange = (layer: MapLayer) => {\n const removeLayer = (layerToRemove: string) => activeLayers.filter(item => item !== layerToRemove);\n const newActiveLayers = activeLayers.includes(layer) ? removeLayer(layer) : [...activeLayers, layer];\n setActiveLayers(newActiveLayers);\n onMapLayerChange(newActiveLayers, activeLayers);\n };\n\n const handleShowClusterChange = (newShowCluster: boolean) => {\n setShowCluster(newShowCluster);\n onShowClusterChange(newShowCluster);\n };\n\n // Note: For performance reasons, we deactivate pointer events and hence CSS style recalculation for the\n // the body. Having for instance many assets in the tree causes a performance loss when clicking on the map\n // to move it and zoom in/out since the map triggers a style invalidation and recalculation and\n // due to the nature of the AssetTree with it's hundreds DOM nodes, applying the CSS selectors\n // takes time.\n const handleMapInteractionStart = () => {\n document.querySelector('.AssetTree')?.classList.add('pointer-events-none');\n };\n const handleMapInteractionEnd = () => {\n document.querySelector('.AssetTree')?.classList.remove('pointer-events-none');\n };\n\n const style: CSSProperties = {};\n if (height) {\n style.height = height;\n }\n if (width) {\n style.width = width;\n }\n const autoHeightClass = isEmpty(style) ? 'height-100pct' : '';\n\n return (\n <div\n className={`Map position-relative map-type-${baseLayer.toLowerCase()} ${autoHeightClass}`}\n style={style}\n ref={mapRef}\n onTouchStart={handleMapInteractionStart}\n onTouchEnd={handleMapInteractionEnd}\n onMouseEnter={handleMapInteractionStart}\n onMouseOut={handleMapInteractionEnd}\n onBlur={handleMapInteractionEnd}\n >\n {isMapInitialized && api && (\n <MapContext.Provider\n value={{\n api,\n language,\n enableWebGL,\n enableMarkerIconCache,\n enableFractionalZoom,\n isZoomInteractionActive,\n showCluster,\n activeLayers,\n baseLayer,\n hideMapLayerSettings,\n hideClusterSettings,\n onMapTypeChange: handleMapTypeChange,\n onMapLayerChange: handleMapLayerChange,\n onShowClusterChange: handleShowClusterChange,\n mapSettingsTooltip,\n onIncidentsChange,\n devicePixelRatio,\n }}\n >\n <MapPosition api={api} boundingBox={boundingBox} center={center} zoomAnimation={zoomAnimation} />\n <MapSize api={api} />\n <MapZoom\n zoom={zoom}\n hideZoomButtons={disableBehavior}\n onZoomIn={onZoomIn}\n onZoomOut={onZoomOut}\n zoomAnimation={zoomAnimation}\n />\n {mapSettings && mapSettings}\n <MapOverlayLayers layers={activeLayers} />\n <MapElements api={api}>{children}</MapElements>\n </MapContext.Provider>\n )}\n </div>\n );\n};\n\nMap.TYPE_DEFAULT = MAP_TYPE_DEFAULT;\nMap.TYPE_FLEET_STYLE = MAP_TYPE_FLEET_STYLE;\nMap.TYPE_SATELLITE = MAP_TYPE_SATELLITE;\nMap.TYPE_TERRAIN = MAP_TYPE_TERRAIN;\nMap.TYPE_NIGHT = MAP_TYPE_NIGHT;\n\nMap.LAYER_INCIDENTS = MAP_LAYER_INCIDENTS;\nMap.LAYER_TRAFFIC = MAP_LAYER_TRAFFIC;\nMap.LAYER_ROAD_RESTRICTIONS = MAP_LAYER_ROAD_RESTRICTIONS;\n\nexport default Map;\n"],"names":["MARKER_POINTER_EVENTS_DISABLED_CLASS","MARKER_POINTER_EVENTS_RESET_DELAY_MS","Map","props","children","credentials","width","height","lang","center","zoom","zoomAnimation","boundingBox","hideClusterSettings","hideMapLayerSettings","disableMapEvents","disableBehavior","disableZoomMomentum","enableFractionalZoom","eventListenerMap","mapType","MAP_TYPE_DEFAULT","mapLayer","externalShowCluster","showScaleBar","onMapLayerChange","onMapTypeChange","onShowClusterChange","onZoomIn","onZoomOut","onIncidentsChange","mapSettingsTooltip","mapSettings","enableWebGL","enableDevicePixelRatio","enableMarkerIconCache","disableMarkerPointerEventsWhileZooming","pixelRatio","DEFAULT_PIXEL_RATIO","minZoom","DEFAULT_MIN_ZOOM","maxZoom","DEFAULT_MAX_ZOOM","safeMaxZoom","mapRef","useRef","markerPointerEventsResetTimeoutRef","markerPointerEventsDisabledRef","disableMarkerPointerEventsWhileZoomingRef","isMapInitialized","setMapInitialized","useState","isZoomInteractionActive","setIsZoomInteractionActive","api","setApi","baseLayer","setBaseLayer","activeLayers","setActiveLayers","showCluster","setShowCluster","devicePixelRatio","language","locale","setMarkerPointerEventsDisabled","disabled","mapElement","clearMarkerPointerEventsResetTimeout","scheduleMarkerPointerEventsEnable","temporarilyDisableMarkerPointerEvents","useEffect","handleWheel","allMapObjects","removeMapViewChangeListeners","removeEventListenerMap","bounds","getMapBounds","platform","getPlatform","engineType","getEngineType","defaultLayers","getBaseLayer","MAP_LAYER_ROAD_RESTRICTIONS","defaultLayerMap","handleMapViewChangeStart","handleMapViewChangeEnd","hereMap","hereMapEvents","hereBehavior","addEventListenerMap","hereUi","getHereUi","createUtils","isDarkMode","useDarkMode","handleMapTypeChange","MAP_TYPE_NIGHT","previousMapLayer","setPreviousMapLayer","isEqual","newMapType","handleMapLayerChange","layer","removeLayer","layerToRemove","item","newActiveLayers","handleShowClusterChange","newShowCluster","handleMapInteractionStart","handleMapInteractionEnd","style","autoHeightClass","isEmpty","jsx","jsxs","MapContext","MapPosition","MapSize","MapZoom","MapOverlayLayers","MapElements","MAP_TYPE_FLEET_STYLE","MAP_TYPE_SATELLITE","MAP_TYPE_TERRAIN","MAP_LAYER_INCIDENTS","MAP_LAYER_TRAFFIC"],"mappings":";;;;;;;;;;;;;;;;AA+BA,MAAMA,KAAuC,qCACvCC,KAAuC,KAEvCC,IAAM,CAACC,OAAoB;AAC7B,QAAM;AAAA,IACF,UAAAC;AAAA,IACA,aAAAC;AAAA,IACA,OAAAC;AAAA,IACA,QAAAC;AAAA,IACA,UAAUC,KAAO;AAAA,IACjB,QAAAC;AAAA,IACA,MAAAC;AAAA,IACA,eAAAC,IAAgB;AAAA,IAChB,aAAAC;AAAA,IACA,qBAAAC,KAAsB;AAAA,IACtB,sBAAAC,KAAuB;AAAA,IACvB,kBAAAC;AAAA,IACA,iBAAAC,IAAkB;AAAA,IAClB,qBAAAC,IAAsB;AAAA,IACtB,sBAAAC,IAAuB;AAAA,IACvB,kBAAAC;AAAA,IACA,SAAAC,IAAUC;AAAA,IACV,UAAAC,IAAW,CAAA;AAAA,IACX,aAAaC,IAAsB;AAAA,IACnC,cAAAC,KAAe;AAAA,IACf,kBAAAC,KAAmB,MAAM;AAAA,IAAC;AAAA,IAC1B,iBAAAC,KAAkB,MAAM;AAAA,IAAC;AAAA,IACzB,qBAAAC,KAAsB,MAAM;AAAA,IAAC;AAAA,IAC7B,UAAAC,KAAW,MAAM;AAAA,IAAC;AAAA,IAClB,WAAAC,KAAY,MAAM;AAAA,IAAC;AAAA,IACnB,mBAAAC,KAAoB,MAAM;AAAA,IAAC;AAAA,IAC3B,oBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,aAAAC,IAAc;AAAA,IACd,wBAAAC,IAAyB;AAAA,IACzB,uBAAAC,KAAwB;AAAA,IACxB,wCAAAC,IAAyC;AAAA,IACzC,YAAAC,IAAaC;AAAA,IACb,SAAAC,IAAUC;AAAA,IACV,SAAAC,IAAUC;AAAA,EAAA,IACVvC;AAEJ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gC;AAAA,UAAA;AAAA,UAGJ,UAAA;AAAA,YAAA,gBAAAsD,EAACG,IAAA,EAAY,KAAAjE,GAAU,aAAA1C,GAA0B,QAAAH,GAAgB,eAAAE,GAA8B;AAAA,YAC/F,gBAAAyG,EAACI,MAAQ,KAAAlE,GAAU;AAAA,YACnB,gBAAA8D;AAAA,cAACK;AAAA,cAAA;AAAA,gBACG,MAAA/G;AAAA,gBACA,iBAAiBM;AAAA,gBACjB,UAAAY;AAAA,gBACA,WAAAC;AAAA,gBACA,eAAAlB;AAAA,cAAA;AAAA,YAAA;AAAA,YAEHqB,KAAeA;AAAA,YAChB,gBAAAoF,EAACM,IAAA,EAAiB,QAAQhE,EAAA,CAAc;AAAA,YACxC,gBAAA0D,EAACO,IAAA,EAAY,KAAArE,GAAW,UAAAlD,GAAA,CAAS;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACrC;AAAA,EAAA;AAIhB;AAEAF,EAAI,eAAemB;AACnBnB,EAAI,mBAAmB0H;AACvB1H,EAAI,iBAAiB2H;AACrB3H,EAAI,eAAe4H;AACnB5H,EAAI,aAAagG;AAEjBhG,EAAI,kBAAkB6H;AACtB7H,EAAI,gBAAgB8H;AACpB9H,EAAI,0BAA0BkF;"}
@@ -4,6 +4,8 @@ export type MapContextType = {
4
4
  language: string;
5
5
  enableWebGL: boolean;
6
6
  enableMarkerIconCache: boolean;
7
+ enableFractionalZoom: boolean;
8
+ isZoomInteractionActive: boolean;
7
9
  baseLayer: MapType;
8
10
  activeLayers: MapLayer[];
9
11
  showCluster: boolean;
@@ -1,20 +1,22 @@
1
1
  import { createContext as e, useContext as t } from "react";
2
2
  import { MAP_TYPE_DEFAULT as a } from "./constants.js";
3
- const n = {
3
+ const o = {
4
4
  api: {},
5
5
  language: "en",
6
6
  enableWebGL: !0,
7
7
  enableMarkerIconCache: !0,
8
+ enableFractionalZoom: !1,
9
+ isZoomInteractionActive: !1,
8
10
  baseLayer: a,
9
11
  activeLayers: [],
10
12
  showCluster: !0,
11
13
  devicePixelRatio: 1,
12
14
  onIncidentsChange: () => {
13
15
  }
14
- }, o = e(n), c = () => t(o);
16
+ }, n = e(o), c = () => t(n);
15
17
  export {
16
- o as MapContext,
17
- n as defaultMapContext,
18
+ n as MapContext,
19
+ o as defaultMapContext,
18
20
  c as useMapContext
19
21
  };
20
22
  //# sourceMappingURL=MapContext.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MapContext.js","sources":["../../../../src/components/map/components/MapContext.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nimport type { MapApi, MapIncidents, MapLayer, MapType } from '../utils/mapTypes';\nimport { MAP_TYPE_DEFAULT } from './constants';\n\nexport type MapContextType = {\n api: MapApi;\n language: string;\n enableWebGL: boolean;\n enableMarkerIconCache: boolean;\n baseLayer: MapType;\n activeLayers: MapLayer[];\n showCluster: boolean;\n devicePixelRatio: number;\n onMapTypeChange?: (type: MapType) => void;\n onMapLayerChange?: (layer: MapLayer) => void;\n onShowClusterChange?: (showCluster: boolean) => void;\n mapSettingsTooltip?: string | React.ReactNode;\n hideMapLayerSettings?: boolean;\n hideClusterSettings?: boolean;\n onIncidentsChange: (incidentsResult: MapIncidents) => void;\n};\n\nexport const defaultMapContext: MapContextType = {\n api: {},\n language: 'en',\n enableWebGL: true,\n enableMarkerIconCache: true,\n baseLayer: MAP_TYPE_DEFAULT,\n activeLayers: [],\n showCluster: true,\n devicePixelRatio: 1,\n onIncidentsChange: () => {},\n};\n\nexport const MapContext = createContext<MapContextType>(defaultMapContext);\n\nexport const useMapContext = () => useContext(MapContext);\n"],"names":["defaultMapContext","MAP_TYPE_DEFAULT","MapContext","createContext","useMapContext","useContext"],"mappings":";;AAuBO,MAAMA,IAAoC;AAAA,EAC7C,KAAK,CAAA;AAAA,EACL,UAAU;AAAA,EACV,aAAa;AAAA,EACb,uBAAuB;AAAA,EACvB,WAAWC;AAAA,EACX,cAAc,CAAA;AAAA,EACd,aAAa;AAAA,EACb,kBAAkB;AAAA,EAClB,mBAAmB,MAAM;AAAA,EAAC;AAC9B,GAEaC,IAAaC,EAA8BH,CAAiB,GAE5DI,IAAgB,MAAMC,EAAWH,CAAU;"}
1
+ {"version":3,"file":"MapContext.js","sources":["../../../../src/components/map/components/MapContext.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nimport type { MapApi, MapIncidents, MapLayer, MapType } from '../utils/mapTypes';\nimport { MAP_TYPE_DEFAULT } from './constants';\n\nexport type MapContextType = {\n api: MapApi;\n language: string;\n enableWebGL: boolean;\n enableMarkerIconCache: boolean;\n enableFractionalZoom: boolean;\n isZoomInteractionActive: boolean;\n baseLayer: MapType;\n activeLayers: MapLayer[];\n showCluster: boolean;\n devicePixelRatio: number;\n onMapTypeChange?: (type: MapType) => void;\n onMapLayerChange?: (layer: MapLayer) => void;\n onShowClusterChange?: (showCluster: boolean) => void;\n mapSettingsTooltip?: string | React.ReactNode;\n hideMapLayerSettings?: boolean;\n hideClusterSettings?: boolean;\n onIncidentsChange: (incidentsResult: MapIncidents) => void;\n};\n\nexport const defaultMapContext: MapContextType = {\n api: {},\n language: 'en',\n enableWebGL: true,\n enableMarkerIconCache: true,\n enableFractionalZoom: false,\n isZoomInteractionActive: false,\n baseLayer: MAP_TYPE_DEFAULT,\n activeLayers: [],\n showCluster: true,\n devicePixelRatio: 1,\n onIncidentsChange: () => {},\n};\n\nexport const MapContext = createContext<MapContextType>(defaultMapContext);\n\nexport const useMapContext = () => useContext(MapContext);\n"],"names":["defaultMapContext","MAP_TYPE_DEFAULT","MapContext","createContext","useMapContext","useContext"],"mappings":";;AAyBO,MAAMA,IAAoC;AAAA,EAC7C,KAAK,CAAA;AAAA,EACL,UAAU;AAAA,EACV,aAAa;AAAA,EACb,uBAAuB;AAAA,EACvB,sBAAsB;AAAA,EACtB,yBAAyB;AAAA,EACzB,WAAWC;AAAA,EACX,cAAc,CAAA;AAAA,EACd,aAAa;AAAA,EACb,kBAAkB;AAAA,EAClB,mBAAmB,MAAM;AAAA,EAAC;AAC9B,GAEaC,IAAaC,EAA8BH,CAAiB,GAE5DI,IAAgB,MAAMC,EAAWH,CAAU;"}