@local-logic/maps 0.1.9 → 0.1.10

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.
@@ -0,0 +1,109 @@
1
+ import { jsx as v, jsxs as x, Fragment as A } from "react/jsx-runtime";
2
+ import { useState as B, useEffect as y, useRef as C, useCallback as E } from "react";
3
+ import { APIProvider as O, Map as z, ControlPosition as L, useMap as G } from "@vis.gl/react-google-maps";
4
+ import { u as _, D as T, W as c, a as Z, m as I } from "./index-Bm3Y5tYu.js";
5
+ import { t as R } from "./index-DscDx7HE.js";
6
+ const F = {
7
+ "top-left": L.LEFT_TOP,
8
+ "top-right": L.RIGHT_TOP,
9
+ "bottom-left": L.LEFT_BOTTOM,
10
+ "bottom-right": L.RIGHT_BOTTOM
11
+ }, D = ({ isMapLoaded: P }) => {
12
+ const o = G(), { centerPinMarkerPoints: a, markerPoints: t, locationBoundary: i, setZoom: r, mapPadding: n } = _(), [f, g] = B(void 0), m = C(void 0), d = E(() => {
13
+ if (!o)
14
+ return;
15
+ const e = o.getZoom();
16
+ typeof e < "u" && r(e + 1);
17
+ }, [o, r]);
18
+ return y(() => {
19
+ d();
20
+ const e = o?.addListener("zoom_changed", d);
21
+ return () => {
22
+ e?.remove();
23
+ };
24
+ }, [o, d]), y(() => {
25
+ if (!o)
26
+ return;
27
+ const e = [];
28
+ typeof i < "u" && i.length > 0 ? e.push(...i) : typeof t < "u" && t.length > 0 ? (e.push(...t), a && e.push(a)) : a !== void 0 && e.push(a);
29
+ const s = e.length === 0 ? c : R(I(e));
30
+ (!m.current || !s.every((l, u) => l === m.current?.[u])) && (m.current = s, g(s));
31
+ }, [o, t, i, a]), y(() => {
32
+ if (!o || typeof f > "u")
33
+ return;
34
+ const [e, s, l, u] = f, p = (l - e) * 0.1 || 1e-3, h = (u - s) * 0.1 || 1e-3;
35
+ o.fitBounds(
36
+ {
37
+ south: s - h,
38
+ west: e - p,
39
+ north: u + h,
40
+ east: l + p
41
+ },
42
+ n
43
+ );
44
+ }, [P, o, f, n]), null;
45
+ };
46
+ function j({ children: P }) {
47
+ const [o, a] = B(!1), [t, i] = B(!1), {
48
+ mapProvider: r,
49
+ mapPadding: n,
50
+ locale: f,
51
+ center: g,
52
+ zoom: m = T.zoom,
53
+ minZoom: d,
54
+ maxZoom: e,
55
+ pitch: s = T.pitch,
56
+ bearing: l = T.bearing,
57
+ cooperativeGestures: u = T.cooperativeGestures,
58
+ zoomPosition: p
59
+ } = _();
60
+ if (y(() => {
61
+ if (!t)
62
+ return;
63
+ const M = document.querySelector(".gm-style-moc");
64
+ M && n && (M.style.paddingLeft = `${n.left}px`, M.style.paddingRight = `${n.right}px`);
65
+ }, [t, n?.left, n?.right]), r.name !== "google")
66
+ return null;
67
+ const h = () => {
68
+ a(!0);
69
+ }, b = () => {
70
+ i(!0);
71
+ };
72
+ return /* @__PURE__ */ v(O, { apiKey: r.apiKey, language: f, onLoad: h, children: o && /* @__PURE__ */ x(A, { children: [
73
+ /* @__PURE__ */ v(D, { isMapLoaded: t }),
74
+ /* @__PURE__ */ v(
75
+ z,
76
+ {
77
+ mapId: r.theme || Z.google,
78
+ defaultCenter: {
79
+ lat: g.latitude,
80
+ lng: g.longitude
81
+ },
82
+ defaultBounds: {
83
+ north: c[3],
84
+ south: c[1],
85
+ east: c[2],
86
+ west: c[0]
87
+ },
88
+ defaultZoom: m + 1,
89
+ defaultTilt: s,
90
+ defaultHeading: l,
91
+ gestureHandling: u ? "cooperative" : "greedy",
92
+ streetViewControl: !1,
93
+ fullscreenControl: !1,
94
+ clickableIcons: !1,
95
+ mapTypeControl: !1,
96
+ zoomControlOptions: {
97
+ position: p && F[p]
98
+ },
99
+ minZoom: typeof d == "number" ? d + 1 : void 0,
100
+ maxZoom: typeof e == "number" ? e + 1 : void 0,
101
+ onTilesLoaded: b,
102
+ children: P
103
+ }
104
+ )
105
+ ] }) });
106
+ }
107
+ export {
108
+ j as default
109
+ };
@@ -1,8 +1,8 @@
1
1
  import { jsx as E } from "react/jsx-runtime";
