@tracktor/map 0.4.0 → 0.4.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/dist/main.js +159 -141
- package/dist/main.umd.cjs +8 -8
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -4,7 +4,7 @@ import { LicenseInfo as Pr } from "@mui/x-license";
|
|
|
4
4
|
import Or, { LngLatBounds as wr, Marker as jr, Popup as Ar, Map as Lr } from "mapbox-gl";
|
|
5
5
|
import { Box as ae, Skeleton as Fr, useTheme as Dr, GlobalStyles as Nr } from "@tracktor/design-system";
|
|
6
6
|
import Ir from "react-dom";
|
|
7
|
-
const
|
|
7
|
+
const kr = 2.333, Mr = 46.8677;
|
|
8
8
|
var K = { exports: {} }, Y = {};
|
|
9
9
|
/**
|
|
10
10
|
* @license React
|
|
@@ -20,14 +20,14 @@ function $r() {
|
|
|
20
20
|
if (Ne) return Y;
|
|
21
21
|
Ne = 1;
|
|
22
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
|
|
24
|
-
var
|
|
25
|
-
v !== void 0 && (
|
|
26
|
-
for (
|
|
27
|
-
if (
|
|
28
|
-
return { $$typeof: t, type:
|
|
23
|
+
function d(p, u, v) {
|
|
24
|
+
var f, E = {}, R = null, D = null;
|
|
25
|
+
v !== void 0 && (R = "" + v), u.key !== void 0 && (R = "" + u.key), u.ref !== void 0 && (D = u.ref);
|
|
26
|
+
for (f in u) o.call(u, f) && !l.hasOwnProperty(f) && (E[f] = u[f]);
|
|
27
|
+
if (p && p.defaultProps) for (f in u = p.defaultProps, u) E[f] === void 0 && (E[f] = u[f]);
|
|
28
|
+
return { $$typeof: t, type: p, key: R, ref: D, props: E, _owner: s.current };
|
|
29
29
|
}
|
|
30
|
-
return Y.Fragment = a, Y.jsx =
|
|
30
|
+
return Y.Fragment = a, Y.jsx = d, Y.jsxs = d, 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"), l = Symbol.for("react.profiler"),
|
|
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"), d = Symbol.for("react.provider"), p = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), v = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), R = 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;
|
|
@@ -50,7 +50,7 @@ function Wr() {
|
|
|
50
50
|
return typeof n == "function" ? n : null;
|
|
51
51
|
}
|
|
52
52
|
var w = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
53
|
-
function
|
|
53
|
+
function m(e) {
|
|
54
54
|
{
|
|
55
55
|
for (var n = arguments.length, i = new Array(n > 1 ? n - 1 : 0), c = 1; c < n; c++)
|
|
56
56
|
i[c - 1] = arguments[c];
|
|
@@ -70,7 +70,7 @@ function Wr() {
|
|
|
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 === l || Je || e === s || e === v || e ===
|
|
73
|
+
return !!(typeof e == "string" || typeof e == "function" || e === o || e === l || Je || e === s || e === v || e === f || ze || e === D || X || N || qe || typeof e == "object" && e !== null && (e.$$typeof === R || e.$$typeof === E || e.$$typeof === d || e.$$typeof === p || 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.
|
|
@@ -89,7 +89,7 @@ function Wr() {
|
|
|
89
89
|
function j(e) {
|
|
90
90
|
if (e == null)
|
|
91
91
|
return null;
|
|
92
|
-
if (typeof e.tag == "number" &&
|
|
92
|
+
if (typeof e.tag == "number" && m("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
93
93
|
return e.displayName || e.name || null;
|
|
94
94
|
if (typeof e == "string")
|
|
95
95
|
return e;
|
|
@@ -104,15 +104,15 @@ function Wr() {
|
|
|
104
104
|
return "StrictMode";
|
|
105
105
|
case v:
|
|
106
106
|
return "Suspense";
|
|
107
|
-
case
|
|
107
|
+
case f:
|
|
108
108
|
return "SuspenseList";
|
|
109
109
|
}
|
|
110
110
|
if (typeof e == "object")
|
|
111
111
|
switch (e.$$typeof) {
|
|
112
|
-
case
|
|
112
|
+
case p:
|
|
113
113
|
var n = e;
|
|
114
114
|
return le(n) + ".Consumer";
|
|
115
|
-
case
|
|
115
|
+
case d:
|
|
116
116
|
var i = e;
|
|
117
117
|
return le(i._context) + ".Provider";
|
|
118
118
|
case u:
|
|
@@ -120,7 +120,7 @@ function Wr() {
|
|
|
120
120
|
case E:
|
|
121
121
|
var c = e.displayName || null;
|
|
122
122
|
return c !== null ? c : j(e.type) || "Memo";
|
|
123
|
-
case
|
|
123
|
+
case R: {
|
|
124
124
|
var b = e, h = b._payload, g = b._init;
|
|
125
125
|
try {
|
|
126
126
|
return j(g(h));
|
|
@@ -190,7 +190,7 @@ function Wr() {
|
|
|
190
190
|
})
|
|
191
191
|
});
|
|
192
192
|
}
|
|
193
|
-
$ < 0 &&
|
|
193
|
+
$ < 0 && m("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
var Z = w.ReactCurrentDispatcher, Q;
|
|
@@ -262,25 +262,25 @@ function Wr() {
|
|
|
262
262
|
if (x && c && typeof x.stack == "string") {
|
|
263
263
|
for (var y = x.stack.split(`
|
|
264
264
|
`), T = c.stack.split(`
|
|
265
|
-
`), _ = y.length - 1,
|
|
266
|
-
|
|
267
|
-
for (; _ >= 1 &&
|
|
268
|
-
if (y[_] !== T[
|
|
269
|
-
if (_ !== 1 ||
|
|
265
|
+
`), _ = y.length - 1, C = T.length - 1; _ >= 1 && C >= 0 && y[_] !== T[C]; )
|
|
266
|
+
C--;
|
|
267
|
+
for (; _ >= 1 && C >= 0; _--, C--)
|
|
268
|
+
if (y[_] !== T[C]) {
|
|
269
|
+
if (_ !== 1 || C !== 1)
|
|
270
270
|
do
|
|
271
|
-
if (_--,
|
|
271
|
+
if (_--, C--, C < 0 || y[_] !== T[C]) {
|
|
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 (_ >= 1 &&
|
|
276
|
+
while (_ >= 1 && C >= 0);
|
|
277
277
|
break;
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
} finally {
|
|
281
281
|
ee = !1, Z.current = h, Ze(), Error.prepareStackTrace = b;
|
|
282
282
|
}
|
|
283
|
-
var
|
|
283
|
+
var k = e ? e.displayName || e.name : "", F = k ? V(k) : "";
|
|
284
284
|
return typeof e == "function" && q.set(e, F), F;
|
|
285
285
|
}
|
|
286
286
|
function er(e, n, i) {
|
|
@@ -300,7 +300,7 @@ function Wr() {
|
|
|
300
300
|
switch (e) {
|
|
301
301
|
case v:
|
|
302
302
|
return V("Suspense");
|
|
303
|
-
case
|
|
303
|
+
case f:
|
|
304
304
|
return V("SuspenseList");
|
|
305
305
|
}
|
|
306
306
|
if (typeof e == "object")
|
|
@@ -309,7 +309,7 @@ function Wr() {
|
|
|
309
309
|
return er(e.render);
|
|
310
310
|
case E:
|
|
311
311
|
return z(e.type, n, i);
|
|
312
|
-
case
|
|
312
|
+
case R: {
|
|
313
313
|
var c = e, b = c._payload, h = c._init;
|
|
314
314
|
try {
|
|
315
315
|
return z(h(b), n, i);
|
|
@@ -319,13 +319,13 @@ function Wr() {
|
|
|
319
319
|
}
|
|
320
320
|
return "";
|
|
321
321
|
}
|
|
322
|
-
var W = Object.prototype.hasOwnProperty, Re = {},
|
|
322
|
+
var W = Object.prototype.hasOwnProperty, Re = {}, me = 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
|
+
me.setExtraStackFrame(i);
|
|
327
327
|
} else
|
|
328
|
-
|
|
328
|
+
me.setExtraStackFrame(null);
|
|
329
329
|
}
|
|
330
330
|
function tr(e, n, i, c, b) {
|
|
331
331
|
{
|
|
@@ -342,7 +342,7 @@ function Wr() {
|
|
|
342
342
|
} catch (_) {
|
|
343
343
|
y = _;
|
|
344
344
|
}
|
|
345
|
-
y && !(y instanceof Error) && (J(b),
|
|
345
|
+
y && !(y instanceof Error) && (J(b), m("%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), m("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 _e(e), !1;
|
|
362
362
|
} catch {
|
|
363
363
|
return !0;
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
|
-
function
|
|
366
|
+
function _e(e) {
|
|
367
367
|
return "" + e;
|
|
368
368
|
}
|
|
369
369
|
function Ce(e) {
|
|
370
370
|
if (ir(e))
|
|
371
|
-
return
|
|
371
|
+
return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", or(e)), _e(e);
|
|
372
372
|
}
|
|
373
373
|
var Te = w.ReactCurrentOwner, ar = {
|
|
374
374
|
key: !0,
|
|
@@ -398,7 +398,7 @@ function Wr() {
|
|
|
398
398
|
function lr(e, n) {
|
|
399
399
|
{
|
|
400
400
|
var i = function() {
|
|
401
|
-
xe || (xe = !0,
|
|
401
|
+
xe || (xe = !0, m("%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));
|
|
402
402
|
};
|
|
403
403
|
i.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
404
404
|
get: i,
|
|
@@ -409,7 +409,7 @@ function Wr() {
|
|
|
409
409
|
function fr(e, n) {
|
|
410
410
|
{
|
|
411
411
|
var i = function() {
|
|
412
|
-
Se || (Se = !0,
|
|
412
|
+
Se || (Se = !0, m("%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));
|
|
413
413
|
};
|
|
414
414
|
i.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
415
415
|
get: i,
|
|
@@ -458,8 +458,8 @@ function Wr() {
|
|
|
458
458
|
g[h] === void 0 && (g[h] = _[h]);
|
|
459
459
|
}
|
|
460
460
|
if (y || T) {
|
|
461
|
-
var
|
|
462
|
-
y && lr(g,
|
|
461
|
+
var C = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
462
|
+
y && lr(g, C), T && fr(g, C);
|
|
463
463
|
}
|
|
464
464
|
return dr(e, y, T, b, c, Te.current, g);
|
|
465
465
|
}
|
|
@@ -515,7 +515,7 @@ Check the top-level render call using <` + i + ">.");
|
|
|
515
515
|
return;
|
|
516
516
|
we[i] = !0;
|
|
517
517
|
var c = "";
|
|
518
|
-
e && e._owner && e._owner !== te.current && (c = " It was passed a child from " + j(e._owner.type) + "."), I(e),
|
|
518
|
+
e && e._owner && e._owner !== te.current && (c = " It was passed a child from " + j(e._owner.type) + "."), I(e), m('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) {
|
|
@@ -557,9 +557,9 @@ Check the top-level render call using <` + i + ">.");
|
|
|
557
557
|
} else if (n.PropTypes !== void 0 && !ne) {
|
|
558
558
|
ne = !0;
|
|
559
559
|
var b = j(n);
|
|
560
|
-
|
|
560
|
+
m("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", b || "Unknown");
|
|
561
561
|
}
|
|
562
|
-
typeof n.getDefaultProps == "function" && !n.getDefaultProps.isReactClassApproved &&
|
|
562
|
+
typeof n.getDefaultProps == "function" && !n.getDefaultProps.isReactClassApproved && m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
563
563
|
}
|
|
564
564
|
}
|
|
565
565
|
function br(e) {
|
|
@@ -567,11 +567,11 @@ Check the top-level render call using <` + i + ">.");
|
|
|
567
567
|
for (var n = Object.keys(e.props), i = 0; i < n.length; i++) {
|
|
568
568
|
var c = n[i];
|
|
569
569
|
if (c !== "children" && c !== "key") {
|
|
570
|
-
I(e),
|
|
570
|
+
I(e), m("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
|
}
|
|
574
|
-
e.ref !== null && (I(e),
|
|
574
|
+
e.ref !== null && (I(e), m("Invalid attribute `ref` supplied to `React.Fragment`."), I(null));
|
|
575
575
|
}
|
|
576
576
|
}
|
|
577
577
|
var Le = {};
|
|
@@ -584,21 +584,21 @@ Check the top-level render call using <` + i + ">.");
|
|
|
584
584
|
var T = vr();
|
|
585
585
|
T ? y += T : y += Oe();
|
|
586
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,
|
|
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, m("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 C = pr(e, n, i, b, h);
|
|
590
|
+
if (C == null)
|
|
591
|
+
return C;
|
|
592
592
|
if (g) {
|
|
593
593
|
var P = n.children;
|
|
594
594
|
if (P !== void 0)
|
|
595
595
|
if (c)
|
|
596
596
|
if (re(P)) {
|
|
597
|
-
for (var
|
|
598
|
-
Ae(P[
|
|
597
|
+
for (var k = 0; k < P.length; k++)
|
|
598
|
+
Ae(P[k], e);
|
|
599
599
|
Object.freeze && Object.freeze(P);
|
|
600
600
|
} else
|
|
601
|
-
|
|
601
|
+
m("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
602
602
|
else
|
|
603
603
|
Ae(P, e);
|
|
604
604
|
}
|
|
@@ -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
|
|
611
|
-
|
|
610
|
+
var _r = x.length > 0 ? "{" + x.join(": ..., ") + ": ...}" : "{}";
|
|
611
|
+
m(`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, _r, F), Le[F + ie] = !0;
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
|
-
return e === o ? br(
|
|
619
|
+
return e === o ? br(C) : gr(C), C;
|
|
620
620
|
}
|
|
621
621
|
}
|
|
622
622
|
function Er(e, n, i) {
|
|
@@ -625,13 +625,13 @@ 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, mr = Er;
|
|
629
|
+
U.Fragment = o, U.jsx = Rr, U.jsxs = mr;
|
|
630
630
|
}()), U;
|
|
631
631
|
}
|
|
632
|
-
var
|
|
632
|
+
var ke;
|
|
633
633
|
function Yr() {
|
|
634
|
-
return
|
|
634
|
+
return ke || (ke = 1, process.env.NODE_ENV === "production" ? K.exports = $r() : K.exports = Wr()), K.exports;
|
|
635
635
|
}
|
|
636
636
|
var O = Yr();
|
|
637
637
|
const Ur = Tr({
|
|
@@ -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: l = "100%" },
|
|
652
|
+
}, Gr = ({ containerStyle: r, square: t, error: a, loading: o = !1, height: s = 300, width: l = "100%" }, d) => /* @__PURE__ */ O.jsxs(ae, { sx: { position: "relative" }, height: s, children: [
|
|
653
653
|
/* @__PURE__ */ O.jsx(
|
|
654
654
|
ae,
|
|
655
655
|
{
|
|
@@ -664,7 +664,7 @@ const Ur = Tr({
|
|
|
664
664
|
zIndex: 1,
|
|
665
665
|
...r
|
|
666
666
|
},
|
|
667
|
-
ref:
|
|
667
|
+
ref: d,
|
|
668
668
|
width: l,
|
|
669
669
|
height: s,
|
|
670
670
|
children: a && /* @__PURE__ */ O.jsx(ae, { textAlign: "center", children: a })
|
|
@@ -692,53 +692,53 @@ const Ur = Tr({
|
|
|
692
692
|
zoom: o,
|
|
693
693
|
fitBounds: s,
|
|
694
694
|
markers: l,
|
|
695
|
-
fitBoundDuration:
|
|
696
|
-
fitBoundsPadding:
|
|
695
|
+
fitBoundDuration: d,
|
|
696
|
+
fitBoundsPadding: p
|
|
697
697
|
}) => {
|
|
698
698
|
A(() => {
|
|
699
699
|
if (!r.current || (t || r.current.flyTo({
|
|
700
700
|
duration: a,
|
|
701
701
|
zoom: o
|
|
702
702
|
}), !s || !(l != null && l.length) || (l == null ? void 0 : l.length) < 2)) return;
|
|
703
|
-
const u = new wr(), v = l.filter((
|
|
704
|
-
const E = Number(
|
|
705
|
-
return Ve(
|
|
703
|
+
const u = new wr(), v = l.filter((f) => {
|
|
704
|
+
const E = Number(f.lng), R = Number(f.lat);
|
|
705
|
+
return Ve(R, E);
|
|
706
706
|
});
|
|
707
707
|
if (!(v.length < 2)) {
|
|
708
|
-
for (let
|
|
709
|
-
const E = Number(v[
|
|
710
|
-
u.extend([E,
|
|
708
|
+
for (let f = 0; f < v.length; f += 1) {
|
|
709
|
+
const E = Number(v[f].lng), R = Number(v[f].lat);
|
|
710
|
+
u.extend([E, R]);
|
|
711
711
|
}
|
|
712
712
|
r.current.fitBounds(u, {
|
|
713
|
-
duration:
|
|
714
|
-
padding:
|
|
713
|
+
duration: d,
|
|
714
|
+
padding: p
|
|
715
715
|
});
|
|
716
716
|
}
|
|
717
|
-
}, [l, s,
|
|
717
|
+
}, [l, s, p, a, o, d, 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;
|
|
721
|
-
const a = Array.isArray(t) && Ve(t[1], t[0]) ? We(t) : { lat:
|
|
721
|
+
const a = Array.isArray(t) && Ve(t[1], t[0]) ? We(t) : { lat: Mr, lng: kr };
|
|
722
722
|
a && r.current.setCenter(a);
|
|
723
723
|
}, [t, r]);
|
|
724
724
|
};
|
|
725
|
-
var
|
|
725
|
+
var M = {}, Me;
|
|
726
726
|
function zr() {
|
|
727
|
-
if (
|
|
728
|
-
|
|
727
|
+
if (Me) return M;
|
|
728
|
+
Me = 1;
|
|
729
729
|
var r = Ir;
|
|
730
730
|
if (process.env.NODE_ENV === "production")
|
|
731
|
-
|
|
731
|
+
M.createRoot = r.createRoot, M.hydrateRoot = r.hydrateRoot;
|
|
732
732
|
else {
|
|
733
733
|
var t = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
734
|
-
|
|
734
|
+
M.createRoot = function(a, o) {
|
|
735
735
|
t.usingClientEntryPoint = !0;
|
|
736
736
|
try {
|
|
737
737
|
return r.createRoot(a, o);
|
|
738
738
|
} finally {
|
|
739
739
|
t.usingClientEntryPoint = !1;
|
|
740
740
|
}
|
|
741
|
-
},
|
|
741
|
+
}, M.hydrateRoot = function(a, o, s) {
|
|
742
742
|
t.usingClientEntryPoint = !0;
|
|
743
743
|
try {
|
|
744
744
|
return r.hydrateRoot(a, o, s);
|
|
@@ -747,7 +747,7 @@ function zr() {
|
|
|
747
747
|
}
|
|
748
748
|
};
|
|
749
749
|
}
|
|
750
|
-
return
|
|
750
|
+
return M;
|
|
751
751
|
}
|
|
752
752
|
var Ye = zr();
|
|
753
753
|
const Jr = ({ palette: r, type: t }) => {
|
|
@@ -770,14 +770,14 @@ 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((d) => ({
|
|
774
774
|
geometry: {
|
|
775
|
-
coordinates:
|
|
775
|
+
coordinates: d.geometry.coordinates,
|
|
776
776
|
type: "Point"
|
|
777
777
|
},
|
|
778
778
|
properties: {
|
|
779
|
-
id:
|
|
780
|
-
...
|
|
779
|
+
id: d.properties.id,
|
|
780
|
+
...d.properties
|
|
781
781
|
},
|
|
782
782
|
type: "Feature"
|
|
783
783
|
})),
|
|
@@ -786,13 +786,13 @@ const Jr = ({ palette: r, type: t }) => {
|
|
|
786
786
|
l ? l.setData(s) : r.addSource(t, {
|
|
787
787
|
data: s,
|
|
788
788
|
type: "geojson"
|
|
789
|
-
}), s.features.forEach((
|
|
790
|
-
const { description:
|
|
791
|
-
r.getLayer(
|
|
792
|
-
r.setPaintProperty(
|
|
789
|
+
}), s.features.forEach((d) => {
|
|
790
|
+
const { description: p, id: u } = d.properties || {}, v = Jr({ palette: o, type: p }), f = `marker-${u}`;
|
|
791
|
+
r.getLayer(f) ? Object.entries(v || {}).forEach(([E, R]) => {
|
|
792
|
+
r.setPaintProperty(f, E, R);
|
|
793
793
|
}) : r.addLayer({
|
|
794
794
|
filter: ["==", "id", u],
|
|
795
|
-
id:
|
|
795
|
+
id: f,
|
|
796
796
|
layout: {
|
|
797
797
|
visibility: "visible"
|
|
798
798
|
},
|
|
@@ -803,16 +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: l, onClick:
|
|
807
|
-
if (s &&
|
|
806
|
+
const { IconComponent: s, iconProps: l, onClick: d } = o.properties || {}, { coordinates: p } = o.geometry;
|
|
807
|
+
if (s && p.length >= 2) {
|
|
808
808
|
const u = document.createElement("div");
|
|
809
809
|
u.className = "react-custom-marker", u.style.position = "absolute";
|
|
810
|
-
const v = document.createElement("div"),
|
|
811
|
-
s &&
|
|
810
|
+
const v = document.createElement("div"), f = Ye.createRoot(v);
|
|
811
|
+
s && f.render(ue.createElement(s, l || {})), u.appendChild(v);
|
|
812
812
|
const E = () => {
|
|
813
|
-
|
|
813
|
+
d == null || d(o);
|
|
814
814
|
};
|
|
815
|
-
u.addEventListener("click", E), new jr(u).setLngLat([
|
|
815
|
+
u.addEventListener("click", E), new jr(u).setLngLat([p[0], p[1]]).addTo(r);
|
|
816
816
|
}
|
|
817
817
|
});
|
|
818
818
|
}, Xr = (r) => ({
|
|
@@ -839,16 +839,16 @@ const Jr = ({ palette: r, type: t }) => {
|
|
|
839
839
|
type: "FeatureCollection"
|
|
840
840
|
}), Zr = ({ map: r, setLoadingMapBox: t, palette: a, markers: o }) => {
|
|
841
841
|
if (t(!1), !r.current) return;
|
|
842
|
-
const s = Xr(o), l = s.features.filter((
|
|
842
|
+
const s = Xr(o), l = s.features.filter((p) => {
|
|
843
843
|
var u;
|
|
844
|
-
return ((u =
|
|
844
|
+
return ((u = p.properties) == null ? void 0 : u.IconComponent) === void 0;
|
|
845
845
|
});
|
|
846
846
|
l.length && Kr(r.current, "markerProps", l, a);
|
|
847
|
-
const
|
|
847
|
+
const d = s.features.filter((p) => {
|
|
848
848
|
var u;
|
|
849
|
-
return (u =
|
|
849
|
+
return (u = p.properties) == null ? void 0 : u.IconComponent;
|
|
850
850
|
});
|
|
851
|
-
|
|
851
|
+
d.length && Hr(r.current, d);
|
|
852
852
|
}, Qr = ({ map: r, markers: t, markersAreInvalid: a, palette: o, setLoadingMapBox: s }) => {
|
|
853
853
|
A(() => {
|
|
854
854
|
if (!r.current || a) return;
|
|
@@ -861,8 +861,8 @@ const Jr = ({ palette: r, type: t }) => {
|
|
|
861
861
|
A(() => {
|
|
862
862
|
if (!r.current || !t) return;
|
|
863
863
|
const a = r.current.getCanvas(), o = (s) => {
|
|
864
|
-
const l = [s.clientX - a.getBoundingClientRect().left, s.clientY - a.getBoundingClientRect().top],
|
|
865
|
-
t(
|
|
864
|
+
const l = [s.clientX - a.getBoundingClientRect().left, s.clientY - a.getBoundingClientRect().top], d = r.current.unproject(l);
|
|
865
|
+
t(d.lng, d.lat);
|
|
866
866
|
};
|
|
867
867
|
a.addEventListener("click", o);
|
|
868
868
|
}, [r, t]);
|
|
@@ -878,16 +878,16 @@ const Jr = ({ palette: r, type: t }) => {
|
|
|
878
878
|
s.style.padding = "10px", o.style.zIndex = "1000";
|
|
879
879
|
const l = Ye.createRoot(s);
|
|
880
880
|
l.render(t);
|
|
881
|
-
const
|
|
881
|
+
const d = new Ar({
|
|
882
882
|
closeButton: !1
|
|
883
883
|
}).setLngLat(a).setDOMContent(o).addTo(r.current);
|
|
884
|
-
|
|
884
|
+
d.on("close", () => {
|
|
885
885
|
queueMicrotask(() => {
|
|
886
886
|
l.unmount();
|
|
887
887
|
});
|
|
888
888
|
});
|
|
889
|
-
const
|
|
890
|
-
return o.appendChild(
|
|
889
|
+
const p = rt(d);
|
|
890
|
+
return o.appendChild(p), o.appendChild(s), d;
|
|
891
891
|
}, Ue = (r) => typeof r == "object" && r !== null && "type" in r && "coordinates" in r, tt = (r) => {
|
|
892
892
|
if (typeof r != "object" || r === null || !("geometry" in r && "properties" in r))
|
|
893
893
|
return !1;
|
|
@@ -900,15 +900,15 @@ const Jr = ({ palette: r, type: t }) => {
|
|
|
900
900
|
const { properties: s } = r;
|
|
901
901
|
return typeof s != "object" || s === null ? !1 : "id" in s && s.id !== void 0;
|
|
902
902
|
}, nt = ({ map: r, point: t }) => {
|
|
903
|
-
var s, l,
|
|
903
|
+
var s, l, d, p, u;
|
|
904
904
|
if (!((s = r.current) != null && s.isStyleLoaded()))
|
|
905
905
|
return null;
|
|
906
|
-
const a = ((
|
|
906
|
+
const a = ((p = (d = (l = r.current) == null ? void 0 : l.getStyle()) == null ? void 0 : d.layers) == null ? void 0 : p.filter((v) => v.id.startsWith("marker-")).map((v) => v.id)) || [], o = (u = r.current) == null ? void 0 : u.queryRenderedFeatures(t, { layers: a });
|
|
907
907
|
if (o && o.length > 0) {
|
|
908
908
|
const v = o[0];
|
|
909
909
|
if (!tt(v) || !Ue(v.geometry))
|
|
910
910
|
return null;
|
|
911
|
-
const { geometry:
|
|
911
|
+
const { geometry: f } = v, E = f.coordinates.slice();
|
|
912
912
|
return E.length !== 2 || typeof E[0] != "number" || typeof E[1] != "number" ? null : v;
|
|
913
913
|
}
|
|
914
914
|
}, ot = ({ openPopup: r, map: t, markers: a }) => {
|
|
@@ -917,39 +917,57 @@ const Jr = ({ palette: r, type: t }) => {
|
|
|
917
917
|
if (!t.current || !a) return;
|
|
918
918
|
const l = t.current.getCanvas();
|
|
919
919
|
if (o.current && (o.current.remove(), o.current = null), r) {
|
|
920
|
-
const
|
|
921
|
-
if (
|
|
922
|
-
const u = [Number(
|
|
920
|
+
const p = a.find((u) => u.id === r);
|
|
921
|
+
if (p) {
|
|
922
|
+
const u = [Number(p.lng) || 0, Number(p.lat) || 0], v = $e({
|
|
923
923
|
coordinates: u,
|
|
924
924
|
map: t,
|
|
925
|
-
tooltip:
|
|
925
|
+
tooltip: p.Tooltip
|
|
926
926
|
});
|
|
927
927
|
v && (o.current = v);
|
|
928
928
|
}
|
|
929
929
|
}
|
|
930
|
-
const
|
|
930
|
+
const d = (p) => {
|
|
931
931
|
const u = [
|
|
932
|
-
|
|
933
|
-
|
|
932
|
+
p.clientX - l.getBoundingClientRect().left,
|
|
933
|
+
p.clientY - l.getBoundingClientRect().top
|
|
934
934
|
], v = nt({ map: t, point: u });
|
|
935
935
|
if (v && v.properties && v.properties.id) {
|
|
936
936
|
o.current && (o.current.remove(), o.current = null);
|
|
937
|
-
const
|
|
938
|
-
if (
|
|
939
|
-
const E = [Number(
|
|
937
|
+
const f = a.find((E) => E.id === v.properties.id);
|
|
938
|
+
if (f) {
|
|
939
|
+
const E = [Number(f.lng) || 0, Number(f.lat) || 0];
|
|
940
|
+
if (typeof f.onClick == "function") {
|
|
941
|
+
const R = {
|
|
942
|
+
geometry: {
|
|
943
|
+
coordinates: E,
|
|
944
|
+
type: "Point"
|
|
945
|
+
},
|
|
946
|
+
properties: {
|
|
947
|
+
description: f.name,
|
|
948
|
+
id: f.id,
|
|
949
|
+
name: f.name,
|
|
950
|
+
onClick: f.onClick,
|
|
951
|
+
size: f.size || 1,
|
|
952
|
+
zIndex: f.zIndex || 1
|
|
953
|
+
},
|
|
954
|
+
type: "Feature"
|
|
955
|
+
};
|
|
956
|
+
f.onClick(R);
|
|
957
|
+
}
|
|
940
958
|
requestAnimationFrame(() => {
|
|
941
|
-
const
|
|
959
|
+
const R = $e({
|
|
942
960
|
coordinates: E,
|
|
943
961
|
map: t,
|
|
944
|
-
tooltip:
|
|
962
|
+
tooltip: f.Tooltip
|
|
945
963
|
});
|
|
946
|
-
|
|
964
|
+
R && (o.current = R);
|
|
947
965
|
});
|
|
948
966
|
}
|
|
949
967
|
}
|
|
950
968
|
};
|
|
951
|
-
return l.addEventListener("click",
|
|
952
|
-
l.removeEventListener("click",
|
|
969
|
+
return l.addEventListener("click", d), () => {
|
|
970
|
+
l.removeEventListener("click", d), o.current && (o.current.remove(), o.current = null);
|
|
953
971
|
};
|
|
954
972
|
}, [t, a, r]);
|
|
955
973
|
}, it = () => {
|
|
@@ -960,11 +978,11 @@ const Jr = ({ palette: r, type: t }) => {
|
|
|
960
978
|
return !1;
|
|
961
979
|
}
|
|
962
980
|
}, at = ({ mapStyle: r, mapContainer: t, zoomFlyFrom: a, markers: o, center: s }) => {
|
|
963
|
-
var
|
|
981
|
+
var d, p;
|
|
964
982
|
return {
|
|
965
983
|
center: s ? We(s) : {
|
|
966
|
-
lat: ((
|
|
967
|
-
lng: ((
|
|
984
|
+
lat: ((d = o == null ? void 0 : o[0]) == null ? void 0 : d.lat) !== void 0 ? Number(o[0].lat) : Be,
|
|
985
|
+
lng: ((p = o == null ? void 0 : o[0]) == null ? void 0 : p.lng) !== void 0 ? Number(o[0].lng) : Ge
|
|
968
986
|
},
|
|
969
987
|
container: (t == null ? void 0 : t.current) || "",
|
|
970
988
|
cooperativeGestures: !0,
|
|
@@ -979,26 +997,26 @@ const Jr = ({ palette: r, type: t }) => {
|
|
|
979
997
|
openPopup: o,
|
|
980
998
|
onMapClick: s,
|
|
981
999
|
flyToDuration: l = 5e3,
|
|
982
|
-
fitBoundDuration:
|
|
983
|
-
fitBounds:
|
|
1000
|
+
fitBoundDuration: d = 1e3,
|
|
1001
|
+
fitBounds: p = !0,
|
|
984
1002
|
disableFlyTo: u = !1,
|
|
985
1003
|
fitBoundsPadding: v = 50,
|
|
986
|
-
mapStyle:
|
|
1004
|
+
mapStyle: f = "mapbox://styles/mapbox/streets-v12?optimize=true",
|
|
987
1005
|
zoom: E = 6,
|
|
988
|
-
zoomFlyFrom:
|
|
1006
|
+
zoomFlyFrom: R = 3
|
|
989
1007
|
}) => {
|
|
990
|
-
const { palette: D } = Dr(), [G, B] = De(!0), [H, w] = De(!0),
|
|
1008
|
+
const { palette: D } = Dr(), [G, B] = De(!0), [H, w] = De(!0), m = se(null), S = se(null), X = !r || r.some((N) => N.lat === void 0 || N.lng === void 0);
|
|
991
1009
|
return A(() => {
|
|
992
1010
|
if (!it()) {
|
|
993
1011
|
w(!1), B(!1);
|
|
994
1012
|
return;
|
|
995
1013
|
}
|
|
996
|
-
if (S.current || !
|
|
1014
|
+
if (S.current || !m.current || t)
|
|
997
1015
|
return;
|
|
998
|
-
|
|
999
|
-
const N = at({ center: a, mapContainer:
|
|
1016
|
+
m.current.innerHTML !== "" && (m.current.innerHTML = "");
|
|
1017
|
+
const N = at({ center: a, mapContainer: m, mapStyle: f, markers: r, zoomFlyFrom: R });
|
|
1000
1018
|
S.current = new Lr(N);
|
|
1001
|
-
}, [a, t,
|
|
1019
|
+
}, [a, t, f, r, R]), 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: d, fitBounds: p, fitBoundsPadding: v, flyToDuration: l, map: S, markers: r, zoom: E }), A(
|
|
1002
1020
|
() => () => {
|
|
1003
1021
|
S.current && (S.current.remove(), S.current = null);
|
|
1004
1022
|
},
|
|
@@ -1006,12 +1024,12 @@ const Jr = ({ palette: r, type: t }) => {
|
|
|
1006
1024
|
), {
|
|
1007
1025
|
loading: G || t,
|
|
1008
1026
|
map: S,
|
|
1009
|
-
mapContainer:
|
|
1027
|
+
mapContainer: m,
|
|
1010
1028
|
markers: r,
|
|
1011
1029
|
webGLSupported: H
|
|
1012
1030
|
};
|
|
1013
1031
|
}, vt = ({ containerStyle: r, square: t, theme: a, height: o = 300, width: s = "100%", ...l }) => {
|
|
1014
|
-
const { loading:
|
|
1032
|
+
const { loading: d, mapContainer: p, webGLSupported: u } = st(l);
|
|
1015
1033
|
return /* @__PURE__ */ O.jsxs(O.Fragment, { children: [
|
|
1016
1034
|
/* @__PURE__ */ O.jsx(
|
|
1017
1035
|
Nr,
|
|
@@ -1030,8 +1048,8 @@ const Jr = ({ palette: r, type: t }) => {
|
|
|
1030
1048
|
/* @__PURE__ */ O.jsx(
|
|
1031
1049
|
Br,
|
|
1032
1050
|
{
|
|
1033
|
-
ref:
|
|
1034
|
-
loading:
|
|
1051
|
+
ref: p,
|
|
1052
|
+
loading: d,
|
|
1035
1053
|
height: o,
|
|
1036
1054
|
width: s,
|
|
1037
1055
|
containerStyle: r,
|
|
@@ -1042,8 +1060,8 @@ const Jr = ({ palette: r, type: t }) => {
|
|
|
1042
1060
|
] });
|
|
1043
1061
|
}, Ve = (r, t) => Number.isFinite(r) && Number.isFinite(t) && r >= -90 && r <= 90 && t >= -180 && t <= 180;
|
|
1044
1062
|
export {
|
|
1045
|
-
|
|
1046
|
-
|
|
1063
|
+
Mr as DEFAULT_CENTER_LAT,
|
|
1064
|
+
kr as DEFAULT_CENTER_LNG,
|
|
1047
1065
|
pt as MapProvider,
|
|
1048
1066
|
Ur as MapProviderContext,
|
|
1049
1067
|
vt as MarkerMap,
|
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,l={key:!0,ref:!0,__self:!0,__source:!0};function
|
|
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 d(p,u,v){var f,b={},_=null,M=null;v!==void 0&&(_=""+v),u.key!==void 0&&(_=""+u.key),u.ref!==void 0&&(M=u.ref);for(f in u)o.call(u,f)&&!l.hasOwnProperty(f)&&(b[f]=u[f]);if(p&&p.defaultProps)for(f in u=p.defaultProps,u)b[f]===void 0&&(b[f]=u[f]);return{$$typeof:r,type:p,key:_,ref:M,props:b,_owner:s.current}}return G.Fragment=a,G.jsx=d,G.jsxs=d,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"),l=Symbol.for("react.profiler"),
|
|
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,
|
|
20
|
-
`),
|
|
21
|
-
`),C=y.length-1,
|
|
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&&
|
|
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"),d=Symbol.for("react.provider"),p=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),b=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),M=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 m(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,me;me=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===f||ht||e===M||te||I||bt||typeof e=="object"&&e!==null&&(e.$$typeof===_||e.$$typeof===b||e.$$typeof===d||e.$$typeof===p||e.$$typeof===u||e.$$typeof===me||e.getModuleId!==void 0))}function mt(e,n,i){var c=e.displayName;if(c)return c;var E=n.displayName||n.name||"";return E!==""?i+"("+E+")":i}function Ce(e){return e.displayName||"Context"}function A(e){if(e==null)return null;if(typeof e.tag=="number"&&m("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 f:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case p:var n=e;return Ce(n)+".Consumer";case d:var i=e;return Ce(i._context)+".Provider";case u:return mt(e,e.render,"ForwardRef");case b:var c=e.displayName||null;return c!==null?c:A(e.type)||"Memo";case _:{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,Pe,Se,Oe,we,je;function Le(){}Le.__reactDisabledLog=!0;function Ct(){{if(V===0){Te=console.log,xe=console.info,Pe=console.warn,Se=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:Pe}),error:F({},e,{value:Se}),group:F({},e,{value:Oe}),groupCollapsed:F({},e,{value:we}),groupEnd:F({},e,{value:je})})}V<0&&m("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,Ct();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(S){c=S}Reflect.construct(e,[],g)}else{try{g.call()}catch(S){c=S}e.call(g.prototype)}}else{try{throw Error()}catch(S){c=S}e()}}catch(S){if(S&&c&&typeof S.stack=="string"){for(var y=S.stack.split(`
|
|
20
|
+
`),P=c.stack.split(`
|
|
21
|
+
`),C=y.length-1,T=P.length-1;C>=1&&T>=0&&y[C]!==P[T];)T--;for(;C>=1&&T>=0;C--,T--)if(y[C]!==P[T]){if(C!==1||T!==1)do if(C--,T--,T<0||y[C]!==P[T]){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&&T>=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 Pt(e,n,i){return Ae(e,!1)}function St(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,St(e));if(typeof e=="string")return X(e);switch(e){case v:return X("Suspense");case f:return X("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case u:return Pt(e.render);case b:return Z(e.type,n,i);case _:{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 P=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 P.name="Invariant Violation",P}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),m("%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),m("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 ke(e){if(Lt(e))return m("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 Me=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"&&Me.current}function kt(e,n){{var i=function(){Ie||(Ie=!0,m("%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 Mt(e,n){{var i=function(){We||(We=!0,m("%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,P=null;i!==void 0&&(ke(i),y=""+i),Nt(n)&&(ke(n.key),y=""+n.key),Ft(n)&&(P=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||P){var T=typeof e=="function"?e.displayName||e.name||"Unknown":e;y&&kt(g,T),P&&Mt(g,T)}return It(e,y,P,E,c,Me.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 c="";e&&e._owner&&e._owner!==ae.current&&(c=" It was passed a child from "+A(e._owner.type)+"."),W(e),
|
|
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),m('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);m("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",E||"Unknown")}typeof n.getDefaultProps=="function"&&!n.getDefaultProps.isReactClassApproved&&m("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),m("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),m("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 P=Ut();P?y+=P: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,m("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 T=Wt(e,n,i,E,h);if(T==null)return T;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 m("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),S=Object.keys(n).filter(function(Xt){return Xt!=="key"}),ce=S.length>0?"{key: someKey, "+S.join(": ..., ")+": ...}":"{key: someKey}";if(!ze[N+ce]){var Ht=S.length>0?"{"+S.join(": ..., ")+": ...}":"{}";m(`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(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"})});
|
|
31
|
+
<%s key={someKey} {...props} />`,ce,N,Ht,N),ze[N+ce]=!0}}return e===o?Bt(T):Gt(T),T}}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%"},d)=>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:d,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:d,fitBoundsPadding:p})=>{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(f=>{const b=Number(f.lng),_=Number(f.lat);return $(_,b)});if(!(v.length<2)){for(let f=0;f<v.length;f+=1){const b=Number(v[f].lng),_=Number(v[f].lat);u.extend([b,_])}t.current.fitBounds(u,{duration:d,padding:p})}},[l,s,p,a,o,d,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 k={},ye;function nt(){if(ye)return k;ye=1;var t=He;if(process.env.NODE_ENV==="production")k.createRoot=t.createRoot,k.hydrateRoot=t.hydrateRoot;else{var r=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;k.createRoot=function(a,o){r.usingClientEntryPoint=!0;try{return t.createRoot(a,o)}finally{r.usingClientEntryPoint=!1}},k.hydrateRoot=function(a,o,s){r.usingClientEntryPoint=!0;try{return t.hydrateRoot(a,o,s)}finally{r.usingClientEntryPoint=!1}}}return k}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(d=>({geometry:{coordinates:d.geometry.coordinates,type:"Point"},properties:{id:d.properties.id,...d.properties},type:"Feature"})),type:"FeatureCollection"},l=t.getSource(r);l?l.setData(s):t.addSource(r,{data:s,type:"geojson"}),s.features.forEach(d=>{const{description:p,id:u}=d.properties||{},v=ot({palette:o,type:p}),f=`marker-${u}`;t.getLayer(f)?Object.entries(v||{}).forEach(([b,_])=>{t.setPaintProperty(f,b,_)}):t.addLayer({filter:["==","id",u],id:f,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:d}=o.properties||{},{coordinates:p}=o.geometry;if(s&&p.length>=2){const u=document.createElement("div");u.className="react-custom-marker",u.style.position="absolute";const v=document.createElement("div"),f=ge.createRoot(v);s&&f.render(R.createElement(s,l||{})),u.appendChild(v);const b=()=>{d==null||d(o)};u.addEventListener("click",b),new Y.Marker(u).setLngLat([p[0],p[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(p=>{var u;return((u=p.properties)==null?void 0:u.IconComponent)===void 0});l.length&&it(t.current,"markerProps",l,a);const d=s.features.filter(p=>{var u;return(u=p.properties)==null?void 0:u.IconComponent});d.length&&at(t.current,d)},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],d=t.current.unproject(l);r(d.lng,d.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 d=new Y.Popup({closeButton:!1}).setLngLat(a).setDOMContent(o).addTo(t.current);d.on("close",()=>{queueMicrotask(()=>{l.unmount()})});const p=ft(d);return o.appendChild(p),o.appendChild(s),d},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,d,p,u;if(!((s=t.current)!=null&&s.isStyleLoaded()))return null;const a=((p=(d=(l=t.current)==null?void 0:l.getStyle())==null?void 0:d.layers)==null?void 0:p.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:f}=v,b=f.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 p=a.find(u=>u.id===t);if(p){const u=[Number(p.lng)||0,Number(p.lat)||0],v=Ee({coordinates:u,map:r,tooltip:p.Tooltip});v&&(o.current=v)}}const d=p=>{const u=[p.clientX-l.getBoundingClientRect().left,p.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 f=a.find(b=>b.id===v.properties.id);if(f){const b=[Number(f.lng)||0,Number(f.lat)||0];if(typeof f.onClick=="function"){const _={geometry:{coordinates:b,type:"Point"},properties:{description:f.name,id:f.id,name:f.name,onClick:f.onClick,size:f.size||1,zIndex:f.zIndex||1},type:"Feature"};f.onClick(_)}requestAnimationFrame(()=>{const _=Ee({coordinates:b,map:r,tooltip:f.Tooltip});_&&(o.current=_)})}}};return l.addEventListener("click",d),()=>{l.removeEventListener("click",d),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 d,p;return{center:s?ve(s):{lat:((d=o==null?void 0:o[0])==null?void 0:d.lat)!==void 0?Number(o[0].lat):_e,lng:((p=o==null?void 0:o[0])==null?void 0:p.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:d=1e3,fitBounds:p=!0,disableFlyTo:u=!1,fitBoundsPadding:v=50,mapStyle:f="mapbox://styles/mapbox/streets-v12?optimize=true",zoom:b=6,zoomFlyFrom:_=3})=>{const{palette:M}=D.useTheme(),[K,H]=R.useState(!0),[ee,L]=R.useState(!0),m=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||!m.current||r)return;m.current.innerHTML!==""&&(m.current.innerHTML="");const I=yt({center:a,mapContainer:m,mapStyle:f,markers:t,zoomFlyFrom:_});O.current=new Y.Map(I)},[a,r,f,t,_]),ct({map:O,markers:t,markersAreInvalid:te,palette:M,setLoadingMapBox:H}),vt({map:O,markers:t,openPopup:o}),rt({center:a,map:O}),lt({map:O,onMapClick:s}),tt({disableFlyTo:u,fitBoundDuration:d,fitBounds:p,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:m,markers:t,webGLSupported:ee}},Et=({containerStyle:t,square:r,theme:a,height:o=300,width:s="100%",...l})=>{const{loading:d,mapContainer:p,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:p,loading:d,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"})});
|
package/package.json
CHANGED