@dartcom/ui-kit 10.2.27 → 10.2.31

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.
Files changed (46) hide show
  1. package/README.md +8 -1
  2. package/dist/components/layers/leaflet/index.d.ts +1 -0
  3. package/dist/components/layers/leaflet/index.d.ts.map +1 -1
  4. package/dist/components/layers/leaflet/leaflet.d.ts.map +1 -1
  5. package/dist/components/layers/leaflet/lib/hooks/useGetLeafletLayer.d.ts +6 -1
  6. package/dist/components/layers/leaflet/lib/hooks/useGetLeafletLayer.d.ts.map +1 -1
  7. package/dist/components/layers/leaflet/lib/types.d.ts +4 -3
  8. package/dist/components/layers/leaflet/lib/types.d.ts.map +1 -1
  9. package/dist/components/layers/leaflet/services/index.d.ts +2 -0
  10. package/dist/components/layers/leaflet/services/index.d.ts.map +1 -0
  11. package/dist/components/layers/leaflet/services/tangram-layer.d.ts +50 -0
  12. package/dist/components/layers/leaflet/services/tangram-layer.d.ts.map +1 -0
  13. package/dist/components/layers/map-container/index.d.ts +3 -0
  14. package/dist/components/layers/map-container/index.d.ts.map +1 -0
  15. package/dist/components/layers/map-container/lib/hooks/index.d.ts +3 -0
  16. package/dist/components/layers/map-container/lib/hooks/index.d.ts.map +1 -0
  17. package/dist/components/layers/map-container/lib/hooks/useMap.d.ts +2 -0
  18. package/dist/components/layers/map-container/lib/hooks/useMap.d.ts.map +1 -0
  19. package/dist/components/layers/map-container/lib/hooks/useMapEvents.d.ts +3 -0
  20. package/dist/components/layers/map-container/lib/hooks/useMapEvents.d.ts.map +1 -0
  21. package/dist/components/layers/map-container/lib/index.d.ts +3 -0
  22. package/dist/components/layers/map-container/lib/index.d.ts.map +1 -0
  23. package/dist/components/layers/map-container/lib/types.d.ts +5 -0
  24. package/dist/components/layers/map-container/lib/types.d.ts.map +1 -0
  25. package/dist/components/layers/map-container/map-container.d.ts +9 -0
  26. package/dist/components/layers/map-container/map-container.d.ts.map +1 -0
  27. package/dist/components/layers/map-container/types.d.ts +3 -0
  28. package/dist/components/layers/map-container/types.d.ts.map +1 -0
  29. package/dist/index.cjs +1514 -37
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.css +1 -0
  32. package/dist/index.esm.css +1 -0
  33. package/dist/index.esm.js +11 -5
  34. package/dist/index.esm.js.map +1 -1
  35. package/dist/library/leaflet-arrows.d.ts +3 -0
  36. package/dist/library/leaflet-arrows.d.ts.map +1 -0
  37. package/dist/library/leaflet-textpath.d.ts +1 -0
  38. package/dist/library/leaflet-textpath.d.ts.map +1 -0
  39. package/dist/providers/map/index.d.ts +2 -0
  40. package/dist/providers/map/index.d.ts.map +1 -0
  41. package/dist/providers/map/map.d.ts +4 -0
  42. package/dist/providers/map/map.d.ts.map +1 -0
  43. package/dist/providers/providers.d.ts.map +1 -1
  44. package/dist/services/storybook/decorators.d.ts +0 -1
  45. package/dist/services/storybook/decorators.d.ts.map +1 -1
  46. package/package.json +6 -1
package/dist/index.cjs CHANGED
@@ -41,6 +41,21 @@ function _interopNamespaceDefault(e) {
41
41
  return Object.freeze(n);
42
42
  }
43
43
 
44
+ function _mergeNamespaces(n, m) {
45
+ m.forEach(function (e) {
46
+ e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
47
+ if (k !== 'default' && !(k in n)) {
48
+ var d = Object.getOwnPropertyDescriptor(e, k);
49
+ Object.defineProperty(n, k, d.get ? d : {
50
+ enumerable: true,
51
+ get: function () { return e[k]; }
52
+ });
53
+ }
54
+ });
55
+ });
56
+ return Object.freeze(n);
57
+ }
58
+
44
59
  var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
45
60
 
46
61
  exports.Operations = void 0;
@@ -14633,10 +14648,11 @@ function requireLeafletSrc () {
14633
14648
  }
14634
14649
 
14635
14650
  var leafletSrcExports = requireLeafletSrc();
14651
+ var s$3 = /*@__PURE__*/getDefaultExportFromCjs(leafletSrcExports);
14636
14652
 
