@tracktor/map 0.3.4 → 0.4.0
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/main.js +205 -200
- package/dist/main.umd.cjs +8 -8
- package/dist/types/MarkerProps.d.ts +2 -1
- package/dist/utils/loadMarkers.d.ts +18 -1
- package/dist/utils/mapOptions.d.ts +2 -2
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -19,15 +19,15 @@ var Ne;
|
|
|
19
19
|
function $r() {
|
|
20
20
|
if (Ne) return Y;
|
|
21
21
|
Ne = 1;
|
|
22
|
-
var r = ue, t = Symbol.for("react.element"), a = Symbol.for("react.fragment"), o = Object.prototype.hasOwnProperty, s = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,
|
|
23
|
-
function
|
|
24
|
-
var
|
|
25
|
-
v !== void 0 && (C = "" + v),
|
|
26
|
-
for (
|
|
27
|
-
if (d && d.defaultProps) for (
|
|
28
|
-
return { $$typeof: t, type: d, key: C, ref: D, props:
|
|
22
|
+
var r = ue, t = Symbol.for("react.element"), a = Symbol.for("react.fragment"), o = Object.prototype.hasOwnProperty, s = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, l = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
23
|
+
function f(d, u, v) {
|
|
24
|
+
var p, E = {}, C = null, D = null;
|
|
25
|
+
v !== void 0 && (C = "" + v), u.key !== void 0 && (C = "" + u.key), u.ref !== void 0 && (D = u.ref);
|
|
26
|
+
for (p in u) o.call(u, p) && !l.hasOwnProperty(p) && (E[p] = u[p]);
|
|
27
|
+
if (d && d.defaultProps) for (p in u = d.defaultProps, u) E[p] === void 0 && (E[p] = u[p]);
|
|
28
|
+
return { $$typeof: t, type: d, key: C, ref: D, props: E, _owner: s.current };
|
|
29
29
|
}
|
|
30
|
-
return Y.Fragment = a, Y.jsx =
|
|
30
|
+
return Y.Fragment = a, Y.jsx = f, Y.jsxs = f, Y;
|
|
31
31
|
}
|
|
32
32
|
var U = {};
|
|
33
33
|
/**
|
|
@@ -42,7 +42,7 @@ var U = {};
|
|
|
42
42
|
var Ie;
|
|
43
43
|
function Wr() {
|
|
44
44
|
return Ie || (Ie = 1, process.env.NODE_ENV !== "production" && function() {
|
|
45
|
-
var r = ue, t = Symbol.for("react.element"), a = Symbol.for("react.portal"), o = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"),
|
|
45
|
+
var r = ue, t = Symbol.for("react.element"), a = Symbol.for("react.portal"), o = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), l = Symbol.for("react.profiler"), f = Symbol.for("react.provider"), d = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), v = Symbol.for("react.suspense"), p = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), C = Symbol.for("react.lazy"), D = Symbol.for("react.offscreen"), G = Symbol.iterator, B = "@@iterator";
|
|
46
46
|
function H(e) {
|
|
47
47
|
if (e === null || typeof e != "object")
|
|
48
48
|
return null;
|
|
@@ -52,34 +52,34 @@ function Wr() {
|
|
|
52
52
|
var w = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
53
53
|
function R(e) {
|
|
54
54
|
{
|
|
55
|
-
for (var n = arguments.length, i = new Array(n > 1 ? n - 1 : 0),
|
|
56
|
-
i[
|
|
55
|
+
for (var n = arguments.length, i = new Array(n > 1 ? n - 1 : 0), c = 1; c < n; c++)
|
|
56
|
+
i[c - 1] = arguments[c];
|
|
57
57
|
S("error", e, i);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
function S(e, n, i) {
|
|
61
61
|
{
|
|
62
|
-
var
|
|
62
|
+
var c = w.ReactDebugCurrentFrame, b = c.getStackAddendum();
|
|
63
63
|
b !== "" && (n += "%s", i = i.concat([b]));
|
|
64
|
-
var
|
|
64
|
+
var h = i.map(function(g) {
|
|
65
65
|
return String(g);
|
|
66
66
|
});
|
|
67
|
-
|
|
67
|
+
h.unshift("Warning: " + n), Function.prototype.apply.call(console[e], console, h);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
var X = !1, N = !1, qe = !1, ze = !1, Je = !1, ce;
|
|
71
71
|
ce = Symbol.for("react.module.reference");
|
|
72
72
|
function Ke(e) {
|
|
73
|
-
return !!(typeof e == "string" || typeof e == "function" || e === o || e ===
|
|
73
|
+
return !!(typeof e == "string" || typeof e == "function" || e === o || e === l || Je || e === s || e === v || e === p || ze || e === D || X || N || qe || typeof e == "object" && e !== null && (e.$$typeof === C || e.$$typeof === E || e.$$typeof === f || e.$$typeof === d || e.$$typeof === u || // This needs to include all possible module reference object
|
|
74
74
|
// types supported by any Flight configuration anywhere since
|
|
75
75
|
// we don't know which Flight build this will end up being used
|
|
76
76
|
// with.
|
|
77
77
|
e.$$typeof === ce || e.getModuleId !== void 0));
|
|
78
78
|
}
|
|
79
79
|
function He(e, n, i) {
|
|
80
|
-
var
|
|
81
|
-
if (
|
|
82
|
-
return
|
|
80
|
+
var c = e.displayName;
|
|
81
|
+
if (c)
|
|
82
|
+
return c;
|
|
83
83
|
var b = n.displayName || n.name || "";
|
|
84
84
|
return b !== "" ? i + "(" + b + ")" : i;
|
|
85
85
|
}
|
|
@@ -98,13 +98,13 @@ function Wr() {
|
|
|
98
98
|
return "Fragment";
|
|
99
99
|
case a:
|
|
100
100
|
return "Portal";
|
|
101
|
-
case
|
|
101
|
+
case l:
|
|
102
102
|
return "Profiler";
|
|
103
103
|
case s:
|
|
104
104
|
return "StrictMode";
|
|
105
105
|
case v:
|
|
106
106
|
return "Suspense";
|
|
107
|
-
case
|
|
107
|
+
case p:
|
|
108
108
|
return "SuspenseList";
|
|
109
109
|
}
|
|
110
110
|
if (typeof e == "object")
|
|
@@ -112,18 +112,18 @@ function Wr() {
|
|
|
112
112
|
case d:
|
|
113
113
|
var n = e;
|
|
114
114
|
return le(n) + ".Consumer";
|
|
115
|
-
case
|
|
115
|
+
case f:
|
|
116
116
|
var i = e;
|
|
117
117
|
return le(i._context) + ".Provider";
|
|
118
|
-
case
|
|
118
|
+
case u:
|
|
119
119
|
return He(e, e.render, "ForwardRef");
|
|
120
|
-
case
|
|
121
|
-
var
|
|
122
|
-
return
|
|
120
|
+
case E:
|
|
121
|
+
var c = e.displayName || null;
|
|
122
|
+
return c !== null ? c : j(e.type) || "Memo";
|
|
123
123
|
case C: {
|
|
124
|
-
var b = e,
|
|
124
|
+
var b = e, h = b._payload, g = b._init;
|
|
125
125
|
try {
|
|
126
|
-
return j(g(
|
|
126
|
+
return j(g(h));
|
|
127
127
|
} catch {
|
|
128
128
|
return null;
|
|
129
129
|
}
|
|
@@ -200,8 +200,8 @@ function Wr() {
|
|
|
200
200
|
try {
|
|
201
201
|
throw Error();
|
|
202
202
|
} catch (b) {
|
|
203
|
-
var
|
|
204
|
-
Q =
|
|
203
|
+
var c = b.stack.trim().match(/\n( *(at )?)/);
|
|
204
|
+
Q = c && c[1] || "";
|
|
205
205
|
}
|
|
206
206
|
return `
|
|
207
207
|
` + Q + e;
|
|
@@ -220,12 +220,12 @@ function Wr() {
|
|
|
220
220
|
if (i !== void 0)
|
|
221
221
|
return i;
|
|
222
222
|
}
|
|
223
|
-
var
|
|
223
|
+
var c;
|
|
224
224
|
ee = !0;
|
|
225
225
|
var b = Error.prepareStackTrace;
|
|
226
226
|
Error.prepareStackTrace = void 0;
|
|
227
|
-
var
|
|
228
|
-
|
|
227
|
+
var h;
|
|
228
|
+
h = Z.current, Z.current = null, Xe();
|
|
229
229
|
try {
|
|
230
230
|
if (n) {
|
|
231
231
|
var g = function() {
|
|
@@ -239,14 +239,14 @@ function Wr() {
|
|
|
239
239
|
try {
|
|
240
240
|
Reflect.construct(g, []);
|
|
241
241
|
} catch (x) {
|
|
242
|
-
|
|
242
|
+
c = x;
|
|
243
243
|
}
|
|
244
244
|
Reflect.construct(e, [], g);
|
|
245
245
|
} else {
|
|
246
246
|
try {
|
|
247
247
|
g.call();
|
|
248
248
|
} catch (x) {
|
|
249
|
-
|
|
249
|
+
c = x;
|
|
250
250
|
}
|
|
251
251
|
e.call(g.prototype);
|
|
252
252
|
}
|
|
@@ -254,31 +254,31 @@ function Wr() {
|
|
|
254
254
|
try {
|
|
255
255
|
throw Error();
|
|
256
256
|
} catch (x) {
|
|
257
|
-
|
|
257
|
+
c = x;
|
|
258
258
|
}
|
|
259
259
|
e();
|
|
260
260
|
}
|
|
261
261
|
} catch (x) {
|
|
262
|
-
if (x &&
|
|
263
|
-
for (var
|
|
264
|
-
`), T =
|
|
265
|
-
`),
|
|
266
|
-
|
|
267
|
-
for (;
|
|
268
|
-
if (
|
|
269
|
-
if (
|
|
262
|
+
if (x && c && typeof x.stack == "string") {
|
|
263
|
+
for (var y = x.stack.split(`
|
|
264
|
+
`), T = c.stack.split(`
|
|
265
|
+
`), _ = y.length - 1, m = T.length - 1; _ >= 1 && m >= 0 && y[_] !== T[m]; )
|
|
266
|
+
m--;
|
|
267
|
+
for (; _ >= 1 && m >= 0; _--, m--)
|
|
268
|
+
if (y[_] !== T[m]) {
|
|
269
|
+
if (_ !== 1 || m !== 1)
|
|
270
270
|
do
|
|
271
|
-
if (
|
|
271
|
+
if (_--, m--, m < 0 || y[_] !== T[m]) {
|
|
272
272
|
var P = `
|
|
273
|
-
` +
|
|
273
|
+
` + y[_].replace(" at new ", " at ");
|
|
274
274
|
return e.displayName && P.includes("<anonymous>") && (P = P.replace("<anonymous>", e.displayName)), typeof e == "function" && q.set(e, P), P;
|
|
275
275
|
}
|
|
276
|
-
while (
|
|
276
|
+
while (_ >= 1 && m >= 0);
|
|
277
277
|
break;
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
} finally {
|
|
281
|
-
ee = !1, Z.current =
|
|
281
|
+
ee = !1, Z.current = h, Ze(), Error.prepareStackTrace = b;
|
|
282
282
|
}
|
|
283
283
|
var M = e ? e.displayName || e.name : "", F = M ? V(M) : "";
|
|
284
284
|
return typeof e == "function" && q.set(e, F), F;
|
|
@@ -300,49 +300,49 @@ function Wr() {
|
|
|
300
300
|
switch (e) {
|
|
301
301
|
case v:
|
|
302
302
|
return V("Suspense");
|
|
303
|
-
case
|
|
303
|
+
case p:
|
|
304
304
|
return V("SuspenseList");
|
|
305
305
|
}
|
|
306
306
|
if (typeof e == "object")
|
|
307
307
|
switch (e.$$typeof) {
|
|
308
|
-
case
|
|
308
|
+
case u:
|
|
309
309
|
return er(e.render);
|
|
310
|
-
case
|
|
310
|
+
case E:
|
|
311
311
|
return z(e.type, n, i);
|
|
312
312
|
case C: {
|
|
313
|
-
var
|
|
313
|
+
var c = e, b = c._payload, h = c._init;
|
|
314
314
|
try {
|
|
315
|
-
return z(
|
|
315
|
+
return z(h(b), n, i);
|
|
316
316
|
} catch {
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
320
|
return "";
|
|
321
321
|
}
|
|
322
|
-
var W = Object.prototype.hasOwnProperty, Re = {},
|
|
322
|
+
var W = Object.prototype.hasOwnProperty, Re = {}, _e = w.ReactDebugCurrentFrame;
|
|
323
323
|
function J(e) {
|
|
324
324
|
if (e) {
|
|
325
325
|
var n = e._owner, i = z(e.type, e._source, n ? n.type : null);
|
|
326
|
-
|
|
326
|
+
_e.setExtraStackFrame(i);
|
|
327
327
|
} else
|
|
328
|
-
|
|
328
|
+
_e.setExtraStackFrame(null);
|
|
329
329
|
}
|
|
330
|
-
function tr(e, n, i,
|
|
330
|
+
function tr(e, n, i, c, b) {
|
|
331
331
|
{
|
|
332
|
-
var
|
|
332
|
+
var h = Function.call.bind(W);
|
|
333
333
|
for (var g in e)
|
|
334
|
-
if (
|
|
335
|
-
var
|
|
334
|
+
if (h(e, g)) {
|
|
335
|
+
var y = void 0;
|
|
336
336
|
try {
|
|
337
337
|
if (typeof e[g] != "function") {
|
|
338
|
-
var T = Error((
|
|
338
|
+
var T = Error((c || "React class") + ": " + i + " type `" + g + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[g] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
339
339
|
throw T.name = "Invariant Violation", T;
|
|
340
340
|
}
|
|
341
|
-
|
|
342
|
-
} catch (
|
|
343
|
-
|
|
341
|
+
y = e[g](n, g, c, i, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
342
|
+
} catch (_) {
|
|
343
|
+
y = _;
|
|
344
344
|
}
|
|
345
|
-
|
|
345
|
+
y && !(y instanceof Error) && (J(b), R("%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).", c || "React class", i, g, typeof y), J(null)), y instanceof Error && !(y.message in Re) && (Re[y.message] = !0, J(b), R("Failed %s type: %s", i, y.message), J(null));
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
348
|
}
|
|
@@ -358,17 +358,17 @@ function Wr() {
|
|
|
358
358
|
}
|
|
359
359
|
function ir(e) {
|
|
360
360
|
try {
|
|
361
|
-
return
|
|
361
|
+
return me(e), !1;
|
|
362
362
|
} catch {
|
|
363
363
|
return !0;
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
|
-
function
|
|
366
|
+
function me(e) {
|
|
367
367
|
return "" + e;
|
|
368
368
|
}
|
|
369
369
|
function Ce(e) {
|
|
370
370
|
if (ir(e))
|
|
371
|
-
return R("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", or(e)),
|
|
371
|
+
return R("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", or(e)), me(e);
|
|
372
372
|
}
|
|
373
373
|
var Te = w.ReactCurrentOwner, ar = {
|
|
374
374
|
key: !0,
|
|
@@ -417,8 +417,8 @@ function Wr() {
|
|
|
417
417
|
});
|
|
418
418
|
}
|
|
419
419
|
}
|
|
420
|
-
var dr = function(e, n, i,
|
|
421
|
-
var
|
|
420
|
+
var dr = function(e, n, i, c, b, h, g) {
|
|
421
|
+
var y = {
|
|
422
422
|
// This tag allows us to uniquely identify this as a React Element
|
|
423
423
|
$$typeof: t,
|
|
424
424
|
// Built-in properties that belong on the element
|
|
@@ -427,41 +427,41 @@ function Wr() {
|
|
|
427
427
|
ref: i,
|
|
428
428
|
props: g,
|
|
429
429
|
// Record the component responsible for creating this element.
|
|
430
|
-
_owner:
|
|
430
|
+
_owner: h
|
|
431
431
|
};
|
|
432
|
-
return
|
|
432
|
+
return y._store = {}, Object.defineProperty(y._store, "validated", {
|
|
433
433
|
configurable: !1,
|
|
434
434
|
enumerable: !1,
|
|
435
435
|
writable: !0,
|
|
436
436
|
value: !1
|
|
437
|
-
}), Object.defineProperty(
|
|
437
|
+
}), Object.defineProperty(y, "_self", {
|
|
438
438
|
configurable: !1,
|
|
439
439
|
enumerable: !1,
|
|
440
440
|
writable: !1,
|
|
441
|
-
value:
|
|
442
|
-
}), Object.defineProperty(
|
|
441
|
+
value: c
|
|
442
|
+
}), Object.defineProperty(y, "_source", {
|
|
443
443
|
configurable: !1,
|
|
444
444
|
enumerable: !1,
|
|
445
445
|
writable: !1,
|
|
446
446
|
value: b
|
|
447
|
-
}), Object.freeze && (Object.freeze(
|
|
447
|
+
}), Object.freeze && (Object.freeze(y.props), Object.freeze(y)), y;
|
|
448
448
|
};
|
|
449
|
-
function pr(e, n, i,
|
|
449
|
+
function pr(e, n, i, c, b) {
|
|
450
450
|
{
|
|
451
|
-
var
|
|
452
|
-
i !== void 0 && (Ce(i),
|
|
453
|
-
for (
|
|
454
|
-
W.call(n,
|
|
451
|
+
var h, g = {}, y = null, T = null;
|
|
452
|
+
i !== void 0 && (Ce(i), y = "" + i), ur(n) && (Ce(n.key), y = "" + n.key), sr(n) && (T = n.ref, cr(n, b));
|
|
453
|
+
for (h in n)
|
|
454
|
+
W.call(n, h) && !ar.hasOwnProperty(h) && (g[h] = n[h]);
|
|
455
455
|
if (e && e.defaultProps) {
|
|
456
|
-
var
|
|
457
|
-
for (
|
|
458
|
-
g[
|
|
456
|
+
var _ = e.defaultProps;
|
|
457
|
+
for (h in _)
|
|
458
|
+
g[h] === void 0 && (g[h] = _[h]);
|
|
459
459
|
}
|
|
460
|
-
if (
|
|
461
|
-
var
|
|
462
|
-
|
|
460
|
+
if (y || T) {
|
|
461
|
+
var m = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
462
|
+
y && lr(g, m), T && fr(g, m);
|
|
463
463
|
}
|
|
464
|
-
return dr(e,
|
|
464
|
+
return dr(e, y, T, b, c, Te.current, g);
|
|
465
465
|
}
|
|
466
466
|
}
|
|
467
467
|
var te = w.ReactCurrentOwner, Pe = w.ReactDebugCurrentFrame;
|
|
@@ -514,8 +514,8 @@ Check the top-level render call using <` + i + ">.");
|
|
|
514
514
|
if (we[i])
|
|
515
515
|
return;
|
|
516
516
|
we[i] = !0;
|
|
517
|
-
var
|
|
518
|
-
e && e._owner && e._owner !== te.current && (
|
|
517
|
+
var c = "";
|
|
518
|
+
e && e._owner && e._owner !== te.current && (c = " It was passed a child from " + j(e._owner.type) + "."), I(e), R('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', i, c), I(null);
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
521
|
function Ae(e, n) {
|
|
@@ -524,15 +524,15 @@ Check the top-level render call using <` + i + ">.");
|
|
|
524
524
|
return;
|
|
525
525
|
if (re(e))
|
|
526
526
|
for (var i = 0; i < e.length; i++) {
|
|
527
|
-
var
|
|
528
|
-
oe(
|
|
527
|
+
var c = e[i];
|
|
528
|
+
oe(c) && je(c, n);
|
|
529
529
|
}
|
|
530
530
|
else if (oe(e))
|
|
531
531
|
e._store && (e._store.validated = !0);
|
|
532
532
|
else if (e) {
|
|
533
533
|
var b = H(e);
|
|
534
534
|
if (typeof b == "function" && b !== e.entries)
|
|
535
|
-
for (var
|
|
535
|
+
for (var h = b.call(e), g; !(g = h.next()).done; )
|
|
536
536
|
oe(g.value) && je(g.value, n);
|
|
537
537
|
}
|
|
538
538
|
}
|
|
@@ -545,15 +545,15 @@ Check the top-level render call using <` + i + ">.");
|
|
|
545
545
|
var i;
|
|
546
546
|
if (typeof n == "function")
|
|
547
547
|
i = n.propTypes;
|
|
548
|
-
else if (typeof n == "object" && (n.$$typeof ===
|
|
548
|
+
else if (typeof n == "object" && (n.$$typeof === u || // Note: Memo only checks outer props here.
|
|
549
549
|
// Inner props are checked in the reconciler.
|
|
550
|
-
n.$$typeof ===
|
|
550
|
+
n.$$typeof === E))
|
|
551
551
|
i = n.propTypes;
|
|
552
552
|
else
|
|
553
553
|
return;
|
|
554
554
|
if (i) {
|
|
555
|
-
var
|
|
556
|
-
tr(i, e.props, "prop",
|
|
555
|
+
var c = j(n);
|
|
556
|
+
tr(i, e.props, "prop", c, e);
|
|
557
557
|
} else if (n.PropTypes !== void 0 && !ne) {
|
|
558
558
|
ne = !0;
|
|
559
559
|
var b = j(n);
|
|
@@ -565,9 +565,9 @@ Check the top-level render call using <` + i + ">.");
|
|
|
565
565
|
function br(e) {
|
|
566
566
|
{
|
|
567
567
|
for (var n = Object.keys(e.props), i = 0; i < n.length; i++) {
|
|
568
|
-
var
|
|
569
|
-
if (
|
|
570
|
-
I(e), R("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",
|
|
568
|
+
var c = n[i];
|
|
569
|
+
if (c !== "children" && c !== "key") {
|
|
570
|
+
I(e), R("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", c), I(null);
|
|
571
571
|
break;
|
|
572
572
|
}
|
|
573
573
|
}
|
|
@@ -575,24 +575,24 @@ Check the top-level render call using <` + i + ">.");
|
|
|
575
575
|
}
|
|
576
576
|
}
|
|
577
577
|
var Le = {};
|
|
578
|
-
function Fe(e, n, i,
|
|
578
|
+
function Fe(e, n, i, c, b, h) {
|
|
579
579
|
{
|
|
580
580
|
var g = Ke(e);
|
|
581
581
|
if (!g) {
|
|
582
|
-
var
|
|
583
|
-
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (
|
|
582
|
+
var y = "";
|
|
583
|
+
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (y += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
584
584
|
var T = vr();
|
|
585
|
-
T ?
|
|
586
|
-
var
|
|
587
|
-
e === null ?
|
|
585
|
+
T ? y += T : y += Oe();
|
|
586
|
+
var _;
|
|
587
|
+
e === null ? _ = "null" : re(e) ? _ = "array" : e !== void 0 && e.$$typeof === t ? (_ = "<" + (j(e.type) || "Unknown") + " />", y = " Did you accidentally export a JSX literal instead of a component?") : _ = typeof e, R("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", _, y);
|
|
588
588
|
}
|
|
589
|
-
var
|
|
590
|
-
if (
|
|
591
|
-
return
|
|
589
|
+
var m = pr(e, n, i, b, h);
|
|
590
|
+
if (m == null)
|
|
591
|
+
return m;
|
|
592
592
|
if (g) {
|
|
593
593
|
var P = n.children;
|
|
594
594
|
if (P !== void 0)
|
|
595
|
-
if (
|
|
595
|
+
if (c)
|
|
596
596
|
if (re(P)) {
|
|
597
597
|
for (var M = 0; M < P.length; M++)
|
|
598
598
|
Ae(P[M], e);
|
|
@@ -607,16 +607,16 @@ Check the top-level render call using <` + i + ">.");
|
|
|
607
607
|
return Cr !== "key";
|
|
608
608
|
}), ie = x.length > 0 ? "{key: someKey, " + x.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
609
609
|
if (!Le[F + ie]) {
|
|
610
|
-
var
|
|
610
|
+
var mr = x.length > 0 ? "{" + x.join(": ..., ") + ": ...}" : "{}";
|
|
611
611
|
R(`A props object containing a "key" prop is being spread into JSX:
|
|
612
612
|
let props = %s;
|
|
613
613
|
<%s {...props} />
|
|
614
614
|
React keys must be passed directly to JSX without using spread:
|
|
615
615
|
let props = %s;
|
|
616
|
-
<%s key={someKey} {...props} />`, ie, F,
|
|
616
|
+
<%s key={someKey} {...props} />`, ie, F, mr, F), Le[F + ie] = !0;
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
|
-
return e === o ? br(
|
|
619
|
+
return e === o ? br(m) : gr(m), m;
|
|
620
620
|
}
|
|
621
621
|
}
|
|
622
622
|
function Er(e, n, i) {
|
|
@@ -625,8 +625,8 @@ React keys must be passed directly to JSX without using spread:
|
|
|
625
625
|
function hr(e, n, i) {
|
|
626
626
|
return Fe(e, n, i, !1);
|
|
627
627
|
}
|
|
628
|
-
var Rr = hr,
|
|
629
|
-
U.Fragment = o, U.jsx = Rr, U.jsxs =
|
|
628
|
+
var Rr = hr, _r = Er;
|
|
629
|
+
U.Fragment = o, U.jsx = Rr, U.jsxs = _r;
|
|
630
630
|
}()), U;
|
|
631
631
|
}
|
|
632
632
|
var Me;
|
|
@@ -649,7 +649,7 @@ const Ur = Tr({
|
|
|
649
649
|
[t, a]
|
|
650
650
|
);
|
|
651
651
|
return a && (Or.accessToken = a), /* @__PURE__ */ O.jsx(Ur.Provider, { value: o, children: r });
|
|
652
|
-
}, Gr = ({ containerStyle: r, square: t, error: a, loading: o = !1, height: s = 300, width:
|
|
652
|
+
}, Gr = ({ containerStyle: r, square: t, error: a, loading: o = !1, height: s = 300, width: l = "100%" }, f) => /* @__PURE__ */ O.jsxs(ae, { sx: { position: "relative" }, height: s, children: [
|
|
653
653
|
/* @__PURE__ */ O.jsx(
|
|
654
654
|
ae,
|
|
655
655
|
{
|
|
@@ -664,8 +664,8 @@ const Ur = Tr({
|
|
|
664
664
|
zIndex: 1,
|
|
665
665
|
...r
|
|
666
666
|
},
|
|
667
|
-
ref:
|
|
668
|
-
width:
|
|
667
|
+
ref: f,
|
|
668
|
+
width: l,
|
|
669
669
|
height: s,
|
|
670
670
|
children: a && /* @__PURE__ */ O.jsx(ae, { textAlign: "center", children: a })
|
|
671
671
|
}
|
|
@@ -680,7 +680,7 @@ const Ur = Tr({
|
|
|
680
680
|
zIndex: 0,
|
|
681
681
|
...r
|
|
682
682
|
},
|
|
683
|
-
width:
|
|
683
|
+
width: l,
|
|
684
684
|
height: s,
|
|
685
685
|
variant: t ? "rectangular" : "rounded"
|
|
686
686
|
}
|
|
@@ -691,30 +691,30 @@ const Ur = Tr({
|
|
|
691
691
|
flyToDuration: a,
|
|
692
692
|
zoom: o,
|
|
693
693
|
fitBounds: s,
|
|
694
|
-
markers:
|
|
695
|
-
fitBoundDuration:
|
|
694
|
+
markers: l,
|
|
695
|
+
fitBoundDuration: f,
|
|
696
696
|
fitBoundsPadding: d
|
|
697
697
|
}) => {
|
|
698
698
|
A(() => {
|
|
699
699
|
if (!r.current || (t || r.current.flyTo({
|
|
700
700
|
duration: a,
|
|
701
701
|
zoom: o
|
|
702
|
-
}), !s || !(
|
|
703
|
-
const
|
|
704
|
-
const
|
|
705
|
-
return Ve(C,
|
|
702
|
+
}), !s || !(l != null && l.length) || (l == null ? void 0 : l.length) < 2)) return;
|
|
703
|
+
const u = new wr(), v = l.filter((p) => {
|
|
704
|
+
const E = Number(p.lng), C = Number(p.lat);
|
|
705
|
+
return Ve(C, E);
|
|
706
706
|
});
|
|
707
707
|
if (!(v.length < 2)) {
|
|
708
|
-
for (let
|
|
709
|
-
const
|
|
710
|
-
|
|
708
|
+
for (let p = 0; p < v.length; p += 1) {
|
|
709
|
+
const E = Number(v[p].lng), C = Number(v[p].lat);
|
|
710
|
+
u.extend([E, C]);
|
|
711
711
|
}
|
|
712
|
-
r.current.fitBounds(
|
|
713
|
-
duration:
|
|
712
|
+
r.current.fitBounds(u, {
|
|
713
|
+
duration: f,
|
|
714
714
|
padding: d
|
|
715
715
|
});
|
|
716
716
|
}
|
|
717
|
-
}, [
|
|
717
|
+
}, [l, s, d, a, o, f, t, r]);
|
|
718
718
|
}, We = (r) => Array.isArray(r) ? r.length >= 2 ? [r[0], r[1]] : void 0 : r, qr = ({ map: r, center: t }) => {
|
|
719
719
|
A(() => {
|
|
720
720
|
if (!r.current || !t) return;
|
|
@@ -770,29 +770,29 @@ const Jr = ({ palette: r, type: t }) => {
|
|
|
770
770
|
}
|
|
771
771
|
}, Kr = (r, t, a, o) => {
|
|
772
772
|
const s = {
|
|
773
|
-
features: a.map((
|
|
773
|
+
features: a.map((f) => ({
|
|
774
774
|
geometry: {
|
|
775
|
-
coordinates:
|
|
775
|
+
coordinates: f.geometry.coordinates,
|
|
776
776
|
type: "Point"
|
|
777
777
|
},
|
|
778
778
|
properties: {
|
|
779
|
-
id:
|
|
780
|
-
...
|
|
779
|
+
id: f.properties.id,
|
|
780
|
+
...f.properties
|
|
781
781
|
},
|
|
782
782
|
type: "Feature"
|
|
783
783
|
})),
|
|
784
784
|
type: "FeatureCollection"
|
|
785
|
-
},
|
|
786
|
-
|
|
785
|
+
}, l = r.getSource(t);
|
|
786
|
+
l ? l.setData(s) : r.addSource(t, {
|
|
787
787
|
data: s,
|
|
788
788
|
type: "geojson"
|
|
789
|
-
}), s.features.forEach((
|
|
790
|
-
const { description: d, id:
|
|
791
|
-
r.getLayer(
|
|
792
|
-
r.setPaintProperty(
|
|
789
|
+
}), s.features.forEach((f) => {
|
|
790
|
+
const { description: d, id: u } = f.properties || {}, v = Jr({ palette: o, type: d }), p = `marker-${u}`;
|
|
791
|
+
r.getLayer(p) ? Object.entries(v || {}).forEach(([E, C]) => {
|
|
792
|
+
r.setPaintProperty(p, E, C);
|
|
793
793
|
}) : r.addLayer({
|
|
794
|
-
filter: ["==", "id",
|
|
795
|
-
id:
|
|
794
|
+
filter: ["==", "id", u],
|
|
795
|
+
id: p,
|
|
796
796
|
layout: {
|
|
797
797
|
visibility: "visible"
|
|
798
798
|
},
|
|
@@ -803,12 +803,16 @@ const Jr = ({ palette: r, type: t }) => {
|
|
|
803
803
|
});
|
|
804
804
|
}, Hr = (r, t) => {
|
|
805
805
|
document.querySelectorAll(".react-custom-marker").forEach((o) => o.remove()), t.forEach((o) => {
|
|
806
|
-
const { IconComponent: s, iconProps:
|
|
807
|
-
if (s &&
|
|
808
|
-
const
|
|
809
|
-
|
|
810
|
-
const
|
|
811
|
-
s &&
|
|
806
|
+
const { IconComponent: s, iconProps: l, onClick: f } = o.properties || {}, { coordinates: d } = o.geometry;
|
|
807
|
+
if (s && d.length >= 2) {
|
|
808
|
+
const u = document.createElement("div");
|
|
809
|
+
u.className = "react-custom-marker", u.style.position = "absolute";
|
|
810
|
+
const v = document.createElement("div"), p = Ye.createRoot(v);
|
|
811
|
+
s && p.render(ue.createElement(s, l || {})), u.appendChild(v);
|
|
812
|
+
const E = () => {
|
|
813
|
+
f == null || f(o);
|
|
814
|
+
};
|
|
815
|
+
u.addEventListener("click", E), new jr(u).setLngLat([d[0], d[1]]).addTo(r);
|
|
812
816
|
}
|
|
813
817
|
});
|
|
814
818
|
}, Xr = (r) => ({
|
|
@@ -826,6 +830,7 @@ const Jr = ({ palette: r, type: t }) => {
|
|
|
826
830
|
iconProps: t.iconProps,
|
|
827
831
|
id: t.id || `{marker-${a}}`,
|
|
828
832
|
name: t.name,
|
|
833
|
+
onClick: t.onClick,
|
|
829
834
|
size: t.size || 1,
|
|
830
835
|
zIndex: t.zIndex || 0
|
|
831
836
|
},
|
|
@@ -834,30 +839,30 @@ const Jr = ({ palette: r, type: t }) => {
|
|
|
834
839
|
type: "FeatureCollection"
|
|
835
840
|
}), Zr = ({ map: r, setLoadingMapBox: t, palette: a, markers: o }) => {
|
|
836
841
|
if (t(!1), !r.current) return;
|
|
837
|
-
const s = Xr(o),
|
|
838
|
-
var
|
|
839
|
-
return ((
|
|
842
|
+
const s = Xr(o), l = s.features.filter((d) => {
|
|
843
|
+
var u;
|
|
844
|
+
return ((u = d.properties) == null ? void 0 : u.IconComponent) === void 0;
|
|
840
845
|
});
|
|
841
|
-
|
|
842
|
-
const
|
|
843
|
-
var
|
|
844
|
-
return (
|
|
846
|
+
l.length && Kr(r.current, "markerProps", l, a);
|
|
847
|
+
const f = s.features.filter((d) => {
|
|
848
|
+
var u;
|
|
849
|
+
return (u = d.properties) == null ? void 0 : u.IconComponent;
|
|
845
850
|
});
|
|
846
|
-
|
|
851
|
+
f.length && Hr(r.current, f);
|
|
847
852
|
}, Qr = ({ map: r, markers: t, markersAreInvalid: a, palette: o, setLoadingMapBox: s }) => {
|
|
848
853
|
A(() => {
|
|
849
854
|
if (!r.current || a) return;
|
|
850
|
-
const
|
|
855
|
+
const l = () => {
|
|
851
856
|
t && Zr({ map: r, markers: t, palette: o, setLoadingMapBox: s });
|
|
852
857
|
};
|
|
853
|
-
r.current.loaded() ?
|
|
858
|
+
r.current.loaded() ? l() : r.current.once("load", l);
|
|
854
859
|
}, [r, t, a, o, s]);
|
|
855
860
|
}, et = ({ map: r, onMapClick: t }) => {
|
|
856
861
|
A(() => {
|
|
857
862
|
if (!r.current || !t) return;
|
|
858
863
|
const a = r.current.getCanvas(), o = (s) => {
|
|
859
|
-
const
|
|
860
|
-
t(
|
|
864
|
+
const l = [s.clientX - a.getBoundingClientRect().left, s.clientY - a.getBoundingClientRect().top], f = r.current.unproject(l);
|
|
865
|
+
t(f.lng, f.lat);
|
|
861
866
|
};
|
|
862
867
|
a.addEventListener("click", o);
|
|
863
868
|
}, [r, t]);
|
|
@@ -871,18 +876,18 @@ const Jr = ({ palette: r, type: t }) => {
|
|
|
871
876
|
o.style.position = "relative", o.style.overflow = "hidden";
|
|
872
877
|
const s = document.createElement("div");
|
|
873
878
|
s.style.padding = "10px", o.style.zIndex = "1000";
|
|
874
|
-
const
|
|
875
|
-
|
|
876
|
-
const
|
|
879
|
+
const l = Ye.createRoot(s);
|
|
880
|
+
l.render(t);
|
|
881
|
+
const f = new Ar({
|
|
877
882
|
closeButton: !1
|
|
878
883
|
}).setLngLat(a).setDOMContent(o).addTo(r.current);
|
|
879
|
-
|
|
884
|
+
f.on("close", () => {
|
|
880
885
|
queueMicrotask(() => {
|
|
881
|
-
|
|
886
|
+
l.unmount();
|
|
882
887
|
});
|
|
883
888
|
});
|
|
884
|
-
const d = rt(
|
|
885
|
-
return o.appendChild(d), o.appendChild(s),
|
|
889
|
+
const d = rt(f);
|
|
890
|
+
return o.appendChild(d), o.appendChild(s), f;
|
|
886
891
|
}, Ue = (r) => typeof r == "object" && r !== null && "type" in r && "coordinates" in r, tt = (r) => {
|
|
887
892
|
if (typeof r != "object" || r === null || !("geometry" in r && "properties" in r))
|
|
888
893
|
return !1;
|
|
@@ -895,56 +900,56 @@ const Jr = ({ palette: r, type: t }) => {
|
|
|
895
900
|
const { properties: s } = r;
|
|
896
901
|
return typeof s != "object" || s === null ? !1 : "id" in s && s.id !== void 0;
|
|
897
902
|
}, nt = ({ map: r, point: t }) => {
|
|
898
|
-
var s,
|
|
903
|
+
var s, l, f, d, u;
|
|
899
904
|
if (!((s = r.current) != null && s.isStyleLoaded()))
|
|
900
905
|
return null;
|
|
901
|
-
const a = ((d = (
|
|
906
|
+
const a = ((d = (f = (l = r.current) == null ? void 0 : l.getStyle()) == null ? void 0 : f.layers) == null ? void 0 : d.filter((v) => v.id.startsWith("marker-")).map((v) => v.id)) || [], o = (u = r.current) == null ? void 0 : u.queryRenderedFeatures(t, { layers: a });
|
|
902
907
|
if (o && o.length > 0) {
|
|
903
908
|
const v = o[0];
|
|
904
909
|
if (!tt(v) || !Ue(v.geometry))
|
|
905
910
|
return null;
|
|
906
|
-
const { geometry:
|
|
907
|
-
return
|
|
911
|
+
const { geometry: p } = v, E = p.coordinates.slice();
|
|
912
|
+
return E.length !== 2 || typeof E[0] != "number" || typeof E[1] != "number" ? null : v;
|
|
908
913
|
}
|
|
909
914
|
}, ot = ({ openPopup: r, map: t, markers: a }) => {
|
|
910
915
|
const o = se(null);
|
|
911
916
|
A(() => {
|
|
912
917
|
if (!t.current || !a) return;
|
|
913
|
-
const
|
|
918
|
+
const l = t.current.getCanvas();
|
|
914
919
|
if (o.current && (o.current.remove(), o.current = null), r) {
|
|
915
|
-
const d = a.find((
|
|
920
|
+
const d = a.find((u) => u.id === r);
|
|
916
921
|
if (d) {
|
|
917
|
-
const
|
|
918
|
-
coordinates:
|
|
922
|
+
const u = [Number(d.lng) || 0, Number(d.lat) || 0], v = $e({
|
|
923
|
+
coordinates: u,
|
|
919
924
|
map: t,
|
|
920
925
|
tooltip: d.Tooltip
|
|
921
926
|
});
|
|
922
927
|
v && (o.current = v);
|
|
923
928
|
}
|
|
924
929
|
}
|
|
925
|
-
const
|
|
926
|
-
const
|
|
927
|
-
d.clientX -
|
|
928
|
-
d.clientY -
|
|
929
|
-
], v = nt({ map: t, point:
|
|
930
|
+
const f = (d) => {
|
|
931
|
+
const u = [
|
|
932
|
+
d.clientX - l.getBoundingClientRect().left,
|
|
933
|
+
d.clientY - l.getBoundingClientRect().top
|
|
934
|
+
], v = nt({ map: t, point: u });
|
|
930
935
|
if (v && v.properties && v.properties.id) {
|
|
931
936
|
o.current && (o.current.remove(), o.current = null);
|
|
932
|
-
const
|
|
933
|
-
if (
|
|
934
|
-
const
|
|
937
|
+
const p = a.find((E) => E.id === v.properties.id);
|
|
938
|
+
if (p) {
|
|
939
|
+
const E = [Number(p.lng) || 0, Number(p.lat) || 0];
|
|
935
940
|
requestAnimationFrame(() => {
|
|
936
941
|
const C = $e({
|
|
937
|
-
coordinates:
|
|
942
|
+
coordinates: E,
|
|
938
943
|
map: t,
|
|
939
|
-
tooltip:
|
|
944
|
+
tooltip: p.Tooltip
|
|
940
945
|
});
|
|
941
946
|
C && (o.current = C);
|
|
942
947
|
});
|
|
943
948
|
}
|
|
944
949
|
}
|
|
945
950
|
};
|
|
946
|
-
return
|
|
947
|
-
|
|
951
|
+
return l.addEventListener("click", f), () => {
|
|
952
|
+
l.removeEventListener("click", f), o.current && (o.current.remove(), o.current = null);
|
|
948
953
|
};
|
|
949
954
|
}, [t, a, r]);
|
|
950
955
|
}, it = () => {
|
|
@@ -955,10 +960,10 @@ const Jr = ({ palette: r, type: t }) => {
|
|
|
955
960
|
return !1;
|
|
956
961
|
}
|
|
957
962
|
}, at = ({ mapStyle: r, mapContainer: t, zoomFlyFrom: a, markers: o, center: s }) => {
|
|
958
|
-
var
|
|
963
|
+
var f, d;
|
|
959
964
|
return {
|
|
960
965
|
center: s ? We(s) : {
|
|
961
|
-
lat: ((
|
|
966
|
+
lat: ((f = o == null ? void 0 : o[0]) == null ? void 0 : f.lat) !== void 0 ? Number(o[0].lat) : Be,
|
|
962
967
|
lng: ((d = o == null ? void 0 : o[0]) == null ? void 0 : d.lng) !== void 0 ? Number(o[0].lng) : Ge
|
|
963
968
|
},
|
|
964
969
|
container: (t == null ? void 0 : t.current) || "",
|
|
@@ -973,13 +978,13 @@ const Jr = ({ palette: r, type: t }) => {
|
|
|
973
978
|
center: a,
|
|
974
979
|
openPopup: o,
|
|
975
980
|
onMapClick: s,
|
|
976
|
-
flyToDuration:
|
|
977
|
-
fitBoundDuration:
|
|
981
|
+
flyToDuration: l = 5e3,
|
|
982
|
+
fitBoundDuration: f = 1e3,
|
|
978
983
|
fitBounds: d = !0,
|
|
979
|
-
disableFlyTo:
|
|
984
|
+
disableFlyTo: u = !1,
|
|
980
985
|
fitBoundsPadding: v = 50,
|
|
981
|
-
mapStyle:
|
|
982
|
-
zoom:
|
|
986
|
+
mapStyle: p = "mapbox://styles/mapbox/streets-v12?optimize=true",
|
|
987
|
+
zoom: E = 6,
|
|
983
988
|
zoomFlyFrom: C = 3
|
|
984
989
|
}) => {
|
|
985
990
|
const { palette: D } = Dr(), [G, B] = De(!0), [H, w] = De(!0), R = se(null), S = se(null), X = !r || r.some((N) => N.lat === void 0 || N.lng === void 0);
|
|
@@ -991,9 +996,9 @@ const Jr = ({ palette: r, type: t }) => {
|
|
|
991
996
|
if (S.current || !R.current || t)
|
|
992
997
|
return;
|
|
993
998
|
R.current.innerHTML !== "" && (R.current.innerHTML = "");
|
|
994
|
-
const N = at({ center: a, mapContainer: R, mapStyle:
|
|
999
|
+
const N = at({ center: a, mapContainer: R, mapStyle: p, markers: r, zoomFlyFrom: C });
|
|
995
1000
|
S.current = new Lr(N);
|
|
996
|
-
}, [a, t,
|
|
1001
|
+
}, [a, t, p, r, C]), Qr({ map: S, markers: r, markersAreInvalid: X, palette: D, setLoadingMapBox: B }), ot({ map: S, markers: r, openPopup: o }), qr({ center: a, map: S }), et({ map: S, onMapClick: s }), Vr({ disableFlyTo: u, fitBoundDuration: f, fitBounds: d, fitBoundsPadding: v, flyToDuration: l, map: S, markers: r, zoom: E }), A(
|
|
997
1002
|
() => () => {
|
|
998
1003
|
S.current && (S.current.remove(), S.current = null);
|
|
999
1004
|
},
|
|
@@ -1005,8 +1010,8 @@ const Jr = ({ palette: r, type: t }) => {
|
|
|
1005
1010
|
markers: r,
|
|
1006
1011
|
webGLSupported: H
|
|
1007
1012
|
};
|
|
1008
|
-
}, vt = ({ containerStyle: r, square: t, theme: a, height: o = 300, width: s = "100%", ...
|
|
1009
|
-
const { loading:
|
|
1013
|
+
}, vt = ({ containerStyle: r, square: t, theme: a, height: o = 300, width: s = "100%", ...l }) => {
|
|
1014
|
+
const { loading: f, mapContainer: d, webGLSupported: u } = st(l);
|
|
1010
1015
|
return /* @__PURE__ */ O.jsxs(O.Fragment, { children: [
|
|
1011
1016
|
/* @__PURE__ */ O.jsx(
|
|
1012
1017
|
Nr,
|
|
@@ -1026,12 +1031,12 @@ const Jr = ({ palette: r, type: t }) => {
|
|
|
1026
1031
|
Br,
|
|
1027
1032
|
{
|
|
1028
1033
|
ref: d,
|
|
1029
|
-
loading:
|
|
1034
|
+
loading: f,
|
|
1030
1035
|
height: o,
|
|
1031
1036
|
width: s,
|
|
1032
1037
|
containerStyle: r,
|
|
1033
1038
|
square: t,
|
|
1034
|
-
error: !
|
|
1039
|
+
error: !u && "WebGL is not enabled in your browser. This technology is required to display the interactive map."
|
|
1035
1040
|
}
|
|
1036
1041
|
)
|
|
1037
1042
|
] });
|
package/dist/main.umd.cjs
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* This source code is licensed under the MIT license found in the
|
|
9
9
|
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/var le;function Xe(){if(le)return G;le=1;var t=R,r=Symbol.for("react.element"),a=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,s=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,
|
|
10
|
+
*/var le;function Xe(){if(le)return G;le=1;var t=R,r=Symbol.for("react.element"),a=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,s=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function f(d,u,v){var p,b={},T=null,k=null;v!==void 0&&(T=""+v),u.key!==void 0&&(T=""+u.key),u.ref!==void 0&&(k=u.ref);for(p in u)o.call(u,p)&&!l.hasOwnProperty(p)&&(b[p]=u[p]);if(d&&d.defaultProps)for(p in u=d.defaultProps,u)b[p]===void 0&&(b[p]=u[p]);return{$$typeof:r,type:d,key:T,ref:k,props:b,_owner:s.current}}return G.Fragment=a,G.jsx=f,G.jsxs=f,G}var B={};/**
|
|
11
11
|
* @license React
|
|
12
12
|
* react-jsx-runtime.development.js
|
|
13
13
|
*
|
|
@@ -15,17 +15,17 @@
|
|
|
15
15
|
*
|
|
16
16
|
* This source code is licensed under the MIT license found in the
|
|
17
17
|
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/var fe;function qe(){return fe||(fe=1,process.env.NODE_ENV!=="production"&&function(){var t=R,r=Symbol.for("react.element"),a=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),
|
|
19
|
-
`+ne+e}}var oe=!1,q;{var xt=typeof WeakMap=="function"?WeakMap:Map;q=new xt}function Ae(e,n){if(!e||oe)return"";{var i=q.get(e);if(i!==void 0)return i}var
|
|
20
|
-
`),S=
|
|
21
|
-
`),
|
|
22
|
-
`+
|
|
18
|
+
*/var fe;function qe(){return fe||(fe=1,process.env.NODE_ENV!=="production"&&function(){var t=R,r=Symbol.for("react.element"),a=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),f=Symbol.for("react.provider"),d=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),b=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),k=Symbol.for("react.offscreen"),K=Symbol.iterator,H="@@iterator";function ee(e){if(e===null||typeof e!="object")return null;var n=K&&e[K]||e[H];return typeof n=="function"?n:null}var L=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function _(e){{for(var n=arguments.length,i=new Array(n>1?n-1:0),c=1;c<n;c++)i[c-1]=arguments[c];O("error",e,i)}}function O(e,n,i){{var c=L.ReactDebugCurrentFrame,E=c.getStackAddendum();E!==""&&(n+="%s",i=i.concat([E]));var h=i.map(function(g){return String(g)});h.unshift("Warning: "+n),Function.prototype.apply.call(console[e],console,h)}}var te=!1,I=!1,bt=!1,ht=!1,Rt=!1,Ce;Ce=Symbol.for("react.module.reference");function _t(e){return!!(typeof e=="string"||typeof e=="function"||e===o||e===l||Rt||e===s||e===v||e===p||ht||e===k||te||I||bt||typeof e=="object"&&e!==null&&(e.$$typeof===T||e.$$typeof===b||e.$$typeof===f||e.$$typeof===d||e.$$typeof===u||e.$$typeof===Ce||e.getModuleId!==void 0))}function Ct(e,n,i){var c=e.displayName;if(c)return c;var E=n.displayName||n.name||"";return E!==""?i+"("+E+")":i}function me(e){return e.displayName||"Context"}function A(e){if(e==null)return null;if(typeof e.tag=="number"&&_("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case o:return"Fragment";case a:return"Portal";case l:return"Profiler";case s:return"StrictMode";case v:return"Suspense";case p:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case d:var n=e;return me(n)+".Consumer";case f:var i=e;return me(i._context)+".Provider";case u:return Ct(e,e.render,"ForwardRef");case b:var c=e.displayName||null;return c!==null?c:A(e.type)||"Memo";case T:{var E=e,h=E._payload,g=E._init;try{return A(g(h))}catch{return null}}}return null}var F=Object.assign,V=0,Te,xe,Se,Pe,Oe,we,je;function Le(){}Le.__reactDisabledLog=!0;function mt(){{if(V===0){Te=console.log,xe=console.info,Se=console.warn,Pe=console.error,Oe=console.group,we=console.groupCollapsed,je=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Le,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}V++}}function Tt(){{if(V--,V===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:F({},e,{value:Te}),info:F({},e,{value:xe}),warn:F({},e,{value:Se}),error:F({},e,{value:Pe}),group:F({},e,{value:Oe}),groupCollapsed:F({},e,{value:we}),groupEnd:F({},e,{value:je})})}V<0&&_("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var re=L.ReactCurrentDispatcher,ne;function X(e,n,i){{if(ne===void 0)try{throw Error()}catch(E){var c=E.stack.trim().match(/\n( *(at )?)/);ne=c&&c[1]||""}return`
|
|
19
|
+
`+ne+e}}var oe=!1,q;{var xt=typeof WeakMap=="function"?WeakMap:Map;q=new xt}function Ae(e,n){if(!e||oe)return"";{var i=q.get(e);if(i!==void 0)return i}var c;oe=!0;var E=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var h;h=re.current,re.current=null,mt();try{if(n){var g=function(){throw Error()};if(Object.defineProperty(g.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(g,[])}catch(P){c=P}Reflect.construct(e,[],g)}else{try{g.call()}catch(P){c=P}e.call(g.prototype)}}else{try{throw Error()}catch(P){c=P}e()}}catch(P){if(P&&c&&typeof P.stack=="string"){for(var y=P.stack.split(`
|
|
20
|
+
`),S=c.stack.split(`
|
|
21
|
+
`),C=y.length-1,m=S.length-1;C>=1&&m>=0&&y[C]!==S[m];)m--;for(;C>=1&&m>=0;C--,m--)if(y[C]!==S[m]){if(C!==1||m!==1)do if(C--,m--,m<0||y[C]!==S[m]){var w=`
|
|
22
|
+
`+y[C].replace(" at new "," at ");return e.displayName&&w.includes("<anonymous>")&&(w=w.replace("<anonymous>",e.displayName)),typeof e=="function"&&q.set(e,w),w}while(C>=1&&m>=0);break}}}finally{oe=!1,re.current=h,Tt(),Error.prepareStackTrace=E}var U=e?e.displayName||e.name:"",N=U?X(U):"";return typeof e=="function"&&q.set(e,N),N}function St(e,n,i){return Ae(e,!1)}function Pt(e){var n=e.prototype;return!!(n&&n.isReactComponent)}function Z(e,n,i){if(e==null)return"";if(typeof e=="function")return Ae(e,Pt(e));if(typeof e=="string")return X(e);switch(e){case v:return X("Suspense");case p:return X("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case u:return St(e.render);case b:return Z(e.type,n,i);case T:{var c=e,E=c._payload,h=c._init;try{return Z(h(E),n,i)}catch{}}}return""}var z=Object.prototype.hasOwnProperty,Fe={},Ne=L.ReactDebugCurrentFrame;function Q(e){if(e){var n=e._owner,i=Z(e.type,e._source,n?n.type:null);Ne.setExtraStackFrame(i)}else Ne.setExtraStackFrame(null)}function Ot(e,n,i,c,E){{var h=Function.call.bind(z);for(var g in e)if(h(e,g)){var y=void 0;try{if(typeof e[g]!="function"){var S=Error((c||"React class")+": "+i+" type `"+g+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[g]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw S.name="Invariant Violation",S}y=e[g](n,g,c,i,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(C){y=C}y&&!(y instanceof Error)&&(Q(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).",c||"React class",i,g,typeof y),Q(null)),y instanceof Error&&!(y.message in Fe)&&(Fe[y.message]=!0,Q(E),_("Failed %s type: %s",i,y.message),Q(null))}}}var wt=Array.isArray;function ie(e){return wt(e)}function jt(e){{var n=typeof Symbol=="function"&&Symbol.toStringTag,i=n&&e[Symbol.toStringTag]||e.constructor.name||"Object";return i}}function Lt(e){try{return De(e),!1}catch{return!0}}function De(e){return""+e}function Me(e){if(Lt(e))return _("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",jt(e)),De(e)}var ke=L.ReactCurrentOwner,At={key:!0,ref:!0,__self:!0,__source:!0},Ie,We;function Ft(e){if(z.call(e,"ref")){var n=Object.getOwnPropertyDescriptor(e,"ref").get;if(n&&n.isReactWarning)return!1}return e.ref!==void 0}function Nt(e){if(z.call(e,"key")){var n=Object.getOwnPropertyDescriptor(e,"key").get;if(n&&n.isReactWarning)return!1}return e.key!==void 0}function Dt(e,n){typeof e.ref=="string"&&ke.current}function Mt(e,n){{var i=function(){Ie||(Ie=!0,_("%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)",n))};i.isReactWarning=!0,Object.defineProperty(e,"key",{get:i,configurable:!0})}}function kt(e,n){{var i=function(){We||(We=!0,_("%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)",n))};i.isReactWarning=!0,Object.defineProperty(e,"ref",{get:i,configurable:!0})}}var It=function(e,n,i,c,E,h,g){var y={$$typeof:r,type:e,key:n,ref:i,props:g,_owner:h};return y._store={},Object.defineProperty(y._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(y,"_self",{configurable:!1,enumerable:!1,writable:!1,value:c}),Object.defineProperty(y,"_source",{configurable:!1,enumerable:!1,writable:!1,value:E}),Object.freeze&&(Object.freeze(y.props),Object.freeze(y)),y};function Wt(e,n,i,c,E){{var h,g={},y=null,S=null;i!==void 0&&(Me(i),y=""+i),Nt(n)&&(Me(n.key),y=""+n.key),Ft(n)&&(S=n.ref,Dt(n,E));for(h in n)z.call(n,h)&&!At.hasOwnProperty(h)&&(g[h]=n[h]);if(e&&e.defaultProps){var C=e.defaultProps;for(h in C)g[h]===void 0&&(g[h]=C[h])}if(y||S){var m=typeof e=="function"?e.displayName||e.name||"Unknown":e;y&&Mt(g,m),S&&kt(g,m)}return It(e,y,S,E,c,ke.current,g)}}var ae=L.ReactCurrentOwner,Ue=L.ReactDebugCurrentFrame;function W(e){if(e){var n=e._owner,i=Z(e.type,e._source,n?n.type:null);Ue.setExtraStackFrame(i)}else Ue.setExtraStackFrame(null)}var se;se=!1;function ue(e){return typeof e=="object"&&e!==null&&e.$$typeof===r}function Ye(){{if(ae.current){var e=A(ae.current.type);if(e)return`
|
|
23
23
|
|
|
24
24
|
Check the render method of \``+e+"`."}return""}}function Ut(e){return""}var Ge={};function Yt(e){{var n=Ye();if(!n){var i=typeof e=="string"?e:e.displayName||e.name;i&&(n=`
|
|
25
25
|
|
|
26
|
-
Check the top-level render call using <`+i+">.")}return n}}function Be(e,n){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var i=Yt(n);if(Ge[i])return;Ge[i]=!0;var
|
|
26
|
+
Check the top-level render call using <`+i+">.")}return n}}function Be(e,n){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var i=Yt(n);if(Ge[i])return;Ge[i]=!0;var c="";e&&e._owner&&e._owner!==ae.current&&(c=" It was passed a child from "+A(e._owner.type)+"."),W(e),_('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',i,c),W(null)}}function Ve(e,n){{if(typeof e!="object")return;if(ie(e))for(var i=0;i<e.length;i++){var c=e[i];ue(c)&&Be(c,n)}else if(ue(e))e._store&&(e._store.validated=!0);else if(e){var E=ee(e);if(typeof E=="function"&&E!==e.entries)for(var h=E.call(e),g;!(g=h.next()).done;)ue(g.value)&&Be(g.value,n)}}}function Gt(e){{var n=e.type;if(n==null||typeof n=="string")return;var i;if(typeof n=="function")i=n.propTypes;else if(typeof n=="object"&&(n.$$typeof===u||n.$$typeof===b))i=n.propTypes;else return;if(i){var c=A(n);Ot(i,e.props,"prop",c,e)}else if(n.PropTypes!==void 0&&!se){se=!0;var E=A(n);_("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",E||"Unknown")}typeof n.getDefaultProps=="function"&&!n.getDefaultProps.isReactClassApproved&&_("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Bt(e){{for(var n=Object.keys(e.props),i=0;i<n.length;i++){var c=n[i];if(c!=="children"&&c!=="key"){W(e),_("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",c),W(null);break}}e.ref!==null&&(W(e),_("Invalid attribute `ref` supplied to `React.Fragment`."),W(null))}}var ze={};function Je(e,n,i,c,E,h){{var g=_t(e);if(!g){var y="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(y+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var S=Ut();S?y+=S:y+=Ye();var C;e===null?C="null":ie(e)?C="array":e!==void 0&&e.$$typeof===r?(C="<"+(A(e.type)||"Unknown")+" />",y=" Did you accidentally export a JSX literal instead of a component?"):C=typeof e,_("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",C,y)}var m=Wt(e,n,i,E,h);if(m==null)return m;if(g){var w=n.children;if(w!==void 0)if(c)if(ie(w)){for(var U=0;U<w.length;U++)Ve(w[U],e);Object.freeze&&Object.freeze(w)}else _("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ve(w,e)}if(z.call(n,"key")){var N=A(e),P=Object.keys(n).filter(function(Xt){return Xt!=="key"}),ce=P.length>0?"{key: someKey, "+P.join(": ..., ")+": ...}":"{key: someKey}";if(!ze[N+ce]){var Ht=P.length>0?"{"+P.join(": ..., ")+": ...}":"{}";_(`A props object containing a "key" prop is being spread into JSX:
|
|
27
27
|
let props = %s;
|
|
28
28
|
<%s {...props} />
|
|
29
29
|
React keys must be passed directly to JSX without using spread:
|
|
30
30
|
let props = %s;
|
|
31
|
-
<%s key={someKey} {...props} />`,ce,N,Ht,N),ze[N+ce]=!0}}return e===o?Bt(C):Gt(C),C}}function Vt(e,n,i){return Je(e,n,i,!0)}function zt(e,n,i){return Je(e,n,i,!1)}var Jt=zt,Kt=Vt;B.Fragment=o,B.jsx=Jt,B.jsxs=Kt}()),B}var de;function Ze(){return de||(de=1,process.env.NODE_ENV==="production"?J.exports=Xe():J.exports=qe()),J.exports}var j=Ze();const pe=R.createContext({licenceMapbox:"",licenseMuiX:""}),Qe=({children:t,licenseMuiX:r,licenceMapbox:a})=>{R.useEffect(()=>{r&&Ke.LicenseInfo.setLicenseKey(r)},[r]);const o=R.useMemo(()=>({licenceMapbox:a,licenseMuiX:r}),[r,a]);return a&&(Y.accessToken=a),j.jsx(pe.Provider,{value:o,children:t})},$e=({containerStyle:t,square:r,error:a,loading:o=!1,height:s=300,width:c="100%"},l)=>j.jsxs(D.Box,{sx:{position:"relative"},height:s,children:[j.jsx(D.Box,{sx:{alignItems:"center",borderRadius:r?0:1,display:"flex",justifyContent:"center",left:0,position:"absolute",top:0,zIndex:1,...t},ref:l,width:c,height:s,children:a&&j.jsx(D.Box,{textAlign:"center",children:a})}),o&&j.jsx(D.Skeleton,{sx:{left:0,position:"absolute",top:0,zIndex:0,...t},width:c,height:s,variant:r?"rectangular":"rounded"})]}),et=R.forwardRef($e),tt=({map:t,disableFlyTo:r,flyToDuration:a,zoom:o,fitBounds:s,markers:c,fitBoundDuration:l,fitBoundsPadding:d})=>{R.useEffect(()=>{if(!t.current||(r||t.current.flyTo({duration:a,zoom:o}),!s||!(c!=null&&c.length)||(c==null?void 0:c.length)<2))return;const f=new Y.LngLatBounds,v=c.filter(y=>{const h=Number(y.lng),T=Number(y.lat);return $(T,h)});if(!(v.length<2)){for(let y=0;y<v.length;y+=1){const h=Number(v[y].lng),T=Number(v[y].lat);f.extend([h,T])}t.current.fitBounds(f,{duration:l,padding:d})}},[c,s,d,a,o,l,r,t])},ve=t=>Array.isArray(t)?t.length>=2?[t[0],t[1]]:void 0:t,rt=({map:t,center:r})=>{R.useEffect(()=>{if(!t.current||!r)return;const a=Array.isArray(r)&&$(r[1],r[0])?ve(r):{lat:46.8677,lng:2.333};a&&t.current.setCenter(a)},[r,t])};var M={},ye;function nt(){if(ye)return M;ye=1;var t=He;if(process.env.NODE_ENV==="production")M.createRoot=t.createRoot,M.hydrateRoot=t.hydrateRoot;else{var r=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;M.createRoot=function(a,o){r.usingClientEntryPoint=!0;try{return t.createRoot(a,o)}finally{r.usingClientEntryPoint=!1}},M.hydrateRoot=function(a,o,s){r.usingClientEntryPoint=!0;try{return t.hydrateRoot(a,o,s)}finally{r.usingClientEntryPoint=!1}}}return M}var ge=nt();const ot=({palette:t,type:r})=>{const a=t.mode==="dark"?"black":"white",o=t.secondary.main,s=t.info.main;switch(r){case"dropOff":return{"circle-color":a,"circle-radius":5,"circle-stroke-color":s,"circle-stroke-width":6};default:return{"circle-color":a,"circle-radius":7,"circle-stroke-color":o,"circle-stroke-width":8}}},it=(t,r,a,o)=>{const s={features:a.map(l=>({geometry:{coordinates:l.geometry.coordinates,type:"Point"},properties:{id:l.properties.id,...l.properties},type:"Feature"})),type:"FeatureCollection"},c=t.getSource(r);c?c.setData(s):t.addSource(r,{data:s,type:"geojson"}),s.features.forEach(l=>{const{description:d,id:f}=l.properties||{},v=ot({palette:o,type:d}),y=`marker-${f}`;t.getLayer(y)?Object.entries(v||{}).forEach(([h,T])=>{t.setPaintProperty(y,h,T)}):t.addLayer({filter:["==","id",f],id:y,layout:{visibility:"visible"},paint:v,source:r,type:"circle"})})},at=(t,r)=>{document.querySelectorAll(".react-custom-marker").forEach(o=>o.remove()),r.forEach(o=>{const{IconComponent:s,iconProps:c}=o.properties||{},{coordinates:l}=o.geometry;if(s&&l.length>=2){const d=document.createElement("div");d.className="react-custom-marker",d.style.position="absolute";const f=document.createElement("div"),v=ge.createRoot(f);s&&v.render(R.createElement(s,c||{})),d.appendChild(f),new Y.Marker(d).setLngLat([l[0],l[1]]).addTo(t)}})},st=t=>({features:(t==null?void 0:t.map((r,a)=>({geometry:{coordinates:[Number.isFinite(Number(r.lng))?Number(r.lng):Number(Re),Number.isFinite(Number(r.lat))?Number(r.lat):Number(_e)],type:"Point"},properties:{description:r.type,IconComponent:r.IconComponent,iconProps:r.iconProps,id:r.id||`{marker-${a}}`,name:r.name,size:r.size||1,zIndex:r.zIndex||0},type:"Feature"})))||[],type:"FeatureCollection"}),ut=({map:t,setLoadingMapBox:r,palette:a,markers:o})=>{if(r(!1),!t.current)return;const s=st(o),c=s.features.filter(d=>{var f;return((f=d.properties)==null?void 0:f.IconComponent)===void 0});c.length&&it(t.current,"markerProps",c,a);const l=s.features.filter(d=>{var f;return(f=d.properties)==null?void 0:f.IconComponent});l.length&&at(t.current,l)},ct=({map:t,markers:r,markersAreInvalid:a,palette:o,setLoadingMapBox:s})=>{R.useEffect(()=>{if(!t.current||a)return;const c=()=>{r&&ut({map:t,markers:r,palette:o,setLoadingMapBox:s})};t.current.loaded()?c():t.current.once("load",c)},[t,r,a,o,s])},lt=({map:t,onMapClick:r})=>{R.useEffect(()=>{if(!t.current||!r)return;const a=t.current.getCanvas(),o=s=>{const c=[s.clientX-a.getBoundingClientRect().left,s.clientY-a.getBoundingClientRect().top],l=t.current.unproject(c);r(l.lng,l.lat)};a.addEventListener("click",o)},[t,r])},ft=t=>{const r=document.createElement("button");return r.innerText="×",r.style.position="absolute",r.style.top="5px",r.style.right="5px",r.style.background="transparent",r.style.border="none",r.style.fontSize="16px",r.style.padding="0",r.style.margin="10px",r.style.cursor="pointer",r.type="button",r.setAttribute("aria-label","Close popup"),r.removeAttribute("aria-hidden"),r.onclick=()=>t.remove(),r},Ee=({map:t,tooltip:r,coordinates:a})=>{if(!a||!r||!t.current||!Array.isArray(a)||a.length!==2)return null;const o=document.createElement("div");o.style.position="relative",o.style.overflow="hidden";const s=document.createElement("div");s.style.padding="10px",o.style.zIndex="1000";const c=ge.createRoot(s);c.render(r);const l=new Y.Popup({closeButton:!1}).setLngLat(a).setDOMContent(o).addTo(t.current);l.on("close",()=>{queueMicrotask(()=>{c.unmount()})});const d=ft(l);return o.appendChild(d),o.appendChild(s),l},be=t=>typeof t=="object"&&t!==null&&"type"in t&&"coordinates"in t,dt=t=>{if(typeof t!="object"||t===null||!("geometry"in t&&"properties"in t))return!1;const{geometry:a}=t;if(typeof a!="object"||a===null||!("coordinates"in a))return!1;const{coordinates:o}=a;if(!Array.isArray(o)||o.length!==2||!be(a))return!1;const{properties:s}=t;return typeof s!="object"||s===null?!1:"id"in s&&s.id!==void 0},pt=({map:t,point:r})=>{var s,c,l,d,f;if(!((s=t.current)!=null&&s.isStyleLoaded()))return null;const a=((d=(l=(c=t.current)==null?void 0:c.getStyle())==null?void 0:l.layers)==null?void 0:d.filter(v=>v.id.startsWith("marker-")).map(v=>v.id))||[],o=(f=t.current)==null?void 0:f.queryRenderedFeatures(r,{layers:a});if(o&&o.length>0){const v=o[0];if(!dt(v)||!be(v.geometry))return null;const{geometry:y}=v,h=y.coordinates.slice();return h.length!==2||typeof h[0]!="number"||typeof h[1]!="number"?null:v}},vt=({openPopup:t,map:r,markers:a})=>{const o=R.useRef(null);R.useEffect(()=>{if(!r.current||!a)return;const c=r.current.getCanvas();if(o.current&&(o.current.remove(),o.current=null),t){const d=a.find(f=>f.id===t);if(d){const f=[Number(d.lng)||0,Number(d.lat)||0],v=Ee({coordinates:f,map:r,tooltip:d.Tooltip});v&&(o.current=v)}}const l=d=>{const f=[d.clientX-c.getBoundingClientRect().left,d.clientY-c.getBoundingClientRect().top],v=pt({map:r,point:f});if(v&&v.properties&&v.properties.id){o.current&&(o.current.remove(),o.current=null);const y=a.find(h=>h.id===v.properties.id);if(y){const h=[Number(y.lng)||0,Number(y.lat)||0];requestAnimationFrame(()=>{const T=Ee({coordinates:h,map:r,tooltip:y.Tooltip});T&&(o.current=T)})}}};return c.addEventListener("click",l),()=>{c.removeEventListener("click",l),o.current&&(o.current.remove(),o.current=null)}},[r,a,t])},he=()=>{try{const t=document.createElement("canvas");return(t.getContext("webgl")||t.getContext("experimental-webgl"))instanceof WebGLRenderingContext}catch{return!1}},yt=({mapStyle:t,mapContainer:r,zoomFlyFrom:a,markers:o,center:s})=>{var l,d;return{center:s?ve(s):{lat:((l=o==null?void 0:o[0])==null?void 0:l.lat)!==void 0?Number(o[0].lat):_e,lng:((d=o==null?void 0:o[0])==null?void 0:d.lng)!==void 0?Number(o[0].lng):Re},container:(r==null?void 0:r.current)||"",cooperativeGestures:!0,failIfMajorPerformanceCaveat:!1,style:t,zoom:a}},Re=2.333,_e=46.8677,gt=({markers:t,loading:r,center:a,openPopup:o,onMapClick:s,flyToDuration:c=5e3,fitBoundDuration:l=1e3,fitBounds:d=!0,disableFlyTo:f=!1,fitBoundsPadding:v=50,mapStyle:y="mapbox://styles/mapbox/streets-v12?optimize=true",zoom:h=6,zoomFlyFrom:T=3})=>{const{palette:I}=D.useTheme(),[K,H]=R.useState(!0),[ee,L]=R.useState(!0),_=R.useRef(null),O=R.useRef(null),te=!t||t.some(k=>k.lat===void 0||k.lng===void 0);return R.useEffect(()=>{if(!he()){L(!1),H(!1);return}if(O.current||!_.current||r)return;_.current.innerHTML!==""&&(_.current.innerHTML="");const k=yt({center:a,mapContainer:_,mapStyle:y,markers:t,zoomFlyFrom:T});O.current=new Y.Map(k)},[a,r,y,t,T]),ct({map:O,markers:t,markersAreInvalid:te,palette:I,setLoadingMapBox:H}),vt({map:O,markers:t,openPopup:o}),rt({center:a,map:O}),lt({map:O,onMapClick:s}),tt({disableFlyTo:f,fitBoundDuration:l,fitBounds:d,fitBoundsPadding:v,flyToDuration:c,map:O,markers:t,zoom:h}),R.useEffect(()=>()=>{O.current&&(O.current.remove(),O.current=null)},[]),{loading:K||r,map:O,mapContainer:_,markers:t,webGLSupported:ee}},Et=({containerStyle:t,square:r,theme:a,height:o=300,width:s="100%",...c})=>{const{loading:l,mapContainer:d,webGLSupported:f}=gt(c);return j.jsxs(j.Fragment,{children:[j.jsx(D.GlobalStyles,{styles:{".mapboxgl-popup-content":{backgroundColor:"transparent!important",borderRadius:"0px !important",boxShadow:"none!important",padding:"0px 0px!important",width:"fit-content!important"}}}),j.jsx(et,{ref:d,loading:l,height:o,width:s,containerStyle:t,square:r,error:!f&&"WebGL is not enabled in your browser. This technology is required to display the interactive map."})]})},$=(t,r)=>Number.isFinite(t)&&Number.isFinite(r)&&t>=-90&&t<=90&&r>=-180&&r<=180;x.DEFAULT_CENTER_LAT=46.8677,x.DEFAULT_CENTER_LNG=2.333,x.MapProvider=Qe,x.MapProviderContext=pe,x.MarkerMap=Et,x.isValidLatLng=$,x.isWebGLSupported=he,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})});
|
|
31
|
+
<%s key={someKey} {...props} />`,ce,N,Ht,N),ze[N+ce]=!0}}return e===o?Bt(m):Gt(m),m}}function Vt(e,n,i){return Je(e,n,i,!0)}function zt(e,n,i){return Je(e,n,i,!1)}var Jt=zt,Kt=Vt;B.Fragment=o,B.jsx=Jt,B.jsxs=Kt}()),B}var de;function Ze(){return de||(de=1,process.env.NODE_ENV==="production"?J.exports=Xe():J.exports=qe()),J.exports}var j=Ze();const pe=R.createContext({licenceMapbox:"",licenseMuiX:""}),Qe=({children:t,licenseMuiX:r,licenceMapbox:a})=>{R.useEffect(()=>{r&&Ke.LicenseInfo.setLicenseKey(r)},[r]);const o=R.useMemo(()=>({licenceMapbox:a,licenseMuiX:r}),[r,a]);return a&&(Y.accessToken=a),j.jsx(pe.Provider,{value:o,children:t})},$e=({containerStyle:t,square:r,error:a,loading:o=!1,height:s=300,width:l="100%"},f)=>j.jsxs(D.Box,{sx:{position:"relative"},height:s,children:[j.jsx(D.Box,{sx:{alignItems:"center",borderRadius:r?0:1,display:"flex",justifyContent:"center",left:0,position:"absolute",top:0,zIndex:1,...t},ref:f,width:l,height:s,children:a&&j.jsx(D.Box,{textAlign:"center",children:a})}),o&&j.jsx(D.Skeleton,{sx:{left:0,position:"absolute",top:0,zIndex:0,...t},width:l,height:s,variant:r?"rectangular":"rounded"})]}),et=R.forwardRef($e),tt=({map:t,disableFlyTo:r,flyToDuration:a,zoom:o,fitBounds:s,markers:l,fitBoundDuration:f,fitBoundsPadding:d})=>{R.useEffect(()=>{if(!t.current||(r||t.current.flyTo({duration:a,zoom:o}),!s||!(l!=null&&l.length)||(l==null?void 0:l.length)<2))return;const u=new Y.LngLatBounds,v=l.filter(p=>{const b=Number(p.lng),T=Number(p.lat);return $(T,b)});if(!(v.length<2)){for(let p=0;p<v.length;p+=1){const b=Number(v[p].lng),T=Number(v[p].lat);u.extend([b,T])}t.current.fitBounds(u,{duration:f,padding:d})}},[l,s,d,a,o,f,r,t])},ve=t=>Array.isArray(t)?t.length>=2?[t[0],t[1]]:void 0:t,rt=({map:t,center:r})=>{R.useEffect(()=>{if(!t.current||!r)return;const a=Array.isArray(r)&&$(r[1],r[0])?ve(r):{lat:46.8677,lng:2.333};a&&t.current.setCenter(a)},[r,t])};var M={},ye;function nt(){if(ye)return M;ye=1;var t=He;if(process.env.NODE_ENV==="production")M.createRoot=t.createRoot,M.hydrateRoot=t.hydrateRoot;else{var r=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;M.createRoot=function(a,o){r.usingClientEntryPoint=!0;try{return t.createRoot(a,o)}finally{r.usingClientEntryPoint=!1}},M.hydrateRoot=function(a,o,s){r.usingClientEntryPoint=!0;try{return t.hydrateRoot(a,o,s)}finally{r.usingClientEntryPoint=!1}}}return M}var ge=nt();const ot=({palette:t,type:r})=>{const a=t.mode==="dark"?"black":"white",o=t.secondary.main,s=t.info.main;switch(r){case"dropOff":return{"circle-color":a,"circle-radius":5,"circle-stroke-color":s,"circle-stroke-width":6};default:return{"circle-color":a,"circle-radius":7,"circle-stroke-color":o,"circle-stroke-width":8}}},it=(t,r,a,o)=>{const s={features:a.map(f=>({geometry:{coordinates:f.geometry.coordinates,type:"Point"},properties:{id:f.properties.id,...f.properties},type:"Feature"})),type:"FeatureCollection"},l=t.getSource(r);l?l.setData(s):t.addSource(r,{data:s,type:"geojson"}),s.features.forEach(f=>{const{description:d,id:u}=f.properties||{},v=ot({palette:o,type:d}),p=`marker-${u}`;t.getLayer(p)?Object.entries(v||{}).forEach(([b,T])=>{t.setPaintProperty(p,b,T)}):t.addLayer({filter:["==","id",u],id:p,layout:{visibility:"visible"},paint:v,source:r,type:"circle"})})},at=(t,r)=>{document.querySelectorAll(".react-custom-marker").forEach(o=>o.remove()),r.forEach(o=>{const{IconComponent:s,iconProps:l,onClick:f}=o.properties||{},{coordinates:d}=o.geometry;if(s&&d.length>=2){const u=document.createElement("div");u.className="react-custom-marker",u.style.position="absolute";const v=document.createElement("div"),p=ge.createRoot(v);s&&p.render(R.createElement(s,l||{})),u.appendChild(v);const b=()=>{f==null||f(o)};u.addEventListener("click",b),new Y.Marker(u).setLngLat([d[0],d[1]]).addTo(t)}})},st=t=>({features:(t==null?void 0:t.map((r,a)=>({geometry:{coordinates:[Number.isFinite(Number(r.lng))?Number(r.lng):Number(Re),Number.isFinite(Number(r.lat))?Number(r.lat):Number(_e)],type:"Point"},properties:{description:r.type,IconComponent:r.IconComponent,iconProps:r.iconProps,id:r.id||`{marker-${a}}`,name:r.name,onClick:r.onClick,size:r.size||1,zIndex:r.zIndex||0},type:"Feature"})))||[],type:"FeatureCollection"}),ut=({map:t,setLoadingMapBox:r,palette:a,markers:o})=>{if(r(!1),!t.current)return;const s=st(o),l=s.features.filter(d=>{var u;return((u=d.properties)==null?void 0:u.IconComponent)===void 0});l.length&&it(t.current,"markerProps",l,a);const f=s.features.filter(d=>{var u;return(u=d.properties)==null?void 0:u.IconComponent});f.length&&at(t.current,f)},ct=({map:t,markers:r,markersAreInvalid:a,palette:o,setLoadingMapBox:s})=>{R.useEffect(()=>{if(!t.current||a)return;const l=()=>{r&&ut({map:t,markers:r,palette:o,setLoadingMapBox:s})};t.current.loaded()?l():t.current.once("load",l)},[t,r,a,o,s])},lt=({map:t,onMapClick:r})=>{R.useEffect(()=>{if(!t.current||!r)return;const a=t.current.getCanvas(),o=s=>{const l=[s.clientX-a.getBoundingClientRect().left,s.clientY-a.getBoundingClientRect().top],f=t.current.unproject(l);r(f.lng,f.lat)};a.addEventListener("click",o)},[t,r])},ft=t=>{const r=document.createElement("button");return r.innerText="×",r.style.position="absolute",r.style.top="5px",r.style.right="5px",r.style.background="transparent",r.style.border="none",r.style.fontSize="16px",r.style.padding="0",r.style.margin="10px",r.style.cursor="pointer",r.type="button",r.setAttribute("aria-label","Close popup"),r.removeAttribute("aria-hidden"),r.onclick=()=>t.remove(),r},Ee=({map:t,tooltip:r,coordinates:a})=>{if(!a||!r||!t.current||!Array.isArray(a)||a.length!==2)return null;const o=document.createElement("div");o.style.position="relative",o.style.overflow="hidden";const s=document.createElement("div");s.style.padding="10px",o.style.zIndex="1000";const l=ge.createRoot(s);l.render(r);const f=new Y.Popup({closeButton:!1}).setLngLat(a).setDOMContent(o).addTo(t.current);f.on("close",()=>{queueMicrotask(()=>{l.unmount()})});const d=ft(f);return o.appendChild(d),o.appendChild(s),f},be=t=>typeof t=="object"&&t!==null&&"type"in t&&"coordinates"in t,dt=t=>{if(typeof t!="object"||t===null||!("geometry"in t&&"properties"in t))return!1;const{geometry:a}=t;if(typeof a!="object"||a===null||!("coordinates"in a))return!1;const{coordinates:o}=a;if(!Array.isArray(o)||o.length!==2||!be(a))return!1;const{properties:s}=t;return typeof s!="object"||s===null?!1:"id"in s&&s.id!==void 0},pt=({map:t,point:r})=>{var s,l,f,d,u;if(!((s=t.current)!=null&&s.isStyleLoaded()))return null;const a=((d=(f=(l=t.current)==null?void 0:l.getStyle())==null?void 0:f.layers)==null?void 0:d.filter(v=>v.id.startsWith("marker-")).map(v=>v.id))||[],o=(u=t.current)==null?void 0:u.queryRenderedFeatures(r,{layers:a});if(o&&o.length>0){const v=o[0];if(!dt(v)||!be(v.geometry))return null;const{geometry:p}=v,b=p.coordinates.slice();return b.length!==2||typeof b[0]!="number"||typeof b[1]!="number"?null:v}},vt=({openPopup:t,map:r,markers:a})=>{const o=R.useRef(null);R.useEffect(()=>{if(!r.current||!a)return;const l=r.current.getCanvas();if(o.current&&(o.current.remove(),o.current=null),t){const d=a.find(u=>u.id===t);if(d){const u=[Number(d.lng)||0,Number(d.lat)||0],v=Ee({coordinates:u,map:r,tooltip:d.Tooltip});v&&(o.current=v)}}const f=d=>{const u=[d.clientX-l.getBoundingClientRect().left,d.clientY-l.getBoundingClientRect().top],v=pt({map:r,point:u});if(v&&v.properties&&v.properties.id){o.current&&(o.current.remove(),o.current=null);const p=a.find(b=>b.id===v.properties.id);if(p){const b=[Number(p.lng)||0,Number(p.lat)||0];requestAnimationFrame(()=>{const T=Ee({coordinates:b,map:r,tooltip:p.Tooltip});T&&(o.current=T)})}}};return l.addEventListener("click",f),()=>{l.removeEventListener("click",f),o.current&&(o.current.remove(),o.current=null)}},[r,a,t])},he=()=>{try{const t=document.createElement("canvas");return(t.getContext("webgl")||t.getContext("experimental-webgl"))instanceof WebGLRenderingContext}catch{return!1}},yt=({mapStyle:t,mapContainer:r,zoomFlyFrom:a,markers:o,center:s})=>{var f,d;return{center:s?ve(s):{lat:((f=o==null?void 0:o[0])==null?void 0:f.lat)!==void 0?Number(o[0].lat):_e,lng:((d=o==null?void 0:o[0])==null?void 0:d.lng)!==void 0?Number(o[0].lng):Re},container:(r==null?void 0:r.current)||"",cooperativeGestures:!0,failIfMajorPerformanceCaveat:!1,style:t,zoom:a}},Re=2.333,_e=46.8677,gt=({markers:t,loading:r,center:a,openPopup:o,onMapClick:s,flyToDuration:l=5e3,fitBoundDuration:f=1e3,fitBounds:d=!0,disableFlyTo:u=!1,fitBoundsPadding:v=50,mapStyle:p="mapbox://styles/mapbox/streets-v12?optimize=true",zoom:b=6,zoomFlyFrom:T=3})=>{const{palette:k}=D.useTheme(),[K,H]=R.useState(!0),[ee,L]=R.useState(!0),_=R.useRef(null),O=R.useRef(null),te=!t||t.some(I=>I.lat===void 0||I.lng===void 0);return R.useEffect(()=>{if(!he()){L(!1),H(!1);return}if(O.current||!_.current||r)return;_.current.innerHTML!==""&&(_.current.innerHTML="");const I=yt({center:a,mapContainer:_,mapStyle:p,markers:t,zoomFlyFrom:T});O.current=new Y.Map(I)},[a,r,p,t,T]),ct({map:O,markers:t,markersAreInvalid:te,palette:k,setLoadingMapBox:H}),vt({map:O,markers:t,openPopup:o}),rt({center:a,map:O}),lt({map:O,onMapClick:s}),tt({disableFlyTo:u,fitBoundDuration:f,fitBounds:d,fitBoundsPadding:v,flyToDuration:l,map:O,markers:t,zoom:b}),R.useEffect(()=>()=>{O.current&&(O.current.remove(),O.current=null)},[]),{loading:K||r,map:O,mapContainer:_,markers:t,webGLSupported:ee}},Et=({containerStyle:t,square:r,theme:a,height:o=300,width:s="100%",...l})=>{const{loading:f,mapContainer:d,webGLSupported:u}=gt(l);return j.jsxs(j.Fragment,{children:[j.jsx(D.GlobalStyles,{styles:{".mapboxgl-popup-content":{backgroundColor:"transparent!important",borderRadius:"0px !important",boxShadow:"none!important",padding:"0px 0px!important",width:"fit-content!important"}}}),j.jsx(et,{ref:d,loading:f,height:o,width:s,containerStyle:t,square:r,error:!u&&"WebGL is not enabled in your browser. This technology is required to display the interactive map."})]})},$=(t,r)=>Number.isFinite(t)&&Number.isFinite(r)&&t>=-90&&t<=90&&r>=-180&&r<=180;x.DEFAULT_CENTER_LAT=46.8677,x.DEFAULT_CENTER_LNG=2.333,x.MapProvider=Qe,x.MapProviderContext=pe,x.MarkerMap=Et,x.isValidLatLng=$,x.isWebGLSupported=he,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { default as React, ReactNode } from 'react';
|
|
2
|
+
import { CustomMarkerMapProps } from '../utils/loadMarkers.tsx';
|
|
2
3
|
export interface MarkerProps {
|
|
3
4
|
/**
|
|
4
5
|
* Optional unique identifier for the marker.
|
|
@@ -35,7 +36,7 @@ export interface MarkerProps {
|
|
|
35
36
|
/**
|
|
36
37
|
* Function to call when the marker is clicked.
|
|
37
38
|
*/
|
|
38
|
-
onClick?: () => void;
|
|
39
|
+
onClick?: (markerData?: CustomMarkerMapProps) => void;
|
|
39
40
|
/**
|
|
40
41
|
* Optional type/category of the marker (e.g., 'restaurant', 'user', etc.).
|
|
41
42
|
*/
|
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
import { Palette } from '@tracktor/design-system';
|
|
2
2
|
import { Map } from 'mapbox-gl';
|
|
3
|
-
import { RefObject } from 'react';
|
|
3
|
+
import { default as React, RefObject } from 'react';
|
|
4
4
|
import { MarkerProps } from '../types/MarkerProps.ts';
|
|
5
|
+
export interface CustomMarkerMapProps {
|
|
6
|
+
geometry: {
|
|
7
|
+
coordinates: number[];
|
|
8
|
+
type: string;
|
|
9
|
+
};
|
|
10
|
+
properties: {
|
|
11
|
+
description?: string;
|
|
12
|
+
id?: string | number;
|
|
13
|
+
size: number;
|
|
14
|
+
zIndex: number;
|
|
15
|
+
name?: string;
|
|
16
|
+
IconComponent?: React.ComponentType<any>;
|
|
17
|
+
iconProps?: Record<string, any>;
|
|
18
|
+
onClick?: (markerData?: CustomMarkerMapProps) => void;
|
|
19
|
+
};
|
|
20
|
+
type: string;
|
|
21
|
+
}
|
|
5
22
|
interface GenerateMarkersProps {
|
|
6
23
|
palette: Palette;
|
|
7
24
|
type?: string;
|
|
@@ -42,13 +42,13 @@ interface MapOptionsProps {
|
|
|
42
42
|
* });
|
|
43
43
|
*/
|
|
44
44
|
declare const mapOptions: ({ mapStyle, mapContainer, zoomFlyFrom, markers, center }: MapOptionsProps) => {
|
|
45
|
-
center: {
|
|
45
|
+
center: [number, number] | {
|
|
46
46
|
lng: number;
|
|
47
47
|
lat: number;
|
|
48
48
|
} | {
|
|
49
49
|
lon: number;
|
|
50
50
|
lat: number;
|
|
51
|
-
} |
|
|
51
|
+
} | undefined;
|
|
52
52
|
container: string | HTMLDivElement;
|
|
53
53
|
cooperativeGestures: boolean;
|
|
54
54
|
failIfMajorPerformanceCaveat: boolean;
|
package/package.json
CHANGED