@local-logic/maps 0.1.5 → 0.1.6

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.
@@ -1,7 +1,7 @@
1
1
  import { jsx as _ } from "react/jsx-runtime";
2
2
  import * as Z from "react";
3
- import ut, { useContext as lt, useState as L, useMemo as v, lazy as w, Suspense as R, useRef as j, useEffect as V } from "react";
4
- const rt = ut.createContext({}), I = () => lt(rt), C = {
3
+ import ut, { useContext as lt, useState as b, useMemo as O, lazy as w, Suspense as R, useEffect as z, useRef as j } from "react";
4
+ const rt = ut.createContext({}), I = () => lt(rt), L = {
5
5
  zoom: 14,
6
6
  pitch: 0,
7
7
  bearing: 0,
@@ -11,21 +11,21 @@ const rt = ut.createContext({}), I = () => lt(rt), C = {
11
11
  mapbox: "locallogic/cmb9nz9kb011501ru8drq8fqf",
12
12
  google: "a7ff20eb973126bb",
13
13
  testing: "testing"
14
- }, pt = {
14
+ }, ht = {
15
15
  top: 10,
16
16
  bottom: 10,
17
17
  left: 10,
18
18
  right: 10
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-Caot5InX.js")), wt = w(() => import("./index-wmShBScF.js")), Mt = w(() => import("./index-BP_m_WyV.js")), Y = w(() => import("./index-Bx7faHOu.js")), _t = ({ children: r }) => {
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-BqhW6lBz.js")), wt = w(() => import("./index-B2t_G7DM.js")), Mt = w(() => import("./index-B13R2TUm.js")), Y = w(() => import("./index-Oeg9DKq8.js")), _t = ({ children: r }) => {
20
20
  const {
21
21
  mapProvider: t,
22
22
  center: e,
23
- zoom: n = C.zoom,
24
- pitch: i = C.pitch,
25
- bearing: o = C.bearing,
26
- cooperativeGestures: a = C.cooperativeGestures,
23
+ zoom: n = L.zoom,
24
+ pitch: i = L.pitch,
25
+ bearing: o = L.bearing,
26
+ cooperativeGestures: a = L.cooperativeGestures,
27
27
  zoomPosition: c
28
- } = I(), [s] = L(n), l = v(() => {
28
+ } = I(), [s] = b(n), l = O(() => {
29
29
  switch (t?.name) {
30
30
  case "maptiler":
31
31
  return yt;
@@ -58,7 +58,14 @@ const rt = ut.createContext({}), I = () => lt(rt), C = {
58
58
  );
59
59
  }, Pt = w(() => import("./index-C3Tj3r2u.js")), At = w(() => import("./index-CUUravWc.js")), Et = w(() => import("./index-eWv3le07.js")), xt = w(() => import("./index-BO34uKgS.js"));
60
60
  function Tt(r) {
61
- const { mapProvider: t } = I(), e = v(() => {
61
+ const { mapProvider: t, setCenterPinMarkerPoints: e } = I();
62
+ z(() => {
63
+ if (r?.marker)
64
+ return e([r.marker.longitude, r.marker.latitude]), () => {
65
+ e(void 0);
66
+ };
67
+ }, [r?.marker?.longitude, r?.marker?.latitude, e]);
68
+ const n = O(() => {
62
69
  switch (t?.name) {
63
70
  case "maptiler":
64
71
  return Pt;
@@ -72,13 +79,13 @@ function Tt(r) {
72
79
  return null;
73
80
  }
74
81
  }, [t]);
75
- return e ? /* @__PURE__ */ _(R, { fallback: null, children: /* @__PURE__ */ _(e, { ...r }) }) : null;
82
+ return n ? /* @__PURE__ */ _(R, { fallback: null, children: /* @__PURE__ */ _(n, { ...r }) }) : null;
76
83
  }
77
84
  function st(r, t, e = {}) {
78
85
  const n = { type: "Feature" };
79
86
  return (e.id === 0 || e.id) && (n.id = e.id), e.bbox && (n.bbox = e.bbox), n.properties = t || {}, n.geometry = r, n;
80
87
  }
81
- function bt(r, t, e = {}) {
88
+ function vt(r, t, e = {}) {
82
89
  if (!r)
83
90
  throw new Error("coordinates is required");
84
91
  if (!Array.isArray(r))
@@ -111,8 +118,8 @@ const q = [
111
118
  Uint32Array,
112
119
  Float32Array,
113
120
  Float64Array
114
- ], F = 1, O = 8;
115
- class G {
121
+ ], F = 1, S = 8;
122
+ class $ {
116
123
  /**
117
124
  * Creates an index from raw `ArrayBuffer` data.
118
125
  * @param {ArrayBuffer} data
@@ -130,7 +137,7 @@ class G {
130
137
  if (!o)
131
138
  throw new Error("Unrecognized array type.");
132
139
  const [a] = new Uint16Array(t, 2, 1), [c] = new Uint32Array(t, 4, 1);
133
- return new G(c, a, o, t);
140
+ return new $(c, a, o, t);
134
141
  }
135
142
  /**
136
143
  * Creates an index that will hold a given number of items.
@@ -145,7 +152,7 @@ class G {
145
152
  const o = q.indexOf(this.ArrayType), a = t * 2 * this.ArrayType.BYTES_PER_ELEMENT, c = t * this.IndexArrayType.BYTES_PER_ELEMENT, s = (8 - c % 8) % 8;
146
153
  if (o < 0)
147
154
  throw new Error(`Unexpected typed array class: ${n}.`);
148
- i && i instanceof ArrayBuffer ? (this.data = i, this.ids = new this.IndexArrayType(this.data, O, t), this.coords = new this.ArrayType(this.data, O + c + s, t * 2), this._pos = t * 2, this._finished = !0) : (this.data = new ArrayBuffer(O + a + c + s), this.ids = new this.IndexArrayType(this.data, O, t), this.coords = new this.ArrayType(this.data, O + c + s, t * 2), this._pos = 0, this._finished = !1, new Uint8Array(this.data, 0, 2).set([219, (F << 4) + o]), new Uint16Array(this.data, 2, 1)[0] = e, new Uint32Array(this.data, 4, 1)[0] = t);
155
+ i && i instanceof ArrayBuffer ? (this.data = i, this.ids = new this.IndexArrayType(this.data, S, t), this.coords = new this.ArrayType(this.data, S + c + s, t * 2), this._pos = t * 2, this._finished = !0) : (this.data = new ArrayBuffer(S + a + c + s), this.ids = new this.IndexArrayType(this.data, S, t), this.coords = new this.ArrayType(this.data, S + c + s, t * 2), this._pos = 0, this._finished = !1, new Uint8Array(this.data, 0, 2).set([219, (F << 4) + o]), new Uint16Array(this.data, 2, 1)[0] = e, new Uint32Array(this.data, 4, 1)[0] = t);
149
156
  }
150
157
  /**
151
158
  * Add a point to the index.
@@ -164,7 +171,7 @@ class G {
164
171
  const t = this._pos >> 1;
165
172
  if (t !== this.numItems)
166
173
  throw new Error(`Added ${t} items when expected ${this.numItems}.`);
167
- return k(this.ids, this.coords, this.nodeSize, 0, this.numItems - 1, 0), this._finished = !0, this;
174
+ return G(this.ids, this.coords, this.nodeSize, 0, this.numItems - 1, 0), this._finished = !0, this;
168
175
  }
169
176
  /**
170
177
  * Search the index for items within a given bounding box.
@@ -178,16 +185,16 @@ class G {
178
185
  if (!this._finished) throw new Error("Data not yet indexed - call index.finish().");
179
186
  const { ids: o, coords: a, nodeSize: c } = this, s = [0, o.length - 1, 0], l = [];
180
187
  for (; s.length; ) {
181
- const h = s.pop() || 0, u = s.pop() || 0, f = s.pop() || 0;
188
+ const p = s.pop() || 0, u = s.pop() || 0, f = s.pop() || 0;
182
189
  if (u - f <= c) {
183
- for (let p = f; p <= u; p++) {
184
- const m = a[2 * p], M = a[2 * p + 1];
185
- m >= t && m <= n && M >= e && M <= i && l.push(o[p]);
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]);
186
193
  }
187
194
  continue;
188
195
  }
189
196
  const d = f + u >> 1, g = a[2 * d], y = a[2 * d + 1];
190
- 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));
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));
191
198
  }
192
199
  return l;
193
200
  }
@@ -202,42 +209,42 @@ class G {
202
209
  if (!this._finished) throw new Error("Data not yet indexed - call index.finish().");
203
210
  const { ids: i, coords: o, nodeSize: a } = this, c = [0, i.length - 1, 0], s = [], l = n * n;
204
211
  for (; c.length; ) {
205
- const h = c.pop() || 0, u = c.pop() || 0, f = c.pop() || 0;
212
+ const p = c.pop() || 0, u = c.pop() || 0, f = c.pop() || 0;
206
213
  if (u - f <= a) {
207
- for (let p = f; p <= u; p++)
208
- Q(o[2 * p], o[2 * p + 1], t, e) <= l && s.push(i[p]);
214
+ for (let h = f; h <= u; h++)
215
+ Q(o[2 * h], o[2 * h + 1], t, e) <= l && s.push(i[h]);
209
216
  continue;
210
217
  }
211
218
  const d = f + u >> 1, g = o[2 * d], y = o[2 * d + 1];
212
- 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));
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));
213
220
  }
214
221
  return s;
215
222
  }
216
223
  }
217
- function k(r, t, e, n, i, o) {
224
+ function G(r, t, e, n, i, o) {
218
225
  if (i - n <= e) return;
219
226
  const a = n + i >> 1;
220
- it(r, t, a, n, i, o), k(r, t, e, n, a - 1, 1 - o), k(r, t, e, a + 1, i, 1 - o);
227
+ it(r, t, a, n, i, o), G(r, t, e, n, a - 1, 1 - o), G(r, t, e, a + 1, i, 1 - o);
221
228
  }
222
229
  function it(r, t, e, n, i, o) {
223
230
  for (; i > n; ) {
224
231
  if (i - n > 600) {
225
- 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));
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));
226
233
  it(r, t, e, g, y, o);
227
234
  }
228
235
  const a = t[2 * e + o];
229
236
  let c = n, s = i;
230
- for (S(r, t, n, e), t[2 * i + o] > a && S(r, t, n, i); c < s; ) {
231
- for (S(r, t, c, s), c++, s--; t[2 * c + o] < a; ) c++;
237
+ for (C(r, t, n, e), t[2 * i + o] > a && C(r, t, n, i); c < s; ) {
238
+ for (C(r, t, c, s), c++, s--; t[2 * c + o] < a; ) c++;
232
239
  for (; t[2 * s + o] > a; ) s--;
233
240
  }
234
- t[2 * n + o] === a ? S(r, t, n, s) : (s++, S(r, t, s, i)), s <= e && (n = s + 1), e <= s && (i = s - 1);
241
+ t[2 * n + o] === a ? C(r, t, n, s) : (s++, C(r, t, s, i)), s <= e && (n = s + 1), e <= s && (i = s - 1);
235
242
  }
236
243
  }
237
- function S(r, t, e, n) {
238
- N(r, e, n), N(t, 2 * e, 2 * n), N(t, 2 * e + 1, 2 * n + 1);
244
+ function C(r, t, e, n) {
245
+ k(r, e, n), k(t, 2 * e, 2 * n), k(t, 2 * e + 1, 2 * n + 1);
239
246
  }
240
- function N(r, t, e) {
247
+ function k(r, t, e) {
241
248
  const n = r[t];
242
249
  r[t] = r[e], r[e] = n;
243
250
  }
@@ -245,7 +252,7 @@ function Q(r, t, e, n) {
245
252
  const i = r - e, o = t - n;
246
253
  return i * i + o * o;
247
254
  }
248
- const vt = {
255
+ const bt = {
249
256
  minZoom: 0,
250
257
  // min zoom to generate clusters on
251
258
  maxZoom: 16,
@@ -268,10 +275,10 @@ const vt = {
268
275
  // properties to use for individual points when running the reducer
269
276
  map: (r) => r
270
277
  // props => ({sum: props.my_value})
271
- }, X = Math.fround || /* @__PURE__ */ ((r) => ((t) => (r[0] = +t, r[0])))(new Float32Array(1)), T = 2, E = 3, z = 4, A = 5, ot = 6;
278
+ }, X = Math.fround || /* @__PURE__ */ ((r) => ((t) => (r[0] = +t, r[0])))(new Float32Array(1)), T = 2, E = 3, N = 4, A = 5, ot = 6;
272
279
  class Ot {
273
280
  constructor(t) {
274
- this.options = Object.assign(Object.create(vt), t), this.trees = new Array(this.options.maxZoom + 1), this.stride = this.options.reduce ? 7 : 6, this.clusterProps = [];
281
+ this.options = Object.assign(Object.create(bt), t), this.trees = new Array(this.options.maxZoom + 1), this.stride = this.options.reduce ? 7 : 6, this.clusterProps = [];
275
282
  }
276
283
  load(t) {
277
284
  const { log: e, minZoom: n, maxZoom: i } = this.options;
@@ -282,7 +289,7 @@ class Ot {
282
289
  for (let s = 0; s < t.length; s++) {
283
290
  const l = t[s];
284
291
  if (!l.geometry) continue;
285
- const [h, u] = l.geometry.coordinates, f = X(U(h)), d = X(D(u));
292
+ const [p, u] = l.geometry.coordinates, f = X(U(p)), d = X(D(u));
286
293
  a.push(
287
294
  f,
288
295
  d,
@@ -316,22 +323,22 @@ class Ot {
316
323
  const u = this.getClusters([n, i, 180, a], e), f = this.getClusters([-180, i, o, a], e);
317
324
  return u.concat(f);
318
325
  }
319
- const c = this.trees[this._limitZoom(e)], s = c.range(U(n), D(a), U(o), D(i)), l = c.data, h = [];
326
+ const c = this.trees[this._limitZoom(e)], s = c.range(U(n), D(a), U(o), D(i)), l = c.data, p = [];
320
327
  for (const u of s) {
321
328
  const f = this.stride * u;
322
- h.push(l[f + A] > 1 ? tt(l, f, this.clusterProps) : this.points[l[f + E]]);
329
+ p.push(l[f + A] > 1 ? tt(l, f, this.clusterProps) : this.points[l[f + E]]);
323
330
  }
324
- return h;
331
+ return p;
325
332
  }
326
333
  getChildren(t) {
327
334
  const e = this._getOriginId(t), n = this._getOriginZoom(t), i = "No cluster with the specified id.", o = this.trees[n];
328
335
  if (!o) throw new Error(i);
329
336
  const a = o.data;
330
337
  if (e * this.stride >= a.length) throw new Error(i);
331
- 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 = [];
332
- for (const f of h) {
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) {
333
340
  const d = f * this.stride;
334
- a[d + z] === t && u.push(a[d + A] > 1 ? tt(a, d, this.clusterProps) : this.points[a[d + E]]);
341
+ a[d + N] === t && u.push(a[d + A] > 1 ? tt(a, d, this.clusterProps) : this.points[a[d + E]]);
335
342
  }
336
343
  if (u.length === 0) throw new Error(i);
337
344
  return u;
@@ -342,25 +349,25 @@ class Ot {
342
349
  return this._appendLeaves(i, t, e, n, 0), i;
343
350
  }
344
351
  getTile(t, e, n) {
345
- 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 = {
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 = {
346
353
  features: []
347
354
  };
348
355
  return this._addTileFeatures(
349
- i.range((e - s) / o, l, (e + 1 + s) / o, h),
356
+ i.range((e - s) / o, l, (e + 1 + s) / o, p),
350
357
  i.data,
351
358
  e,
352
359
  n,
353
360
  o,
354
361
  u
355
362
  ), e === 0 && this._addTileFeatures(
356
- i.range(1 - s / o, l, 1, h),
363
+ i.range(1 - s / o, l, 1, p),
357
364
  i.data,
358
365
  o,
359
366
  n,
360
367
  o,
361
368
  u
362
369
  ), e === o - 1 && this._addTileFeatures(
363
- i.range(0, l, s / o, h),
370
+ i.range(0, l, s / o, p),
364
371
  i.data,
365
372
  -1,
366
373
  n,
@@ -386,21 +393,21 @@ class Ot {
386
393
  return o;
387
394
  }
388
395
  _createTree(t) {
389
- const e = new G(t.length / this.stride | 0, this.options.nodeSize, Float32Array);
396
+ const e = new $(t.length / this.stride | 0, this.options.nodeSize, Float32Array);
390
397
  for (let n = 0; n < t.length; n += this.stride) e.add(t[n], t[n + 1]);
391
398
  return e.finish(), e.data = t, e;
392
399
  }
393
400
  _addTileFeatures(t, e, n, i, o, a) {
394
401
  for (const c of t) {
395
402
  const s = c * this.stride, l = e[s + A] > 1;
396
- let h, u, f;
403
+ let p, u, f;
397
404
  if (l)
398
- h = at(e, s, this.clusterProps), u = e[s], f = e[s + 1];
405
+ p = at(e, s, this.clusterProps), u = e[s], f = e[s + 1];
399
406
  else {
400
407
  const y = this.points[e[s + E]];
401
- h = y.properties;
402
- const [p, m] = y.geometry.coordinates;
403
- u = U(p), f = D(m);
408
+ p = y.properties;
409
+ const [h, m] = y.geometry.coordinates;
410
+ u = U(h), f = D(m);
404
411
  }
405
412
  const d = {
406
413
  type: 1,
@@ -408,7 +415,7 @@ class Ot {
408
415
  Math.round(this.options.extent * (u * o - n)),
409
416
  Math.round(this.options.extent * (f * o - i))
410
417
  ]],
411
- tags: h
418
+ tags: p
412
419
  };
413
420
  let g;
414
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);
@@ -418,35 +425,35 @@ class Ot {
418
425
  return Math.max(this.options.minZoom, Math.min(Math.floor(+t), this.options.maxZoom + 1));
419
426
  }
420
427
  _cluster(t, e) {
421
- 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;
422
- for (let u = 0; u < s.length; u += h) {
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) {
423
430
  if (s[u + T] <= e) continue;
424
431
  s[u + T] = e;
425
432
  const f = s[u], d = s[u + 1], g = t.within(s[u], s[u + 1], c), y = s[u + A];
426
- let p = y;
433
+ let h = y;
427
434
  for (const m of g) {
428
- const M = m * h;
429
- s[M + T] > e && (p += s[M + A]);
435
+ const M = m * p;
436
+ s[M + T] > e && (h += s[M + A]);
430
437
  }
431
- if (p > y && p >= a) {
432
- let m = f * y, M = d * y, P, $ = -1;
433
- const B = ((u / h | 0) << 5) + (e + 1) + this.points.length;
438
+ if (h > y && h >= a) {
439
+ let m = f * y, M = d * y, P, H = -1;
440
+ const B = ((u / p | 0) << 5) + (e + 1) + this.points.length;
434
441
  for (const ct of g) {
435
- const x = ct * h;
442
+ const x = ct * p;
436
443
  if (s[x + T] <= e) continue;
437
444
  s[x + T] = e;
438
- const H = s[x + A];
439
- m += s[x] * H, M += s[x + 1] * H, s[x + z] = B, o && (P || (P = this._map(s, u, !0), $ = this.clusterProps.length, this.clusterProps.push(P)), o(P, this._map(s, x)));
445
+ const V = s[x + A];
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)));
440
447
  }
441
- s[u + z] = B, l.push(m / p, M / p, 1 / 0, B, -1, p), o && l.push($);
448
+ s[u + N] = B, l.push(m / h, M / h, 1 / 0, B, -1, h), o && l.push(H);
442
449
  } else {
443
- for (let m = 0; m < h; m++) l.push(s[u + m]);
444
- if (p > 1)
450
+ for (let m = 0; m < p; m++) l.push(s[u + m]);
451
+ if (h > 1)
445
452
  for (const m of g) {
446
- const M = m * h;
453
+ const M = m * p;
447
454
  if (!(s[M + T] <= e)) {
448
455
  s[M + T] = e;
449
- for (let P = 0; P < h; P++) l.push(s[M + P]);
456
+ for (let P = 0; P < p; P++) l.push(s[M + P]);
450
457
  }
451
458
  }
452
459
  }
@@ -507,9 +514,9 @@ function Ct(r) {
507
514
  var et = Object.prototype.hasOwnProperty;
508
515
  function nt(r, t, e) {
509
516
  for (e of r.keys())
510
- if (b(e, t)) return e;
517
+ if (v(e, t)) return e;
511
518
  }
512
- function b(r, t) {
519
+ function v(r, t) {
513
520
  var e, n, i;
514
521
  if (r === t) return !0;
515
522
  if (r && t && (e = r.constructor) === t.constructor) {
@@ -517,7 +524,7 @@ function b(r, t) {
517
524
  if (e === RegExp) return r.toString() === t.toString();
518
525
  if (e === Array) {
519
526
  if ((n = r.length) === t.length)
520
- for (; n-- && b(r[n], t[n]); ) ;
527
+ for (; n-- && v(r[n], t[n]); ) ;
521
528
  return n === -1;
522
529
  }
523
530
  if (e === Set) {
@@ -531,7 +538,7 @@ function b(r, t) {
531
538
  if (r.size !== t.size)
532
539
  return !1;
533
540
  for (n of r)
534
- if (i = n[0], i && typeof i == "object" && (i = nt(t, i), !i) || !b(n[1], t.get(i)))
541
+ if (i = n[0], i && typeof i == "object" && (i = nt(t, i), !i) || !v(n[1], t.get(i)))
535
542
  return !1;
536
543
  return !0;
537
544
  }
@@ -550,7 +557,7 @@ function b(r, t) {
550
557
  if (!e || typeof r == "object") {
551
558
  n = 0;
552
559
  for (e in r)
553
- if (et.call(r, e) && ++n && !et.call(t, e) || !(e in t) || !b(r[e], t[e])) return !1;
560
+ if (et.call(r, e) && ++n && !et.call(t, e) || !(e in t) || !v(r[e], t[e])) return !1;
554
561
  return Object.keys(t).length === n;
555
562
  }
556
563
  }
@@ -558,7 +565,7 @@ function b(r, t) {
558
565
  }
559
566
  function Lt(r) {
560
567
  var t = Z.useRef(r), e = Z.useRef(0);
561
- return b(r, t.current) || (t.current = r, e.current += 1), Z.useMemo(function() {
568
+ return v(r, t.current) || (t.current = r, e.current += 1), Z.useMemo(function() {
562
569
  return t.current;
563
570
  }, [e.current]);
564
571
  }
@@ -566,74 +573,74 @@ function Rt(r, t) {
566
573
  return Z.useEffect(r, Lt(t));
567
574
  }
568
575
  var It = function(t) {
569
- var e = t.points, n = t.bounds, i = t.zoom, o = t.options, a = t.disableRefresh, c = j(), s = j(), l = L([]), h = 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([]), p = l[0], u = l[1], f = Math.round(i);
570
577
  return Rt(function() {
571
- a !== !0 && ((!c.current || !b(s.current, e) || !b(c.current.options, o)) && (c.current = new Ot(o), c.current.load(e)), n && u(c.current.getClusters(n, f)), s.current = e);
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);
572
579
  }, [e, n, f, o, a]), {
573
- clusters: h,
580
+ clusters: p,
574
581
  supercluster: c.current
575
582
  };
576
583
  };
577
- const Ut = w(() => import("./index-DBgzG__6.js")), Dt = w(() => import("./index-DsyoZEsZ.js")), Zt = w(() => import("./index-aSBXZLeP.js")), Bt = w(() => import("./index-DEFuc-6u.js"));
584
+ const Ut = w(() => import("./index-BpXydeNl.js")), Dt = w(() => import("./index-qum6AMNP.js")), Zt = w(() => import("./index-BTgWiuFg.js")), Bt = w(() => import("./index-DEFuc-6u.js"));
578
585
  function Ft({ isLoading: r, markers: t, onClick: e, ...n }) {
579
586
  const { mapProvider: i, activeMarker: o, zoom: a, setMarkerPoints: c, setClusterPoints: s } = I();
580
- V(() => {
587
+ z(() => {
581
588
  if (r)
582
589
  return;
583
- const p = (t || []).map((m) => [m.longitude, m.latitude]);
584
- c(p);
590
+ const h = (t || []).map((m) => [m.longitude, m.latitude]);
591
+ c(h);
585
592
  }, [t, c]);
586
- const l = v(
593
+ const l = O(
587
594
  () => ({
588
- points: t.map((p) => bt([p.longitude, p.latitude], p)),
595
+ points: t.map((h) => vt([h.longitude, h.latitude], h)),
589
596
  // Using world bounds to avoid issues with markers near the edges of the map
590
597
  bounds: mt,
591
598
  zoom: a,
592
599
  options: {
593
600
  radius: i.name === "google" && a > W ? dt : ft,
594
601
  minZoom: W,
595
- maxZoom: ht
602
+ maxZoom: pt
596
603
  }
597
604
  }),
598
605
  [t, i, a]
599
- ), { clusters: h, supercluster: u } = It(l), f = j("");
600
- V(() => {
601
- const p = JSON.stringify(
602
- h.map((m) => ({
606
+ ), { clusters: p, supercluster: u } = It(l), f = j("");
607
+ z(() => {
608
+ const h = JSON.stringify(
609
+ p.map((m) => ({
603
610
  coords: m.geometry.coordinates,
604
611
  props: m.properties
605
612
  }))
606
613
  );
607
- p !== f.current && (s(h), f.current = p);
608
- }, [h, s]);
609
- const d = (p) => {
610
- if (!("properties" in p))
614
+ h !== f.current && (s(p), f.current = h);
615
+ }, [p, s]);
616
+ const d = (h) => {
617
+ if (!("properties" in h))
611
618
  throw new Error("Cluster does not have properties");
612
- if (p.properties?.cluster && typeof p.properties?.cluster_id == "number") {
619
+ if (h.properties?.cluster && typeof h.properties?.cluster_id == "number") {
613
620
  e?.({
614
- id: `${p.properties.cluster_id}`,
615
- latitude: p.geometry.coordinates[1],
616
- longitude: p.geometry.coordinates[0],
617
- markers: u?.getLeaves(p.properties.cluster_id)?.map((m) => m.properties) ?? []
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) ?? []
618
625
  });
619
626
  return;
620
627
  }
621
628
  e?.({
622
- id: p.properties.id,
623
- latitude: p.properties.latitude,
624
- longitude: p.properties.longitude,
625
- markers: [p.properties]
629
+ id: h.properties.id,
630
+ latitude: h.properties.latitude,
631
+ longitude: h.properties.longitude,
632
+ markers: [h.properties]
626
633
  });
627
- }, g = (p) => {
634
+ }, g = (h) => {
628
635
  if (!u || !o) return !1;
629
- if (o.id === `${p}`)
636
+ if (o.id === `${h}`)
630
637
  return !0;
631
638
  try {
632
- return u.getLeaves(p)?.find((m) => m.properties.id === o.id) !== void 0;
639
+ return u.getLeaves(h)?.find((m) => m.properties.id === o.id) !== void 0;
633
640
  } catch {
634
641
  return !1;
635
642
  }
636
- }, y = v(() => {
643
+ }, y = O(() => {
637
644
  switch (i?.name) {
638
645
  case "maptiler":
639
646
  return Ut;
@@ -650,25 +657,25 @@ function Ft({ isLoading: r, markers: t, onClick: e, ...n }) {
650
657
  return y ? /* @__PURE__ */ _(R, { fallback: null, children: /* @__PURE__ */ _(
651
658
  y,
652
659
  {
653
- clusters: h,
660
+ clusters: p,
654
661
  onClick: d,
655
662
  doesSuperclusterContainActiveMarker: g,
656
663
  ...n
657
664
  }
658
665
  ) }) : null;
659
666
  }
660
- const Nt = w(() => import("./index-D49Xw0s2.js")), zt = w(() => import("./index-DQ1iIFTk.js")), jt = w(() => import("./index-Bp7Yr6DA.js")), kt = w(() => import("./index-COB6j_V1.js"));
667
+ const kt = w(() => import("./index-BL4YTPcp.js")), Nt = w(() => import("./index-DM-Ih4p_.js")), zt = w(() => import("./index-D9mXgSxJ.js")), jt = w(() => import("./index-COB6j_V1.js"));
661
668
  function Gt({ children: r, anchor: t = "bottom", ...e }) {
662
- const { mapProvider: n } = I(), i = v(() => {
669
+ const { mapProvider: n } = I(), i = O(() => {
663
670
  switch (n?.name) {
664
671
  case "maptiler":
665
- return Nt;
672
+ return kt;
666
673
  case "google":
667
- return zt;
674
+ return Nt;
668
675
  case "mapbox":
669
- return jt;
676
+ return zt;
670
677
  case "testing":
671
- return kt;
678
+ return jt;
672
679
  default:
673
680
  return null;
674
681
  }
@@ -677,7 +684,7 @@ function Gt({ children: r, anchor: t = "bottom", ...e }) {
677
684
  }
678
685
  const $t = w(() => import("./index-DKy2opdk.js")), Ht = w(() => import("./index-k9UFzKZZ.js")), Vt = w(() => import("./index-D8-yY6UK.js")), Jt = w(() => import("./index-C0inY_TA.js"));
679
686
  function Wt(r) {
680
- const { mapProvider: t } = I(), e = v(() => {
687
+ const { mapProvider: t } = I(), e = O(() => {
681
688
  switch (t?.name) {
682
689
  case "maptiler":
683
690
  return $t;
@@ -694,21 +701,23 @@ function Wt(r) {
694
701
  return e ? /* @__PURE__ */ _(R, { fallback: null, children: /* @__PURE__ */ _(e, { ...r }) }) : null;
695
702
  }
696
703
  function Yt(r) {
697
- const [t, e] = L([]), [n, i] = L([]), [o, a] = L(r.zoom || C.zoom);
704
+ const [t, e] = b(), [n, i] = b([]), [o, a] = b([]), [c, s] = b(r.zoom || L.zoom);
698
705
  return /* @__PURE__ */ _(
699
706
  rt.Provider,
700
707
  {
701
708
  value: {
702
709
  ...r,
703
710
  locale: r.locale || "en",
704
- mapPadding: r.mapPadding || pt,
711
+ mapPadding: r.mapPadding || ht,
705
712
  locationBoundary: r.locationBoundary ? r.locationBoundary : [[r.center.longitude, r.center.latitude]],
706
- markerPoints: t,
707
- setMarkerPoints: e,
708
- clusterPoints: n,
709
- setClusterPoints: i,
710
- zoom: o,
711
- setZoom: a
713
+ centerPinMarkerPoints: t,
714
+ setCenterPinMarkerPoints: e,
715
+ markerPoints: n,
716
+ setMarkerPoints: i,
717
+ clusterPoints: o,
718
+ setClusterPoints: a,
719
+ zoom: c,
720
+ setZoom: s
712
721
  },
713
722
  children: r.children
714
723
  }
@@ -724,12 +733,12 @@ const ee = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
724
733
  Root: Yt
725
734
  }, Symbol.toStringTag, { value: "Module" }));
726
735
  export {
727
- C as D,
736
+ L as D,
728
737
  Qt as M,
729
738
  Xt as P,
730
739
  mt as W,
731
740
  J as a,
732
- pt as b,
741
+ ht as b,
733
742
  ee as i,
734
743
  te as m,
735
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-Bbgg2AcG.js";
3
+ import { u as M, M as g } from "./index-eyFsWhYO.js";
4
4
  import { c as C, M as v } from "./index-D4t3jFAj.js";
5
- import { C as I } from "./index-Cz1bOBd_.js";
5
+ import { C as I } from "./index-DFGiNPbe.js";
6
6
  function y({
7
7
  clusters: a,
8
8
  colors: o,
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { i as c } from "./index-Bbgg2AcG.js";
1
+ import { i as c } from "./index-eyFsWhYO.js";
2
2
  export {
3
3
  c as LocalLogicMap
4
4
  };