14637
- function r$1(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r$1(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx$1(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r$1(e))&&(n&&(n+=" "),n+=t);return n}
14653
+ function r$2(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r$2(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx$1(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r$2(e))&&(n&&(n+=" "),n+=t);return n}
14638
14654
 
14639
- let e$1={data:""},t=t=>{if("object"==typeof window){let e=(t?t.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return e.nonce=window.__nonce__,e.parentNode||(t||document.head).appendChild(e),e.firstChild}return t||e$1},l=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,a=/\/\*[^]*?\*\/| +/g,n$1=/\n+/g,o$2=(e,t)=>{let r="",l="",a="";for(let n in e){let c=e[n];"@"==n[0]?"i"==n[1]?r=n+" "+c+";":l+="f"==n[1]?o$2(c,n):n+"{"+o$2(c,"k"==n[1]?"":t)+"}":"object"==typeof c?l+=o$2(c,t?t.replace(/([^,])+/g,e=>n.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,t=>/&/.test(t)?t.replace(/&/g,e):e?e+" "+t:t)):n):null!=c&&(n=/^--/.test(n)?n:n.replace(/[A-Z]/g,"-$&").toLowerCase(),a+=o$2.p?o$2.p(n,c):n+":"+c+";");}return r+(t&&a?t+"{"+a+"}":a)+l},c$1={},s$2=e=>{if("object"==typeof e){let t="";for(let r in e)t+=r+s$2(e[r]);return t}return e},i$2=(e,t,r,i,p)=>{let u=s$2(e),d=c$1[u]||(c$1[u]=(e=>{let t=0,r=11;for(;t<e.length;)r=101*r+e.charCodeAt(t++)>>>0;return "go"+r})(u));if(!c$1[d]){let t=u!==e?e:(e=>{let t,r,o=[{}];for(;t=l.exec(e.replace(a,""));)t[4]?o.shift():t[3]?(r=t[3].replace(n$1," ").trim(),o.unshift(o[0][r]=o[0][r]||{})):o[0][t[1]]=t[2].replace(n$1," ").trim();return o[0]})(e);c$1[d]=o$2(p?{["@keyframes "+d]:t}:t,r?"":"."+d);}let f=r&&c$1.g?c$1.g:null;return r&&(c$1.g=c$1[d]),((e,t,r,l)=>{l?t.data=t.data.replace(l,e):-1===t.data.indexOf(e)&&(t.data=r?e+t.data:t.data+e);})(c$1[d],t,i,f),d},p=(e,t,r)=>e.reduce((e,l,a)=>{let n=t[a];if(n&&n.call){let e=n(r),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;n=t?"."+t:e&&"object"==typeof e?e.props?"":o$2(e,""):false===e?"":e;}return e+l+(null==n?"":n)},"");function u(e){let r=this||{},l=e.call?e(r.p):e;return i$2(l.unshift?l.raw?p(l,[].slice.call(arguments,1),r.p):l.reduce((e,t)=>Object.assign(e,t&&t.call?t(r.p):t),{}):l,t(r.target),r.g,r.o,r.k)}u.bind({g:1});u.bind({k:1});
14655
+ let e$1={data:""},t=t=>{if("object"==typeof window){let e=(t?t.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return e.nonce=window.__nonce__,e.parentNode||(t||document.head).appendChild(e),e.firstChild}return t||e$1},l$1=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,a=/\/\*[^]*?\*\/| +/g,n$1=/\n+/g,o$2=(e,t)=>{let r="",l="",a="";for(let n in e){let c=e[n];"@"==n[0]?"i"==n[1]?r=n+" "+c+";":l+="f"==n[1]?o$2(c,n):n+"{"+o$2(c,"k"==n[1]?"":t)+"}":"object"==typeof c?l+=o$2(c,t?t.replace(/([^,])+/g,e=>n.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,t=>/&/.test(t)?t.replace(/&/g,e):e?e+" "+t:t)):n):null!=c&&(n=/^--/.test(n)?n:n.replace(/[A-Z]/g,"-$&").toLowerCase(),a+=o$2.p?o$2.p(n,c):n+":"+c+";");}return r+(t&&a?t+"{"+a+"}":a)+l},c$1={},s$2=e=>{if("object"==typeof e){let t="";for(let r in e)t+=r+s$2(e[r]);return t}return e},i$2=(e,t,r,i,p)=>{let u=s$2(e),d=c$1[u]||(c$1[u]=(e=>{let t=0,r=11;for(;t<e.length;)r=101*r+e.charCodeAt(t++)>>>0;return "go"+r})(u));if(!c$1[d]){let t=u!==e?e:(e=>{let t,r,o=[{}];for(;t=l$1.exec(e.replace(a,""));)t[4]?o.shift():t[3]?(r=t[3].replace(n$1," ").trim(),o.unshift(o[0][r]=o[0][r]||{})):o[0][t[1]]=t[2].replace(n$1," ").trim();return o[0]})(e);c$1[d]=o$2(p?{["@keyframes "+d]:t}:t,r?"":"."+d);}let f=r&&c$1.g?c$1.g:null;return r&&(c$1.g=c$1[d]),((e,t,r,l)=>{l?t.data=t.data.replace(l,e):-1===t.data.indexOf(e)&&(t.data=r?e+t.data:t.data+e);})(c$1[d],t,i,f),d},p=(e,t,r)=>e.reduce((e,l,a)=>{let n=t[a];if(n&&n.call){let e=n(r),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;n=t?"."+t:e&&"object"==typeof e?e.props?"":o$2(e,""):false===e?"":e;}return e+l+(null==n?"":n)},"");function u(e){let r=this||{},l=e.call?e(r.p):e;return i$2(l.unshift?l.raw?p(l,[].slice.call(arguments,1),r.p):l.reduce((e,t)=>Object.assign(e,t&&t.call?t(r.p):t),{}):l,t(r.target),r.g,r.o,r.k)}u.bind({g:1});u.bind({k:1});
14640
14656
 
14641
14657
  function _defineProperties$1(target, props) {
14642
14658
  for (var i = 0; i < props.length; i++) {
@@ -26618,6 +26634,29 @@ const DartcomInitializeProvider = ({ children, configOptions }) => {
26618
26634
  return jsxRuntime.jsx(React__namespace.Fragment, { children: children });
26619
26635
  };
26620
26636
 
26637
+ const MapProvider = ({ children }) => {
26638
+ const [isReady, setIsReady] = React__namespace.useState(false);
26639
+ React__namespace.useEffect(() => {
26640
+ Promise.all([
26641
+ Promise.resolve().then(function () { return tangram_min; }),
26642
+ Promise.resolve().then(function () { return leaflet_rotatedMarker; }),
26643
+ Promise.resolve().then(function () { return leaflet_polylineoffset$1; }),
26644
+ Promise.resolve().then(function () { return index$1; }),
26645
+ Promise.resolve().then(function () { return index; }),
26646
+ Promise.resolve().then(function () { return leafletArrows$1; }),
26647
+ ])
26648
+ .then(() => {
26649
+ setIsReady(true);
26650
+ })
26651
+ .catch(() => {
26652
+ setIsReady(false);
26653
+ });
26654
+ }, []);
26655
+ if (!isReady)
26656
+ return null;
26657
+ return jsxRuntime.jsx(React__namespace.Fragment, { children: children });
26658
+ };
26659
+
26621
26660
  const queryClient = new QueryClient();
26622
26661
  const QueryProvider = (props) => (jsxRuntime.jsx(QueryClientProvider, { ...props, client: queryClient }));
26623
26662
 
@@ -26627,7 +26666,7 @@ const DartcomThemeProvider = ({ children, themeOptions }) => {
26627
26666
  };
26628
26667
 
26629
26668
  const DartcomProviders = ({ children, configOptions, themeOptions }) => {
26630
- return (jsxRuntime.jsx(SnackbarProvider, { children: jsxRuntime.jsx(QueryProvider, { children: jsxRuntime.jsx(DartcomMobxProvider, { children: jsxRuntime.jsx(DartcomThemeProvider, { themeOptions: themeOptions, children: jsxRuntime.jsx(Provider, { children: jsxRuntime.jsx(DartcomInitializeProvider, { configOptions: configOptions, children: children }) }) }) }) }) }));
26669
+ return (jsxRuntime.jsx(SnackbarProvider, { children: jsxRuntime.jsx(QueryProvider, { children: jsxRuntime.jsx(DartcomMobxProvider, { children: jsxRuntime.jsx(DartcomThemeProvider, { themeOptions: themeOptions, children: jsxRuntime.jsx(Provider, { children: jsxRuntime.jsx(MapProvider, { children: jsxRuntime.jsx(DartcomInitializeProvider, { configOptions: configOptions, children: children }) }) }) }) }) }) }));
26631
26670
  };
26632
26671
 
26633
26672
  const useShowSnackbar = () => {
@@ -43475,43 +43514,31 @@ const getLayerModalsNames = (layer) => {
43475
43514
 
43476
43515
  const useGetLeafletLayer = ({ eventHandlers, defaultLayers, }) => {
43477
43516
  const [layer, setLayer] = React__namespace.useState(null);
43478
- const [map, setMap] = React__namespace.useState(null);
43479
43517
  const [config, setConfig] = React__namespace.useState(null);
43518
+ const [isReady, setIsReady] = React__namespace.useState(false);
43480
43519
  const scene = React__namespace.useMemo(() => {
43481
43520
  if (layer === null)
43482
43521
  return null;
43483
43522
  const { scene } = layer;
43484
43523
  return scene;
43485
43524
  }, [layer]);
43486
- const toggleWheelZoom = React__namespace.useCallback((enable) => {
43487
- if (map && layer) {
43488
- const container = layer.getContainer();
43489
- if (enable) {
43490
- map.scrollWheelZoom.enable();
43491
- }
43492
- else {
43493
- map.scrollWheelZoom.disable();
43494
- }
43495
- container.style.pointerEvents = enable ? 'auto' : 'none';
43496
- }
43497
- }, [map, layer]);
43498
43525
  const getLeafletLayer = React__namespace.useCallback(() => {
43499
43526
  Promise.resolve().then(function () { return tangram_min; }).then(() => {
43500
43527
  if (window.Tangram) {
43501
43528
  const leafletLayer = window.Tangram.leafletLayer({
43502
43529
  scene: data,
43503
- modifyScrollWheel: true,
43530
+ modifyScrollWheel: false,
43504
43531
  modifyZoomBehavior: false,
43505
43532
  });
43506
43533
  const { scene } = leafletLayer;
43507
43534
  scene.subscribe({
43508
43535
  load: ({ config }) => {
43509
43536
  setConfig(config);
43537
+ setIsReady(true);
43510
43538
  },
43511
43539
  });
43512
43540
  leafletLayer.on('load', ({ sourceTarget }) => {
43513
- const map = sourceTarget._map;
43514
- const container = leafletLayer.getContainer();
43541
+ const mapInstance = sourceTarget._map;
43515
43542
  leafletLayer.setSelectionEvents({
43516
43543
  click: ({ feature, leaflet_event }) => {
43517
43544
  if (feature) {
@@ -43523,7 +43550,7 @@ const useGetLeafletLayer = ({ eventHandlers, defaultLayers, }) => {
43523
43550
  }
43524
43551
  },
43525
43552
  hover: ({ feature, leaflet_event }) => {
43526
- const mapContainer = map.getContainer();
43553
+ const mapContainer = mapInstance.getContainer();
43527
43554
  if (feature) {
43528
43555
  const { source_layer, properties } = feature;
43529
43556
  mapContainer.style.cursor = 'pointer';
@@ -43537,9 +43564,6 @@ const useGetLeafletLayer = ({ eventHandlers, defaultLayers, }) => {
43537
43564
  }
43538
43565
  },
43539
43566
  });
43540
- map.scrollWheelZoom.enable();
43541
- container.style.pointerEvents = 'auto';
43542
- setMap(map);
43543
43567
  });
43544
43568
  setLayer(leafletLayer);
43545
43569
  }
@@ -43731,10 +43755,10 @@ const useGetLeafletLayer = ({ eventHandlers, defaultLayers, }) => {
43731
43755
  Object.values(exports.TangramSourceNames).forEach(addSource);
43732
43756
  }, [addStyle, addSource]);
43733
43757
  React__namespace.useEffect(() => {
43734
- if (defaultLayers) {
43758
+ if (defaultLayers && isReady) {
43735
43759
  defaultLayers.map(addLayer);
43736
43760
  }
43737
- }, [defaultLayers, addLayer]);
43761
+ }, [defaultLayers, addLayer, isReady]);
43738
43762
  return {
43739
43763
  layer,
43740
43764
  scene,
@@ -43751,10 +43775,15 @@ const useGetLeafletLayer = ({ eventHandlers, defaultLayers, }) => {
43751
43775
  getSources,
43752
43776
  getLayers,
43753
43777
  removeLayers,
43754
- toggleWheelZoom,
43755
43778
  };
43756
43779
  };
43757
43780
 
43781
+ function extendContext(source, extra) {
43782
+ return Object.freeze({
43783
+ ...source,
43784
+ ...extra
43785
+ });
43786
+ }
43758
43787
  const LeafletContext = React.createContext(null);
43759
43788
  function useLeafletContext() {
43760
43789
  const context = React.use(LeafletContext);
@@ -43764,21 +43793,442 @@ function useLeafletContext() {
43764
43793
  return context;
43765
43794
  }
43766
43795
 
43796
+ function createContainerComponent(useElement) {
43797
+ function ContainerComponent(props, forwardedRef) {
43798
+ const { instance, context } = useElement(props).current;
43799
+ React.useImperativeHandle(forwardedRef, ()=>instance);
43800
+ const { children } = props;
43801
+ return children == null ? null : /*#__PURE__*/ React.createElement(LeafletContext, {
43802
+ value: context
43803
+ }, children);
43804
+ }
43805
+ return /*#__PURE__*/ React.forwardRef(ContainerComponent);
43806
+ }
43807
+
43808
+ function createControlHook(useElement) {
43809
+ return function useLeafletControl(props) {
43810
+ const context = useLeafletContext();
43811
+ const elementRef = useElement(props, context);
43812
+ const { instance } = elementRef.current;
43813
+ const positionRef = React.useRef(props.position);
43814
+ const { position } = props;
43815
+ React.useEffect(function addControl() {
43816
+ instance.addTo(context.map);
43817
+ return function removeControl() {
43818
+ instance.remove();
43819
+ };
43820
+ }, [
43821
+ context.map,
43822
+ instance
43823
+ ]);
43824
+ React.useEffect(function updateControl() {
43825
+ if (position != null && position !== positionRef.current) {
43826
+ instance.setPosition(position);
43827
+ positionRef.current = position;
43828
+ }
43829
+ }, [
43830
+ instance,
43831
+ position
43832
+ ]);
43833
+ return elementRef;
43834
+ };
43835
+ }
43836
+
43837
+ function createElementObject(instance, context, container) {
43838
+ return Object.freeze({
43839
+ instance,
43840
+ context,
43841
+ container
43842
+ });
43843
+ }
43844
+ function createElementHook(createElement, updateElement) {
43845
+ if (updateElement == null) {
43846
+ return function useImmutableLeafletElement(props, context) {
43847
+ const elementRef = React.useRef(undefined);
43848
+ if (!elementRef.current) elementRef.current = createElement(props, context);
43849
+ return elementRef;
43850
+ };
43851
+ }
43852
+ return function useMutableLeafletElement(props, context) {
43853
+ const elementRef = React.useRef(undefined);
43854
+ if (!elementRef.current) elementRef.current = createElement(props, context);
43855
+ const propsRef = React.useRef(props);
43856
+ const { instance } = elementRef.current;
43857
+ React.useEffect(function updateElementProps() {
43858
+ if (propsRef.current !== props) {
43859
+ updateElement(instance, props, propsRef.current);
43860
+ propsRef.current = props;
43861
+ }
43862
+ }, [
43863
+ instance,
43864
+ props,
43865
+ updateElement
43866
+ ]);
43867
+ return elementRef;
43868
+ };
43869
+ }
43870
+
43767
43871
  function useMap() {
43768
43872
  return useLeafletContext().map;
43769
43873
  }
43770
43874
 
43875
+ const useLayersControlElement = createElementHook(function createLayersControl({ children: _c, ...options }, ctx) {
43876
+ const control = new leafletSrcExports.Control.Layers(undefined, undefined, options);
43877
+ return createElementObject(control, extendContext(ctx, {
43878
+ layersControl: control
43879
+ }));
43880
+ }, function updateLayersControl(control, props, prevProps) {
43881
+ if (props.collapsed !== prevProps.collapsed) {
43882
+ if (props.collapsed === true) {
43883
+ control.collapse();
43884
+ } else {
43885
+ control.expand();
43886
+ }
43887
+ }
43888
+ });
43889
+ const useLayersControl = createControlHook(useLayersControlElement);
43890
+ // @ts-ignore
43891
+ const LayersControl = createContainerComponent(useLayersControl);
43892
+ function createControlledLayer(addLayerToControl) {
43893
+ return function ControlledLayer(props) {
43894
+ const parentContext = useLeafletContext();
43895
+ const propsRef = React.useRef(props);
43896
+ const [layer, setLayer] = React.useState(null);
43897
+ const { layersControl, map } = parentContext;
43898
+ const addLayer = React.useCallback((layerToAdd)=>{
43899
+ if (layersControl != null) {
43900
+ if (propsRef.current.checked) {
43901
+ map.addLayer(layerToAdd);
43902
+ }
43903
+ addLayerToControl(layersControl, layerToAdd, propsRef.current.name);
43904
+ setLayer(layerToAdd);
43905
+ }
43906
+ }, [
43907
+ addLayerToControl,
43908
+ layersControl,
43909
+ map
43910
+ ]);
43911
+ const removeLayer = React.useCallback((layerToRemove)=>{
43912
+ layersControl?.removeLayer(layerToRemove);
43913
+ setLayer(null);
43914
+ }, [
43915
+ layersControl
43916
+ ]);
43917
+ const context = React.useMemo(()=>{
43918
+ return extendContext(parentContext, {
43919
+ layerContainer: {
43920
+ addLayer,
43921
+ removeLayer
43922
+ }
43923
+ });
43924
+ }, [
43925
+ parentContext,
43926
+ addLayer,
43927
+ removeLayer
43928
+ ]);
43929
+ React.useEffect(()=>{
43930
+ if (layer !== null && propsRef.current !== props) {
43931
+ if (props.checked === true && (propsRef.current.checked == null || propsRef.current.checked === false)) {
43932
+ map.addLayer(layer);
43933
+ } else if (propsRef.current.checked === true && (props.checked == null || props.checked === false)) {
43934
+ map.removeLayer(layer);
43935
+ }
43936
+ propsRef.current = props;
43937
+ }
43938
+ });
43939
+ return props.children ? /*#__PURE__*/ React.createElement(LeafletContext, {
43940
+ value: context
43941
+ }, props.children) : null;
43942
+ };
43943
+ }
43944
+ LayersControl.BaseLayer = createControlledLayer(function addBaseLayer(layersControl, layer, name) {
43945
+ layersControl.addBaseLayer(layer, name);
43946
+ });
43947
+ LayersControl.Overlay = createControlledLayer(function addOverlay(layersControl, layer, name) {
43948
+ layersControl.addOverlay(layer, name);
43949
+ });
43950
+
43951
+ class TangramLayer {
43952
+ props;
43953
+ constructor(props) {
43954
+ this.props = props;
43955
+ if (GlobalConfig.instance.isValidApiKey) {
43956
+ const layer = this._createLayer();
43957
+ if (layer) {
43958
+ const { scene } = layer;
43959
+ scene.subscribe({
43960
+ load: ({ config }) => {
43961
+ this.config = config;
43962
+ this.isReady = true;
43963
+ this._init();
43964
+ },
43965
+ });
43966
+ this.layer = layer;
43967
+ this._addHandlers();
43968
+ this.props.onCreate({ layer });
43969
+ }
43970
+ }
43971
+ }
43972
+ _createLayer() {
43973
+ if (window.Tangram) {
43974
+ const leafletLayer = window.Tangram.leafletLayer({
43975
+ scene: data,
43976
+ });
43977
+ return leafletLayer;
43978
+ }
43979
+ }
43980
+ _addHandlers() {
43981
+ if (this.layer) {
43982
+ this.layer.addEventListener('load', (event) => {
43983
+ const { sourceTarget } = event;
43984
+ const mapInstance = sourceTarget._map;
43985
+ if (this.layer) {
43986
+ this.layer.setSelectionEvents({
43987
+ click: ({ feature, leaflet_event }) => {
43988
+ if (feature) {
43989
+ const { source_layer, properties } = feature;
43990
+ this.props.eventHandlers?.[source_layer]?.click?.({
43991
+ leaflet_event,
43992
+ properties,
43993
+ });
43994
+ }
43995
+ },
43996
+ hover: ({ feature, leaflet_event }) => {
43997
+ const mapContainer = mapInstance.getContainer();
43998
+ if (feature) {
43999
+ const { source_layer, properties } = feature;
44000
+ mapContainer.style.cursor = 'pointer';
44001
+ this.props.eventHandlers?.[source_layer]?.hover?.({
44002
+ leaflet_event,
44003
+ properties,
44004
+ });
44005
+ }
44006
+ else {
44007
+ mapContainer.style.cursor = 'default';
44008
+ }
44009
+ },
44010
+ });
44011
+ }
44012
+ });
44013
+ }
44014
+ }
44015
+ removeLayer() {
44016
+ if (this.layer) {
44017
+ this.layer.clearAllEventListeners();
44018
+ this.layer.remove();
44019
+ }
44020
+ this.layer = null;
44021
+ }
44022
+ _init() {
44023
+ this.addStyle({
44024
+ name: 'zebra_crossing',
44025
+ style: {
44026
+ base: 'polygons',
44027
+ lighting: false,
44028
+ shaders: {
44029
+ attributes: {
44030
+ a_angle: {
44031
+ type: 'float',
44032
+ default: 0.0,
44033
+ },
44034
+ },
44035
+ uniforms: {
44036
+ u_stripe_width: 1,
44037
+ },
44038
+ blocks: {
44039
+ filter: `
44040
+ vec3 pos = worldPosition().xyz;
44041
+
44042
+ float ang = radians(a_angle);
44043
+
44044
+ vec2 dir = vec2(sin(ang), cos(ang));
44045
+
44046
+ float positionAlongLine = dot(pos.xy, dir);
44047
+
44048
+ float stripe = step(1.0, mod(positionAlongLine / u_stripe_width, 2.0));
44049
+
44050
+ color.rgb = mix(vec3(1.0, 1.0, 1.0), vec3(1.0, 0.8, 0.0), stripe);
44051
+
44052
+ color.a = 1.0;
44053
+ `,
44054
+ },
44055
+ },
44056
+ },
44057
+ });
44058
+ const layers = this.props.defaultLayers ?? [];
44059
+ layers.forEach((layer) => {
44060
+ this.addLayer(layer);
44061
+ });
44062
+ Object.values(exports.TangramSourceNames).forEach((source) => {
44063
+ this.addSource(source);
44064
+ });
44065
+ }
44066
+ _layer = null;
44067
+ get layer() {
44068
+ return this._layer;
44069
+ }
44070
+ set layer(value) {
44071
+ this._layer = value;
44072
+ }
44073
+ _config = null;
44074
+ get config() {
44075
+ return this._config;
44076
+ }
44077
+ set config(value) {
44078
+ this._config = value;
44079
+ }
44080
+ _isReady = false;
44081
+ get isReady() {
44082
+ return this._isReady;
44083
+ }
44084
+ set isReady(value) {
44085
+ this._isReady = value;
44086
+ }
44087
+ get scene() {
44088
+ if (this.layer === null)
44089
+ return null;
44090
+ const { scene } = this.layer;
44091
+ return scene;
44092
+ }
44093
+ addStyle({ name, style }) {
44094
+ if (this.config && this.scene) {
44095
+ this.config.styles[name] = structuredClone(style);
44096
+ this.scene.updateConfig({ rebuild: true });
44097
+ }
44098
+ }
44099
+ addSource(sourceName) {
44100
+ if (this.config && this.scene) {
44101
+ const url = sourceUrl[sourceName];
44102
+ this.config.sources[sourceName] = {
44103
+ tile_size,
44104
+ url,
44105
+ type: 'MVT',
44106
+ };
44107
+ this.scene.updateConfig({ rebuild: true });
44108
+ }
44109
+ }
44110
+ deleteSource(sourceName) {
44111
+ if (this.config && this.scene) {
44112
+ delete this.config.sources[sourceName];
44113
+ this.scene.updateConfig({ rebuild: true });
44114
+ }
44115
+ }
44116
+ getSource(sourceName) {
44117
+ let source = null;
44118
+ if (this.config) {
44119
+ source = structuredClone(this.config.sources[sourceName]);
44120
+ }
44121
+ return source;
44122
+ }
44123
+ updateSource(sourceName, newUrl) {
44124
+ if (this.config && this.scene) {
44125
+ this.config.sources[sourceName].url = newUrl;
44126
+ this.scene.updateConfig({ rebuild: true });
44127
+ }
44128
+ }
44129
+ reloadSource(sourceName) {
44130
+ this.deleteSource(sourceName);
44131
+ this.addSource(sourceName);
44132
+ }
44133
+ addLayer(layer) {
44134
+ if (this.config && this.scene) {
44135
+ const order = this.getLayers().length + 1;
44136
+ const validLayer = getValidLayer({
44137
+ layer,
44138
+ order,
44139
+ eventHandlers: this.props.eventHandlers,
44140
+ });
44141
+ const layerName = getLayerName(validLayer);
44142
+ const { sublayers, draw, textures } = validLayer;
44143
+ if (draw) {
44144
+ const { styles = {} } = draw;
44145
+ if (styles) {
44146
+ validLayer.draw = {
44147
+ ...structuredClone(validLayer.draw),
44148
+ ...structuredClone(styles),
44149
+ };
44150
+ }
44151
+ }
44152
+ this.config.layers[layerName] = {
44153
+ ...structuredClone(validLayer),
44154
+ ...structuredClone(sublayers),
44155
+ };
44156
+ this.config.textures = {
44157
+ ...structuredClone(this.config.textures),
44158
+ ...structuredClone(textures),
44159
+ };
44160
+ this.scene.updateConfig({ rebuild: true });
44161
+ }
44162
+ }
44163
+ deleteLayers() {
44164
+ if (this.config) {
44165
+ const { layers } = this.config;
44166
+ Object.values(layers).forEach((layer) => {
44167
+ this.deleteLayer(layer);
44168
+ });
44169
+ }
44170
+ }
44171
+ deleteLayer(layer) {
44172
+ const layerName = getLayerName(layer);
44173
+ if (this.config && this.scene) {
44174
+ delete this.config.layers[layerName];
44175
+ this.scene.updateConfig({ rebuild: true });
44176
+ }
44177
+ }
44178
+ getLayers() {
44179
+ const layers = [];
44180
+ if (this.config) {
44181
+ layers.push(...Object.keys(this.config.layers));
44182
+ }
44183
+ return layers;
44184
+ }
44185
+ getLayerVisibility(layer) {
44186
+ let layerVisibility = true;
44187
+ const layerName = getLayerName(layer);
44188
+ if (this.config) {
44189
+ const { visible = true } = this.config.layers[layerName];
44190
+ layerVisibility = visible;
44191
+ }
44192
+ return layerVisibility;
44193
+ }
44194
+ toggleLayerVisibility({ layer, visible, }) {
44195
+ const layerName = getLayerName(layer);
44196
+ if (this.config && this.scene) {
44197
+ this.config.layers[layerName].visible = visible;
44198
+ this.scene.updateConfig({ rebuild: true });
44199
+ }
44200
+ }
44201
+ }
44202
+
43771
44203
  const LeafletLayer = ({ layers }) => {
44204
+ const controlRef = React__namespace.useRef(null);
43772
44205
  const map = useMap();
43773
- const { layer } = useGetLeafletLayer({
43774
- defaultLayers: layers,
43775
- });
43776
44206
  React__namespace.useEffect(() => {
43777
- if (layer) {
43778
- map.addLayer(layer);
43779
- }
43780
- }, [layer]);
43781
- return null;
44207
+ const googleSatelliteLayer = leafletSrcExports.tileLayer('http://{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}', {
44208
+ minZoom: 2,
44209
+ maxZoom: 25,
44210
+ maxNativeZoom: 19,
44211
+ subdomains: ['mt0', 'mt1', 'mt2', 'mt3'],
44212
+ });
44213
+ new TangramLayer({
44214
+ defaultLayers: layers,
44215
+ onCreate: ({ layer }) => {
44216
+ const { current: layersControl } = controlRef;
44217
+ if (layer && layersControl) {
44218
+ layersControl.addBaseLayer(layer, 'Dartcom');
44219
+ layersControl.addBaseLayer(googleSatelliteLayer, 'Google Satellite');
44220
+ layer.addTo(map);
44221
+ }
44222
+ },
44223
+ onDelete: ({ layer }) => {
44224
+ const { current: layersControl } = controlRef;
44225
+ if (layersControl) {
44226
+ map.removeLayer(layer);
44227
+ }
44228
+ },
44229
+ });
44230
+ }, []);
44231
+ return jsxRuntime.jsx(LayersControl, { ref: controlRef, position: "bottomleft" });
43782
44232
  };
43783
44233
 
43784
44234
  const modalStyle = {
@@ -43883,10 +44333,10 @@ function requirePapaparse_min () {
43883
44333
  var papaparse_minExports = requirePapaparse_min();
43884
44334
  var e = /*@__PURE__*/getDefaultExportFromCjs(papaparse_minExports);
43885
44335
 
43886
- "function"==typeof SuppressedError&&SuppressedError;function P(n,t){return e.parse(n,t)}function x$1(n,t){e.parse(n,Object.assign({},{download:true},t));}function O(n,t){return void 0===t&&(t={}),e.unparse(n,t)}function S(){return {readString:P,readRemoteFile:x$1,jsonToCSV:O}}e.BAD_DELIMITERS;e.RECORD_SEP;e.UNIT_SEP;e.WORKERS_SUPPORTED;e.LocalChunkSize;e.DefaultDelimiter;
44336
+ "function"==typeof SuppressedError&&SuppressedError;function P(n,t){return e.parse(n,t)}function x$1(n,t){e.parse(n,Object.assign({},{download:true},t));}function O(n,t){return void 0===t&&(t={}),e.unparse(n,t)}function S$1(){return {readString:P,readRemoteFile:x$1,jsonToCSV:O}}e.BAD_DELIMITERS;e.RECORD_SEP;e.UNIT_SEP;e.WORKERS_SUPPORTED;e.LocalChunkSize;e.DefaultDelimiter;
43887
44337
 
43888
44338
  const CSVUploader = ({ onDataParsed, onError, delimiter = ',', header = true, dynamicTyping = true, skipEmptyLines = true, worker = false, }) => {
43889
- const { readString } = S();
44339
+ const { readString } = S$1();
43890
44340
  const [loading, setLoading] = React__namespace.useState(false);
43891
44341
  const [error, setError] = React__namespace.useState(null);
43892
44342
  return (jsxRuntime.jsx(UploadButton, { accept: ".csv", loading: loading, error: error, onFilesLoad: ({ files }) => {
@@ -46338,7 +46788,7 @@ const schema = create$3().shape({
46338
46788
  password: create$6().required(),
46339
46789
  });
46340
46790
 
46341
- const r=(t,r,o)=>{if(t&&"reportValidity"in t){const s=get(o,r);t.setCustomValidity(s&&s.message||""),t.reportValidity();}},o$1=(e,t)=>{for(const o in t.fields){const s=t.fields[o];s&&s.ref&&"reportValidity"in s.ref?r(s.ref,o,e):s&&s.refs&&s.refs.forEach(t=>r(t,o,e));}},s=(r,s)=>{s.shouldUseNativeValidation&&o$1(r,s);const n={};for(const o in r){const f=get(s.fields,o),c=Object.assign(r[o]||{},{ref:f&&f.ref});if(i(s.names||Object.keys(r),o)){const r=Object.assign({},get(n,o));set(r,"root",c),set(n,o,r);}else set(n,o,c);}return n},i=(e,t)=>{const r=n(t);return e.some(e=>n(e).match(`^${r}\\.\\d+`))};function n(e){return e.replace(/\]|\[/g,"")}
46791
+ const r$1=(t,r,o)=>{if(t&&"reportValidity"in t){const s=get(o,r);t.setCustomValidity(s&&s.message||""),t.reportValidity();}},o$1=(e,t)=>{for(const o in t.fields){const s=t.fields[o];s&&s.ref&&"reportValidity"in s.ref?r$1(s.ref,o,e):s&&s.refs&&s.refs.forEach(t=>r$1(t,o,e));}},s=(r,s)=>{s.shouldUseNativeValidation&&o$1(r,s);const n={};for(const o in r){const f=get(s.fields,o),c=Object.assign(r[o]||{},{ref:f&&f.ref});if(i(s.names||Object.keys(r),o)){const r=Object.assign({},get(n,o));set(r,"root",c),set(n,o,r);}else set(n,o,c);}return n},i=(e,t)=>{const r=n(t);return e.some(e=>n(e).match(`^${r}\\.\\d+`))};function n(e){return e.replace(/\]|\[/g,"")}
46342
46792
 
46343
46793
  function o(o,n,s$1){return void 0===s$1&&(s$1={}),function(a,i,c){try{return Promise.resolve(function(t,r){try{var u=(null!=n&&n.context&&"development"===process.env.NODE_ENV&&console.warn("You should not used the yup options context. Please, use the 'useForm' context object instead"),Promise.resolve(o["sync"===s$1.mode?"validateSync":"validate"](a,Object.assign({abortEarly:!1},n,{context:i}))).then(function(t){return c.shouldUseNativeValidation&&o$1({},c),{values:s$1.raw?Object.assign({},a):t,errors:{}}}));}catch(e){return r(e)}return u&&u.then?u.then(void 0,r):u}(0,function(e){if(!e.inner)throw e;return {values:{},errors:s((o=e,n=!c.shouldUseNativeValidation&&"all"===c.criteriaMode,(o.inner||[]).reduce(function(e,t){if(e[t.path]||(e[t.path]={message:t.message,type:t.type}),n){var o=e[t.path].types,s=o&&o[t.type];e[t.path]=appendErrors(t.path,n,e,t.type,s?[].concat(s,t.message):t.message);}return e},{})),c)};var o,n;}))}catch(e){return Promise.reject(e)}}}
46344
46794
 
@@ -46437,10 +46887,1036 @@ try {
46437
46887
  }
46438
46888
  } catch(e) {}
46439
46889
 
46890
+ var Tangram$1 = Tangram;
46891
+
46440
46892
  var tangram_min = /*#__PURE__*/Object.freeze({
46893
+ __proto__: null,
46894
+ default: Tangram$1
46895
+ });
46896
+
46897
+ (function() {
46898
+ // save these original methods before they are overwritten
46899
+ var proto_initIcon = L.Marker.prototype._initIcon;
46900
+ var proto_setPos = L.Marker.prototype._setPos;
46901
+
46902
+ var oldIE = (L.DomUtil.TRANSFORM === 'msTransform');
46903
+
46904
+ L.Marker.addInitHook(function () {
46905
+ var iconOptions = this.options.icon && this.options.icon.options;
46906
+ var iconAnchor = iconOptions && this.options.icon.options.iconAnchor;
46907
+ if (iconAnchor) {
46908
+ iconAnchor = (iconAnchor[0] + 'px ' + iconAnchor[1] + 'px');
46909
+ }
46910
+ this.options.rotationOrigin = this.options.rotationOrigin || iconAnchor || 'center bottom' ;
46911
+ this.options.rotationAngle = this.options.rotationAngle || 0;
46912
+
46913
+ // Ensure marker keeps rotated during dragging
46914
+ this.on('drag', function(e) { e.target._applyRotation(); });
46915
+ });
46916
+
46917
+ L.Marker.include({
46918
+ _initIcon: function() {
46919
+ proto_initIcon.call(this);
46920
+ },
46921
+
46922
+ _setPos: function (pos) {
46923
+ proto_setPos.call(this, pos);
46924
+ this._applyRotation();
46925
+ },
46926
+
46927
+ _applyRotation: function () {
46928
+ if(this.options.rotationAngle) {
46929
+ this._icon.style[L.DomUtil.TRANSFORM+'Origin'] = this.options.rotationOrigin;
46930
+
46931
+ if(oldIE) {
46932
+ // for IE 9, use the 2D rotation
46933
+ this._icon.style[L.DomUtil.TRANSFORM] = 'rotate(' + this.options.rotationAngle + 'deg)';
46934
+ } else {
46935
+ // for modern browsers, prefer the 3D accelerated version
46936
+ this._icon.style[L.DomUtil.TRANSFORM] += ' rotateZ(' + this.options.rotationAngle + 'deg)';
46937
+ }
46938
+ }
46939
+ },
46940
+
46941
+ setRotationAngle: function(angle) {
46942
+ this.options.rotationAngle = angle;
46943
+ this.update();
46944
+ return this;
46945
+ },
46946
+
46947
+ setRotationOrigin: function(origin) {
46948
+ this.options.rotationOrigin = origin;
46949
+ this.update();
46950
+ return this;
46951
+ }
46952
+ });
46953
+ })();
46954
+
46955
+ var leaflet_rotatedMarker = /*#__PURE__*/Object.freeze({
46441
46956
  __proto__: null
46442
46957
  });
46443
46958
 
46959
+ var leaflet_polylineoffset$2 = {exports: {}};
46960
+
46961
+ var hasRequiredLeaflet_polylineoffset;
46962
+
46963
+ function requireLeaflet_polylineoffset () {
46964
+ if (hasRequiredLeaflet_polylineoffset) return leaflet_polylineoffset$2.exports;
46965
+ hasRequiredLeaflet_polylineoffset = 1;
46966
+ (function (module, exports$1) {
46967
+ (function (factory, window) {
46968
+ {
46969
+ module.exports = factory(requireLeafletSrc());
46970
+ }
46971
+ if (typeof window !== 'undefined' && window.L) {
46972
+ window.L.PolylineOffset = factory(L);
46973
+ }
46974
+ }(function (L) {
46975
+
46976
+ function forEachPair(list, callback) {
46977
+ if (!list || list.length < 1) { return; }
46978
+ for (var i = 1, l = list.length; i < l; i++) {
46979
+ callback(list[i-1], list[i]);
46980
+ }
46981
+ }
46982
+
46983
+ /**
46984
+ Find the coefficients (a,b) of a line of equation y = a.x + b,
46985
+ or the constant x for vertical lines
46986
+ Return null if there's no equation possible
46987
+ */
46988
+ function lineEquation(pt1, pt2) {
46989
+ if (pt1.x === pt2.x) {
46990
+ return pt1.y === pt2.y ? null : { x: pt1.x };
46991
+ }
46992
+
46993
+ var a = (pt2.y - pt1.y) / (pt2.x - pt1.x);
46994
+ return {
46995
+ a: a,
46996
+ b: pt1.y - a * pt1.x,
46997
+ };
46998
+ }
46999
+
47000
+ /**
47001
+ Return the intersection point of two lines defined by two points each
47002
+ Return null when there's no unique intersection
47003
+ */
47004
+ function intersection(l1a, l1b, l2a, l2b) {
47005
+ var line1 = lineEquation(l1a, l1b);
47006
+ var line2 = lineEquation(l2a, l2b);
47007
+
47008
+ if (line1 === null || line2 === null) {
47009
+ return null;
47010
+ }
47011
+
47012
+ if (line1.hasOwnProperty('x')) {
47013
+ return line2.hasOwnProperty('x')
47014
+ ? null
47015
+ : {
47016
+ x: line1.x,
47017
+ y: line2.a * line1.x + line2.b,
47018
+ };
47019
+ }
47020
+ if (line2.hasOwnProperty('x')) {
47021
+ return {
47022
+ x: line2.x,
47023
+ y: line1.a * line2.x + line1.b,
47024
+ };
47025
+ }
47026
+
47027
+ if (line1.a === line2.a) {
47028
+ return null;
47029
+ }
47030
+
47031
+ var x = (line2.b - line1.b) / (line1.a - line2.a);
47032
+ return {
47033
+ x: x,
47034
+ y: line1.a * x + line1.b,
47035
+ };
47036
+ }
47037
+
47038
+ function translatePoint(pt, dist, heading) {
47039
+ return {
47040
+ x: pt.x + dist * Math.cos(heading),
47041
+ y: pt.y + dist * Math.sin(heading),
47042
+ };
47043
+ }
47044
+
47045
+ var PolylineOffset = {
47046
+ offsetPointLine: function(points, distance) {
47047
+ var offsetSegments = [];
47048
+
47049
+ forEachPair(points, L.bind(function(a, b) {
47050
+ if (a.x === b.x && a.y === b.y) { return; }
47051
+
47052
+ // angles in (-PI, PI]
47053
+ var segmentAngle = Math.atan2(a.y - b.y, a.x - b.x);
47054
+ var offsetAngle = segmentAngle - Math.PI/2;
47055
+
47056
+ offsetSegments.push({
47057
+ offsetAngle: offsetAngle,
47058
+ original: [a, b],
47059
+ offset: [
47060
+ translatePoint(a, distance, offsetAngle),
47061
+ translatePoint(b, distance, offsetAngle)
47062
+ ]
47063
+ });
47064
+ }, this));
47065
+
47066
+ return offsetSegments;
47067
+ },
47068
+
47069
+ offsetPoints: function(pts, offset) {
47070
+ var offsetSegments = this.offsetPointLine(pts, offset);
47071
+ return this.joinLineSegments(offsetSegments, offset);
47072
+ },
47073
+
47074
+ /**
47075
+ Join 2 line segments defined by 2 points each with a circular arc
47076
+ */
47077
+ joinSegments: function(s1, s2, offset) {
47078
+ // TODO: different join styles
47079
+ return this.circularArc(s1, s2, offset)
47080
+ .filter(function(x) { return x; })
47081
+ },
47082
+
47083
+ joinLineSegments: function(segments, offset) {
47084
+ var joinedPoints = [];
47085
+ var first = segments[0];
47086
+ var last = segments[segments.length - 1];
47087
+
47088
+ if (first && last) {
47089
+ joinedPoints.push(first.offset[0]);
47090
+ forEachPair(segments, L.bind(function(s1, s2) {
47091
+ joinedPoints = joinedPoints.concat(this.joinSegments(s1, s2, offset));
47092
+ }, this));
47093
+ joinedPoints.push(last.offset[1]);
47094
+ }
47095
+
47096
+ return joinedPoints;
47097
+ },
47098
+
47099
+ segmentAsVector: function(s) {
47100
+ return {
47101
+ x: s[1].x - s[0].x,
47102
+ y: s[1].y - s[0].y,
47103
+ };
47104
+ },
47105
+
47106
+ getSignedAngle: function(s1, s2) {
47107
+ const a = this.segmentAsVector(s1);
47108
+ const b = this.segmentAsVector(s2);
47109
+ return Math.atan2(a.x * b.y - a.y * b.x, a.x * b.x + a.y * b.y);
47110
+ },
47111
+
47112
+ /**
47113
+ Interpolates points between two offset segments in a circular form
47114
+ */
47115
+ circularArc: function(s1, s2, distance) {
47116
+ // if the segments are the same angle,
47117
+ // there should be a single join point
47118
+ if (s1.offsetAngle === s2.offsetAngle) {
47119
+ return [s1.offset[1]];
47120
+ }
47121
+
47122
+ const signedAngle = this.getSignedAngle(s1.offset, s2.offset);
47123
+ // for inner angles, just find the offset segments intersection
47124
+ if ((signedAngle * distance > 0) &&
47125
+ (signedAngle * this.getSignedAngle(s1.offset, [s1.offset[0], s2.offset[1]]) > 0)) {
47126
+ return [intersection(s1.offset[0], s1.offset[1], s2.offset[0], s2.offset[1])];
47127
+ }
47128
+
47129
+ // draws a circular arc with R = offset distance, C = original meeting point
47130
+ var points = [];
47131
+ var center = s1.original[1];
47132
+ // ensure angles go in the anti-clockwise direction
47133
+ var rightOffset = distance > 0;
47134
+ var startAngle = rightOffset ? s2.offsetAngle : s1.offsetAngle;
47135
+ var endAngle = rightOffset ? s1.offsetAngle : s2.offsetAngle;
47136
+ // and that the end angle is bigger than the start angle
47137
+ if (endAngle < startAngle) {
47138
+ endAngle += Math.PI * 2;
47139
+ }
47140
+ var step = Math.PI / 8;
47141
+ for (var alpha = startAngle; alpha < endAngle; alpha += step) {
47142
+ points.push(translatePoint(center, distance, alpha));
47143
+ }
47144
+ points.push(translatePoint(center, distance, endAngle));
47145
+
47146
+ return rightOffset ? points.reverse() : points;
47147
+ }
47148
+ };
47149
+
47150
+ // Modify the L.Polyline class by overwriting the projection function
47151
+ L.Polyline.include({
47152
+ _projectLatlngs: function (latlngs, result, projectedBounds) {
47153
+ var isFlat = latlngs.length > 0 && latlngs[0] instanceof L.LatLng;
47154
+
47155
+ if (isFlat) {
47156
+ var ring = latlngs.map(L.bind(function(ll) {
47157
+ var point = this._map.latLngToLayerPoint(ll);
47158
+ if (projectedBounds) {
47159
+ projectedBounds.extend(point);
47160
+ }
47161
+ return point;
47162
+ }, this));
47163
+
47164
+ // Offset management hack ---
47165
+ if (this.options.offset) {
47166
+ ring = L.PolylineOffset.offsetPoints(ring, this.options.offset);
47167
+ }
47168
+ // Offset management hack END ---
47169
+
47170
+ result.push(ring.map(function (xy) {
47171
+ return L.point(xy.x, xy.y);
47172
+ }));
47173
+ } else {
47174
+ latlngs.forEach(L.bind(function(ll) {
47175
+ this._projectLatlngs(ll, result, projectedBounds);
47176
+ }, this));
47177
+ }
47178
+ }
47179
+ });
47180
+
47181
+ L.Polyline.include({
47182
+ setOffset: function(offset) {
47183
+ this.options.offset = offset;
47184
+ this.redraw();
47185
+ return this;
47186
+ }
47187
+ });
47188
+
47189
+ return PolylineOffset;
47190
+
47191
+ }, window));
47192
+ } (leaflet_polylineoffset$2));
47193
+ return leaflet_polylineoffset$2.exports;
47194
+ }
47195
+
47196
+ var leaflet_polylineoffsetExports = requireLeaflet_polylineoffset();
47197
+ var leaflet_polylineoffset = /*@__PURE__*/getDefaultExportFromCjs(leaflet_polylineoffsetExports);
47198
+
47199
+ var leaflet_polylineoffset$1 = /*#__PURE__*/_mergeNamespaces({
47200
+ __proto__: null,
47201
+ default: leaflet_polylineoffset
47202
+ }, [leaflet_polylineoffsetExports]);
47203
+
47204
+ /**
47205
+ * L.Map.SelectArea - Area selection tool for leaflet
47206
+ *
47207
+ * @author Alexander Milevski <info@w8r.name>
47208
+ * @see https://github.com/w8r/leaflet-area-select
47209
+ * @license MIT
47210
+ * @preserve
47211
+ */
47212
+ var r = function() {
47213
+ return true;
47214
+ };
47215
+ s$3.Map.SelectArea = s$3.Map.BoxZoom.extend({
47216
+ statics: {
47217
+ /**
47218
+ * @static
47219
+ * @type {String}
47220
+ */
47221
+ SELECT_AREA_SELECTED: "selectarea:selected",
47222
+ /**
47223
+ * @static
47224
+ * @type {String}
47225
+ */
47226
+ SELECT_AREA_START: "selectarea:start",
47227
+ /**
47228
+ * @static
47229
+ * @type {String}
47230
+ */
47231
+ SELECT_AREA_TOGGLED: "selectarea:toggled"
47232
+ },
47233
+ options: {
47234
+ shiftKey: false,
47235
+ ctrlKey: true,
47236
+ validate: r,
47237
+ autoDisable: false,
47238
+ cursor: "crosshair"
47239
+ },
47240
+ /**
47241
+ * @param {L.Map} map
47242
+ * @constructor
47243
+ */
47244
+ initialize: function(t, e) {
47245
+ s$3.Util.setOptions(this, e || {}), s$3.Map.BoxZoom.prototype.initialize.call(this, t), this._validate = null, this._moved = false, this._autoDisable = !this.options.ctrlKey && this.options.autoDisable, this._lastLayerPoint = null, this._beforeCursor = null, this.setValidate(this.options.validate), this.setAutoDisable(this.options.autoDisable);
47246
+ },
47247
+ /**
47248
+ * @param {Function=} validate
47249
+ * @return {SelectArea}
47250
+ */
47251
+ setValidate: function(t) {
47252
+ var e = this;
47253
+ return typeof t != "function" && (t = r), this._validate = function(i) {
47254
+ return t.call(e, i);
47255
+ }, this;
47256
+ },
47257
+ /**
47258
+ * @param {Boolean} autoDisable
47259
+ */
47260
+ setAutoDisable: function(t) {
47261
+ this._autoDisable = !!t;
47262
+ },
47263
+ /**
47264
+ * @param {Boolean} on
47265
+ */
47266
+ setControlKey: function(t) {
47267
+ var e = this._enabled;
47268
+ e && this.disable(), this.options.ctrlKey = !!t, t && (this.options.shiftKey = false), e && this.enable();
47269
+ },
47270
+ /**
47271
+ * @param {Boolean} on
47272
+ */
47273
+ setShiftKey: function(t) {
47274
+ var e = this._enabled;
47275
+ e && this.disable(), this.options.shiftKey = !!t, t && (this.options.ctrlKey = false), e && this.enable();
47276
+ },
47277
+ /**
47278
+ * Disable dragging or zoombox
47279
+ * @param {Function=} validate
47280
+ * @param {Boolean=} autoDisable
47281
+ */
47282
+ enable: function(t, e) {
47283
+ this.options.shiftKey ? this._map.boxZoom && this._map.boxZoom.disable() : this.options.ctrlKey || this._map.dragging.disable(), s$3.Map.BoxZoom.prototype.enable.call(this), this.options.ctrlKey || this._setCursor(), t && this.setValidate(t), this.setAutoDisable(e), this._map.fire(s$3.Map.SelectArea.SELECT_AREA_TOGGLED);
47284
+ },
47285
+ /**
47286
+ * Re-enable box zoom or dragging
47287
+ */
47288
+ disable: function() {
47289
+ s$3.Map.BoxZoom.prototype.disable.call(this), this.options.ctrlKey || this._restoreCursor(), this.options.shiftKey ? this._map.boxZoom && this._map.boxZoom.enable() : this._map.dragging.enable(), this._map.fire(s$3.Map.SelectArea.SELECT_AREA_TOGGLED);
47290
+ },
47291
+ /**
47292
+ * Also listen to ESC to cancel interaction
47293
+ * @override
47294
+ */
47295
+ addHooks: function() {
47296
+ s$3.Map.BoxZoom.prototype.addHooks.call(this), s$3.DomEvent.on(document, "keyup", this._onKeyUp, this).on(document, "keydown", this._onKeyPress, this).on(document, "contextmenu", this._onMouseDown, this).on(window, "blur", this._onBlur, this), this._map.on("dragstart", this._onMouseDown, this);
47297
+ },
47298
+ /**
47299
+ * @override
47300
+ */
47301
+ removeHooks: function() {
47302
+ s$3.Map.BoxZoom.prototype.removeHooks.call(this), s$3.DomEvent.off(document, "keyup", this._onKeyUp, this).off(document, "keydown", this._onKeyPress, this).off(document, "contextmenu", this._onMouseDown, this).off(window, "blur", this._onBlur, this), this._map.off("dragstart", this._onMouseDown, this);
47303
+ },
47304
+ /**
47305
+ * @override
47306
+ */
47307
+ _onMouseDown: function(t) {
47308
+ if (this._moved = false, this._lastLayerPoint = null, this.options.shiftKey && !t.shiftKey || this.options.ctrlKey && !t.ctrlKey || t.which !== 1 && t.button !== 1)
47309
+ return false;
47310
+ s$3.DomEvent.stop(t);
47311
+ var e = this._map.mouseEventToLayerPoint(t);
47312
+ if (!this._validate(e)) return false;
47313
+ s$3.DomUtil.disableTextSelection(), s$3.DomUtil.disableImageDrag(), this._startLayerPoint = e, s$3.DomEvent.on(document, "mousemove", this._onMouseMove, this).on(document, "mouseup", this._onMouseUp, this).on(document, "keydown", this._onKeyDown, this);
47314
+ },
47315
+ /**
47316
+ * @override
47317
+ */
47318
+ _onMouseMove: function(t) {
47319
+ this._moved || (this._box = s$3.DomUtil.create("div", "leaflet-zoom-box", this._pane), s$3.DomUtil.setPosition(this._box, this._startLayerPoint), this._map.fire(s$3.Map.SelectArea.SELECT_AREA_START));
47320
+ var e = this._startLayerPoint, i = this._box, o = this._map.mouseEventToLayerPoint(t), a = o.subtract(e);
47321
+ if (this._validate(o)) {
47322
+ this._lastLayerPoint = o;
47323
+ var n = new s$3.Point(
47324
+ Math.min(o.x, e.x),
47325
+ Math.min(o.y, e.y)
47326
+ );
47327
+ s$3.DomUtil.setPosition(i, n), this._moved = true, i.style.width = Math.max(0, Math.abs(a.x) - 4) + "px", i.style.height = Math.max(0, Math.abs(a.y) - 4) + "px";
47328
+ }
47329
+ },
47330
+ /**
47331
+ * General on/off toggle
47332
+ * @param {KeyboardEvent} e
47333
+ */
47334
+ _onKeyUp: function(t) {
47335
+ t.keyCode === 27 ? this._moved && this._box && this._finish() : this.options.ctrlKey && (this._restoreCursor(), this._map.dragging.enable());
47336
+ },
47337
+ /**
47338
+ * Key down listener to enable on ctrl-press
47339
+ * @param {KeyboardEvent} e
47340
+ */
47341
+ _onKeyPress: function(t) {
47342
+ this.options.ctrlKey && (t.ctrlKey || t.type === "dragstart") && this._beforeCursor === null && (this._setCursor(), this._map.dragging._draggable._onUp(t), this._map.dragging.disable());
47343
+ },
47344
+ /**
47345
+ * Window blur listener to restore state
47346
+ * @param {Event} e
47347
+ */
47348
+ _onBlur: function(t) {
47349
+ this._restoreCursor(), this._map.dragging.enable();
47350
+ },
47351
+ /**
47352
+ * Set crosshair cursor
47353
+ */
47354
+ _setCursor: function() {
47355
+ this._beforeCursor = this._container.style.cursor, this._container.style.cursor = this.options.cursor;
47356
+ },
47357
+ /**
47358
+ * Restore status quo cursor
47359
+ */
47360
+ _restoreCursor: function() {
47361
+ this._container.style.cursor = this._beforeCursor, this._beforeCursor = null;
47362
+ },
47363
+ /**
47364
+ * @override
47365
+ */
47366
+ _onMouseUp: function(t) {
47367
+ this._finish();
47368
+ var e = this._map, i = this._lastLayerPoint;
47369
+ if (!(!i || this._startLayerPoint.equals(i))) {
47370
+ s$3.DomEvent.stop(t);
47371
+ var o = e.layerPointToLatLng(this._startLayerPoint), a = e.layerPointToLatLng(i), n = new s$3.LatLngBounds(o, a);
47372
+ this._autoDisable ? this.disable() : this._restoreCursor(), this._moved = false, s$3.Util.requestAnimFrame(function() {
47373
+ e.fire(s$3.Map.SelectArea.SELECT_AREA_SELECTED, {
47374
+ bounds: n,
47375
+ start: o,
47376
+ end: a
47377
+ });
47378
+ });
47379
+ }
47380
+ }
47381
+ });
47382
+ s$3.Map.mergeOptions({
47383
+ selectArea: false
47384
+ });
47385
+ s$3.Map.addInitHook("addHandler", "selectArea", s$3.Map.SelectArea);
47386
+ const l = s$3.Map.SelectArea;
47387
+
47388
+ var index$1 = /*#__PURE__*/Object.freeze({
47389
+ __proto__: null,
47390
+ default: l
47391
+ });
47392
+
47393
+ leafletSrcExports.SVG.include({
47394
+ /**
47395
+ * Reset transform matrix
47396
+ */
47397
+ _resetTransformPath: function(t) {
47398
+ t._path.setAttributeNS(null, "transform", "");
47399
+ },
47400
+ /**
47401
+ * Applies matrix transformation to SVG
47402
+ * @param {L.Path} layer
47403
+ * @param {Array.<Number>} matrix
47404
+ */
47405
+ transformPath: function(t, i) {
47406
+ t._path.setAttributeNS(
47407
+ null,
47408
+ "transform",
47409
+ "matrix(" + i.join(" ") + ")"
47410
+ );
47411
+ }
47412
+ });
47413
+ leafletSrcExports.SVG.include(
47414
+ leafletSrcExports.Browser.vml ? {
47415
+ /**
47416
+ * Reset transform matrix
47417
+ */
47418
+ _resetTransformPath: function(t) {
47419
+ t._skew && (t._skew.on = false, t._path.removeChild(t._skew), t._skew = null);
47420
+ },
47421
+ /**
47422
+ * Applies matrix transformation to VML
47423
+ * @param {L.Path} layer
47424
+ * @param {Array.<Number>} matrix
47425
+ */
47426
+ transformPath: function(t, i) {
47427
+ let n = t._skew;
47428
+ n || (n = leafletSrcExports.SVG.create("skew"), t._path.appendChild(n), n.style.behavior = "url(#default#VML)", t._skew = n);
47429
+ const a = i[0].toFixed(8) + " " + i[1].toFixed(8) + " " + i[2].toFixed(8) + " " + i[3].toFixed(8) + " 0 0", r = Math.floor(i[4]).toFixed() + ", " + Math.floor(i[5]).toFixed(), s = this._path.style;
47430
+ let e = parseFloat(s.left), o = parseFloat(s.top), _ = parseFloat(s.width), p = parseFloat(s.height);
47431
+ isNaN(e) && (e = 0), isNaN(o) && (o = 0), (isNaN(_) || !_) && (_ = 1), (isNaN(p) || !p) && (p = 1);
47432
+ const u = (-e / _ - 0.5).toFixed(8) + " " + (-o / p - 0.5).toFixed(8);
47433
+ n.on = "f", n.matrix = a, n.origin = u, n.offset = r, n.on = true;
47434
+ }
47435
+ } : {}
47436
+ );
47437
+ function E() {
47438
+ return true;
47439
+ }
47440
+ leafletSrcExports.Canvas.include({
47441
+ /**
47442
+ * Do nothing
47443
+ * @param {L.Path} layer
47444
+ */
47445
+ _resetTransformPath: function(t) {
47446
+ this._containerCopy && (delete this._containerCopy, t._containsPoint_ && (t._containsPoint = t._containsPoint_, delete t._containsPoint_, this._requestRedraw(t)));
47447
+ },
47448
+ /**
47449
+ * Algorithm outline:
47450
+ *
47451
+ * 1. pre-transform - clear the path out of the canvas, copy canvas state
47452
+ * 2. at every frame:
47453
+ * 2.1. save
47454
+ * 2.2. redraw the canvas from saved one
47455
+ * 2.3. transform
47456
+ * 2.4. draw path
47457
+ * 2.5. restore
47458
+ * 3. Repeat
47459
+ *
47460
+ * @param {L.Path} layer
47461
+ * @param {Array.<Number>} matrix
47462
+ */
47463
+ transformPath: function(t, i) {
47464
+ let n = this._containerCopy;
47465
+ const a = this._ctx;
47466
+ let r;
47467
+ const s = leafletSrcExports.Browser.retina ? 2 : 1, e = this._bounds, o = e.getSize(), _ = e.min;
47468
+ n || (n = this._containerCopy = document.createElement("canvas"), r = n.getContext("2d"), n.width = s * o.x, n.height = s * o.y, this._removePath(t), this._redraw(), r.translate(s * e.min.x, s * e.min.y), r.drawImage(this._container, 0, 0), this._initPath(t), t._containsPoint_ = t._containsPoint, t._containsPoint = E), a.save(), a.clearRect(_.x, _.y, o.x * s, o.y * s), a.setTransform(1, 0, 0, 1, 0, 0), a.restore(), a.save(), a.drawImage(this._containerCopy, 0, 0, o.x, o.y), a.transform.apply(a, i), this._drawing = true, t._updatePath(), this._drawing = false, a.restore();
47469
+ }
47470
+ });
47471
+ /**
47472
+ * Leaflet vector features drag functionality
47473
+ * @author Alexander Milevski <info@w8r.name>
47474
+ * @preserve
47475
+ */
47476
+ leafletSrcExports.Path.include({
47477
+ /**
47478
+ * Applies matrix transformation to SVG
47479
+ * @param {Array.<Number>?} matrix
47480
+ */
47481
+ _transform: function(t) {
47482
+ return this._renderer && (t ? this._renderer.transformPath(this, t) : (this._renderer._resetTransformPath(this), this._update())), this;
47483
+ },
47484
+ /**
47485
+ * Check if the feature was dragged, that'll supress the click event
47486
+ * on mouseup. That fixes popups for example
47487
+ *
47488
+ * @param {MouseEvent} e
47489
+ */
47490
+ _onMouseClick: function(t) {
47491
+ this.dragging && this.dragging.moved() || this._map.dragging && this._map.dragging.moved() || this._fireMouseEvent(t);
47492
+ }
47493
+ });
47494
+ const S = {
47495
+ mousedown: "mouseup",
47496
+ touchstart: "touchend",
47497
+ pointerdown: "touchend",
47498
+ MSPointerDown: "touchend"
47499
+ }, M = {
47500
+ mousedown: "mousemove",
47501
+ touchstart: "touchmove",
47502
+ pointerdown: "touchmove",
47503
+ MSPointerDown: "touchmove"
47504
+ };
47505
+ function k(t, i) {
47506
+ const n = t.x - i.x, a = t.y - i.y;
47507
+ return Math.sqrt(n * n + a * a);
47508
+ }
47509
+ leafletSrcExports.Handler.PathDrag = leafletSrcExports.Handler.extend(
47510
+ /** @lends L.Path.Drag.prototype */
47511
+ {
47512
+ statics: {
47513
+ DRAGGING_CLS: "leaflet-path-draggable"
47514
+ },
47515
+ /**
47516
+ * @param {L.Path} path
47517
+ * @constructor
47518
+ */
47519
+ initialize: function(t) {
47520
+ this._path = t, this._matrix = null, this._startPoint = null, this._dragStartPoint = null, this._mapDraggingWasEnabled = false, this._path._dragMoved = false;
47521
+ },
47522
+ /**
47523
+ * Enable dragging
47524
+ */
47525
+ addHooks: function() {
47526
+ this._path.on("mousedown", this._onDragStart, this), this._path.options.className = this._path.options.className ? this._path.options.className + " " + leafletSrcExports.Handler.PathDrag.DRAGGING_CLS : leafletSrcExports.Handler.PathDrag.DRAGGING_CLS, this._path._path && leafletSrcExports.DomUtil.addClass(this._path._path, leafletSrcExports.Handler.PathDrag.DRAGGING_CLS);
47527
+ },
47528
+ /**
47529
+ * Disable dragging
47530
+ */
47531
+ removeHooks: function() {
47532
+ this._path.off("mousedown", this._onDragStart, this), this._path.options.className = this._path.options.className.replace(
47533
+ new RegExp("\\s+" + leafletSrcExports.Handler.PathDrag.DRAGGING_CLS),
47534
+ ""
47535
+ ), this._path._path && leafletSrcExports.DomUtil.removeClass(this._path._path, leafletSrcExports.Handler.PathDrag.DRAGGING_CLS);
47536
+ },
47537
+ /**
47538
+ * @return {Boolean}
47539
+ */
47540
+ moved: function() {
47541
+ return this._path._dragMoved;
47542
+ },
47543
+ /**
47544
+ * Start drag
47545
+ * @param {L.MouseEvent} evt
47546
+ */
47547
+ _onDragStart: function(t) {
47548
+ const i = t.originalEvent._simulated ? "touchstart" : t.originalEvent.type;
47549
+ this._mapDraggingWasEnabled = false, this._startPoint = t.containerPoint.clone(), this._dragStartPoint = t.containerPoint.clone(), this._matrix = [1, 0, 0, 1, 0, 0], leafletSrcExports.DomEvent.stop(t.originalEvent), leafletSrcExports.DomUtil.addClass(this._path._renderer._container, "leaflet-interactive"), leafletSrcExports.DomEvent.on(document, M[i], this._onDrag, this).on(
47550
+ document,
47551
+ S[i],
47552
+ this._onDragEnd,
47553
+ this
47554
+ ), this._path._map.dragging.enabled() && (this._path._map.dragging.disable(), this._mapDraggingWasEnabled = true), this._path._dragMoved = false, this._path._popup && this._path._popup.close(), this._replaceCoordGetters(t);
47555
+ },
47556
+ /**
47557
+ * Dragging
47558
+ * @param {L.MouseEvent} evt
47559
+ */
47560
+ _onDrag: function(t) {
47561
+ leafletSrcExports.DomEvent.stop(t);
47562
+ const i = t.touches && t.touches.length >= 1 ? t.touches[0] : t, n = this._path._map.mouseEventToContainerPoint(i);
47563
+ if (t.type === "touchmove" && !this._path._dragMoved && this._dragStartPoint.distanceTo(n) <= this._path._map.options.tapTolerance)
47564
+ return;
47565
+ const a = n.x, r = n.y, s = a - this._startPoint.x, e = r - this._startPoint.y;
47566
+ (s || e) && (this._path._dragMoved || (this._path._dragMoved = true, this._path.options.interactive = false, this._path._map.dragging._draggable._moved = true, this._path.fire("dragstart", t), this._path.bringToFront()), this._matrix[4] += s, this._matrix[5] += e, this._startPoint.x = a, this._startPoint.y = r, this._path.fire("predrag", t), this._path._transform(this._matrix), this._path.fire("drag", t));
47567
+ },
47568
+ /**
47569
+ * Dragging stopped, apply
47570
+ * @param {L.MouseEvent} evt
47571
+ */
47572
+ _onDragEnd: function(t) {
47573
+ const i = this._path._map.mouseEventToContainerPoint(t), n = this.moved();
47574
+ if (n && (this._transformPoints(this._matrix), this._path._updatePath(), this._path._project(), this._path._transform(null), leafletSrcExports.DomEvent.stop(t)), leafletSrcExports.DomEvent.off(document, "mousemove touchmove", this._onDrag, this), leafletSrcExports.DomEvent.off(document, "mouseup touchend", this._onDragEnd, this), this._restoreCoordGetters(), n) {
47575
+ this._path.fire("dragend", {
47576
+ distance: k(this._dragStartPoint, i)
47577
+ });
47578
+ const a = this._path._containsPoint;
47579
+ this._path._containsPoint = leafletSrcExports.Util.falseFn, leafletSrcExports.Util.requestAnimFrame(function() {
47580
+ this._path._dragMoved = false, this._path.options.interactive = true, this._path._containsPoint = a;
47581
+ }, this);
47582
+ }
47583
+ this._mapDraggingWasEnabled && this._path._map.dragging.enable();
47584
+ },
47585
+ /**
47586
+ * Applies transformation, does it in one sweep for performance,
47587
+ * so don't be surprised about the code repetition.
47588
+ *
47589
+ * [ x ] [ a b tx ] [ x ] [ a * x + b * y + tx ]
47590
+ * [ y ] = [ c d ty ] [ y ] = [ c * x + d * y + ty ]
47591
+ *
47592
+ * @param {Array.<Number>} matrix
47593
+ */
47594
+ _transformPoints: function(t, i) {
47595
+ const n = this._path, a = L.point(t[4], t[5]), r = n._map.options.crs, s = r.transformation, e = r.scale(n._map.getZoom()), o = r.projection, _ = s.untransform(a, e).subtract(s.untransform(leafletSrcExports.point(0, 0), e)), p = !i;
47596
+ if (n._bounds = new leafletSrcExports.LatLngBounds(), n._point)
47597
+ i = o.unproject(
47598
+ o.project(n._latlng)._add(_)
47599
+ ), p && (n._latlng = i, n._point._add(a));
47600
+ else if (n._rings || n._parts) {
47601
+ const u = n._rings || n._parts;
47602
+ let c = n._latlngs;
47603
+ i = i || c, leafletSrcExports.Util.isArray(c[0]) || (c = [c], i = [i]);
47604
+ for (let g = 0, w = u.length; g < w; g++) {
47605
+ i[g] = i[g] || [];
47606
+ for (let d = 0, v = u[g].length; d < v; d++) {
47607
+ const b = c[g][d];
47608
+ i[g][d] = o.unproject(
47609
+ o.project(b)._add(_)
47610
+ ), p && (n._bounds.extend(c[g][d]), u[g][d]._add(a));
47611
+ }
47612
+ }
47613
+ }
47614
+ return i;
47615
+ },
47616
+ /**
47617
+ * If you want to read the latlngs during the drag - your right,
47618
+ * but they have to be transformed
47619
+ */
47620
+ _replaceCoordGetters: function() {
47621
+ this._path.getLatLng ? (this._path.getLatLng_ = this._path.getLatLng, this._path.getLatLng = leafletSrcExports.Util.bind(function() {
47622
+ return this.dragging._transformPoints(this.dragging._matrix, {});
47623
+ }, this._path)) : this._path.getLatLngs && (this._path.getLatLngs_ = this._path.getLatLngs, this._path.getLatLngs = leafletSrcExports.Util.bind(function() {
47624
+ return this.dragging._transformPoints(this.dragging._matrix, []);
47625
+ }, this._path));
47626
+ },
47627
+ /**
47628
+ * Put back the getters
47629
+ */
47630
+ _restoreCoordGetters: function() {
47631
+ this._path.getLatLng_ ? (this._path.getLatLng = this._path.getLatLng_, delete this._path.getLatLng_) : this._path.getLatLngs_ && (this._path.getLatLngs = this._path.getLatLngs_, delete this._path.getLatLngs_);
47632
+ }
47633
+ }
47634
+ );
47635
+ leafletSrcExports.Handler.PathDrag.makeDraggable = function(t) {
47636
+ return t.dragging = new leafletSrcExports.Handler.PathDrag(t), t;
47637
+ };
47638
+ leafletSrcExports.Path.prototype.makeDraggable = function() {
47639
+ return leafletSrcExports.Handler.PathDrag.makeDraggable(this);
47640
+ };
47641
+ leafletSrcExports.Path.addInitHook(function() {
47642
+ this.options.draggable ? (this.options.interactive = true, this.dragging ? this.dragging.enable() : (leafletSrcExports.Handler.PathDrag.makeDraggable(this), this.dragging.enable())) : this.dragging && this.dragging.disable();
47643
+ });
47644
+ const T = leafletSrcExports.Handler.PathDrag;
47645
+
47646
+ var index = /*#__PURE__*/Object.freeze({
47647
+ __proto__: null,
47648
+ default: T
47649
+ });
47650
+
47651
+ var leafletArrows$2 = {exports: {}};
47652
+
47653
+ var hasRequiredLeafletArrows;
47654
+
47655
+ function requireLeafletArrows () {
47656
+ if (hasRequiredLeafletArrows) return leafletArrows$2.exports;
47657
+ hasRequiredLeafletArrows = 1;
47658
+ (function (module, exports$1) {
47659
+ // Leaflet Arrows by Meteotest
47660
+ // https://github.com/meteotest/leaflet-arrows
47661
+ // Module Loader Boilerplate
47662
+ (function (factory, window) {
47663
+ // define an AMD module that relies on 'leaflet'
47664
+ {
47665
+ module.exports = factory(requireLeafletSrc());
47666
+ }
47667
+ // attach your plugin to the global 'L' variable
47668
+ if (typeof window !== 'undefined' && window.L) {
47669
+ window.L.Arrow = factory(L);
47670
+ }
47671
+ })(function (L) {
47672
+ // beware! the arrow factory
47673
+ const Arrow = L.FeatureGroup.extend({
47674
+ options: {
47675
+ distanceUnit: 'km', // can be [px,km]
47676
+ stretchFactor: 1, // should the distance be stretched?
47677
+ arrowheadLength: 4, // in distance unit
47678
+ arrowheadClosingLine: false, // should a closing third line be drawn?
47679
+ arrowheadDegree: 155, // degree of arrowhead
47680
+ clickableWidth: 10, // defines the width in pixels of the "phantom" path to capture click events on a line
47681
+ //optional: popupContent: function(data) {},
47682
+ // add your own custom validator, probably not needed...
47683
+ // the validator gets the bound data object as argument
47684
+ validator: function (data) {
47685
+ return (typeof data.latlng !== 'undefined' &&
47686
+ typeof data.distance !== 'undefined' &&
47687
+ !isNaN(data.distance));
47688
+ }, // validator is a callback function that takes the data object of the current point and returns whether it is 'valid'. Invalid arrows will be drawn gray
47689
+ colorScheme: function () {
47690
+ return this.color;
47691
+ }, // add own colorscheme callback
47692
+ circleRadiusInvalidPoint: 1000, // Radius of the circle to display missing or '0'-value
47693
+ // path options
47694
+ color: '#333',
47695
+ opacity: 0.9, // stroke opacity
47696
+ fillOpacity: 0.9,
47697
+ weight: 4, // the width of the arrow
47698
+ smoothFactor: 0,
47699
+ radius: 5, // default radius, when distance is 0
47700
+ defaultPointOptions: {
47701
+ stroke: false,
47702
+ fillOpacity: 0.8,
47703
+ fillColor: '#111',
47704
+ radius: 7,
47705
+ },
47706
+ invalidPointOptions: {
47707
+ stroke: false,
47708
+ fillOpacity: 0.8,
47709
+ fillColor: 'red',
47710
+ radius: 7,
47711
+ },
47712
+ drawSourceMarker: false,
47713
+ sourceMarkerOptions: {
47714
+ stroke: false,
47715
+ fillOpacity: 1,
47716
+ fillColor: '#333',
47717
+ radius: 5,
47718
+ },
47719
+ },
47720
+ /**
47721
+ * The data opject needs at least following properties:
47722
+ * - latlng : L.LatLng
47723
+ * - degree : float
47724
+ * - distance: float
47725
+ */
47726
+ initialize: function (data, options) {
47727
+ L.Util.setOptions(this, options);
47728
+ this.setData(data);
47729
+ },
47730
+ onAdd: function (map) {
47731
+ this._map = map;
47732
+ this.redraw();
47733
+ // add a viewreset event listener for updating layer's position
47734
+ map.on('viewreset', this._reset, this);
47735
+ },
47736
+ onRemove: function () {
47737
+ // remove layer's DOM elements and listeners
47738
+ for (const i in this._layers) {
47739
+ if (this._layers.hasOwnProperty(i)) {
47740
+ this._map.removeLayer(this._layers[i]);
47741
+ }
47742
+ }
47743
+ if (typeof this._sourceMarker !== 'undefined') {
47744
+ this._map.removeLayer(this._sourceMarker);
47745
+ }
47746
+ this._map.off('viewreset', this._reset, this);
47747
+ },
47748
+ // draw
47749
+ redraw: function () {
47750
+ // only draw when on map
47751
+ if (!this._map) {
47752
+ return;
47753
+ }
47754
+ this._layers = {};
47755
+ // bind popup to the whole feature group
47756
+ if (typeof this.options.popupContent === 'function') {
47757
+ this.bindPopup(this.options.popupContent(this._data));
47758
+ }
47759
+ if (this._data.valid && typeof this.options.colorScheme === 'function') {
47760
+ this.options.color = this.options.colorScheme(this._data);
47761
+ }
47762
+ this._data.distance = parseFloat(this._data.distance);
47763
+ // if distance or degree is falsy/Zero then draw a point instead of an arrow
47764
+ if (!this._data.valid || !this._data.distance || !this._data.angle) {
47765
+ let circle;
47766
+ const pathOptions = this._data.valid
47767
+ ? this.options.defaultPointOptions
47768
+ : this.options.invalidPointOptions;
47769
+ if (this.options.distanceUnit.toLowerCase() === 'km') {
47770
+ // use a tenth of the supplied radius (usally used in the circlemarker)
47771
+ circle = L.circle(this._data.latlng, this.options.radius / 10, pathOptions);
47772
+ }
47773
+ else {
47774
+ circle = L.circleMarker(this._data.latlng, pathOptions);
47775
+ }
47776
+ this.addLayer(circle);
47777
+ }
47778
+ else {
47779
+ const theLine = [
47780
+ this._data.latlng,
47781
+ this._calculateEndPoint(this._data.latlng, this._data.distance, this._data.angle),
47782
+ ];
47783
+ const theArrow = this._calculateArrowArray(theLine[1]);
47784
+ const backgroundPathOption = L.Util.setOptions({}, this.pathOptions);
47785
+ backgroundPathOption.opacity = 0;
47786
+ backgroundPathOption.weight = this.options.clickableWidth;
47787
+ const invisibleBackgroundPolyline = new L.Polyline([theLine, theArrow], backgroundPathOption);
47788
+ const polyline = new L.Polyline([theLine, theArrow], this.options);
47789
+ this.addLayer(invisibleBackgroundPolyline);
47790
+ this.addLayer(polyline);
47791
+ // that special case, where a circle has to be drawn on the source of the arrow
47792
+ if (this.options.drawSourceMarker) {
47793
+ if (typeof this._sourceMarker === 'undefined') {
47794
+ // use the same coloar as the arrow does
47795
+ this.options.sourceMarkerOptions.fillColor = this.color;
47796
+ this._sourceMarker = L.circleMarker(this._data.latlng, this.options.sourceMarkerOptions);
47797
+ }
47798
+ else {
47799
+ // there is a chance, that the latlng values have been changed by the setData-function
47800
+ this._sourceMarker.setLatLng(this._data.latlng);
47801
+ }
47802
+ }
47803
+ }
47804
+ },
47805
+ // custom methods
47806
+ // just change the angle of the arrow
47807
+ setAngle: function (angle) {
47808
+ if (isNaN(angle)) {
47809
+ this._data.angle = 0; // undefined direction.
47810
+ }
47811
+ else {
47812
+ if (this.options.isWindDegree) {
47813
+ this._data.angle = angle - 180;
47814
+ if (this.options.distanceUnit.toLowerCase() === 'px') {
47815
+ this._data.angle -= 90;
47816
+ }
47817
+ }
47818
+ else {
47819
+ this._data.angle = angle;
47820
+ }
47821
+ }
47822
+ this.redraw();
47823
+ },
47824
+ // just change the length of the arrow
47825
+ setDistance: function (distance) {
47826
+ if (isNaN(distance)) {
47827
+ this._data.distance = 0;
47828
+ }
47829
+ else {
47830
+ this._data.distance = parseFloat(distance);
47831
+ }
47832
+ this.redraw();
47833
+ },
47834
+ // use this method to update the whole dataset that corresponds to the arrow
47835
+ setData: function (data) {
47836
+ this._data = data;
47837
+ if (this.options.validator(this._data)) {
47838
+ this._data.valid = true;
47839
+ this.setAngle(data.degree);
47840
+ }
47841
+ else {
47842
+ this._data.valid = false;
47843
+ this._data.distance = NaN;
47844
+ this._data.degree = NaN;
47845
+ }
47846
+ },
47847
+ // private methods
47848
+ // When using Screen Pixels as unit, the arrows have to be
47849
+ // recalculated after the zoom level has changed
47850
+ _reset: function () {
47851
+ if (this.options.distanceUnit.toLowerCase() === 'px') {
47852
+ this.redraw();
47853
+ }
47854
+ },
47855
+ _calculateEndPoint: function (latlng, dist, degree) {
47856
+ /*
47857
+ * http://www.codeguru.com/cpp/cpp/algorithms/article.php/c5115/Geographic-Distance-and-Azimuth-Calculations.htm
47858
+ */
47859
+ // don't use this._data here.
47860
+ // this function is also used to find the points of the arrow
47861
+ let distance = dist * this.options.stretchFactor, d2r = Math.PI / 180, // degree 2 radius
47862
+ r2d = 180 / Math.PI;
47863
+ if (this.options.distanceUnit.toLowerCase() === 'km') {
47864
+ const R = 6378.137, // earth radius in kmeters
47865
+ bearing = degree * d2r;
47866
+ distance = distance / R;
47867
+ const a = Math.acos(Math.cos(distance) * Math.cos((90 - latlng.lat) * d2r) +
47868
+ Math.sin((90 - latlng.lat) * d2r) *
47869
+ Math.sin(distance) *
47870
+ Math.cos(bearing));
47871
+ const B = Math.asin((Math.sin(distance) * Math.sin(bearing)) / Math.sin(a));
47872
+ return new L.LatLng(90 - a * r2d, B * r2d + latlng.lng);
47873
+ }
47874
+ else if (this.options.distanceUnit.toLowerCase() === 'px') {
47875
+ const sourcePoint = this._map.latLngToLayerPoint(latlng);
47876
+ const rad = degree * d2r;
47877
+ const vector = L.point(Math.cos(rad) * distance, Math.sin(rad) * distance);
47878
+ const targetPoint = sourcePoint.add(vector);
47879
+ return this._map.layerPointToLatLng(targetPoint);
47880
+ }
47881
+ else {
47882
+ throw Error('calculate end point undefined for distanceUnit: ' +
47883
+ this.options.distanceUnit);
47884
+ }
47885
+ },
47886
+ _calculateArrowArray: function (latlng) {
47887
+ // calculates the Array for the arrow
47888
+ // latlng is the position, where the arrow is added
47889
+ const degree = this._data.angle;
47890
+ if (latlng.length !== undefined) {
47891
+ latlng = new L.LatLng(latlng);
47892
+ }
47893
+ const firstEdge = this._calculateEndPoint(latlng, this.options.arrowheadLength, degree - this.options.arrowheadDegree);
47894
+ const arr = [
47895
+ firstEdge,
47896
+ latlng,
47897
+ this._calculateEndPoint(latlng, this.options.arrowheadLength, degree + this.options.arrowheadDegree),
47898
+ ];
47899
+ if (this.options.arrowheadClosingLine) {
47900
+ arr.push(firstEdge);
47901
+ }
47902
+ return arr;
47903
+ },
47904
+ });
47905
+ return Arrow;
47906
+ }, window);
47907
+
47908
+ } (leafletArrows$2));
47909
+ return leafletArrows$2.exports;
47910
+ }
47911
+
47912
+ var leafletArrowsExports = requireLeafletArrows();
47913
+ var leafletArrows = /*@__PURE__*/getDefaultExportFromCjs(leafletArrowsExports);
47914
+
47915
+ var leafletArrows$1 = /*#__PURE__*/_mergeNamespaces({
47916
+ __proto__: null,
47917
+ default: leafletArrows
47918
+ }, [leafletArrowsExports]);
47919
+
46444
47920
  exports.Accordion = Accordion;
46445
47921
  exports.AlertDialog = alertDialog;
46446
47922
  exports.AlertStore = AlertStore;
@@ -46478,6 +47954,7 @@ exports.RootStore = RootStore;
46478
47954
  exports.Select = FormSelect;
46479
47955
  exports.StoreContext = StoreContext;
46480
47956
  exports.Tabs = Tabs;
47957
+ exports.TangramLayer = TangramLayer;
46481
47958
  exports.TextField = TextField;
46482
47959
  exports.UploadButton = UploadButton;
46483
47960
  exports._testApiKeys = _testApiKeys;