@local-logic/maps 0.1.9 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index-2-7bXVdw.js +109 -0
- package/dist/{index-BrJk0fvu.js → index-5KsGujTK.js} +2 -2
- package/dist/{index-D06VjH1r.js → index-8AZECG4p.js} +2 -2
- package/dist/{index-CSsNIeGf.js → index-BCfZMtQL.js} +2 -2
- package/dist/{index-DEk1iNZG.js → index-BJa715Dk.js} +1 -1
- package/dist/{index-BIEyexab.js → index-BZQ1oWSp.js} +2 -2
- package/dist/{index-B-7FSpFA.js → index-Bm3Y5tYu.js} +72 -72
- package/dist/{index-CGULF4ex.js → index-CNCGWBR2.js} +2 -2
- package/dist/{index-BjiM48Gd.js → index-CV3FlwtS.js} +28 -28
- package/dist/{index-B9geAgZc.js → index-DJemWGRP.js} +28 -28
- package/dist/{index-BDolTDJO.js → index-HiFwRrPn.js} +1 -1
- package/dist/{index-DI5zCndd.js → index-g1-fRXga.js} +2 -2
- package/dist/index.es.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/src/components/Map/Root/BaseMap/Google/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/BaseMap/Mapbox/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/BaseMap/Maptiler/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/index.d.ts.map +1 -1
- package/dist/{styles-C3ghTFwc.js → styles-C7XlxM5D.js} +1 -1
- package/package.json +2 -2
- package/dist/index-BKCGWHuo.js +0 -109
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsxs as h, jsx as M } from "react/jsx-runtime";
|
|
2
|
+
import { useState as x, useRef as Z, useCallback as B, useEffect as g } from "react";
|
|
3
3
|
import { M as L, N as P, u as T } from "./scale-control-Dsir9fWY.js";
|
|
4
|
-
import { u as v, D as f, a as
|
|
5
|
-
import { t as
|
|
6
|
-
const
|
|
4
|
+
import { u as v, D as f, a as y, m as z } from "./index-Bm3Y5tYu.js";
|
|
5
|
+
import { t as A } from "./index-DscDx7HE.js";
|
|
6
|
+
const E = {
|
|
7
7
|
en: {
|
|
8
8
|
"AttributionControl.ToggleAttribution": "Toggle attribution",
|
|
9
9
|
"FullscreenControl.Enter": "Enter fullscreen",
|
|
@@ -35,26 +35,26 @@ const y = {
|
|
|
35
35
|
"TouchPanBlocker.Message": "Utilisez deux doigts pour déplacer la carte"
|
|
36
36
|
}
|
|
37
37
|
}, k = () => {
|
|
38
|
-
const { current: o } = T(), { centerPinMarkerPoints: t, markerPoints: n, locationBoundary:
|
|
38
|
+
const { current: o } = T(), { centerPinMarkerPoints: t, markerPoints: n, locationBoundary: r, setZoom: c, mapPadding: u } = v(), [l, d] = x(void 0), s = Z(void 0), a = B(() => {
|
|
39
39
|
o && c(o.getZoom());
|
|
40
40
|
}, [o, c]);
|
|
41
|
-
return g(() => (
|
|
42
|
-
o?.off("zoom",
|
|
43
|
-
}), [o,
|
|
41
|
+
return g(() => (a(), o?.on("zoom", a), () => {
|
|
42
|
+
o?.off("zoom", a);
|
|
43
|
+
}), [o, a]), g(() => {
|
|
44
44
|
if (!o)
|
|
45
45
|
return;
|
|
46
46
|
const e = [];
|
|
47
|
-
if (typeof n < "u" && n.length > 0 ? (e.push(...n), t && e.push(t)) : e.push(
|
|
47
|
+
if (typeof r < "u" && r.length > 0 ? e.push(...r) : typeof n < "u" && n.length > 0 ? (e.push(...n), t && e.push(t)) : t !== void 0 && e.push(t), e.length === 0)
|
|
48
48
|
return;
|
|
49
|
-
const
|
|
50
|
-
(!
|
|
51
|
-
}, [o, n,
|
|
52
|
-
if (!o || typeof
|
|
49
|
+
const i = A(z(e));
|
|
50
|
+
(!s.current || !i.every((m, p) => m === s.current?.[p])) && (s.current = i, d(i));
|
|
51
|
+
}, [o, n, r, t]), g(() => {
|
|
52
|
+
if (!o || typeof l > "u")
|
|
53
53
|
return;
|
|
54
|
-
const [e,
|
|
54
|
+
const [e, i, m, p] = l, b = (m - e) * 0.1 || 1e-3, C = (p - i) * 0.1 || 1e-3;
|
|
55
55
|
o.fitBounds(
|
|
56
56
|
[
|
|
57
|
-
[e - b,
|
|
57
|
+
[e - b, i - C],
|
|
58
58
|
[m + b, p + C]
|
|
59
59
|
],
|
|
60
60
|
{
|
|
@@ -67,37 +67,37 @@ const y = {
|
|
|
67
67
|
duration: 700
|
|
68
68
|
}
|
|
69
69
|
);
|
|
70
|
-
}, [o,
|
|
70
|
+
}, [o, l, u]), null;
|
|
71
71
|
};
|
|
72
72
|
function G({ children: o }) {
|
|
73
73
|
const {
|
|
74
74
|
mapProvider: t,
|
|
75
75
|
locale: n,
|
|
76
|
-
center:
|
|
76
|
+
center: r,
|
|
77
77
|
zoom: c = f.zoom,
|
|
78
78
|
minZoom: u,
|
|
79
|
-
maxZoom:
|
|
79
|
+
maxZoom: l,
|
|
80
80
|
pitch: d = f.pitch,
|
|
81
|
-
bearing:
|
|
82
|
-
cooperativeGestures:
|
|
81
|
+
bearing: s = f.bearing,
|
|
82
|
+
cooperativeGestures: a = f.cooperativeGestures,
|
|
83
83
|
zoomPosition: e
|
|
84
84
|
} = v();
|
|
85
|
-
return t.name !== "mapbox" ? null : /* @__PURE__ */
|
|
85
|
+
return t.name !== "mapbox" ? null : /* @__PURE__ */ h(
|
|
86
86
|
L,
|
|
87
87
|
{
|
|
88
88
|
mapboxAccessToken: t.apiKey,
|
|
89
89
|
initialViewState: {
|
|
90
|
-
...
|
|
90
|
+
...r,
|
|
91
91
|
zoom: c,
|
|
92
92
|
pitch: d,
|
|
93
|
-
bearing:
|
|
93
|
+
bearing: s
|
|
94
94
|
},
|
|
95
|
-
cooperativeGestures:
|
|
95
|
+
cooperativeGestures: a,
|
|
96
96
|
minZoom: u,
|
|
97
|
-
maxZoom:
|
|
98
|
-
mapStyle: `mapbox://styles/${t.theme ||
|
|
97
|
+
maxZoom: l,
|
|
98
|
+
mapStyle: `mapbox://styles/${t.theme || y.mapbox}`,
|
|
99
99
|
interactiveLayerIds: ["road-label", "waterway-label"],
|
|
100
|
-
locale:
|
|
100
|
+
locale: E[n],
|
|
101
101
|
children: [
|
|
102
102
|
/* @__PURE__ */ M(k, {}),
|
|
103
103
|
e && /* @__PURE__ */ M(P, { position: e }),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as i, jsx as e, Fragment as d } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo as u } from "react";
|
|
3
|
-
import { u as f, M as n } from "./index-
|
|
3
|
+
import { u as f, M as n } from "./index-Bm3Y5tYu.js";
|
|
4
4
|
import { c as o, M as v } from "./index-D4t3jFAj.js";
|
|
5
5
|
const M = `
|
|
6
6
|
relative flex
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsxs as f, jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { a as k } from "./scale-control-Dsir9fWY.js";
|
|
3
3
|
import "react";
|
|
4
|
-
import { u, M } from "./index-
|
|
4
|
+
import { u, M } from "./index-Bm3Y5tYu.js";
|
|
5
5
|
import { c as g, M as C } from "./index-D4t3jFAj.js";
|
|
6
|
-
import { C as b } from "./index-
|
|
6
|
+
import { C as b } from "./index-HiFwRrPn.js";
|
|
7
7
|
function y({
|
|
8
8
|
clusters: n,
|
|
9
9
|
colors: r,
|
package/dist/index.es.js
CHANGED
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(D,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react/jsx-runtime"),require("react"),require("@vis.gl/react-google-maps"),require("@phosphor-icons/react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","@vis.gl/react-google-maps","@phosphor-icons/react","react-dom"],m):(D=typeof globalThis<"u"?globalThis:D||self,m(D.LocalLogicMaps={},D.jsxRuntime,D.React,D.ReactGoogleMaps,D.PhosphorIcons,D.ReactDOM))})(this,(function(D,m,c,Z,le,Se){"use strict";function bo(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const n=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const T=bo(c),st=c.createContext({}),z=()=>c.useContext(st),F={zoom:14,pitch:0,bearing:0,cooperativeGestures:!1},be={maptiler:"600d69cb-288d-445e-9839-3dfe4d76b31a",mapbox:"locallogic/cmb9nz9kb011501ru8drq8fqf",google:"a7ff20eb973126bb",testing:"testing"},ve={top:10,bottom:10,left:10,right:10},at=10,vo=22,we=10,wo=30,xo=60,ce=15,ue=[-180,-85.0511,180,85.0511],_o="w-full h-full relative overflow-hidden",Co=c.lazy(()=>Promise.resolve().then(()=>Fn)),Mo=c.lazy(()=>Promise.resolve().then(()=>Bn)),ko=c.lazy(()=>Promise.resolve().then(()=>Mr)),lt=c.lazy(()=>Promise.resolve().then(()=>Lr)),So=({children:e})=>{const{mapProvider:t,center:o,zoom:n=F.zoom,pitch:r=F.pitch,bearing:i=F.bearing,cooperativeGestures:s=F.cooperativeGestures,zoomPosition:l}=z(),[a]=c.useState(n),d=c.useMemo(()=>{switch(t?.name){case"maptiler":return Co;case"google":return Mo;case"mapbox":return ko;case"testing":return lt;default:return lt}},[t]);return m.jsx("div",{className:_o,"data-testid":"base-map","data-map-provider-name":t?.name,"data-map-provider-theme":t?.theme||be[t?.name]||be.maptiler,"data-initial-zoom":a,"data-pitch":r,"data-bearing":i,"data-cooperative-gestures":s,"data-zoom-position":l,"data-center-latitude":o.latitude,"data-center-longitude":o.longitude,children:m.jsx(c.Suspense,{fallback:null,children:m.jsx(d,{children:e})})})},Po=c.lazy(()=>Promise.resolve().then(()=>ci)),Eo=c.lazy(()=>Promise.resolve().then(()=>di)),Lo=c.lazy(()=>Promise.resolve().then(()=>mi)),To=c.lazy(()=>Promise.resolve().then(()=>hi));function zo(e){const{mapProvider:t,setCenterPinMarkerPoints:o}=z();c.useEffect(()=>{if(e?.marker)return o([e.marker.longitude,e.marker.latitude]),()=>{o(void 0)}},[e?.marker?.longitude,e?.marker?.latitude,o]);const n=c.useMemo(()=>{switch(t?.name){case"maptiler":return Po;case"google":return Eo;case"mapbox":return Lo;case"testing":return To;default:return null}},[t]);return n?m.jsx(c.Suspense,{fallback:null,children:m.jsx(n,{...e})}):null}function ct(e,t,o={}){const n={type:"Feature"};return(o.id===0||o.id)&&(n.id=o.id),o.bbox&&(n.bbox=o.bbox),n.properties=t||{},n.geometry=e,n}function Ao(e,t,o={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!ut(e[0])||!ut(e[1]))throw new Error("coordinates must contain numbers");return ct({type:"Point",coordinates:e},t,o)}function Ie(e,t,o={}){return ct({type:"MultiPoint",coordinates:e},t,o)}function ut(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}const dt=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],je=1,xe=8;class Ze{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[o,n]=new Uint8Array(t,0,2);if(o!==219)throw new Error("Data does not appear to be in a KDBush format.");const r=n>>4;if(r!==je)throw new Error(`Got v${r} data when expected v${je}.`);const i=dt[n&15];if(!i)throw new Error("Unrecognized array type.");const[s]=new Uint16Array(t,2,1),[l]=new Uint32Array(t,4,1);return new Ze(l,s,i,t)}constructor(t,o=64,n=Float64Array,r){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+o,2),65535),this.ArrayType=n,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const i=dt.indexOf(this.ArrayType),s=t*2*this.ArrayType.BYTES_PER_ELEMENT,l=t*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-l%8)%8;if(i<0)throw new Error(`Unexpected typed array class: ${n}.`);r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,xe,t),this.coords=new this.ArrayType(this.data,xe+l+a,t*2),this._pos=t*2,this._finished=!0):(this.data=new ArrayBuffer(xe+s+l+a),this.ids=new this.IndexArrayType(this.data,xe,t),this.coords=new this.ArrayType(this.data,xe+l+a,t*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(je<<4)+i]),new Uint16Array(this.data,2,1)[0]=o,new Uint32Array(this.data,4,1)[0]=t)}add(t,o){const n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=t,this.coords[this._pos++]=o,n}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Be(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,o,n,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:s,nodeSize:l}=this,a=[0,i.length-1,0],d=[];for(;a.length;){const f=a.pop()||0,u=a.pop()||0,p=a.pop()||0;if(u-p<=l){for(let h=p;h<=u;h++){const v=s[2*h],E=s[2*h+1];v>=t&&v<=n&&E>=o&&E<=r&&d.push(i[h])}continue}const g=p+u>>1,y=s[2*g],b=s[2*g+1];y>=t&&y<=n&&b>=o&&b<=r&&d.push(i[g]),(f===0?t<=y:o<=b)&&(a.push(p),a.push(g-1),a.push(1-f)),(f===0?n>=y:r>=b)&&(a.push(g+1),a.push(u),a.push(1-f))}return d}within(t,o,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:r,coords:i,nodeSize:s}=this,l=[0,r.length-1,0],a=[],d=n*n;for(;l.length;){const f=l.pop()||0,u=l.pop()||0,p=l.pop()||0;if(u-p<=s){for(let h=p;h<=u;h++)mt(i[2*h],i[2*h+1],t,o)<=d&&a.push(r[h]);continue}const g=p+u>>1,y=i[2*g],b=i[2*g+1];mt(y,b,t,o)<=d&&a.push(r[g]),(f===0?t-n<=y:o-n<=b)&&(l.push(p),l.push(g-1),l.push(1-f)),(f===0?t+n>=y:o+n>=b)&&(l.push(g+1),l.push(u),l.push(1-f))}return a}}function Be(e,t,o,n,r,i){if(r-n<=o)return;const s=n+r>>1;ft(e,t,s,n,r,i),Be(e,t,o,n,s-1,1-i),Be(e,t,o,s+1,r,1-i)}function ft(e,t,o,n,r,i){for(;r>n;){if(r-n>600){const d=r-n+1,f=o-n+1,u=Math.log(d),p=.5*Math.exp(2*u/3),g=.5*Math.sqrt(u*p*(d-p)/d)*(f-d/2<0?-1:1),y=Math.max(n,Math.floor(o-f*p/d+g)),b=Math.min(r,Math.floor(o+(d-f)*p/d+g));ft(e,t,o,y,b,i)}const s=t[2*o+i];let l=n,a=r;for(_e(e,t,n,o),t[2*r+i]>s&&_e(e,t,n,r);l<a;){for(_e(e,t,l,a),l++,a--;t[2*l+i]<s;)l++;for(;t[2*a+i]>s;)a--}t[2*n+i]===s?_e(e,t,n,a):(a++,_e(e,t,a,r)),a<=o&&(n=a+1),o<=a&&(r=a-1)}}function _e(e,t,o,n){Ue(e,o,n),Ue(t,2*o,2*n),Ue(t,2*o+1,2*n+1)}function Ue(e,t,o){const n=e[t];e[t]=e[o],e[o]=n}function mt(e,t,o,n){const r=e-o,i=t-n;return r*r+i*i}const Oo={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},pt=Math.fround||(e=>(t=>(e[0]=+t,e[0])))(new Float32Array(1)),ee=2,J=3,De=4,Y=5,gt=6;class $o{constructor(t){this.options=Object.assign(Object.create(Oo),t),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(t){const{log:o,minZoom:n,maxZoom:r}=this.options;o&&console.time("total time");const i=`prepare ${t.length} points`;o&&console.time(i),this.points=t;const s=[];for(let a=0;a<t.length;a++){const d=t[a];if(!d.geometry)continue;const[f,u]=d.geometry.coordinates,p=pt(Pe(f)),g=pt(Ee(u));s.push(p,g,1/0,a,-1,1),this.options.reduce&&s.push(0)}let l=this.trees[r+1]=this._createTree(s);o&&console.timeEnd(i);for(let a=r;a>=n;a--){const d=+Date.now();l=this.trees[a]=this._createTree(this._cluster(l,a)),o&&console.log("z%d: %d clusters in %dms",a,l.numItems,+Date.now()-d)}return o&&console.timeEnd("total time"),this}getClusters(t,o){let n=((t[0]+180)%360+360)%360-180;const r=Math.max(-90,Math.min(90,t[1]));let i=t[2]===180?180:((t[2]+180)%360+360)%360-180;const s=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)n=-180,i=180;else if(n>i){const u=this.getClusters([n,r,180,s],o),p=this.getClusters([-180,r,i,s],o);return u.concat(p)}const l=this.trees[this._limitZoom(o)],a=l.range(Pe(n),Ee(s),Pe(i),Ee(r)),d=l.data,f=[];for(const u of a){const p=this.stride*u;f.push(d[p+Y]>1?ht(d,p,this.clusterProps):this.points[d[p+J]])}return f}getChildren(t){const o=this._getOriginId(t),n=this._getOriginZoom(t),r="No cluster with the specified id.",i=this.trees[n];if(!i)throw new Error(r);const s=i.data;if(o*this.stride>=s.length)throw new Error(r);const l=this.options.radius/(this.options.extent*Math.pow(2,n-1)),a=s[o*this.stride],d=s[o*this.stride+1],f=i.within(a,d,l),u=[];for(const p of f){const g=p*this.stride;s[g+De]===t&&u.push(s[g+Y]>1?ht(s,g,this.clusterProps):this.points[s[g+J]])}if(u.length===0)throw new Error(r);return u}getLeaves(t,o,n){o=o||10,n=n||0;const r=[];return this._appendLeaves(r,t,o,n,0),r}getTile(t,o,n){const r=this.trees[this._limitZoom(t)],i=Math.pow(2,t),{extent:s,radius:l}=this.options,a=l/s,d=(n-a)/i,f=(n+1+a)/i,u={features:[]};return this._addTileFeatures(r.range((o-a)/i,d,(o+1+a)/i,f),r.data,o,n,i,u),o===0&&this._addTileFeatures(r.range(1-a/i,d,1,f),r.data,i,n,i,u),o===i-1&&this._addTileFeatures(r.range(0,d,a/i,f),r.data,-1,n,i,u),u.features.length?u:null}getClusterExpansionZoom(t){let o=this._getOriginZoom(t)-1;for(;o<=this.options.maxZoom;){const n=this.getChildren(t);if(o++,n.length!==1)break;t=n[0].properties.cluster_id}return o}_appendLeaves(t,o,n,r,i){const s=this.getChildren(o);for(const l of s){const a=l.properties;if(a&&a.cluster?i+a.point_count<=r?i+=a.point_count:i=this._appendLeaves(t,a.cluster_id,n,r,i):i<r?i++:t.push(l),t.length===n)break}return i}_createTree(t){const o=new Ze(t.length/this.stride|0,this.options.nodeSize,Float32Array);for(let n=0;n<t.length;n+=this.stride)o.add(t[n],t[n+1]);return o.finish(),o.data=t,o}_addTileFeatures(t,o,n,r,i,s){for(const l of t){const a=l*this.stride,d=o[a+Y]>1;let f,u,p;if(d)f=yt(o,a,this.clusterProps),u=o[a],p=o[a+1];else{const b=this.points[o[a+J]];f=b.properties;const[h,v]=b.geometry.coordinates;u=Pe(h),p=Ee(v)}const g={type:1,geometry:[[Math.round(this.options.extent*(u*i-n)),Math.round(this.options.extent*(p*i-r))]],tags:f};let y;d||this.options.generateId?y=o[a+J]:y=this.points[o[a+J]].id,y!==void 0&&(g.id=y),s.features.push(g)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}_cluster(t,o){const{radius:n,extent:r,reduce:i,minPoints:s}=this.options,l=n/(r*Math.pow(2,o)),a=t.data,d=[],f=this.stride;for(let u=0;u<a.length;u+=f){if(a[u+ee]<=o)continue;a[u+ee]=o;const p=a[u],g=a[u+1],y=t.within(a[u],a[u+1],l),b=a[u+Y];let h=b;for(const v of y){const E=v*f;a[E+ee]>o&&(h+=a[E+Y])}if(h>b&&h>=s){let v=p*b,E=g*b,_,M=-1;const k=((u/f|0)<<5)+(o+1)+this.points.length;for(const L of y){const O=L*f;if(a[O+ee]<=o)continue;a[O+ee]=o;const C=a[O+Y];v+=a[O]*C,E+=a[O+1]*C,a[O+De]=k,i&&(_||(_=this._map(a,u,!0),M=this.clusterProps.length,this.clusterProps.push(_)),i(_,this._map(a,O)))}a[u+De]=k,d.push(v/h,E/h,1/0,k,-1,h),i&&d.push(M)}else{for(let v=0;v<f;v++)d.push(a[u+v]);if(h>1)for(const v of y){const E=v*f;if(!(a[E+ee]<=o)){a[E+ee]=o;for(let _=0;_<f;_++)d.push(a[E+_])}}}}return d}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,o,n){if(t[o+Y]>1){const s=this.clusterProps[t[o+gt]];return n?Object.assign({},s):s}const r=this.points[t[o+J]].properties,i=this.options.map(r);return n&&i===r?Object.assign({},i):i}}function ht(e,t,o){return{type:"Feature",id:e[t+J],properties:yt(e,t,o),geometry:{type:"Point",coordinates:[No(e[t]),Fo(e[t+1])]}}}function yt(e,t,o){const n=e[t+Y],r=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?`${Math.round(n/100)/10}k`:n,i=e[t+gt],s=i===-1?{}:Object.assign({},o[i]);return Object.assign(s,{cluster:!0,cluster_id:e[t+J],point_count:n,point_count_abbreviated:r})}function Pe(e){return e/360+.5}function Ee(e){const t=Math.sin(e*Math.PI/180),o=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return o<0?0:o>1?1:o}function No(e){return(e-.5)*360}function Fo(e){const t=(180-e*360)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}var bt=Object.prototype.hasOwnProperty;function vt(e,t,o){for(o of e.keys())if(te(o,t))return o}function te(e,t){var o,n,r;if(e===t)return!0;if(e&&t&&(o=e.constructor)===t.constructor){if(o===Date)return e.getTime()===t.getTime();if(o===RegExp)return e.toString()===t.toString();if(o===Array){if((n=e.length)===t.length)for(;n--&&te(e[n],t[n]););return n===-1}if(o===Set){if(e.size!==t.size)return!1;for(n of e)if(r=n,r&&typeof r=="object"&&(r=vt(t,r),!r)||!t.has(r))return!1;return!0}if(o===Map){if(e.size!==t.size)return!1;for(n of e)if(r=n[0],r&&typeof r=="object"&&(r=vt(t,r),!r)||!te(n[1],t.get(r)))return!1;return!0}if(o===ArrayBuffer)e=new Uint8Array(e),t=new Uint8Array(t);else if(o===DataView){if((n=e.byteLength)===t.byteLength)for(;n--&&e.getInt8(n)===t.getInt8(n););return n===-1}if(ArrayBuffer.isView(e)){if((n=e.byteLength)===t.byteLength)for(;n--&&e[n]===t[n];);return n===-1}if(!o||typeof e=="object"){n=0;for(o in e)if(bt.call(e,o)&&++n&&!bt.call(t,o)||!(o in t)||!te(e[o],t[o]))return!1;return Object.keys(t).length===n}}return e!==e&&t!==t}function Io(e){var t=T.useRef(e),o=T.useRef(0);return te(e,t.current)||(t.current=e,o.current+=1),T.useMemo(function(){return t.current},[o.current])}function jo(e,t){return T.useEffect(e,Io(t))}var Zo=function(t){var o=t.points,n=t.bounds,r=t.zoom,i=t.options,s=t.disableRefresh,l=c.useRef(),a=c.useRef(),d=c.useState([]),f=d[0],u=d[1],p=Math.round(r);return jo(function(){s!==!0&&((!l.current||!te(a.current,o)||!te(l.current.options,i))&&(l.current=new $o(i),l.current.load(o)),n&&u(l.current.getClusters(n,p)),a.current=o)},[o,n,p,i,s]),{clusters:f,supercluster:l.current}};const Bo=c.lazy(()=>Promise.resolve().then(()=>vi)),Uo=c.lazy(()=>Promise.resolve().then(()=>xi)),Do=c.lazy(()=>Promise.resolve().then(()=>Ci)),Go=c.lazy(()=>Promise.resolve().then(()=>zi));function Ho({isLoading:e,markers:t,onClick:o,...n}){const{mapProvider:r,activeMarker:i,zoom:s,setMarkerPoints:l,setClusterPoints:a}=z();c.useEffect(()=>{if(e)return;const h=(t||[]).map(v=>[v.longitude,v.latitude]);l(h)},[t,l]);const d=c.useMemo(()=>({points:t.map(h=>Ao([h.longitude,h.latitude],h)),bounds:ue,zoom:s,options:{radius:r.name==="google"&&s>at?xo:wo,minZoom:at,maxZoom:vo}}),[t,r,s]),{clusters:f,supercluster:u}=Zo(d),p=c.useRef("");c.useEffect(()=>{const h=JSON.stringify(f.map(v=>({coords:v.geometry.coordinates,props:v.properties})));h!==p.current&&(a(f),p.current=h)},[f,a]);const g=h=>{if(!("properties"in h))throw new Error("Cluster does not have properties");if(h.properties?.cluster&&typeof h.properties?.cluster_id=="number"){o?.({id:`${h.properties.cluster_id}`,latitude:h.geometry.coordinates[1],longitude:h.geometry.coordinates[0],markers:u?.getLeaves(h.properties.cluster_id)?.map(v=>v.properties)??[]});return}o?.({id:h.properties.id,latitude:h.properties.latitude,longitude:h.properties.longitude,markers:[h.properties]})},y=h=>{if(!u||!i)return!1;if(i.id===`${h}`)return!0;try{return u.getLeaves(h)?.find(v=>v.properties.id===i.id)!==void 0}catch{return!1}},b=c.useMemo(()=>{switch(r?.name){case"maptiler":return Bo;case"google":return Uo;case"mapbox":return Do;case"testing":return Go;default:return null}},[r]);return b?m.jsx(c.Suspense,{fallback:null,children:m.jsx(b,{clusters:f,onClick:g,doesSuperclusterContainActiveMarker:y,...n})}):null}const Wo=c.lazy(()=>Promise.resolve().then(()=>Oi)),Vo=c.lazy(()=>Promise.resolve().then(()=>Ni)),qo=c.lazy(()=>Promise.resolve().then(()=>Ii)),Ko=c.lazy(()=>Promise.resolve().then(()=>Gi));function Jo({children:e,anchor:t="bottom",...o}){const{mapProvider:n}=z(),r=c.useMemo(()=>{switch(n?.name){case"maptiler":return Wo;case"google":return Vo;case"mapbox":return qo;case"testing":return Ko;default:return null}},[n]);return r?m.jsx(c.Suspense,{fallback:null,children:m.jsx(r,{...o,anchor:t,children:e})}):null}const Yo=c.lazy(()=>Promise.resolve().then(()=>Vi)),Qo=c.lazy(()=>Promise.resolve().then(()=>Ki)),Xo=c.lazy(()=>Promise.resolve().then(()=>Yi)),Ro=c.lazy(()=>Promise.resolve().then(()=>ss));function en(e){const{mapProvider:t}=z(),o=c.useMemo(()=>{switch(t?.name){case"maptiler":return Yo;case"google":return Qo;case"mapbox":return Xo;case"testing":return Ro;default:return null}},[t]);return o?m.jsx(c.Suspense,{fallback:null,children:m.jsx(o,{...e})}):null}function tn(e){const[t,o]=c.useState(),[n,r]=c.useState([]),[i,s]=c.useState([]),[l,a]=c.useState(e.zoom||F.zoom);return m.jsx(st.Provider,{value:{...e,locale:e.locale||"en",mapPadding:e.mapPadding||ve,locationBoundary:e.locationBoundary?e.locationBoundary:[[e.center.longitude,e.center.latitude]],centerPinMarkerPoints:t,setCenterPinMarkerPoints:o,markerPoints:n,setMarkerPoints:r,clusterPoints:i,setClusterPoints:s,zoom:l,setZoom:a},children:e.children})}const on=Object.freeze(Object.defineProperty({__proto__:null,BaseMap:So,CenterPin:zo,Layers:en,Markers:Ho,Popup:Jo,Root:tn},Symbol.toStringTag,{value:"Module"})),wt=T.createContext(null);function xt(){const e=c.useContext(wt)?.maps,t=c.useContext(oe);return c.useMemo(()=>({...e,current:t?.map}),[e,t])}function nn(e,t){const o=Array.isArray(e)?e[0]:e?e.x:0,n=Array.isArray(e)?e[1]:e?e.y:0,r=Array.isArray(t)?t[0]:t?t.x:0,i=Array.isArray(t)?t[1]:t?t.y:0;return o===r&&n===i}function j(e,t){if(e===t)return!0;if(!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let o=0;o<e.length;o++)if(!j(e[o],t[o]))return!1;return!0}else if(Array.isArray(t))return!1;if(typeof e=="object"&&typeof t=="object"){const o=Object.keys(e),n=Object.keys(t);if(o.length!==n.length)return!1;for(const r of o)if(!t.hasOwnProperty(r)||!j(e[r],t[r]))return!1;return!0}return!1}function _t(e){return{longitude:e.center.lng,latitude:e.center.lat,zoom:e.zoom,pitch:e.pitch,bearing:e.bearing,padding:e.padding}}function Ct(e,t){const o=t.viewState||t,n={};if("longitude"in o&&"latitude"in o&&(o.longitude!==e.center.lng||o.latitude!==e.center.lat)){const r=e.center.constructor;n.center=new r(o.longitude,o.latitude)}return"zoom"in o&&o.zoom!==e.zoom&&(n.zoom=o.zoom),"bearing"in o&&o.bearing!==e.bearing&&(n.bearing=o.bearing),"pitch"in o&&o.pitch!==e.pitch&&(n.pitch=o.pitch),o.padding&&e.padding&&!j(o.padding,e.padding)&&(n.padding=o.padding),n}const rn=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Mt(e){if(!e)return null;if(typeof e=="string"||("toJS"in e&&(e=e.toJS()),!e.layers))return e;const t={};for(const n of e.layers)t[n.id]=n;const o=e.layers.map(n=>{let r=null;"interactive"in n&&(r=Object.assign({},n),delete r.interactive);const i=t[n.ref];if(i){r=r||Object.assign({},n),delete r.ref;for(const s of rn)s in i&&(r[s]=i[s])}return r||n});return{...e,layers:o}}const kt={version:8,sources:{},layers:[]},St={mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",click:"onClick",dblclick:"onDblClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mouseout:"onMouseOut",contextmenu:"onContextMenu",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",touchcancel:"onTouchCancel"},Pt={movestart:"onMoveStart",move:"onMove",moveend:"onMoveEnd",dragstart:"onDragStart",drag:"onDrag",dragend:"onDragEnd",zoomstart:"onZoomStart",zoom:"onZoom",zoomend:"onZoomEnd",rotatestart:"onRotateStart",rotate:"onRotate",rotateend:"onRotateEnd",pitchstart:"onPitchStart",pitch:"onPitch",pitchend:"onPitchEnd"},Et={wheel:"onWheel",boxzoomstart:"onBoxZoomStart",boxzoomend:"onBoxZoomEnd",boxzoomcancel:"onBoxZoomCancel",resize:"onResize",load:"onLoad",render:"onRender",idle:"onIdle",remove:"onRemove",data:"onData",styledata:"onStyleData",sourcedata:"onSourceData",error:"onError"},sn=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],an=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"];class de{constructor(t,o,n){this._map=null,this._internalUpdate=!1,this._hoveredFeatures=null,this._propsedCameraUpdate=null,this._styleComponents={},this._onEvent=r=>{const i=this.props[Et[r.type]];i?i(r):r.type==="error"&&console.error(r.error)},this._onCameraEvent=r=>{if(this._internalUpdate)return;r.viewState=this._propsedCameraUpdate||_t(this._map.transform);const i=this.props[Pt[r.type]];i&&i(r)},this._onCameraUpdate=r=>this._internalUpdate?r:(this._propsedCameraUpdate=_t(r),Ct(r,this.props)),this._onPointerEvent=r=>{(r.type==="mousemove"||r.type==="mouseout")&&this._updateHover(r);const i=this.props[St[r.type]];i&&(this.props.interactiveLayerIds&&r.type!=="mouseover"&&r.type!=="mouseout"&&(r.features=this._hoveredFeatures||this._queryRenderedFeatures(r.point)),i(r),delete r.features)},this._MapClass=t,this.props=o,this._initialize(n)}get map(){return this._map}setProps(t){const o=this.props;this.props=t;const n=this._updateSettings(t,o),r=this._updateSize(t),i=this._updateViewState(t);this._updateStyle(t,o),this._updateStyleComponents(t),this._updateHandlers(t,o),(n||r||i&&!this._map.isMoving())&&this.redraw()}static reuse(t,o){const n=de.savedMaps.pop();if(!n)return null;const r=n.map,i=r.getContainer();for(o.className=i.className;i.childNodes.length>0;)o.appendChild(i.childNodes[0]);r._container=o;const s=r._resizeObserver;s&&(s.disconnect(),s.observe(o)),n.setProps({...t,styleDiffing:!1}),r.resize();const{initialViewState:l}=t;return l&&(l.bounds?r.fitBounds(l.bounds,{...l.fitBoundsOptions,duration:0}):n._updateViewState(l)),r.isStyleLoaded()?r.fire("load"):r.once("style.load",()=>r.fire("load")),r._update(),n}_initialize(t){const{props:o}=this,{mapStyle:n=kt}=o,r={...o,...o.initialViewState,container:t,style:Mt(n)},i=r.initialViewState||r.viewState||r;if(Object.assign(r,{center:[i.longitude||0,i.latitude||0],zoom:i.zoom||0,pitch:i.pitch||0,bearing:i.bearing||0}),o.gl){const l=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=l,o.gl)}const s=new this._MapClass(r);i.padding&&s.setPadding(i.padding),o.cursor&&(s.getCanvas().style.cursor=o.cursor),s.transformCameraUpdate=this._onCameraUpdate,s.on("style.load",()=>{this._styleComponents={light:s.getLight(),sky:s.getSky(),projection:s.getProjection?.(),terrain:s.getTerrain()},this._updateStyleComponents(this.props)}),s.on("sourcedata",()=>{this._updateStyleComponents(this.props)});for(const l in St)s.on(l,this._onPointerEvent);for(const l in Pt)s.on(l,this._onCameraEvent);for(const l in Et)s.on(l,this._onEvent);this._map=s}recycle(){this.map.getContainer().querySelector("[mapboxgl-children]")?.remove(),de.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const t=this._map;t.style&&(t._frame&&(t._frame.cancel(),t._frame=null),t._render())}_updateSize(t){const{viewState:o}=t;if(o){const n=this._map;if(o.width!==n.transform.width||o.height!==n.transform.height)return n.resize(),!0}return!1}_updateViewState(t){const o=this._map,n=o.transform;if(!o.isMoving()){const i=Ct(n,t);if(Object.keys(i).length>0)return this._internalUpdate=!0,o.jumpTo(i),this._internalUpdate=!1,!0}return!1}_updateSettings(t,o){const n=this._map;let r=!1;for(const i of sn)i in t&&!j(t[i],o[i])&&(r=!0,n[`set${i[0].toUpperCase()}${i.slice(1)}`]?.call(n,t[i]));return r}_updateStyle(t,o){if(t.cursor!==o.cursor&&(this._map.getCanvas().style.cursor=t.cursor||""),t.mapStyle!==o.mapStyle){const{mapStyle:n=kt,styleDiffing:r=!0}=t,i={diff:r};"localIdeographFontFamily"in t&&(i.localIdeographFontFamily=t.localIdeographFontFamily),this._map.setStyle(Mt(n),i)}}_updateStyleComponents({light:t,projection:o,sky:n,terrain:r}){const i=this._map,s=this._styleComponents;i.style._loaded&&(t&&!j(t,s.light)&&(s.light=t,i.setLight(t)),o&&!j(o,s.projection)&&o!==s.projection?.type&&(s.projection=typeof o=="string"?{type:o}:o,i.setProjection?.(s.projection)),n&&!j(n,s.sky)&&(s.sky=n,i.setSky(n)),r!==void 0&&!j(r,s.terrain)&&(!r||i.getSource(r.source))&&(s.terrain=r,i.setTerrain(r)))}_updateHandlers(t,o){const n=this._map;for(const r of an){const i=t[r]??!0,s=o[r]??!0;j(i,s)||(i?n[r].enable(i):n[r].disable())}}_queryRenderedFeatures(t){const o=this._map,{interactiveLayerIds:n=[]}=this.props;try{return o.queryRenderedFeatures(t,{layers:n.filter(o.getLayer.bind(o))})}catch{return[]}}_updateHover(t){const{props:o}=this;if(o.interactiveLayerIds&&(o.onMouseMove||o.onMouseEnter||o.onMouseLeave)){const r=t.type,i=this._hoveredFeatures?.length>0,s=this._queryRenderedFeatures(t.point),l=s.length>0;!l&&i&&(t.type="mouseleave",this._onPointerEvent(t)),this._hoveredFeatures=s,l&&!i&&(t.type="mouseenter",this._onPointerEvent(t)),t.type=r}else this._hoveredFeatures=null}}de.savedMaps=[];const ln=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function cn(e){if(!e)return null;const t=e.map,o={getMap:()=>t};for(const n of un(t))!(n in o)&&!ln.includes(n)&&(o[n]=t[n].bind(t));return o}function un(e){const t=new Set;let o=e;for(;o;){for(const n of Object.getOwnPropertyNames(o))n[0]!=="_"&&typeof e[n]=="function"&&n!=="fire"&&n!=="setEventedParent"&&t.add(n);o=Object.getPrototypeOf(o)}return Array.from(t)}const dn=typeof document<"u"?c.useLayoutEffect:c.useEffect;function fn(e,t){const{RTLTextPlugin:o,maxParallelImageRequests:n,workerCount:r,workerUrl:i}=t;if(o&&e.getRTLTextPluginStatus&&e.getRTLTextPluginStatus()==="unavailable"){const{pluginUrl:s,lazy:l=!0}=typeof o=="string"?{pluginUrl:o}:o;e.setRTLTextPlugin(s,a=>{a&&console.error(a)},l)}n!==void 0&&e.setMaxParallelImageRequests(n),r!==void 0&&e.setWorkerCount(r),i!==void 0&&e.setWorkerUrl(i)}const oe=T.createContext(null);function mn(e,t){const o=c.useContext(wt),[n,r]=c.useState(null),i=c.useRef(),{current:s}=c.useRef({mapLib:null,map:null});c.useEffect(()=>{const d=e.mapLib;let f=!0,u;return Promise.resolve(d||import("maplibre-gl")).then(p=>{if(!f)return;if(!p)throw new Error("Invalid mapLib");const g="Map"in p?p:p.default;if(!g.Map)throw new Error("Invalid mapLib");fn(g,e),e.reuseMaps&&(u=de.reuse(e,i.current)),u||(u=new de(g.Map,e,i.current)),s.map=cn(u),s.mapLib=g,r(u),o?.onMapMount(s.map,e.id)}).catch(p=>{const{onError:g}=e;g?g({type:"error",target:null,originalEvent:null,error:p}):console.error(p)}),()=>{f=!1,u&&(o?.onMapUnmount(e.id),e.reuseMaps?u.recycle():u.destroy())}},[]),dn(()=>{n&&n.setProps(e)}),c.useImperativeHandle(t,()=>s.map,[n]);const l=c.useMemo(()=>({position:"relative",width:"100%",height:"100%",...e.style}),[e.style]),a={height:"100%"};return T.createElement("div",{id:e.id,ref:i,style:l},n&&T.createElement(oe.Provider,{value:s},T.createElement("div",{"mapboxgl-children":"",style:a},e.children)))}const pn=T.forwardRef(mn),gn=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function H(e,t){if(!e||!t)return;const o=e.style;for(const n in t){const r=t[n];Number.isFinite(r)&&!gn.test(n)?o[n]=`${r}px`:o[n]=r}}function Lt(e,t){if(e===t)return null;const o=Tt(e),n=Tt(t),r=[];for(const i of n)o.has(i)||r.push(i);for(const i of o)n.has(i)||r.push(i);return r.length===0?null:r}function Tt(e){return new Set(e?e.trim().split(/\s+/):[])}const zt=c.memo(c.forwardRef((e,t)=>{const{map:o,mapLib:n}=c.useContext(oe),r=c.useRef({props:e}),i=c.useMemo(()=>{let v=!1;T.Children.forEach(e.children,M=>{M&&(v=!0)});const E={...e,element:v?document.createElement("div"):void 0},_=new n.Marker(E);return _.setLngLat([e.longitude,e.latitude]),_.getElement().addEventListener("click",M=>{r.current.props.onClick?.({type:"click",target:_,originalEvent:M})}),_.on("dragstart",M=>{const k=M;k.lngLat=i.getLngLat(),r.current.props.onDragStart?.(k)}),_.on("drag",M=>{const k=M;k.lngLat=i.getLngLat(),r.current.props.onDrag?.(k)}),_.on("dragend",M=>{const k=M;k.lngLat=i.getLngLat(),r.current.props.onDragEnd?.(k)}),_},[]);c.useEffect(()=>(i.addTo(o.getMap()),()=>{i.remove()}),[]);const{longitude:s,latitude:l,offset:a,style:d,draggable:f=!1,popup:u=null,rotation:p=0,rotationAlignment:g="auto",pitchAlignment:y="auto"}=e;c.useEffect(()=>{H(i.getElement(),d)},[d]),c.useImperativeHandle(t,()=>i,[]);const b=r.current.props;(i.getLngLat().lng!==s||i.getLngLat().lat!==l)&&i.setLngLat([s,l]),a&&!nn(i.getOffset(),a)&&i.setOffset(a),i.isDraggable()!==f&&i.setDraggable(f),i.getRotation()!==p&&i.setRotation(p),i.getRotationAlignment()!==g&&i.setRotationAlignment(g),i.getPitchAlignment()!==y&&i.setPitchAlignment(y),i.getPopup()!==u&&i.setPopup(u);const h=Lt(b.className,e.className);if(h)for(const v of h)i.toggleClassName(v);return r.current.props=e,Se.createPortal(e.children,i.getElement())})),hn=c.memo(c.forwardRef((e,t)=>{const{map:o,mapLib:n}=c.useContext(oe),r=c.useMemo(()=>document.createElement("div"),[]),i=c.useRef({props:e}),s=c.useMemo(()=>{const l={...e},a=new n.Popup(l);return a.setLngLat([e.longitude,e.latitude]),a.once("open",d=>{i.current.props.onOpen?.(d)}),a},[]);if(c.useEffect(()=>{const l=a=>{i.current.props.onClose?.(a)};return s.on("close",l),s.setDOMContent(r).addTo(o.getMap()),()=>{s.off("close",l),s.isOpen()&&s.remove()}},[]),c.useEffect(()=>{H(s.getElement(),e.style)},[e.style]),c.useImperativeHandle(t,()=>s,[]),s.isOpen()){const l=i.current.props;(s.getLngLat().lng!==e.longitude||s.getLngLat().lat!==e.latitude)&&s.setLngLat([e.longitude,e.latitude]),e.offset&&!j(l.offset,e.offset)&&s.setOffset(e.offset),(l.anchor!==e.anchor||l.maxWidth!==e.maxWidth)&&(s.options.anchor=e.anchor,s.setMaxWidth(e.maxWidth));const a=Lt(l.className,e.className);if(a)for(const d of a)s.toggleClassName(d);i.current.props=e}return Se.createPortal(e.children,r)}));function ne(e,t,o,n){const r=c.useContext(oe),i=c.useMemo(()=>e(r),[]);return c.useEffect(()=>{const s=t,l=null,a=typeof t=="function"?t:null,{map:d}=r;return d.hasControl(i)||(d.addControl(i,s?.position),l&&l(r)),()=>{a&&a(r),d.hasControl(i)&&d.removeControl(i)}},[]),i}function yn(e){const t=ne(({mapLib:o})=>new o.AttributionControl(e),{position:e.position});return c.useEffect(()=>{H(t._container,e.style)},[e.style]),null}c.memo(yn);function bn(e){const t=ne(({mapLib:o})=>new o.FullscreenControl({container:e.containerId&&document.getElementById(e.containerId)}),{position:e.position});return c.useEffect(()=>{H(t._controlContainer,e.style)},[e.style]),null}c.memo(bn);function vn(e,t){const o=c.useRef({props:e}),n=ne(({mapLib:r})=>{const i=new r.GeolocateControl(e),s=i._setupUI;return i._setupUI=()=>{i._container.hasChildNodes()||s()},i.on("geolocate",l=>{o.current.props.onGeolocate?.(l)}),i.on("error",l=>{o.current.props.onError?.(l)}),i.on("outofmaxbounds",l=>{o.current.props.onOutOfMaxBounds?.(l)}),i.on("trackuserlocationstart",l=>{o.current.props.onTrackUserLocationStart?.(l)}),i.on("trackuserlocationend",l=>{o.current.props.onTrackUserLocationEnd?.(l)}),i},{position:e.position});return o.current.props=e,c.useImperativeHandle(t,()=>n,[]),c.useEffect(()=>{H(n._container,e.style)},[e.style]),null}c.memo(c.forwardRef(vn));function wn(e){const t=ne(({mapLib:o})=>new o.NavigationControl(e),{position:e.position});return c.useEffect(()=>{H(t._container,e.style)},[e.style]),null}const xn=c.memo(wn);function _n(e){const t=ne(({mapLib:i})=>new i.ScaleControl(e),{position:e.position}),o=c.useRef(e),n=o.current;o.current=e;const{style:r}=e;return e.maxWidth!==void 0&&e.maxWidth!==n.maxWidth&&(t.options.maxWidth=e.maxWidth),e.unit!==void 0&&e.unit!==n.unit&&t.setUnit(e.unit),c.useEffect(()=>{H(t._container,r)},[r]),null}c.memo(_n);function Cn(e){const t=ne(({mapLib:o})=>new o.TerrainControl(e),{position:e.position});return c.useEffect(()=>{H(t._container,e.style)},[e.style]),null}c.memo(Cn);function Mn(e){const t=ne(({mapLib:o})=>new o.LogoControl(e),{position:e.position});return c.useEffect(()=>{H(t._container,e.style)},[e.style]),null}c.memo(Mn);function Le(e,t){if(!e)throw new Error(t)}let kn=0;function Sn(e,t,o){if(e.style&&e.style._loaded){const n={...o};return delete n.id,delete n.children,e.addSource(t,n),e.getSource(t)}return null}function Pn(e,t,o){Le(t.id===o.id,"source id changed"),Le(t.type===o.type,"source type changed");let n="",r=0;for(const s in t)s!=="children"&&s!=="id"&&!j(o[s],t[s])&&(n=s,r++);if(!r)return;const i=t.type;if(i==="geojson")e.setData(t.data);else if(i==="image")e.updateImage({url:t.url,coordinates:t.coordinates});else switch(n){case"coordinates":e.setCoordinates?.(t.coordinates);break;case"url":e.setUrl?.(t.url);break;case"tiles":e.setTiles?.(t.tiles);break;default:console.warn(`Unable to update <Source> prop: ${n}`)}}function En(e){const t=c.useContext(oe).map.getMap(),o=c.useRef(e),[,n]=c.useState(0),r=c.useMemo(()=>e.id||`jsx-source-${kn++}`,[]);c.useEffect(()=>{if(t){const s=()=>setTimeout(()=>n(l=>l+1),0);return t.on("styledata",s),s(),()=>{if(t.off("styledata",s),t.style&&t.style._loaded&&t.getSource(r)){const l=t.getStyle()?.layers;if(l)for(const a of l)a.source===r&&t.removeLayer(a.id);t.removeSource(r)}}}},[t]);let i=t&&t.style&&t.getSource(r);return i?Pn(i,e,o.current):i=Sn(t,r,e),o.current=e,i&&T.Children.map(e.children,s=>s&&c.cloneElement(s,{source:r}))||null}function Ln(e,t,o,n){if(Le(o.id===n.id,"layer id changed"),Le(o.type===n.type,"layer type changed"),o.type==="custom"||n.type==="custom")return;const{layout:r={},paint:i={},filter:s,minzoom:l,maxzoom:a,beforeId:d}=o;if(d!==n.beforeId&&e.moveLayer(t,d),r!==n.layout){const f=n.layout||{};for(const u in r)j(r[u],f[u])||e.setLayoutProperty(t,u,r[u]);for(const u in f)r.hasOwnProperty(u)||e.setLayoutProperty(t,u,void 0)}if(i!==n.paint){const f=n.paint||{};for(const u in i)j(i[u],f[u])||e.setPaintProperty(t,u,i[u]);for(const u in f)i.hasOwnProperty(u)||e.setPaintProperty(t,u,void 0)}j(s,n.filter)||e.setFilter(t,s),(l!==n.minzoom||a!==n.maxzoom)&&e.setLayerZoomRange(t,l,a)}function Tn(e,t,o){if(e.style&&e.style._loaded&&(!("source"in o)||e.getSource(o.source))){const n={...o,id:t};delete n.beforeId,e.addLayer(n,o.beforeId)}}let zn=0;function At(e){const t=c.useContext(oe).map.getMap(),o=c.useRef(e),[,n]=c.useState(0),r=c.useMemo(()=>e.id||`jsx-layer-${zn++}`,[]);if(c.useEffect(()=>{if(t){const s=()=>n(l=>l+1);return t.on("styledata",s),s(),()=>{t.off("styledata",s),t.style&&t.style._loaded&&t.getLayer(r)&&t.removeLayer(r)}}},[t]),t&&t.style&&t.getLayer(r))try{Ln(t,r,e,o.current)}catch(s){console.warn(s)}else Tn(t,r,e);return o.current=e,null}function Ot(e,t,o){if(e!==null)for(var n,r,i,s,l,a,d,f=0,u=0,p,g=e.type,y=g==="FeatureCollection",b=g==="Feature",h=y?e.features.length:1,v=0;v<h;v++){d=y?e.features[v].geometry:b?e.geometry:e,p=d?d.type==="GeometryCollection":!1,l=p?d.geometries.length:1;for(var E=0;E<l;E++){var _=0,M=0;if(s=p?d.geometries[E]:d,s!==null){a=s.coordinates;var k=s.type;switch(f=0,k){case null:break;case"Point":if(t(a,u,v,_,M)===!1)return!1;u++,_++;break;case"LineString":case"MultiPoint":for(n=0;n<a.length;n++){if(t(a[n],u,v,_,M)===!1)return!1;u++,k==="MultiPoint"&&_++}k==="LineString"&&_++;break;case"Polygon":case"MultiLineString":for(n=0;n<a.length;n++){for(r=0;r<a[n].length-f;r++){if(t(a[n][r],u,v,_,M)===!1)return!1;u++}k==="MultiLineString"&&_++,k==="Polygon"&&M++}k==="Polygon"&&_++;break;case"MultiPolygon":for(n=0;n<a.length;n++){for(M=0,r=0;r<a[n].length;r++){for(i=0;i<a[n][r].length-f;i++){if(t(a[n][r][i],u,v,_,M)===!1)return!1;u++}M++}_++}break;case"GeometryCollection":for(n=0;n<s.geometries.length;n++)if(Ot(s.geometries[n],t)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function An(e,t={}){if(e.bbox!=null&&t.recompute!==!0)return e.bbox;const o=[1/0,1/0,-1/0,-1/0];return Ot(e,n=>{o[0]>n[0]&&(o[0]=n[0]),o[1]>n[1]&&(o[1]=n[1]),o[2]<n[0]&&(o[2]=n[0]),o[3]<n[1]&&(o[3]=n[1])}),o}var Ge=An;const On={en:{"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},fr:{"AttributionControl.ToggleAttribution":"Afficher/Masquer l’attribution","AttributionControl.MapFeedback":"Retour sur la carte","FullscreenControl.Enter":"Passer en plein écran","FullscreenControl.Exit":"Quitter le plein écran","GeolocateControl.FindMyLocation":"Trouver ma position","GeolocateControl.LocationNotAvailable":"Position non disponible","LogoControl.Title":"Logo MapLibre","Map.Title":"Carte","Marker.Title":"Marqueur de carte","NavigationControl.ResetBearing":"Réinitialiser l’orientation au nord","NavigationControl.ZoomIn":"Zoomer","NavigationControl.ZoomOut":"Dézoomer","Popup.Close":"Fermer la fenêtre","ScaleControl.Feet":"pi","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"mn","GlobeControl.Enable":"Activer le globe","GlobeControl.Disable":"Désactiver le globe","TerrainControl.Enable":"Activer le relief","TerrainControl.Disable":"Désactiver le relief","CooperativeGesturesHandler.WindowsHelpText":"Utilisez Ctrl + défilement pour zoomer sur la carte","CooperativeGesturesHandler.MacHelpText":"Utilisez ⌘ + défilement pour zoomer sur la carte","CooperativeGesturesHandler.MobileHelpText":"Utilisez deux doigts pour déplacer la carte"}},$n=()=>{const{current:e}=xt(),{centerPinMarkerPoints:t,markerPoints:o,locationBoundary:n,setZoom:r,mapPadding:i}=z(),[s,l]=c.useState(void 0),a=c.useRef(void 0),d=c.useCallback(()=>{e&&r(e.getZoom())},[e,r]);return c.useEffect(()=>(d(),e?.on("zoom",d),()=>{e?.off("zoom",d)}),[e,d]),c.useEffect(()=>{if(!e)return;const f=[];if(typeof o<"u"&&o.length>0?(f.push(...o),t&&f.push(t)):f.push(...n||[]),f.length===0)return;const u=Ge(Ie(f));(!a.current||!u.every((p,g)=>p===a.current?.[g]))&&(a.current=u,l(u))},[e,o,n,t]),c.useEffect(()=>{if(!e||typeof s>"u")return;const[f,u,p,g]=s,y=(p-f)*.05||.001,b=(g-u)*.05||.001;e.fitBounds([[f-y,u-b],[p+y,g+b]],{padding:i,maxZoom:17,duration:700})},[e,s,i]),null};function Nn({children:e}){const{mapProvider:t,locale:o,center:n,zoom:r=F.zoom,minZoom:i,maxZoom:s,pitch:l=F.pitch,bearing:a=F.bearing,cooperativeGestures:d=F.cooperativeGestures,zoomPosition:f}=z();return t.name!=="maptiler"?null:m.jsxs(pn,{initialViewState:{...n,zoom:r,pitch:l,bearing:a},cooperativeGestures:d,minZoom:i,maxZoom:s,mapStyle:`https://api.maptiler.com/maps/${t.theme||be.maptiler}/style.json?key=${t.apiKey}`,locale:On[o],children:[m.jsx($n,{}),f&&m.jsx(xn,{position:f}),e]})}const Fn=Object.freeze(Object.defineProperty({__proto__:null,default:Nn},Symbol.toStringTag,{value:"Module"})),In={"top-left":Z.ControlPosition.LEFT_TOP,"top-right":Z.ControlPosition.RIGHT_TOP,"bottom-left":Z.ControlPosition.LEFT_BOTTOM,"bottom-right":Z.ControlPosition.RIGHT_BOTTOM},jn=({isMapLoaded:e})=>{const t=Z.useMap(),{centerPinMarkerPoints:o,markerPoints:n,locationBoundary:r,setZoom:i,mapPadding:s}=z(),[l,a]=c.useState(void 0),d=c.useRef(void 0),f=c.useCallback(()=>{if(!t)return;const u=t.getZoom();typeof u<"u"&&i(u+1)},[t,i]);return c.useEffect(()=>{f();const u=t?.addListener("zoom_changed",f);return()=>{u?.remove()}},[t,f]),c.useEffect(()=>{if(!t)return;const u=[];typeof n<"u"&&n.length>0?(u.push(...n),o&&u.push(o)):u.push(...r||[]);const p=u.length===0?ue:Ge(Ie(u));(!d.current||!p.every((g,y)=>g===d.current?.[y]))&&(d.current=p,a(p))},[t,n,r,o]),c.useEffect(()=>{if(!t||typeof l>"u")return;const[u,p,g,y]=l,b=(g-u)*.05||.001,h=(y-p)*.05||.001;t.fitBounds({south:p-h,west:u-b,north:y+h,east:g+b},s)},[e,t,l,s]),null};function Zn({children:e}){const[t,o]=c.useState(!1),[n,r]=c.useState(!1),{mapProvider:i,mapPadding:s,locale:l,center:a,zoom:d=F.zoom,minZoom:f,maxZoom:u,pitch:p=F.pitch,bearing:g=F.bearing,cooperativeGestures:y=F.cooperativeGestures,zoomPosition:b}=z();if(c.useEffect(()=>{if(!n)return;const E=document.querySelector(".gm-style-moc");E&&s&&(E.style.paddingLeft=`${s.left}px`,E.style.paddingRight=`${s.right}px`)},[n,s?.left,s?.right]),i.name!=="google")return null;const h=()=>{o(!0)},v=()=>{r(!0)};return m.jsx(Z.APIProvider,{apiKey:i.apiKey,language:l,onLoad:h,children:t&&m.jsxs(m.Fragment,{children:[m.jsx(jn,{isMapLoaded:n}),m.jsx(Z.Map,{mapId:i.theme||be.google,defaultCenter:{lat:a.latitude,lng:a.longitude},defaultBounds:{north:ue[3],south:ue[1],east:ue[2],west:ue[0]},defaultZoom:d+1,defaultTilt:p,defaultHeading:g,gestureHandling:y?"cooperative":"greedy",streetViewControl:!1,fullscreenControl:!1,clickableIcons:!1,mapTypeControl:!1,zoomControlOptions:{position:b&&In[b]},minZoom:typeof f=="number"?f+1:void 0,maxZoom:typeof u=="number"?u+1:void 0,onTilesLoaded:v,children:e})]})})}const Bn=Object.freeze(Object.defineProperty({__proto__:null,default:Zn},Symbol.toStringTag,{value:"Module"})),$t=T.createContext(null);function Nt(){const e=c.useContext($t)?.maps,t=c.useContext(re);return c.useMemo(()=>({...e,current:t?.map}),[e,t])}function Un(e){return{longitude:e.center.lng,latitude:e.center.lat,zoom:e._seaLevelZoom??e.zoom,pitch:e.pitch,bearing:e.bearing,padding:e.padding,elevation:e._centerAltitude}}function Dn(e){return Number.isFinite(e.longitude)||Number.isFinite(e.latitude)||Number.isFinite(e.zoom)||Number.isFinite(e.pitch)||Number.isFinite(e.bearing)}function Gn(e,t){return!!(Number.isFinite(t.longitude)&&e.center.lng!==t.longitude||Number.isFinite(t.latitude)&&e.center.lat!==t.latitude||Number.isFinite(t.bearing)&&e.bearing!==t.bearing||Number.isFinite(t.pitch)&&e.pitch!==t.pitch||Number.isFinite(t.zoom)&&(e._seaLevelZoom??e.zoom)!==t.zoom||t.padding&&!e.isPaddingEqual(t.padding))}function Ft(){}function Hn(e,t){const o=e._constrain,n=e._calcMatrices;if(e._constrain=Ft,e._calcMatrices=Ft,Number.isFinite(t.bearing)&&(e.bearing=t.bearing),Number.isFinite(t.pitch)&&(e.pitch=t.pitch),t.padding&&!e.isPaddingEqual(t.padding)&&(e.padding=t.padding),Number.isFinite(t.longitude)||Number.isFinite(t.latitude)){const r=e.center;e._center=new r.constructor(t.longitude??r.lng,t.latitude??r.lat)}if(Number.isFinite(t.zoom))if(e._centerAltitude=t.elevation??0,e.elevation){e._seaLevelZoom=t.zoom;const r=e.pixelsPerMeter/e.worldSize*e._centerAltitude,i=e._mercatorZfromZoom(t.zoom),s=e._mercatorZfromZoom(e._maxZoom),l=Math.max(i-r,s);e._setZoom(e._zoomFromMercatorZ(l))}else e._seaLevelZoom=null,e.zoom=t.zoom;e._constrain=o,e._calcMatrices=n,e._unmodified||(e._constrain(),e._calcMatrices())}const Wn=new Set(["_calcMatrices","_calcFogMatrices","_updateCameraState","_updateSeaLevelZoom"]);function Vn(e){let t=!1,o={};const n=e;let r=null;const i={get(s,l){return l==="$reactViewState"?o:l==="$proposedTransform"?r:l==="$internalUpdate"?t:l==="_setZoom"?a=>{t&&r?.[l](a),Number.isFinite(o.zoom)||n[l](a)}:(t&&l==="_translateCameraConstrained"&&Dn(o)&&(r=r||n.clone()),Wn.has(l)?function(...a){r?.[l](...a),n[l](...a)}:t&&r?r[l]:n[l])},set(s,l,a){if(l==="$reactViewState")return o=a,Hn(n,o),!0;if(l==="$proposedTransform")return r=a,!0;if(l==="$internalUpdate")return t=a,!0;let d=a;return l==="center"||l==="_center"?(Number.isFinite(o.longitude)||Number.isFinite(o.latitude))&&(d=new a.constructor(o.longitude??a.lng,o.latitude??a.lat)):l==="zoom"||l==="_zoom"||l==="_seaLevelZoom"?Number.isFinite(o.zoom)&&(d=n[l]):l==="_centerAltitude"?Number.isFinite(o.elevation)&&(d=n[l]):l==="pitch"||l==="_pitch"?Number.isFinite(o.pitch)&&(d=n[l]):(l==="bearing"||l==="rotation"||l==="angle")&&Number.isFinite(o.bearing)&&(d=n[l]),t&&d!==a&&(r=r||n.clone()),t&&r&&(r[l]=a),n[l]=d,!0}};return new Proxy(e,i)}const qn=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function It(e){if(!e)return null;if(typeof e=="string"||("toJS"in e&&(e=e.toJS()),!e.layers))return e;const t={};for(const n of e.layers)t[n.id]=n;const o=e.layers.map(n=>{let r=null;"interactive"in n&&(r=Object.assign({},n),delete r.interactive);const i=t[n.ref];if(i){r=r||Object.assign({},n),delete r.ref;for(const s of qn)s in i&&(r[s]=i[s])}return r||n});return{...e,layers:o}}function Kn(e,t){const o=Array.isArray(e)?e[0]:e?e.x:0,n=Array.isArray(e)?e[1]:e?e.y:0,r=Array.isArray(t)?t[0]:t?t.x:0,i=Array.isArray(t)?t[1]:t?t.y:0;return o===r&&n===i}function U(e,t){if(e===t)return!0;if(!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let o=0;o<e.length;o++)if(!U(e[o],t[o]))return!1;return!0}else if(Array.isArray(t))return!1;if(typeof e=="object"&&typeof t=="object"){const o=Object.keys(e),n=Object.keys(t);if(o.length!==n.length)return!1;for(const r of o)if(!t.hasOwnProperty(r)||!U(e[r],t[r]))return!1;return!0}return!1}const jt={version:8,sources:{},layers:[]},Zt={mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",click:"onClick",dblclick:"onDblClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mouseout:"onMouseOut",contextmenu:"onContextMenu",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",touchcancel:"onTouchCancel"},Bt={movestart:"onMoveStart",move:"onMove",moveend:"onMoveEnd",dragstart:"onDragStart",drag:"onDrag",dragend:"onDragEnd",zoomstart:"onZoomStart",zoom:"onZoom",zoomend:"onZoomEnd",rotatestart:"onRotateStart",rotate:"onRotate",rotateend:"onRotateEnd",pitchstart:"onPitchStart",pitch:"onPitch",pitchend:"onPitchEnd"},Ut={wheel:"onWheel",boxzoomstart:"onBoxZoomStart",boxzoomend:"onBoxZoomEnd",boxzoomcancel:"onBoxZoomCancel",resize:"onResize",load:"onLoad",render:"onRender",idle:"onIdle",remove:"onRemove",data:"onData",styledata:"onStyleData",sourcedata:"onSourceData",error:"onError"},Jn=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],Yn=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"];class fe{constructor(t,o,n){this._map=null,this._internalUpdate=!1,this._inRender=!1,this._hoveredFeatures=null,this._deferredEvents={move:!1,zoom:!1,pitch:!1,rotate:!1},this._onEvent=r=>{const i=this.props[Ut[r.type]];i?i(r):r.type==="error"&&console.error(r.error)},this._onPointerEvent=r=>{(r.type==="mousemove"||r.type==="mouseout")&&this._updateHover(r);const i=this.props[Zt[r.type]];i&&(this.props.interactiveLayerIds&&r.type!=="mouseover"&&r.type!=="mouseout"&&(r.features=this._hoveredFeatures||this._queryRenderedFeatures(r.point)),i(r),delete r.features)},this._onCameraEvent=r=>{if(!this._internalUpdate){const i=this.props[Bt[r.type]],s=this._proxyTransform;i&&(r.viewState=Un(s.$proposedTransform??s),i(r)),r.type==="moveend"&&(s.$proposedTransform=null)}r.type in this._deferredEvents&&(this._deferredEvents[r.type]=!1)},this._MapClass=t,this.props=o,this._initialize(n)}get map(){return this._map}get transform(){return this._map.transform}setProps(t){const o=this.props;this.props=t;const n=this._updateSettings(t,o);n&&this._createProxyTransform(this._map);const r=this._updateSize(t),i=this._updateViewState(t,!0);this._updateStyle(t,o),this._updateStyleComponents(t,o),this._updateHandlers(t,o),(n||r||i&&!this._map.isMoving())&&this.redraw()}static reuse(t,o){const n=fe.savedMaps.pop();if(!n)return null;const r=n.map,i=r.getContainer();for(o.className=i.className;i.childNodes.length>0;)o.appendChild(i.childNodes[0]);r._container=o,n.setProps({...t,styleDiffing:!1}),r.resize();const{initialViewState:s}=t;return s&&(s.bounds?r.fitBounds(s.bounds,{...s.fitBoundsOptions,duration:0}):n._updateViewState(s,!1)),r.isStyleLoaded()?r.fire("load"):r.once("styledata",()=>r.fire("load")),r._update(),n}_initialize(t){const{props:o}=this,{mapStyle:n=jt}=o,r={...o,...o.initialViewState,accessToken:o.mapboxAccessToken||Qn()||null,container:t,style:It(n)},i=r.initialViewState||r.viewState||r;if(Object.assign(r,{center:[i.longitude||0,i.latitude||0],zoom:i.zoom||0,pitch:i.pitch||0,bearing:i.bearing||0}),o.gl){const u=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=u,o.gl)}const s=new this._MapClass(r);i.padding&&s.setPadding(i.padding),o.cursor&&(s.getCanvas().style.cursor=o.cursor),this._createProxyTransform(s);const l=s._render;s._render=u=>{this._inRender=!0,l.call(s,u),this._inRender=!1};const a=s._renderTaskQueue.run;s._renderTaskQueue.run=u=>{this._proxyTransform.$internalUpdate=!0,a.call(s._renderTaskQueue,u),this._proxyTransform.$internalUpdate=!1,this._fireDefferedEvents()};const d=s.jumpTo;s.jumpTo=(...u)=>(this._proxyTransform.$internalUpdate=!0,d.apply(s,u),this._proxyTransform.$internalUpdate=!1,s);const f=s.fire;s.fire=this._fireEvent.bind(this,f),s.on("styledata",()=>{this._updateStyleComponents(this.props,{})}),s.on("sourcedata",()=>{this._updateStyleComponents(this.props,{})});for(const u in Zt)s.on(u,this._onPointerEvent);for(const u in Bt)s.on(u,this._onCameraEvent);for(const u in Ut)s.on(u,this._onEvent);this._map=s}recycle(){this.map.getContainer().querySelector("[mapboxgl-children]")?.remove(),fe.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const t=this._map;!this._inRender&&t.style&&(t._frame&&(t._frame.cancel(),t._frame=null),t._render())}_createProxyTransform(t){const o=Vn(t.transform);t.transform=o,t.painter.transform=o,this._proxyTransform=o}_updateSize(t){const{viewState:o}=t;if(o){const n=this._map;if(o.width!==n.transform.width||o.height!==n.transform.height)return n.resize(),!0}return!1}_updateViewState(t,o){const n=t.viewState||t,r=this._proxyTransform,{zoom:i,pitch:s,bearing:l}=r,a=Gn(this._proxyTransform,n);if(r.$reactViewState=n,a&&o){const d=this._deferredEvents;d.move=!0,d.zoom||(d.zoom=i!==r.zoom),d.rotate||(d.rotate=l!==r.bearing),d.pitch||(d.pitch=s!==r.pitch)}return a}_updateSettings(t,o){const n=this._map;let r=!1;for(const i of Jn)i in t&&!U(t[i],o[i])&&(r=!0,n[`set${i[0].toUpperCase()}${i.slice(1)}`]?.call(n,t[i]));return r}_updateStyle(t,o){if(t.cursor!==o.cursor&&(this._map.getCanvas().style.cursor=t.cursor||""),t.mapStyle!==o.mapStyle){const{mapStyle:n=jt,styleDiffing:r=!0}=t,i={diff:r};return"localIdeographFontFamily"in t&&(i.localIdeographFontFamily=t.localIdeographFontFamily),this._map.setStyle(It(n),i),!0}return!1}_updateStyleComponents(t,o){const n=this._map;let r=!1;return n.isStyleLoaded()&&("light"in t&&n.setLight&&!U(t.light,o.light)&&(r=!0,n.setLight(t.light)),"fog"in t&&n.setFog&&!U(t.fog,o.fog)&&(r=!0,n.setFog(t.fog)),"terrain"in t&&n.setTerrain&&!U(t.terrain,o.terrain)&&(!t.terrain||n.getSource(t.terrain.source))&&(r=!0,n.setTerrain(t.terrain))),r}_updateHandlers(t,o){const n=this._map;let r=!1;for(const i of Yn){const s=t[i]??!0,l=o[i]??!0;U(s,l)||(r=!0,s?n[i].enable(s):n[i].disable())}return r}_queryRenderedFeatures(t){const o=this._map,{interactiveLayerIds:n=[]}=this.props;try{return o.queryRenderedFeatures(t,{layers:n.filter(o.getLayer.bind(o))})}catch{return[]}}_updateHover(t){const{props:o}=this;if(o.interactiveLayerIds&&(o.onMouseMove||o.onMouseEnter||o.onMouseLeave)){const r=t.type,i=this._hoveredFeatures?.length>0,s=this._queryRenderedFeatures(t.point),l=s.length>0;!l&&i&&(t.type="mouseleave",this._onPointerEvent(t)),this._hoveredFeatures=s,l&&!i&&(t.type="mouseenter",this._onPointerEvent(t)),t.type=r}else this._hoveredFeatures=null}_fireEvent(t,o,n){const r=this._map,i=this._proxyTransform,s=i.$internalUpdate;try{i.$internalUpdate=!1,t.call(r,o,n)}finally{i.$internalUpdate=s}return r}_fireDefferedEvents(){const t=this._map;this._internalUpdate=!0;for(const o in this._deferredEvents)this._deferredEvents[o]&&t.fire(o);this._internalUpdate=!1}}fe.savedMaps=[];function Qn(){let e=null;if(typeof location<"u"){const t=/access_token=([^&\/]*)/.exec(location.search);e=t&&t[1]}try{e=e||process.env.MapboxAccessToken}catch{}try{e=e||process.env.REACT_APP_MAPBOX_ACCESS_TOKEN}catch{}return e}const Xn=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function Rn(e){if(!e)return null;const t=e.map,o={getMap:()=>t,getCenter:()=>e.transform.center,getZoom:()=>e.transform.zoom,getBearing:()=>e.transform.bearing,getPitch:()=>e.transform.pitch,getPadding:()=>e.transform.padding,getBounds:()=>e.transform.getBounds(),project:n=>{const r=t.transform;t.transform=e.transform;const i=t.project(n);return t.transform=r,i},unproject:n=>{const r=t.transform;t.transform=e.transform;const i=t.unproject(n);return t.transform=r,i},queryTerrainElevation:(n,r)=>{const i=t.transform;t.transform=e.transform;const s=t.queryTerrainElevation(n,r);return t.transform=i,s},queryRenderedFeatures:(n,r)=>{const i=t.transform;t.transform=e.transform;const s=t.queryRenderedFeatures(n,r);return t.transform=i,s}};for(const n of er(t))!(n in o)&&!Xn.includes(n)&&(o[n]=t[n].bind(t));return o}function er(e){const t=new Set;let o=e;for(;o;){for(const n of Object.getOwnPropertyNames(o))n[0]!=="_"&&typeof e[n]=="function"&&n!=="fire"&&n!=="setEventedParent"&&t.add(n);o=Object.getPrototypeOf(o)}return Array.from(t)}const tr=typeof document<"u"?c.useLayoutEffect:c.useEffect,or=["baseApiUrl","maxParallelImageRequests","workerClass","workerCount","workerUrl"];function nr(e,t){for(const n of or)n in t&&(e[n]=t[n]);const{RTLTextPlugin:o="https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js"}=t;o&&e.getRTLTextPluginStatus&&e.getRTLTextPluginStatus()==="unavailable"&&e.setRTLTextPlugin(o,n=>{n&&console.error(n)},!0)}const re=T.createContext(null);function rr(e,t){const o=c.useContext($t),[n,r]=c.useState(null),i=c.useRef(),{current:s}=c.useRef({mapLib:null,map:null});c.useEffect(()=>{const d=e.mapLib;let f=!0,u;return Promise.resolve(d||import("mapbox-gl")).then(p=>{if(!f)return;if(!p)throw new Error("Invalid mapLib");const g="Map"in p?p:p.default;if(!g.Map)throw new Error("Invalid mapLib");nr(g,e),e.reuseMaps&&(u=fe.reuse(e,i.current)),u||(u=new fe(g.Map,e,i.current)),s.map=Rn(u),s.mapLib=g,r(u),o?.onMapMount(s.map,e.id)}).catch(p=>{const{onError:g}=e;g?g({type:"error",target:null,error:p}):console.error(p)}),()=>{f=!1,u&&(o?.onMapUnmount(e.id),e.reuseMaps?u.recycle():u.destroy())}},[]),tr(()=>{n&&n.setProps(e)}),c.useImperativeHandle(t,()=>s.map,[n]);const l=c.useMemo(()=>({position:"relative",width:"100%",height:"100%",...e.style}),[e.style]),a={height:"100%"};return T.createElement("div",{id:e.id,ref:i,style:l},n&&T.createElement(re.Provider,{value:s},T.createElement("div",{"mapboxgl-children":"",style:a},e.children)))}const ir=T.forwardRef(rr),sr=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function ie(e,t){if(!e||!t)return;const o=e.style;for(const n in t){const r=t[n];Number.isFinite(r)&&!sr.test(n)?o[n]=`${r}px`:o[n]=r}}function Dt(e,t){if(e===t)return null;const o=Gt(e),n=Gt(t),r=[];for(const i of n)o.has(i)||r.push(i);for(const i of o)n.has(i)||r.push(i);return r.length===0?null:r}function Gt(e){return new Set(e?e.trim().split(/\s+/):[])}const Ht=c.memo(c.forwardRef((e,t)=>{const{map:o,mapLib:n}=c.useContext(re),r=c.useRef({props:e}),i=c.useMemo(()=>{let v=!1;T.Children.forEach(e.children,M=>{M&&(v=!0)});const E={...e,element:v?document.createElement("div"):null},_=new n.Marker(E);return _.setLngLat([e.longitude,e.latitude]),_.getElement().addEventListener("click",M=>{r.current.props.onClick?.({type:"click",target:_,originalEvent:M})}),_.on("dragstart",M=>{const k=M;k.lngLat=i.getLngLat(),r.current.props.onDragStart?.(k)}),_.on("drag",M=>{const k=M;k.lngLat=i.getLngLat(),r.current.props.onDrag?.(k)}),_.on("dragend",M=>{const k=M;k.lngLat=i.getLngLat(),r.current.props.onDragEnd?.(k)}),_},[]);c.useEffect(()=>(i.addTo(o.getMap()),()=>{i.remove()}),[]);const{longitude:s,latitude:l,offset:a,style:d,draggable:f=!1,popup:u=null,rotation:p=0,rotationAlignment:g="auto",pitchAlignment:y="auto"}=e;c.useEffect(()=>{ie(i.getElement(),d)},[d]),c.useImperativeHandle(t,()=>i,[]);const b=r.current.props;(i.getLngLat().lng!==s||i.getLngLat().lat!==l)&&i.setLngLat([s,l]),a&&!Kn(i.getOffset(),a)&&i.setOffset(a),i.isDraggable()!==f&&i.setDraggable(f),i.getRotation()!==p&&i.setRotation(p),i.getRotationAlignment()!==g&&i.setRotationAlignment(g),i.getPitchAlignment()!==y&&i.setPitchAlignment(y),i.getPopup()!==u&&i.setPopup(u);const h=Dt(b.className,e.className);if(h)for(const v of h)i.toggleClassName(v);return r.current.props=e,Se.createPortal(e.children,i.getElement())})),ar=c.memo(c.forwardRef((e,t)=>{const{map:o,mapLib:n}=c.useContext(re),r=c.useMemo(()=>document.createElement("div"),[]),i=c.useRef({props:e}),s=c.useMemo(()=>{const l={...e},a=new n.Popup(l);return a.setLngLat([e.longitude,e.latitude]),a.once("open",d=>{i.current.props.onOpen?.(d)}),a},[]);if(c.useEffect(()=>{const l=a=>{i.current.props.onClose?.(a)};return s.on("close",l),s.setDOMContent(r).addTo(o.getMap()),()=>{s.off("close",l),s.isOpen()&&s.remove()}},[]),c.useEffect(()=>{ie(s.getElement(),e.style)},[e.style]),c.useImperativeHandle(t,()=>s,[]),s.isOpen()){const l=i.current.props;(s.getLngLat().lng!==e.longitude||s.getLngLat().lat!==e.latitude)&&s.setLngLat([e.longitude,e.latitude]),e.offset&&!U(l.offset,e.offset)&&(s.options.anchor=e.anchor,s.setOffset(e.offset)),(l.anchor!==e.anchor||l.maxWidth!==e.maxWidth)&&s.setMaxWidth(e.maxWidth);const a=Dt(l.className,e.className);if(a)for(const d of a)s.toggleClassName(d);i.current.props=e}return Se.createPortal(e.children,r)}));function Ce(e,t,o,n){const r=c.useContext(re),i=c.useMemo(()=>e(r),[]);return c.useEffect(()=>{const s=t,l=null,a=typeof t=="function"?t:null,{map:d}=r;return d.hasControl(i)||(d.addControl(i,s?.position),l&&l(r)),()=>{a&&a(r),d.hasControl(i)&&d.removeControl(i)}},[]),i}function lr(e){const t=Ce(({mapLib:o})=>new o.AttributionControl(e),{position:e.position});return c.useEffect(()=>{ie(t._container,e.style)},[e.style]),null}c.memo(lr);function cr(e){const t=Ce(({mapLib:o})=>new o.FullscreenControl({container:e.containerId&&document.getElementById(e.containerId)}),{position:e.position});return c.useEffect(()=>{ie(t._controlContainer,e.style)},[e.style]),null}c.memo(cr);function ur(e,t){const o=c.useRef({props:e}),n=Ce(({mapLib:r})=>{const i=new r.GeolocateControl(e),s=i._setupUI.bind(i);return i._setupUI=l=>{i._container.hasChildNodes()||s(l)},i.on("geolocate",l=>{o.current.props.onGeolocate?.(l)}),i.on("error",l=>{o.current.props.onError?.(l)}),i.on("outofmaxbounds",l=>{o.current.props.onOutOfMaxBounds?.(l)}),i.on("trackuserlocationstart",l=>{o.current.props.onTrackUserLocationStart?.(l)}),i.on("trackuserlocationend",l=>{o.current.props.onTrackUserLocationEnd?.(l)}),i},{position:e.position});return o.current.props=e,c.useImperativeHandle(t,()=>n,[]),c.useEffect(()=>{ie(n._container,e.style)},[e.style]),null}c.memo(c.forwardRef(ur));function dr(e){const t=Ce(({mapLib:o})=>new o.NavigationControl(e),{position:e.position});return c.useEffect(()=>{ie(t._container,e.style)},[e.style]),null}const fr=c.memo(dr);function mr(e){const t=Ce(({mapLib:i})=>new i.ScaleControl(e),{position:e.position}),o=c.useRef(e),n=o.current;o.current=e;const{style:r}=e;return e.maxWidth!==void 0&&e.maxWidth!==n.maxWidth&&(t.options.maxWidth=e.maxWidth),e.unit!==void 0&&e.unit!==n.unit&&t.setUnit(e.unit),c.useEffect(()=>{ie(t._container,r)},[r]),null}c.memo(mr);function Te(e,t){if(!e)throw new Error(t)}let pr=0;function gr(e,t,o){if(e.style&&e.style._loaded){const n={...o};return delete n.id,delete n.children,e.addSource(t,n),e.getSource(t)}return null}function hr(e,t,o){Te(t.id===o.id,"source id changed"),Te(t.type===o.type,"source type changed");let n="",r=0;for(const s in t)s!=="children"&&s!=="id"&&!U(o[s],t[s])&&(n=s,r++);if(!r)return;const i=t.type;i==="geojson"?e.setData(t.data):i==="image"?e.updateImage({url:t.url,coordinates:t.coordinates}):"setCoordinates"in e&&r===1&&n==="coordinates"?e.setCoordinates(t.coordinates):"setUrl"in e&&n==="url"?e.setUrl(t.url):"setTiles"in e&&n==="tiles"?e.setTiles(t.tiles):console.warn(`Unable to update <Source> prop: ${n}`)}function yr(e){const t=c.useContext(re).map.getMap(),o=c.useRef(e),[,n]=c.useState(0),r=c.useMemo(()=>e.id||`jsx-source-${pr++}`,[]);c.useEffect(()=>{if(t){const s=()=>setTimeout(()=>n(l=>l+1),0);return t.on("styledata",s),s(),()=>{if(t.off("styledata",s),t.style&&t.style._loaded&&t.getSource(r)){const l=t.getStyle()?.layers;if(l)for(const a of l)a.source===r&&t.removeLayer(a.id);t.removeSource(r)}}}},[t]);let i=t&&t.style&&t.getSource(r);return i?hr(i,e,o.current):i=gr(t,r,e),o.current=e,i&&T.Children.map(e.children,s=>s&&c.cloneElement(s,{source:r}))||null}function br(e,t,o,n){if(Te(o.id===n.id,"layer id changed"),Te(o.type===n.type,"layer type changed"),o.type==="custom"||n.type==="custom")return;const{layout:r={},paint:i={},filter:s,minzoom:l,maxzoom:a,beforeId:d}=o;if(d!==n.beforeId&&e.moveLayer(t,d),r!==n.layout){const f=n.layout||{};for(const u in r)U(r[u],f[u])||e.setLayoutProperty(t,u,r[u]);for(const u in f)r.hasOwnProperty(u)||e.setLayoutProperty(t,u,void 0)}if(i!==n.paint){const f=n.paint||{};for(const u in i)U(i[u],f[u])||e.setPaintProperty(t,u,i[u]);for(const u in f)i.hasOwnProperty(u)||e.setPaintProperty(t,u,void 0)}U(s,n.filter)||e.setFilter(t,s),(l!==n.minzoom||a!==n.maxzoom)&&e.setLayerZoomRange(t,l,a)}function vr(e,t,o){if(e.style&&e.style._loaded&&(!("source"in o)||e.getSource(o.source))){const n={...o,id:t};delete n.beforeId,e.addLayer(n,o.beforeId)}}let wr=0;function Wt(e){const t=c.useContext(re).map.getMap(),o=c.useRef(e),[,n]=c.useState(0),r=c.useMemo(()=>e.id||`jsx-layer-${wr++}`,[]);if(c.useEffect(()=>{if(t){const s=()=>n(l=>l+1);return t.on("styledata",s),s(),()=>{t.off("styledata",s),t.style&&t.style._loaded&&t.getLayer(r)&&t.removeLayer(r)}}},[t]),t&&t.style&&t.getLayer(r))try{br(t,r,e,o.current)}catch(s){console.warn(s)}else vr(t,r,e);return o.current=e,null}const xr={en:{"AttributionControl.ToggleAttribution":"Toggle attribution","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox homepage","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use ⌘ + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"},fr:{"AttributionControl.ToggleAttribution":"Afficher/Masquer l’attribution","FullscreenControl.Enter":"Passer en plein écran","FullscreenControl.Exit":"Quitter le plein écran","GeolocateControl.FindMyLocation":"Trouver ma position","GeolocateControl.LocationNotAvailable":"Position non disponible","LogoControl.Title":"Page d’accueil Mapbox","Map.Title":"Carte","NavigationControl.ResetBearing":"Réinitialiser l’orientation au nord","NavigationControl.ZoomIn":"Zoomer","NavigationControl.ZoomOut":"Dézoomer","ScrollZoomBlocker.CtrlMessage":"Utilisez ctrl + défilement pour zoomer sur la carte","ScrollZoomBlocker.CmdMessage":"Utilisez ⌘ + défilement pour zoomer sur la carte","TouchPanBlocker.Message":"Utilisez deux doigts pour déplacer la carte"}},_r=()=>{const{current:e}=Nt(),{centerPinMarkerPoints:t,markerPoints:o,locationBoundary:n,setZoom:r,mapPadding:i}=z(),[s,l]=c.useState(void 0),a=c.useRef(void 0),d=c.useCallback(()=>{e&&r(e.getZoom())},[e,r]);return c.useEffect(()=>(d(),e?.on("zoom",d),()=>{e?.off("zoom",d)}),[e,d]),c.useEffect(()=>{if(!e)return;const f=[];if(typeof o<"u"&&o.length>0?(f.push(...o),t&&f.push(t)):f.push(...n||[]),f.length===0)return;const u=Ge(Ie(f));(!a.current||!u.every((p,g)=>p===a.current?.[g]))&&(a.current=u,l(u))},[e,o,n,t]),c.useEffect(()=>{if(!e||typeof s>"u")return;const[f,u,p,g]=s,y=(p-f)*.05||.001,b=(g-u)*.05||.001;e.fitBounds([[f-y,u-b],[p+y,g+b]],{retainPadding:!1,padding:i,maxZoom:17,duration:700})},[e,s,i]),null};function Cr({children:e}){const{mapProvider:t,locale:o,center:n,zoom:r=F.zoom,minZoom:i,maxZoom:s,pitch:l=F.pitch,bearing:a=F.bearing,cooperativeGestures:d=F.cooperativeGestures,zoomPosition:f}=z();return t.name!=="mapbox"?null:m.jsxs(ir,{mapboxAccessToken:t.apiKey,initialViewState:{...n,zoom:r,pitch:l,bearing:a},cooperativeGestures:d,minZoom:i,maxZoom:s,mapStyle:`mapbox://styles/${t.theme||be.mapbox}`,interactiveLayerIds:["road-label","waterway-label"],locale:xr[o],children:[m.jsx(_r,{}),f&&m.jsx(fr,{position:f}),e]})}const Mr=Object.freeze(Object.defineProperty({__proto__:null,default:Cr},Symbol.toStringTag,{value:"Module"})),kr=`
|
|
1
|
+
(function(D,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react/jsx-runtime"),require("react"),require("@vis.gl/react-google-maps"),require("@phosphor-icons/react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","@vis.gl/react-google-maps","@phosphor-icons/react","react-dom"],m):(D=typeof globalThis<"u"?globalThis:D||self,m(D.LocalLogicMaps={},D.jsxRuntime,D.React,D.ReactGoogleMaps,D.PhosphorIcons,D.ReactDOM))})(this,(function(D,m,c,Z,le,Se){"use strict";function bo(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const n=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const T=bo(c),st=c.createContext({}),z=()=>c.useContext(st),F={zoom:14,pitch:0,bearing:0,cooperativeGestures:!1},be={maptiler:"600d69cb-288d-445e-9839-3dfe4d76b31a",mapbox:"locallogic/cmb9nz9kb011501ru8drq8fqf",google:"a7ff20eb973126bb",testing:"testing"},ve={top:10,bottom:10,left:10,right:10},at=10,vo=22,we=10,wo=30,xo=60,ce=15,ue=[-180,-85.0511,180,85.0511],_o="w-full h-full relative overflow-hidden",Co=c.lazy(()=>Promise.resolve().then(()=>Fn)),Mo=c.lazy(()=>Promise.resolve().then(()=>Bn)),ko=c.lazy(()=>Promise.resolve().then(()=>Mr)),lt=c.lazy(()=>Promise.resolve().then(()=>Lr)),So=({children:e})=>{const{mapProvider:t,center:o,zoom:n=F.zoom,pitch:r=F.pitch,bearing:i=F.bearing,cooperativeGestures:s=F.cooperativeGestures,zoomPosition:l}=z(),[a]=c.useState(n),d=c.useMemo(()=>{switch(t?.name){case"maptiler":return Co;case"google":return Mo;case"mapbox":return ko;case"testing":return lt;default:return lt}},[t]);return m.jsx("div",{className:_o,"data-testid":"base-map","data-map-provider-name":t?.name,"data-map-provider-theme":t?.theme||be[t?.name]||be.maptiler,"data-initial-zoom":a,"data-pitch":r,"data-bearing":i,"data-cooperative-gestures":s,"data-zoom-position":l,"data-center-latitude":o.latitude,"data-center-longitude":o.longitude,children:m.jsx(c.Suspense,{fallback:null,children:m.jsx(d,{children:e})})})},Po=c.lazy(()=>Promise.resolve().then(()=>ci)),Eo=c.lazy(()=>Promise.resolve().then(()=>di)),Lo=c.lazy(()=>Promise.resolve().then(()=>mi)),To=c.lazy(()=>Promise.resolve().then(()=>hi));function zo(e){const{mapProvider:t,setCenterPinMarkerPoints:o}=z();c.useEffect(()=>{if(e?.marker)return o([e.marker.longitude,e.marker.latitude]),()=>{o(void 0)}},[e?.marker?.longitude,e?.marker?.latitude,o]);const n=c.useMemo(()=>{switch(t?.name){case"maptiler":return Po;case"google":return Eo;case"mapbox":return Lo;case"testing":return To;default:return null}},[t]);return n?m.jsx(c.Suspense,{fallback:null,children:m.jsx(n,{...e})}):null}function ct(e,t,o={}){const n={type:"Feature"};return(o.id===0||o.id)&&(n.id=o.id),o.bbox&&(n.bbox=o.bbox),n.properties=t||{},n.geometry=e,n}function Ao(e,t,o={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!ut(e[0])||!ut(e[1]))throw new Error("coordinates must contain numbers");return ct({type:"Point",coordinates:e},t,o)}function Ie(e,t,o={}){return ct({type:"MultiPoint",coordinates:e},t,o)}function ut(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}const dt=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],je=1,xe=8;class Ze{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[o,n]=new Uint8Array(t,0,2);if(o!==219)throw new Error("Data does not appear to be in a KDBush format.");const r=n>>4;if(r!==je)throw new Error(`Got v${r} data when expected v${je}.`);const i=dt[n&15];if(!i)throw new Error("Unrecognized array type.");const[s]=new Uint16Array(t,2,1),[l]=new Uint32Array(t,4,1);return new Ze(l,s,i,t)}constructor(t,o=64,n=Float64Array,r){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+o,2),65535),this.ArrayType=n,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const i=dt.indexOf(this.ArrayType),s=t*2*this.ArrayType.BYTES_PER_ELEMENT,l=t*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-l%8)%8;if(i<0)throw new Error(`Unexpected typed array class: ${n}.`);r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,xe,t),this.coords=new this.ArrayType(this.data,xe+l+a,t*2),this._pos=t*2,this._finished=!0):(this.data=new ArrayBuffer(xe+s+l+a),this.ids=new this.IndexArrayType(this.data,xe,t),this.coords=new this.ArrayType(this.data,xe+l+a,t*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(je<<4)+i]),new Uint16Array(this.data,2,1)[0]=o,new Uint32Array(this.data,4,1)[0]=t)}add(t,o){const n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=t,this.coords[this._pos++]=o,n}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Be(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,o,n,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:s,nodeSize:l}=this,a=[0,i.length-1,0],d=[];for(;a.length;){const f=a.pop()||0,u=a.pop()||0,p=a.pop()||0;if(u-p<=l){for(let h=p;h<=u;h++){const v=s[2*h],E=s[2*h+1];v>=t&&v<=n&&E>=o&&E<=r&&d.push(i[h])}continue}const g=p+u>>1,y=s[2*g],b=s[2*g+1];y>=t&&y<=n&&b>=o&&b<=r&&d.push(i[g]),(f===0?t<=y:o<=b)&&(a.push(p),a.push(g-1),a.push(1-f)),(f===0?n>=y:r>=b)&&(a.push(g+1),a.push(u),a.push(1-f))}return d}within(t,o,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:r,coords:i,nodeSize:s}=this,l=[0,r.length-1,0],a=[],d=n*n;for(;l.length;){const f=l.pop()||0,u=l.pop()||0,p=l.pop()||0;if(u-p<=s){for(let h=p;h<=u;h++)mt(i[2*h],i[2*h+1],t,o)<=d&&a.push(r[h]);continue}const g=p+u>>1,y=i[2*g],b=i[2*g+1];mt(y,b,t,o)<=d&&a.push(r[g]),(f===0?t-n<=y:o-n<=b)&&(l.push(p),l.push(g-1),l.push(1-f)),(f===0?t+n>=y:o+n>=b)&&(l.push(g+1),l.push(u),l.push(1-f))}return a}}function Be(e,t,o,n,r,i){if(r-n<=o)return;const s=n+r>>1;ft(e,t,s,n,r,i),Be(e,t,o,n,s-1,1-i),Be(e,t,o,s+1,r,1-i)}function ft(e,t,o,n,r,i){for(;r>n;){if(r-n>600){const d=r-n+1,f=o-n+1,u=Math.log(d),p=.5*Math.exp(2*u/3),g=.5*Math.sqrt(u*p*(d-p)/d)*(f-d/2<0?-1:1),y=Math.max(n,Math.floor(o-f*p/d+g)),b=Math.min(r,Math.floor(o+(d-f)*p/d+g));ft(e,t,o,y,b,i)}const s=t[2*o+i];let l=n,a=r;for(_e(e,t,n,o),t[2*r+i]>s&&_e(e,t,n,r);l<a;){for(_e(e,t,l,a),l++,a--;t[2*l+i]<s;)l++;for(;t[2*a+i]>s;)a--}t[2*n+i]===s?_e(e,t,n,a):(a++,_e(e,t,a,r)),a<=o&&(n=a+1),o<=a&&(r=a-1)}}function _e(e,t,o,n){Ue(e,o,n),Ue(t,2*o,2*n),Ue(t,2*o+1,2*n+1)}function Ue(e,t,o){const n=e[t];e[t]=e[o],e[o]=n}function mt(e,t,o,n){const r=e-o,i=t-n;return r*r+i*i}const Oo={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},pt=Math.fround||(e=>(t=>(e[0]=+t,e[0])))(new Float32Array(1)),ee=2,J=3,De=4,Y=5,gt=6;class $o{constructor(t){this.options=Object.assign(Object.create(Oo),t),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(t){const{log:o,minZoom:n,maxZoom:r}=this.options;o&&console.time("total time");const i=`prepare ${t.length} points`;o&&console.time(i),this.points=t;const s=[];for(let a=0;a<t.length;a++){const d=t[a];if(!d.geometry)continue;const[f,u]=d.geometry.coordinates,p=pt(Pe(f)),g=pt(Ee(u));s.push(p,g,1/0,a,-1,1),this.options.reduce&&s.push(0)}let l=this.trees[r+1]=this._createTree(s);o&&console.timeEnd(i);for(let a=r;a>=n;a--){const d=+Date.now();l=this.trees[a]=this._createTree(this._cluster(l,a)),o&&console.log("z%d: %d clusters in %dms",a,l.numItems,+Date.now()-d)}return o&&console.timeEnd("total time"),this}getClusters(t,o){let n=((t[0]+180)%360+360)%360-180;const r=Math.max(-90,Math.min(90,t[1]));let i=t[2]===180?180:((t[2]+180)%360+360)%360-180;const s=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)n=-180,i=180;else if(n>i){const u=this.getClusters([n,r,180,s],o),p=this.getClusters([-180,r,i,s],o);return u.concat(p)}const l=this.trees[this._limitZoom(o)],a=l.range(Pe(n),Ee(s),Pe(i),Ee(r)),d=l.data,f=[];for(const u of a){const p=this.stride*u;f.push(d[p+Y]>1?ht(d,p,this.clusterProps):this.points[d[p+J]])}return f}getChildren(t){const o=this._getOriginId(t),n=this._getOriginZoom(t),r="No cluster with the specified id.",i=this.trees[n];if(!i)throw new Error(r);const s=i.data;if(o*this.stride>=s.length)throw new Error(r);const l=this.options.radius/(this.options.extent*Math.pow(2,n-1)),a=s[o*this.stride],d=s[o*this.stride+1],f=i.within(a,d,l),u=[];for(const p of f){const g=p*this.stride;s[g+De]===t&&u.push(s[g+Y]>1?ht(s,g,this.clusterProps):this.points[s[g+J]])}if(u.length===0)throw new Error(r);return u}getLeaves(t,o,n){o=o||10,n=n||0;const r=[];return this._appendLeaves(r,t,o,n,0),r}getTile(t,o,n){const r=this.trees[this._limitZoom(t)],i=Math.pow(2,t),{extent:s,radius:l}=this.options,a=l/s,d=(n-a)/i,f=(n+1+a)/i,u={features:[]};return this._addTileFeatures(r.range((o-a)/i,d,(o+1+a)/i,f),r.data,o,n,i,u),o===0&&this._addTileFeatures(r.range(1-a/i,d,1,f),r.data,i,n,i,u),o===i-1&&this._addTileFeatures(r.range(0,d,a/i,f),r.data,-1,n,i,u),u.features.length?u:null}getClusterExpansionZoom(t){let o=this._getOriginZoom(t)-1;for(;o<=this.options.maxZoom;){const n=this.getChildren(t);if(o++,n.length!==1)break;t=n[0].properties.cluster_id}return o}_appendLeaves(t,o,n,r,i){const s=this.getChildren(o);for(const l of s){const a=l.properties;if(a&&a.cluster?i+a.point_count<=r?i+=a.point_count:i=this._appendLeaves(t,a.cluster_id,n,r,i):i<r?i++:t.push(l),t.length===n)break}return i}_createTree(t){const o=new Ze(t.length/this.stride|0,this.options.nodeSize,Float32Array);for(let n=0;n<t.length;n+=this.stride)o.add(t[n],t[n+1]);return o.finish(),o.data=t,o}_addTileFeatures(t,o,n,r,i,s){for(const l of t){const a=l*this.stride,d=o[a+Y]>1;let f,u,p;if(d)f=yt(o,a,this.clusterProps),u=o[a],p=o[a+1];else{const b=this.points[o[a+J]];f=b.properties;const[h,v]=b.geometry.coordinates;u=Pe(h),p=Ee(v)}const g={type:1,geometry:[[Math.round(this.options.extent*(u*i-n)),Math.round(this.options.extent*(p*i-r))]],tags:f};let y;d||this.options.generateId?y=o[a+J]:y=this.points[o[a+J]].id,y!==void 0&&(g.id=y),s.features.push(g)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}_cluster(t,o){const{radius:n,extent:r,reduce:i,minPoints:s}=this.options,l=n/(r*Math.pow(2,o)),a=t.data,d=[],f=this.stride;for(let u=0;u<a.length;u+=f){if(a[u+ee]<=o)continue;a[u+ee]=o;const p=a[u],g=a[u+1],y=t.within(a[u],a[u+1],l),b=a[u+Y];let h=b;for(const v of y){const E=v*f;a[E+ee]>o&&(h+=a[E+Y])}if(h>b&&h>=s){let v=p*b,E=g*b,_,M=-1;const k=((u/f|0)<<5)+(o+1)+this.points.length;for(const L of y){const O=L*f;if(a[O+ee]<=o)continue;a[O+ee]=o;const C=a[O+Y];v+=a[O]*C,E+=a[O+1]*C,a[O+De]=k,i&&(_||(_=this._map(a,u,!0),M=this.clusterProps.length,this.clusterProps.push(_)),i(_,this._map(a,O)))}a[u+De]=k,d.push(v/h,E/h,1/0,k,-1,h),i&&d.push(M)}else{for(let v=0;v<f;v++)d.push(a[u+v]);if(h>1)for(const v of y){const E=v*f;if(!(a[E+ee]<=o)){a[E+ee]=o;for(let _=0;_<f;_++)d.push(a[E+_])}}}}return d}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,o,n){if(t[o+Y]>1){const s=this.clusterProps[t[o+gt]];return n?Object.assign({},s):s}const r=this.points[t[o+J]].properties,i=this.options.map(r);return n&&i===r?Object.assign({},i):i}}function ht(e,t,o){return{type:"Feature",id:e[t+J],properties:yt(e,t,o),geometry:{type:"Point",coordinates:[No(e[t]),Fo(e[t+1])]}}}function yt(e,t,o){const n=e[t+Y],r=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?`${Math.round(n/100)/10}k`:n,i=e[t+gt],s=i===-1?{}:Object.assign({},o[i]);return Object.assign(s,{cluster:!0,cluster_id:e[t+J],point_count:n,point_count_abbreviated:r})}function Pe(e){return e/360+.5}function Ee(e){const t=Math.sin(e*Math.PI/180),o=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return o<0?0:o>1?1:o}function No(e){return(e-.5)*360}function Fo(e){const t=(180-e*360)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}var bt=Object.prototype.hasOwnProperty;function vt(e,t,o){for(o of e.keys())if(te(o,t))return o}function te(e,t){var o,n,r;if(e===t)return!0;if(e&&t&&(o=e.constructor)===t.constructor){if(o===Date)return e.getTime()===t.getTime();if(o===RegExp)return e.toString()===t.toString();if(o===Array){if((n=e.length)===t.length)for(;n--&&te(e[n],t[n]););return n===-1}if(o===Set){if(e.size!==t.size)return!1;for(n of e)if(r=n,r&&typeof r=="object"&&(r=vt(t,r),!r)||!t.has(r))return!1;return!0}if(o===Map){if(e.size!==t.size)return!1;for(n of e)if(r=n[0],r&&typeof r=="object"&&(r=vt(t,r),!r)||!te(n[1],t.get(r)))return!1;return!0}if(o===ArrayBuffer)e=new Uint8Array(e),t=new Uint8Array(t);else if(o===DataView){if((n=e.byteLength)===t.byteLength)for(;n--&&e.getInt8(n)===t.getInt8(n););return n===-1}if(ArrayBuffer.isView(e)){if((n=e.byteLength)===t.byteLength)for(;n--&&e[n]===t[n];);return n===-1}if(!o||typeof e=="object"){n=0;for(o in e)if(bt.call(e,o)&&++n&&!bt.call(t,o)||!(o in t)||!te(e[o],t[o]))return!1;return Object.keys(t).length===n}}return e!==e&&t!==t}function Io(e){var t=T.useRef(e),o=T.useRef(0);return te(e,t.current)||(t.current=e,o.current+=1),T.useMemo(function(){return t.current},[o.current])}function jo(e,t){return T.useEffect(e,Io(t))}var Zo=function(t){var o=t.points,n=t.bounds,r=t.zoom,i=t.options,s=t.disableRefresh,l=c.useRef(),a=c.useRef(),d=c.useState([]),f=d[0],u=d[1],p=Math.round(r);return jo(function(){s!==!0&&((!l.current||!te(a.current,o)||!te(l.current.options,i))&&(l.current=new $o(i),l.current.load(o)),n&&u(l.current.getClusters(n,p)),a.current=o)},[o,n,p,i,s]),{clusters:f,supercluster:l.current}};const Bo=c.lazy(()=>Promise.resolve().then(()=>vi)),Uo=c.lazy(()=>Promise.resolve().then(()=>xi)),Do=c.lazy(()=>Promise.resolve().then(()=>Ci)),Go=c.lazy(()=>Promise.resolve().then(()=>zi));function Ho({isLoading:e,markers:t,onClick:o,...n}){const{mapProvider:r,activeMarker:i,zoom:s,setMarkerPoints:l,setClusterPoints:a}=z();c.useEffect(()=>{if(e)return;const h=(t||[]).map(v=>[v.longitude,v.latitude]);l(h)},[t,l]);const d=c.useMemo(()=>({points:t.map(h=>Ao([h.longitude,h.latitude],h)),bounds:ue,zoom:s,options:{radius:r.name==="google"&&s>at?xo:wo,minZoom:at,maxZoom:vo}}),[t,r,s]),{clusters:f,supercluster:u}=Zo(d),p=c.useRef("");c.useEffect(()=>{const h=JSON.stringify(f.map(v=>({coords:v.geometry.coordinates,props:v.properties})));h!==p.current&&(a(f),p.current=h)},[f,a]);const g=h=>{if(!("properties"in h))throw new Error("Cluster does not have properties");if(h.properties?.cluster&&typeof h.properties?.cluster_id=="number"){o?.({id:`${h.properties.cluster_id}`,latitude:h.geometry.coordinates[1],longitude:h.geometry.coordinates[0],markers:u?.getLeaves(h.properties.cluster_id)?.map(v=>v.properties)??[]});return}o?.({id:h.properties.id,latitude:h.properties.latitude,longitude:h.properties.longitude,markers:[h.properties]})},y=h=>{if(!u||!i)return!1;if(i.id===`${h}`)return!0;try{return u.getLeaves(h)?.find(v=>v.properties.id===i.id)!==void 0}catch{return!1}},b=c.useMemo(()=>{switch(r?.name){case"maptiler":return Bo;case"google":return Uo;case"mapbox":return Do;case"testing":return Go;default:return null}},[r]);return b?m.jsx(c.Suspense,{fallback:null,children:m.jsx(b,{clusters:f,onClick:g,doesSuperclusterContainActiveMarker:y,...n})}):null}const Wo=c.lazy(()=>Promise.resolve().then(()=>Oi)),Vo=c.lazy(()=>Promise.resolve().then(()=>Ni)),qo=c.lazy(()=>Promise.resolve().then(()=>Ii)),Ko=c.lazy(()=>Promise.resolve().then(()=>Gi));function Jo({children:e,anchor:t="bottom",...o}){const{mapProvider:n}=z(),r=c.useMemo(()=>{switch(n?.name){case"maptiler":return Wo;case"google":return Vo;case"mapbox":return qo;case"testing":return Ko;default:return null}},[n]);return r?m.jsx(c.Suspense,{fallback:null,children:m.jsx(r,{...o,anchor:t,children:e})}):null}const Yo=c.lazy(()=>Promise.resolve().then(()=>Vi)),Qo=c.lazy(()=>Promise.resolve().then(()=>Ki)),Xo=c.lazy(()=>Promise.resolve().then(()=>Yi)),Ro=c.lazy(()=>Promise.resolve().then(()=>ss));function en(e){const{mapProvider:t}=z(),o=c.useMemo(()=>{switch(t?.name){case"maptiler":return Yo;case"google":return Qo;case"mapbox":return Xo;case"testing":return Ro;default:return null}},[t]);return o?m.jsx(c.Suspense,{fallback:null,children:m.jsx(o,{...e})}):null}function tn(e){const[t,o]=c.useState(),[n,r]=c.useState([]),[i,s]=c.useState([]),[l,a]=c.useState(e.zoom||F.zoom);return m.jsx(st.Provider,{value:{...e,locale:e.locale||"en",mapPadding:e.mapPadding||ve,locationBoundary:e.locationBoundary,centerPinMarkerPoints:t,setCenterPinMarkerPoints:o,markerPoints:n,setMarkerPoints:r,clusterPoints:i,setClusterPoints:s,zoom:l,setZoom:a},children:e.children})}const on=Object.freeze(Object.defineProperty({__proto__:null,BaseMap:So,CenterPin:zo,Layers:en,Markers:Ho,Popup:Jo,Root:tn},Symbol.toStringTag,{value:"Module"})),wt=T.createContext(null);function xt(){const e=c.useContext(wt)?.maps,t=c.useContext(oe);return c.useMemo(()=>({...e,current:t?.map}),[e,t])}function nn(e,t){const o=Array.isArray(e)?e[0]:e?e.x:0,n=Array.isArray(e)?e[1]:e?e.y:0,r=Array.isArray(t)?t[0]:t?t.x:0,i=Array.isArray(t)?t[1]:t?t.y:0;return o===r&&n===i}function j(e,t){if(e===t)return!0;if(!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let o=0;o<e.length;o++)if(!j(e[o],t[o]))return!1;return!0}else if(Array.isArray(t))return!1;if(typeof e=="object"&&typeof t=="object"){const o=Object.keys(e),n=Object.keys(t);if(o.length!==n.length)return!1;for(const r of o)if(!t.hasOwnProperty(r)||!j(e[r],t[r]))return!1;return!0}return!1}function _t(e){return{longitude:e.center.lng,latitude:e.center.lat,zoom:e.zoom,pitch:e.pitch,bearing:e.bearing,padding:e.padding}}function Ct(e,t){const o=t.viewState||t,n={};if("longitude"in o&&"latitude"in o&&(o.longitude!==e.center.lng||o.latitude!==e.center.lat)){const r=e.center.constructor;n.center=new r(o.longitude,o.latitude)}return"zoom"in o&&o.zoom!==e.zoom&&(n.zoom=o.zoom),"bearing"in o&&o.bearing!==e.bearing&&(n.bearing=o.bearing),"pitch"in o&&o.pitch!==e.pitch&&(n.pitch=o.pitch),o.padding&&e.padding&&!j(o.padding,e.padding)&&(n.padding=o.padding),n}const rn=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Mt(e){if(!e)return null;if(typeof e=="string"||("toJS"in e&&(e=e.toJS()),!e.layers))return e;const t={};for(const n of e.layers)t[n.id]=n;const o=e.layers.map(n=>{let r=null;"interactive"in n&&(r=Object.assign({},n),delete r.interactive);const i=t[n.ref];if(i){r=r||Object.assign({},n),delete r.ref;for(const s of rn)s in i&&(r[s]=i[s])}return r||n});return{...e,layers:o}}const kt={version:8,sources:{},layers:[]},St={mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",click:"onClick",dblclick:"onDblClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mouseout:"onMouseOut",contextmenu:"onContextMenu",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",touchcancel:"onTouchCancel"},Pt={movestart:"onMoveStart",move:"onMove",moveend:"onMoveEnd",dragstart:"onDragStart",drag:"onDrag",dragend:"onDragEnd",zoomstart:"onZoomStart",zoom:"onZoom",zoomend:"onZoomEnd",rotatestart:"onRotateStart",rotate:"onRotate",rotateend:"onRotateEnd",pitchstart:"onPitchStart",pitch:"onPitch",pitchend:"onPitchEnd"},Et={wheel:"onWheel",boxzoomstart:"onBoxZoomStart",boxzoomend:"onBoxZoomEnd",boxzoomcancel:"onBoxZoomCancel",resize:"onResize",load:"onLoad",render:"onRender",idle:"onIdle",remove:"onRemove",data:"onData",styledata:"onStyleData",sourcedata:"onSourceData",error:"onError"},sn=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],an=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"];class de{constructor(t,o,n){this._map=null,this._internalUpdate=!1,this._hoveredFeatures=null,this._propsedCameraUpdate=null,this._styleComponents={},this._onEvent=r=>{const i=this.props[Et[r.type]];i?i(r):r.type==="error"&&console.error(r.error)},this._onCameraEvent=r=>{if(this._internalUpdate)return;r.viewState=this._propsedCameraUpdate||_t(this._map.transform);const i=this.props[Pt[r.type]];i&&i(r)},this._onCameraUpdate=r=>this._internalUpdate?r:(this._propsedCameraUpdate=_t(r),Ct(r,this.props)),this._onPointerEvent=r=>{(r.type==="mousemove"||r.type==="mouseout")&&this._updateHover(r);const i=this.props[St[r.type]];i&&(this.props.interactiveLayerIds&&r.type!=="mouseover"&&r.type!=="mouseout"&&(r.features=this._hoveredFeatures||this._queryRenderedFeatures(r.point)),i(r),delete r.features)},this._MapClass=t,this.props=o,this._initialize(n)}get map(){return this._map}setProps(t){const o=this.props;this.props=t;const n=this._updateSettings(t,o),r=this._updateSize(t),i=this._updateViewState(t);this._updateStyle(t,o),this._updateStyleComponents(t),this._updateHandlers(t,o),(n||r||i&&!this._map.isMoving())&&this.redraw()}static reuse(t,o){const n=de.savedMaps.pop();if(!n)return null;const r=n.map,i=r.getContainer();for(o.className=i.className;i.childNodes.length>0;)o.appendChild(i.childNodes[0]);r._container=o;const s=r._resizeObserver;s&&(s.disconnect(),s.observe(o)),n.setProps({...t,styleDiffing:!1}),r.resize();const{initialViewState:l}=t;return l&&(l.bounds?r.fitBounds(l.bounds,{...l.fitBoundsOptions,duration:0}):n._updateViewState(l)),r.isStyleLoaded()?r.fire("load"):r.once("style.load",()=>r.fire("load")),r._update(),n}_initialize(t){const{props:o}=this,{mapStyle:n=kt}=o,r={...o,...o.initialViewState,container:t,style:Mt(n)},i=r.initialViewState||r.viewState||r;if(Object.assign(r,{center:[i.longitude||0,i.latitude||0],zoom:i.zoom||0,pitch:i.pitch||0,bearing:i.bearing||0}),o.gl){const l=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=l,o.gl)}const s=new this._MapClass(r);i.padding&&s.setPadding(i.padding),o.cursor&&(s.getCanvas().style.cursor=o.cursor),s.transformCameraUpdate=this._onCameraUpdate,s.on("style.load",()=>{this._styleComponents={light:s.getLight(),sky:s.getSky(),projection:s.getProjection?.(),terrain:s.getTerrain()},this._updateStyleComponents(this.props)}),s.on("sourcedata",()=>{this._updateStyleComponents(this.props)});for(const l in St)s.on(l,this._onPointerEvent);for(const l in Pt)s.on(l,this._onCameraEvent);for(const l in Et)s.on(l,this._onEvent);this._map=s}recycle(){this.map.getContainer().querySelector("[mapboxgl-children]")?.remove(),de.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const t=this._map;t.style&&(t._frame&&(t._frame.cancel(),t._frame=null),t._render())}_updateSize(t){const{viewState:o}=t;if(o){const n=this._map;if(o.width!==n.transform.width||o.height!==n.transform.height)return n.resize(),!0}return!1}_updateViewState(t){const o=this._map,n=o.transform;if(!o.isMoving()){const i=Ct(n,t);if(Object.keys(i).length>0)return this._internalUpdate=!0,o.jumpTo(i),this._internalUpdate=!1,!0}return!1}_updateSettings(t,o){const n=this._map;let r=!1;for(const i of sn)i in t&&!j(t[i],o[i])&&(r=!0,n[`set${i[0].toUpperCase()}${i.slice(1)}`]?.call(n,t[i]));return r}_updateStyle(t,o){if(t.cursor!==o.cursor&&(this._map.getCanvas().style.cursor=t.cursor||""),t.mapStyle!==o.mapStyle){const{mapStyle:n=kt,styleDiffing:r=!0}=t,i={diff:r};"localIdeographFontFamily"in t&&(i.localIdeographFontFamily=t.localIdeographFontFamily),this._map.setStyle(Mt(n),i)}}_updateStyleComponents({light:t,projection:o,sky:n,terrain:r}){const i=this._map,s=this._styleComponents;i.style._loaded&&(t&&!j(t,s.light)&&(s.light=t,i.setLight(t)),o&&!j(o,s.projection)&&o!==s.projection?.type&&(s.projection=typeof o=="string"?{type:o}:o,i.setProjection?.(s.projection)),n&&!j(n,s.sky)&&(s.sky=n,i.setSky(n)),r!==void 0&&!j(r,s.terrain)&&(!r||i.getSource(r.source))&&(s.terrain=r,i.setTerrain(r)))}_updateHandlers(t,o){const n=this._map;for(const r of an){const i=t[r]??!0,s=o[r]??!0;j(i,s)||(i?n[r].enable(i):n[r].disable())}}_queryRenderedFeatures(t){const o=this._map,{interactiveLayerIds:n=[]}=this.props;try{return o.queryRenderedFeatures(t,{layers:n.filter(o.getLayer.bind(o))})}catch{return[]}}_updateHover(t){const{props:o}=this;if(o.interactiveLayerIds&&(o.onMouseMove||o.onMouseEnter||o.onMouseLeave)){const r=t.type,i=this._hoveredFeatures?.length>0,s=this._queryRenderedFeatures(t.point),l=s.length>0;!l&&i&&(t.type="mouseleave",this._onPointerEvent(t)),this._hoveredFeatures=s,l&&!i&&(t.type="mouseenter",this._onPointerEvent(t)),t.type=r}else this._hoveredFeatures=null}}de.savedMaps=[];const ln=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function cn(e){if(!e)return null;const t=e.map,o={getMap:()=>t};for(const n of un(t))!(n in o)&&!ln.includes(n)&&(o[n]=t[n].bind(t));return o}function un(e){const t=new Set;let o=e;for(;o;){for(const n of Object.getOwnPropertyNames(o))n[0]!=="_"&&typeof e[n]=="function"&&n!=="fire"&&n!=="setEventedParent"&&t.add(n);o=Object.getPrototypeOf(o)}return Array.from(t)}const dn=typeof document<"u"?c.useLayoutEffect:c.useEffect;function fn(e,t){const{RTLTextPlugin:o,maxParallelImageRequests:n,workerCount:r,workerUrl:i}=t;if(o&&e.getRTLTextPluginStatus&&e.getRTLTextPluginStatus()==="unavailable"){const{pluginUrl:s,lazy:l=!0}=typeof o=="string"?{pluginUrl:o}:o;e.setRTLTextPlugin(s,a=>{a&&console.error(a)},l)}n!==void 0&&e.setMaxParallelImageRequests(n),r!==void 0&&e.setWorkerCount(r),i!==void 0&&e.setWorkerUrl(i)}const oe=T.createContext(null);function mn(e,t){const o=c.useContext(wt),[n,r]=c.useState(null),i=c.useRef(),{current:s}=c.useRef({mapLib:null,map:null});c.useEffect(()=>{const d=e.mapLib;let f=!0,u;return Promise.resolve(d||import("maplibre-gl")).then(p=>{if(!f)return;if(!p)throw new Error("Invalid mapLib");const g="Map"in p?p:p.default;if(!g.Map)throw new Error("Invalid mapLib");fn(g,e),e.reuseMaps&&(u=de.reuse(e,i.current)),u||(u=new de(g.Map,e,i.current)),s.map=cn(u),s.mapLib=g,r(u),o?.onMapMount(s.map,e.id)}).catch(p=>{const{onError:g}=e;g?g({type:"error",target:null,originalEvent:null,error:p}):console.error(p)}),()=>{f=!1,u&&(o?.onMapUnmount(e.id),e.reuseMaps?u.recycle():u.destroy())}},[]),dn(()=>{n&&n.setProps(e)}),c.useImperativeHandle(t,()=>s.map,[n]);const l=c.useMemo(()=>({position:"relative",width:"100%",height:"100%",...e.style}),[e.style]),a={height:"100%"};return T.createElement("div",{id:e.id,ref:i,style:l},n&&T.createElement(oe.Provider,{value:s},T.createElement("div",{"mapboxgl-children":"",style:a},e.children)))}const pn=T.forwardRef(mn),gn=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function H(e,t){if(!e||!t)return;const o=e.style;for(const n in t){const r=t[n];Number.isFinite(r)&&!gn.test(n)?o[n]=`${r}px`:o[n]=r}}function Lt(e,t){if(e===t)return null;const o=Tt(e),n=Tt(t),r=[];for(const i of n)o.has(i)||r.push(i);for(const i of o)n.has(i)||r.push(i);return r.length===0?null:r}function Tt(e){return new Set(e?e.trim().split(/\s+/):[])}const zt=c.memo(c.forwardRef((e,t)=>{const{map:o,mapLib:n}=c.useContext(oe),r=c.useRef({props:e}),i=c.useMemo(()=>{let v=!1;T.Children.forEach(e.children,M=>{M&&(v=!0)});const E={...e,element:v?document.createElement("div"):void 0},_=new n.Marker(E);return _.setLngLat([e.longitude,e.latitude]),_.getElement().addEventListener("click",M=>{r.current.props.onClick?.({type:"click",target:_,originalEvent:M})}),_.on("dragstart",M=>{const k=M;k.lngLat=i.getLngLat(),r.current.props.onDragStart?.(k)}),_.on("drag",M=>{const k=M;k.lngLat=i.getLngLat(),r.current.props.onDrag?.(k)}),_.on("dragend",M=>{const k=M;k.lngLat=i.getLngLat(),r.current.props.onDragEnd?.(k)}),_},[]);c.useEffect(()=>(i.addTo(o.getMap()),()=>{i.remove()}),[]);const{longitude:s,latitude:l,offset:a,style:d,draggable:f=!1,popup:u=null,rotation:p=0,rotationAlignment:g="auto",pitchAlignment:y="auto"}=e;c.useEffect(()=>{H(i.getElement(),d)},[d]),c.useImperativeHandle(t,()=>i,[]);const b=r.current.props;(i.getLngLat().lng!==s||i.getLngLat().lat!==l)&&i.setLngLat([s,l]),a&&!nn(i.getOffset(),a)&&i.setOffset(a),i.isDraggable()!==f&&i.setDraggable(f),i.getRotation()!==p&&i.setRotation(p),i.getRotationAlignment()!==g&&i.setRotationAlignment(g),i.getPitchAlignment()!==y&&i.setPitchAlignment(y),i.getPopup()!==u&&i.setPopup(u);const h=Lt(b.className,e.className);if(h)for(const v of h)i.toggleClassName(v);return r.current.props=e,Se.createPortal(e.children,i.getElement())})),hn=c.memo(c.forwardRef((e,t)=>{const{map:o,mapLib:n}=c.useContext(oe),r=c.useMemo(()=>document.createElement("div"),[]),i=c.useRef({props:e}),s=c.useMemo(()=>{const l={...e},a=new n.Popup(l);return a.setLngLat([e.longitude,e.latitude]),a.once("open",d=>{i.current.props.onOpen?.(d)}),a},[]);if(c.useEffect(()=>{const l=a=>{i.current.props.onClose?.(a)};return s.on("close",l),s.setDOMContent(r).addTo(o.getMap()),()=>{s.off("close",l),s.isOpen()&&s.remove()}},[]),c.useEffect(()=>{H(s.getElement(),e.style)},[e.style]),c.useImperativeHandle(t,()=>s,[]),s.isOpen()){const l=i.current.props;(s.getLngLat().lng!==e.longitude||s.getLngLat().lat!==e.latitude)&&s.setLngLat([e.longitude,e.latitude]),e.offset&&!j(l.offset,e.offset)&&s.setOffset(e.offset),(l.anchor!==e.anchor||l.maxWidth!==e.maxWidth)&&(s.options.anchor=e.anchor,s.setMaxWidth(e.maxWidth));const a=Lt(l.className,e.className);if(a)for(const d of a)s.toggleClassName(d);i.current.props=e}return Se.createPortal(e.children,r)}));function ne(e,t,o,n){const r=c.useContext(oe),i=c.useMemo(()=>e(r),[]);return c.useEffect(()=>{const s=t,l=null,a=typeof t=="function"?t:null,{map:d}=r;return d.hasControl(i)||(d.addControl(i,s?.position),l&&l(r)),()=>{a&&a(r),d.hasControl(i)&&d.removeControl(i)}},[]),i}function yn(e){const t=ne(({mapLib:o})=>new o.AttributionControl(e),{position:e.position});return c.useEffect(()=>{H(t._container,e.style)},[e.style]),null}c.memo(yn);function bn(e){const t=ne(({mapLib:o})=>new o.FullscreenControl({container:e.containerId&&document.getElementById(e.containerId)}),{position:e.position});return c.useEffect(()=>{H(t._controlContainer,e.style)},[e.style]),null}c.memo(bn);function vn(e,t){const o=c.useRef({props:e}),n=ne(({mapLib:r})=>{const i=new r.GeolocateControl(e),s=i._setupUI;return i._setupUI=()=>{i._container.hasChildNodes()||s()},i.on("geolocate",l=>{o.current.props.onGeolocate?.(l)}),i.on("error",l=>{o.current.props.onError?.(l)}),i.on("outofmaxbounds",l=>{o.current.props.onOutOfMaxBounds?.(l)}),i.on("trackuserlocationstart",l=>{o.current.props.onTrackUserLocationStart?.(l)}),i.on("trackuserlocationend",l=>{o.current.props.onTrackUserLocationEnd?.(l)}),i},{position:e.position});return o.current.props=e,c.useImperativeHandle(t,()=>n,[]),c.useEffect(()=>{H(n._container,e.style)},[e.style]),null}c.memo(c.forwardRef(vn));function wn(e){const t=ne(({mapLib:o})=>new o.NavigationControl(e),{position:e.position});return c.useEffect(()=>{H(t._container,e.style)},[e.style]),null}const xn=c.memo(wn);function _n(e){const t=ne(({mapLib:i})=>new i.ScaleControl(e),{position:e.position}),o=c.useRef(e),n=o.current;o.current=e;const{style:r}=e;return e.maxWidth!==void 0&&e.maxWidth!==n.maxWidth&&(t.options.maxWidth=e.maxWidth),e.unit!==void 0&&e.unit!==n.unit&&t.setUnit(e.unit),c.useEffect(()=>{H(t._container,r)},[r]),null}c.memo(_n);function Cn(e){const t=ne(({mapLib:o})=>new o.TerrainControl(e),{position:e.position});return c.useEffect(()=>{H(t._container,e.style)},[e.style]),null}c.memo(Cn);function Mn(e){const t=ne(({mapLib:o})=>new o.LogoControl(e),{position:e.position});return c.useEffect(()=>{H(t._container,e.style)},[e.style]),null}c.memo(Mn);function Le(e,t){if(!e)throw new Error(t)}let kn=0;function Sn(e,t,o){if(e.style&&e.style._loaded){const n={...o};return delete n.id,delete n.children,e.addSource(t,n),e.getSource(t)}return null}function Pn(e,t,o){Le(t.id===o.id,"source id changed"),Le(t.type===o.type,"source type changed");let n="",r=0;for(const s in t)s!=="children"&&s!=="id"&&!j(o[s],t[s])&&(n=s,r++);if(!r)return;const i=t.type;if(i==="geojson")e.setData(t.data);else if(i==="image")e.updateImage({url:t.url,coordinates:t.coordinates});else switch(n){case"coordinates":e.setCoordinates?.(t.coordinates);break;case"url":e.setUrl?.(t.url);break;case"tiles":e.setTiles?.(t.tiles);break;default:console.warn(`Unable to update <Source> prop: ${n}`)}}function En(e){const t=c.useContext(oe).map.getMap(),o=c.useRef(e),[,n]=c.useState(0),r=c.useMemo(()=>e.id||`jsx-source-${kn++}`,[]);c.useEffect(()=>{if(t){const s=()=>setTimeout(()=>n(l=>l+1),0);return t.on("styledata",s),s(),()=>{if(t.off("styledata",s),t.style&&t.style._loaded&&t.getSource(r)){const l=t.getStyle()?.layers;if(l)for(const a of l)a.source===r&&t.removeLayer(a.id);t.removeSource(r)}}}},[t]);let i=t&&t.style&&t.getSource(r);return i?Pn(i,e,o.current):i=Sn(t,r,e),o.current=e,i&&T.Children.map(e.children,s=>s&&c.cloneElement(s,{source:r}))||null}function Ln(e,t,o,n){if(Le(o.id===n.id,"layer id changed"),Le(o.type===n.type,"layer type changed"),o.type==="custom"||n.type==="custom")return;const{layout:r={},paint:i={},filter:s,minzoom:l,maxzoom:a,beforeId:d}=o;if(d!==n.beforeId&&e.moveLayer(t,d),r!==n.layout){const f=n.layout||{};for(const u in r)j(r[u],f[u])||e.setLayoutProperty(t,u,r[u]);for(const u in f)r.hasOwnProperty(u)||e.setLayoutProperty(t,u,void 0)}if(i!==n.paint){const f=n.paint||{};for(const u in i)j(i[u],f[u])||e.setPaintProperty(t,u,i[u]);for(const u in f)i.hasOwnProperty(u)||e.setPaintProperty(t,u,void 0)}j(s,n.filter)||e.setFilter(t,s),(l!==n.minzoom||a!==n.maxzoom)&&e.setLayerZoomRange(t,l,a)}function Tn(e,t,o){if(e.style&&e.style._loaded&&(!("source"in o)||e.getSource(o.source))){const n={...o,id:t};delete n.beforeId,e.addLayer(n,o.beforeId)}}let zn=0;function At(e){const t=c.useContext(oe).map.getMap(),o=c.useRef(e),[,n]=c.useState(0),r=c.useMemo(()=>e.id||`jsx-layer-${zn++}`,[]);if(c.useEffect(()=>{if(t){const s=()=>n(l=>l+1);return t.on("styledata",s),s(),()=>{t.off("styledata",s),t.style&&t.style._loaded&&t.getLayer(r)&&t.removeLayer(r)}}},[t]),t&&t.style&&t.getLayer(r))try{Ln(t,r,e,o.current)}catch(s){console.warn(s)}else Tn(t,r,e);return o.current=e,null}function Ot(e,t,o){if(e!==null)for(var n,r,i,s,l,a,d,f=0,u=0,p,g=e.type,y=g==="FeatureCollection",b=g==="Feature",h=y?e.features.length:1,v=0;v<h;v++){d=y?e.features[v].geometry:b?e.geometry:e,p=d?d.type==="GeometryCollection":!1,l=p?d.geometries.length:1;for(var E=0;E<l;E++){var _=0,M=0;if(s=p?d.geometries[E]:d,s!==null){a=s.coordinates;var k=s.type;switch(f=0,k){case null:break;case"Point":if(t(a,u,v,_,M)===!1)return!1;u++,_++;break;case"LineString":case"MultiPoint":for(n=0;n<a.length;n++){if(t(a[n],u,v,_,M)===!1)return!1;u++,k==="MultiPoint"&&_++}k==="LineString"&&_++;break;case"Polygon":case"MultiLineString":for(n=0;n<a.length;n++){for(r=0;r<a[n].length-f;r++){if(t(a[n][r],u,v,_,M)===!1)return!1;u++}k==="MultiLineString"&&_++,k==="Polygon"&&M++}k==="Polygon"&&_++;break;case"MultiPolygon":for(n=0;n<a.length;n++){for(M=0,r=0;r<a[n].length;r++){for(i=0;i<a[n][r].length-f;i++){if(t(a[n][r][i],u,v,_,M)===!1)return!1;u++}M++}_++}break;case"GeometryCollection":for(n=0;n<s.geometries.length;n++)if(Ot(s.geometries[n],t)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function An(e,t={}){if(e.bbox!=null&&t.recompute!==!0)return e.bbox;const o=[1/0,1/0,-1/0,-1/0];return Ot(e,n=>{o[0]>n[0]&&(o[0]=n[0]),o[1]>n[1]&&(o[1]=n[1]),o[2]<n[0]&&(o[2]=n[0]),o[3]<n[1]&&(o[3]=n[1])}),o}var Ge=An;const On={en:{"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},fr:{"AttributionControl.ToggleAttribution":"Afficher/Masquer l’attribution","AttributionControl.MapFeedback":"Retour sur la carte","FullscreenControl.Enter":"Passer en plein écran","FullscreenControl.Exit":"Quitter le plein écran","GeolocateControl.FindMyLocation":"Trouver ma position","GeolocateControl.LocationNotAvailable":"Position non disponible","LogoControl.Title":"Logo MapLibre","Map.Title":"Carte","Marker.Title":"Marqueur de carte","NavigationControl.ResetBearing":"Réinitialiser l’orientation au nord","NavigationControl.ZoomIn":"Zoomer","NavigationControl.ZoomOut":"Dézoomer","Popup.Close":"Fermer la fenêtre","ScaleControl.Feet":"pi","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"mn","GlobeControl.Enable":"Activer le globe","GlobeControl.Disable":"Désactiver le globe","TerrainControl.Enable":"Activer le relief","TerrainControl.Disable":"Désactiver le relief","CooperativeGesturesHandler.WindowsHelpText":"Utilisez Ctrl + défilement pour zoomer sur la carte","CooperativeGesturesHandler.MacHelpText":"Utilisez ⌘ + défilement pour zoomer sur la carte","CooperativeGesturesHandler.MobileHelpText":"Utilisez deux doigts pour déplacer la carte"}},$n=()=>{const{current:e}=xt(),{centerPinMarkerPoints:t,markerPoints:o,locationBoundary:n,setZoom:r,mapPadding:i}=z(),[s,l]=c.useState(void 0),a=c.useRef(void 0),d=c.useCallback(()=>{e&&r(e.getZoom())},[e,r]);return c.useEffect(()=>(d(),e?.on("zoom",d),()=>{e?.off("zoom",d)}),[e,d]),c.useEffect(()=>{if(!e)return;const f=[];if(typeof n<"u"&&n.length>0?f.push(...n):typeof o<"u"&&o.length>0?(f.push(...o),t&&f.push(t)):t!==void 0&&f.push(t),f.length===0)return;const u=Ge(Ie(f));(!a.current||!u.every((p,g)=>p===a.current?.[g]))&&(a.current=u,l(u))},[e,o,n,t]),c.useEffect(()=>{if(!e||typeof s>"u")return;const[f,u,p,g]=s,y=(p-f)*.1||.001,b=(g-u)*.1||.001;e.fitBounds([[f-y,u-b],[p+y,g+b]],{padding:i,maxZoom:17,duration:700})},[e,s,i]),null};function Nn({children:e}){const{mapProvider:t,locale:o,center:n,zoom:r=F.zoom,minZoom:i,maxZoom:s,pitch:l=F.pitch,bearing:a=F.bearing,cooperativeGestures:d=F.cooperativeGestures,zoomPosition:f}=z();return t.name!=="maptiler"?null:m.jsxs(pn,{initialViewState:{...n,zoom:r,pitch:l,bearing:a},cooperativeGestures:d,minZoom:i,maxZoom:s,mapStyle:`https://api.maptiler.com/maps/${t.theme||be.maptiler}/style.json?key=${t.apiKey}`,locale:On[o],children:[m.jsx($n,{}),f&&m.jsx(xn,{position:f}),e]})}const Fn=Object.freeze(Object.defineProperty({__proto__:null,default:Nn},Symbol.toStringTag,{value:"Module"})),In={"top-left":Z.ControlPosition.LEFT_TOP,"top-right":Z.ControlPosition.RIGHT_TOP,"bottom-left":Z.ControlPosition.LEFT_BOTTOM,"bottom-right":Z.ControlPosition.RIGHT_BOTTOM},jn=({isMapLoaded:e})=>{const t=Z.useMap(),{centerPinMarkerPoints:o,markerPoints:n,locationBoundary:r,setZoom:i,mapPadding:s}=z(),[l,a]=c.useState(void 0),d=c.useRef(void 0),f=c.useCallback(()=>{if(!t)return;const u=t.getZoom();typeof u<"u"&&i(u+1)},[t,i]);return c.useEffect(()=>{f();const u=t?.addListener("zoom_changed",f);return()=>{u?.remove()}},[t,f]),c.useEffect(()=>{if(!t)return;const u=[];typeof r<"u"&&r.length>0?u.push(...r):typeof n<"u"&&n.length>0?(u.push(...n),o&&u.push(o)):o!==void 0&&u.push(o);const p=u.length===0?ue:Ge(Ie(u));(!d.current||!p.every((g,y)=>g===d.current?.[y]))&&(d.current=p,a(p))},[t,n,r,o]),c.useEffect(()=>{if(!t||typeof l>"u")return;const[u,p,g,y]=l,b=(g-u)*.1||.001,h=(y-p)*.1||.001;t.fitBounds({south:p-h,west:u-b,north:y+h,east:g+b},s)},[e,t,l,s]),null};function Zn({children:e}){const[t,o]=c.useState(!1),[n,r]=c.useState(!1),{mapProvider:i,mapPadding:s,locale:l,center:a,zoom:d=F.zoom,minZoom:f,maxZoom:u,pitch:p=F.pitch,bearing:g=F.bearing,cooperativeGestures:y=F.cooperativeGestures,zoomPosition:b}=z();if(c.useEffect(()=>{if(!n)return;const E=document.querySelector(".gm-style-moc");E&&s&&(E.style.paddingLeft=`${s.left}px`,E.style.paddingRight=`${s.right}px`)},[n,s?.left,s?.right]),i.name!=="google")return null;const h=()=>{o(!0)},v=()=>{r(!0)};return m.jsx(Z.APIProvider,{apiKey:i.apiKey,language:l,onLoad:h,children:t&&m.jsxs(m.Fragment,{children:[m.jsx(jn,{isMapLoaded:n}),m.jsx(Z.Map,{mapId:i.theme||be.google,defaultCenter:{lat:a.latitude,lng:a.longitude},defaultBounds:{north:ue[3],south:ue[1],east:ue[2],west:ue[0]},defaultZoom:d+1,defaultTilt:p,defaultHeading:g,gestureHandling:y?"cooperative":"greedy",streetViewControl:!1,fullscreenControl:!1,clickableIcons:!1,mapTypeControl:!1,zoomControlOptions:{position:b&&In[b]},minZoom:typeof f=="number"?f+1:void 0,maxZoom:typeof u=="number"?u+1:void 0,onTilesLoaded:v,children:e})]})})}const Bn=Object.freeze(Object.defineProperty({__proto__:null,default:Zn},Symbol.toStringTag,{value:"Module"})),$t=T.createContext(null);function Nt(){const e=c.useContext($t)?.maps,t=c.useContext(re);return c.useMemo(()=>({...e,current:t?.map}),[e,t])}function Un(e){return{longitude:e.center.lng,latitude:e.center.lat,zoom:e._seaLevelZoom??e.zoom,pitch:e.pitch,bearing:e.bearing,padding:e.padding,elevation:e._centerAltitude}}function Dn(e){return Number.isFinite(e.longitude)||Number.isFinite(e.latitude)||Number.isFinite(e.zoom)||Number.isFinite(e.pitch)||Number.isFinite(e.bearing)}function Gn(e,t){return!!(Number.isFinite(t.longitude)&&e.center.lng!==t.longitude||Number.isFinite(t.latitude)&&e.center.lat!==t.latitude||Number.isFinite(t.bearing)&&e.bearing!==t.bearing||Number.isFinite(t.pitch)&&e.pitch!==t.pitch||Number.isFinite(t.zoom)&&(e._seaLevelZoom??e.zoom)!==t.zoom||t.padding&&!e.isPaddingEqual(t.padding))}function Ft(){}function Hn(e,t){const o=e._constrain,n=e._calcMatrices;if(e._constrain=Ft,e._calcMatrices=Ft,Number.isFinite(t.bearing)&&(e.bearing=t.bearing),Number.isFinite(t.pitch)&&(e.pitch=t.pitch),t.padding&&!e.isPaddingEqual(t.padding)&&(e.padding=t.padding),Number.isFinite(t.longitude)||Number.isFinite(t.latitude)){const r=e.center;e._center=new r.constructor(t.longitude??r.lng,t.latitude??r.lat)}if(Number.isFinite(t.zoom))if(e._centerAltitude=t.elevation??0,e.elevation){e._seaLevelZoom=t.zoom;const r=e.pixelsPerMeter/e.worldSize*e._centerAltitude,i=e._mercatorZfromZoom(t.zoom),s=e._mercatorZfromZoom(e._maxZoom),l=Math.max(i-r,s);e._setZoom(e._zoomFromMercatorZ(l))}else e._seaLevelZoom=null,e.zoom=t.zoom;e._constrain=o,e._calcMatrices=n,e._unmodified||(e._constrain(),e._calcMatrices())}const Wn=new Set(["_calcMatrices","_calcFogMatrices","_updateCameraState","_updateSeaLevelZoom"]);function Vn(e){let t=!1,o={};const n=e;let r=null;const i={get(s,l){return l==="$reactViewState"?o:l==="$proposedTransform"?r:l==="$internalUpdate"?t:l==="_setZoom"?a=>{t&&r?.[l](a),Number.isFinite(o.zoom)||n[l](a)}:(t&&l==="_translateCameraConstrained"&&Dn(o)&&(r=r||n.clone()),Wn.has(l)?function(...a){r?.[l](...a),n[l](...a)}:t&&r?r[l]:n[l])},set(s,l,a){if(l==="$reactViewState")return o=a,Hn(n,o),!0;if(l==="$proposedTransform")return r=a,!0;if(l==="$internalUpdate")return t=a,!0;let d=a;return l==="center"||l==="_center"?(Number.isFinite(o.longitude)||Number.isFinite(o.latitude))&&(d=new a.constructor(o.longitude??a.lng,o.latitude??a.lat)):l==="zoom"||l==="_zoom"||l==="_seaLevelZoom"?Number.isFinite(o.zoom)&&(d=n[l]):l==="_centerAltitude"?Number.isFinite(o.elevation)&&(d=n[l]):l==="pitch"||l==="_pitch"?Number.isFinite(o.pitch)&&(d=n[l]):(l==="bearing"||l==="rotation"||l==="angle")&&Number.isFinite(o.bearing)&&(d=n[l]),t&&d!==a&&(r=r||n.clone()),t&&r&&(r[l]=a),n[l]=d,!0}};return new Proxy(e,i)}const qn=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function It(e){if(!e)return null;if(typeof e=="string"||("toJS"in e&&(e=e.toJS()),!e.layers))return e;const t={};for(const n of e.layers)t[n.id]=n;const o=e.layers.map(n=>{let r=null;"interactive"in n&&(r=Object.assign({},n),delete r.interactive);const i=t[n.ref];if(i){r=r||Object.assign({},n),delete r.ref;for(const s of qn)s in i&&(r[s]=i[s])}return r||n});return{...e,layers:o}}function Kn(e,t){const o=Array.isArray(e)?e[0]:e?e.x:0,n=Array.isArray(e)?e[1]:e?e.y:0,r=Array.isArray(t)?t[0]:t?t.x:0,i=Array.isArray(t)?t[1]:t?t.y:0;return o===r&&n===i}function U(e,t){if(e===t)return!0;if(!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let o=0;o<e.length;o++)if(!U(e[o],t[o]))return!1;return!0}else if(Array.isArray(t))return!1;if(typeof e=="object"&&typeof t=="object"){const o=Object.keys(e),n=Object.keys(t);if(o.length!==n.length)return!1;for(const r of o)if(!t.hasOwnProperty(r)||!U(e[r],t[r]))return!1;return!0}return!1}const jt={version:8,sources:{},layers:[]},Zt={mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",click:"onClick",dblclick:"onDblClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mouseout:"onMouseOut",contextmenu:"onContextMenu",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",touchcancel:"onTouchCancel"},Bt={movestart:"onMoveStart",move:"onMove",moveend:"onMoveEnd",dragstart:"onDragStart",drag:"onDrag",dragend:"onDragEnd",zoomstart:"onZoomStart",zoom:"onZoom",zoomend:"onZoomEnd",rotatestart:"onRotateStart",rotate:"onRotate",rotateend:"onRotateEnd",pitchstart:"onPitchStart",pitch:"onPitch",pitchend:"onPitchEnd"},Ut={wheel:"onWheel",boxzoomstart:"onBoxZoomStart",boxzoomend:"onBoxZoomEnd",boxzoomcancel:"onBoxZoomCancel",resize:"onResize",load:"onLoad",render:"onRender",idle:"onIdle",remove:"onRemove",data:"onData",styledata:"onStyleData",sourcedata:"onSourceData",error:"onError"},Jn=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],Yn=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"];class fe{constructor(t,o,n){this._map=null,this._internalUpdate=!1,this._inRender=!1,this._hoveredFeatures=null,this._deferredEvents={move:!1,zoom:!1,pitch:!1,rotate:!1},this._onEvent=r=>{const i=this.props[Ut[r.type]];i?i(r):r.type==="error"&&console.error(r.error)},this._onPointerEvent=r=>{(r.type==="mousemove"||r.type==="mouseout")&&this._updateHover(r);const i=this.props[Zt[r.type]];i&&(this.props.interactiveLayerIds&&r.type!=="mouseover"&&r.type!=="mouseout"&&(r.features=this._hoveredFeatures||this._queryRenderedFeatures(r.point)),i(r),delete r.features)},this._onCameraEvent=r=>{if(!this._internalUpdate){const i=this.props[Bt[r.type]],s=this._proxyTransform;i&&(r.viewState=Un(s.$proposedTransform??s),i(r)),r.type==="moveend"&&(s.$proposedTransform=null)}r.type in this._deferredEvents&&(this._deferredEvents[r.type]=!1)},this._MapClass=t,this.props=o,this._initialize(n)}get map(){return this._map}get transform(){return this._map.transform}setProps(t){const o=this.props;this.props=t;const n=this._updateSettings(t,o);n&&this._createProxyTransform(this._map);const r=this._updateSize(t),i=this._updateViewState(t,!0);this._updateStyle(t,o),this._updateStyleComponents(t,o),this._updateHandlers(t,o),(n||r||i&&!this._map.isMoving())&&this.redraw()}static reuse(t,o){const n=fe.savedMaps.pop();if(!n)return null;const r=n.map,i=r.getContainer();for(o.className=i.className;i.childNodes.length>0;)o.appendChild(i.childNodes[0]);r._container=o,n.setProps({...t,styleDiffing:!1}),r.resize();const{initialViewState:s}=t;return s&&(s.bounds?r.fitBounds(s.bounds,{...s.fitBoundsOptions,duration:0}):n._updateViewState(s,!1)),r.isStyleLoaded()?r.fire("load"):r.once("styledata",()=>r.fire("load")),r._update(),n}_initialize(t){const{props:o}=this,{mapStyle:n=jt}=o,r={...o,...o.initialViewState,accessToken:o.mapboxAccessToken||Qn()||null,container:t,style:It(n)},i=r.initialViewState||r.viewState||r;if(Object.assign(r,{center:[i.longitude||0,i.latitude||0],zoom:i.zoom||0,pitch:i.pitch||0,bearing:i.bearing||0}),o.gl){const u=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=u,o.gl)}const s=new this._MapClass(r);i.padding&&s.setPadding(i.padding),o.cursor&&(s.getCanvas().style.cursor=o.cursor),this._createProxyTransform(s);const l=s._render;s._render=u=>{this._inRender=!0,l.call(s,u),this._inRender=!1};const a=s._renderTaskQueue.run;s._renderTaskQueue.run=u=>{this._proxyTransform.$internalUpdate=!0,a.call(s._renderTaskQueue,u),this._proxyTransform.$internalUpdate=!1,this._fireDefferedEvents()};const d=s.jumpTo;s.jumpTo=(...u)=>(this._proxyTransform.$internalUpdate=!0,d.apply(s,u),this._proxyTransform.$internalUpdate=!1,s);const f=s.fire;s.fire=this._fireEvent.bind(this,f),s.on("styledata",()=>{this._updateStyleComponents(this.props,{})}),s.on("sourcedata",()=>{this._updateStyleComponents(this.props,{})});for(const u in Zt)s.on(u,this._onPointerEvent);for(const u in Bt)s.on(u,this._onCameraEvent);for(const u in Ut)s.on(u,this._onEvent);this._map=s}recycle(){this.map.getContainer().querySelector("[mapboxgl-children]")?.remove(),fe.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const t=this._map;!this._inRender&&t.style&&(t._frame&&(t._frame.cancel(),t._frame=null),t._render())}_createProxyTransform(t){const o=Vn(t.transform);t.transform=o,t.painter.transform=o,this._proxyTransform=o}_updateSize(t){const{viewState:o}=t;if(o){const n=this._map;if(o.width!==n.transform.width||o.height!==n.transform.height)return n.resize(),!0}return!1}_updateViewState(t,o){const n=t.viewState||t,r=this._proxyTransform,{zoom:i,pitch:s,bearing:l}=r,a=Gn(this._proxyTransform,n);if(r.$reactViewState=n,a&&o){const d=this._deferredEvents;d.move=!0,d.zoom||(d.zoom=i!==r.zoom),d.rotate||(d.rotate=l!==r.bearing),d.pitch||(d.pitch=s!==r.pitch)}return a}_updateSettings(t,o){const n=this._map;let r=!1;for(const i of Jn)i in t&&!U(t[i],o[i])&&(r=!0,n[`set${i[0].toUpperCase()}${i.slice(1)}`]?.call(n,t[i]));return r}_updateStyle(t,o){if(t.cursor!==o.cursor&&(this._map.getCanvas().style.cursor=t.cursor||""),t.mapStyle!==o.mapStyle){const{mapStyle:n=jt,styleDiffing:r=!0}=t,i={diff:r};return"localIdeographFontFamily"in t&&(i.localIdeographFontFamily=t.localIdeographFontFamily),this._map.setStyle(It(n),i),!0}return!1}_updateStyleComponents(t,o){const n=this._map;let r=!1;return n.isStyleLoaded()&&("light"in t&&n.setLight&&!U(t.light,o.light)&&(r=!0,n.setLight(t.light)),"fog"in t&&n.setFog&&!U(t.fog,o.fog)&&(r=!0,n.setFog(t.fog)),"terrain"in t&&n.setTerrain&&!U(t.terrain,o.terrain)&&(!t.terrain||n.getSource(t.terrain.source))&&(r=!0,n.setTerrain(t.terrain))),r}_updateHandlers(t,o){const n=this._map;let r=!1;for(const i of Yn){const s=t[i]??!0,l=o[i]??!0;U(s,l)||(r=!0,s?n[i].enable(s):n[i].disable())}return r}_queryRenderedFeatures(t){const o=this._map,{interactiveLayerIds:n=[]}=this.props;try{return o.queryRenderedFeatures(t,{layers:n.filter(o.getLayer.bind(o))})}catch{return[]}}_updateHover(t){const{props:o}=this;if(o.interactiveLayerIds&&(o.onMouseMove||o.onMouseEnter||o.onMouseLeave)){const r=t.type,i=this._hoveredFeatures?.length>0,s=this._queryRenderedFeatures(t.point),l=s.length>0;!l&&i&&(t.type="mouseleave",this._onPointerEvent(t)),this._hoveredFeatures=s,l&&!i&&(t.type="mouseenter",this._onPointerEvent(t)),t.type=r}else this._hoveredFeatures=null}_fireEvent(t,o,n){const r=this._map,i=this._proxyTransform,s=i.$internalUpdate;try{i.$internalUpdate=!1,t.call(r,o,n)}finally{i.$internalUpdate=s}return r}_fireDefferedEvents(){const t=this._map;this._internalUpdate=!0;for(const o in this._deferredEvents)this._deferredEvents[o]&&t.fire(o);this._internalUpdate=!1}}fe.savedMaps=[];function Qn(){let e=null;if(typeof location<"u"){const t=/access_token=([^&\/]*)/.exec(location.search);e=t&&t[1]}try{e=e||process.env.MapboxAccessToken}catch{}try{e=e||process.env.REACT_APP_MAPBOX_ACCESS_TOKEN}catch{}return e}const Xn=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function Rn(e){if(!e)return null;const t=e.map,o={getMap:()=>t,getCenter:()=>e.transform.center,getZoom:()=>e.transform.zoom,getBearing:()=>e.transform.bearing,getPitch:()=>e.transform.pitch,getPadding:()=>e.transform.padding,getBounds:()=>e.transform.getBounds(),project:n=>{const r=t.transform;t.transform=e.transform;const i=t.project(n);return t.transform=r,i},unproject:n=>{const r=t.transform;t.transform=e.transform;const i=t.unproject(n);return t.transform=r,i},queryTerrainElevation:(n,r)=>{const i=t.transform;t.transform=e.transform;const s=t.queryTerrainElevation(n,r);return t.transform=i,s},queryRenderedFeatures:(n,r)=>{const i=t.transform;t.transform=e.transform;const s=t.queryRenderedFeatures(n,r);return t.transform=i,s}};for(const n of er(t))!(n in o)&&!Xn.includes(n)&&(o[n]=t[n].bind(t));return o}function er(e){const t=new Set;let o=e;for(;o;){for(const n of Object.getOwnPropertyNames(o))n[0]!=="_"&&typeof e[n]=="function"&&n!=="fire"&&n!=="setEventedParent"&&t.add(n);o=Object.getPrototypeOf(o)}return Array.from(t)}const tr=typeof document<"u"?c.useLayoutEffect:c.useEffect,or=["baseApiUrl","maxParallelImageRequests","workerClass","workerCount","workerUrl"];function nr(e,t){for(const n of or)n in t&&(e[n]=t[n]);const{RTLTextPlugin:o="https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js"}=t;o&&e.getRTLTextPluginStatus&&e.getRTLTextPluginStatus()==="unavailable"&&e.setRTLTextPlugin(o,n=>{n&&console.error(n)},!0)}const re=T.createContext(null);function rr(e,t){const o=c.useContext($t),[n,r]=c.useState(null),i=c.useRef(),{current:s}=c.useRef({mapLib:null,map:null});c.useEffect(()=>{const d=e.mapLib;let f=!0,u;return Promise.resolve(d||import("mapbox-gl")).then(p=>{if(!f)return;if(!p)throw new Error("Invalid mapLib");const g="Map"in p?p:p.default;if(!g.Map)throw new Error("Invalid mapLib");nr(g,e),e.reuseMaps&&(u=fe.reuse(e,i.current)),u||(u=new fe(g.Map,e,i.current)),s.map=Rn(u),s.mapLib=g,r(u),o?.onMapMount(s.map,e.id)}).catch(p=>{const{onError:g}=e;g?g({type:"error",target:null,error:p}):console.error(p)}),()=>{f=!1,u&&(o?.onMapUnmount(e.id),e.reuseMaps?u.recycle():u.destroy())}},[]),tr(()=>{n&&n.setProps(e)}),c.useImperativeHandle(t,()=>s.map,[n]);const l=c.useMemo(()=>({position:"relative",width:"100%",height:"100%",...e.style}),[e.style]),a={height:"100%"};return T.createElement("div",{id:e.id,ref:i,style:l},n&&T.createElement(re.Provider,{value:s},T.createElement("div",{"mapboxgl-children":"",style:a},e.children)))}const ir=T.forwardRef(rr),sr=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function ie(e,t){if(!e||!t)return;const o=e.style;for(const n in t){const r=t[n];Number.isFinite(r)&&!sr.test(n)?o[n]=`${r}px`:o[n]=r}}function Dt(e,t){if(e===t)return null;const o=Gt(e),n=Gt(t),r=[];for(const i of n)o.has(i)||r.push(i);for(const i of o)n.has(i)||r.push(i);return r.length===0?null:r}function Gt(e){return new Set(e?e.trim().split(/\s+/):[])}const Ht=c.memo(c.forwardRef((e,t)=>{const{map:o,mapLib:n}=c.useContext(re),r=c.useRef({props:e}),i=c.useMemo(()=>{let v=!1;T.Children.forEach(e.children,M=>{M&&(v=!0)});const E={...e,element:v?document.createElement("div"):null},_=new n.Marker(E);return _.setLngLat([e.longitude,e.latitude]),_.getElement().addEventListener("click",M=>{r.current.props.onClick?.({type:"click",target:_,originalEvent:M})}),_.on("dragstart",M=>{const k=M;k.lngLat=i.getLngLat(),r.current.props.onDragStart?.(k)}),_.on("drag",M=>{const k=M;k.lngLat=i.getLngLat(),r.current.props.onDrag?.(k)}),_.on("dragend",M=>{const k=M;k.lngLat=i.getLngLat(),r.current.props.onDragEnd?.(k)}),_},[]);c.useEffect(()=>(i.addTo(o.getMap()),()=>{i.remove()}),[]);const{longitude:s,latitude:l,offset:a,style:d,draggable:f=!1,popup:u=null,rotation:p=0,rotationAlignment:g="auto",pitchAlignment:y="auto"}=e;c.useEffect(()=>{ie(i.getElement(),d)},[d]),c.useImperativeHandle(t,()=>i,[]);const b=r.current.props;(i.getLngLat().lng!==s||i.getLngLat().lat!==l)&&i.setLngLat([s,l]),a&&!Kn(i.getOffset(),a)&&i.setOffset(a),i.isDraggable()!==f&&i.setDraggable(f),i.getRotation()!==p&&i.setRotation(p),i.getRotationAlignment()!==g&&i.setRotationAlignment(g),i.getPitchAlignment()!==y&&i.setPitchAlignment(y),i.getPopup()!==u&&i.setPopup(u);const h=Dt(b.className,e.className);if(h)for(const v of h)i.toggleClassName(v);return r.current.props=e,Se.createPortal(e.children,i.getElement())})),ar=c.memo(c.forwardRef((e,t)=>{const{map:o,mapLib:n}=c.useContext(re),r=c.useMemo(()=>document.createElement("div"),[]),i=c.useRef({props:e}),s=c.useMemo(()=>{const l={...e},a=new n.Popup(l);return a.setLngLat([e.longitude,e.latitude]),a.once("open",d=>{i.current.props.onOpen?.(d)}),a},[]);if(c.useEffect(()=>{const l=a=>{i.current.props.onClose?.(a)};return s.on("close",l),s.setDOMContent(r).addTo(o.getMap()),()=>{s.off("close",l),s.isOpen()&&s.remove()}},[]),c.useEffect(()=>{ie(s.getElement(),e.style)},[e.style]),c.useImperativeHandle(t,()=>s,[]),s.isOpen()){const l=i.current.props;(s.getLngLat().lng!==e.longitude||s.getLngLat().lat!==e.latitude)&&s.setLngLat([e.longitude,e.latitude]),e.offset&&!U(l.offset,e.offset)&&(s.options.anchor=e.anchor,s.setOffset(e.offset)),(l.anchor!==e.anchor||l.maxWidth!==e.maxWidth)&&s.setMaxWidth(e.maxWidth);const a=Dt(l.className,e.className);if(a)for(const d of a)s.toggleClassName(d);i.current.props=e}return Se.createPortal(e.children,r)}));function Ce(e,t,o,n){const r=c.useContext(re),i=c.useMemo(()=>e(r),[]);return c.useEffect(()=>{const s=t,l=null,a=typeof t=="function"?t:null,{map:d}=r;return d.hasControl(i)||(d.addControl(i,s?.position),l&&l(r)),()=>{a&&a(r),d.hasControl(i)&&d.removeControl(i)}},[]),i}function lr(e){const t=Ce(({mapLib:o})=>new o.AttributionControl(e),{position:e.position});return c.useEffect(()=>{ie(t._container,e.style)},[e.style]),null}c.memo(lr);function cr(e){const t=Ce(({mapLib:o})=>new o.FullscreenControl({container:e.containerId&&document.getElementById(e.containerId)}),{position:e.position});return c.useEffect(()=>{ie(t._controlContainer,e.style)},[e.style]),null}c.memo(cr);function ur(e,t){const o=c.useRef({props:e}),n=Ce(({mapLib:r})=>{const i=new r.GeolocateControl(e),s=i._setupUI.bind(i);return i._setupUI=l=>{i._container.hasChildNodes()||s(l)},i.on("geolocate",l=>{o.current.props.onGeolocate?.(l)}),i.on("error",l=>{o.current.props.onError?.(l)}),i.on("outofmaxbounds",l=>{o.current.props.onOutOfMaxBounds?.(l)}),i.on("trackuserlocationstart",l=>{o.current.props.onTrackUserLocationStart?.(l)}),i.on("trackuserlocationend",l=>{o.current.props.onTrackUserLocationEnd?.(l)}),i},{position:e.position});return o.current.props=e,c.useImperativeHandle(t,()=>n,[]),c.useEffect(()=>{ie(n._container,e.style)},[e.style]),null}c.memo(c.forwardRef(ur));function dr(e){const t=Ce(({mapLib:o})=>new o.NavigationControl(e),{position:e.position});return c.useEffect(()=>{ie(t._container,e.style)},[e.style]),null}const fr=c.memo(dr);function mr(e){const t=Ce(({mapLib:i})=>new i.ScaleControl(e),{position:e.position}),o=c.useRef(e),n=o.current;o.current=e;const{style:r}=e;return e.maxWidth!==void 0&&e.maxWidth!==n.maxWidth&&(t.options.maxWidth=e.maxWidth),e.unit!==void 0&&e.unit!==n.unit&&t.setUnit(e.unit),c.useEffect(()=>{ie(t._container,r)},[r]),null}c.memo(mr);function Te(e,t){if(!e)throw new Error(t)}let pr=0;function gr(e,t,o){if(e.style&&e.style._loaded){const n={...o};return delete n.id,delete n.children,e.addSource(t,n),e.getSource(t)}return null}function hr(e,t,o){Te(t.id===o.id,"source id changed"),Te(t.type===o.type,"source type changed");let n="",r=0;for(const s in t)s!=="children"&&s!=="id"&&!U(o[s],t[s])&&(n=s,r++);if(!r)return;const i=t.type;i==="geojson"?e.setData(t.data):i==="image"?e.updateImage({url:t.url,coordinates:t.coordinates}):"setCoordinates"in e&&r===1&&n==="coordinates"?e.setCoordinates(t.coordinates):"setUrl"in e&&n==="url"?e.setUrl(t.url):"setTiles"in e&&n==="tiles"?e.setTiles(t.tiles):console.warn(`Unable to update <Source> prop: ${n}`)}function yr(e){const t=c.useContext(re).map.getMap(),o=c.useRef(e),[,n]=c.useState(0),r=c.useMemo(()=>e.id||`jsx-source-${pr++}`,[]);c.useEffect(()=>{if(t){const s=()=>setTimeout(()=>n(l=>l+1),0);return t.on("styledata",s),s(),()=>{if(t.off("styledata",s),t.style&&t.style._loaded&&t.getSource(r)){const l=t.getStyle()?.layers;if(l)for(const a of l)a.source===r&&t.removeLayer(a.id);t.removeSource(r)}}}},[t]);let i=t&&t.style&&t.getSource(r);return i?hr(i,e,o.current):i=gr(t,r,e),o.current=e,i&&T.Children.map(e.children,s=>s&&c.cloneElement(s,{source:r}))||null}function br(e,t,o,n){if(Te(o.id===n.id,"layer id changed"),Te(o.type===n.type,"layer type changed"),o.type==="custom"||n.type==="custom")return;const{layout:r={},paint:i={},filter:s,minzoom:l,maxzoom:a,beforeId:d}=o;if(d!==n.beforeId&&e.moveLayer(t,d),r!==n.layout){const f=n.layout||{};for(const u in r)U(r[u],f[u])||e.setLayoutProperty(t,u,r[u]);for(const u in f)r.hasOwnProperty(u)||e.setLayoutProperty(t,u,void 0)}if(i!==n.paint){const f=n.paint||{};for(const u in i)U(i[u],f[u])||e.setPaintProperty(t,u,i[u]);for(const u in f)i.hasOwnProperty(u)||e.setPaintProperty(t,u,void 0)}U(s,n.filter)||e.setFilter(t,s),(l!==n.minzoom||a!==n.maxzoom)&&e.setLayerZoomRange(t,l,a)}function vr(e,t,o){if(e.style&&e.style._loaded&&(!("source"in o)||e.getSource(o.source))){const n={...o,id:t};delete n.beforeId,e.addLayer(n,o.beforeId)}}let wr=0;function Wt(e){const t=c.useContext(re).map.getMap(),o=c.useRef(e),[,n]=c.useState(0),r=c.useMemo(()=>e.id||`jsx-layer-${wr++}`,[]);if(c.useEffect(()=>{if(t){const s=()=>n(l=>l+1);return t.on("styledata",s),s(),()=>{t.off("styledata",s),t.style&&t.style._loaded&&t.getLayer(r)&&t.removeLayer(r)}}},[t]),t&&t.style&&t.getLayer(r))try{br(t,r,e,o.current)}catch(s){console.warn(s)}else vr(t,r,e);return o.current=e,null}const xr={en:{"AttributionControl.ToggleAttribution":"Toggle attribution","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox homepage","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use ⌘ + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"},fr:{"AttributionControl.ToggleAttribution":"Afficher/Masquer l’attribution","FullscreenControl.Enter":"Passer en plein écran","FullscreenControl.Exit":"Quitter le plein écran","GeolocateControl.FindMyLocation":"Trouver ma position","GeolocateControl.LocationNotAvailable":"Position non disponible","LogoControl.Title":"Page d’accueil Mapbox","Map.Title":"Carte","NavigationControl.ResetBearing":"Réinitialiser l’orientation au nord","NavigationControl.ZoomIn":"Zoomer","NavigationControl.ZoomOut":"Dézoomer","ScrollZoomBlocker.CtrlMessage":"Utilisez ctrl + défilement pour zoomer sur la carte","ScrollZoomBlocker.CmdMessage":"Utilisez ⌘ + défilement pour zoomer sur la carte","TouchPanBlocker.Message":"Utilisez deux doigts pour déplacer la carte"}},_r=()=>{const{current:e}=Nt(),{centerPinMarkerPoints:t,markerPoints:o,locationBoundary:n,setZoom:r,mapPadding:i}=z(),[s,l]=c.useState(void 0),a=c.useRef(void 0),d=c.useCallback(()=>{e&&r(e.getZoom())},[e,r]);return c.useEffect(()=>(d(),e?.on("zoom",d),()=>{e?.off("zoom",d)}),[e,d]),c.useEffect(()=>{if(!e)return;const f=[];if(typeof n<"u"&&n.length>0?f.push(...n):typeof o<"u"&&o.length>0?(f.push(...o),t&&f.push(t)):t!==void 0&&f.push(t),f.length===0)return;const u=Ge(Ie(f));(!a.current||!u.every((p,g)=>p===a.current?.[g]))&&(a.current=u,l(u))},[e,o,n,t]),c.useEffect(()=>{if(!e||typeof s>"u")return;const[f,u,p,g]=s,y=(p-f)*.1||.001,b=(g-u)*.1||.001;e.fitBounds([[f-y,u-b],[p+y,g+b]],{retainPadding:!1,padding:i,maxZoom:17,duration:700})},[e,s,i]),null};function Cr({children:e}){const{mapProvider:t,locale:o,center:n,zoom:r=F.zoom,minZoom:i,maxZoom:s,pitch:l=F.pitch,bearing:a=F.bearing,cooperativeGestures:d=F.cooperativeGestures,zoomPosition:f}=z();return t.name!=="mapbox"?null:m.jsxs(ir,{mapboxAccessToken:t.apiKey,initialViewState:{...n,zoom:r,pitch:l,bearing:a},cooperativeGestures:d,minZoom:i,maxZoom:s,mapStyle:`mapbox://styles/${t.theme||be.mapbox}`,interactiveLayerIds:["road-label","waterway-label"],locale:xr[o],children:[m.jsx(_r,{}),f&&m.jsx(fr,{position:f}),e]})}const Mr=Object.freeze(Object.defineProperty({__proto__:null,default:Cr},Symbol.toStringTag,{value:"Module"})),kr=`
|
|
2
2
|
relative w-full h-full bg-gray-200 border-2 border-gray-400
|
|
3
3
|
flex flex-col overflow-hidden
|
|
4
4
|
`,Sr=`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/Map/Root/BaseMap/Google/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAWxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/Map/Root/BaseMap/Google/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAWxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AA8F7C;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE,YAAY,4BAqF/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/Map/Root/BaseMap/Mapbox/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAGxE,OAAO,8BAA8B,CAAC;AACtC,OAAO,cAAc,CAAC;AAQtB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/Map/Root/BaseMap/Mapbox/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAGxE,OAAO,8BAA8B,CAAC;AACtC,OAAO,cAAc,CAAC;AAQtB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AA8F7C,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE,YAAY,4BAuC/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/Map/Root/BaseMap/Maptiler/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAGxE,OAAO,kCAAkC,CAAC;AAC1C,OAAO,cAAc,CAAC;AAQtB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/Map/Root/BaseMap/Maptiler/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAGxE,OAAO,kCAAkC,CAAC;AAC1C,OAAO,cAAc,CAAC;AAQtB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AA0F7C,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAAE,QAAQ,EAAE,EAAE,YAAY,4BAqCjE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Map/Root/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAIzC,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Map/Root/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAIzC,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,qBA2BpC;AAED,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@local-logic/maps",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "This is a maps implementation allowing for the display of Local Logic data on a map.",
|
|
5
5
|
"author": "Local Logic",
|
|
6
6
|
"license": "ISC",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"tailwindcss": "^3.4.17",
|
|
101
101
|
"tsconfig": "workspace:*",
|
|
102
102
|
"typescript": "^5.9.2",
|
|
103
|
-
"vite": "^7.
|
|
103
|
+
"vite": "^7.3.2",
|
|
104
104
|
"vite-plugin-dts": "^4.5.4",
|
|
105
105
|
"vite-plugin-svgr": "^4.3.0",
|
|
106
106
|
"vitest": "^3.2.4"
|