react-three-map 0.0.0 → 0.0.1
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/README.md +13 -7
- package/build/cjs/index.js.js +1 -0
- package/build/es/index.js.mjs +5 -0
- package/build/es/index.js.mjs.map +1 -0
- package/build/es/index.js10.mjs +40 -0
- package/build/es/index.js10.mjs.map +1 -0
- package/build/es/index.js11.mjs +13 -0
- package/build/es/index.js11.mjs.map +1 -0
- package/build/es/index.js12.mjs +13 -0
- package/build/es/index.js12.mjs.map +1 -0
- package/build/es/index.js13.mjs +31 -0
- package/build/es/index.js13.mjs.map +1 -0
- package/build/es/index.js14.mjs +13 -0
- package/build/es/index.js14.mjs.map +1 -0
- package/build/es/index.js15.mjs +15 -0
- package/build/es/index.js15.mjs.map +1 -0
- package/build/es/index.js16.mjs +14 -0
- package/build/es/index.js16.mjs.map +1 -0
- package/build/es/index.js17.mjs +56 -0
- package/build/es/index.js17.mjs.map +1 -0
- package/build/es/index.js18.mjs +9 -0
- package/build/es/index.js18.mjs.map +1 -0
- package/build/es/index.js19.mjs +320 -0
- package/build/es/index.js19.mjs.map +1 -0
- package/build/es/index.js2.mjs +40 -0
- package/build/es/index.js2.mjs.map +1 -0
- package/build/es/index.js20.mjs +72 -0
- package/build/es/index.js20.mjs.map +1 -0
- package/build/es/index.js21.mjs +6 -0
- package/build/es/index.js21.mjs.map +1 -0
- package/build/es/index.js22.mjs +19 -0
- package/build/es/index.js22.mjs.map +1 -0
- package/build/es/index.js23.mjs +14 -0
- package/build/es/index.js23.mjs.map +1 -0
- package/build/es/index.js24.mjs +34 -0
- package/build/es/index.js24.mjs.map +1 -0
- package/build/es/index.js25.mjs +15 -0
- package/build/es/index.js25.mjs.map +1 -0
- package/build/es/index.js26.mjs +8 -0
- package/build/es/index.js26.mjs.map +1 -0
- package/build/es/index.js27.mjs +41 -0
- package/build/es/index.js27.mjs.map +1 -0
- package/build/es/index.js28.mjs +26 -0
- package/build/es/index.js28.mjs.map +1 -0
- package/build/es/index.js3.mjs +21 -0
- package/build/es/index.js3.mjs.map +1 -0
- package/build/es/index.js4.mjs +11 -0
- package/build/es/index.js4.mjs.map +1 -0
- package/build/es/index.js5.mjs +53 -0
- package/build/es/index.js5.mjs.map +1 -0
- package/build/es/index.js6.mjs +16 -0
- package/build/es/index.js6.mjs.map +1 -0
- package/build/es/index.js7.mjs +62 -0
- package/build/es/index.js7.mjs.map +1 -0
- package/build/es/index.js8.mjs +58 -0
- package/build/es/index.js8.mjs.map +1 -0
- package/build/es/index.js9.mjs +49 -0
- package/build/es/index.js9.mjs.map +1 -0
- package/build/es/vite.svg +1 -0
- package/build/vite.svg +1 -0
- package/index.html +13 -0
- package/package.json +11 -11
- package/src/canvas/canvas.tsx +49 -0
- package/src/canvas/coords-to-matrix.ts +19 -0
- package/src/canvas/create-events.ts +73 -0
- package/src/canvas/state-ref.ts +9 -0
- package/src/canvas/use-function.ts +10 -0
- package/src/canvas/use-on-add.ts +67 -0
- package/src/canvas/use-render.ts +27 -0
- package/src/index.ts +1 -0
- package/src/stories/canvas.stories.tsx +28 -0
- package/src/stories/my-scene.tsx +86 -0
- package/src/stories/no-map.stories.tsx +12 -0
- package/src/vite-env.d.ts +1 -0
- package/tsconfig.json +25 -0
- package/tsconfig.node.json +10 -0
- package/dist/my-lib.es.js +0 -1538
- package/dist/my-lib.umd.js +0 -27
- /package/{dist → build/cjs}/vite.svg +0 -0
package/dist/my-lib.es.js
DELETED
|
@@ -1,1538 +0,0 @@
|
|
|
1
|
-
import * as W from "react";
|
|
2
|
-
import ot, { useContext as U, useMemo as z, useLayoutEffect as It, useEffect as M, useState as _e, useRef as D, useImperativeHandle as oe, memo as I, forwardRef as Ee, useCallback as Nt, useId as Wt } from "react";
|
|
3
|
-
import { createEvents as Ut, createRoot as Vt, extend as $t } from "@react-three/fiber";
|
|
4
|
-
import { createPortal as at } from "react-dom";
|
|
5
|
-
import * as Yt from "three";
|
|
6
|
-
import { Quaternion as Bt, Euler as Ht, Vector3 as it, Matrix4 as qt } from "three";
|
|
7
|
-
import { MercatorCoordinate as Zt } from "maplibre-gl";
|
|
8
|
-
var pe = { exports: {} }, G = {};
|
|
9
|
-
/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.production.min.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/
|
|
18
|
-
var Be;
|
|
19
|
-
function Gt() {
|
|
20
|
-
if (Be)
|
|
21
|
-
return G;
|
|
22
|
-
Be = 1;
|
|
23
|
-
var e = ot, n = Symbol.for("react.element"), o = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, a = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
24
|
-
function s(f, u, d) {
|
|
25
|
-
var m, h = {}, C = null, T = null;
|
|
26
|
-
d !== void 0 && (C = "" + d), u.key !== void 0 && (C = "" + u.key), u.ref !== void 0 && (T = u.ref);
|
|
27
|
-
for (m in u)
|
|
28
|
-
r.call(u, m) && !i.hasOwnProperty(m) && (h[m] = u[m]);
|
|
29
|
-
if (f && f.defaultProps)
|
|
30
|
-
for (m in u = f.defaultProps, u)
|
|
31
|
-
h[m] === void 0 && (h[m] = u[m]);
|
|
32
|
-
return { $$typeof: n, type: f, key: C, ref: T, props: h, _owner: a.current };
|
|
33
|
-
}
|
|
34
|
-
return G.Fragment = o, G.jsx = s, G.jsxs = s, G;
|
|
35
|
-
}
|
|
36
|
-
var J = {};
|
|
37
|
-
/**
|
|
38
|
-
* @license React
|
|
39
|
-
* react-jsx-runtime.development.js
|
|
40
|
-
*
|
|
41
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
42
|
-
*
|
|
43
|
-
* This source code is licensed under the MIT license found in the
|
|
44
|
-
* LICENSE file in the root directory of this source tree.
|
|
45
|
-
*/
|
|
46
|
-
var He;
|
|
47
|
-
function Jt() {
|
|
48
|
-
return He || (He = 1, process.env.NODE_ENV !== "production" && function() {
|
|
49
|
-
var e = ot, n = Symbol.for("react.element"), o = Symbol.for("react.portal"), r = Symbol.for("react.fragment"), a = Symbol.for("react.strict_mode"), i = Symbol.for("react.profiler"), s = Symbol.for("react.provider"), f = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), d = Symbol.for("react.suspense"), m = Symbol.for("react.suspense_list"), h = Symbol.for("react.memo"), C = Symbol.for("react.lazy"), T = Symbol.for("react.offscreen"), S = Symbol.iterator, Q = "@@iterator";
|
|
50
|
-
function ae(t) {
|
|
51
|
-
if (t === null || typeof t != "object")
|
|
52
|
-
return null;
|
|
53
|
-
var c = S && t[S] || t[Q];
|
|
54
|
-
return typeof c == "function" ? c : null;
|
|
55
|
-
}
|
|
56
|
-
var L = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
57
|
-
function E(t) {
|
|
58
|
-
{
|
|
59
|
-
for (var c = arguments.length, l = new Array(c > 1 ? c - 1 : 0), v = 1; v < c; v++)
|
|
60
|
-
l[v - 1] = arguments[v];
|
|
61
|
-
O("error", t, l);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
function O(t, c, l) {
|
|
65
|
-
{
|
|
66
|
-
var v = L.ReactDebugCurrentFrame, y = v.getStackAddendum();
|
|
67
|
-
y !== "" && (c += "%s", l = l.concat([y]));
|
|
68
|
-
var _ = l.map(function(p) {
|
|
69
|
-
return String(p);
|
|
70
|
-
});
|
|
71
|
-
_.unshift("Warning: " + c), Function.prototype.apply.call(console[t], console, _);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
var w = !1, j = !1, ct = !1, ut = !1, lt = !1, be;
|
|
75
|
-
be = Symbol.for("react.module.reference");
|
|
76
|
-
function ft(t) {
|
|
77
|
-
return !!(typeof t == "string" || typeof t == "function" || t === r || t === i || lt || t === a || t === d || t === m || ut || t === T || w || j || ct || typeof t == "object" && t !== null && (t.$$typeof === C || t.$$typeof === h || t.$$typeof === s || t.$$typeof === f || t.$$typeof === u || // This needs to include all possible module reference object
|
|
78
|
-
// types supported by any Flight configuration anywhere since
|
|
79
|
-
// we don't know which Flight build this will end up being used
|
|
80
|
-
// with.
|
|
81
|
-
t.$$typeof === be || t.getModuleId !== void 0));
|
|
82
|
-
}
|
|
83
|
-
function dt(t, c, l) {
|
|
84
|
-
var v = t.displayName;
|
|
85
|
-
if (v)
|
|
86
|
-
return v;
|
|
87
|
-
var y = c.displayName || c.name || "";
|
|
88
|
-
return y !== "" ? l + "(" + y + ")" : l;
|
|
89
|
-
}
|
|
90
|
-
function Re(t) {
|
|
91
|
-
return t.displayName || "Context";
|
|
92
|
-
}
|
|
93
|
-
function A(t) {
|
|
94
|
-
if (t == null)
|
|
95
|
-
return null;
|
|
96
|
-
if (typeof t.tag == "number" && E("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof t == "function")
|
|
97
|
-
return t.displayName || t.name || null;
|
|
98
|
-
if (typeof t == "string")
|
|
99
|
-
return t;
|
|
100
|
-
switch (t) {
|
|
101
|
-
case r:
|
|
102
|
-
return "Fragment";
|
|
103
|
-
case o:
|
|
104
|
-
return "Portal";
|
|
105
|
-
case i:
|
|
106
|
-
return "Profiler";
|
|
107
|
-
case a:
|
|
108
|
-
return "StrictMode";
|
|
109
|
-
case d:
|
|
110
|
-
return "Suspense";
|
|
111
|
-
case m:
|
|
112
|
-
return "SuspenseList";
|
|
113
|
-
}
|
|
114
|
-
if (typeof t == "object")
|
|
115
|
-
switch (t.$$typeof) {
|
|
116
|
-
case f:
|
|
117
|
-
var c = t;
|
|
118
|
-
return Re(c) + ".Consumer";
|
|
119
|
-
case s:
|
|
120
|
-
var l = t;
|
|
121
|
-
return Re(l._context) + ".Provider";
|
|
122
|
-
case u:
|
|
123
|
-
return dt(t, t.render, "ForwardRef");
|
|
124
|
-
case h:
|
|
125
|
-
var v = t.displayName || null;
|
|
126
|
-
return v !== null ? v : A(t.type) || "Memo";
|
|
127
|
-
case C: {
|
|
128
|
-
var y = t, _ = y._payload, p = y._init;
|
|
129
|
-
try {
|
|
130
|
-
return A(p(_));
|
|
131
|
-
} catch {
|
|
132
|
-
return null;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
return null;
|
|
137
|
-
}
|
|
138
|
-
var N = Object.assign, q = 0, Ce, we, Te, Se, xe, Le, Me;
|
|
139
|
-
function Oe() {
|
|
140
|
-
}
|
|
141
|
-
Oe.__reactDisabledLog = !0;
|
|
142
|
-
function mt() {
|
|
143
|
-
{
|
|
144
|
-
if (q === 0) {
|
|
145
|
-
Ce = console.log, we = console.info, Te = console.warn, Se = console.error, xe = console.group, Le = console.groupCollapsed, Me = console.groupEnd;
|
|
146
|
-
var t = {
|
|
147
|
-
configurable: !0,
|
|
148
|
-
enumerable: !0,
|
|
149
|
-
value: Oe,
|
|
150
|
-
writable: !0
|
|
151
|
-
};
|
|
152
|
-
Object.defineProperties(console, {
|
|
153
|
-
info: t,
|
|
154
|
-
log: t,
|
|
155
|
-
warn: t,
|
|
156
|
-
error: t,
|
|
157
|
-
group: t,
|
|
158
|
-
groupCollapsed: t,
|
|
159
|
-
groupEnd: t
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
q++;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
function vt() {
|
|
166
|
-
{
|
|
167
|
-
if (q--, q === 0) {
|
|
168
|
-
var t = {
|
|
169
|
-
configurable: !0,
|
|
170
|
-
enumerable: !0,
|
|
171
|
-
writable: !0
|
|
172
|
-
};
|
|
173
|
-
Object.defineProperties(console, {
|
|
174
|
-
log: N({}, t, {
|
|
175
|
-
value: Ce
|
|
176
|
-
}),
|
|
177
|
-
info: N({}, t, {
|
|
178
|
-
value: we
|
|
179
|
-
}),
|
|
180
|
-
warn: N({}, t, {
|
|
181
|
-
value: Te
|
|
182
|
-
}),
|
|
183
|
-
error: N({}, t, {
|
|
184
|
-
value: Se
|
|
185
|
-
}),
|
|
186
|
-
group: N({}, t, {
|
|
187
|
-
value: xe
|
|
188
|
-
}),
|
|
189
|
-
groupCollapsed: N({}, t, {
|
|
190
|
-
value: Le
|
|
191
|
-
}),
|
|
192
|
-
groupEnd: N({}, t, {
|
|
193
|
-
value: Me
|
|
194
|
-
})
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
q < 0 && E("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
var ie = L.ReactCurrentDispatcher, se;
|
|
201
|
-
function X(t, c, l) {
|
|
202
|
-
{
|
|
203
|
-
if (se === void 0)
|
|
204
|
-
try {
|
|
205
|
-
throw Error();
|
|
206
|
-
} catch (y) {
|
|
207
|
-
var v = y.stack.trim().match(/\n( *(at )?)/);
|
|
208
|
-
se = v && v[1] || "";
|
|
209
|
-
}
|
|
210
|
-
return `
|
|
211
|
-
` + se + t;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
var ce = !1, ee;
|
|
215
|
-
{
|
|
216
|
-
var ht = typeof WeakMap == "function" ? WeakMap : Map;
|
|
217
|
-
ee = new ht();
|
|
218
|
-
}
|
|
219
|
-
function ke(t, c) {
|
|
220
|
-
if (!t || ce)
|
|
221
|
-
return "";
|
|
222
|
-
{
|
|
223
|
-
var l = ee.get(t);
|
|
224
|
-
if (l !== void 0)
|
|
225
|
-
return l;
|
|
226
|
-
}
|
|
227
|
-
var v;
|
|
228
|
-
ce = !0;
|
|
229
|
-
var y = Error.prepareStackTrace;
|
|
230
|
-
Error.prepareStackTrace = void 0;
|
|
231
|
-
var _;
|
|
232
|
-
_ = ie.current, ie.current = null, mt();
|
|
233
|
-
try {
|
|
234
|
-
if (c) {
|
|
235
|
-
var p = function() {
|
|
236
|
-
throw Error();
|
|
237
|
-
};
|
|
238
|
-
if (Object.defineProperty(p.prototype, "props", {
|
|
239
|
-
set: function() {
|
|
240
|
-
throw Error();
|
|
241
|
-
}
|
|
242
|
-
}), typeof Reflect == "object" && Reflect.construct) {
|
|
243
|
-
try {
|
|
244
|
-
Reflect.construct(p, []);
|
|
245
|
-
} catch (F) {
|
|
246
|
-
v = F;
|
|
247
|
-
}
|
|
248
|
-
Reflect.construct(t, [], p);
|
|
249
|
-
} else {
|
|
250
|
-
try {
|
|
251
|
-
p.call();
|
|
252
|
-
} catch (F) {
|
|
253
|
-
v = F;
|
|
254
|
-
}
|
|
255
|
-
t.call(p.prototype);
|
|
256
|
-
}
|
|
257
|
-
} else {
|
|
258
|
-
try {
|
|
259
|
-
throw Error();
|
|
260
|
-
} catch (F) {
|
|
261
|
-
v = F;
|
|
262
|
-
}
|
|
263
|
-
t();
|
|
264
|
-
}
|
|
265
|
-
} catch (F) {
|
|
266
|
-
if (F && v && typeof F.stack == "string") {
|
|
267
|
-
for (var g = F.stack.split(`
|
|
268
|
-
`), x = v.stack.split(`
|
|
269
|
-
`), b = g.length - 1, R = x.length - 1; b >= 1 && R >= 0 && g[b] !== x[R]; )
|
|
270
|
-
R--;
|
|
271
|
-
for (; b >= 1 && R >= 0; b--, R--)
|
|
272
|
-
if (g[b] !== x[R]) {
|
|
273
|
-
if (b !== 1 || R !== 1)
|
|
274
|
-
do
|
|
275
|
-
if (b--, R--, R < 0 || g[b] !== x[R]) {
|
|
276
|
-
var k = `
|
|
277
|
-
` + g[b].replace(" at new ", " at ");
|
|
278
|
-
return t.displayName && k.includes("<anonymous>") && (k = k.replace("<anonymous>", t.displayName)), typeof t == "function" && ee.set(t, k), k;
|
|
279
|
-
}
|
|
280
|
-
while (b >= 1 && R >= 0);
|
|
281
|
-
break;
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
} finally {
|
|
285
|
-
ce = !1, ie.current = _, vt(), Error.prepareStackTrace = y;
|
|
286
|
-
}
|
|
287
|
-
var Y = t ? t.displayName || t.name : "", Ye = Y ? X(Y) : "";
|
|
288
|
-
return typeof t == "function" && ee.set(t, Ye), Ye;
|
|
289
|
-
}
|
|
290
|
-
function gt(t, c, l) {
|
|
291
|
-
return ke(t, !1);
|
|
292
|
-
}
|
|
293
|
-
function pt(t) {
|
|
294
|
-
var c = t.prototype;
|
|
295
|
-
return !!(c && c.isReactComponent);
|
|
296
|
-
}
|
|
297
|
-
function te(t, c, l) {
|
|
298
|
-
if (t == null)
|
|
299
|
-
return "";
|
|
300
|
-
if (typeof t == "function")
|
|
301
|
-
return ke(t, pt(t));
|
|
302
|
-
if (typeof t == "string")
|
|
303
|
-
return X(t);
|
|
304
|
-
switch (t) {
|
|
305
|
-
case d:
|
|
306
|
-
return X("Suspense");
|
|
307
|
-
case m:
|
|
308
|
-
return X("SuspenseList");
|
|
309
|
-
}
|
|
310
|
-
if (typeof t == "object")
|
|
311
|
-
switch (t.$$typeof) {
|
|
312
|
-
case u:
|
|
313
|
-
return gt(t.render);
|
|
314
|
-
case h:
|
|
315
|
-
return te(t.type, c, l);
|
|
316
|
-
case C: {
|
|
317
|
-
var v = t, y = v._payload, _ = v._init;
|
|
318
|
-
try {
|
|
319
|
-
return te(_(y), c, l);
|
|
320
|
-
} catch {
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
return "";
|
|
325
|
-
}
|
|
326
|
-
var ne = Object.prototype.hasOwnProperty, Pe = {}, je = L.ReactDebugCurrentFrame;
|
|
327
|
-
function re(t) {
|
|
328
|
-
if (t) {
|
|
329
|
-
var c = t._owner, l = te(t.type, t._source, c ? c.type : null);
|
|
330
|
-
je.setExtraStackFrame(l);
|
|
331
|
-
} else
|
|
332
|
-
je.setExtraStackFrame(null);
|
|
333
|
-
}
|
|
334
|
-
function yt(t, c, l, v, y) {
|
|
335
|
-
{
|
|
336
|
-
var _ = Function.call.bind(ne);
|
|
337
|
-
for (var p in t)
|
|
338
|
-
if (_(t, p)) {
|
|
339
|
-
var g = void 0;
|
|
340
|
-
try {
|
|
341
|
-
if (typeof t[p] != "function") {
|
|
342
|
-
var x = Error((v || "React class") + ": " + l + " type `" + p + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof t[p] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
343
|
-
throw x.name = "Invariant Violation", x;
|
|
344
|
-
}
|
|
345
|
-
g = t[p](c, p, v, l, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
346
|
-
} catch (b) {
|
|
347
|
-
g = b;
|
|
348
|
-
}
|
|
349
|
-
g && !(g instanceof Error) && (re(y), E("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", v || "React class", l, p, typeof g), re(null)), g instanceof Error && !(g.message in Pe) && (Pe[g.message] = !0, re(y), E("Failed %s type: %s", l, g.message), re(null));
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
var _t = Array.isArray;
|
|
354
|
-
function ue(t) {
|
|
355
|
-
return _t(t);
|
|
356
|
-
}
|
|
357
|
-
function Et(t) {
|
|
358
|
-
{
|
|
359
|
-
var c = typeof Symbol == "function" && Symbol.toStringTag, l = c && t[Symbol.toStringTag] || t.constructor.name || "Object";
|
|
360
|
-
return l;
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
function bt(t) {
|
|
364
|
-
try {
|
|
365
|
-
return Ae(t), !1;
|
|
366
|
-
} catch {
|
|
367
|
-
return !0;
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
function Ae(t) {
|
|
371
|
-
return "" + t;
|
|
372
|
-
}
|
|
373
|
-
function Fe(t) {
|
|
374
|
-
if (bt(t))
|
|
375
|
-
return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Et(t)), Ae(t);
|
|
376
|
-
}
|
|
377
|
-
var Z = L.ReactCurrentOwner, Rt = {
|
|
378
|
-
key: !0,
|
|
379
|
-
ref: !0,
|
|
380
|
-
__self: !0,
|
|
381
|
-
__source: !0
|
|
382
|
-
}, De, ze, le;
|
|
383
|
-
le = {};
|
|
384
|
-
function Ct(t) {
|
|
385
|
-
if (ne.call(t, "ref")) {
|
|
386
|
-
var c = Object.getOwnPropertyDescriptor(t, "ref").get;
|
|
387
|
-
if (c && c.isReactWarning)
|
|
388
|
-
return !1;
|
|
389
|
-
}
|
|
390
|
-
return t.ref !== void 0;
|
|
391
|
-
}
|
|
392
|
-
function wt(t) {
|
|
393
|
-
if (ne.call(t, "key")) {
|
|
394
|
-
var c = Object.getOwnPropertyDescriptor(t, "key").get;
|
|
395
|
-
if (c && c.isReactWarning)
|
|
396
|
-
return !1;
|
|
397
|
-
}
|
|
398
|
-
return t.key !== void 0;
|
|
399
|
-
}
|
|
400
|
-
function Tt(t, c) {
|
|
401
|
-
if (typeof t.ref == "string" && Z.current && c && Z.current.stateNode !== c) {
|
|
402
|
-
var l = A(Z.current.type);
|
|
403
|
-
le[l] || (E('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', A(Z.current.type), t.ref), le[l] = !0);
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
function St(t, c) {
|
|
407
|
-
{
|
|
408
|
-
var l = function() {
|
|
409
|
-
De || (De = !0, E("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", c));
|
|
410
|
-
};
|
|
411
|
-
l.isReactWarning = !0, Object.defineProperty(t, "key", {
|
|
412
|
-
get: l,
|
|
413
|
-
configurable: !0
|
|
414
|
-
});
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
function xt(t, c) {
|
|
418
|
-
{
|
|
419
|
-
var l = function() {
|
|
420
|
-
ze || (ze = !0, E("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", c));
|
|
421
|
-
};
|
|
422
|
-
l.isReactWarning = !0, Object.defineProperty(t, "ref", {
|
|
423
|
-
get: l,
|
|
424
|
-
configurable: !0
|
|
425
|
-
});
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
var Lt = function(t, c, l, v, y, _, p) {
|
|
429
|
-
var g = {
|
|
430
|
-
// This tag allows us to uniquely identify this as a React Element
|
|
431
|
-
$$typeof: n,
|
|
432
|
-
// Built-in properties that belong on the element
|
|
433
|
-
type: t,
|
|
434
|
-
key: c,
|
|
435
|
-
ref: l,
|
|
436
|
-
props: p,
|
|
437
|
-
// Record the component responsible for creating this element.
|
|
438
|
-
_owner: _
|
|
439
|
-
};
|
|
440
|
-
return g._store = {}, Object.defineProperty(g._store, "validated", {
|
|
441
|
-
configurable: !1,
|
|
442
|
-
enumerable: !1,
|
|
443
|
-
writable: !0,
|
|
444
|
-
value: !1
|
|
445
|
-
}), Object.defineProperty(g, "_self", {
|
|
446
|
-
configurable: !1,
|
|
447
|
-
enumerable: !1,
|
|
448
|
-
writable: !1,
|
|
449
|
-
value: v
|
|
450
|
-
}), Object.defineProperty(g, "_source", {
|
|
451
|
-
configurable: !1,
|
|
452
|
-
enumerable: !1,
|
|
453
|
-
writable: !1,
|
|
454
|
-
value: y
|
|
455
|
-
}), Object.freeze && (Object.freeze(g.props), Object.freeze(g)), g;
|
|
456
|
-
};
|
|
457
|
-
function Mt(t, c, l, v, y) {
|
|
458
|
-
{
|
|
459
|
-
var _, p = {}, g = null, x = null;
|
|
460
|
-
l !== void 0 && (Fe(l), g = "" + l), wt(c) && (Fe(c.key), g = "" + c.key), Ct(c) && (x = c.ref, Tt(c, y));
|
|
461
|
-
for (_ in c)
|
|
462
|
-
ne.call(c, _) && !Rt.hasOwnProperty(_) && (p[_] = c[_]);
|
|
463
|
-
if (t && t.defaultProps) {
|
|
464
|
-
var b = t.defaultProps;
|
|
465
|
-
for (_ in b)
|
|
466
|
-
p[_] === void 0 && (p[_] = b[_]);
|
|
467
|
-
}
|
|
468
|
-
if (g || x) {
|
|
469
|
-
var R = typeof t == "function" ? t.displayName || t.name || "Unknown" : t;
|
|
470
|
-
g && St(p, R), x && xt(p, R);
|
|
471
|
-
}
|
|
472
|
-
return Lt(t, g, x, y, v, Z.current, p);
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
var fe = L.ReactCurrentOwner, Ie = L.ReactDebugCurrentFrame;
|
|
476
|
-
function $(t) {
|
|
477
|
-
if (t) {
|
|
478
|
-
var c = t._owner, l = te(t.type, t._source, c ? c.type : null);
|
|
479
|
-
Ie.setExtraStackFrame(l);
|
|
480
|
-
} else
|
|
481
|
-
Ie.setExtraStackFrame(null);
|
|
482
|
-
}
|
|
483
|
-
var de;
|
|
484
|
-
de = !1;
|
|
485
|
-
function me(t) {
|
|
486
|
-
return typeof t == "object" && t !== null && t.$$typeof === n;
|
|
487
|
-
}
|
|
488
|
-
function Ne() {
|
|
489
|
-
{
|
|
490
|
-
if (fe.current) {
|
|
491
|
-
var t = A(fe.current.type);
|
|
492
|
-
if (t)
|
|
493
|
-
return `
|
|
494
|
-
|
|
495
|
-
Check the render method of \`` + t + "`.";
|
|
496
|
-
}
|
|
497
|
-
return "";
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
function Ot(t) {
|
|
501
|
-
{
|
|
502
|
-
if (t !== void 0) {
|
|
503
|
-
var c = t.fileName.replace(/^.*[\\\/]/, ""), l = t.lineNumber;
|
|
504
|
-
return `
|
|
505
|
-
|
|
506
|
-
Check your code at ` + c + ":" + l + ".";
|
|
507
|
-
}
|
|
508
|
-
return "";
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
var We = {};
|
|
512
|
-
function kt(t) {
|
|
513
|
-
{
|
|
514
|
-
var c = Ne();
|
|
515
|
-
if (!c) {
|
|
516
|
-
var l = typeof t == "string" ? t : t.displayName || t.name;
|
|
517
|
-
l && (c = `
|
|
518
|
-
|
|
519
|
-
Check the top-level render call using <` + l + ">.");
|
|
520
|
-
}
|
|
521
|
-
return c;
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
function Ue(t, c) {
|
|
525
|
-
{
|
|
526
|
-
if (!t._store || t._store.validated || t.key != null)
|
|
527
|
-
return;
|
|
528
|
-
t._store.validated = !0;
|
|
529
|
-
var l = kt(c);
|
|
530
|
-
if (We[l])
|
|
531
|
-
return;
|
|
532
|
-
We[l] = !0;
|
|
533
|
-
var v = "";
|
|
534
|
-
t && t._owner && t._owner !== fe.current && (v = " It was passed a child from " + A(t._owner.type) + "."), $(t), E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', l, v), $(null);
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
function Ve(t, c) {
|
|
538
|
-
{
|
|
539
|
-
if (typeof t != "object")
|
|
540
|
-
return;
|
|
541
|
-
if (ue(t))
|
|
542
|
-
for (var l = 0; l < t.length; l++) {
|
|
543
|
-
var v = t[l];
|
|
544
|
-
me(v) && Ue(v, c);
|
|
545
|
-
}
|
|
546
|
-
else if (me(t))
|
|
547
|
-
t._store && (t._store.validated = !0);
|
|
548
|
-
else if (t) {
|
|
549
|
-
var y = ae(t);
|
|
550
|
-
if (typeof y == "function" && y !== t.entries)
|
|
551
|
-
for (var _ = y.call(t), p; !(p = _.next()).done; )
|
|
552
|
-
me(p.value) && Ue(p.value, c);
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
function Pt(t) {
|
|
557
|
-
{
|
|
558
|
-
var c = t.type;
|
|
559
|
-
if (c == null || typeof c == "string")
|
|
560
|
-
return;
|
|
561
|
-
var l;
|
|
562
|
-
if (typeof c == "function")
|
|
563
|
-
l = c.propTypes;
|
|
564
|
-
else if (typeof c == "object" && (c.$$typeof === u || // Note: Memo only checks outer props here.
|
|
565
|
-
// Inner props are checked in the reconciler.
|
|
566
|
-
c.$$typeof === h))
|
|
567
|
-
l = c.propTypes;
|
|
568
|
-
else
|
|
569
|
-
return;
|
|
570
|
-
if (l) {
|
|
571
|
-
var v = A(c);
|
|
572
|
-
yt(l, t.props, "prop", v, t);
|
|
573
|
-
} else if (c.PropTypes !== void 0 && !de) {
|
|
574
|
-
de = !0;
|
|
575
|
-
var y = A(c);
|
|
576
|
-
E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", y || "Unknown");
|
|
577
|
-
}
|
|
578
|
-
typeof c.getDefaultProps == "function" && !c.getDefaultProps.isReactClassApproved && E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
function jt(t) {
|
|
582
|
-
{
|
|
583
|
-
for (var c = Object.keys(t.props), l = 0; l < c.length; l++) {
|
|
584
|
-
var v = c[l];
|
|
585
|
-
if (v !== "children" && v !== "key") {
|
|
586
|
-
$(t), E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", v), $(null);
|
|
587
|
-
break;
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
t.ref !== null && ($(t), E("Invalid attribute `ref` supplied to `React.Fragment`."), $(null));
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
function $e(t, c, l, v, y, _) {
|
|
594
|
-
{
|
|
595
|
-
var p = ft(t);
|
|
596
|
-
if (!p) {
|
|
597
|
-
var g = "";
|
|
598
|
-
(t === void 0 || typeof t == "object" && t !== null && Object.keys(t).length === 0) && (g += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
599
|
-
var x = Ot(y);
|
|
600
|
-
x ? g += x : g += Ne();
|
|
601
|
-
var b;
|
|
602
|
-
t === null ? b = "null" : ue(t) ? b = "array" : t !== void 0 && t.$$typeof === n ? (b = "<" + (A(t.type) || "Unknown") + " />", g = " Did you accidentally export a JSX literal instead of a component?") : b = typeof t, E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", b, g);
|
|
603
|
-
}
|
|
604
|
-
var R = Mt(t, c, l, y, _);
|
|
605
|
-
if (R == null)
|
|
606
|
-
return R;
|
|
607
|
-
if (p) {
|
|
608
|
-
var k = c.children;
|
|
609
|
-
if (k !== void 0)
|
|
610
|
-
if (v)
|
|
611
|
-
if (ue(k)) {
|
|
612
|
-
for (var Y = 0; Y < k.length; Y++)
|
|
613
|
-
Ve(k[Y], t);
|
|
614
|
-
Object.freeze && Object.freeze(k);
|
|
615
|
-
} else
|
|
616
|
-
E("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
617
|
-
else
|
|
618
|
-
Ve(k, t);
|
|
619
|
-
}
|
|
620
|
-
return t === r ? jt(R) : Pt(R), R;
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
function At(t, c, l) {
|
|
624
|
-
return $e(t, c, l, !0);
|
|
625
|
-
}
|
|
626
|
-
function Ft(t, c, l) {
|
|
627
|
-
return $e(t, c, l, !1);
|
|
628
|
-
}
|
|
629
|
-
var Dt = Ft, zt = At;
|
|
630
|
-
J.Fragment = r, J.jsx = Dt, J.jsxs = zt;
|
|
631
|
-
}()), J;
|
|
632
|
-
}
|
|
633
|
-
process.env.NODE_ENV === "production" ? pe.exports = Gt() : pe.exports = Jt();
|
|
634
|
-
var ve = pe.exports;
|
|
635
|
-
const st = W.createContext(null);
|
|
636
|
-
function Kt() {
|
|
637
|
-
var e;
|
|
638
|
-
const n = (e = U(st)) === null || e === void 0 ? void 0 : e.maps, o = U(H);
|
|
639
|
-
return z(() => ({ ...n, current: o == null ? void 0 : o.map }), [n, o]);
|
|
640
|
-
}
|
|
641
|
-
function Qt(e) {
|
|
642
|
-
const n = e.clone();
|
|
643
|
-
return n.pixelsToGLUnits = e.pixelsToGLUnits, n;
|
|
644
|
-
}
|
|
645
|
-
function qe(e) {
|
|
646
|
-
return {
|
|
647
|
-
longitude: e.center.lng,
|
|
648
|
-
latitude: e.center.lat,
|
|
649
|
-
zoom: e.zoom,
|
|
650
|
-
pitch: e.pitch,
|
|
651
|
-
bearing: e.bearing,
|
|
652
|
-
padding: e.padding
|
|
653
|
-
};
|
|
654
|
-
}
|
|
655
|
-
function Ze(e, n) {
|
|
656
|
-
const o = n.viewState || n;
|
|
657
|
-
let r = !1;
|
|
658
|
-
if ("longitude" in o && "latitude" in o) {
|
|
659
|
-
const a = e.center;
|
|
660
|
-
e.center = new a.constructor(o.longitude, o.latitude), r = r || a !== e.center;
|
|
661
|
-
}
|
|
662
|
-
if ("zoom" in o) {
|
|
663
|
-
const a = e.zoom;
|
|
664
|
-
e.zoom = o.zoom, r = r || a !== e.zoom;
|
|
665
|
-
}
|
|
666
|
-
if ("bearing" in o) {
|
|
667
|
-
const a = e.bearing;
|
|
668
|
-
e.bearing = o.bearing, r = r || a !== e.bearing;
|
|
669
|
-
}
|
|
670
|
-
if ("pitch" in o) {
|
|
671
|
-
const a = e.pitch;
|
|
672
|
-
e.pitch = o.pitch, r = r || a !== e.pitch;
|
|
673
|
-
}
|
|
674
|
-
return o.padding && !e.isPaddingEqual(o.padding) && (r = !0, e.padding = o.padding), r;
|
|
675
|
-
}
|
|
676
|
-
const Xt = ["type", "source", "source-layer", "minzoom", "maxzoom", "filter", "layout"];
|
|
677
|
-
function Ge(e) {
|
|
678
|
-
if (!e)
|
|
679
|
-
return null;
|
|
680
|
-
if (typeof e == "string" || ("toJS" in e && (e = e.toJS()), !e.layers))
|
|
681
|
-
return e;
|
|
682
|
-
const n = {};
|
|
683
|
-
for (const r of e.layers)
|
|
684
|
-
n[r.id] = r;
|
|
685
|
-
const o = e.layers.map((r) => {
|
|
686
|
-
let a = null;
|
|
687
|
-
"interactive" in r && (a = Object.assign({}, r), delete a.interactive);
|
|
688
|
-
const i = n[r.ref];
|
|
689
|
-
if (i) {
|
|
690
|
-
a = a || Object.assign({}, r), delete a.ref;
|
|
691
|
-
for (const s of Xt)
|
|
692
|
-
s in i && (a[s] = i[s]);
|
|
693
|
-
}
|
|
694
|
-
return a || r;
|
|
695
|
-
});
|
|
696
|
-
return { ...e, layers: o };
|
|
697
|
-
}
|
|
698
|
-
function en(e, n) {
|
|
699
|
-
const o = Array.isArray(e) ? e[0] : e ? e.x : 0, r = Array.isArray(e) ? e[1] : e ? e.y : 0, a = Array.isArray(n) ? n[0] : n ? n.x : 0, i = Array.isArray(n) ? n[1] : n ? n.y : 0;
|
|
700
|
-
return o === a && r === i;
|
|
701
|
-
}
|
|
702
|
-
function P(e, n) {
|
|
703
|
-
if (e === n)
|
|
704
|
-
return !0;
|
|
705
|
-
if (!e || !n)
|
|
706
|
-
return !1;
|
|
707
|
-
if (Array.isArray(e)) {
|
|
708
|
-
if (!Array.isArray(n) || e.length !== n.length)
|
|
709
|
-
return !1;
|
|
710
|
-
for (let o = 0; o < e.length; o++)
|
|
711
|
-
if (!P(e[o], n[o]))
|
|
712
|
-
return !1;
|
|
713
|
-
return !0;
|
|
714
|
-
} else if (Array.isArray(n))
|
|
715
|
-
return !1;
|
|
716
|
-
if (typeof e == "object" && typeof n == "object") {
|
|
717
|
-
const o = Object.keys(e), r = Object.keys(n);
|
|
718
|
-
if (o.length !== r.length)
|
|
719
|
-
return !1;
|
|
720
|
-
for (const a of o)
|
|
721
|
-
if (!n.hasOwnProperty(a) || !P(e[a], n[a]))
|
|
722
|
-
return !1;
|
|
723
|
-
return !0;
|
|
724
|
-
}
|
|
725
|
-
return !1;
|
|
726
|
-
}
|
|
727
|
-
const Je = { version: 8, sources: {}, layers: [] }, Ke = {
|
|
728
|
-
mousedown: "onMouseDown",
|
|
729
|
-
mouseup: "onMouseUp",
|
|
730
|
-
mouseover: "onMouseOver",
|
|
731
|
-
mousemove: "onMouseMove",
|
|
732
|
-
click: "onClick",
|
|
733
|
-
dblclick: "onDblClick",
|
|
734
|
-
mouseenter: "onMouseEnter",
|
|
735
|
-
mouseleave: "onMouseLeave",
|
|
736
|
-
mouseout: "onMouseOut",
|
|
737
|
-
contextmenu: "onContextMenu",
|
|
738
|
-
touchstart: "onTouchStart",
|
|
739
|
-
touchend: "onTouchEnd",
|
|
740
|
-
touchmove: "onTouchMove",
|
|
741
|
-
touchcancel: "onTouchCancel"
|
|
742
|
-
}, he = {
|
|
743
|
-
movestart: "onMoveStart",
|
|
744
|
-
move: "onMove",
|
|
745
|
-
moveend: "onMoveEnd",
|
|
746
|
-
dragstart: "onDragStart",
|
|
747
|
-
drag: "onDrag",
|
|
748
|
-
dragend: "onDragEnd",
|
|
749
|
-
zoomstart: "onZoomStart",
|
|
750
|
-
zoom: "onZoom",
|
|
751
|
-
zoomend: "onZoomEnd",
|
|
752
|
-
rotatestart: "onRotateStart",
|
|
753
|
-
rotate: "onRotate",
|
|
754
|
-
rotateend: "onRotateEnd",
|
|
755
|
-
pitchstart: "onPitchStart",
|
|
756
|
-
pitch: "onPitch",
|
|
757
|
-
pitchend: "onPitchEnd"
|
|
758
|
-
}, Qe = {
|
|
759
|
-
wheel: "onWheel",
|
|
760
|
-
boxzoomstart: "onBoxZoomStart",
|
|
761
|
-
boxzoomend: "onBoxZoomEnd",
|
|
762
|
-
boxzoomcancel: "onBoxZoomCancel",
|
|
763
|
-
resize: "onResize",
|
|
764
|
-
load: "onLoad",
|
|
765
|
-
render: "onRender",
|
|
766
|
-
idle: "onIdle",
|
|
767
|
-
remove: "onRemove",
|
|
768
|
-
data: "onData",
|
|
769
|
-
styledata: "onStyleData",
|
|
770
|
-
sourcedata: "onSourceData",
|
|
771
|
-
error: "onError"
|
|
772
|
-
}, tn = [
|
|
773
|
-
"minZoom",
|
|
774
|
-
"maxZoom",
|
|
775
|
-
"minPitch",
|
|
776
|
-
"maxPitch",
|
|
777
|
-
"maxBounds",
|
|
778
|
-
"projection",
|
|
779
|
-
"renderWorldCopies"
|
|
780
|
-
], nn = [
|
|
781
|
-
"scrollZoom",
|
|
782
|
-
"boxZoom",
|
|
783
|
-
"dragRotate",
|
|
784
|
-
"dragPan",
|
|
785
|
-
"keyboard",
|
|
786
|
-
"doubleClickZoom",
|
|
787
|
-
"touchZoomRotate",
|
|
788
|
-
"touchPitch"
|
|
789
|
-
];
|
|
790
|
-
class B {
|
|
791
|
-
constructor(n, o, r) {
|
|
792
|
-
this._map = null, this._internalUpdate = !1, this._inRender = !1, this._hoveredFeatures = null, this._deferredEvents = {
|
|
793
|
-
move: !1,
|
|
794
|
-
zoom: !1,
|
|
795
|
-
pitch: !1,
|
|
796
|
-
rotate: !1
|
|
797
|
-
}, this._onEvent = (a) => {
|
|
798
|
-
const i = this.props[Qe[a.type]];
|
|
799
|
-
i ? i(a) : a.type === "error" && console.error(a.error);
|
|
800
|
-
}, this._onPointerEvent = (a) => {
|
|
801
|
-
(a.type === "mousemove" || a.type === "mouseout") && this._updateHover(a);
|
|
802
|
-
const i = this.props[Ke[a.type]];
|
|
803
|
-
i && (this.props.interactiveLayerIds && a.type !== "mouseover" && a.type !== "mouseout" && (a.features = this._hoveredFeatures || this._queryRenderedFeatures(a.point)), i(a), delete a.features);
|
|
804
|
-
}, this._onCameraEvent = (a) => {
|
|
805
|
-
if (!this._internalUpdate) {
|
|
806
|
-
const i = this.props[he[a.type]];
|
|
807
|
-
i && i(a);
|
|
808
|
-
}
|
|
809
|
-
a.type in this._deferredEvents && (this._deferredEvents[a.type] = !1);
|
|
810
|
-
}, this._MapClass = n, this.props = o, this._initialize(r);
|
|
811
|
-
}
|
|
812
|
-
get map() {
|
|
813
|
-
return this._map;
|
|
814
|
-
}
|
|
815
|
-
get transform() {
|
|
816
|
-
return this._renderTransform;
|
|
817
|
-
}
|
|
818
|
-
setProps(n) {
|
|
819
|
-
const o = this.props;
|
|
820
|
-
this.props = n;
|
|
821
|
-
const r = this._updateSettings(n, o);
|
|
822
|
-
r && this._createShadowTransform(this._map);
|
|
823
|
-
const a = this._updateSize(n), i = this._updateViewState(n, !0);
|
|
824
|
-
this._updateStyle(n, o), this._updateStyleComponents(n, o), this._updateHandlers(n, o), (r || a || i && !this._map.isMoving()) && this.redraw();
|
|
825
|
-
}
|
|
826
|
-
static reuse(n, o) {
|
|
827
|
-
const r = B.savedMaps.pop();
|
|
828
|
-
if (!r)
|
|
829
|
-
return null;
|
|
830
|
-
const a = r.map, i = a.getContainer();
|
|
831
|
-
for (o.className = i.className; i.childNodes.length > 0; )
|
|
832
|
-
o.appendChild(i.childNodes[0]);
|
|
833
|
-
a._container = o;
|
|
834
|
-
const s = a._resizeObserver;
|
|
835
|
-
s && (s.disconnect(), s.observe(o)), r.setProps({ ...n, styleDiffing: !1 }), a.resize();
|
|
836
|
-
const { initialViewState: f } = n;
|
|
837
|
-
return f && (f.bounds ? a.fitBounds(f.bounds, { ...f.fitBoundsOptions, duration: 0 }) : r._updateViewState(f, !1)), a.isStyleLoaded() ? a.fire("load") : a.once("styledata", () => a.fire("load")), a._update(), r;
|
|
838
|
-
}
|
|
839
|
-
/* eslint-disable complexity,max-statements */
|
|
840
|
-
_initialize(n) {
|
|
841
|
-
const { props: o } = this, { mapStyle: r = Je } = o, a = {
|
|
842
|
-
...o,
|
|
843
|
-
...o.initialViewState,
|
|
844
|
-
accessToken: o.mapboxAccessToken || rn() || null,
|
|
845
|
-
container: n,
|
|
846
|
-
style: Ge(r)
|
|
847
|
-
}, i = a.initialViewState || a.viewState || a;
|
|
848
|
-
if (Object.assign(a, {
|
|
849
|
-
center: [i.longitude || 0, i.latitude || 0],
|
|
850
|
-
zoom: i.zoom || 0,
|
|
851
|
-
pitch: i.pitch || 0,
|
|
852
|
-
bearing: i.bearing || 0
|
|
853
|
-
}), o.gl) {
|
|
854
|
-
const m = HTMLCanvasElement.prototype.getContext;
|
|
855
|
-
HTMLCanvasElement.prototype.getContext = () => (HTMLCanvasElement.prototype.getContext = m, o.gl);
|
|
856
|
-
}
|
|
857
|
-
const s = new this._MapClass(a);
|
|
858
|
-
i.padding && s.setPadding(i.padding), o.cursor && (s.getCanvas().style.cursor = o.cursor), this._createShadowTransform(s);
|
|
859
|
-
const f = s._render;
|
|
860
|
-
s._render = (m) => {
|
|
861
|
-
this._inRender = !0, f.call(s, m), this._inRender = !1;
|
|
862
|
-
};
|
|
863
|
-
const u = s._renderTaskQueue.run;
|
|
864
|
-
s._renderTaskQueue.run = (m) => {
|
|
865
|
-
u.call(s._renderTaskQueue, m), this._onBeforeRepaint();
|
|
866
|
-
}, s.on("render", () => this._onAfterRepaint());
|
|
867
|
-
const d = s.fire;
|
|
868
|
-
s.fire = this._fireEvent.bind(this, d), s.on("resize", () => {
|
|
869
|
-
this._renderTransform.resize(s.transform.width, s.transform.height);
|
|
870
|
-
}), s.on("styledata", () => this._updateStyleComponents(this.props, {})), s.on("sourcedata", () => this._updateStyleComponents(this.props, {}));
|
|
871
|
-
for (const m in Ke)
|
|
872
|
-
s.on(m, this._onPointerEvent);
|
|
873
|
-
for (const m in he)
|
|
874
|
-
s.on(m, this._onCameraEvent);
|
|
875
|
-
for (const m in Qe)
|
|
876
|
-
s.on(m, this._onEvent);
|
|
877
|
-
this._map = s;
|
|
878
|
-
}
|
|
879
|
-
/* eslint-enable complexity,max-statements */
|
|
880
|
-
recycle() {
|
|
881
|
-
const o = this.map.getContainer().querySelector("[mapboxgl-children]");
|
|
882
|
-
o == null || o.remove(), B.savedMaps.push(this);
|
|
883
|
-
}
|
|
884
|
-
destroy() {
|
|
885
|
-
this._map.remove();
|
|
886
|
-
}
|
|
887
|
-
// Force redraw the map now. Typically resize() and jumpTo() is reflected in the next
|
|
888
|
-
// render cycle, which is managed by Mapbox's animation loop.
|
|
889
|
-
// This removes the synchronization issue caused by requestAnimationFrame.
|
|
890
|
-
redraw() {
|
|
891
|
-
const n = this._map;
|
|
892
|
-
!this._inRender && n.style && (n._frame && (n._frame.cancel(), n._frame = null), n._render());
|
|
893
|
-
}
|
|
894
|
-
_createShadowTransform(n) {
|
|
895
|
-
const o = Qt(n.transform);
|
|
896
|
-
n.painter.transform = o, this._renderTransform = o;
|
|
897
|
-
}
|
|
898
|
-
/* Trigger map resize if size is controlled
|
|
899
|
-
@param {object} nextProps
|
|
900
|
-
@returns {bool} true if size has changed
|
|
901
|
-
*/
|
|
902
|
-
_updateSize(n) {
|
|
903
|
-
const { viewState: o } = n;
|
|
904
|
-
if (o) {
|
|
905
|
-
const r = this._map;
|
|
906
|
-
if (o.width !== r.transform.width || o.height !== r.transform.height)
|
|
907
|
-
return r.resize(), !0;
|
|
908
|
-
}
|
|
909
|
-
return !1;
|
|
910
|
-
}
|
|
911
|
-
// Adapted from map.jumpTo
|
|
912
|
-
/* Update camera to match props
|
|
913
|
-
@param {object} nextProps
|
|
914
|
-
@param {bool} triggerEvents - should fire camera events
|
|
915
|
-
@returns {bool} true if anything is changed
|
|
916
|
-
*/
|
|
917
|
-
_updateViewState(n, o) {
|
|
918
|
-
if (this._internalUpdate)
|
|
919
|
-
return !1;
|
|
920
|
-
const r = this._map, a = this._renderTransform, { zoom: i, pitch: s, bearing: f } = a, u = r.isMoving();
|
|
921
|
-
u && (a.cameraElevationReference = "sea");
|
|
922
|
-
const d = Ze(a, {
|
|
923
|
-
...qe(r.transform),
|
|
924
|
-
...n
|
|
925
|
-
});
|
|
926
|
-
if (u && (a.cameraElevationReference = "ground"), d && o) {
|
|
927
|
-
const m = this._deferredEvents;
|
|
928
|
-
m.move = !0, m.zoom || (m.zoom = i !== a.zoom), m.rotate || (m.rotate = f !== a.bearing), m.pitch || (m.pitch = s !== a.pitch);
|
|
929
|
-
}
|
|
930
|
-
return u || Ze(r.transform, n), d;
|
|
931
|
-
}
|
|
932
|
-
/* Update camera constraints and projection settings to match props
|
|
933
|
-
@param {object} nextProps
|
|
934
|
-
@param {object} currProps
|
|
935
|
-
@returns {bool} true if anything is changed
|
|
936
|
-
*/
|
|
937
|
-
_updateSettings(n, o) {
|
|
938
|
-
const r = this._map;
|
|
939
|
-
let a = !1;
|
|
940
|
-
for (const i of tn)
|
|
941
|
-
if (i in n && !P(n[i], o[i])) {
|
|
942
|
-
a = !0;
|
|
943
|
-
const s = r[`set${i[0].toUpperCase()}${i.slice(1)}`];
|
|
944
|
-
s == null || s(n[i]);
|
|
945
|
-
}
|
|
946
|
-
return a;
|
|
947
|
-
}
|
|
948
|
-
/* Update map style to match props
|
|
949
|
-
@param {object} nextProps
|
|
950
|
-
@param {object} currProps
|
|
951
|
-
@returns {bool} true if style is changed
|
|
952
|
-
*/
|
|
953
|
-
_updateStyle(n, o) {
|
|
954
|
-
if (n.cursor !== o.cursor && (this._map.getCanvas().style.cursor = n.cursor), n.mapStyle !== o.mapStyle) {
|
|
955
|
-
const { mapStyle: r = Je, styleDiffing: a = !0 } = n, i = {
|
|
956
|
-
diff: a
|
|
957
|
-
};
|
|
958
|
-
return "localIdeographFontFamily" in n && (i.localIdeographFontFamily = n.localIdeographFontFamily), this._map.setStyle(Ge(r), i), !0;
|
|
959
|
-
}
|
|
960
|
-
return !1;
|
|
961
|
-
}
|
|
962
|
-
/* Update fog, light and terrain to match props
|
|
963
|
-
@param {object} nextProps
|
|
964
|
-
@param {object} currProps
|
|
965
|
-
@returns {bool} true if anything is changed
|
|
966
|
-
*/
|
|
967
|
-
_updateStyleComponents(n, o) {
|
|
968
|
-
const r = this._map;
|
|
969
|
-
let a = !1;
|
|
970
|
-
return r.isStyleLoaded() && ("light" in n && r.setLight && !P(n.light, o.light) && (a = !0, r.setLight(n.light)), "fog" in n && r.setFog && !P(n.fog, o.fog) && (a = !0, r.setFog(n.fog)), "terrain" in n && r.setTerrain && !P(n.terrain, o.terrain) && (!n.terrain || r.getSource(n.terrain.source)) && (a = !0, r.setTerrain(n.terrain))), a;
|
|
971
|
-
}
|
|
972
|
-
/* Update interaction handlers to match props
|
|
973
|
-
@param {object} nextProps
|
|
974
|
-
@param {object} currProps
|
|
975
|
-
@returns {bool} true if anything is changed
|
|
976
|
-
*/
|
|
977
|
-
_updateHandlers(n, o) {
|
|
978
|
-
var r, a;
|
|
979
|
-
const i = this._map;
|
|
980
|
-
let s = !1;
|
|
981
|
-
for (const f of nn) {
|
|
982
|
-
const u = (r = n[f]) !== null && r !== void 0 ? r : !0, d = (a = o[f]) !== null && a !== void 0 ? a : !0;
|
|
983
|
-
P(u, d) || (s = !0, u ? i[f].enable(u) : i[f].disable());
|
|
984
|
-
}
|
|
985
|
-
return s;
|
|
986
|
-
}
|
|
987
|
-
_queryRenderedFeatures(n) {
|
|
988
|
-
const o = this._map, { interactiveLayerIds: r = [] } = this.props;
|
|
989
|
-
try {
|
|
990
|
-
return o.queryRenderedFeatures(n, {
|
|
991
|
-
layers: r.filter(o.getLayer.bind(o))
|
|
992
|
-
});
|
|
993
|
-
} catch {
|
|
994
|
-
return [];
|
|
995
|
-
}
|
|
996
|
-
}
|
|
997
|
-
_updateHover(n) {
|
|
998
|
-
var o;
|
|
999
|
-
const { props: r } = this;
|
|
1000
|
-
if (r.interactiveLayerIds && (r.onMouseMove || r.onMouseEnter || r.onMouseLeave)) {
|
|
1001
|
-
const i = n.type, s = ((o = this._hoveredFeatures) === null || o === void 0 ? void 0 : o.length) > 0, f = this._queryRenderedFeatures(n.point), u = f.length > 0;
|
|
1002
|
-
!u && s && (n.type = "mouseleave", this._onPointerEvent(n)), this._hoveredFeatures = f, u && !s && (n.type = "mouseenter", this._onPointerEvent(n)), n.type = i;
|
|
1003
|
-
} else
|
|
1004
|
-
this._hoveredFeatures = null;
|
|
1005
|
-
}
|
|
1006
|
-
_fireEvent(n, o, r) {
|
|
1007
|
-
const a = this._map, i = a.transform, s = typeof o == "string" ? o : o.type;
|
|
1008
|
-
return s === "move" && this._updateViewState(this.props, !1), s in he && (typeof o == "object" && (o.viewState = qe(i)), this._map.isMoving()) ? (a.transform = this._renderTransform, n.call(a, o, r), a.transform = i, a) : (n.call(a, o, r), a);
|
|
1009
|
-
}
|
|
1010
|
-
// All camera manipulations are complete, ready to repaint
|
|
1011
|
-
_onBeforeRepaint() {
|
|
1012
|
-
const n = this._map;
|
|
1013
|
-
this._internalUpdate = !0;
|
|
1014
|
-
for (const r in this._deferredEvents)
|
|
1015
|
-
this._deferredEvents[r] && n.fire(r);
|
|
1016
|
-
this._internalUpdate = !1;
|
|
1017
|
-
const o = this._map.transform;
|
|
1018
|
-
this._map.transform = this._renderTransform, this._onAfterRepaint = () => {
|
|
1019
|
-
this._map.transform = o;
|
|
1020
|
-
};
|
|
1021
|
-
}
|
|
1022
|
-
}
|
|
1023
|
-
B.savedMaps = [];
|
|
1024
|
-
function rn() {
|
|
1025
|
-
let e = null;
|
|
1026
|
-
if (typeof location < "u") {
|
|
1027
|
-
const n = /access_token=([^&\/]*)/.exec(location.search);
|
|
1028
|
-
e = n && n[1];
|
|
1029
|
-
}
|
|
1030
|
-
try {
|
|
1031
|
-
e = e || process.env.MapboxAccessToken;
|
|
1032
|
-
} catch {
|
|
1033
|
-
}
|
|
1034
|
-
try {
|
|
1035
|
-
e = e || process.env.REACT_APP_MAPBOX_ACCESS_TOKEN;
|
|
1036
|
-
} catch {
|
|
1037
|
-
}
|
|
1038
|
-
return e;
|
|
1039
|
-
}
|
|
1040
|
-
const on = [
|
|
1041
|
-
"setMaxBounds",
|
|
1042
|
-
"setMinZoom",
|
|
1043
|
-
"setMaxZoom",
|
|
1044
|
-
"setMinPitch",
|
|
1045
|
-
"setMaxPitch",
|
|
1046
|
-
"setRenderWorldCopies",
|
|
1047
|
-
"setProjection",
|
|
1048
|
-
"setStyle",
|
|
1049
|
-
"addSource",
|
|
1050
|
-
"removeSource",
|
|
1051
|
-
"addLayer",
|
|
1052
|
-
"removeLayer",
|
|
1053
|
-
"setLayerZoomRange",
|
|
1054
|
-
"setFilter",
|
|
1055
|
-
"setPaintProperty",
|
|
1056
|
-
"setLayoutProperty",
|
|
1057
|
-
"setLight",
|
|
1058
|
-
"setTerrain",
|
|
1059
|
-
"setFog",
|
|
1060
|
-
"remove"
|
|
1061
|
-
];
|
|
1062
|
-
function an(e) {
|
|
1063
|
-
if (!e)
|
|
1064
|
-
return null;
|
|
1065
|
-
const n = e.map, o = {
|
|
1066
|
-
getMap: () => n,
|
|
1067
|
-
// Overwrite getters to use our shadow transform
|
|
1068
|
-
getCenter: () => e.transform.center,
|
|
1069
|
-
getZoom: () => e.transform.zoom,
|
|
1070
|
-
getBearing: () => e.transform.bearing,
|
|
1071
|
-
getPitch: () => e.transform.pitch,
|
|
1072
|
-
getPadding: () => e.transform.padding,
|
|
1073
|
-
getBounds: () => e.transform.getBounds(),
|
|
1074
|
-
project: (r) => {
|
|
1075
|
-
const a = n.transform;
|
|
1076
|
-
n.transform = e.transform;
|
|
1077
|
-
const i = n.project(r);
|
|
1078
|
-
return n.transform = a, i;
|
|
1079
|
-
},
|
|
1080
|
-
unproject: (r) => {
|
|
1081
|
-
const a = n.transform;
|
|
1082
|
-
n.transform = e.transform;
|
|
1083
|
-
const i = n.unproject(r);
|
|
1084
|
-
return n.transform = a, i;
|
|
1085
|
-
},
|
|
1086
|
-
// options diverge between mapbox and maplibre
|
|
1087
|
-
queryTerrainElevation: (r, a) => {
|
|
1088
|
-
const i = n.transform;
|
|
1089
|
-
n.transform = e.transform;
|
|
1090
|
-
const s = n.queryTerrainElevation(r, a);
|
|
1091
|
-
return n.transform = i, s;
|
|
1092
|
-
}
|
|
1093
|
-
};
|
|
1094
|
-
for (const r of sn(n))
|
|
1095
|
-
!(r in o) && !on.includes(r) && (o[r] = n[r].bind(n));
|
|
1096
|
-
return o;
|
|
1097
|
-
}
|
|
1098
|
-
function sn(e) {
|
|
1099
|
-
const n = /* @__PURE__ */ new Set();
|
|
1100
|
-
let o = e;
|
|
1101
|
-
for (; o; ) {
|
|
1102
|
-
for (const r of Object.getOwnPropertyNames(o))
|
|
1103
|
-
r[0] !== "_" && typeof e[r] == "function" && r !== "fire" && r !== "setEventedParent" && n.add(r);
|
|
1104
|
-
o = Object.getPrototypeOf(o);
|
|
1105
|
-
}
|
|
1106
|
-
return Array.from(n);
|
|
1107
|
-
}
|
|
1108
|
-
const cn = typeof document < "u" ? It : M, un = [
|
|
1109
|
-
"baseApiUrl",
|
|
1110
|
-
"maxParallelImageRequests",
|
|
1111
|
-
"workerClass",
|
|
1112
|
-
"workerCount",
|
|
1113
|
-
"workerUrl"
|
|
1114
|
-
];
|
|
1115
|
-
function ln(e, n) {
|
|
1116
|
-
for (const r of un)
|
|
1117
|
-
r in n && (e[r] = n[r]);
|
|
1118
|
-
const { RTLTextPlugin: o = "https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js" } = n;
|
|
1119
|
-
o && e.getRTLTextPluginStatus && e.getRTLTextPluginStatus() === "unavailable" && e.setRTLTextPlugin(o, (r) => {
|
|
1120
|
-
r && console.error(r);
|
|
1121
|
-
}, !1);
|
|
1122
|
-
}
|
|
1123
|
-
const H = W.createContext(null);
|
|
1124
|
-
function fn(e, n, o) {
|
|
1125
|
-
const r = U(st), [a, i] = _e(null), s = D(), { current: f } = D({ mapLib: null, map: null });
|
|
1126
|
-
M(() => {
|
|
1127
|
-
const m = e.mapLib;
|
|
1128
|
-
let h = !0, C;
|
|
1129
|
-
return Promise.resolve(m || o).then((T) => {
|
|
1130
|
-
if (!h)
|
|
1131
|
-
return;
|
|
1132
|
-
if (!T)
|
|
1133
|
-
throw new Error("Invalid mapLib");
|
|
1134
|
-
const S = "Map" in T ? T : T.default;
|
|
1135
|
-
if (!S.Map)
|
|
1136
|
-
throw new Error("Invalid mapLib");
|
|
1137
|
-
if (ln(S, e), !S.supported || S.supported(e))
|
|
1138
|
-
e.reuseMaps && (C = B.reuse(e, s.current)), C || (C = new B(S.Map, e, s.current)), f.map = an(C), f.mapLib = S, i(C), r == null || r.onMapMount(f.map, e.id);
|
|
1139
|
-
else
|
|
1140
|
-
throw new Error("Map is not supported by this browser");
|
|
1141
|
-
}).catch((T) => {
|
|
1142
|
-
const { onError: S } = e;
|
|
1143
|
-
S ? S({
|
|
1144
|
-
type: "error",
|
|
1145
|
-
target: null,
|
|
1146
|
-
originalEvent: null,
|
|
1147
|
-
error: T
|
|
1148
|
-
}) : console.error(T);
|
|
1149
|
-
}), () => {
|
|
1150
|
-
h = !1, C && (r == null || r.onMapUnmount(e.id), e.reuseMaps ? C.recycle() : C.destroy());
|
|
1151
|
-
};
|
|
1152
|
-
}, []), cn(() => {
|
|
1153
|
-
a && a.setProps(e);
|
|
1154
|
-
}), oe(n, () => f.map, [a]);
|
|
1155
|
-
const u = z(() => ({
|
|
1156
|
-
position: "relative",
|
|
1157
|
-
width: "100%",
|
|
1158
|
-
height: "100%",
|
|
1159
|
-
...e.style
|
|
1160
|
-
}), [e.style]), d = {
|
|
1161
|
-
height: "100%"
|
|
1162
|
-
};
|
|
1163
|
-
return W.createElement("div", { id: e.id, ref: s, style: u }, a && W.createElement(
|
|
1164
|
-
H.Provider,
|
|
1165
|
-
{ value: f },
|
|
1166
|
-
W.createElement("div", { "mapboxgl-children": "", style: d }, e.children)
|
|
1167
|
-
));
|
|
1168
|
-
}
|
|
1169
|
-
const dn = /box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;
|
|
1170
|
-
function V(e, n) {
|
|
1171
|
-
if (!e || !n)
|
|
1172
|
-
return;
|
|
1173
|
-
const o = e.style;
|
|
1174
|
-
for (const r in n) {
|
|
1175
|
-
const a = n[r];
|
|
1176
|
-
Number.isFinite(a) && !dn.test(r) ? o[r] = `${a}px` : o[r] = a;
|
|
1177
|
-
}
|
|
1178
|
-
}
|
|
1179
|
-
function mn(e, n) {
|
|
1180
|
-
const { map: o, mapLib: r } = U(H), a = D({ props: e });
|
|
1181
|
-
a.current.props = e;
|
|
1182
|
-
const i = z(() => {
|
|
1183
|
-
let Q = !1;
|
|
1184
|
-
W.Children.forEach(e.children, (E) => {
|
|
1185
|
-
E && (Q = !0);
|
|
1186
|
-
});
|
|
1187
|
-
const ae = {
|
|
1188
|
-
...e,
|
|
1189
|
-
element: Q ? document.createElement("div") : null
|
|
1190
|
-
}, L = new r.Marker(ae);
|
|
1191
|
-
return L.setLngLat([e.longitude, e.latitude]), L.getElement().addEventListener("click", (E) => {
|
|
1192
|
-
var O, w;
|
|
1193
|
-
(w = (O = a.current.props).onClick) === null || w === void 0 || w.call(O, {
|
|
1194
|
-
type: "click",
|
|
1195
|
-
target: L,
|
|
1196
|
-
originalEvent: E
|
|
1197
|
-
});
|
|
1198
|
-
}), L.on("dragstart", (E) => {
|
|
1199
|
-
var O, w;
|
|
1200
|
-
const j = E;
|
|
1201
|
-
j.lngLat = i.getLngLat(), (w = (O = a.current.props).onDragStart) === null || w === void 0 || w.call(O, j);
|
|
1202
|
-
}), L.on("drag", (E) => {
|
|
1203
|
-
var O, w;
|
|
1204
|
-
const j = E;
|
|
1205
|
-
j.lngLat = i.getLngLat(), (w = (O = a.current.props).onDrag) === null || w === void 0 || w.call(O, j);
|
|
1206
|
-
}), L.on("dragend", (E) => {
|
|
1207
|
-
var O, w;
|
|
1208
|
-
const j = E;
|
|
1209
|
-
j.lngLat = i.getLngLat(), (w = (O = a.current.props).onDragEnd) === null || w === void 0 || w.call(O, j);
|
|
1210
|
-
}), L;
|
|
1211
|
-
}, []);
|
|
1212
|
-
M(() => (i.addTo(o.getMap()), () => {
|
|
1213
|
-
i.remove();
|
|
1214
|
-
}), []);
|
|
1215
|
-
const { longitude: s, latitude: f, offset: u, style: d, draggable: m = !1, popup: h = null, rotation: C = 0, rotationAlignment: T = "auto", pitchAlignment: S = "auto" } = e;
|
|
1216
|
-
return M(() => {
|
|
1217
|
-
V(i.getElement(), d);
|
|
1218
|
-
}, [d]), oe(n, () => i, []), (i.getLngLat().lng !== s || i.getLngLat().lat !== f) && i.setLngLat([s, f]), u && !en(i.getOffset(), u) && i.setOffset(u), i.isDraggable() !== m && i.setDraggable(m), i.getRotation() !== C && i.setRotation(C), i.getRotationAlignment() !== T && i.setRotationAlignment(T), i.getPitchAlignment() !== S && i.setPitchAlignment(S), i.getPopup() !== h && i.setPopup(h), at(e.children, i.getElement());
|
|
1219
|
-
}
|
|
1220
|
-
I(Ee(mn));
|
|
1221
|
-
function Xe(e) {
|
|
1222
|
-
return new Set(e ? e.trim().split(/\s+/) : []);
|
|
1223
|
-
}
|
|
1224
|
-
function vn(e, n) {
|
|
1225
|
-
const { map: o, mapLib: r } = U(H), a = z(() => document.createElement("div"), []), i = D({ props: e });
|
|
1226
|
-
i.current.props = e;
|
|
1227
|
-
const s = z(() => {
|
|
1228
|
-
const f = { ...e }, u = new r.Popup(f);
|
|
1229
|
-
return u.setLngLat([e.longitude, e.latitude]), u.once("open", (d) => {
|
|
1230
|
-
var m, h;
|
|
1231
|
-
(h = (m = i.current.props).onOpen) === null || h === void 0 || h.call(m, d);
|
|
1232
|
-
}), u;
|
|
1233
|
-
}, []);
|
|
1234
|
-
if (M(() => {
|
|
1235
|
-
const f = (u) => {
|
|
1236
|
-
var d, m;
|
|
1237
|
-
(m = (d = i.current.props).onClose) === null || m === void 0 || m.call(d, u);
|
|
1238
|
-
};
|
|
1239
|
-
return s.on("close", f), s.setDOMContent(a).addTo(o.getMap()), () => {
|
|
1240
|
-
s.off("close", f), s.isOpen() && s.remove();
|
|
1241
|
-
};
|
|
1242
|
-
}, []), M(() => {
|
|
1243
|
-
V(s.getElement(), e.style);
|
|
1244
|
-
}, [e.style]), oe(n, () => s, []), s.isOpen() && ((s.getLngLat().lng !== e.longitude || s.getLngLat().lat !== e.latitude) && s.setLngLat([e.longitude, e.latitude]), e.offset && !P(s.options.offset, e.offset) && s.setOffset(e.offset), (s.options.anchor !== e.anchor || s.options.maxWidth !== e.maxWidth) && (s.options.anchor = e.anchor, s.setMaxWidth(e.maxWidth)), s.options.className !== e.className)) {
|
|
1245
|
-
const f = Xe(s.options.className), u = Xe(e.className);
|
|
1246
|
-
for (const d of f)
|
|
1247
|
-
u.has(d) || s.removeClassName(d);
|
|
1248
|
-
for (const d of u)
|
|
1249
|
-
f.has(d) || s.addClassName(d);
|
|
1250
|
-
s.options.className = e.className;
|
|
1251
|
-
}
|
|
1252
|
-
return at(e.children, a);
|
|
1253
|
-
}
|
|
1254
|
-
I(Ee(vn));
|
|
1255
|
-
function K(e, n, o, r) {
|
|
1256
|
-
const a = U(H), i = z(() => e(a), []);
|
|
1257
|
-
return M(() => {
|
|
1258
|
-
const s = r || o || n, f = typeof n == "function" && typeof o == "function" ? n : null, u = typeof o == "function" ? o : typeof n == "function" ? n : null, { map: d } = a;
|
|
1259
|
-
return d.hasControl(i) || (d.addControl(i, s == null ? void 0 : s.position), f && f(a)), () => {
|
|
1260
|
-
u && u(a), d.hasControl(i) && d.removeControl(i);
|
|
1261
|
-
};
|
|
1262
|
-
}, []), i;
|
|
1263
|
-
}
|
|
1264
|
-
function hn(e) {
|
|
1265
|
-
const n = K(({ mapLib: o }) => new o.AttributionControl(e), {
|
|
1266
|
-
position: e.position
|
|
1267
|
-
});
|
|
1268
|
-
return M(() => {
|
|
1269
|
-
V(n._container, e.style);
|
|
1270
|
-
}, [e.style]), null;
|
|
1271
|
-
}
|
|
1272
|
-
I(hn);
|
|
1273
|
-
function gn(e) {
|
|
1274
|
-
const n = K(({ mapLib: o }) => new o.FullscreenControl({
|
|
1275
|
-
container: e.containerId && document.getElementById(e.containerId)
|
|
1276
|
-
}), { position: e.position });
|
|
1277
|
-
return M(() => {
|
|
1278
|
-
V(n._controlContainer, e.style);
|
|
1279
|
-
}, [e.style]), null;
|
|
1280
|
-
}
|
|
1281
|
-
I(gn);
|
|
1282
|
-
function pn(e, n) {
|
|
1283
|
-
const o = D({ props: e }), r = K(({ mapLib: a }) => {
|
|
1284
|
-
const i = new a.GeolocateControl(e), s = i._setupUI;
|
|
1285
|
-
return i._setupUI = (f) => {
|
|
1286
|
-
i._container.hasChildNodes() || s(f);
|
|
1287
|
-
}, i.on("geolocate", (f) => {
|
|
1288
|
-
var u, d;
|
|
1289
|
-
(d = (u = o.current.props).onGeolocate) === null || d === void 0 || d.call(u, f);
|
|
1290
|
-
}), i.on("error", (f) => {
|
|
1291
|
-
var u, d;
|
|
1292
|
-
(d = (u = o.current.props).onError) === null || d === void 0 || d.call(u, f);
|
|
1293
|
-
}), i.on("outofmaxbounds", (f) => {
|
|
1294
|
-
var u, d;
|
|
1295
|
-
(d = (u = o.current.props).onOutOfMaxBounds) === null || d === void 0 || d.call(u, f);
|
|
1296
|
-
}), i.on("trackuserlocationstart", (f) => {
|
|
1297
|
-
var u, d;
|
|
1298
|
-
(d = (u = o.current.props).onTrackUserLocationStart) === null || d === void 0 || d.call(u, f);
|
|
1299
|
-
}), i.on("trackuserlocationend", (f) => {
|
|
1300
|
-
var u, d;
|
|
1301
|
-
(d = (u = o.current.props).onTrackUserLocationEnd) === null || d === void 0 || d.call(u, f);
|
|
1302
|
-
}), i;
|
|
1303
|
-
}, { position: e.position });
|
|
1304
|
-
return o.current.props = e, oe(n, () => r, []), M(() => {
|
|
1305
|
-
V(r._container, e.style);
|
|
1306
|
-
}, [e.style]), null;
|
|
1307
|
-
}
|
|
1308
|
-
I(Ee(pn));
|
|
1309
|
-
function yn(e) {
|
|
1310
|
-
const n = K(({ mapLib: o }) => new o.NavigationControl(e), {
|
|
1311
|
-
position: e.position
|
|
1312
|
-
});
|
|
1313
|
-
return M(() => {
|
|
1314
|
-
V(n._container, e.style);
|
|
1315
|
-
}, [e.style]), null;
|
|
1316
|
-
}
|
|
1317
|
-
I(yn);
|
|
1318
|
-
function _n(e) {
|
|
1319
|
-
const n = K(({ mapLib: i }) => new i.ScaleControl(e), {
|
|
1320
|
-
position: e.position
|
|
1321
|
-
}), o = D(e), r = o.current;
|
|
1322
|
-
o.current = e;
|
|
1323
|
-
const { style: a } = e;
|
|
1324
|
-
return e.maxWidth !== void 0 && e.maxWidth !== r.maxWidth && (n.options.maxWidth = e.maxWidth), e.unit !== void 0 && e.unit !== r.unit && n.setUnit(e.unit), M(() => {
|
|
1325
|
-
V(n._container, a);
|
|
1326
|
-
}, [a]), null;
|
|
1327
|
-
}
|
|
1328
|
-
I(_n);
|
|
1329
|
-
function et(e, n) {
|
|
1330
|
-
if (!e)
|
|
1331
|
-
throw new Error(n);
|
|
1332
|
-
}
|
|
1333
|
-
function En(e, n, o, r) {
|
|
1334
|
-
if (et(o.id === r.id, "layer id changed"), et(o.type === r.type, "layer type changed"), o.type === "custom" || r.type === "custom")
|
|
1335
|
-
return;
|
|
1336
|
-
const {
|
|
1337
|
-
layout: a = {},
|
|
1338
|
-
paint: i = {},
|
|
1339
|
-
// @ts-expect-error filter is not defined on some layer types
|
|
1340
|
-
filter: s,
|
|
1341
|
-
minzoom: f,
|
|
1342
|
-
maxzoom: u,
|
|
1343
|
-
beforeId: d
|
|
1344
|
-
} = o;
|
|
1345
|
-
if (d !== r.beforeId && e.moveLayer(n, d), a !== r.layout) {
|
|
1346
|
-
const m = r.layout || {};
|
|
1347
|
-
for (const h in a)
|
|
1348
|
-
P(a[h], m[h]) || e.setLayoutProperty(n, h, a[h]);
|
|
1349
|
-
for (const h in m)
|
|
1350
|
-
a.hasOwnProperty(h) || e.setLayoutProperty(n, h, void 0);
|
|
1351
|
-
}
|
|
1352
|
-
if (i !== r.paint) {
|
|
1353
|
-
const m = r.paint || {};
|
|
1354
|
-
for (const h in i)
|
|
1355
|
-
P(i[h], m[h]) || e.setPaintProperty(n, h, i[h]);
|
|
1356
|
-
for (const h in m)
|
|
1357
|
-
i.hasOwnProperty(h) || e.setPaintProperty(n, h, void 0);
|
|
1358
|
-
}
|
|
1359
|
-
P(s, r.filter) || e.setFilter(n, s), (f !== r.minzoom || u !== r.maxzoom) && e.setLayerZoomRange(n, f, u);
|
|
1360
|
-
}
|
|
1361
|
-
function bn(e, n, o) {
|
|
1362
|
-
if (e.style && e.style._loaded && (!("source" in o) || e.getSource(o.source))) {
|
|
1363
|
-
const r = { ...o, id: n };
|
|
1364
|
-
delete r.beforeId, e.addLayer(r, o.beforeId);
|
|
1365
|
-
}
|
|
1366
|
-
}
|
|
1367
|
-
let Rn = 0;
|
|
1368
|
-
function Cn(e) {
|
|
1369
|
-
const n = U(H).map.getMap(), o = D(e), [, r] = _e(0), a = z(() => e.id || `jsx-layer-${Rn++}`, []);
|
|
1370
|
-
if (M(() => {
|
|
1371
|
-
if (n) {
|
|
1372
|
-
const s = () => r((f) => f + 1);
|
|
1373
|
-
return n.on("styledata", s), s(), () => {
|
|
1374
|
-
n.off("styledata", s), n.style && n.style._loaded && n.getLayer(a) && n.removeLayer(a);
|
|
1375
|
-
};
|
|
1376
|
-
}
|
|
1377
|
-
}, [n]), n && n.style && n.getLayer(a))
|
|
1378
|
-
try {
|
|
1379
|
-
En(n, a, e, o.current);
|
|
1380
|
-
} catch (s) {
|
|
1381
|
-
console.warn(s);
|
|
1382
|
-
}
|
|
1383
|
-
else
|
|
1384
|
-
bn(n, a, e);
|
|
1385
|
-
return o.current = e, null;
|
|
1386
|
-
}
|
|
1387
|
-
function wn() {
|
|
1388
|
-
return Kt();
|
|
1389
|
-
}
|
|
1390
|
-
const Tn = import("maplibre-gl");
|
|
1391
|
-
W.forwardRef(function(n, o) {
|
|
1392
|
-
return fn(n, o, Tn);
|
|
1393
|
-
});
|
|
1394
|
-
const tt = new Bt(), Sn = new Ht(), nt = new it(), rt = new it(), xn = new qt();
|
|
1395
|
-
function Ln({ longitude: e, latitude: n, altitude: o }) {
|
|
1396
|
-
const r = Zt.fromLngLat([e, n], o), a = r.meterInMercatorCoordinateUnits();
|
|
1397
|
-
return nt.set(r.x, r.y, r.z || 0), rt.set(a, -a, a), tt.setFromEuler(Sn.set(-Math.PI * 0.5, 0, 0)), xn.compose(nt, tt, rt);
|
|
1398
|
-
}
|
|
1399
|
-
const ge = {
|
|
1400
|
-
onClick: ["click", !1],
|
|
1401
|
-
onContextMenu: ["contextmenu", !1],
|
|
1402
|
-
onDoubleClick: ["dblclick", !1],
|
|
1403
|
-
onWheel: ["wheel", !0],
|
|
1404
|
-
onPointerDown: ["pointerdown", !0],
|
|
1405
|
-
onPointerUp: ["pointerup", !0],
|
|
1406
|
-
onPointerLeave: ["pointerleave", !0],
|
|
1407
|
-
onPointerMove: ["pointermove", !0],
|
|
1408
|
-
onPointerCancel: ["pointercancel", !0],
|
|
1409
|
-
onLostPointerCapture: ["lostpointercapture", !0]
|
|
1410
|
-
};
|
|
1411
|
-
function Mn() {
|
|
1412
|
-
return (e) => {
|
|
1413
|
-
const { handlePointer: n } = Ut(e);
|
|
1414
|
-
return {
|
|
1415
|
-
priority: 1,
|
|
1416
|
-
enabled: !0,
|
|
1417
|
-
compute(o, r) {
|
|
1418
|
-
r.size.width = r.gl.domElement.width, r.size.height = r.gl.domElement.height, r.pointer.x = o.offsetX / (r.size.width / window.devicePixelRatio) * 2 - 1, r.pointer.y = 1 - o.offsetY / (r.size.height / window.devicePixelRatio) * 2, r.raycaster.camera = r.camera, r.raycaster.ray.origin.setScalar(0).applyMatrix4(r.camera.projectionMatrixInverse), r.raycaster.ray.direction.set(r.pointer.x, r.pointer.y, 1).applyMatrix4(r.camera.projectionMatrixInverse).sub(r.raycaster.ray.origin).normalize();
|
|
1419
|
-
},
|
|
1420
|
-
connected: void 0,
|
|
1421
|
-
handlers: Object.keys(ge).reduce(
|
|
1422
|
-
(o, r) => ({ ...o, [r]: n(r) }),
|
|
1423
|
-
{}
|
|
1424
|
-
),
|
|
1425
|
-
update: () => {
|
|
1426
|
-
var a;
|
|
1427
|
-
const { events: o, internal: r } = e.getState();
|
|
1428
|
-
(a = r.lastEvent) != null && a.current && o.handlers && o.handlers.onPointerMove(r.lastEvent.current);
|
|
1429
|
-
},
|
|
1430
|
-
connect: (o) => {
|
|
1431
|
-
var i;
|
|
1432
|
-
const { set: r, events: a } = e.getState();
|
|
1433
|
-
(i = a.disconnect) == null || i.call(a), r((s) => ({ events: { ...s.events, connected: o } })), Object.entries(a.handlers ?? []).forEach(([s, f]) => {
|
|
1434
|
-
const [u, d] = ge[s];
|
|
1435
|
-
o.addEventListener(u, f, { passive: d });
|
|
1436
|
-
});
|
|
1437
|
-
},
|
|
1438
|
-
disconnect: () => {
|
|
1439
|
-
const { set: o, events: r } = e.getState();
|
|
1440
|
-
r.connected && (Object.entries(r.handlers ?? []).forEach(([a, i]) => {
|
|
1441
|
-
if (r && r.connected instanceof HTMLElement) {
|
|
1442
|
-
const [s] = ge[a];
|
|
1443
|
-
r.connected.removeEventListener(s, i);
|
|
1444
|
-
}
|
|
1445
|
-
}), o((a) => ({ events: { ...a.events, connected: void 0 } })));
|
|
1446
|
-
}
|
|
1447
|
-
};
|
|
1448
|
-
};
|
|
1449
|
-
}
|
|
1450
|
-
const ye = (e) => {
|
|
1451
|
-
const n = D(e);
|
|
1452
|
-
return n.current = e, Nt((...o) => n.current(...o), []);
|
|
1453
|
-
};
|
|
1454
|
-
function On(e, n) {
|
|
1455
|
-
const [o, r] = _e(!1), a = ye((s, f) => {
|
|
1456
|
-
const u = s.getCanvas(), d = Vt(u);
|
|
1457
|
-
d.configure({
|
|
1458
|
-
frameloop: "never",
|
|
1459
|
-
dpr: window.devicePixelRatio,
|
|
1460
|
-
shadows: !0,
|
|
1461
|
-
events: Mn(),
|
|
1462
|
-
...n,
|
|
1463
|
-
gl: {
|
|
1464
|
-
context: f,
|
|
1465
|
-
depth: !0,
|
|
1466
|
-
autoClear: !1,
|
|
1467
|
-
antialias: !0,
|
|
1468
|
-
...n == null ? void 0 : n.gl
|
|
1469
|
-
},
|
|
1470
|
-
onCreated: (m) => {
|
|
1471
|
-
e.current = {
|
|
1472
|
-
state: m,
|
|
1473
|
-
map: s,
|
|
1474
|
-
root: d
|
|
1475
|
-
}, m.gl.forceContextLoss = () => {
|
|
1476
|
-
};
|
|
1477
|
-
},
|
|
1478
|
-
camera: {
|
|
1479
|
-
matrixAutoUpdate: !1
|
|
1480
|
-
},
|
|
1481
|
-
size: {
|
|
1482
|
-
width: u.clientWidth,
|
|
1483
|
-
height: u.clientHeight,
|
|
1484
|
-
top: 0,
|
|
1485
|
-
left: 0,
|
|
1486
|
-
...n == null ? void 0 : n.size
|
|
1487
|
-
}
|
|
1488
|
-
}), e.current = {
|
|
1489
|
-
map: s,
|
|
1490
|
-
root: d
|
|
1491
|
-
}, setTimeout(() => r(!0));
|
|
1492
|
-
}), i = ye(() => {
|
|
1493
|
-
setTimeout(() => {
|
|
1494
|
-
e.current && e.current.root.unmount();
|
|
1495
|
-
});
|
|
1496
|
-
});
|
|
1497
|
-
return { onAdd: a, onRemove: i, mounted: o };
|
|
1498
|
-
}
|
|
1499
|
-
function kn(e, n) {
|
|
1500
|
-
const o = wn();
|
|
1501
|
-
return ye((a, i) => {
|
|
1502
|
-
var d;
|
|
1503
|
-
if (!o.current || !((d = n.current) != null && d.state))
|
|
1504
|
-
return;
|
|
1505
|
-
const s = n.current.state.camera, f = n.current.state.gl, u = n.current.state.advance;
|
|
1506
|
-
s.projectionMatrix.fromArray(i).multiply(e), s.projectionMatrixInverse.copy(s.projectionMatrix).invert(), f.resetState(), u(Date.now(), !0), o.current.triggerRepaint();
|
|
1507
|
-
});
|
|
1508
|
-
}
|
|
1509
|
-
$t(Yt);
|
|
1510
|
-
const zn = I(({
|
|
1511
|
-
longitude: e,
|
|
1512
|
-
latitude: n,
|
|
1513
|
-
altitude: o = 0,
|
|
1514
|
-
children: r,
|
|
1515
|
-
...a
|
|
1516
|
-
}) => {
|
|
1517
|
-
const i = Wt(), s = D(), f = z(() => Ln({
|
|
1518
|
-
latitude: n,
|
|
1519
|
-
longitude: e,
|
|
1520
|
-
altitude: o
|
|
1521
|
-
}), [n, e, o]), { onAdd: u, onRemove: d, mounted: m } = On(s, a), h = kn(f, s);
|
|
1522
|
-
return M(() => {
|
|
1523
|
-
m && s.current && s.current.root.render(/* @__PURE__ */ ve.jsx(ve.Fragment, { children: r }));
|
|
1524
|
-
}, [s, m, r]), /* @__PURE__ */ ve.jsx(
|
|
1525
|
-
Cn,
|
|
1526
|
-
{
|
|
1527
|
-
id: i,
|
|
1528
|
-
type: "custom",
|
|
1529
|
-
renderingMode: "3d",
|
|
1530
|
-
onAdd: u,
|
|
1531
|
-
onRemove: d,
|
|
1532
|
-
render: h
|
|
1533
|
-
}
|
|
1534
|
-
);
|
|
1535
|
-
});
|
|
1536
|
-
export {
|
|
1537
|
-
zn as Canvas
|
|
1538
|
-
};
|