2
2
  import { useState as L, useRef as M, useCallback as N, useEffect as f, useMemo as W } from "react";
3
3
  import { useMap as _, InfoWindow as x } from "@vis.gl/react-google-maps";
4
- import { u as z, P as y } from "./index-B-7FSpFA.js";
5
- import { c as H, m as j } from "./styles-C3ghTFwc.js";
4
+ import { u as z, P as y } from "./index-Bm3Y5tYu.js";
5
+ import { c as H, m as j } from "./styles-C7XlxM5D.js";
6
6
  function Z({
7
7
  latitude: g,
8
8
  longitude: m,
@@ -1,8 +1,8 @@
1
1
  import { jsx as E } from "react/jsx-runtime";
2
2
  import { useRef as d, useEffect as M } from "react";
3
3
  import { u as z, P as D } from "./scale-control-Dsir9fWY.js";
4
- import { u as H, P as T } from "./index-B-7FSpFA.js";
5
- import { c as j, m as A } from "./styles-C3ghTFwc.js";
4
+ import { u as H, P as T } from "./index-Bm3Y5tYu.js";
5
+ import { c as j, m as A } from "./styles-C7XlxM5D.js";
6
6
  function Z({
7
7
  latitude: h,
8
8
  longitude: l,
@@ -1,8 +1,8 @@
1
1
  import { jsx as E } from "react/jsx-runtime";
2
2
  import { useRef as d, useEffect as M } from "react";
3
3
  import { u as D, P as H } from "./logo-control-CHapR1Dt.js";
4
- import { u as j, P as T } from "./index-B-7FSpFA.js";
5
- import { c as x, m as A } from "./styles-C3ghTFwc.js";
4
+ import { u as j, P as T } from "./index-Bm3Y5tYu.js";
5
+ import { c as x, m as A } from "./styles-C7XlxM5D.js";
6
6
  function Z({
7
7
  latitude: l,
8
8
  longitude: h,
@@ -1,5 +1,5 @@
1
1
  import { jsxs as t, jsx as i } from "react/jsx-runtime";
2
- import { u as a } from "./index-B-7FSpFA.js";
2
+ import { u as a } from "./index-Bm3Y5tYu.js";
3
3
  const d = `
4
4
  relative w-full h-full bg-gray-200 border-2 border-gray-400
5
5
  flex flex-col overflow-hidden
@@ -1,9 +1,9 @@
1
1
  import { jsxs as f, jsx as i } from "react/jsx-runtime";
2
2
  import { a as k } from "./logo-control-CHapR1Dt.js";
3
3
  import "react";
4
- import { u, M } from "./index-B-7FSpFA.js";
4
+ import { u, M } from "./index-Bm3Y5tYu.js";
5
5
  import { c as g, M as C } from "./index-D4t3jFAj.js";
6
- import { C as v } from "./index-BDolTDJO.js";
6
+ import { C as v } from "./index-HiFwRrPn.js";
7
7
  function y({
8
8
  clusters: n,
9
9
  colors: o,
@@ -11,12 +11,12 @@ const rt = ut.createContext({}), I = () => lt(rt), L = {
11
11
  mapbox: "locallogic/cmb9nz9kb011501ru8drq8fqf",
12
12
  google: "a7ff20eb973126bb",
13
13
  testing: "testing"
14
- }, ht = {
14
+ }, pt = {
15
15
  top: 10,
16
16
  bottom: 10,
17
17
  left: 10,
18
18
  right: 10
19
- }, W = 10, pt = 22, Qt = 10, ft = 30, dt = 60, Xt = 15, mt = [-180, -85.0511, 180, 85.0511], gt = "w-full h-full relative overflow-hidden", yt = w(() => import("./index-BjiM48Gd.js")), wt = w(() => import("./index-BKCGWHuo.js")), Mt = w(() => import("./index-B9geAgZc.js")), Y = w(() => import("./index-DEk1iNZG.js")), _t = ({ children: r }) => {
19
+ }, W = 10, ht = 22, Qt = 10, ft = 30, dt = 60, Xt = 15, mt = [-180, -85.0511, 180, 85.0511], gt = "w-full h-full relative overflow-hidden", yt = w(() => import("./index-CV3FlwtS.js")), wt = w(() => import("./index-2-7bXVdw.js")), Mt = w(() => import("./index-DJemWGRP.js")), Y = w(() => import("./index-BJa715Dk.js")), _t = ({ children: r }) => {
20
20
  const {
21
21
  mapProvider: t,
22
22
  center: e,
@@ -185,16 +185,16 @@ class $ {
185
185
  if (!this._finished) throw new Error("Data not yet indexed - call index.finish().");
186
186
  const { ids: o, coords: a, nodeSize: c } = this, s = [0, o.length - 1, 0], l = [];
187
187
  for (; s.length; ) {
188
- const p = s.pop() || 0, u = s.pop() || 0, f = s.pop() || 0;
188
+ const h = s.pop() || 0, u = s.pop() || 0, f = s.pop() || 0;
189
189
  if (u - f <= c) {
190
- for (let h = f; h <= u; h++) {
191
- const m = a[2 * h], M = a[2 * h + 1];
192
- m >= t && m <= n && M >= e && M <= i && l.push(o[h]);
190
+ for (let p = f; p <= u; p++) {
191
+ const m = a[2 * p], M = a[2 * p + 1];
192
+ m >= t && m <= n && M >= e && M <= i && l.push(o[p]);
193
193
  }
194
194
  continue;
195
195
  }
196
196
  const d = f + u >> 1, g = a[2 * d], y = a[2 * d + 1];
197
- g >= t && g <= n && y >= e && y <= i && l.push(o[d]), (p === 0 ? t <= g : e <= y) && (s.push(f), s.push(d - 1), s.push(1 - p)), (p === 0 ? n >= g : i >= y) && (s.push(d + 1), s.push(u), s.push(1 - p));
197
+ g >= t && g <= n && y >= e && y <= i && l.push(o[d]), (h === 0 ? t <= g : e <= y) && (s.push(f), s.push(d - 1), s.push(1 - h)), (h === 0 ? n >= g : i >= y) && (s.push(d + 1), s.push(u), s.push(1 - h));
198
198
  }
199
199
  return l;
200
200
  }
@@ -209,14 +209,14 @@ class $ {
209
209
  if (!this._finished) throw new Error("Data not yet indexed - call index.finish().");
210
210
  const { ids: i, coords: o, nodeSize: a } = this, c = [0, i.length - 1, 0], s = [], l = n * n;
211
211
  for (; c.length; ) {
212
- const p = c.pop() || 0, u = c.pop() || 0, f = c.pop() || 0;
212
+ const h = c.pop() || 0, u = c.pop() || 0, f = c.pop() || 0;
213
213
  if (u - f <= a) {
214
- for (let h = f; h <= u; h++)
215
- Q(o[2 * h], o[2 * h + 1], t, e) <= l && s.push(i[h]);
214
+ for (let p = f; p <= u; p++)
215
+ Q(o[2 * p], o[2 * p + 1], t, e) <= l && s.push(i[p]);
216
216
  continue;
217
217
  }
218
218
  const d = f + u >> 1, g = o[2 * d], y = o[2 * d + 1];
219
- Q(g, y, t, e) <= l && s.push(i[d]), (p === 0 ? t - n <= g : e - n <= y) && (c.push(f), c.push(d - 1), c.push(1 - p)), (p === 0 ? t + n >= g : e + n >= y) && (c.push(d + 1), c.push(u), c.push(1 - p));
219
+ Q(g, y, t, e) <= l && s.push(i[d]), (h === 0 ? t - n <= g : e - n <= y) && (c.push(f), c.push(d - 1), c.push(1 - h)), (h === 0 ? t + n >= g : e + n >= y) && (c.push(d + 1), c.push(u), c.push(1 - h));
220
220
  }
221
221
  return s;
222
222
  }
@@ -229,7 +229,7 @@ function G(r, t, e, n, i, o) {
229
229
  function it(r, t, e, n, i, o) {
230
230
  for (; i > n; ) {
231
231
  if (i - n > 600) {
232
- const l = i - n + 1, p = e - n + 1, u = Math.log(l), f = 0.5 * Math.exp(2 * u / 3), d = 0.5 * Math.sqrt(u * f * (l - f) / l) * (p - l / 2 < 0 ? -1 : 1), g = Math.max(n, Math.floor(e - p * f / l + d)), y = Math.min(i, Math.floor(e + (l - p) * f / l + d));
232
+ const l = i - n + 1, h = e - n + 1, u = Math.log(l), f = 0.5 * Math.exp(2 * u / 3), d = 0.5 * Math.sqrt(u * f * (l - f) / l) * (h - l / 2 < 0 ? -1 : 1), g = Math.max(n, Math.floor(e - h * f / l + d)), y = Math.min(i, Math.floor(e + (l - h) * f / l + d));
233
233
  it(r, t, e, g, y, o);
234
234
  }
235
235
  const a = t[2 * e + o];
@@ -289,7 +289,7 @@ class Ot {
289
289
  for (let s = 0; s < t.length; s++) {
290
290
  const l = t[s];
291
291
  if (!l.geometry) continue;
292
- const [p, u] = l.geometry.coordinates, f = X(U(p)), d = X(D(u));
292
+ const [h, u] = l.geometry.coordinates, f = X(U(h)), d = X(D(u));
293
293
  a.push(
294
294
  f,
295
295
  d,
@@ -323,20 +323,20 @@ class Ot {
323
323
  const u = this.getClusters([n, i, 180, a], e), f = this.getClusters([-180, i, o, a], e);
324
324
  return u.concat(f);
325
325
  }
326
- const c = this.trees[this._limitZoom(e)], s = c.range(U(n), D(a), U(o), D(i)), l = c.data, p = [];
326
+ const c = this.trees[this._limitZoom(e)], s = c.range(U(n), D(a), U(o), D(i)), l = c.data, h = [];
327
327
  for (const u of s) {
328
328
  const f = this.stride * u;
329
- p.push(l[f + A] > 1 ? tt(l, f, this.clusterProps) : this.points[l[f + E]]);
329
+ h.push(l[f + A] > 1 ? tt(l, f, this.clusterProps) : this.points[l[f + E]]);
330
330
  }
331
- return p;
331
+ return h;
332
332
  }
333
333
  getChildren(t) {
334
334
  const e = this._getOriginId(t), n = this._getOriginZoom(t), i = "No cluster with the specified id.", o = this.trees[n];
335
335
  if (!o) throw new Error(i);
336
336
  const a = o.data;
337
337
  if (e * this.stride >= a.length) throw new Error(i);
338
- const c = this.options.radius / (this.options.extent * Math.pow(2, n - 1)), s = a[e * this.stride], l = a[e * this.stride + 1], p = o.within(s, l, c), u = [];
339
- for (const f of p) {
338
+ const c = this.options.radius / (this.options.extent * Math.pow(2, n - 1)), s = a[e * this.stride], l = a[e * this.stride + 1], h = o.within(s, l, c), u = [];
339
+ for (const f of h) {
340
340
  const d = f * this.stride;
341
341
  a[d + N] === t && u.push(a[d + A] > 1 ? tt(a, d, this.clusterProps) : this.points[a[d + E]]);
342
342
  }
@@ -349,25 +349,25 @@ class Ot {
349
349
  return this._appendLeaves(i, t, e, n, 0), i;
350
350
  }
351
351
  getTile(t, e, n) {
352
- const i = this.trees[this._limitZoom(t)], o = Math.pow(2, t), { extent: a, radius: c } = this.options, s = c / a, l = (n - s) / o, p = (n + 1 + s) / o, u = {
352
+ const i = this.trees[this._limitZoom(t)], o = Math.pow(2, t), { extent: a, radius: c } = this.options, s = c / a, l = (n - s) / o, h = (n + 1 + s) / o, u = {
353
353
  features: []
354
354
  };
355
355
  return this._addTileFeatures(
356
- i.range((e - s) / o, l, (e + 1 + s) / o, p),
356
+ i.range((e - s) / o, l, (e + 1 + s) / o, h),
357
357
  i.data,
358
358
  e,
359
359
  n,
360
360
  o,
361
361
  u
362
362
  ), e === 0 && this._addTileFeatures(
363
- i.range(1 - s / o, l, 1, p),
363
+ i.range(1 - s / o, l, 1, h),
364
364
  i.data,
365
365
  o,
366
366
  n,
367
367
  o,
368
368
  u
369
369
  ), e === o - 1 && this._addTileFeatures(
370
- i.range(0, l, s / o, p),
370
+ i.range(0, l, s / o, h),
371
371
  i.data,
372
372
  -1,
373
373
  n,
@@ -400,14 +400,14 @@ class Ot {
400
400
  _addTileFeatures(t, e, n, i, o, a) {
401
401
  for (const c of t) {
402
402
  const s = c * this.stride, l = e[s + A] > 1;
403
- let p, u, f;
403
+ let h, u, f;
404
404
  if (l)
405
- p = at(e, s, this.clusterProps), u = e[s], f = e[s + 1];
405
+ h = at(e, s, this.clusterProps), u = e[s], f = e[s + 1];
406
406
  else {
407
407
  const y = this.points[e[s + E]];
408
- p = y.properties;
409
- const [h, m] = y.geometry.coordinates;
410
- u = U(h), f = D(m);
408
+ h = y.properties;
409
+ const [p, m] = y.geometry.coordinates;
410
+ u = U(p), f = D(m);
411
411
  }
412
412
  const d = {
413
413
  type: 1,
@@ -415,7 +415,7 @@ class Ot {
415
415
  Math.round(this.options.extent * (u * o - n)),
416
416
  Math.round(this.options.extent * (f * o - i))
417
417
  ]],
418
- tags: p
418
+ tags: h
419
419
  };
420
420
  let g;
421
421
  l || this.options.generateId ? g = e[s + E] : g = this.points[e[s + E]].id, g !== void 0 && (d.id = g), a.features.push(d);
@@ -425,35 +425,35 @@ class Ot {
425
425
  return Math.max(this.options.minZoom, Math.min(Math.floor(+t), this.options.maxZoom + 1));
426
426
  }
427
427
  _cluster(t, e) {
428
- const { radius: n, extent: i, reduce: o, minPoints: a } = this.options, c = n / (i * Math.pow(2, e)), s = t.data, l = [], p = this.stride;
429
- for (let u = 0; u < s.length; u += p) {
428
+ const { radius: n, extent: i, reduce: o, minPoints: a } = this.options, c = n / (i * Math.pow(2, e)), s = t.data, l = [], h = this.stride;
429
+ for (let u = 0; u < s.length; u += h) {
430
430
  if (s[u + T] <= e) continue;
431
431
  s[u + T] = e;
432
432
  const f = s[u], d = s[u + 1], g = t.within(s[u], s[u + 1], c), y = s[u + A];
433
- let h = y;
433
+ let p = y;
434
434
  for (const m of g) {
435
- const M = m * p;
436
- s[M + T] > e && (h += s[M + A]);
435
+ const M = m * h;
436
+ s[M + T] > e && (p += s[M + A]);
437
437
  }
438
- if (h > y && h >= a) {
438
+ if (p > y && p >= a) {
439
439
  let m = f * y, M = d * y, P, H = -1;
440
- const B = ((u / p | 0) << 5) + (e + 1) + this.points.length;
440
+ const B = ((u / h | 0) << 5) + (e + 1) + this.points.length;
441
441
  for (const ct of g) {
442
- const x = ct * p;
442
+ const x = ct * h;
443
443
  if (s[x + T] <= e) continue;
444
444
  s[x + T] = e;
445
445
  const V = s[x + A];
446
446
  m += s[x] * V, M += s[x + 1] * V, s[x + N] = B, o && (P || (P = this._map(s, u, !0), H = this.clusterProps.length, this.clusterProps.push(P)), o(P, this._map(s, x)));
447
447
  }
448
- s[u + N] = B, l.push(m / h, M / h, 1 / 0, B, -1, h), o && l.push(H);
448
+ s[u + N] = B, l.push(m / p, M / p, 1 / 0, B, -1, p), o && l.push(H);
449
449
  } else {
450
- for (let m = 0; m < p; m++) l.push(s[u + m]);
451
- if (h > 1)
450
+ for (let m = 0; m < h; m++) l.push(s[u + m]);
451
+ if (p > 1)
452
452
  for (const m of g) {
453
- const M = m * p;
453
+ const M = m * h;
454
454
  if (!(s[M + T] <= e)) {
455
455
  s[M + T] = e;
456
- for (let P = 0; P < p; P++) l.push(s[M + P]);
456
+ for (let P = 0; P < h; P++) l.push(s[M + P]);
457
457
  }
458
458
  }
459
459
  }
@@ -573,70 +573,70 @@ function Rt(r, t) {
573
573
  return Z.useEffect(r, Lt(t));
574
574
  }
575
575
  var It = function(t) {
576
- var e = t.points, n = t.bounds, i = t.zoom, o = t.options, a = t.disableRefresh, c = j(), s = j(), l = b([]), p = l[0], u = l[1], f = Math.round(i);
576
+ var e = t.points, n = t.bounds, i = t.zoom, o = t.options, a = t.disableRefresh, c = j(), s = j(), l = b([]), h = l[0], u = l[1], f = Math.round(i);
577
577
  return Rt(function() {
578
578
  a !== !0 && ((!c.current || !v(s.current, e) || !v(c.current.options, o)) && (c.current = new Ot(o), c.current.load(e)), n && u(c.current.getClusters(n, f)), s.current = e);
579
579
  }, [e, n, f, o, a]), {
580
- clusters: p,
580
+ clusters: h,
581
581
  supercluster: c.current
582
582
  };
583
583
  };
584
- const Ut = w(() => import("./index-BIEyexab.js")), Dt = w(() => import("./index-CGULF4ex.js")), Zt = w(() => import("./index-DI5zCndd.js")), Bt = w(() => import("./index-DEFuc-6u.js"));
584
+ const Ut = w(() => import("./index-BZQ1oWSp.js")), Dt = w(() => import("./index-CNCGWBR2.js")), Zt = w(() => import("./index-g1-fRXga.js")), Bt = w(() => import("./index-DEFuc-6u.js"));
585
585
  function Ft({ isLoading: r, markers: t, onClick: e, ...n }) {
586
586
  const { mapProvider: i, activeMarker: o, zoom: a, setMarkerPoints: c, setClusterPoints: s } = I();
587
587
  z(() => {
588
588
  if (r)
589
589
  return;
590
- const h = (t || []).map((m) => [m.longitude, m.latitude]);
591
- c(h);
590
+ const p = (t || []).map((m) => [m.longitude, m.latitude]);
591
+ c(p);
592
592
  }, [t, c]);
593
593
  const l = O(
594
594
  () => ({
595
- points: t.map((h) => vt([h.longitude, h.latitude], h)),
595
+ points: t.map((p) => vt([p.longitude, p.latitude], p)),
596
596
  // Using world bounds to avoid issues with markers near the edges of the map
597
597
  bounds: mt,
598
598
  zoom: a,
599
599
  options: {
600
600
  radius: i.name === "google" && a > W ? dt : ft,
601
601
  minZoom: W,
602
- maxZoom: pt
602
+ maxZoom: ht
603
603
  }
604
604
  }),
605
605
  [t, i, a]
606
- ), { clusters: p, supercluster: u } = It(l), f = j("");
606
+ ), { clusters: h, supercluster: u } = It(l), f = j("");
607
607
  z(() => {
608
- const h = JSON.stringify(
609
- p.map((m) => ({
608
+ const p = JSON.stringify(
609
+ h.map((m) => ({
610
610
  coords: m.geometry.coordinates,
611
611
  props: m.properties
612
612
  }))
613
613
  );
614
- h !== f.current && (s(p), f.current = h);
615
- }, [p, s]);
616
- const d = (h) => {
617
- if (!("properties" in h))
614
+ p !== f.current && (s(h), f.current = p);
615
+ }, [h, s]);
616
+ const d = (p) => {
617
+ if (!("properties" in p))
618
618
  throw new Error("Cluster does not have properties");
619
- if (h.properties?.cluster && typeof h.properties?.cluster_id == "number") {
619
+ if (p.properties?.cluster && typeof p.properties?.cluster_id == "number") {
620
620
  e?.({
621
- id: `${h.properties.cluster_id}`,
622
- latitude: h.geometry.coordinates[1],
623
- longitude: h.geometry.coordinates[0],
624
- markers: u?.getLeaves(h.properties.cluster_id)?.map((m) => m.properties) ?? []
621
+ id: `${p.properties.cluster_id}`,
622
+ latitude: p.geometry.coordinates[1],
623
+ longitude: p.geometry.coordinates[0],
624
+ markers: u?.getLeaves(p.properties.cluster_id)?.map((m) => m.properties) ?? []
625
625
  });
626
626
  return;
627
627
  }
628
628
  e?.({
629
- id: h.properties.id,
630
- latitude: h.properties.latitude,
631
- longitude: h.properties.longitude,
632
- markers: [h.properties]
629
+ id: p.properties.id,
630
+ latitude: p.properties.latitude,
631
+ longitude: p.properties.longitude,
632
+ markers: [p.properties]
633
633
  });
634
- }, g = (h) => {
634
+ }, g = (p) => {
635
635
  if (!u || !o) return !1;
636
- if (o.id === `${h}`)
636
+ if (o.id === `${p}`)
637
637
  return !0;
638
638
  try {
639
- return u.getLeaves(h)?.find((m) => m.properties.id === o.id) !== void 0;
639
+ return u.getLeaves(p)?.find((m) => m.properties.id === o.id) !== void 0;
640
640
  } catch {
641
641
  return !1;
642
642
  }
@@ -657,14 +657,14 @@ function Ft({ isLoading: r, markers: t, onClick: e, ...n }) {
657
657
  return y ? /* @__PURE__ */ _(R, { fallback: null, children: /* @__PURE__ */ _(
658
658
  y,
659
659
  {
660
- clusters: p,
660
+ clusters: h,
661
661
  onClick: d,
662
662
  doesSuperclusterContainActiveMarker: g,
663
663
  ...n
664
664
  }
665
665
  ) }) : null;
666
666
  }
667
- const kt = w(() => import("./index-CSsNIeGf.js")), Nt = w(() => import("./index-BrJk0fvu.js")), zt = w(() => import("./index-D06VjH1r.js")), jt = w(() => import("./index-COB6j_V1.js"));
667
+ const kt = w(() => import("./index-BCfZMtQL.js")), Nt = w(() => import("./index-5KsGujTK.js")), zt = w(() => import("./index-8AZECG4p.js")), jt = w(() => import("./index-COB6j_V1.js"));
668
668
  function Gt({ children: r, anchor: t = "bottom", ...e }) {
669
669
  const { mapProvider: n } = I(), i = O(() => {
670
670
  switch (n?.name) {
@@ -708,8 +708,8 @@ function Yt(r) {
708
708
  value: {
709
709
  ...r,
710
710
  locale: r.locale || "en",
711
- mapPadding: r.mapPadding || ht,
712
- locationBoundary: r.locationBoundary ? r.locationBoundary : [[r.center.longitude, r.center.latitude]],
711
+ mapPadding: r.mapPadding || pt,
712
+ locationBoundary: r.locationBoundary,
713
713
  centerPinMarkerPoints: t,
714
714
  setCenterPinMarkerPoints: e,
715
715
  markerPoints: n,
@@ -738,7 +738,7 @@ export {
738
738
  Xt as P,
739
739
  mt as W,
740
740
  J as a,
741
- ht as b,
741
+ pt as b,
742
742
  ee as i,
743
743
  te as m,
744
744
  I as u
@@ -1,8 +1,8 @@
1
1
  import { jsxs as f, jsx as r } from "react/jsx-runtime";
2
2
  import { useMap as k, AdvancedMarker as u } from "@vis.gl/react-google-maps";
3
- import { u as M, M as g } from "./index-B-7FSpFA.js";
3
+ import { u as M, M as g } from "./index-Bm3Y5tYu.js";
4
4
  import { c as C, M as v } from "./index-D4t3jFAj.js";
5
- import { C as I } from "./index-BDolTDJO.js";
5
+ import { C as I } from "./index-HiFwRrPn.js";
6
6
  function y({
7
7
  clusters: a,
8
8
  colors: o,
@@ -1,7 +1,7 @@
1
1
  import { jsxs as T, jsx as M } from "react/jsx-runtime";
2
- import { useState as E, useRef as x, useCallback as L, useEffect as f } from "react";
3
- import { M as A, N as G, u as h } from "./logo-control-CHapR1Dt.js";
4
- import { u as v, D as C, a as F, m as S } from "./index-B-7FSpFA.js";
2
+ import { useState as E, useRef as x, useCallback as h, useEffect as d } from "react";
3
+ import { M as L, N as A, u as G } from "./logo-control-CHapR1Dt.js";
4
+ import { u as v, D as C, a as F, m as S } from "./index-Bm3Y5tYu.js";
5
5
  import { t as z } from "./index-DscDx7HE.js";
6
6
  const H = {
7
7
  en: {
@@ -59,27 +59,27 @@ const H = {
59
59
  "CooperativeGesturesHandler.MobileHelpText": "Utilisez deux doigts pour déplacer la carte"
60
60
  }
61
61
  }, P = () => {
62
- const { current: e } = h(), { centerPinMarkerPoints: t, markerPoints: r, locationBoundary: s, setZoom: u, mapPadding: c } = v(), [a, b] = E(void 0), i = x(void 0), n = L(() => {
62
+ const { current: e } = G(), { centerPinMarkerPoints: t, markerPoints: r, locationBoundary: n, setZoom: u, mapPadding: c } = v(), [i, f] = E(void 0), s = x(void 0), l = h(() => {
63
63
  e && u(e.getZoom());
64
64
  }, [e, u]);
65
- return f(() => (n(), e?.on("zoom", n), () => {
66
- e?.off("zoom", n);
67
- }), [e, n]), f(() => {
65
+ return d(() => (l(), e?.on("zoom", l), () => {
66
+ e?.off("zoom", l);
67
+ }), [e, l]), d(() => {
68
68
  if (!e)
69
69
  return;
70
70
  const o = [];
71
- if (typeof r < "u" && r.length > 0 ? (o.push(...r), t && o.push(t)) : o.push(...s || []), o.length === 0)
71
+ if (typeof n < "u" && n.length > 0 ? o.push(...n) : typeof r < "u" && r.length > 0 ? (o.push(...r), t && o.push(t)) : t !== void 0 && o.push(t), o.length === 0)
72
72
  return;
73
- const l = z(S(o));
74
- (!i.current || !l.every((p, m) => p === i.current?.[m])) && (i.current = l, b(l));
75
- }, [e, r, s, t]), f(() => {
76
- if (!e || typeof a > "u")
73
+ const a = z(S(o));
74
+ (!s.current || !a.every((p, m) => p === s.current?.[m])) && (s.current = a, f(a));
75
+ }, [e, r, n, t]), d(() => {
76
+ if (!e || typeof i > "u")
77
77
  return;
78
- const [o, l, p, m] = a, d = (p - o) * 0.05 || 1e-3, g = (m - l) * 0.05 || 1e-3;
78
+ const [o, a, p, m] = i, b = (p - o) * 0.1 || 1e-3, g = (m - a) * 0.1 || 1e-3;
79
79
  e.fitBounds(
80
80
  [
81
- [o - d, l - g],
82
- [p + d, m + g]
81
+ [o - b, a - g],
82
+ [p + b, m + g]
83
83
  ],
84
84
  {
85
85
  padding: c,
@@ -87,38 +87,38 @@ const H = {
87
87
  duration: 700
88
88
  }
89
89
  );
90
- }, [e, a, c]), null;
90
+ }, [e, i, c]), null;
91
91
  };
92
92
  function B({ children: e }) {
93
93
  const {
94
94
  mapProvider: t,
95
95
  locale: r,
96
- center: s,
96
+ center: n,
97
97
  zoom: u = C.zoom,
98
98
  minZoom: c,
99
- maxZoom: a,
100
- pitch: b = C.pitch,
101
- bearing: i = C.bearing,
102
- cooperativeGestures: n = C.cooperativeGestures,
99
+ maxZoom: i,
100
+ pitch: f = C.pitch,
101
+ bearing: s = C.bearing,
102
+ cooperativeGestures: l = C.cooperativeGestures,
103
103
  zoomPosition: o
104
104
  } = v();
105
105
  return t.name !== "maptiler" ? null : /* @__PURE__ */ T(
106
- A,
106
+ L,
107
107
  {
108
108
  initialViewState: {
109
- ...s,
109
+ ...n,
110
110
  zoom: u,
111
- pitch: b,
112
- bearing: i
111
+ pitch: f,
112
+ bearing: s
113
113
  },
114
- cooperativeGestures: n,
114
+ cooperativeGestures: l,
115
115
  minZoom: c,
116
- maxZoom: a,
116
+ maxZoom: i,
117
117
  mapStyle: `https://api.maptiler.com/maps/${t.theme || F.maptiler}/style.json?key=${t.apiKey}`,
118
118
  locale: H[r],
119
119
  children: [
120
120
  /* @__PURE__ */ M(P, {}),
121
- o && /* @__PURE__ */ M(G, { position: o }),
121
+ o && /* @__PURE__ */ M(A, { position: o }),
122
122
  e
123
123
  ]
124
124
  }