@local-logic/maps 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index-BabQioiH.js → index-B1dI6iqp.js} +1 -1
- package/dist/{index-xDS1OfMB.js → index-Bm2KdhhT.js} +1 -1
- package/dist/{index-BOJCRr60.js → index-CFioISlP.js} +2 -2
- package/dist/{index-vIYPnHrB.js → index-CyFpPXRS.js} +2 -2
- package/dist/{index-DHOxmHER.js → index-CzqD82Cl.js} +2 -2
- package/dist/{index-Dy0j33aN.js → index-Deqck8KU.js} +2 -2
- package/dist/{index-BUZonjTY.js → index-HWDZde-a.js} +1 -1
- package/dist/{index-D37STE_k.js → index-J8lmJ6Xj.js} +206 -206
- package/dist/{index-CTWLtI5f.js → index-NMqp09ek.js} +1 -1
- package/dist/{index-CWXZA3V3.js → index-VFglx6lb.js} +2 -2
- package/dist/{index-Ci9PQ3VM.js → index-zqYpD_YN.js} +2 -2
- package/dist/index.es.js +1 -1
- package/dist/index.umd.js +4 -4
- package/dist/src/components/Map/Root/BaseMap/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/CenterPin/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Layers/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Markers/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Popup/index.d.ts.map +1 -1
- package/dist/{styles-B3ZaR0wz.js → styles-J872R1eq.js} +1 -1
- package/package.json +1 -1
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
const
|
|
1
|
+
import { jsx as _ } from "react/jsx-runtime";
|
|
2
|
+
import * as Z from "react";
|
|
3
|
+
import ct, { useContext as ut, useState as L, useMemo as O, lazy as w, Suspense as R, useRef as j, useEffect as V } from "react";
|
|
4
|
+
const nt = ct.createContext({}), I = () => ut(nt), C = {
|
|
5
5
|
zoom: 14,
|
|
6
6
|
pitch: 0,
|
|
7
7
|
bearing: 0,
|
|
8
8
|
cooperativeGestures: !1
|
|
9
|
-
},
|
|
9
|
+
}, J = {
|
|
10
10
|
maptiler: "600d69cb-288d-445e-9839-3dfe4d76b31a",
|
|
11
11
|
mapbox: "locallogic/cmb9nz9kb011501ru8drq8fqf",
|
|
12
12
|
google: "a7ff20eb973126bb"
|
|
13
|
-
},
|
|
13
|
+
}, lt = {
|
|
14
14
|
top: 10,
|
|
15
15
|
bottom: 10,
|
|
16
16
|
left: 10,
|
|
17
17
|
right: 10
|
|
18
|
-
},
|
|
18
|
+
}, W = 10, pt = 22, Wt = 10, ht = 30, ft = 60, Yt = 15, dt = [-180, -85.0511, 180, 85.0511], mt = "w-full h-full relative overflow-hidden", gt = w(() => import("./index-NMqp09ek.js")), yt = w(() => import("./index-B1dI6iqp.js")), wt = w(() => import("./index-Bm2KdhhT.js")), Mt = w(() => import("./index-qqbvBkdn.js")), _t = ({ children: r }) => {
|
|
19
19
|
const {
|
|
20
20
|
mapProvider: t,
|
|
21
21
|
center: e,
|
|
@@ -24,25 +24,25 @@ const et = at.createContext({}), R = () => ct(et), C = {
|
|
|
24
24
|
bearing: i = C.bearing,
|
|
25
25
|
cooperativeGestures: a = C.cooperativeGestures,
|
|
26
26
|
zoomPosition: c
|
|
27
|
-
} =
|
|
27
|
+
} = I(), [s] = L(n), l = O(() => {
|
|
28
28
|
switch (t?.name) {
|
|
29
29
|
case "maptiler":
|
|
30
|
-
return mt;
|
|
31
|
-
case "google":
|
|
32
30
|
return gt;
|
|
33
|
-
case "
|
|
31
|
+
case "google":
|
|
34
32
|
return yt;
|
|
35
|
-
|
|
33
|
+
case "mapbox":
|
|
36
34
|
return wt;
|
|
35
|
+
default:
|
|
36
|
+
return Mt;
|
|
37
37
|
}
|
|
38
38
|
}, [t]);
|
|
39
|
-
return /* @__PURE__ */
|
|
39
|
+
return /* @__PURE__ */ _(
|
|
40
40
|
"div",
|
|
41
41
|
{
|
|
42
|
-
className:
|
|
42
|
+
className: mt,
|
|
43
43
|
"data-testid": "base-map",
|
|
44
44
|
"data-map-provider-name": t?.name,
|
|
45
|
-
"data-map-provider-theme": t?.theme ||
|
|
45
|
+
"data-map-provider-theme": t?.theme || J[t?.name] || J.maptiler,
|
|
46
46
|
"data-initial-zoom": s,
|
|
47
47
|
"data-pitch": o,
|
|
48
48
|
"data-bearing": i,
|
|
@@ -50,53 +50,53 @@ const et = at.createContext({}), R = () => ct(et), C = {
|
|
|
50
50
|
"data-zoom-position": c,
|
|
51
51
|
"data-center-latitude": e.latitude,
|
|
52
52
|
"data-center-longitude": e.longitude,
|
|
53
|
-
children: /* @__PURE__ */
|
|
53
|
+
children: /* @__PURE__ */ _(R, { fallback: null, children: /* @__PURE__ */ _(l, { children: r }) })
|
|
54
54
|
}
|
|
55
55
|
);
|
|
56
|
-
},
|
|
57
|
-
function
|
|
58
|
-
const { mapProvider: t } =
|
|
56
|
+
}, Pt = w(() => import("./index-C3Tj3r2u.js")), At = w(() => import("./index-CUUravWc.js")), Et = w(() => import("./index-eWv3le07.js"));
|
|
57
|
+
function xt(r) {
|
|
58
|
+
const { mapProvider: t } = I(), e = O(() => {
|
|
59
59
|
switch (t?.name) {
|
|
60
60
|
case "maptiler":
|
|
61
|
-
return _t;
|
|
62
|
-
case "google":
|
|
63
61
|
return Pt;
|
|
64
|
-
case "
|
|
62
|
+
case "google":
|
|
65
63
|
return At;
|
|
64
|
+
case "mapbox":
|
|
65
|
+
return Et;
|
|
66
66
|
default:
|
|
67
67
|
return null;
|
|
68
68
|
}
|
|
69
69
|
}, [t]);
|
|
70
|
-
return e ? /* @__PURE__ */
|
|
70
|
+
return e ? /* @__PURE__ */ _(R, { fallback: null, children: /* @__PURE__ */ _(e, { ...r }) }) : null;
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function rt(r, t, e = {}) {
|
|
73
73
|
const n = { type: "Feature" };
|
|
74
74
|
return (e.id === 0 || e.id) && (n.id = e.id), e.bbox && (n.bbox = e.bbox), n.properties = t || {}, n.geometry = r, n;
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function bt(r, t, e = {}) {
|
|
77
77
|
if (!r)
|
|
78
78
|
throw new Error("coordinates is required");
|
|
79
79
|
if (!Array.isArray(r))
|
|
80
80
|
throw new Error("coordinates must be an Array");
|
|
81
81
|
if (r.length < 2)
|
|
82
82
|
throw new Error("coordinates must be at least 2 numbers long");
|
|
83
|
-
if (!
|
|
83
|
+
if (!Y(r[0]) || !Y(r[1]))
|
|
84
84
|
throw new Error("coordinates must contain numbers");
|
|
85
|
-
return
|
|
85
|
+
return rt({
|
|
86
86
|
type: "Point",
|
|
87
87
|
coordinates: r
|
|
88
88
|
}, t, e);
|
|
89
89
|
}
|
|
90
|
-
function
|
|
91
|
-
return
|
|
90
|
+
function Kt(r, t, e = {}) {
|
|
91
|
+
return rt({
|
|
92
92
|
type: "MultiPoint",
|
|
93
93
|
coordinates: r
|
|
94
94
|
}, t, e);
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function Y(r) {
|
|
97
97
|
return !isNaN(r) && r !== null && !Array.isArray(r);
|
|
98
98
|
}
|
|
99
|
-
const
|
|
99
|
+
const K = [
|
|
100
100
|
Int8Array,
|
|
101
101
|
Uint8Array,
|
|
102
102
|
Uint8ClampedArray,
|
|
@@ -106,7 +106,7 @@ const Y = [
|
|
|
106
106
|
Uint32Array,
|
|
107
107
|
Float32Array,
|
|
108
108
|
Float64Array
|
|
109
|
-
],
|
|
109
|
+
], F = 1, S = 8;
|
|
110
110
|
class G {
|
|
111
111
|
/**
|
|
112
112
|
* Creates an index from raw `ArrayBuffer` data.
|
|
@@ -119,9 +119,9 @@ class G {
|
|
|
119
119
|
if (e !== 219)
|
|
120
120
|
throw new Error("Data does not appear to be in a KDBush format.");
|
|
121
121
|
const o = n >> 4;
|
|
122
|
-
if (o !==
|
|
123
|
-
throw new Error(`Got v${o} data when expected v${
|
|
124
|
-
const i =
|
|
122
|
+
if (o !== F)
|
|
123
|
+
throw new Error(`Got v${o} data when expected v${F}.`);
|
|
124
|
+
const i = K[n & 15];
|
|
125
125
|
if (!i)
|
|
126
126
|
throw new Error("Unrecognized array type.");
|
|
127
127
|
const [a] = new Uint16Array(t, 2, 1), [c] = new Uint32Array(t, 4, 1);
|
|
@@ -137,10 +137,10 @@ class G {
|
|
|
137
137
|
constructor(t, e = 64, n = Float64Array, o) {
|
|
138
138
|
if (isNaN(t) || t < 0) throw new Error(`Unpexpected numItems value: ${t}.`);
|
|
139
139
|
this.numItems = +t, this.nodeSize = Math.min(Math.max(+e, 2), 65535), this.ArrayType = n, this.IndexArrayType = t < 65536 ? Uint16Array : Uint32Array;
|
|
140
|
-
const i =
|
|
140
|
+
const i = K.indexOf(this.ArrayType), a = t * 2 * this.ArrayType.BYTES_PER_ELEMENT, c = t * this.IndexArrayType.BYTES_PER_ELEMENT, s = (8 - c % 8) % 8;
|
|
141
141
|
if (i < 0)
|
|
142
142
|
throw new Error(`Unexpected typed array class: ${n}.`);
|
|
143
|
-
o && o instanceof ArrayBuffer ? (this.data = o, this.ids = new this.IndexArrayType(this.data,
|
|
143
|
+
o && o instanceof ArrayBuffer ? (this.data = o, 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) + i]), new Uint16Array(this.data, 2, 1)[0] = e, new Uint32Array(this.data, 4, 1)[0] = t);
|
|
144
144
|
}
|
|
145
145
|
/**
|
|
146
146
|
* Add a point to the index.
|
|
@@ -159,7 +159,7 @@ class G {
|
|
|
159
159
|
const t = this._pos >> 1;
|
|
160
160
|
if (t !== this.numItems)
|
|
161
161
|
throw new Error(`Added ${t} items when expected ${this.numItems}.`);
|
|
162
|
-
return
|
|
162
|
+
return k(this.ids, this.coords, this.nodeSize, 0, this.numItems - 1, 0), this._finished = !0, this;
|
|
163
163
|
}
|
|
164
164
|
/**
|
|
165
165
|
* Search the index for items within a given bounding box.
|
|
@@ -171,20 +171,20 @@ class G {
|
|
|
171
171
|
*/
|
|
172
172
|
range(t, e, n, o) {
|
|
173
173
|
if (!this._finished) throw new Error("Data not yet indexed - call index.finish().");
|
|
174
|
-
const { ids: i, coords: a, nodeSize: c } = this, s = [0, i.length - 1, 0],
|
|
174
|
+
const { ids: i, coords: a, nodeSize: c } = this, s = [0, i.length - 1, 0], l = [];
|
|
175
175
|
for (; s.length; ) {
|
|
176
|
-
const
|
|
176
|
+
const h = s.pop() || 0, u = s.pop() || 0, f = s.pop() || 0;
|
|
177
177
|
if (u - f <= c) {
|
|
178
|
-
for (let
|
|
179
|
-
const m = a[2 *
|
|
180
|
-
m >= t && m <= n && M >= e && M <= o &&
|
|
178
|
+
for (let p = f; p <= u; p++) {
|
|
179
|
+
const m = a[2 * p], M = a[2 * p + 1];
|
|
180
|
+
m >= t && m <= n && M >= e && M <= o && l.push(i[p]);
|
|
181
181
|
}
|
|
182
182
|
continue;
|
|
183
183
|
}
|
|
184
184
|
const d = f + u >> 1, g = a[2 * d], y = a[2 * d + 1];
|
|
185
|
-
g >= t && g <= n && y >= e && y <= o &&
|
|
185
|
+
g >= t && g <= n && y >= e && y <= o && l.push(i[d]), (h === 0 ? t <= g : e <= y) && (s.push(f), s.push(d - 1), s.push(1 - h)), (h === 0 ? n >= g : o >= y) && (s.push(d + 1), s.push(u), s.push(1 - h));
|
|
186
186
|
}
|
|
187
|
-
return
|
|
187
|
+
return l;
|
|
188
188
|
}
|
|
189
189
|
/**
|
|
190
190
|
* Search the index for items within a given radius.
|
|
@@ -195,48 +195,48 @@ class G {
|
|
|
195
195
|
*/
|
|
196
196
|
within(t, e, n) {
|
|
197
197
|
if (!this._finished) throw new Error("Data not yet indexed - call index.finish().");
|
|
198
|
-
const { ids: o, coords: i, nodeSize: a } = this, c = [0, o.length - 1, 0], s = [],
|
|
198
|
+
const { ids: o, coords: i, nodeSize: a } = this, c = [0, o.length - 1, 0], s = [], l = n * n;
|
|
199
199
|
for (; c.length; ) {
|
|
200
|
-
const
|
|
200
|
+
const h = c.pop() || 0, u = c.pop() || 0, f = c.pop() || 0;
|
|
201
201
|
if (u - f <= a) {
|
|
202
|
-
for (let
|
|
203
|
-
|
|
202
|
+
for (let p = f; p <= u; p++)
|
|
203
|
+
q(i[2 * p], i[2 * p + 1], t, e) <= l && s.push(o[p]);
|
|
204
204
|
continue;
|
|
205
205
|
}
|
|
206
206
|
const d = f + u >> 1, g = i[2 * d], y = i[2 * d + 1];
|
|
207
|
-
|
|
207
|
+
q(g, y, t, e) <= l && s.push(o[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));
|
|
208
208
|
}
|
|
209
209
|
return s;
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
|
-
function
|
|
212
|
+
function k(r, t, e, n, o, i) {
|
|
213
213
|
if (o - n <= e) return;
|
|
214
214
|
const a = n + o >> 1;
|
|
215
|
-
|
|
215
|
+
st(r, t, a, n, o, i), k(r, t, e, n, a - 1, 1 - i), k(r, t, e, a + 1, o, 1 - i);
|
|
216
216
|
}
|
|
217
|
-
function
|
|
217
|
+
function st(r, t, e, n, o, i) {
|
|
218
218
|
for (; o > n; ) {
|
|
219
219
|
if (o - n > 600) {
|
|
220
|
-
const
|
|
221
|
-
|
|
220
|
+
const l = o - 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(o, Math.floor(e + (l - h) * f / l + d));
|
|
221
|
+
st(r, t, e, g, y, i);
|
|
222
222
|
}
|
|
223
223
|
const a = t[2 * e + i];
|
|
224
224
|
let c = n, s = o;
|
|
225
|
-
for (
|
|
226
|
-
for (
|
|
225
|
+
for (T(r, t, n, e), t[2 * o + i] > a && T(r, t, n, o); c < s; ) {
|
|
226
|
+
for (T(r, t, c, s), c++, s--; t[2 * c + i] < a; ) c++;
|
|
227
227
|
for (; t[2 * s + i] > a; ) s--;
|
|
228
228
|
}
|
|
229
|
-
t[2 * n + i] === a ?
|
|
229
|
+
t[2 * n + i] === a ? T(r, t, n, s) : (s++, T(r, t, s, o)), s <= e && (n = s + 1), e <= s && (o = s - 1);
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
|
-
function
|
|
233
|
-
|
|
232
|
+
function T(r, t, e, n) {
|
|
233
|
+
N(r, e, n), N(t, 2 * e, 2 * n), N(t, 2 * e + 1, 2 * n + 1);
|
|
234
234
|
}
|
|
235
|
-
function
|
|
235
|
+
function N(r, t, e) {
|
|
236
236
|
const n = r[t];
|
|
237
237
|
r[t] = r[e], r[e] = n;
|
|
238
238
|
}
|
|
239
|
-
function
|
|
239
|
+
function q(r, t, e, n) {
|
|
240
240
|
const o = r - e, i = t - n;
|
|
241
241
|
return o * o + i * i;
|
|
242
242
|
}
|
|
@@ -263,7 +263,7 @@ const vt = {
|
|
|
263
263
|
// properties to use for individual points when running the reducer
|
|
264
264
|
map: (r) => r
|
|
265
265
|
// props => ({sum: props.my_value})
|
|
266
|
-
},
|
|
266
|
+
}, Q = Math.fround || /* @__PURE__ */ ((r) => ((t) => (r[0] = +t, r[0])))(new Float32Array(1)), b = 2, E = 3, z = 4, A = 5, ot = 6;
|
|
267
267
|
class Ot {
|
|
268
268
|
constructor(t) {
|
|
269
269
|
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 = [];
|
|
@@ -275,9 +275,9 @@ class Ot {
|
|
|
275
275
|
e && console.time(i), this.points = t;
|
|
276
276
|
const a = [];
|
|
277
277
|
for (let s = 0; s < t.length; s++) {
|
|
278
|
-
const
|
|
279
|
-
if (!
|
|
280
|
-
const [
|
|
278
|
+
const l = t[s];
|
|
279
|
+
if (!l.geometry) continue;
|
|
280
|
+
const [h, u] = l.geometry.coordinates, f = Q(U(h)), d = Q(D(u));
|
|
281
281
|
a.push(
|
|
282
282
|
f,
|
|
283
283
|
d,
|
|
@@ -295,8 +295,8 @@ class Ot {
|
|
|
295
295
|
let c = this.trees[o + 1] = this._createTree(a);
|
|
296
296
|
e && console.timeEnd(i);
|
|
297
297
|
for (let s = o; s >= n; s--) {
|
|
298
|
-
const
|
|
299
|
-
c = this.trees[s] = this._createTree(this._cluster(c, s)), e && console.log("z%d: %d clusters in %dms", s, c.numItems, +Date.now() -
|
|
298
|
+
const l = +Date.now();
|
|
299
|
+
c = this.trees[s] = this._createTree(this._cluster(c, s)), e && console.log("z%d: %d clusters in %dms", s, c.numItems, +Date.now() - l);
|
|
300
300
|
}
|
|
301
301
|
return e && console.timeEnd("total time"), this;
|
|
302
302
|
}
|
|
@@ -311,22 +311,22 @@ class Ot {
|
|
|
311
311
|
const u = this.getClusters([n, o, 180, a], e), f = this.getClusters([-180, o, i, a], e);
|
|
312
312
|
return u.concat(f);
|
|
313
313
|
}
|
|
314
|
-
const c = this.trees[this._limitZoom(e)], s = c.range(
|
|
314
|
+
const c = this.trees[this._limitZoom(e)], s = c.range(U(n), D(a), U(i), D(o)), l = c.data, h = [];
|
|
315
315
|
for (const u of s) {
|
|
316
316
|
const f = this.stride * u;
|
|
317
|
-
|
|
317
|
+
h.push(l[f + A] > 1 ? X(l, f, this.clusterProps) : this.points[l[f + E]]);
|
|
318
318
|
}
|
|
319
|
-
return
|
|
319
|
+
return h;
|
|
320
320
|
}
|
|
321
321
|
getChildren(t) {
|
|
322
322
|
const e = this._getOriginId(t), n = this._getOriginZoom(t), o = "No cluster with the specified id.", i = this.trees[n];
|
|
323
323
|
if (!i) throw new Error(o);
|
|
324
324
|
const a = i.data;
|
|
325
325
|
if (e * this.stride >= a.length) throw new Error(o);
|
|
326
|
-
const c = this.options.radius / (this.options.extent * Math.pow(2, n - 1)), s = a[e * this.stride],
|
|
327
|
-
for (const f of
|
|
326
|
+
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 = i.within(s, l, c), u = [];
|
|
327
|
+
for (const f of h) {
|
|
328
328
|
const d = f * this.stride;
|
|
329
|
-
a[d +
|
|
329
|
+
a[d + z] === t && u.push(a[d + A] > 1 ? X(a, d, this.clusterProps) : this.points[a[d + E]]);
|
|
330
330
|
}
|
|
331
331
|
if (u.length === 0) throw new Error(o);
|
|
332
332
|
return u;
|
|
@@ -337,25 +337,25 @@ class Ot {
|
|
|
337
337
|
return this._appendLeaves(o, t, e, n, 0), o;
|
|
338
338
|
}
|
|
339
339
|
getTile(t, e, n) {
|
|
340
|
-
const o = this.trees[this._limitZoom(t)], i = Math.pow(2, t), { extent: a, radius: c } = this.options, s = c / a,
|
|
340
|
+
const o = this.trees[this._limitZoom(t)], i = Math.pow(2, t), { extent: a, radius: c } = this.options, s = c / a, l = (n - s) / i, h = (n + 1 + s) / i, u = {
|
|
341
341
|
features: []
|
|
342
342
|
};
|
|
343
343
|
return this._addTileFeatures(
|
|
344
|
-
o.range((e - s) / i,
|
|
344
|
+
o.range((e - s) / i, l, (e + 1 + s) / i, h),
|
|
345
345
|
o.data,
|
|
346
346
|
e,
|
|
347
347
|
n,
|
|
348
348
|
i,
|
|
349
349
|
u
|
|
350
350
|
), e === 0 && this._addTileFeatures(
|
|
351
|
-
o.range(1 - s / i,
|
|
351
|
+
o.range(1 - s / i, l, 1, h),
|
|
352
352
|
o.data,
|
|
353
353
|
i,
|
|
354
354
|
n,
|
|
355
355
|
i,
|
|
356
356
|
u
|
|
357
357
|
), e === i - 1 && this._addTileFeatures(
|
|
358
|
-
o.range(0,
|
|
358
|
+
o.range(0, l, s / i, h),
|
|
359
359
|
o.data,
|
|
360
360
|
-1,
|
|
361
361
|
n,
|
|
@@ -387,15 +387,15 @@ class Ot {
|
|
|
387
387
|
}
|
|
388
388
|
_addTileFeatures(t, e, n, o, i, a) {
|
|
389
389
|
for (const c of t) {
|
|
390
|
-
const s = c * this.stride,
|
|
391
|
-
let
|
|
392
|
-
if (
|
|
393
|
-
|
|
390
|
+
const s = c * this.stride, l = e[s + A] > 1;
|
|
391
|
+
let h, u, f;
|
|
392
|
+
if (l)
|
|
393
|
+
h = it(e, s, this.clusterProps), u = e[s], f = e[s + 1];
|
|
394
394
|
else {
|
|
395
|
-
const y = this.points[e[s +
|
|
396
|
-
|
|
397
|
-
const [
|
|
398
|
-
u =
|
|
395
|
+
const y = this.points[e[s + E]];
|
|
396
|
+
h = y.properties;
|
|
397
|
+
const [p, m] = y.geometry.coordinates;
|
|
398
|
+
u = U(p), f = D(m);
|
|
399
399
|
}
|
|
400
400
|
const d = {
|
|
401
401
|
type: 1,
|
|
@@ -403,50 +403,50 @@ class Ot {
|
|
|
403
403
|
Math.round(this.options.extent * (u * i - n)),
|
|
404
404
|
Math.round(this.options.extent * (f * i - o))
|
|
405
405
|
]],
|
|
406
|
-
tags:
|
|
406
|
+
tags: h
|
|
407
407
|
};
|
|
408
408
|
let g;
|
|
409
|
-
|
|
409
|
+
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);
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
412
|
_limitZoom(t) {
|
|
413
413
|
return Math.max(this.options.minZoom, Math.min(Math.floor(+t), this.options.maxZoom + 1));
|
|
414
414
|
}
|
|
415
415
|
_cluster(t, e) {
|
|
416
|
-
const { radius: n, extent: o, reduce: i, minPoints: a } = this.options, c = n / (o * Math.pow(2, e)), s = t.data,
|
|
417
|
-
for (let u = 0; u < s.length; u +=
|
|
418
|
-
if (s[u +
|
|
419
|
-
s[u +
|
|
420
|
-
const f = s[u], d = s[u + 1], g = t.within(s[u], s[u + 1], c), y = s[u +
|
|
421
|
-
let
|
|
416
|
+
const { radius: n, extent: o, reduce: i, minPoints: a } = this.options, c = n / (o * Math.pow(2, e)), s = t.data, l = [], h = this.stride;
|
|
417
|
+
for (let u = 0; u < s.length; u += h) {
|
|
418
|
+
if (s[u + b] <= e) continue;
|
|
419
|
+
s[u + b] = e;
|
|
420
|
+
const f = s[u], d = s[u + 1], g = t.within(s[u], s[u + 1], c), y = s[u + A];
|
|
421
|
+
let p = y;
|
|
422
422
|
for (const m of g) {
|
|
423
|
-
const M = m *
|
|
424
|
-
s[M +
|
|
423
|
+
const M = m * h;
|
|
424
|
+
s[M + b] > e && (p += s[M + A]);
|
|
425
425
|
}
|
|
426
|
-
if (
|
|
427
|
-
let m = f * y, M = d * y,
|
|
428
|
-
const
|
|
429
|
-
for (const
|
|
430
|
-
const
|
|
431
|
-
if (s[
|
|
432
|
-
s[
|
|
433
|
-
const
|
|
434
|
-
m += s[
|
|
426
|
+
if (p > y && p >= a) {
|
|
427
|
+
let m = f * y, M = d * y, P, $ = -1;
|
|
428
|
+
const B = ((u / h | 0) << 5) + (e + 1) + this.points.length;
|
|
429
|
+
for (const at of g) {
|
|
430
|
+
const x = at * h;
|
|
431
|
+
if (s[x + b] <= e) continue;
|
|
432
|
+
s[x + b] = e;
|
|
433
|
+
const H = s[x + A];
|
|
434
|
+
m += s[x] * H, M += s[x + 1] * H, s[x + z] = B, i && (P || (P = this._map(s, u, !0), $ = this.clusterProps.length, this.clusterProps.push(P)), i(P, this._map(s, x)));
|
|
435
435
|
}
|
|
436
|
-
s[u +
|
|
436
|
+
s[u + z] = B, l.push(m / p, M / p, 1 / 0, B, -1, p), i && l.push($);
|
|
437
437
|
} else {
|
|
438
|
-
for (let m = 0; m <
|
|
439
|
-
if (
|
|
438
|
+
for (let m = 0; m < h; m++) l.push(s[u + m]);
|
|
439
|
+
if (p > 1)
|
|
440
440
|
for (const m of g) {
|
|
441
|
-
const M = m *
|
|
442
|
-
if (!(s[M +
|
|
443
|
-
s[M +
|
|
444
|
-
for (let
|
|
441
|
+
const M = m * h;
|
|
442
|
+
if (!(s[M + b] <= e)) {
|
|
443
|
+
s[M + b] = e;
|
|
444
|
+
for (let P = 0; P < h; P++) l.push(s[M + P]);
|
|
445
445
|
}
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
448
|
}
|
|
449
|
-
return
|
|
449
|
+
return l;
|
|
450
450
|
}
|
|
451
451
|
// get index of the point from which the cluster originated
|
|
452
452
|
_getOriginId(t) {
|
|
@@ -457,38 +457,38 @@ class Ot {
|
|
|
457
457
|
return (t - this.points.length) % 32;
|
|
458
458
|
}
|
|
459
459
|
_map(t, e, n) {
|
|
460
|
-
if (t[e +
|
|
461
|
-
const a = this.clusterProps[t[e +
|
|
460
|
+
if (t[e + A] > 1) {
|
|
461
|
+
const a = this.clusterProps[t[e + ot]];
|
|
462
462
|
return n ? Object.assign({}, a) : a;
|
|
463
463
|
}
|
|
464
|
-
const o = this.points[t[e +
|
|
464
|
+
const o = this.points[t[e + E]].properties, i = this.options.map(o);
|
|
465
465
|
return n && i === o ? Object.assign({}, i) : i;
|
|
466
466
|
}
|
|
467
467
|
}
|
|
468
|
-
function
|
|
468
|
+
function X(r, t, e) {
|
|
469
469
|
return {
|
|
470
470
|
type: "Feature",
|
|
471
|
-
id: r[t +
|
|
472
|
-
properties:
|
|
471
|
+
id: r[t + E],
|
|
472
|
+
properties: it(r, t, e),
|
|
473
473
|
geometry: {
|
|
474
474
|
type: "Point",
|
|
475
475
|
coordinates: [St(r[t]), Tt(r[t + 1])]
|
|
476
476
|
}
|
|
477
477
|
};
|
|
478
478
|
}
|
|
479
|
-
function
|
|
480
|
-
const n = r[t +
|
|
479
|
+
function it(r, t, e) {
|
|
480
|
+
const n = r[t + A], o = n >= 1e4 ? `${Math.round(n / 1e3)}k` : n >= 1e3 ? `${Math.round(n / 100) / 10}k` : n, i = r[t + ot], a = i === -1 ? {} : Object.assign({}, e[i]);
|
|
481
481
|
return Object.assign(a, {
|
|
482
482
|
cluster: !0,
|
|
483
|
-
cluster_id: r[t +
|
|
483
|
+
cluster_id: r[t + E],
|
|
484
484
|
point_count: n,
|
|
485
485
|
point_count_abbreviated: o
|
|
486
486
|
});
|
|
487
487
|
}
|
|
488
|
-
function
|
|
488
|
+
function U(r) {
|
|
489
489
|
return r / 360 + 0.5;
|
|
490
490
|
}
|
|
491
|
-
function
|
|
491
|
+
function D(r) {
|
|
492
492
|
const t = Math.sin(r * Math.PI / 180), e = 0.5 - 0.25 * Math.log((1 + t) / (1 - t)) / Math.PI;
|
|
493
493
|
return e < 0 ? 0 : e > 1 ? 1 : e;
|
|
494
494
|
}
|
|
@@ -499,8 +499,8 @@ function Tt(r) {
|
|
|
499
499
|
const t = (180 - r * 360) * Math.PI / 180;
|
|
500
500
|
return 360 * Math.atan(Math.exp(t)) / Math.PI - 90;
|
|
501
501
|
}
|
|
502
|
-
var
|
|
503
|
-
function
|
|
502
|
+
var tt = Object.prototype.hasOwnProperty;
|
|
503
|
+
function et(r, t, e) {
|
|
504
504
|
for (e of r.keys())
|
|
505
505
|
if (v(e, t)) return e;
|
|
506
506
|
}
|
|
@@ -519,14 +519,14 @@ function v(r, t) {
|
|
|
519
519
|
if (r.size !== t.size)
|
|
520
520
|
return !1;
|
|
521
521
|
for (n of r)
|
|
522
|
-
if (o = n, o && typeof o == "object" && (o =
|
|
522
|
+
if (o = n, o && typeof o == "object" && (o = et(t, o), !o) || !t.has(o)) return !1;
|
|
523
523
|
return !0;
|
|
524
524
|
}
|
|
525
525
|
if (e === Map) {
|
|
526
526
|
if (r.size !== t.size)
|
|
527
527
|
return !1;
|
|
528
528
|
for (n of r)
|
|
529
|
-
if (o = n[0], o && typeof o == "object" && (o =
|
|
529
|
+
if (o = n[0], o && typeof o == "object" && (o = et(t, o), !o) || !v(n[1], t.get(o)))
|
|
530
530
|
return !1;
|
|
531
531
|
return !0;
|
|
532
532
|
}
|
|
@@ -545,152 +545,152 @@ function v(r, t) {
|
|
|
545
545
|
if (!e || typeof r == "object") {
|
|
546
546
|
n = 0;
|
|
547
547
|
for (e in r)
|
|
548
|
-
if (
|
|
548
|
+
if (tt.call(r, e) && ++n && !tt.call(t, e) || !(e in t) || !v(r[e], t[e])) return !1;
|
|
549
549
|
return Object.keys(t).length === n;
|
|
550
550
|
}
|
|
551
551
|
}
|
|
552
552
|
return r !== r && t !== t;
|
|
553
553
|
}
|
|
554
|
-
function
|
|
555
|
-
var t =
|
|
556
|
-
return v(r, t.current) || (t.current = r, e.current += 1),
|
|
554
|
+
function Ct(r) {
|
|
555
|
+
var t = Z.useRef(r), e = Z.useRef(0);
|
|
556
|
+
return v(r, t.current) || (t.current = r, e.current += 1), Z.useMemo(function() {
|
|
557
557
|
return t.current;
|
|
558
558
|
}, [e.current]);
|
|
559
559
|
}
|
|
560
|
-
function
|
|
561
|
-
return
|
|
560
|
+
function Lt(r, t) {
|
|
561
|
+
return Z.useEffect(r, Ct(t));
|
|
562
562
|
}
|
|
563
|
-
var
|
|
564
|
-
var e = t.points, n = t.bounds, o = t.zoom, i = t.options, a = t.disableRefresh, c =
|
|
565
|
-
return
|
|
563
|
+
var Rt = function(t) {
|
|
564
|
+
var e = t.points, n = t.bounds, o = t.zoom, i = t.options, a = t.disableRefresh, c = j(), s = j(), l = L([]), h = l[0], u = l[1], f = Math.round(o);
|
|
565
|
+
return Lt(function() {
|
|
566
566
|
a !== !0 && ((!c.current || !v(s.current, e) || !v(c.current.options, i)) && (c.current = new Ot(i), c.current.load(e)), n && u(c.current.getClusters(n, f)), s.current = e);
|
|
567
567
|
}, [e, n, f, i, a]), {
|
|
568
|
-
clusters:
|
|
568
|
+
clusters: h,
|
|
569
569
|
supercluster: c.current
|
|
570
570
|
};
|
|
571
571
|
};
|
|
572
|
-
const
|
|
573
|
-
function
|
|
574
|
-
const { mapProvider: o, activeMarker: i, zoom: a, setMarkerPoints: c, setClusterPoints: s } =
|
|
575
|
-
|
|
572
|
+
const It = w(() => import("./index-Deqck8KU.js")), Ut = w(() => import("./index-CFioISlP.js")), Dt = w(() => import("./index-CyFpPXRS.js"));
|
|
573
|
+
function Zt({ isLoading: r, markers: t, onClick: e, ...n }) {
|
|
574
|
+
const { mapProvider: o, activeMarker: i, zoom: a, setMarkerPoints: c, setClusterPoints: s } = I();
|
|
575
|
+
V(() => {
|
|
576
576
|
if (r)
|
|
577
577
|
return;
|
|
578
|
-
const
|
|
579
|
-
c(
|
|
578
|
+
const p = (t || []).map((m) => [m.longitude, m.latitude]);
|
|
579
|
+
c(p);
|
|
580
580
|
}, [t, c]);
|
|
581
|
-
const
|
|
581
|
+
const l = O(
|
|
582
582
|
() => ({
|
|
583
|
-
points: t.map((
|
|
583
|
+
points: t.map((p) => bt([p.longitude, p.latitude], p)),
|
|
584
584
|
// Using world bounds to avoid issues with markers near the edges of the map
|
|
585
|
-
bounds:
|
|
585
|
+
bounds: dt,
|
|
586
586
|
zoom: a,
|
|
587
587
|
options: {
|
|
588
|
-
radius: o.name === "google" && a >
|
|
589
|
-
minZoom:
|
|
588
|
+
radius: o.name === "google" && a > W ? ft : ht,
|
|
589
|
+
minZoom: W,
|
|
590
590
|
maxZoom: pt
|
|
591
591
|
}
|
|
592
592
|
}),
|
|
593
593
|
[t, o, a]
|
|
594
|
-
), { clusters:
|
|
595
|
-
|
|
596
|
-
const
|
|
597
|
-
|
|
594
|
+
), { clusters: h, supercluster: u } = Rt(l), f = j("");
|
|
595
|
+
V(() => {
|
|
596
|
+
const p = JSON.stringify(
|
|
597
|
+
h.map((m) => ({
|
|
598
598
|
coords: m.geometry.coordinates,
|
|
599
599
|
props: m.properties
|
|
600
600
|
}))
|
|
601
601
|
);
|
|
602
|
-
|
|
603
|
-
}, [
|
|
604
|
-
const d = (
|
|
605
|
-
if (!("properties" in
|
|
602
|
+
p !== f.current && (s(h), f.current = p);
|
|
603
|
+
}, [h, s]);
|
|
604
|
+
const d = (p) => {
|
|
605
|
+
if (!("properties" in p))
|
|
606
606
|
throw new Error("Cluster does not have properties");
|
|
607
|
-
if (
|
|
607
|
+
if (p.properties?.cluster && typeof p.properties?.cluster_id == "number") {
|
|
608
608
|
e?.({
|
|
609
|
-
id: `${
|
|
610
|
-
latitude:
|
|
611
|
-
longitude:
|
|
612
|
-
markers: u?.getLeaves(
|
|
609
|
+
id: `${p.properties.cluster_id}`,
|
|
610
|
+
latitude: p.geometry.coordinates[1],
|
|
611
|
+
longitude: p.geometry.coordinates[0],
|
|
612
|
+
markers: u?.getLeaves(p.properties.cluster_id)?.map((m) => m.properties) ?? []
|
|
613
613
|
});
|
|
614
614
|
return;
|
|
615
615
|
}
|
|
616
616
|
e?.({
|
|
617
|
-
id:
|
|
618
|
-
latitude:
|
|
619
|
-
longitude:
|
|
620
|
-
markers: [
|
|
617
|
+
id: p.properties.id,
|
|
618
|
+
latitude: p.properties.latitude,
|
|
619
|
+
longitude: p.properties.longitude,
|
|
620
|
+
markers: [p.properties]
|
|
621
621
|
});
|
|
622
|
-
}, g = (
|
|
622
|
+
}, g = (p) => {
|
|
623
623
|
if (!u || !i) return !1;
|
|
624
|
-
if (i.id === `${
|
|
624
|
+
if (i.id === `${p}`)
|
|
625
625
|
return !0;
|
|
626
626
|
try {
|
|
627
|
-
return u.getLeaves(
|
|
627
|
+
return u.getLeaves(p)?.find((m) => m.properties.id === i.id) !== void 0;
|
|
628
628
|
} catch {
|
|
629
629
|
return !1;
|
|
630
630
|
}
|
|
631
|
-
}, y =
|
|
631
|
+
}, y = O(() => {
|
|
632
632
|
switch (o?.name) {
|
|
633
633
|
case "maptiler":
|
|
634
|
-
return Rt;
|
|
635
|
-
case "google":
|
|
636
634
|
return It;
|
|
637
|
-
case "
|
|
635
|
+
case "google":
|
|
638
636
|
return Ut;
|
|
637
|
+
case "mapbox":
|
|
638
|
+
return Dt;
|
|
639
639
|
default:
|
|
640
640
|
return null;
|
|
641
641
|
}
|
|
642
642
|
}, [o]);
|
|
643
|
-
return y ? /* @__PURE__ */
|
|
643
|
+
return y ? /* @__PURE__ */ _(R, { fallback: null, children: /* @__PURE__ */ _(
|
|
644
644
|
y,
|
|
645
645
|
{
|
|
646
|
-
clusters:
|
|
646
|
+
clusters: h,
|
|
647
647
|
onClick: d,
|
|
648
648
|
doesSuperclusterContainActiveMarker: g,
|
|
649
649
|
...n
|
|
650
650
|
}
|
|
651
|
-
) : null;
|
|
651
|
+
) }) : null;
|
|
652
652
|
}
|
|
653
|
-
const
|
|
654
|
-
function
|
|
655
|
-
const { mapProvider: n } =
|
|
653
|
+
const Bt = w(() => import("./index-zqYpD_YN.js")), Ft = w(() => import("./index-CzqD82Cl.js")), Nt = w(() => import("./index-VFglx6lb.js"));
|
|
654
|
+
function zt({ children: r, anchor: t = "bottom", ...e }) {
|
|
655
|
+
const { mapProvider: n } = I(), o = O(() => {
|
|
656
656
|
switch (n?.name) {
|
|
657
657
|
case "maptiler":
|
|
658
|
-
return Zt;
|
|
659
|
-
case "google":
|
|
660
658
|
return Bt;
|
|
661
|
-
case "
|
|
659
|
+
case "google":
|
|
662
660
|
return Ft;
|
|
661
|
+
case "mapbox":
|
|
662
|
+
return Nt;
|
|
663
663
|
default:
|
|
664
664
|
return null;
|
|
665
665
|
}
|
|
666
666
|
}, [n]);
|
|
667
|
-
return o ? /* @__PURE__ */
|
|
667
|
+
return o ? /* @__PURE__ */ _(R, { fallback: null, children: /* @__PURE__ */ _(o, { ...e, anchor: t, children: r }) }) : null;
|
|
668
668
|
}
|
|
669
|
-
const
|
|
669
|
+
const jt = w(() => import("./index-DKy2opdk.js")), kt = w(() => import("./index-k9UFzKZZ.js")), Gt = w(() => import("./index-D8-yY6UK.js"));
|
|
670
670
|
function $t(r) {
|
|
671
|
-
const { mapProvider: t } =
|
|
671
|
+
const { mapProvider: t } = I(), e = O(() => {
|
|
672
672
|
switch (t?.name) {
|
|
673
673
|
case "maptiler":
|
|
674
|
-
return zt;
|
|
675
|
-
case "google":
|
|
676
674
|
return jt;
|
|
675
|
+
case "google":
|
|
676
|
+
return kt;
|
|
677
677
|
case "mapbox":
|
|
678
678
|
return Gt;
|
|
679
679
|
default:
|
|
680
680
|
return null;
|
|
681
681
|
}
|
|
682
682
|
}, [t]);
|
|
683
|
-
return e ? /* @__PURE__ */
|
|
683
|
+
return e ? /* @__PURE__ */ _(R, { fallback: null, children: /* @__PURE__ */ _(e, { ...r }) }) : null;
|
|
684
684
|
}
|
|
685
|
-
function
|
|
685
|
+
function Ht(r) {
|
|
686
686
|
const [t, e] = L([]), [n, o] = L([]), [i, a] = L(r.zoom || C.zoom);
|
|
687
|
-
return /* @__PURE__ */
|
|
688
|
-
|
|
687
|
+
return /* @__PURE__ */ _(
|
|
688
|
+
nt.Provider,
|
|
689
689
|
{
|
|
690
690
|
value: {
|
|
691
691
|
...r,
|
|
692
692
|
locale: r.locale || "en",
|
|
693
|
-
mapPadding: r.mapPadding ||
|
|
693
|
+
mapPadding: r.mapPadding || lt,
|
|
694
694
|
locationBoundary: r.locationBoundary ? r.locationBoundary : [[r.center.longitude, r.center.latitude]],
|
|
695
695
|
markerPoints: t,
|
|
696
696
|
setMarkerPoints: e,
|
|
@@ -703,23 +703,23 @@ function kt(r) {
|
|
|
703
703
|
}
|
|
704
704
|
);
|
|
705
705
|
}
|
|
706
|
-
const
|
|
706
|
+
const qt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
707
707
|
__proto__: null,
|
|
708
|
-
BaseMap:
|
|
709
|
-
CenterPin:
|
|
708
|
+
BaseMap: _t,
|
|
709
|
+
CenterPin: xt,
|
|
710
710
|
Layers: $t,
|
|
711
|
-
Markers:
|
|
712
|
-
Popup:
|
|
713
|
-
Root:
|
|
711
|
+
Markers: Zt,
|
|
712
|
+
Popup: zt,
|
|
713
|
+
Root: Ht
|
|
714
714
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
715
715
|
export {
|
|
716
716
|
C as D,
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
717
|
+
Wt as M,
|
|
718
|
+
Yt as P,
|
|
719
|
+
dt as W,
|
|
720
|
+
J as a,
|
|
721
|
+
lt as b,
|
|
722
|
+
qt as i,
|
|
723
|
+
Kt as m,
|
|
724
|
+
I as u
|
|
725
725
|
};
|