@local-logic/maps 0.0.19 → 0.0.21

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 (38) hide show
  1. package/dist/index-29Y5fJR0.js +24 -0
  2. package/dist/{index-DnE7POcz.js → index-6JzOJU8O.js} +1 -1
  3. package/dist/{index-C_RtwL3E.js → index-AcZakyxd.js} +5 -5
  4. package/dist/{index-r9nwo0R7.js → index-CHSsiFtN.js} +1 -1
  5. package/dist/{index-DUdSU2pv.js → index-CqUTGwL0.js} +2 -2
  6. package/dist/{index-Be6RGKzc.js → index-Cwn0dgP_.js} +3 -3
  7. package/dist/{index-C1QREXT1.js → index-D--WdzK4.js} +2 -2
  8. package/dist/{index-DMwjyhBt.js → index-D1Phs0fA.js} +2 -2
  9. package/dist/{index-pztBT1mz.js → index-D1vI6Ww_.js} +1 -1
  10. package/dist/{index-Dvg9jDs5.js → index-DHHG0vNa.js} +1 -1
  11. package/dist/{index-C0nB-ZYI.js → index-DKFcZs0A.js} +2 -2
  12. package/dist/{index-CBfuS_n2.js → index-DZTFM839.js} +1 -1
  13. package/dist/index-DdYanSGw.js +23 -0
  14. package/dist/index-Dxh7aMoG.js +23 -0
  15. package/dist/{index-C9z8YU4t.js → index-_8n5sl1B.js} +3 -3
  16. package/dist/{index-gTk5Txmy.js → index-_n1FGHXc.js} +2 -2
  17. package/dist/index.es.js +1 -1
  18. package/dist/index.umd.js +305 -206
  19. package/dist/{logo-control-BALqfBGo.js → logo-control-C5ZdRec5.js} +1 -1
  20. package/dist/{mapbox-gl-Coz2msiN.js → mapbox-gl-D6JObe4m.js} +15957 -15589
  21. package/dist/{maplibre-gl-CAHhS7Ky.js → maplibre-gl-DDfJU6SR.js} +7506 -7216
  22. package/dist/scale-control-Cflgzbvb.js +744 -0
  23. package/dist/src/components/Map/Root/CenterPin/Google/index.d.ts +1 -1
  24. package/dist/src/components/Map/Root/CenterPin/Google/index.d.ts.map +1 -1
  25. package/dist/src/components/Map/Root/CenterPin/Mapbox/index.d.ts +1 -1
  26. package/dist/src/components/Map/Root/CenterPin/Mapbox/index.d.ts.map +1 -1
  27. package/dist/src/components/Map/Root/CenterPin/Maptiler/index.d.ts +1 -1
  28. package/dist/src/components/Map/Root/CenterPin/Maptiler/index.d.ts.map +1 -1
  29. package/dist/src/components/Map/Root/CenterPin/types.d.ts +1 -0
  30. package/dist/src/components/Map/Root/CenterPin/types.d.ts.map +1 -1
  31. package/dist/style.css +1 -1
  32. package/dist/styles-B8oT_wcC.js +2772 -0
  33. package/package.json +5 -4
  34. package/dist/index-C7cTTXxY.js +0 -24
  35. package/dist/index-DjQpPQGI.js +0 -23
  36. package/dist/index-t8m-nFSa.js +0 -23
  37. package/dist/scale-control-BOI2g14-.js +0 -726
  38. package/dist/styles-Do-o-qNU.js +0 -48
