@local-logic/maps 0.0.7 → 0.0.9
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-D0VvNlqV.js → index-92HhWupr.js} +1 -1
- package/dist/{index-CIUYCbof.js → index-BF2kb4Y-.js} +1 -1
- package/dist/{index-FSH3b4mt.js → index-C5-_i-6M.js} +1 -1
- package/dist/{index-CwZ22Kq_.js → index-CY0to_1B.js} +200 -200
- package/dist/{index-7D9tjwUD.js → index-ChwN5abO.js} +1 -1
- package/dist/{index-CSXMNubL.js → index-CrIFr9oc.js} +1 -1
- package/dist/{index-C7t1isWh.js → index-D5-2anzJ.js} +1 -1
- package/dist/index.es.js +1 -1
- package/dist/index.umd.js +10 -10
- package/dist/src/components/Map/Root/BaseMap/Mapbox/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/BaseMap/Maptiler/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/BaseMap/index.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { jsx as x, Fragment as
|
|
1
|
+
import { jsx as x, Fragment as st } from "react/jsx-runtime";
|
|
2
2
|
import * as F from "react";
|
|
3
|
-
import
|
|
4
|
-
const
|
|
3
|
+
import ot, { useContext as it, lazy as w, useMemo as L, useRef as G, useState as Q } from "react";
|
|
4
|
+
const X = ot.createContext(
|
|
5
5
|
{}
|
|
6
|
-
), R = () =>
|
|
6
|
+
), R = () => it(X), S = {
|
|
7
7
|
zoom: 16,
|
|
8
8
|
pitch: 0,
|
|
9
9
|
bearing: 0,
|
|
10
10
|
cooperativeGestures: !1
|
|
11
|
-
},
|
|
11
|
+
}, V = {
|
|
12
12
|
maptiler: "600d69cb-288d-445e-9839-3dfe4d76b31a",
|
|
13
13
|
mapbox: "locallogic/cmb9nz9kb011501ru8drq8fqf",
|
|
14
14
|
google: "a7ff20eb973126bb"
|
|
15
|
-
},
|
|
15
|
+
}, at = "w-full h-full relative overflow-hidden", ct = w(() => import("./index-BF2kb4Y-.js")), ut = w(() => import("./index-C5-_i-6M.js")), ht = w(() => import("./index-CrIFr9oc.js")), pt = w(() => import("./index-qqbvBkdn.js")), lt = ({ children: r }) => {
|
|
16
16
|
const {
|
|
17
17
|
mapProvider: t,
|
|
18
18
|
center: e,
|
|
19
|
-
zoom:
|
|
19
|
+
zoom: n = S.zoom,
|
|
20
20
|
pitch: o = S.pitch,
|
|
21
21
|
bearing: i = S.bearing,
|
|
22
22
|
cooperativeGestures: a = S.cooperativeGestures,
|
|
@@ -24,55 +24,55 @@ const Q = st.createContext(
|
|
|
24
24
|
} = R(), s = L(() => {
|
|
25
25
|
switch (t == null ? void 0 : t.name) {
|
|
26
26
|
case "maptiler":
|
|
27
|
-
return at;
|
|
28
|
-
case "google":
|
|
29
27
|
return ct;
|
|
30
|
-
case "
|
|
28
|
+
case "google":
|
|
31
29
|
return ut;
|
|
32
|
-
|
|
30
|
+
case "mapbox":
|
|
33
31
|
return ht;
|
|
32
|
+
default:
|
|
33
|
+
return pt;
|
|
34
34
|
}
|
|
35
35
|
}, [t]);
|
|
36
36
|
return /* @__PURE__ */ x(
|
|
37
37
|
"div",
|
|
38
38
|
{
|
|
39
|
-
className:
|
|
39
|
+
className: at,
|
|
40
40
|
"data-testid": "base-map",
|
|
41
41
|
"data-map-provider-name": t == null ? void 0 : t.name,
|
|
42
|
-
"data-map-provider-theme": t == null ? void 0 : t.theme,
|
|
43
|
-
"data-zoom":
|
|
42
|
+
"data-map-provider-theme": (t == null ? void 0 : t.theme) || V[t == null ? void 0 : t.name] || V.maptiler,
|
|
43
|
+
"data-zoom": n,
|
|
44
44
|
"data-pitch": o,
|
|
45
45
|
"data-bearing": i,
|
|
46
46
|
"data-cooperative-gestures": a,
|
|
47
47
|
"data-zoom-position": u,
|
|
48
48
|
"data-center-latitude": e.latitude,
|
|
49
49
|
"data-center-longitude": e.longitude,
|
|
50
|
-
children: /* @__PURE__ */ x(s, { children:
|
|
50
|
+
children: /* @__PURE__ */ x(s, { children: r })
|
|
51
51
|
}
|
|
52
52
|
);
|
|
53
53
|
};
|
|
54
|
-
function
|
|
55
|
-
const
|
|
56
|
-
return (e.id === 0 || e.id) && (
|
|
54
|
+
function ft(r, t, e = {}) {
|
|
55
|
+
const n = { type: "Feature" };
|
|
56
|
+
return (e.id === 0 || e.id) && (n.id = e.id), e.bbox && (n.bbox = e.bbox), n.properties = t || {}, n.geometry = r, n;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
59
|
-
if (!
|
|
58
|
+
function dt(r, t, e = {}) {
|
|
59
|
+
if (!r)
|
|
60
60
|
throw new Error("coordinates is required");
|
|
61
|
-
if (!Array.isArray(
|
|
61
|
+
if (!Array.isArray(r))
|
|
62
62
|
throw new Error("coordinates must be an Array");
|
|
63
|
-
if (
|
|
63
|
+
if (r.length < 2)
|
|
64
64
|
throw new Error("coordinates must be at least 2 numbers long");
|
|
65
|
-
if (!
|
|
65
|
+
if (!k(r[0]) || !k(r[1]))
|
|
66
66
|
throw new Error("coordinates must contain numbers");
|
|
67
|
-
return
|
|
67
|
+
return ft({
|
|
68
68
|
type: "Point",
|
|
69
|
-
coordinates:
|
|
69
|
+
coordinates: r
|
|
70
70
|
}, t, e);
|
|
71
71
|
}
|
|
72
|
-
function
|
|
73
|
-
return !isNaN(
|
|
72
|
+
function k(r) {
|
|
73
|
+
return !isNaN(r) && r !== null && !Array.isArray(r);
|
|
74
74
|
}
|
|
75
|
-
const
|
|
75
|
+
const H = [
|
|
76
76
|
Int8Array,
|
|
77
77
|
Uint8Array,
|
|
78
78
|
Uint8ClampedArray,
|
|
@@ -91,13 +91,13 @@ class D {
|
|
|
91
91
|
static from(t) {
|
|
92
92
|
if (!(t instanceof ArrayBuffer))
|
|
93
93
|
throw new Error("Data must be an instance of ArrayBuffer.");
|
|
94
|
-
const [e,
|
|
94
|
+
const [e, n] = new Uint8Array(t, 0, 2);
|
|
95
95
|
if (e !== 219)
|
|
96
96
|
throw new Error("Data does not appear to be in a KDBush format.");
|
|
97
|
-
const o =
|
|
97
|
+
const o = n >> 4;
|
|
98
98
|
if (o !== C)
|
|
99
99
|
throw new Error(`Got v${o} data when expected v${C}.`);
|
|
100
|
-
const i =
|
|
100
|
+
const i = H[n & 15];
|
|
101
101
|
if (!i)
|
|
102
102
|
throw new Error("Unrecognized array type.");
|
|
103
103
|
const [a] = new Uint16Array(t, 2, 1), [u] = new Uint32Array(t, 4, 1);
|
|
@@ -110,12 +110,12 @@ class D {
|
|
|
110
110
|
* @param {TypedArrayConstructor} [ArrayType=Float64Array] The array type used for coordinates storage (`Float64Array` by default).
|
|
111
111
|
* @param {ArrayBuffer} [data] (For internal use only)
|
|
112
112
|
*/
|
|
113
|
-
constructor(t, e = 64,
|
|
113
|
+
constructor(t, e = 64, n = Float64Array, o) {
|
|
114
114
|
if (isNaN(t) || t < 0) throw new Error(`Unpexpected numItems value: ${t}.`);
|
|
115
|
-
this.numItems = +t, this.nodeSize = Math.min(Math.max(+e, 2), 65535), this.ArrayType =
|
|
116
|
-
const i =
|
|
115
|
+
this.numItems = +t, this.nodeSize = Math.min(Math.max(+e, 2), 65535), this.ArrayType = n, this.IndexArrayType = t < 65536 ? Uint16Array : Uint32Array;
|
|
116
|
+
const i = H.indexOf(this.ArrayType), a = t * 2 * this.ArrayType.BYTES_PER_ELEMENT, u = t * this.IndexArrayType.BYTES_PER_ELEMENT, s = (8 - u % 8) % 8;
|
|
117
117
|
if (i < 0)
|
|
118
|
-
throw new Error(`Unexpected typed array class: ${
|
|
118
|
+
throw new Error(`Unexpected typed array class: ${n}.`);
|
|
119
119
|
o && o instanceof ArrayBuffer ? (this.data = o, this.ids = new this.IndexArrayType(this.data, O, t), this.coords = new this.ArrayType(this.data, O + u + s, t * 2), this._pos = t * 2, this._finished = !0) : (this.data = new ArrayBuffer(O + a + u + s), this.ids = new this.IndexArrayType(this.data, O, t), this.coords = new this.ArrayType(this.data, O + u + s, t * 2), this._pos = 0, this._finished = !1, new Uint8Array(this.data, 0, 2).set([219, (C << 4) + i]), new Uint16Array(this.data, 2, 1)[0] = e, new Uint32Array(this.data, 4, 1)[0] = t);
|
|
120
120
|
}
|
|
121
121
|
/**
|
|
@@ -125,8 +125,8 @@ class D {
|
|
|
125
125
|
* @returns {number} An incremental index associated with the added item (starting from `0`).
|
|
126
126
|
*/
|
|
127
127
|
add(t, e) {
|
|
128
|
-
const
|
|
129
|
-
return this.ids[
|
|
128
|
+
const n = this._pos >> 1;
|
|
129
|
+
return this.ids[n] = n, this.coords[this._pos++] = t, this.coords[this._pos++] = e, n;
|
|
130
130
|
}
|
|
131
131
|
/**
|
|
132
132
|
* Perform indexing of the added points.
|
|
@@ -145,7 +145,7 @@ class D {
|
|
|
145
145
|
* @param {number} maxY
|
|
146
146
|
* @returns {number[]} An array of indices correponding to the found items.
|
|
147
147
|
*/
|
|
148
|
-
range(t, e,
|
|
148
|
+
range(t, e, n, o) {
|
|
149
149
|
if (!this._finished) throw new Error("Data not yet indexed - call index.finish().");
|
|
150
150
|
const { ids: i, coords: a, nodeSize: u } = this, s = [0, i.length - 1, 0], c = [];
|
|
151
151
|
for (; s.length; ) {
|
|
@@ -153,12 +153,12 @@ class D {
|
|
|
153
153
|
if (h - l <= u) {
|
|
154
154
|
for (let d = l; d <= h; d++) {
|
|
155
155
|
const y = a[2 * d], M = a[2 * d + 1];
|
|
156
|
-
y >= t && y <=
|
|
156
|
+
y >= t && y <= n && M >= e && M <= o && c.push(i[d]);
|
|
157
157
|
}
|
|
158
158
|
continue;
|
|
159
159
|
}
|
|
160
160
|
const f = l + h >> 1, g = a[2 * f], m = a[2 * f + 1];
|
|
161
|
-
g >= t && g <=
|
|
161
|
+
g >= t && g <= n && m >= e && m <= o && c.push(i[f]), (p === 0 ? t <= g : e <= m) && (s.push(l), s.push(f - 1), s.push(1 - p)), (p === 0 ? n >= g : o >= m) && (s.push(f + 1), s.push(h), s.push(1 - p));
|
|
162
162
|
}
|
|
163
163
|
return c;
|
|
164
164
|
}
|
|
@@ -169,54 +169,54 @@ class D {
|
|
|
169
169
|
* @param {number} r Query radius.
|
|
170
170
|
* @returns {number[]} An array of indices correponding to the found items.
|
|
171
171
|
*/
|
|
172
|
-
within(t, e,
|
|
172
|
+
within(t, e, n) {
|
|
173
173
|
if (!this._finished) throw new Error("Data not yet indexed - call index.finish().");
|
|
174
|
-
const { ids: o, coords: i, nodeSize: a } = this, u = [0, o.length - 1, 0], s = [], c =
|
|
174
|
+
const { ids: o, coords: i, nodeSize: a } = this, u = [0, o.length - 1, 0], s = [], c = n * n;
|
|
175
175
|
for (; u.length; ) {
|
|
176
176
|
const p = u.pop() || 0, h = u.pop() || 0, l = u.pop() || 0;
|
|
177
177
|
if (h - l <= a) {
|
|
178
178
|
for (let d = l; d <= h; d++)
|
|
179
|
-
|
|
179
|
+
J(i[2 * d], i[2 * d + 1], t, e) <= c && s.push(o[d]);
|
|
180
180
|
continue;
|
|
181
181
|
}
|
|
182
182
|
const f = l + h >> 1, g = i[2 * f], m = i[2 * f + 1];
|
|
183
|
-
|
|
183
|
+
J(g, m, t, e) <= c && s.push(o[f]), (p === 0 ? t - n <= g : e - n <= m) && (u.push(l), u.push(f - 1), u.push(1 - p)), (p === 0 ? t + n >= g : e + n >= m) && (u.push(f + 1), u.push(h), u.push(1 - p));
|
|
184
184
|
}
|
|
185
185
|
return s;
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
function j(
|
|
189
|
-
if (o -
|
|
190
|
-
const a =
|
|
191
|
-
|
|
188
|
+
function j(r, t, e, n, o, i) {
|
|
189
|
+
if (o - n <= e) return;
|
|
190
|
+
const a = n + o >> 1;
|
|
191
|
+
tt(r, t, a, n, o, i), j(r, t, e, n, a - 1, 1 - i), j(r, t, e, a + 1, o, 1 - i);
|
|
192
192
|
}
|
|
193
|
-
function
|
|
194
|
-
for (; o >
|
|
195
|
-
if (o -
|
|
196
|
-
const c = o -
|
|
197
|
-
|
|
193
|
+
function tt(r, t, e, n, o, i) {
|
|
194
|
+
for (; o > n; ) {
|
|
195
|
+
if (o - n > 600) {
|
|
196
|
+
const c = o - n + 1, p = e - n + 1, h = Math.log(c), l = 0.5 * Math.exp(2 * h / 3), f = 0.5 * Math.sqrt(h * l * (c - l) / c) * (p - c / 2 < 0 ? -1 : 1), g = Math.max(n, Math.floor(e - p * l / c + f)), m = Math.min(o, Math.floor(e + (c - p) * l / c + f));
|
|
197
|
+
tt(r, t, e, g, m, i);
|
|
198
198
|
}
|
|
199
199
|
const a = t[2 * e + i];
|
|
200
|
-
let u =
|
|
201
|
-
for (P(
|
|
202
|
-
for (P(
|
|
200
|
+
let u = n, s = o;
|
|
201
|
+
for (P(r, t, n, e), t[2 * o + i] > a && P(r, t, n, o); u < s; ) {
|
|
202
|
+
for (P(r, t, u, s), u++, s--; t[2 * u + i] < a; ) u++;
|
|
203
203
|
for (; t[2 * s + i] > a; ) s--;
|
|
204
204
|
}
|
|
205
|
-
t[2 *
|
|
205
|
+
t[2 * n + i] === a ? P(r, t, n, s) : (s++, P(r, t, s, o)), s <= e && (n = s + 1), e <= s && (o = s - 1);
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
-
function P(
|
|
209
|
-
U(
|
|
208
|
+
function P(r, t, e, n) {
|
|
209
|
+
U(r, e, n), U(t, 2 * e, 2 * n), U(t, 2 * e + 1, 2 * n + 1);
|
|
210
210
|
}
|
|
211
|
-
function U(
|
|
212
|
-
const
|
|
213
|
-
|
|
211
|
+
function U(r, t, e) {
|
|
212
|
+
const n = r[t];
|
|
213
|
+
r[t] = r[e], r[e] = n;
|
|
214
214
|
}
|
|
215
|
-
function
|
|
216
|
-
const o =
|
|
215
|
+
function J(r, t, e, n) {
|
|
216
|
+
const o = r - e, i = t - n;
|
|
217
217
|
return o * o + i * i;
|
|
218
218
|
}
|
|
219
|
-
const
|
|
219
|
+
const gt = {
|
|
220
220
|
minZoom: 0,
|
|
221
221
|
// min zoom to generate clusters on
|
|
222
222
|
maxZoom: 16,
|
|
@@ -237,15 +237,15 @@ const dt = {
|
|
|
237
237
|
reduce: null,
|
|
238
238
|
// (accumulated, props) => { accumulated.sum += props.sum; }
|
|
239
239
|
// properties to use for individual points when running the reducer
|
|
240
|
-
map: (
|
|
240
|
+
map: (r) => r
|
|
241
241
|
// props => ({sum: props.my_value})
|
|
242
|
-
},
|
|
243
|
-
class
|
|
242
|
+
}, K = Math.fround || /* @__PURE__ */ ((r) => (t) => (r[0] = +t, r[0]))(new Float32Array(1)), T = 2, E = 3, z = 4, A = 5, et = 6;
|
|
243
|
+
class mt {
|
|
244
244
|
constructor(t) {
|
|
245
|
-
this.options = Object.assign(Object.create(
|
|
245
|
+
this.options = Object.assign(Object.create(gt), t), this.trees = new Array(this.options.maxZoom + 1), this.stride = this.options.reduce ? 7 : 6, this.clusterProps = [];
|
|
246
246
|
}
|
|
247
247
|
load(t) {
|
|
248
|
-
const { log: e, minZoom:
|
|
248
|
+
const { log: e, minZoom: n, maxZoom: o } = this.options;
|
|
249
249
|
e && console.time("total time");
|
|
250
250
|
const i = `prepare ${t.length} points`;
|
|
251
251
|
e && console.time(i), this.points = t;
|
|
@@ -253,7 +253,7 @@ class gt {
|
|
|
253
253
|
for (let s = 0; s < t.length; s++) {
|
|
254
254
|
const c = t[s];
|
|
255
255
|
if (!c.geometry) continue;
|
|
256
|
-
const [p, h] = c.geometry.coordinates, l =
|
|
256
|
+
const [p, h] = c.geometry.coordinates, l = K(I(p)), f = K(B(h));
|
|
257
257
|
a.push(
|
|
258
258
|
l,
|
|
259
259
|
f,
|
|
@@ -270,71 +270,71 @@ class gt {
|
|
|
270
270
|
}
|
|
271
271
|
let u = this.trees[o + 1] = this._createTree(a);
|
|
272
272
|
e && console.timeEnd(i);
|
|
273
|
-
for (let s = o; s >=
|
|
273
|
+
for (let s = o; s >= n; s--) {
|
|
274
274
|
const c = +Date.now();
|
|
275
275
|
u = this.trees[s] = this._createTree(this._cluster(u, s)), e && console.log("z%d: %d clusters in %dms", s, u.numItems, +Date.now() - c);
|
|
276
276
|
}
|
|
277
277
|
return e && console.timeEnd("total time"), this;
|
|
278
278
|
}
|
|
279
279
|
getClusters(t, e) {
|
|
280
|
-
let
|
|
280
|
+
let n = ((t[0] + 180) % 360 + 360) % 360 - 180;
|
|
281
281
|
const o = Math.max(-90, Math.min(90, t[1]));
|
|
282
282
|
let i = t[2] === 180 ? 180 : ((t[2] + 180) % 360 + 360) % 360 - 180;
|
|
283
283
|
const a = Math.max(-90, Math.min(90, t[3]));
|
|
284
284
|
if (t[2] - t[0] >= 360)
|
|
285
|
-
|
|
286
|
-
else if (
|
|
287
|
-
const h = this.getClusters([
|
|
285
|
+
n = -180, i = 180;
|
|
286
|
+
else if (n > i) {
|
|
287
|
+
const h = this.getClusters([n, o, 180, a], e), l = this.getClusters([-180, o, i, a], e);
|
|
288
288
|
return h.concat(l);
|
|
289
289
|
}
|
|
290
|
-
const u = this.trees[this._limitZoom(e)], s = u.range(I(
|
|
290
|
+
const u = this.trees[this._limitZoom(e)], s = u.range(I(n), B(a), I(i), B(o)), c = u.data, p = [];
|
|
291
291
|
for (const h of s) {
|
|
292
292
|
const l = this.stride * h;
|
|
293
|
-
p.push(c[l + A] > 1 ?
|
|
293
|
+
p.push(c[l + A] > 1 ? W(c, l, this.clusterProps) : this.points[c[l + E]]);
|
|
294
294
|
}
|
|
295
295
|
return p;
|
|
296
296
|
}
|
|
297
297
|
getChildren(t) {
|
|
298
|
-
const e = this._getOriginId(t),
|
|
298
|
+
const e = this._getOriginId(t), n = this._getOriginZoom(t), o = "No cluster with the specified id.", i = this.trees[n];
|
|
299
299
|
if (!i) throw new Error(o);
|
|
300
300
|
const a = i.data;
|
|
301
301
|
if (e * this.stride >= a.length) throw new Error(o);
|
|
302
|
-
const u = this.options.radius / (this.options.extent * Math.pow(2,
|
|
302
|
+
const u = this.options.radius / (this.options.extent * Math.pow(2, n - 1)), s = a[e * this.stride], c = a[e * this.stride + 1], p = i.within(s, c, u), h = [];
|
|
303
303
|
for (const l of p) {
|
|
304
304
|
const f = l * this.stride;
|
|
305
|
-
a[f + z] === t && h.push(a[f + A] > 1 ?
|
|
305
|
+
a[f + z] === t && h.push(a[f + A] > 1 ? W(a, f, this.clusterProps) : this.points[a[f + E]]);
|
|
306
306
|
}
|
|
307
307
|
if (h.length === 0) throw new Error(o);
|
|
308
308
|
return h;
|
|
309
309
|
}
|
|
310
|
-
getLeaves(t, e,
|
|
311
|
-
e = e || 10,
|
|
310
|
+
getLeaves(t, e, n) {
|
|
311
|
+
e = e || 10, n = n || 0;
|
|
312
312
|
const o = [];
|
|
313
|
-
return this._appendLeaves(o, t, e,
|
|
313
|
+
return this._appendLeaves(o, t, e, n, 0), o;
|
|
314
314
|
}
|
|
315
|
-
getTile(t, e,
|
|
316
|
-
const o = this.trees[this._limitZoom(t)], i = Math.pow(2, t), { extent: a, radius: u } = this.options, s = u / a, c = (
|
|
315
|
+
getTile(t, e, n) {
|
|
316
|
+
const o = this.trees[this._limitZoom(t)], i = Math.pow(2, t), { extent: a, radius: u } = this.options, s = u / a, c = (n - s) / i, p = (n + 1 + s) / i, h = {
|
|
317
317
|
features: []
|
|
318
318
|
};
|
|
319
319
|
return this._addTileFeatures(
|
|
320
320
|
o.range((e - s) / i, c, (e + 1 + s) / i, p),
|
|
321
321
|
o.data,
|
|
322
322
|
e,
|
|
323
|
-
|
|
323
|
+
n,
|
|
324
324
|
i,
|
|
325
325
|
h
|
|
326
326
|
), e === 0 && this._addTileFeatures(
|
|
327
327
|
o.range(1 - s / i, c, 1, p),
|
|
328
328
|
o.data,
|
|
329
329
|
i,
|
|
330
|
-
|
|
330
|
+
n,
|
|
331
331
|
i,
|
|
332
332
|
h
|
|
333
333
|
), e === i - 1 && this._addTileFeatures(
|
|
334
334
|
o.range(0, c, s / i, p),
|
|
335
335
|
o.data,
|
|
336
336
|
-1,
|
|
337
|
-
|
|
337
|
+
n,
|
|
338
338
|
i,
|
|
339
339
|
h
|
|
340
340
|
), h.features.length ? h : null;
|
|
@@ -342,31 +342,31 @@ class gt {
|
|
|
342
342
|
getClusterExpansionZoom(t) {
|
|
343
343
|
let e = this._getOriginZoom(t) - 1;
|
|
344
344
|
for (; e <= this.options.maxZoom; ) {
|
|
345
|
-
const
|
|
346
|
-
if (e++,
|
|
347
|
-
t =
|
|
345
|
+
const n = this.getChildren(t);
|
|
346
|
+
if (e++, n.length !== 1) break;
|
|
347
|
+
t = n[0].properties.cluster_id;
|
|
348
348
|
}
|
|
349
349
|
return e;
|
|
350
350
|
}
|
|
351
|
-
_appendLeaves(t, e,
|
|
351
|
+
_appendLeaves(t, e, n, o, i) {
|
|
352
352
|
const a = this.getChildren(e);
|
|
353
353
|
for (const u of a) {
|
|
354
354
|
const s = u.properties;
|
|
355
|
-
if (s && s.cluster ? i + s.point_count <= o ? i += s.point_count : i = this._appendLeaves(t, s.cluster_id,
|
|
355
|
+
if (s && s.cluster ? i + s.point_count <= o ? i += s.point_count : i = this._appendLeaves(t, s.cluster_id, n, o, i) : i < o ? i++ : t.push(u), t.length === n) break;
|
|
356
356
|
}
|
|
357
357
|
return i;
|
|
358
358
|
}
|
|
359
359
|
_createTree(t) {
|
|
360
360
|
const e = new D(t.length / this.stride | 0, this.options.nodeSize, Float32Array);
|
|
361
|
-
for (let
|
|
361
|
+
for (let n = 0; n < t.length; n += this.stride) e.add(t[n], t[n + 1]);
|
|
362
362
|
return e.finish(), e.data = t, e;
|
|
363
363
|
}
|
|
364
|
-
_addTileFeatures(t, e,
|
|
364
|
+
_addTileFeatures(t, e, n, o, i, a) {
|
|
365
365
|
for (const u of t) {
|
|
366
366
|
const s = u * this.stride, c = e[s + A] > 1;
|
|
367
367
|
let p, h, l;
|
|
368
368
|
if (c)
|
|
369
|
-
p =
|
|
369
|
+
p = nt(e, s, this.clusterProps), h = e[s], l = e[s + 1];
|
|
370
370
|
else {
|
|
371
371
|
const m = this.points[e[s + E]];
|
|
372
372
|
p = m.properties;
|
|
@@ -376,7 +376,7 @@ class gt {
|
|
|
376
376
|
const f = {
|
|
377
377
|
type: 1,
|
|
378
378
|
geometry: [[
|
|
379
|
-
Math.round(this.options.extent * (h * i -
|
|
379
|
+
Math.round(this.options.extent * (h * i - n)),
|
|
380
380
|
Math.round(this.options.extent * (l * i - o))
|
|
381
381
|
]],
|
|
382
382
|
tags: p
|
|
@@ -389,23 +389,23 @@ class gt {
|
|
|
389
389
|
return Math.max(this.options.minZoom, Math.min(Math.floor(+t), this.options.maxZoom + 1));
|
|
390
390
|
}
|
|
391
391
|
_cluster(t, e) {
|
|
392
|
-
const { radius:
|
|
392
|
+
const { radius: n, extent: o, reduce: i, minPoints: a } = this.options, u = n / (o * Math.pow(2, e)), s = t.data, c = [], p = this.stride;
|
|
393
393
|
for (let h = 0; h < s.length; h += p) {
|
|
394
|
-
if (s[h +
|
|
395
|
-
s[h +
|
|
394
|
+
if (s[h + T] <= e) continue;
|
|
395
|
+
s[h + T] = e;
|
|
396
396
|
const l = s[h], f = s[h + 1], g = t.within(s[h], s[h + 1], u), m = s[h + A];
|
|
397
397
|
let d = m;
|
|
398
398
|
for (const y of g) {
|
|
399
399
|
const M = y * p;
|
|
400
|
-
s[M +
|
|
400
|
+
s[M + T] > e && (d += s[M + A]);
|
|
401
401
|
}
|
|
402
402
|
if (d > m && d >= a) {
|
|
403
403
|
let y = l * m, M = f * m, _, N = -1;
|
|
404
404
|
const Z = ((h / p | 0) << 5) + (e + 1) + this.points.length;
|
|
405
405
|
for (const rt of g) {
|
|
406
406
|
const b = rt * p;
|
|
407
|
-
if (s[b +
|
|
408
|
-
s[b +
|
|
407
|
+
if (s[b + T] <= e) continue;
|
|
408
|
+
s[b + T] = e;
|
|
409
409
|
const $ = s[b + A];
|
|
410
410
|
y += s[b] * $, M += s[b + 1] * $, s[b + z] = Z, i && (_ || (_ = this._map(s, h, !0), N = this.clusterProps.length, this.clusterProps.push(_)), i(_, this._map(s, b)));
|
|
411
411
|
}
|
|
@@ -415,8 +415,8 @@ class gt {
|
|
|
415
415
|
if (d > 1)
|
|
416
416
|
for (const y of g) {
|
|
417
417
|
const M = y * p;
|
|
418
|
-
if (!(s[M +
|
|
419
|
-
s[M +
|
|
418
|
+
if (!(s[M + T] <= e)) {
|
|
419
|
+
s[M + T] = e;
|
|
420
420
|
for (let _ = 0; _ < p; _++) c.push(s[M + _]);
|
|
421
421
|
}
|
|
422
422
|
}
|
|
@@ -432,115 +432,115 @@ class gt {
|
|
|
432
432
|
_getOriginZoom(t) {
|
|
433
433
|
return (t - this.points.length) % 32;
|
|
434
434
|
}
|
|
435
|
-
_map(t, e,
|
|
435
|
+
_map(t, e, n) {
|
|
436
436
|
if (t[e + A] > 1) {
|
|
437
|
-
const a = this.clusterProps[t[e +
|
|
438
|
-
return
|
|
437
|
+
const a = this.clusterProps[t[e + et]];
|
|
438
|
+
return n ? Object.assign({}, a) : a;
|
|
439
439
|
}
|
|
440
440
|
const o = this.points[t[e + E]].properties, i = this.options.map(o);
|
|
441
|
-
return
|
|
441
|
+
return n && i === o ? Object.assign({}, i) : i;
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
|
-
function
|
|
444
|
+
function W(r, t, e) {
|
|
445
445
|
return {
|
|
446
446
|
type: "Feature",
|
|
447
|
-
id:
|
|
448
|
-
properties:
|
|
447
|
+
id: r[t + E],
|
|
448
|
+
properties: nt(r, t, e),
|
|
449
449
|
geometry: {
|
|
450
450
|
type: "Point",
|
|
451
|
-
coordinates: [
|
|
451
|
+
coordinates: [yt(r[t]), wt(r[t + 1])]
|
|
452
452
|
}
|
|
453
453
|
};
|
|
454
454
|
}
|
|
455
|
-
function
|
|
456
|
-
const
|
|
455
|
+
function nt(r, t, e) {
|
|
456
|
+
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 + et], a = i === -1 ? {} : Object.assign({}, e[i]);
|
|
457
457
|
return Object.assign(a, {
|
|
458
458
|
cluster: !0,
|
|
459
|
-
cluster_id:
|
|
460
|
-
point_count:
|
|
459
|
+
cluster_id: r[t + E],
|
|
460
|
+
point_count: n,
|
|
461
461
|
point_count_abbreviated: o
|
|
462
462
|
});
|
|
463
463
|
}
|
|
464
|
-
function I(
|
|
465
|
-
return
|
|
464
|
+
function I(r) {
|
|
465
|
+
return r / 360 + 0.5;
|
|
466
466
|
}
|
|
467
|
-
function B(
|
|
468
|
-
const t = Math.sin(
|
|
467
|
+
function B(r) {
|
|
468
|
+
const t = Math.sin(r * Math.PI / 180), e = 0.5 - 0.25 * Math.log((1 + t) / (1 - t)) / Math.PI;
|
|
469
469
|
return e < 0 ? 0 : e > 1 ? 1 : e;
|
|
470
470
|
}
|
|
471
|
-
function
|
|
472
|
-
return (
|
|
471
|
+
function yt(r) {
|
|
472
|
+
return (r - 0.5) * 360;
|
|
473
473
|
}
|
|
474
|
-
function
|
|
475
|
-
const t = (180 -
|
|
474
|
+
function wt(r) {
|
|
475
|
+
const t = (180 - r * 360) * Math.PI / 180;
|
|
476
476
|
return 360 * Math.atan(Math.exp(t)) / Math.PI - 90;
|
|
477
477
|
}
|
|
478
|
-
var
|
|
479
|
-
function
|
|
480
|
-
for (e of
|
|
481
|
-
if (
|
|
478
|
+
var Y = Object.prototype.hasOwnProperty;
|
|
479
|
+
function q(r, t, e) {
|
|
480
|
+
for (e of r.keys())
|
|
481
|
+
if (v(e, t)) return e;
|
|
482
482
|
}
|
|
483
|
-
function
|
|
484
|
-
var e,
|
|
485
|
-
if (
|
|
486
|
-
if (
|
|
487
|
-
if (e === Date) return
|
|
488
|
-
if (e === RegExp) return
|
|
483
|
+
function v(r, t) {
|
|
484
|
+
var e, n, o;
|
|
485
|
+
if (r === t) return !0;
|
|
486
|
+
if (r && t && (e = r.constructor) === t.constructor) {
|
|
487
|
+
if (e === Date) return r.getTime() === t.getTime();
|
|
488
|
+
if (e === RegExp) return r.toString() === t.toString();
|
|
489
489
|
if (e === Array) {
|
|
490
|
-
if ((
|
|
491
|
-
for (;
|
|
492
|
-
return
|
|
490
|
+
if ((n = r.length) === t.length)
|
|
491
|
+
for (; n-- && v(r[n], t[n]); ) ;
|
|
492
|
+
return n === -1;
|
|
493
493
|
}
|
|
494
494
|
if (e === Set) {
|
|
495
|
-
if (
|
|
495
|
+
if (r.size !== t.size)
|
|
496
496
|
return !1;
|
|
497
|
-
for (
|
|
498
|
-
if (o =
|
|
497
|
+
for (n of r)
|
|
498
|
+
if (o = n, o && typeof o == "object" && (o = q(t, o), !o) || !t.has(o)) return !1;
|
|
499
499
|
return !0;
|
|
500
500
|
}
|
|
501
501
|
if (e === Map) {
|
|
502
|
-
if (
|
|
502
|
+
if (r.size !== t.size)
|
|
503
503
|
return !1;
|
|
504
|
-
for (
|
|
505
|
-
if (o =
|
|
504
|
+
for (n of r)
|
|
505
|
+
if (o = n[0], o && typeof o == "object" && (o = q(t, o), !o) || !v(n[1], t.get(o)))
|
|
506
506
|
return !1;
|
|
507
507
|
return !0;
|
|
508
508
|
}
|
|
509
509
|
if (e === ArrayBuffer)
|
|
510
|
-
|
|
510
|
+
r = new Uint8Array(r), t = new Uint8Array(t);
|
|
511
511
|
else if (e === DataView) {
|
|
512
|
-
if ((
|
|
513
|
-
for (;
|
|
514
|
-
return
|
|
512
|
+
if ((n = r.byteLength) === t.byteLength)
|
|
513
|
+
for (; n-- && r.getInt8(n) === t.getInt8(n); ) ;
|
|
514
|
+
return n === -1;
|
|
515
515
|
}
|
|
516
|
-
if (ArrayBuffer.isView(
|
|
517
|
-
if ((
|
|
518
|
-
for (;
|
|
519
|
-
return
|
|
516
|
+
if (ArrayBuffer.isView(r)) {
|
|
517
|
+
if ((n = r.byteLength) === t.byteLength)
|
|
518
|
+
for (; n-- && r[n] === t[n]; ) ;
|
|
519
|
+
return n === -1;
|
|
520
520
|
}
|
|
521
|
-
if (!e || typeof
|
|
522
|
-
|
|
523
|
-
for (e in
|
|
524
|
-
if (
|
|
525
|
-
return Object.keys(t).length ===
|
|
521
|
+
if (!e || typeof r == "object") {
|
|
522
|
+
n = 0;
|
|
523
|
+
for (e in r)
|
|
524
|
+
if (Y.call(r, e) && ++n && !Y.call(t, e) || !(e in t) || !v(r[e], t[e])) return !1;
|
|
525
|
+
return Object.keys(t).length === n;
|
|
526
526
|
}
|
|
527
527
|
}
|
|
528
|
-
return
|
|
528
|
+
return r !== r && t !== t;
|
|
529
529
|
}
|
|
530
|
-
function
|
|
531
|
-
var t = F.useRef(
|
|
532
|
-
return
|
|
530
|
+
function Mt(r) {
|
|
531
|
+
var t = F.useRef(r), e = F.useRef(0);
|
|
532
|
+
return v(r, t.current) || (t.current = r, e.current += 1), F.useMemo(function() {
|
|
533
533
|
return t.current;
|
|
534
534
|
}, [e.current]);
|
|
535
535
|
}
|
|
536
|
-
function
|
|
537
|
-
return F.useEffect(
|
|
536
|
+
function xt(r, t) {
|
|
537
|
+
return F.useEffect(r, Mt(t));
|
|
538
538
|
}
|
|
539
|
-
var
|
|
540
|
-
var e = t.points,
|
|
541
|
-
return
|
|
542
|
-
a !== !0 && ((!u.current || !
|
|
543
|
-
}, [e,
|
|
539
|
+
var _t = function(t) {
|
|
540
|
+
var e = t.points, n = t.bounds, o = t.zoom, i = t.options, a = t.disableRefresh, u = G(), s = G(), c = Q([]), p = c[0], h = c[1], l = Math.round(o);
|
|
541
|
+
return xt(function() {
|
|
542
|
+
a !== !0 && ((!u.current || !v(s.current, e) || !v(u.current.options, i)) && (u.current = new mt(i), u.current.load(e)), n && h(u.current.getClusters(n, l)), s.current = e);
|
|
543
|
+
}, [e, n, l, i, a]), {
|
|
544
544
|
clusters: p,
|
|
545
545
|
supercluster: u.current
|
|
546
546
|
};
|
|
@@ -555,7 +555,7 @@ const zt = `
|
|
|
555
555
|
transition-transform
|
|
556
556
|
|
|
557
557
|
data-[is-cluster=true]:w-auto
|
|
558
|
-
`,
|
|
558
|
+
`, At = `
|
|
559
559
|
cursor-pointer
|
|
560
560
|
fill-primary-100
|
|
561
561
|
stroke-1
|
|
@@ -577,9 +577,9 @@ const zt = `
|
|
|
577
577
|
group-hover:text-primary-100
|
|
578
578
|
group-hover:max-w-2.5
|
|
579
579
|
group-hover:max-h-2.5
|
|
580
|
-
`,
|
|
581
|
-
const { mapProvider:
|
|
582
|
-
points:
|
|
580
|
+
`, Et = w(() => import("./index-92HhWupr.js")), bt = w(() => import("./index-ChwN5abO.js")), Tt = w(() => import("./index-D5-2anzJ.js")), vt = ({ markers: r, onClick: t, ...e }) => {
|
|
581
|
+
const { mapProvider: n, bounds: o } = R(), { clusters: i, supercluster: a } = _t({
|
|
582
|
+
points: r.map((c) => dt([c.longitude, c.latitude], c)),
|
|
583
583
|
bounds: o,
|
|
584
584
|
zoom: 16,
|
|
585
585
|
options: { radius: 50, maxZoom: 30 }
|
|
@@ -603,70 +603,70 @@ const zt = `
|
|
|
603
603
|
markers: [c.properties]
|
|
604
604
|
});
|
|
605
605
|
}, s = L(() => {
|
|
606
|
-
switch (
|
|
606
|
+
switch (n == null ? void 0 : n.name) {
|
|
607
607
|
case "maptiler":
|
|
608
|
-
return At;
|
|
609
|
-
case "google":
|
|
610
608
|
return Et;
|
|
611
|
-
case "
|
|
609
|
+
case "google":
|
|
612
610
|
return bt;
|
|
611
|
+
case "mapbox":
|
|
612
|
+
return Tt;
|
|
613
613
|
default:
|
|
614
614
|
return null;
|
|
615
615
|
}
|
|
616
|
-
}, [
|
|
617
|
-
return s ? /* @__PURE__ */ x(
|
|
616
|
+
}, [n]);
|
|
617
|
+
return s ? /* @__PURE__ */ x(st, { children: /* @__PURE__ */ x(s, { clusters: i, onClick: u, ...e, children: /* @__PURE__ */ x("svg", { viewBox: "0 0 20 28", fill: "none", className: At, children: /* @__PURE__ */ x(
|
|
618
618
|
"path",
|
|
619
619
|
{
|
|
620
620
|
d: "M20 10C20 15.5228 12 27.5 10 27.5C8 27.5 0 15.5228 0 10C0 4.47715 4.47715 0 10 0C15.5228 0 20 4.47715 20 10Z",
|
|
621
621
|
fill: "inherit"
|
|
622
622
|
}
|
|
623
623
|
) }) }) }) : null;
|
|
624
|
-
},
|
|
625
|
-
function
|
|
626
|
-
const { mapProvider: e } = R(),
|
|
624
|
+
}, Ot = w(() => import("./index-J1MKzGEM.js")), Pt = w(() => import("./index-BZ2605rA.js")), St = w(() => import("./index-B43MtiHH.js"));
|
|
625
|
+
function It({ children: r, ...t }) {
|
|
626
|
+
const { mapProvider: e } = R(), n = L(() => {
|
|
627
627
|
switch (e == null ? void 0 : e.name) {
|
|
628
628
|
case "maptiler":
|
|
629
|
-
return Tt;
|
|
630
|
-
case "google":
|
|
631
629
|
return Ot;
|
|
632
|
-
case "
|
|
630
|
+
case "google":
|
|
633
631
|
return Pt;
|
|
632
|
+
case "mapbox":
|
|
633
|
+
return St;
|
|
634
634
|
default:
|
|
635
635
|
return null;
|
|
636
636
|
}
|
|
637
637
|
}, [e]);
|
|
638
|
-
return
|
|
638
|
+
return n ? /* @__PURE__ */ x(n, { ...t, children: r }) : null;
|
|
639
639
|
}
|
|
640
|
-
const
|
|
641
|
-
function
|
|
640
|
+
const Bt = w(() => import("./index-CTk5bvm9.js")), Ft = w(() => import("./index-CPq7k7F4.js")), Lt = w(() => import("./index-DVitM43i.js"));
|
|
641
|
+
function Rt(r) {
|
|
642
642
|
const { mapProvider: t } = R(), e = L(() => {
|
|
643
643
|
switch (t == null ? void 0 : t.name) {
|
|
644
644
|
case "maptiler":
|
|
645
|
-
return It;
|
|
646
|
-
case "google":
|
|
647
645
|
return Bt;
|
|
648
|
-
case "
|
|
646
|
+
case "google":
|
|
649
647
|
return Ft;
|
|
648
|
+
case "mapbox":
|
|
649
|
+
return Lt;
|
|
650
650
|
default:
|
|
651
651
|
return null;
|
|
652
652
|
}
|
|
653
653
|
}, [t]);
|
|
654
|
-
return e ? /* @__PURE__ */ x(e, { ...
|
|
654
|
+
return e ? /* @__PURE__ */ x(e, { ...r }) : null;
|
|
655
655
|
}
|
|
656
|
-
function
|
|
657
|
-
const [t, e] =
|
|
658
|
-
return /* @__PURE__ */ x(
|
|
656
|
+
function Zt(r) {
|
|
657
|
+
const [t, e] = Q();
|
|
658
|
+
return /* @__PURE__ */ x(X.Provider, { value: { ...r, bounds: t, setBounds: e }, children: r.children });
|
|
659
659
|
}
|
|
660
660
|
const Nt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
661
661
|
__proto__: null,
|
|
662
|
-
BaseMap:
|
|
663
|
-
Layers:
|
|
662
|
+
BaseMap: lt,
|
|
663
|
+
Layers: Rt,
|
|
664
664
|
Markers: vt,
|
|
665
|
-
Popup:
|
|
666
|
-
Root:
|
|
665
|
+
Popup: It,
|
|
666
|
+
Root: Zt
|
|
667
667
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
668
668
|
export {
|
|
669
|
-
|
|
669
|
+
V as a,
|
|
670
670
|
Dt as b,
|
|
671
671
|
zt as c,
|
|
672
672
|
S as d,
|