@@ -0,0 +1,744 @@
1
+ import * as C from "react";
2
+ import { useContext as L, useMemo as M, useLayoutEffect as I, useEffect as m, useState as G, useRef as T, useImperativeHandle as z, memo as S, forwardRef as R } from "react";
3
+ import { createPortal as V } from "react-dom";
4
+ const W = C.createContext(null);
5
+ function Ce() {
6
+ var i;
7
+ const e = (i = L(W)) == null ? void 0 : i.maps, t = L(w);
8
+ return M(() => ({ ...e, current: t == null ? void 0 : t.map }), [e, t]);
9
+ }
10
+ function Q(e) {
11
+ return {
12
+ longitude: e.center.lng,
13
+ latitude: e.center.lat,
14
+ zoom: e._seaLevelZoom ?? e.zoom,
15
+ pitch: e.pitch,
16
+ bearing: e.bearing,
17
+ padding: e.padding,
18
+ elevation: e._centerAltitude
19
+ };
20
+ }
21
+ function K(e) {
22
+ return Number.isFinite(e.longitude) || Number.isFinite(e.latitude) || Number.isFinite(e.zoom) || Number.isFinite(e.pitch) || Number.isFinite(e.bearing);
23
+ }
24
+ function J(e, t) {
25
+ return !!(Number.isFinite(t.longitude) && e.center.lng !== t.longitude || Number.isFinite(t.latitude) && e.center.lat !== t.latitude || Number.isFinite(t.bearing) && e.bearing !== t.bearing || Number.isFinite(t.pitch) && e.pitch !== t.pitch || Number.isFinite(t.zoom) && (e._seaLevelZoom ?? e.zoom) !== t.zoom || t.padding && !e.isPaddingEqual(t.padding));
26
+ }
27
+ function P() {
28
+ }
29
+ function Y(e, t) {
30
+ const o = e._constrain, i = e._calcMatrices;
31
+ if (e._constrain = P, e._calcMatrices = P, Number.isFinite(t.bearing) && (e.bearing = t.bearing), Number.isFinite(t.pitch) && (e.pitch = t.pitch), t.padding && !e.isPaddingEqual(t.padding) && (e.padding = t.padding), Number.isFinite(t.longitude) || Number.isFinite(t.latitude)) {
32
+ const n = e.center;
33
+ e._center = new n.constructor(t.longitude ?? n.lng, t.latitude ?? n.lat);
34
+ }
35
+ if (Number.isFinite(t.zoom))
36
+ if (e._centerAltitude = t.elevation ?? 0, e.elevation) {
37
+ e._seaLevelZoom = t.zoom;
38
+ const n = e.pixelsPerMeter / e.worldSize * e._centerAltitude, r = e._mercatorZfromZoom(t.zoom), a = e._mercatorZfromZoom(e._maxZoom), s = Math.max(r - n, a);
39
+ e._setZoom(e._zoomFromMercatorZ(s));
40
+ } else
41
+ e._seaLevelZoom = null, e.zoom = t.zoom;
42
+ e._constrain = o, e._calcMatrices = i, e._unmodified || (e._constrain(), e._calcMatrices());
43
+ }
44
+ const X = /* @__PURE__ */ new Set([
45
+ "_calcMatrices",
46
+ "_calcFogMatrices",
47
+ "_updateCameraState",
48
+ "_updateSeaLevelZoom"
49
+ ]);
50
+ function ee(e) {
51
+ let t = !1, o = {};
52
+ const i = e;
53
+ let n = null;
54
+ const r = {
55
+ get(a, s) {
56
+ return s === "$reactViewState" ? o : s === "$proposedTransform" ? n : s === "$internalUpdate" ? t : s === "_setZoom" ? (c) => {
57
+ t && (n == null || n[s](c)), Number.isFinite(o.zoom) || i[s](c);
58
+ } : (t && s === "_translateCameraConstrained" && K(o) && (n = n || i.clone()), X.has(s) ? function(...c) {
59
+ n == null || n[s](...c), i[s](...c);
60
+ } : t && n ? n[s] : i[s]);
61
+ },
62
+ set(a, s, c) {
63
+ if (s === "$reactViewState")
64
+ return o = c, Y(i, o), !0;
65
+ if (s === "$proposedTransform")
66
+ return n = c, !0;
67
+ if (s === "$internalUpdate")
68
+ return t = c, !0;
69
+ let l = c;
70
+ return s === "center" || s === "_center" ? (Number.isFinite(o.longitude) || Number.isFinite(o.latitude)) && (l = new c.constructor(o.longitude ?? c.lng, o.latitude ?? c.lat)) : s === "zoom" || s === "_zoom" || s === "_seaLevelZoom" ? Number.isFinite(o.zoom) && (l = i[s]) : s === "_centerAltitude" ? Number.isFinite(o.elevation) && (l = i[s]) : s === "pitch" || s === "_pitch" ? Number.isFinite(o.pitch) && (l = i[s]) : (s === "bearing" || s === "rotation" || s === "angle") && Number.isFinite(o.bearing) && (l = i[s]), t && l !== c && (n = n || i.clone()), t && n && (n[s] = c), i[s] = l, !0;
71
+ }
72
+ };
73
+ return new Proxy(e, r);
74
+ }
75
+ const te = ["type", "source", "source-layer", "minzoom", "maxzoom", "filter", "layout"];
76
+ function Z(e) {
77
+ if (!e)
78
+ return null;
79
+ if (typeof e == "string" || ("toJS" in e && (e = e.toJS()), !e.layers))
80
+ return e;
81
+ const t = {};
82
+ for (const i of e.layers)
83
+ t[i.id] = i;
84
+ const o = e.layers.map((i) => {
85
+ let n = null;
86
+ "interactive" in i && (n = Object.assign({}, i), delete n.interactive);
87
+ const r = t[i.ref];
88
+ if (r) {
89
+ n = n || Object.assign({}, i), delete n.ref;
90
+ for (const a of te)
91
+ a in r && (n[a] = r[a]);
92
+ }
93
+ return n || i;
94
+ });
95
+ return { ...e, layers: o };
96
+ }
97
+ function ne(e, t) {
98
+ const o = Array.isArray(e) ? e[0] : e ? e.x : 0, i = Array.isArray(e) ? e[1] : e ? e.y : 0, n = Array.isArray(t) ? t[0] : t ? t.x : 0, r = Array.isArray(t) ? t[1] : t ? t.y : 0;
99
+ return o === n && i === r;
100
+ }
101
+ function v(e, t) {
102
+ if (e === t)
103
+ return !0;
104
+ if (!e || !t)
105
+ return !1;
106
+ if (Array.isArray(e)) {
107
+ if (!Array.isArray(t) || e.length !== t.length)
108
+ return !1;
109
+ for (let o = 0; o < e.length; o++)
110
+ if (!v(e[o], t[o]))
111
+ return !1;
112
+ return !0;
113
+ } else if (Array.isArray(t))
114
+ return !1;
115
+ if (typeof e == "object" && typeof t == "object") {
116
+ const o = Object.keys(e), i = Object.keys(t);
117
+ if (o.length !== i.length)
118
+ return !1;
119
+ for (const n of o)
120
+ if (!t.hasOwnProperty(n) || !v(e[n], t[n]))
121
+ return !1;
122
+ return !0;
123
+ }
124
+ return !1;
125
+ }
126
+ const O = { version: 8, sources: {}, layers: [] }, U = {
127
+ mousedown: "onMouseDown",
128
+ mouseup: "onMouseUp",
129
+ mouseover: "onMouseOver",
130
+ mousemove: "onMouseMove",
131
+ click: "onClick",
132
+ dblclick: "onDblClick",
133
+ mouseenter: "onMouseEnter",
134
+ mouseleave: "onMouseLeave",
135
+ mouseout: "onMouseOut",
136
+ contextmenu: "onContextMenu",
137
+ touchstart: "onTouchStart",
138
+ touchend: "onTouchEnd",
139
+ touchmove: "onTouchMove",
140
+ touchcancel: "onTouchCancel"
141
+ }, D = {
142
+ movestart: "onMoveStart",
143
+ move: "onMove",
144
+ moveend: "onMoveEnd",
145
+ dragstart: "onDragStart",
146
+ drag: "onDrag",
147
+ dragend: "onDragEnd",
148
+ zoomstart: "onZoomStart",
149
+ zoom: "onZoom",
150
+ zoomend: "onZoomEnd",
151
+ rotatestart: "onRotateStart",
152
+ rotate: "onRotate",
153
+ rotateend: "onRotateEnd",
154
+ pitchstart: "onPitchStart",
155
+ pitch: "onPitch",
156
+ pitchend: "onPitchEnd"
157
+ }, j = {
158
+ wheel: "onWheel",
159
+ boxzoomstart: "onBoxZoomStart",
160
+ boxzoomend: "onBoxZoomEnd",
161
+ boxzoomcancel: "onBoxZoomCancel",
162
+ resize: "onResize",
163
+ load: "onLoad",
164
+ render: "onRender",
165
+ idle: "onIdle",
166
+ remove: "onRemove",
167
+ data: "onData",
168
+ styledata: "onStyleData",
169
+ sourcedata: "onSourceData",
170
+ error: "onError"
171
+ }, oe = [
172
+ "minZoom",
173
+ "maxZoom",
174
+ "minPitch",
175
+ "maxPitch",
176
+ "maxBounds",
177
+ "projection",
178
+ "renderWorldCopies"
179
+ ], re = [
180
+ "scrollZoom",
181
+ "boxZoom",
182
+ "dragRotate",
183
+ "dragPan",
184
+ "keyboard",
185
+ "doubleClickZoom",
186
+ "touchZoomRotate",
187
+ "touchPitch"
188
+ ];
189
+ class x {
190
+ constructor(t, o, i) {
191
+ this._map = null, this._internalUpdate = !1, this._inRender = !1, this._hoveredFeatures = null, this._deferredEvents = {
192
+ move: !1,
193
+ zoom: !1,
194
+ pitch: !1,
195
+ rotate: !1
196
+ }, this._onEvent = (n) => {
197
+ const r = this.props[j[n.type]];
198
+ r ? r(n) : n.type === "error" && console.error(n.error);
199
+ }, this._onPointerEvent = (n) => {
200
+ (n.type === "mousemove" || n.type === "mouseout") && this._updateHover(n);
201
+ const r = this.props[U[n.type]];
202
+ r && (this.props.interactiveLayerIds && n.type !== "mouseover" && n.type !== "mouseout" && (n.features = this._hoveredFeatures || this._queryRenderedFeatures(n.point)), r(n), delete n.features);
203
+ }, this._onCameraEvent = (n) => {
204
+ if (!this._internalUpdate) {
205
+ const r = this.props[D[n.type]], a = this._proxyTransform;
206
+ r && (n.viewState = Q(a.$proposedTransform ?? a), r(n)), n.type === "moveend" && (a.$proposedTransform = null);
207
+ }
208
+ n.type in this._deferredEvents && (this._deferredEvents[n.type] = !1);
209
+ }, this._MapClass = t, this.props = o, this._initialize(i);
210
+ }
211
+ get map() {
212
+ return this._map;
213
+ }
214
+ get transform() {
215
+ return this._map.transform;
216
+ }
217
+ setProps(t) {
218
+ const o = this.props;
219
+ this.props = t;
220
+ const i = this._updateSettings(t, o);
221
+ i && this._createProxyTransform(this._map);
222
+ const n = this._updateSize(t), r = this._updateViewState(t, !0);
223
+ this._updateStyle(t, o), this._updateStyleComponents(t, o), this._updateHandlers(t, o), (i || n || r && !this._map.isMoving()) && this.redraw();
224
+ }
225
+ static reuse(t, o) {
226
+ const i = x.savedMaps.pop();
227
+ if (!i)
228
+ return null;
229
+ const n = i.map, r = n.getContainer();
230
+ for (o.className = r.className; r.childNodes.length > 0; )
231
+ o.appendChild(r.childNodes[0]);
232
+ n._container = o, i.setProps({ ...t, styleDiffing: !1 }), n.resize();
233
+ const { initialViewState: a } = t;
234
+ return a && (a.bounds ? n.fitBounds(a.bounds, { ...a.fitBoundsOptions, duration: 0 }) : i._updateViewState(a, !1)), n.isStyleLoaded() ? n.fire("load") : n.once("styledata", () => n.fire("load")), n._update(), i;
235
+ }
236
+ /* eslint-disable complexity,max-statements */
237
+ _initialize(t) {
238
+ const { props: o } = this, { mapStyle: i = O } = o, n = {
239
+ ...o,
240
+ ...o.initialViewState,
241
+ accessToken: o.mapboxAccessToken || ie() || null,
242
+ container: t,
243
+ style: Z(i)
244
+ }, r = n.initialViewState || n.viewState || n;
245
+ if (Object.assign(n, {
246
+ center: [r.longitude || 0, r.latitude || 0],
247
+ zoom: r.zoom || 0,
248
+ pitch: r.pitch || 0,
249
+ bearing: r.bearing || 0
250
+ }), o.gl) {
251
+ const u = HTMLCanvasElement.prototype.getContext;
252
+ HTMLCanvasElement.prototype.getContext = () => (HTMLCanvasElement.prototype.getContext = u, o.gl);
253
+ }
254
+ const a = new this._MapClass(n);
255
+ r.padding && a.setPadding(r.padding), o.cursor && (a.getCanvas().style.cursor = o.cursor), this._createProxyTransform(a);
256
+ const s = a._render;
257
+ a._render = (u) => {
258
+ this._inRender = !0, s.call(a, u), this._inRender = !1;
259
+ };
260
+ const c = a._renderTaskQueue.run;
261
+ a._renderTaskQueue.run = (u) => {
262
+ this._proxyTransform.$internalUpdate = !0, c.call(a._renderTaskQueue, u), this._proxyTransform.$internalUpdate = !1, this._fireDefferedEvents();
263
+ };
264
+ const l = a.jumpTo;
265
+ a.jumpTo = (...u) => (this._proxyTransform.$internalUpdate = !0, l.apply(a, u), this._proxyTransform.$internalUpdate = !1, a);
266
+ const f = a.fire;
267
+ a.fire = this._fireEvent.bind(this, f), a.on("styledata", () => {
268
+ this._updateStyleComponents(this.props, {});
269
+ }), a.on("sourcedata", () => {
270
+ this._updateStyleComponents(this.props, {});
271
+ });
272
+ for (const u in U)
273
+ a.on(u, this._onPointerEvent);
274
+ for (const u in D)
275
+ a.on(u, this._onCameraEvent);
276
+ for (const u in j)
277
+ a.on(u, this._onEvent);
278
+ this._map = a;
279
+ }
280
+ /* eslint-enable complexity,max-statements */
281
+ recycle() {
282
+ const o = this.map.getContainer().querySelector("[mapboxgl-children]");
283
+ o == null || o.remove(), x.savedMaps.push(this);
284
+ }
285
+ destroy() {
286
+ this._map.remove();
287
+ }
288
+ // Force redraw the map now. Typically resize() and jumpTo() is reflected in the next
289
+ // render cycle, which is managed by Mapbox's animation loop.
290
+ // This removes the synchronization issue caused by requestAnimationFrame.
291
+ redraw() {
292
+ const t = this._map;
293
+ !this._inRender && t.style && (t._frame && (t._frame.cancel(), t._frame = null), t._render());
294
+ }
295
+ _createProxyTransform(t) {
296
+ const o = ee(t.transform);
297
+ t.transform = o, t.painter.transform = o, this._proxyTransform = o;
298
+ }
299
+ /* Trigger map resize if size is controlled
300
+ @param {object} nextProps
301
+ @returns {bool} true if size has changed
302
+ */
303
+ _updateSize(t) {
304
+ const { viewState: o } = t;
305
+ if (o) {
306
+ const i = this._map;
307
+ if (o.width !== i.transform.width || o.height !== i.transform.height)
308
+ return i.resize(), !0;
309
+ }
310
+ return !1;
311
+ }
312
+ // Adapted from map.jumpTo
313
+ /* Update camera to match props
314
+ @param {object} nextProps
315
+ @param {bool} triggerEvents - should fire camera events
316
+ @returns {bool} true if anything is changed
317
+ */
318
+ _updateViewState(t, o) {
319
+ const i = t.viewState || t, n = this._proxyTransform, { zoom: r, pitch: a, bearing: s } = n, c = J(this._proxyTransform, i);
320
+ if (n.$reactViewState = i, c && o) {
321
+ const l = this._deferredEvents;
322
+ l.move = !0, l.zoom || (l.zoom = r !== n.zoom), l.rotate || (l.rotate = s !== n.bearing), l.pitch || (l.pitch = a !== n.pitch);
323
+ }
324
+ return c;
325
+ }
326
+ /* Update camera constraints and projection settings to match props
327
+ @param {object} nextProps
328
+ @param {object} currProps
329
+ @returns {bool} true if anything is changed
330
+ */
331
+ _updateSettings(t, o) {
332
+ const i = this._map;
333
+ let n = !1;
334
+ for (const r of oe)
335
+ if (r in t && !v(t[r], o[r])) {
336
+ n = !0;
337
+ const a = i[`set${r[0].toUpperCase()}${r.slice(1)}`];
338
+ a == null || a.call(i, t[r]);
339
+ }
340
+ return n;
341
+ }
342
+ /* Update map style to match props
343
+ @param {object} nextProps
344
+ @param {object} currProps
345
+ @returns {bool} true if style is changed
346
+ */
347
+ _updateStyle(t, o) {
348
+ if (t.cursor !== o.cursor && (this._map.getCanvas().style.cursor = t.cursor || ""), t.mapStyle !== o.mapStyle) {
349
+ const { mapStyle: i = O, styleDiffing: n = !0 } = t, r = {
350
+ diff: n
351
+ };
352
+ return "localIdeographFontFamily" in t && (r.localIdeographFontFamily = t.localIdeographFontFamily), this._map.setStyle(Z(i), r), !0;
353
+ }
354
+ return !1;
355
+ }
356
+ /* Update fog, light and terrain to match props
357
+ @param {object} nextProps
358
+ @param {object} currProps
359
+ @returns {bool} true if anything is changed
360
+ */
361
+ _updateStyleComponents(t, o) {
362
+ const i = this._map;
363
+ let n = !1;
364
+ return i.isStyleLoaded() && ("light" in t && i.setLight && !v(t.light, o.light) && (n = !0, i.setLight(t.light)), "fog" in t && i.setFog && !v(t.fog, o.fog) && (n = !0, i.setFog(t.fog)), "terrain" in t && i.setTerrain && !v(t.terrain, o.terrain) && (!t.terrain || i.getSource(t.terrain.source)) && (n = !0, i.setTerrain(t.terrain))), n;
365
+ }
366
+ /* Update interaction handlers to match props
367
+ @param {object} nextProps
368
+ @param {object} currProps
369
+ @returns {bool} true if anything is changed
370
+ */
371
+ _updateHandlers(t, o) {
372
+ const i = this._map;
373
+ let n = !1;
374
+ for (const r of re) {
375
+ const a = t[r] ?? !0, s = o[r] ?? !0;
376
+ v(a, s) || (n = !0, a ? i[r].enable(a) : i[r].disable());
377
+ }
378
+ return n;
379
+ }
380
+ _queryRenderedFeatures(t) {
381
+ const o = this._map, { interactiveLayerIds: i = [] } = this.props;
382
+ try {
383
+ return o.queryRenderedFeatures(t, {
384
+ layers: i.filter(o.getLayer.bind(o))
385
+ });
386
+ } catch {
387
+ return [];
388
+ }
389
+ }
390
+ _updateHover(t) {
391
+ var n;
392
+ const { props: o } = this;
393
+ if (o.interactiveLayerIds && (o.onMouseMove || o.onMouseEnter || o.onMouseLeave)) {
394
+ const r = t.type, a = ((n = this._hoveredFeatures) == null ? void 0 : n.length) > 0, s = this._queryRenderedFeatures(t.point), c = s.length > 0;
395
+ !c && a && (t.type = "mouseleave", this._onPointerEvent(t)), this._hoveredFeatures = s, c && !a && (t.type = "mouseenter", this._onPointerEvent(t)), t.type = r;
396
+ } else
397
+ this._hoveredFeatures = null;
398
+ }
399
+ _fireEvent(t, o, i) {
400
+ const n = this._map, r = this._proxyTransform, a = r.$internalUpdate;
401
+ try {
402
+ r.$internalUpdate = !1, t.call(n, o, i);
403
+ } finally {
404
+ r.$internalUpdate = a;
405
+ }
406
+ return n;
407
+ }
408
+ // If there are camera changes driven by props, invoke camera events so that DOM controls are synced
409
+ _fireDefferedEvents() {
410
+ const t = this._map;
411
+ this._internalUpdate = !0;
412
+ for (const o in this._deferredEvents)
413
+ this._deferredEvents[o] && t.fire(o);
414
+ this._internalUpdate = !1;
415
+ }
416
+ }
417
+ x.savedMaps = [];
418
+ function ie() {
419
+ let e = null;
420
+ if (typeof location < "u") {
421
+ const t = /access_token=([^&\/]*)/.exec(location.search);
422
+ e = t && t[1];
423
+ }
424
+ try {
425
+ e = e || process.env.MapboxAccessToken;
426
+ } catch {
427
+ }
428
+ try {
429
+ e = e || process.env.REACT_APP_MAPBOX_ACCESS_TOKEN;
430
+ } catch {
431
+ }
432
+ return e;
433
+ }
434
+ const ae = [
435
+ "setMaxBounds",
436
+ "setMinZoom",
437
+ "setMaxZoom",
438
+ "setMinPitch",
439
+ "setMaxPitch",
440
+ "setRenderWorldCopies",
441
+ "setProjection",
442
+ "setStyle",
443
+ "addSource",
444
+ "removeSource",
445
+ "addLayer",
446
+ "removeLayer",
447
+ "setLayerZoomRange",
448
+ "setFilter",
449
+ "setPaintProperty",
450
+ "setLayoutProperty",
451
+ "setLight",
452
+ "setTerrain",
453
+ "setFog",
454
+ "remove"
455
+ ];
456
+ function se(e) {
457
+ if (!e)
458
+ return null;
459
+ const t = e.map, o = {
460
+ getMap: () => t,
461
+ // Overwrite getters to use our shadow transform
462
+ getCenter: () => e.transform.center,
463
+ getZoom: () => e.transform.zoom,
464
+ getBearing: () => e.transform.bearing,
465
+ getPitch: () => e.transform.pitch,
466
+ getPadding: () => e.transform.padding,
467
+ getBounds: () => e.transform.getBounds(),
468
+ project: (i) => {
469
+ const n = t.transform;
470
+ t.transform = e.transform;
471
+ const r = t.project(i);
472
+ return t.transform = n, r;
473
+ },
474
+ unproject: (i) => {
475
+ const n = t.transform;
476
+ t.transform = e.transform;
477
+ const r = t.unproject(i);
478
+ return t.transform = n, r;
479
+ },
480
+ // options diverge between mapbox and maplibre
481
+ queryTerrainElevation: (i, n) => {
482
+ const r = t.transform;
483
+ t.transform = e.transform;
484
+ const a = t.queryTerrainElevation(i, n);
485
+ return t.transform = r, a;
486
+ },
487
+ queryRenderedFeatures: (i, n) => {
488
+ const r = t.transform;
489
+ t.transform = e.transform;
490
+ const a = t.queryRenderedFeatures(i, n);
491
+ return t.transform = r, a;
492
+ }
493
+ };
494
+ for (const i of ce(t))
495
+ !(i in o) && !ae.includes(i) && (o[i] = t[i].bind(t));
496
+ return o;
497
+ }
498
+ function ce(e) {
499
+ const t = /* @__PURE__ */ new Set();
500
+ let o = e;
501
+ for (; o; ) {
502
+ for (const i of Object.getOwnPropertyNames(o))
503
+ i[0] !== "_" && typeof e[i] == "function" && i !== "fire" && i !== "setEventedParent" && t.add(i);
504
+ o = Object.getPrototypeOf(o);
505
+ }
506
+ return Array.from(t);
507
+ }
508
+ const le = typeof document < "u" ? I : m, ue = [
509
+ "baseApiUrl",
510
+ "maxParallelImageRequests",
511
+ "workerClass",
512
+ "workerCount",
513
+ "workerUrl"
514
+ ];
515
+ function fe(e, t) {
516
+ for (const i of ue)
517
+ i in t && (e[i] = t[i]);
518
+ const { RTLTextPlugin: o = "https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js" } = t;
519
+ o && e.getRTLTextPluginStatus && e.getRTLTextPluginStatus() === "unavailable" && e.setRTLTextPlugin(o, (i) => {
520
+ i && console.error(i);
521
+ }, !0);
522
+ }
523
+ const w = C.createContext(null);
524
+ function de(e, t) {
525
+ const o = L(W), [i, n] = G(null), r = T(), { current: a } = T({ mapLib: null, map: null });
526
+ m(() => {
527
+ const l = e.mapLib;
528
+ let f = !0, u;
529
+ return Promise.resolve(l || import("./mapbox-gl-D6JObe4m.js").then((d) => d.m)).then((d) => {
530
+ if (!f)
531
+ return;
532
+ if (!d)
533
+ throw new Error("Invalid mapLib");
534
+ const y = "Map" in d ? d : d.default;
535
+ if (!y.Map)
536
+ throw new Error("Invalid mapLib");
537
+ fe(y, e), e.reuseMaps && (u = x.reuse(e, r.current)), u || (u = new x(y.Map, e, r.current)), a.map = se(u), a.mapLib = y, n(u), o == null || o.onMapMount(a.map, e.id);
538
+ }).catch((d) => {
539
+ const { onError: y } = e;
540
+ y ? y({
541
+ type: "error",
542
+ target: null,
543
+ error: d
544
+ }) : console.error(d);
545
+ }), () => {
546
+ f = !1, u && (o == null || o.onMapUnmount(e.id), e.reuseMaps ? u.recycle() : u.destroy());
547
+ };
548
+ }, []), le(() => {
549
+ i && i.setProps(e);
550
+ }), z(t, () => a.map, [i]);
551
+ const s = M(() => ({
552
+ position: "relative",
553
+ width: "100%",
554
+ height: "100%",
555
+ ...e.style
556
+ }), [e.style]), c = {
557
+ height: "100%"
558
+ };
559
+ return C.createElement("div", { id: e.id, ref: r, style: s }, i && C.createElement(
560
+ w.Provider,
561
+ { value: a },
562
+ C.createElement("div", { "mapboxgl-children": "", style: c }, e.children)
563
+ ));
564
+ }
565
+ const Se = C.forwardRef(de), me = /box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;
566
+ function E(e, t) {
567
+ if (!e || !t)
568
+ return;
569
+ const o = e.style;
570
+ for (const i in t) {
571
+ const n = t[i];
572
+ Number.isFinite(n) && !me.test(i) ? o[i] = `${n}px` : o[i] = n;
573
+ }
574
+ }
575
+ function H(e, t) {
576
+ if (e === t)
577
+ return null;
578
+ const o = $(e), i = $(t), n = [];
579
+ for (const r of i)
580
+ o.has(r) || n.push(r);
581
+ for (const r of o)
582
+ i.has(r) || n.push(r);
583
+ return n.length === 0 ? null : n;
584
+ }
585
+ function $(e) {
586
+ return new Set(e ? e.trim().split(/\s+/) : []);
587
+ }
588
+ const Ee = S(R((e, t) => {
589
+ const { map: o, mapLib: i } = L(w), n = T({ props: e }), r = M(() => {
590
+ let N = !1;
591
+ C.Children.forEach(e.children, (_) => {
592
+ _ && (N = !0);
593
+ });
594
+ const B = {
595
+ ...e,
596
+ element: N ? document.createElement("div") : null
597
+ }, b = new i.Marker(B);
598
+ return b.setLngLat([e.longitude, e.latitude]), b.getElement().addEventListener("click", (_) => {
599
+ var h, g;
600
+ (g = (h = n.current.props).onClick) == null || g.call(h, {
601
+ type: "click",
602
+ target: b,
603
+ originalEvent: _
604
+ });
605
+ }), b.on("dragstart", (_) => {
606
+ var g, p;
607
+ const h = _;
608
+ h.lngLat = r.getLngLat(), (p = (g = n.current.props).onDragStart) == null || p.call(g, h);
609
+ }), b.on("drag", (_) => {
610
+ var g, p;
611
+ const h = _;
612
+ h.lngLat = r.getLngLat(), (p = (g = n.current.props).onDrag) == null || p.call(g, h);
613
+ }), b.on("dragend", (_) => {
614
+ var g, p;
615
+ const h = _;
616
+ h.lngLat = r.getLngLat(), (p = (g = n.current.props).onDragEnd) == null || p.call(g, h);
617
+ }), b;
618
+ }, []);
619
+ m(() => (r.addTo(o.getMap()), () => {
620
+ r.remove();
621
+ }), []);
622
+ const { longitude: a, latitude: s, offset: c, style: l, draggable: f = !1, popup: u = null, rotation: d = 0, rotationAlignment: y = "auto", pitchAlignment: k = "auto" } = e;
623
+ m(() => {
624
+ E(r.getElement(), l);
625
+ }, [l]), z(t, () => r, []);
626
+ const q = n.current.props;
627
+ (r.getLngLat().lng !== a || r.getLngLat().lat !== s) && r.setLngLat([a, s]), c && !ne(r.getOffset(), c) && r.setOffset(c), r.isDraggable() !== f && r.setDraggable(f), r.getRotation() !== d && r.setRotation(d), r.getRotationAlignment() !== y && r.setRotationAlignment(y), r.getPitchAlignment() !== k && r.setPitchAlignment(k), r.getPopup() !== u && r.setPopup(u);
628
+ const A = H(q.className, e.className);
629
+ if (A)
630
+ for (const N of A)
631
+ r.toggleClassName(N);
632
+ return n.current.props = e, V(e.children, r.getElement());
633
+ })), Le = S(R((e, t) => {
634
+ const { map: o, mapLib: i } = L(w), n = M(() => document.createElement("div"), []), r = T({ props: e }), a = M(() => {
635
+ const s = { ...e }, c = new i.Popup(s);
636
+ return c.setLngLat([e.longitude, e.latitude]), c.once("open", (l) => {
637
+ var f, u;
638
+ (u = (f = r.current.props).onOpen) == null || u.call(f, l);
639
+ }), c;
640
+ }, []);
641
+ if (m(() => {
642
+ const s = (c) => {
643
+ var l, f;
644
+ (f = (l = r.current.props).onClose) == null || f.call(l, c);
645
+ };
646
+ return a.on("close", s), a.setDOMContent(n).addTo(o.getMap()), () => {
647
+ a.off("close", s), a.isOpen() && a.remove();
648
+ };
649
+ }, []), m(() => {
650
+ E(a.getElement(), e.style);
651
+ }, [e.style]), z(t, () => a, []), a.isOpen()) {
652
+ const s = r.current.props;
653
+ (a.getLngLat().lng !== e.longitude || a.getLngLat().lat !== e.latitude) && a.setLngLat([e.longitude, e.latitude]), e.offset && !v(s.offset, e.offset) && (a.options.anchor = e.anchor, a.setOffset(e.offset)), (s.anchor !== e.anchor || s.maxWidth !== e.maxWidth) && a.setMaxWidth(e.maxWidth);
654
+ const c = H(s.className, e.className);
655
+ if (c)
656
+ for (const l of c)
657
+ a.toggleClassName(l);
658
+ r.current.props = e;
659
+ }
660
+ return V(e.children, n);
661
+ }));
662
+ function F(e, t, o, i) {
663
+ const n = L(w), r = M(() => e(n), []);
664
+ return m(() => {
665
+ const a = t, s = null, c = typeof t == "function" ? t : null, { map: l } = n;
666
+ return l.hasControl(r) || (l.addControl(r, a == null ? void 0 : a.position), s && s(n)), () => {
667
+ c && c(n), l.hasControl(r) && l.removeControl(r);
668
+ };
669
+ }, []), r;
670
+ }
671
+ function he(e) {
672
+ const t = F(({ mapLib: o }) => new o.AttributionControl(e), {
673
+ position: e.position
674
+ });
675
+ return m(() => {
676
+ E(t._container, e.style);
677
+ }, [e.style]), null;
678
+ }
679
+ S(he);
680
+ function ge(e) {
681
+ const t = F(({ mapLib: o }) => new o.FullscreenControl({
682
+ container: e.containerId && document.getElementById(e.containerId)
683
+ }), { position: e.position });
684
+ return m(() => {
685
+ E(t._controlContainer, e.style);
686
+ }, [e.style]), null;
687
+ }
688
+ S(ge);
689
+ function ye(e, t) {
690
+ const o = T({ props: e }), i = F(({ mapLib: n }) => {
691
+ const r = new n.GeolocateControl(e), a = r._setupUI.bind(r);
692
+ return r._setupUI = (s) => {
693
+ r._container.hasChildNodes() || a(s);
694
+ }, r.on("geolocate", (s) => {
695
+ var c, l;
696
+ (l = (c = o.current.props).onGeolocate) == null || l.call(c, s);
697
+ }), r.on("error", (s) => {
698
+ var c, l;
699
+ (l = (c = o.current.props).onError) == null || l.call(c, s);
700
+ }), r.on("outofmaxbounds", (s) => {
701
+ var c, l;
702
+ (l = (c = o.current.props).onOutOfMaxBounds) == null || l.call(c, s);
703
+ }), r.on("trackuserlocationstart", (s) => {
704
+ var c, l;
705
+ (l = (c = o.current.props).onTrackUserLocationStart) == null || l.call(c, s);
706
+ }), r.on("trackuserlocationend", (s) => {
707
+ var c, l;
708
+ (l = (c = o.current.props).onTrackUserLocationEnd) == null || l.call(c, s);
709
+ }), r;
710
+ }, { position: e.position });
711
+ return o.current.props = e, z(t, () => i, []), m(() => {
712
+ E(i._container, e.style);
713
+ }, [e.style]), null;
714
+ }
715
+ S(R(ye));
716
+ function _e(e) {
717
+ const t = F(({ mapLib: o }) => new o.NavigationControl(e), {
718
+ position: e.position
719
+ });
720
+ return m(() => {
721
+ E(t._container, e.style);
722
+ }, [e.style]), null;
723
+ }
724
+ const Me = S(_e);
725
+ function pe(e) {
726
+ const t = F(({ mapLib: r }) => new r.ScaleControl(e), {
727
+ position: e.position
728
+ }), o = T(e), i = o.current;
729
+ o.current = e;
730
+ const { style: n } = e;
731
+ return e.maxWidth !== void 0 && e.maxWidth !== i.maxWidth && (t.options.maxWidth = e.maxWidth), e.unit !== void 0 && e.unit !== i.unit && t.setUnit(e.unit), m(() => {
732
+ E(t._container, n);
733
+ }, [n]), null;
734
+ }
735
+ S(pe);
736
+ export {
737
+ Se as M,
738
+ Me as N,
739
+ Le as P,
740
+ Ee as a,
741
+ w as b,
742
+ v as d,
743
+ Ce as u
744
+ };