@performant-software/geospatial 1.2.0-beta.16 → 1.2.0-beta.18

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/build/index.js CHANGED
@@ -1,2 +1,2 @@
1
- (()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{DrawControl:()=>u,GeoJsonLayer:()=>v,LayerMenu:()=>R,Map:()=>D,MapControl:()=>_,MapDraw:()=>B,RasterLayer:()=>F});const r=require("@mapbox/mapbox-gl-draw");var n=e.n(r);const o=require("react");var a=e.n(o);const i=require("react-map-gl");var l=e.n(i);const u=(0,o.forwardRef)((function(e,t){var r=(0,i.useControl)((function(){return new(n())(e)}),(function(t){var r=t.map;r.on("draw.create",e.onCreate),r.on("draw.update",e.onUpdate),r.on("draw.delete",e.onDelete)}),(function(t){var r=t.map;r.off("draw.create",e.onCreate),r.off("draw.update",e.onUpdate),r.off("draw.delete",e.onDelete)}),{position:e.position});return(0,o.useImperativeHandle)(t,(function(){return r}),[r]),null})),c=require("underscore");var f=e.n(c);function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var y="#CC3333",m="#990000",p={"fill-color":y,"fill-opacity":.2},b={"line-color":m,"line-opacity":.6},d={"circle-radius":["interpolate",["linear"],["number",["get","point_count"],1],0,4,10,14],"circle-stroke-width":1,"circle-color":y,"circle-stroke-color":m};const v=function(e){var t,r,n=(t=(0,o.useState)(e.data),r=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw o}}return l}}(t,r)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?s(e,t):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),l=n[0],u=n[1],c=(0,o.useCallback)((function(e,t){return f().defaults(e,t)}),[]),y=(0,o.useMemo)((function(){return c(e.fillStyle,p)}),[c,e.fillStyle]),m=(0,o.useMemo)((function(){return c(e.lineStyle,b)}),[c,e.lineStyle]),v=(0,o.useMemo)((function(){return c(e.pointStyle,d)}),[c,e.pointStyle]);return(0,o.useEffect)((function(){e.url&&fetch(e.url).then((function(e){return e.json()})).then((function(e){return u(e)}))}),[e.url]),a().createElement(i.Source,{data:l,type:"geojson"},a().createElement(i.Layer,{filter:["!=","$type","Point"],paint:y,type:"fill"}),a().createElement(i.Layer,{filter:["!=","$type","Point"],paint:m,type:"line"}),a().createElement(i.Layer,{filter:["==","$type","Point"],paint:v,type:"circle"}))},h=require("react-icons/bs"),g=require("react-icons/io5"),S=require("maplibre-gl");var w=e.n(S);const O=require("react-dom");function j(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function E(e){return E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},E(e)}function C(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,A(n.key),n)}}function A(e){var t=function(e,t){if("object"!=E(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=E(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==E(t)?t:String(t)}var P=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._map=null,this._container=void 0,this._redraw=void 0,this._redraw=t}var t,r;return t=e,(r=[{key:"onAdd",value:function(e){return this._map=e,e.on("move",this._redraw),this._container=document.createElement("div"),this._container.className="maplibregl-ctrl-group maplibregl-ctrl",this._redraw(),this._container}},{key:"onRemove",value:function(){this._container.remove(),this._map.off("move",this._redraw),this._map=null}},{key:"getMap",value:function(){return this._map}},{key:"getElement",value:function(){return this._container}}])&&C(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();const _=function(e){var t,r,n=(t=(0,o.useState)(0),r=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw o}}return l}}(t,r)||function(e,t){if(e){if("string"==typeof e)return j(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?j(e,t):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[1],a=(0,o.useCallback)((function(){return n((function(e){return e+1}))}),[]),l=(0,i.useControl)((function(){return new P(a)}),{position:e.position}),u=l.getMap(),c=o.Children.map(f().compact(o.Children.toArray(e.children)),(function(e){return(0,o.cloneElement)(e,{map:u})}));return(0,o.useEffect)((function(){e.mapRef&&(e.mapRef.current=u)}),[u,e.mapRef]),u&&(0,O.createPortal)(c,l.getElement())};function k(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw o}}return l}}(e,t)||x(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function x(e,t){if(e){if("string"==typeof e)return M(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?M(e,t):void 0}}function M(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var I=function(e){var t=k((0,o.useState)(0),2),r=t[0],n=t[1],i=k((0,o.useState)(),2),l=i[0],u=i[1],c=k((0,o.useState)(!1),2),s=c[0],y=c[1],m=(0,o.useRef)(),p=(0,o.useCallback)((function(t){return e.names&&e.names.length>t&&e.names[t]}),[e.names]),b=(0,o.useCallback)((function(e){return f().includes(l,e)}),[l]),d=(0,o.useMemo)((function(){return o.Children.toArray(e.children)}),[e.children]),v=(0,o.useMemo)((function(){return f().filter(d,(function(e,t){return b(t)}))}),[d,b]),S=(0,o.useCallback)((function(e){var t,r;t=b(e)?f().without(l,e):[].concat(function(e){if(Array.isArray(e))return M(e)}(r=l)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(r)||x(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),[e]),u(t)}),[b,l]);return(0,o.useEffect)((function(){u(f().times(d.length,(function(e){return e})))}),[]),(0,o.useEffect)((function(){var e=m.current;if(e&&e._canvas){var t=m.current._canvas.offsetHeight;n(void 0===t?0:t)}}),[m.current]),f().isEmpty(d)?null:a().createElement(a().Fragment,null,a().createElement(_,{mapRef:m,position:e.position},a().createElement("button",{className:"mapbox-gl-draw_ctrl-draw-btn layer-button",onClick:function(){return y((function(e){return!e}))},type:"button"},a().createElement(h.BsStack,{size:"1.25em"})),s&&a().createElement("div",{className:"layer-menu",style:{maxHeight:"calc(".concat(r,"px - ").concat(30,"px)")}},a().createElement("div",{className:"menu"},f().map(d,(function(e,t){return a().createElement("div",{"aria-selected":b(t),className:"option",role:"option",onClick:function(){return S(t)},onKeyDown:function(){return S(t)},tabIndex:t},a().createElement("div",{className:"checkmark-container"},b(t)&&a().createElement(g.IoCheckmarkOutline,{size:"1em"})),p(t))}))))),v)};I.defaultProps={position:"top-left"};const R=I,z=require("@turf/turf"),D={getBoundingBox:function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=(0,z.bbox)(e),o=(0,z.bboxPolygon)(n);return t=r?(0,z.buffer)(o,r,{units:"miles"}):o,(0,z.bbox)(t)}};function T(e){return T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},T(e)}function L(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function q(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return N(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?N(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function N(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}n().constants.classes.CONTROL_BASE="maplibregl-ctrl",n().constants.classes.CONTROL_PREFIX="maplibregl-ctrl-",n().constants.classes.CONTROL_GROUP="maplibregl-ctrl-group";var U=function(e){var t=q((0,o.useState)(!1),2),r=t[0],n=t[1],i=(0,o.useRef)(),c=(0,o.useRef)(),s=(0,o.useCallback)((function(){e.onChange(i.current.getAll())}),[e.onChange]),y=(0,o.useMemo)((function(){return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?L(Object(r),!0).forEach((function(t){var n,o,a,i;n=e,o=t,a=r[t],i=function(e,t){if("object"!=T(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=T(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(o),(o="symbol"==T(i)?i:String(i))in n?Object.defineProperty(n,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[o]=a})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):L(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({height:500,width:"100%"},e.style||{})}),[e.style]);return(0,o.useEffect)((function(){if(r&&e.data){var t=D.getBoundingBox(e.data,e.buffer);if(f().every(t,f().isFinite)){var n=q(t,4),o=[[n[0],n[1]],[n[2],n[3]]];c.current.fitBounds(o,{duration:e.zoomDuration})}"GeometryCollection"===e.data.type?f().each(e.data.geometries,(function(e){i.current.add((0,z.feature)(e))})):i.current.add(e.data)}}),[r,e.data]),a().createElement(l(),{attributionControl:!1,onLoad:function(){return n(!0)},mapLib:w(),ref:c,style:y,mapStyle:e.mapStyle},a().createElement(u,{ref:i,controls:{line_string:!0,point:!0,polygon:!0,trash:!0},displayControlsDefault:!1,onCreate:s,onUpdate:s,onDelete:s,position:"bottom-left"}),e.children)};U.defaultProps={buffer:2,zoomDuration:1e3};const B=U;var $=function(e){return a().createElement(i.Source,{tileSize:e.tileSize,tiles:[e.url],type:"raster"},a().createElement(i.Layer,{type:"raster",paint:{"raster-opacity":e.opacity},minzoom:e.minzoom,maxzoom:e.maxzoom}))};$.defaultProps={maxzoom:22,minzoom:0,opacity:.7,tileSize:256};const F=$;module.exports=t})();
1
+ (()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{DrawControl:()=>u,GeoJsonLayer:()=>v,LayerMenu:()=>L,LocationMarker:()=>q,Map:()=>D,MapControl:()=>_,MapDraw:()=>G,RasterLayer:()=>J});const r=require("@mapbox/mapbox-gl-draw");var n=e.n(r);const o=require("react");var a=e.n(o);const i=require("react-map-gl");var l=e.n(i);const u=(0,o.forwardRef)((function(e,t){var r=(0,i.useControl)((function(){return new(n())(e)}),(function(t){var r=t.map;r.on("draw.create",e.onCreate),r.on("draw.update",e.onUpdate),r.on("draw.delete",e.onDelete)}),(function(t){var r=t.map;r.off("draw.create",e.onCreate),r.off("draw.update",e.onUpdate),r.off("draw.delete",e.onDelete)}),{position:e.position});return(0,o.useImperativeHandle)(t,(function(){return r}),[r]),null})),c=require("underscore");var f=e.n(c);function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var y="#CC3333",m="#990000",p={"fill-color":y,"fill-opacity":.2},b={"line-color":m,"line-opacity":.6},d={"circle-radius":["interpolate",["linear"],["number",["get","point_count"],1],0,4,10,14],"circle-stroke-width":1,"circle-color":y,"circle-stroke-color":m};const v=function(e){var t,r,n=(t=(0,o.useState)(e.data),r=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw o}}return l}}(t,r)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?s(e,t):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),l=n[0],u=n[1],c=(0,o.useCallback)((function(e,t){return f().defaults(e,t)}),[]),y=(0,o.useMemo)((function(){return c(e.fillStyle,p)}),[c,e.fillStyle]),m=(0,o.useMemo)((function(){return c(e.lineStyle,b)}),[c,e.lineStyle]),v=(0,o.useMemo)((function(){return c(e.pointStyle,d)}),[c,e.pointStyle]);return(0,o.useEffect)((function(){e.url&&fetch(e.url).then((function(e){return e.json()})).then((function(e){return u(e)}))}),[e.url]),a().createElement(i.Source,{data:l,type:"geojson"},a().createElement(i.Layer,{filter:["!=","$type","Point"],paint:y,type:"fill"}),a().createElement(i.Layer,{filter:["!=","$type","Point"],paint:m,type:"line"}),a().createElement(i.Layer,{filter:["==","$type","Point"],paint:v,type:"circle"}))},h=require("react-icons/bs"),g=require("react-icons/io5"),S=require("maplibre-gl");var w=e.n(S);const O=require("react-dom");function j(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function E(e){return E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},E(e)}function C(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,A(n.key),n)}}function A(e){var t=function(e,t){if("object"!=E(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=E(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==E(t)?t:String(t)}var P=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._map=null,this._container=void 0,this._redraw=void 0,this._redraw=t}var t,r;return t=e,(r=[{key:"onAdd",value:function(e){return this._map=e,e.on("move",this._redraw),this._container=document.createElement("div"),this._container.className="maplibregl-ctrl-group maplibregl-ctrl",this._redraw(),this._container}},{key:"onRemove",value:function(){this._container.remove(),this._map.off("move",this._redraw),this._map=null}},{key:"getMap",value:function(){return this._map}},{key:"getElement",value:function(){return this._container}}])&&C(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();const _=function(e){var t,r,n=(t=(0,o.useState)(0),r=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw o}}return l}}(t,r)||function(e,t){if(e){if("string"==typeof e)return j(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?j(e,t):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[1],a=(0,o.useCallback)((function(){return n((function(e){return e+1}))}),[]),l=(0,i.useControl)((function(){return new P(a)}),{position:e.position}),u=l.getMap(),c=o.Children.map(f().compact(o.Children.toArray(e.children)),(function(e){return(0,o.cloneElement)(e,{map:u})}));return(0,o.useEffect)((function(){e.mapRef&&(e.mapRef.current=u)}),[u,e.mapRef]),u&&(0,O.createPortal)(c,l.getElement())};function k(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw o}}return l}}(e,t)||x(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function x(e,t){if(e){if("string"==typeof e)return M(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?M(e,t):void 0}}function M(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var I=function(e){var t=k((0,o.useState)(0),2),r=t[0],n=t[1],i=k((0,o.useState)(),2),l=i[0],u=i[1],c=k((0,o.useState)(!1),2),s=c[0],y=c[1],m=(0,o.useRef)(),p=(0,o.useCallback)((function(t){return e.names&&e.names.length>t&&e.names[t]}),[e.names]),b=(0,o.useCallback)((function(e){return f().includes(l,e)}),[l]),d=(0,o.useMemo)((function(){return o.Children.toArray(e.children)}),[e.children]),v=(0,o.useMemo)((function(){return f().filter(d,(function(e,t){return b(t)}))}),[d,b]),S=(0,o.useCallback)((function(e){var t,r;t=b(e)?f().without(l,e):[].concat(function(e){if(Array.isArray(e))return M(e)}(r=l)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(r)||x(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),[e]),u(t)}),[b,l]);return(0,o.useEffect)((function(){u(f().times(d.length,(function(e){return e})))}),[]),(0,o.useEffect)((function(){var e=m.current;if(e&&e._canvas){var t=m.current._canvas.offsetHeight;n(void 0===t?0:t)}}),[m.current]),f().isEmpty(d)?null:a().createElement(a().Fragment,null,a().createElement(_,{mapRef:m,position:e.position},a().createElement("button",{className:"mapbox-gl-draw_ctrl-draw-btn layer-button",onClick:function(){return y((function(e){return!e}))},type:"button"},a().createElement(h.BsStack,{size:"1.25em"})),s&&a().createElement("div",{className:"layer-menu",style:{maxHeight:"calc(".concat(r,"px - ").concat(30,"px)")}},a().createElement("div",{className:"menu"},f().map(d,(function(e,t){return a().createElement("div",{"aria-selected":b(t),className:"option",role:"option",onClick:function(){return S(t)},onKeyDown:function(){return S(t)},tabIndex:t},a().createElement("div",{className:"checkmark-container"},b(t)&&a().createElement(g.IoCheckmarkOutline,{size:"1em"})),p(t))}))))),v)};I.defaultProps={position:"top-left"};const L=I,R=require("@peripleo/maplibre"),z=require("@turf/turf"),D={getBoundingBox:function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=(0,z.bbox)(e),o=(0,z.bboxPolygon)(n);return t=r?(0,z.buffer)(o,r,{units:"miles"}):o,(0,z.bbox)(t)}};var T=function(e){return(0,o.useEffect)((function(){if(e.map&&e.data){var t=D.getBoundingBox(e.data,e.buffer);e.map.fitBounds(t)}}),[e.buffer,e.data,e.map]),a().createElement(a().Fragment,null,a().createElement(R.PulsingMarkerLayer,{id:"current",data:e.data}),a().createElement(R.MixedGeoJSONLayer,{id:"current",data:e.data,fillStyle:e.fillStyle,strokeStyle:e.strokeStyle,pointStyle:e.pointStyle}))};T.defaultProps={buffer:2,fillStyle:{type:"fill",paint:{"fill-color":"#ff623b","fill-opacity":.2}},pointStyle:{type:"circle",paint:{"circle-radius":["interpolate",["linear"],["number",["get","point_count"],1],0,4,10,14],"circle-stroke-width":1,"circle-color":["case",["boolean",["feature-state","hover"],!1],"#3b62ff","#ff623b"],"circle-stroke-color":"#8d260c"}},strokeStyle:{type:"line",paint:{"line-color":"#ff623b","line-opacity":.6}}};const q=T;function B(e){return B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},B(e)}function N(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function U(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return $(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?$(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}n().constants.classes.CONTROL_BASE="maplibregl-ctrl",n().constants.classes.CONTROL_PREFIX="maplibregl-ctrl-",n().constants.classes.CONTROL_GROUP="maplibregl-ctrl-group";var F=function(e){var t=U((0,o.useState)(!1),2),r=t[0],n=t[1],i=(0,o.useRef)(),c=(0,o.useRef)(),s=(0,o.useCallback)((function(){e.onChange(i.current.getAll())}),[e.onChange]),y=(0,o.useMemo)((function(){return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?N(Object(r),!0).forEach((function(t){var n,o,a,i;n=e,o=t,a=r[t],i=function(e,t){if("object"!=B(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=B(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(o),(o="symbol"==B(i)?i:String(i))in n?Object.defineProperty(n,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[o]=a})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):N(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({height:500,width:"100%"},e.style||{})}),[e.style]);return(0,o.useEffect)((function(){if(r&&e.data){var t=D.getBoundingBox(e.data,e.buffer);if(f().every(t,f().isFinite)){var n=U(t,4),o=[[n[0],n[1]],[n[2],n[3]]];c.current.fitBounds(o,{duration:e.zoomDuration})}"GeometryCollection"===e.data.type?f().each(e.data.geometries,(function(e){i.current.add((0,z.feature)(e))})):i.current.add(e.data)}}),[r,e.data]),a().createElement(l(),{attributionControl:!1,onLoad:function(){return n(!0)},mapLib:w(),ref:c,style:y,mapStyle:e.mapStyle},a().createElement(u,{ref:i,controls:{line_string:!0,point:!0,polygon:!0,trash:!0},displayControlsDefault:!1,onCreate:s,onUpdate:s,onDelete:s,position:"bottom-left"}),e.children)};F.defaultProps={buffer:2,zoomDuration:1e3};const G=F;var H=function(e){return a().createElement(i.Source,{tileSize:e.tileSize,tiles:[e.url],type:"raster"},a().createElement(i.Layer,{type:"raster",paint:{"raster-opacity":e.opacity},minzoom:e.minzoom,maxzoom:e.maxzoom}))};H.defaultProps={maxzoom:22,minzoom:0,opacity:.7,tileSize:256};const J=H;module.exports=t})();
2
2
  //# sourceM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AAA,GAAQA,EAAA,IACa,CADLA,EAAA,GAAQA,EAAA,KAGrChE,EAAOC,QAAQiE,UAAUD,EAAQ,CAAEE,SAAUrI,EAAMsI,cACrD,CA5CgB,uBA+CZtI,EAAMsB,KAAKmB,KACbb,IAAAA,KAAO5B,EAAMsB,KAAKiH,YAAY,SAAC9B,GAC7BvG,EAAQiE,QAAQqE,KAAIC,EAAAA,EAAAA,SAAQhC,GAC9B,IAEAvG,EAAQiE,QAAQqE,IAAIxI,EAAMsB,KAE9B,CACF,GAAG,CAACmG,EAAQzH,EAAMsB,OAGhBiB,IAAAA,cAACmG,IAAG,CACFC,oBAAoB,EACpBC,OAAQ,kBAAMlB,GAAU,EAAK,EAC7BmB,OAAQC,IACR7I,IAAKiE,EACLxC,MAAOA,EACPqH,SAAU/I,EAAM+I,UAEhBxG,IAAAA,cAACyG,EAAW,CACV/I,IAAKC,EACL+I,SAAU,CACRC,aAAa,EACbC,OAAO,EACPnC,SAAS,EACToC,OAAO,GAETC,wBAAwB,EACxB7I,SAAUmH,EACVlH,SAAUkH,EACVjH,SAAUiH,EACV9G,SAAS,gBAETb,EAAM6D,SAGd,EAEA2D,EAAQjB,aAAe,CACrBW,OA1FqB,EA2FrBoB,aA1FyB,KA6F3B,UChJA,IAAMgB,EAAc,SAACtJ,GAAY,OAC/BuC,IAAAA,cAACC,EAAAA,OAAM,CACL+G,SAAUvJ,EAAMuJ,SAChBC,MAAO,CAACxJ,EAAMkC,KACdO,KAAK,UAELF,IAAAA,cAACG,EAAAA,MAAK,CACJD,KAAK,SACLG,MAAO,CACL,iBAAkB5C,EAAMyJ,SAE1BC,QAAS1J,EAAM0J,QACfC,QAAS3J,EAAM2J,UAEV,EAGXL,EAAY/C,aAAe,CACzBoD,QAAS,GACTD,QAAS,EACTD,QAAS,GACTF,SAAU,KAGZ,U","sources":["webpack://@performant-software/geospatial/webpack/bootstrap","webpack://@performant-software/geospatial/webpack/runtime/compat get default export","webpack://@performant-software/geospatial/webpack/runtime/define property getters","webpack://@performant-software/geospatial/webpack/runtime/hasOwnProperty shorthand","webpack://@performant-software/geospatial/webpack/runtime/make namespace object","webpack://@performant-software/geospatial/external commonjs \"@mapbox/mapbox-gl-draw\"","webpack://@performant-software/geospatial/external commonjs2 \"react\"","webpack://@performant-software/geospatial/external commonjs \"react-map-gl\"","webpack://@performant-software/geospatial/./src/components/DrawControl.js","webpack://@performant-software/geospatial/external commonjs \"underscore\"","webpack://@performant-software/geospatial/./src/components/GeoJsonLayer.js","webpack://@performant-software/geospatial/external commonjs \"react-icons/bs\"","webpack://@performant-software/geospatial/external commonjs \"react-icons/io5\"","webpack://@performant-software/geospatial/external commonjs \"maplibre-gl\"","webpack://@performant-software/geospatial/external commonjs2 \"react-dom\"","webpack://@performant-software/geospatial/./src/components/MapControl.js","webpack://@performant-software/geospatial/./src/components/LayerMenu.js","webpack://@performant-software/geospatial/external commonjs \"@turf/turf\"","webpack://@performant-software/geospatial/./src/utils/Map.js","webpack://@performant-software/geospatial/./src/components/MapDraw.js","webpack://@performant-software/geospatial/./src/components/RasterLayer.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@mapbox/mapbox-gl-draw\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react-map-gl\");","// @flow\n\nimport MapboxDraw from '@mapbox/mapbox-gl-draw';\nimport { forwardRef, useImperativeHandle } from 'react';\nimport { useControl, type ControlPosition, type MapRef } from 'react-map-gl';\n\ntype Props = {\n position?: ControlPosition;\n onCreate?: (evt: { features: Array<any> }) => void;\n onUpdate?: (evt: { features: Array<any>, action: string }) => void;\n onDelete?: (evt: { features: Array<any> }) => void;\n};\n\nconst DrawControl = forwardRef((props: Props, ref) => {\n /**\n * Creates the drawer ref using MapboxDraw.\n */\n const drawRef = useControl(\n () => new MapboxDraw(props),\n ({ map }: { map: MapRef }) => {\n map.on('draw.create', props.onCreate);\n map.on('draw.update', props.onUpdate);\n map.on('draw.delete', props.onDelete);\n },\n ({ map }: { map: MapRef }) => {\n map.off('draw.create', props.onCreate);\n map.off('draw.update', props.onUpdate);\n map.off('draw.delete', props.onDelete);\n },\n {\n position: props.position\n }\n );\n\n /**\n * Exposes the ref for the MapboxDraw object.\n */\n useImperativeHandle(ref, () => drawRef, [drawRef]);\n\n return null;\n});\n\nexport default DrawControl;\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"underscore\");","// @flow\n\nimport React, {\n useCallback,\n useEffect,\n useMemo,\n useState\n} from 'react';\nimport { Layer, Source } from 'react-map-gl';\nimport _ from 'underscore';\n\ntype Props = {\n data?: { [key: string]: any },\n fillStyle?: { [key: string]: any },\n lineStyle?: { [key: string]: any },\n pointStyle?: { [key: string]: any },\n url?: string\n};\n\nconst DEFAULT_COLOR = '#CC3333';\nconst HIGHLIGHT_COLOR = '#990000';\n\nconst DEFAULT_FILL_STYLES = {\n 'fill-color': DEFAULT_COLOR,\n 'fill-opacity': 0.2\n};\n\nconst DEFAULT_LINE_STYLES = {\n 'line-color': HIGHLIGHT_COLOR,\n 'line-opacity': 0.6\n};\n\nconst DEFAULT_POINT_STYLES = {\n 'circle-radius': [\n 'interpolate',\n ['linear'],\n ['number', ['get', 'point_count'], 1],\n 0, 4,\n 10, 14\n ],\n 'circle-stroke-width': 1,\n 'circle-color': DEFAULT_COLOR,\n 'circle-stroke-color': HIGHLIGHT_COLOR\n};\n\nconst GeoJsonLayer = (props: Props) => {\n const [data, setData] = useState(props.data);\n\n /**\n * Returns the layer style for the passed style and default.\n *\n * @type {function(*, *): *}\n */\n const getLayerStyles = useCallback((style, defaultStyle) => _.defaults(style, defaultStyle), []);\n\n /**\n * Sets the fill layer style.\n *\n * @type {*}\n */\n const fillStyle = useMemo(() => (\n getLayerStyles(props.fillStyle, DEFAULT_FILL_STYLES)\n ), [getLayerStyles, props.fillStyle]);\n\n /**\n * Sets the line layer style.\n *\n * @type {*}\n */\n const lineStyle = useMemo(() => (\n getLayerStyles(props.lineStyle, DEFAULT_LINE_STYLES)\n ), [getLayerStyles, props.lineStyle]);\n\n /**\n * Sets the point layer style.\n *\n * @type {*}\n */\n const pointStyle = useMemo(() => (\n getLayerStyles(props.pointStyle, DEFAULT_POINT_STYLES)\n ), [getLayerStyles, props.pointStyle]);\n\n /**\n * If the data is passed as a URL, fetches the passed URL and sets the response on the state.\n */\n useEffect(() => {\n if (props.url) {\n fetch(props.url)\n .then((response) => response.json())\n .then((json) => setData(json));\n }\n }, [props.url]);\n\n return (\n <Source\n data={data}\n type='geojson'\n >\n <Layer\n filter={['!=', '$type', 'Point']}\n paint={fillStyle}\n type='fill'\n />\n <Layer\n filter={['!=', '$type', 'Point']}\n paint={lineStyle}\n type='line'\n />\n <Layer\n filter={['==', '$type', 'Point']}\n paint={pointStyle}\n type='circle'\n />\n </Source>\n );\n};\n\nexport default GeoJsonLayer;\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react-icons/bs\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react-icons/io5\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"maplibre-gl\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react-dom\");","// @flow\n\nimport { IControl } from 'maplibre-gl';\nimport {\n Children,\n cloneElement,\n useCallback,\n useEffect,\n useState\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { MapboxMap, useControl } from 'react-map-gl';\nimport _ from 'underscore';\n\n/**\n * Class to implement the IControl interface to allow custom controls to be drawn on the map.\n */\nclass IControlImpl implements IControl {\n _map: MapboxMap = null;\n _container: HTMLElement;\n _redraw: () => void;\n\n /**\n * Constructs a new IControlImpl object.\n *\n * @param redraw\n */\n constructor(redraw: () => void) {\n this._redraw = redraw;\n }\n\n /**\n * Creates the container when the component is added to the passed map.\n *\n * @param map\n *\n * @returns {HTMLElement}\n */\n onAdd(map) {\n this._map = map;\n map.on('move', this._redraw);\n\n this._container = document.createElement('div');\n this._container.className = 'maplibregl-ctrl-group maplibregl-ctrl';\n this._redraw();\n return this._container;\n }\n\n /**\n * Removes the container when the component is removed from the map.\n */\n onRemove() {\n this._container.remove();\n this._map.off('move', this._redraw);\n this._map = null;\n }\n\n /**\n * Returns the map instance.\n *\n * @returns {mapboxgl.Map}\n */\n getMap() {\n return this._map;\n }\n\n /**\n * Returns the container instance.\n *\n * @returns {HTMLElement}\n */\n getElement() {\n return this._container;\n }\n}\n\nconst MapControl = (props) => {\n const [, setVersion] = useState(0);\n\n /**\n * Forces the component to re-render on map move.\n *\n * @type {function(): void}\n */\n const forceUpdate = useCallback(() => setVersion((v) => v + 1), []);\n\n /**\n * Creates the map control.\n *\n * @type {IControlImpl}\n */\n const ctrl = useControl(() => new IControlImpl(forceUpdate), { position: props.position });\n\n /**\n * Sets the map instance.\n *\n * @type {mapboxgl.Map}\n */\n const map = ctrl.getMap();\n\n /**\n * Creates the list of children to be added to the map instance.\n *\n * @type {Array<$NonMaybeType<*>>}\n */\n const children = Children.map(_.compact(Children.toArray(props.children)), (child) => cloneElement(child, { map }));\n\n /**\n * Sets the map ref.\n */\n useEffect(() => {\n if (props.mapRef) {\n // eslint-disable-next-line no-param-reassign\n props.mapRef.current = map;\n }\n }, [map, props.mapRef]);\n\n return map && createPortal(children, ctrl.getElement());\n};\n\nexport default MapControl;\n","// @flow\n\nimport React, {\n Children,\n useCallback,\n useEffect,\n useMemo, useRef,\n useState\n} from 'react';\nimport { BsStack } from 'react-icons/bs';\nimport { IoCheckmarkOutline } from 'react-icons/io5';\nimport _ from 'underscore';\nimport MapControl from './MapControl';\nimport './LayerMenu.css';\n\ntype Props = {\n children: Node,\n names: Array<string>,\n position: 'top-left' | 'bottom-left' | 'top-right' | 'bottom-right'\n};\n\nconst MENU_PADDING = 30;\n\nconst LayerMenu = (props: Props) => {\n const [canvasHeight, setCanvasHeight] = useState(0);\n const [visible, setVisible] = useState();\n const [menuOpen, setMenuOpen] = useState(false);\n\n const mapRef = useRef();\n\n /**\n * Returns the name of the layer at the passed index.\n *\n * @type {unknown}\n */\n const getLayerName = useCallback((index) => (\n props.names && props.names.length > index && props.names[index]\n ), [props.names]);\n\n /**\n * Returns true if the child element at the passed index is visible.\n *\n * @type {function(*): *}\n */\n const isVisible = useCallback((index) => _.includes(visible, index), [visible]);\n\n /**\n * Returns a memoized array of the child elements.\n *\n * @type {Array<$NonMaybeType<unknown>>}\n */\n const children = useMemo(() => Children.toArray(props.children), [props.children]);\n\n /**\n * Returns a memoized array of visible child elements.\n */\n const visibleChildren = useMemo(() => _.filter(children, (child, index) => isVisible(index)), [children, isVisible]);\n\n /**\n * Toggles the visibility for the child element at the passed index.\n *\n * @type {(function(*): void)|*}\n */\n const toggleVisibility = useCallback((index) => {\n let value;\n\n if (isVisible(index)) {\n value = _.without(visible, index);\n } else {\n value = [...visible, index];\n }\n\n setVisible(value);\n }, [isVisible, visible]);\n\n /**\n * Sets all of the child elements to be visible when the component mounts.\n */\n useEffect(() => {\n setVisible(_.times(children.length, (index) => index));\n }, []);\n\n /**\n * Sets the map canvas height.\n */\n useEffect(() => {\n const { current: instance } = mapRef;\n\n if (instance && instance._canvas) {\n const { offsetHeight = 0 } = mapRef.current._canvas;\n setCanvasHeight(offsetHeight);\n }\n }, [mapRef.current]);\n\n if (_.isEmpty(children)) {\n return null;\n }\n\n return (\n <>\n <MapControl\n mapRef={mapRef}\n position={props.position}\n >\n <button\n className='mapbox-gl-draw_ctrl-draw-btn layer-button'\n onClick={() => setMenuOpen((prevMenuOpen) => !prevMenuOpen)}\n type='button'\n >\n <BsStack\n size='1.25em'\n />\n </button>\n { menuOpen && (\n <div\n className='layer-menu'\n style={{\n maxHeight: `calc(${canvasHeight}px - ${MENU_PADDING}px)`\n }}\n >\n <div\n className='menu'\n >\n { _.map(children, (child, index) => (\n <div\n aria-selected={isVisible(index)}\n className='option'\n role='option'\n onClick={() => toggleVisibility(index)}\n onKeyDown={() => toggleVisibility(index)}\n tabIndex={index}\n >\n <div\n className='checkmark-container'\n >\n { isVisible(index) && (\n <IoCheckmarkOutline\n size='1em'\n />\n )}\n </div>\n { getLayerName(index) }\n </div>\n ))}\n </div>\n </div>\n )}\n </MapControl>\n { visibleChildren }\n </>\n );\n};\n\nLayerMenu.defaultProps = {\n position: 'top-left'\n};\n\nexport default LayerMenu;\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@turf/turf\");","// @flow\n\nimport { bbox, bboxPolygon, buffer } from '@turf/turf';\n\n/**\n * Returns a bounding box for the passed geometry (with optional buffer).\n *\n * @param geometry\n * @param bufferDistance\n *\n * @returns {BBox}\n */\nconst getBoundingBox = (geometry, bufferDistance = null) => {\n // Convert the GeoJSON into a bounding box\n const box = bbox(geometry);\n\n // Convert the bounding box to a polygon\n const polygon = bboxPolygon(box);\n\n // Create a buffer around the polygon (if a distance is provided)\n let polygonBuffer;\n\n if (bufferDistance) {\n polygonBuffer = buffer(polygon, bufferDistance, { units: 'miles' });\n } else {\n polygonBuffer = polygon;\n }\n\n // Convert the buffer to a bounding box\n return bbox(polygonBuffer);\n};\n\nexport default {\n getBoundingBox\n};\n","// @flow\n\nimport MapboxDraw from '@mapbox/mapbox-gl-draw';\nimport { feature, type FeatureCollection, type GeometryCollection } from '@turf/turf';\nimport maplibregl from 'maplibre-gl';\nimport React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type Node\n} from 'react';\nimport Map, { MapRef } from 'react-map-gl';\nimport _ from 'underscore';\nimport DrawControl from './DrawControl';\nimport MapUtils from '../utils/Map';\nimport './MapDraw.css';\n\n// Override the MapboxDraw components to use MapLibre styles\nMapboxDraw.constants.classes.CONTROL_BASE = 'maplibregl-ctrl';\nMapboxDraw.constants.classes.CONTROL_PREFIX = 'maplibregl-ctrl-';\nMapboxDraw.constants.classes.CONTROL_GROUP = 'maplibregl-ctrl-group';\n\ntype Props = {\n /**\n * The number of miles to buffer the GeoJSON data.\n */\n buffer?: number,\n\n /**\n * Additional child nodes to render.\n */\n children?: Node,\n\n /**\n * GeoJSON structured data to be displayed on the map.\n */\n data: GeometryCollection | FeatureCollection,\n\n /**\n * URL of the map style to render. This URL should contain any necessary API keys.\n */\n mapStyle: string,\n\n /**\n * Callback fired when the map geometries are changed.\n *\n * @param features\n */\n onChange: (features: Array<any>) => void,\n\n /**\n * Map style object.\n */\n style?: any,\n\n /**\n * The time in milliseconds to zoom into the location.\n */\n zoomDuration?: number\n};\n\nconst DEFAULT_BUFFER = 2;\nconst DEFAULT_ZOOM_DELAY = 1000;\n\nconst GeometryTypes = {\n geometryCollection: 'GeometryCollection',\n point: 'Point'\n};\n\n/**\n * This component renders a map with controls for drawing one or more geometries. Geometries can be a point (lat/long),\n * a line, or a polygon.\n */\nconst MapDraw = (props: Props) => {\n const [loaded, setLoaded] = useState(false);\n\n const drawRef = useRef<MapboxDraw>();\n const mapRef = useRef<MapRef>();\n\n /**\n * Calls the onChange prop with all of the geometries in the current drawer.\n *\n * @type {(function(): void)|*}\n */\n const onChange = useCallback(() => {\n props.onChange(drawRef.current.getAll());\n }, [props.onChange]);\n\n /**\n * Sets the map style.\n *\n * @type {{width: string, height: number}}\n */\n const style = useMemo(() => ({ height: 500, width: '100%', ...(props.style || {}) }), [props.style]);\n\n /**\n * Updates the map bounding box and drawer when the geometry is changed.\n */\n useEffect(() => {\n if (loaded && props.data) {\n // Get the bounding box for the passed data\n const boundingBox = MapUtils.getBoundingBox(props.data, props.buffer);\n\n // Sets the bounding box for the current geometry\n if (_.every(boundingBox, _.isFinite)) {\n const [minLng, minLat, maxLng, maxLat] = boundingBox;\n const bounds = [[minLng, minLat], [maxLng, maxLat]];\n\n mapRef.current.fitBounds(bounds, { duration: props.zoomDuration });\n }\n\n // Handle special cases for geometry collection (not supported by mabox-gl-draw) and point\n if (props.data.type === GeometryTypes.geometryCollection) {\n _.each(props.data.geometries, (geometry) => {\n drawRef.current.add(feature(geometry));\n });\n } else {\n drawRef.current.add(props.data);\n }\n }\n }, [loaded, props.data]);\n\n return (\n <Map\n attributionControl={false}\n onLoad={() => setLoaded(true)}\n mapLib={maplibregl}\n ref={mapRef}\n style={style}\n mapStyle={props.mapStyle}\n >\n <DrawControl\n ref={drawRef}\n controls={{\n line_string: true,\n point: true,\n polygon: true,\n trash: true\n }}\n displayControlsDefault={false}\n onCreate={onChange}\n onUpdate={onChange}\n onDelete={onChange}\n position='bottom-left'\n />\n { props.children }\n </Map>\n );\n};\n\nMapDraw.defaultProps = {\n buffer: DEFAULT_BUFFER,\n zoomDuration: DEFAULT_ZOOM_DELAY\n};\n\nexport default MapDraw;\n","// @flow\n\nimport React from 'react';\nimport { Layer, Source } from 'react-map-gl';\n\ntype Props = {\n maxzoom?: number,\n minzoom?: number,\n opacity?: number,\n tileSize?: number,\n url?: string,\n};\n\nconst RasterLayer = (props: Props) => (\n <Source\n tileSize={props.tileSize}\n tiles={[props.url]}\n type='raster'\n >\n <Layer\n type='raster'\n paint={{\n 'raster-opacity': props.opacity\n }}\n minzoom={props.minzoom}\n maxzoom={props.maxzoom}\n />\n </Source>\n);\n\nRasterLayer.defaultProps = {\n maxzoom: 22,\n minzoom: 0,\n opacity: 0.7,\n tileSize: 256\n};\n\nexport default RasterLayer;\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","require","forwardRef","props","ref","drawRef","useControl","MapboxDraw","_ref","map","on","onCreate","onUpdate","onDelete","_ref2","off","position","useImperativeHandle","DEFAULT_COLOR","HIGHLIGHT_COLOR","DEFAULT_FILL_STYLES","DEFAULT_LINE_STYLES","DEFAULT_POINT_STYLES","_useState2","useState","data","setData","getLayerStyles","useCallback","style","defaultStyle","_","fillStyle","useMemo","lineStyle","pointStyle","useEffect","url","fetch","then","response","json","React","Source","type","Layer","filter","paint","IControlImpl","redraw","_classCallCheck","_map","_container","_redraw","this","document","createElement","className","remove","setVersion","forceUpdate","v","ctrl","getMap","children","Children","toArray","child","cloneElement","mapRef","current","createPortal","getElement","LayerMenu","_slicedToArray","canvasHeight","setCanvasHeight","_useState4","visible","setVisible","_useState6","menuOpen","setMenuOpen","useRef","getLayerName","index","names","length","isVisible","visibleChildren","toggleVisibility","concat","instance","_canvas","_mapRef$current$_canv","offsetHeight","MapControl","onClick","prevMenuOpen","BsStack","size","maxHeight","role","onKeyDown","tabIndex","IoCheckmarkOutline","defaultProps","getBoundingBox","geometry","polygonBuffer","bufferDistance","arguments","undefined","box","bbox","polygon","bboxPolygon","buffer","units","classes","CONTROL_BASE","CONTROL_PREFIX","CONTROL_GROUP","MapDraw","loaded","setLoaded","onChange","getAll","_objectSpread","height","width","boundingBox","MapUtils","_boundingBox","bounds","fitBounds","duration","zoomDuration","geometries","add","feature","Map","attributionControl","onLoad","mapLib","maplibregl","mapStyle","DrawControl","controls","line_string","point","trash","displayControlsDefault","RasterLayer","tileSize","tiles","opacity","minzoom","maxzoom"],"sourceRoot":""}
1
+ {"version":3,"file":"index.js","mappings":"mBACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,Q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AQ,kBAAMf,GAAU,EAAK,EAC7BgB,OAAQC,IACRlJ,IAAKiE,EACLxC,MAAOA,EACP0H,SAAUpJ,EAAMoJ,UAEhB7G,IAAAA,cAAC8G,EAAW,CACVpJ,IAAKC,EACLoJ,SAAU,CACRC,aAAa,EACbC,OAAO,EACPxC,SAAS,EACTyC,OAAO,GAETC,wBAAwB,EACxBlJ,SAAU2H,EACV1H,SAAU0H,EACVzH,SAAUyH,EACVtH,SAAS,gBAETb,EAAM6D,SAGd,EAEAmE,EAAQzB,aAAe,CACrBW,OA1FqB,EA2FrByB,aA1FyB,KA6F3B,UChJA,IAAMgB,EAAc,SAAC3J,GAAY,OAC/BuC,IAAAA,cAACC,EAAAA,OAAM,CACLoH,SAAU5J,EAAM4J,SAChBC,MAAO,CAAC7J,EAAMkC,KACdO,KAAK,UAELF,IAAAA,cAACG,EAAAA,MAAK,CACJD,KAAK,SACLG,MAAO,CACL,iBAAkB5C,EAAM8J,SAE1BC,QAAS/J,EAAM+J,QACfC,QAAShK,EAAMgK,UAEV,EAGXL,EAAYpD,aAAe,CACzByD,QAAS,GACTD,QAAS,EACTD,QAAS,GACTF,SAAU,KAGZ,U","sources":["webpack://@performant-software/geospatial/webpack/bootstrap","webpack://@performant-software/geospatial/webpack/runtime/compat get default export","webpack://@performant-software/geospatial/webpack/runtime/define property getters","webpack://@performant-software/geospatial/webpack/runtime/hasOwnProperty shorthand","webpack://@performant-software/geospatial/webpack/runtime/make namespace object","webpack://@performant-software/geospatial/external commonjs \"@mapbox/mapbox-gl-draw\"","webpack://@performant-software/geospatial/external commonjs2 \"react\"","webpack://@performant-software/geospatial/external commonjs \"react-map-gl\"","webpack://@performant-software/geospatial/./src/components/DrawControl.js","webpack://@performant-software/geospatial/external commonjs \"underscore\"","webpack://@performant-software/geospatial/./src/components/GeoJsonLayer.js","webpack://@performant-software/geospatial/external commonjs \"react-icons/bs\"","webpack://@performant-software/geospatial/external commonjs \"react-icons/io5\"","webpack://@performant-software/geospatial/external commonjs \"maplibre-gl\"","webpack://@performant-software/geospatial/external commonjs2 \"react-dom\"","webpack://@performant-software/geospatial/./src/components/MapControl.js","webpack://@performant-software/geospatial/./src/components/LayerMenu.js","webpack://@performant-software/geospatial/external commonjs \"@peripleo/maplibre\"","webpack://@performant-software/geospatial/external commonjs \"@turf/turf\"","webpack://@performant-software/geospatial/./src/utils/Map.js","webpack://@performant-software/geospatial/./src/components/LocationMarker.js","webpack://@performant-software/geospatial/./src/utils/MapStyles.js","webpack://@performant-software/geospatial/./src/components/MapDraw.js","webpack://@performant-software/geospatial/./src/components/RasterLayer.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@mapbox/mapbox-gl-draw\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react-map-gl\");","// @flow\n\nimport MapboxDraw from '@mapbox/mapbox-gl-draw';\nimport { forwardRef, useImperativeHandle } from 'react';\nimport { useControl, type ControlPosition, type MapRef } from 'react-map-gl';\n\ntype Props = {\n position?: ControlPosition;\n onCreate?: (evt: { features: Array<any> }) => void;\n onUpdate?: (evt: { features: Array<any>, action: string }) => void;\n onDelete?: (evt: { features: Array<any> }) => void;\n};\n\nconst DrawControl = forwardRef((props: Props, ref) => {\n /**\n * Creates the drawer ref using MapboxDraw.\n */\n const drawRef = useControl(\n () => new MapboxDraw(props),\n ({ map }: { map: MapRef }) => {\n map.on('draw.create', props.onCreate);\n map.on('draw.update', props.onUpdate);\n map.on('draw.delete', props.onDelete);\n },\n ({ map }: { map: MapRef }) => {\n map.off('draw.create', props.onCreate);\n map.off('draw.update', props.onUpdate);\n map.off('draw.delete', props.onDelete);\n },\n {\n position: props.position\n }\n );\n\n /**\n * Exposes the ref for the MapboxDraw object.\n */\n useImperativeHandle(ref, () => drawRef, [drawRef]);\n\n return null;\n});\n\nexport default DrawControl;\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"underscore\");","// @flow\n\nimport React, {\n useCallback,\n useEffect,\n useMemo,\n useState\n} from 'react';\nimport { Layer, Source } from 'react-map-gl';\nimport _ from 'underscore';\n\ntype Props = {\n data?: { [key: string]: any },\n fillStyle?: { [key: string]: any },\n lineStyle?: { [key: string]: any },\n pointStyle?: { [key: string]: any },\n url?: string\n};\n\nconst DEFAULT_COLOR = '#CC3333';\nconst HIGHLIGHT_COLOR = '#990000';\n\nconst DEFAULT_FILL_STYLES = {\n 'fill-color': DEFAULT_COLOR,\n 'fill-opacity': 0.2\n};\n\nconst DEFAULT_LINE_STYLES = {\n 'line-color': HIGHLIGHT_COLOR,\n 'line-opacity': 0.6\n};\n\nconst DEFAULT_POINT_STYLES = {\n 'circle-radius': [\n 'interpolate',\n ['linear'],\n ['number', ['get', 'point_count'], 1],\n 0, 4,\n 10, 14\n ],\n 'circle-stroke-width': 1,\n 'circle-color': DEFAULT_COLOR,\n 'circle-stroke-color': HIGHLIGHT_COLOR\n};\n\nconst GeoJsonLayer = (props: Props) => {\n const [data, setData] = useState(props.data);\n\n /**\n * Returns the layer style for the passed style and default.\n *\n * @type {function(*, *): *}\n */\n const getLayerStyles = useCallback((style, defaultStyle) => _.defaults(style, defaultStyle), []);\n\n /**\n * Sets the fill layer style.\n *\n * @type {*}\n */\n const fillStyle = useMemo(() => (\n getLayerStyles(props.fillStyle, DEFAULT_FILL_STYLES)\n ), [getLayerStyles, props.fillStyle]);\n\n /**\n * Sets the line layer style.\n *\n * @type {*}\n */\n const lineStyle = useMemo(() => (\n getLayerStyles(props.lineStyle, DEFAULT_LINE_STYLES)\n ), [getLayerStyles, props.lineStyle]);\n\n /**\n * Sets the point layer style.\n *\n * @type {*}\n */\n const pointStyle = useMemo(() => (\n getLayerStyles(props.pointStyle, DEFAULT_POINT_STYLES)\n ), [getLayerStyles, props.pointStyle]);\n\n /**\n * If the data is passed as a URL, fetches the passed URL and sets the response on the state.\n */\n useEffect(() => {\n if (props.url) {\n fetch(props.url)\n .then((response) => response.json())\n .then((json) => setData(json));\n }\n }, [props.url]);\n\n return (\n <Source\n data={data}\n type='geojson'\n >\n <Layer\n filter={['!=', '$type', 'Point']}\n paint={fillStyle}\n type='fill'\n />\n <Layer\n filter={['!=', '$type', 'Point']}\n paint={lineStyle}\n type='line'\n />\n <Layer\n filter={['==', '$type', 'Point']}\n paint={pointStyle}\n type='circle'\n />\n </Source>\n );\n};\n\nexport default GeoJsonLayer;\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react-icons/bs\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react-icons/io5\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"maplibre-gl\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react-dom\");","// @flow\n\nimport { IControl } from 'maplibre-gl';\nimport {\n Children,\n cloneElement,\n useCallback,\n useEffect,\n useState\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { MapboxMap, useControl } from 'react-map-gl';\nimport _ from 'underscore';\n\n/**\n * Class to implement the IControl interface to allow custom controls to be drawn on the map.\n */\nclass IControlImpl implements IControl {\n _map: MapboxMap = null;\n _container: HTMLElement;\n _redraw: () => void;\n\n /**\n * Constructs a new IControlImpl object.\n *\n * @param redraw\n */\n constructor(redraw: () => void) {\n this._redraw = redraw;\n }\n\n /**\n * Creates the container when the component is added to the passed map.\n *\n * @param map\n *\n * @returns {HTMLElement}\n */\n onAdd(map) {\n this._map = map;\n map.on('move', this._redraw);\n\n this._container = document.createElement('div');\n this._container.className = 'maplibregl-ctrl-group maplibregl-ctrl';\n this._redraw();\n return this._container;\n }\n\n /**\n * Removes the container when the component is removed from the map.\n */\n onRemove() {\n this._container.remove();\n this._map.off('move', this._redraw);\n this._map = null;\n }\n\n /**\n * Returns the map instance.\n *\n * @returns {mapboxgl.Map}\n */\n getMap() {\n return this._map;\n }\n\n /**\n * Returns the container instance.\n *\n * @returns {HTMLElement}\n */\n getElement() {\n return this._container;\n }\n}\n\nconst MapControl = (props) => {\n const [, setVersion] = useState(0);\n\n /**\n * Forces the component to re-render on map move.\n *\n * @type {function(): void}\n */\n const forceUpdate = useCallback(() => setVersion((v) => v + 1), []);\n\n /**\n * Creates the map control.\n *\n * @type {IControlImpl}\n */\n const ctrl = useControl(() => new IControlImpl(forceUpdate), { position: props.position });\n\n /**\n * Sets the map instance.\n *\n * @type {mapboxgl.Map}\n */\n const map = ctrl.getMap();\n\n /**\n * Creates the list of children to be added to the map instance.\n *\n * @type {Array<$NonMaybeType<*>>}\n */\n const children = Children.map(_.compact(Children.toArray(props.children)), (child) => cloneElement(child, { map }));\n\n /**\n * Sets the map ref.\n */\n useEffect(() => {\n if (props.mapRef) {\n // eslint-disable-next-line no-param-reassign\n props.mapRef.current = map;\n }\n }, [map, props.mapRef]);\n\n return map && createPortal(children, ctrl.getElement());\n};\n\nexport default MapControl;\n","// @flow\n\nimport React, {\n Children,\n useCallback,\n useEffect,\n useMemo, useRef,\n useState\n} from 'react';\nimport { BsStack } from 'react-icons/bs';\nimport { IoCheckmarkOutline } from 'react-icons/io5';\nimport _ from 'underscore';\nimport MapControl from './MapControl';\nimport './LayerMenu.css';\n\ntype Props = {\n children: Node,\n names: Array<string>,\n position: 'top-left' | 'bottom-left' | 'top-right' | 'bottom-right'\n};\n\nconst MENU_PADDING = 30;\n\nconst LayerMenu = (props: Props) => {\n const [canvasHeight, setCanvasHeight] = useState(0);\n const [visible, setVisible] = useState();\n const [menuOpen, setMenuOpen] = useState(false);\n\n const mapRef = useRef();\n\n /**\n * Returns the name of the layer at the passed index.\n *\n * @type {unknown}\n */\n const getLayerName = useCallback((index) => (\n props.names && props.names.length > index && props.names[index]\n ), [props.names]);\n\n /**\n * Returns true if the child element at the passed index is visible.\n *\n * @type {function(*): *}\n */\n const isVisible = useCallback((index) => _.includes(visible, index), [visible]);\n\n /**\n * Returns a memoized array of the child elements.\n *\n * @type {Array<$NonMaybeType<unknown>>}\n */\n const children = useMemo(() => Children.toArray(props.children), [props.children]);\n\n /**\n * Returns a memoized array of visible child elements.\n */\n const visibleChildren = useMemo(() => _.filter(children, (child, index) => isVisible(index)), [children, isVisible]);\n\n /**\n * Toggles the visibility for the child element at the passed index.\n *\n * @type {(function(*): void)|*}\n */\n const toggleVisibility = useCallback((index) => {\n let value;\n\n if (isVisible(index)) {\n value = _.without(visible, index);\n } else {\n value = [...visible, index];\n }\n\n setVisible(value);\n }, [isVisible, visible]);\n\n /**\n * Sets all of the child elements to be visible when the component mounts.\n */\n useEffect(() => {\n setVisible(_.times(children.length, (index) => index));\n }, []);\n\n /**\n * Sets the map canvas height.\n */\n useEffect(() => {\n const { current: instance } = mapRef;\n\n if (instance && instance._canvas) {\n const { offsetHeight = 0 } = mapRef.current._canvas;\n setCanvasHeight(offsetHeight);\n }\n }, [mapRef.current]);\n\n if (_.isEmpty(children)) {\n return null;\n }\n\n return (\n <>\n <MapControl\n mapRef={mapRef}\n position={props.position}\n >\n <button\n className='mapbox-gl-draw_ctrl-draw-btn layer-button'\n onClick={() => setMenuOpen((prevMenuOpen) => !prevMenuOpen)}\n type='button'\n >\n <BsStack\n size='1.25em'\n />\n </button>\n { menuOpen && (\n <div\n className='layer-menu'\n style={{\n maxHeight: `calc(${canvasHeight}px - ${MENU_PADDING}px)`\n }}\n >\n <div\n className='menu'\n >\n { _.map(children, (child, index) => (\n <div\n aria-selected={isVisible(index)}\n className='option'\n role='option'\n onClick={() => toggleVisibility(index)}\n onKeyDown={() => toggleVisibility(index)}\n tabIndex={index}\n >\n <div\n className='checkmark-container'\n >\n { isVisible(index) && (\n <IoCheckmarkOutline\n size='1em'\n />\n )}\n </div>\n { getLayerName(index) }\n </div>\n ))}\n </div>\n </div>\n )}\n </MapControl>\n { visibleChildren }\n </>\n );\n};\n\nLayerMenu.defaultProps = {\n position: 'top-left'\n};\n\nexport default LayerMenu;\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@peripleo/maplibre\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@turf/turf\");","// @flow\n\nimport { bbox, bboxPolygon, buffer } from '@turf/turf';\n\n/**\n * Returns a bounding box for the passed geometry (with optional buffer).\n *\n * @param geometry\n * @param bufferDistance\n *\n * @returns {BBox}\n */\nconst getBoundingBox = (geometry, bufferDistance = null) => {\n // Convert the GeoJSON into a bounding box\n const box = bbox(geometry);\n\n // Convert the bounding box to a polygon\n const polygon = bboxPolygon(box);\n\n // Create a buffer around the polygon (if a distance is provided)\n let polygonBuffer;\n\n if (bufferDistance) {\n polygonBuffer = buffer(polygon, bufferDistance, { units: 'miles' });\n } else {\n polygonBuffer = polygon;\n }\n\n // Convert the buffer to a bounding box\n return bbox(polygonBuffer);\n};\n\nexport default {\n getBoundingBox\n};\n","// @flow\n\nimport { MixedGeoJSONLayer, PulsingMarkerLayer, type Map } from '@peripleo/maplibre';\nimport React, { useEffect } from 'react';\nimport { DEFAULT_FILL_STYLE, DEFAULT_POINT_STYLE, DEFAULT_STROKE_STYLE } from '../utils/MapStyles';\nimport MapUtils from '../utils/Map';\n\ntype Props = {\n /**\n * The number of miles to buffer the GeoJSON data.\n */\n buffer: number,\n\n /**\n * The GeoJSON data representing the location.\n */\n data: { [key: string]: any },\n\n /**\n * GeoJSON layer fill style.\n */\n fillStyle?: { [key: string]: any },\n\n /**\n * TOOD: Comment me.\n */\n map?: Map,\n\n /**\n * GeoJSON layer point style.\n */\n pointStyle?: { [key: string]: any },\n\n /**\n * GeoJSON layer stroke style\n */\n strokeStyle?: { [key: string]: any }\n};\n\nconst DEFAULT_BUFFER = 2;\n\n/**\n * This component renders a location marker to be used in a Peripleo context.\n */\nconst LocationMarker = (props: Props) => {\n /**\n * Sets the bounding box on the map.\n */\n useEffect(() => {\n if (props.map && props.data) {\n const boundingBox = MapUtils.getBoundingBox(props.data, props.buffer);\n props.map.fitBounds(boundingBox);\n }\n }, [props.buffer, props.data, props.map]);\n\n return (\n <>\n <PulsingMarkerLayer\n id='current'\n data={props.data}\n />\n <MixedGeoJSONLayer\n id='current'\n data={props.data}\n fillStyle={props.fillStyle}\n strokeStyle={props.strokeStyle}\n pointStyle={props.pointStyle}\n />\n </>\n );\n};\n\nLocationMarker.defaultProps = {\n buffer: DEFAULT_BUFFER,\n fillStyle: DEFAULT_FILL_STYLE,\n pointStyle: DEFAULT_POINT_STYLE,\n strokeStyle: DEFAULT_STROKE_STYLE\n};\n\nexport default LocationMarker;\n","// @flow\n\nexport const DEFAULT_POINT_STYLE = {\n type: 'circle',\n paint: {\n 'circle-radius': [\n 'interpolate',\n ['linear'],\n ['number', ['get', 'point_count'], 1],\n 0, 4,\n 10, 14\n ],\n 'circle-stroke-width': 1,\n 'circle-color': [\n 'case',\n ['boolean', ['feature-state', 'hover'], false],\n '#3b62ff',\n '#ff623b'\n ],\n 'circle-stroke-color': '#8d260c'\n }\n};\n\nexport const DEFAULT_FILL_STYLE = {\n type: 'fill',\n paint: {\n 'fill-color': '#ff623b',\n 'fill-opacity': 0.2\n }\n};\n\nexport const DEFAULT_STROKE_STYLE = {\n type: 'line',\n paint: {\n 'line-color': '#ff623b',\n 'line-opacity': 0.6\n }\n};\n","// @flow\n\nimport MapboxDraw from '@mapbox/mapbox-gl-draw';\nimport { feature, type FeatureCollection, type GeometryCollection } from '@turf/turf';\nimport maplibregl from 'maplibre-gl';\nimport React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type Node\n} from 'react';\nimport Map, { MapRef } from 'react-map-gl';\nimport _ from 'underscore';\nimport DrawControl from './DrawControl';\nimport MapUtils from '../utils/Map';\nimport './MapDraw.css';\n\n// Override the MapboxDraw components to use MapLibre styles\nMapboxDraw.constants.classes.CONTROL_BASE = 'maplibregl-ctrl';\nMapboxDraw.constants.classes.CONTROL_PREFIX = 'maplibregl-ctrl-';\nMapboxDraw.constants.classes.CONTROL_GROUP = 'maplibregl-ctrl-group';\n\ntype Props = {\n /**\n * The number of miles to buffer the GeoJSON data.\n */\n buffer?: number,\n\n /**\n * Additional child nodes to render.\n */\n children?: Node,\n\n /**\n * GeoJSON structured data to be displayed on the map.\n */\n data: GeometryCollection | FeatureCollection,\n\n /**\n * URL of the map style to render. This URL should contain any necessary API keys.\n */\n mapStyle: string,\n\n /**\n * Callback fired when the map geometries are changed.\n *\n * @param features\n */\n onChange: (features: Array<any>) => void,\n\n /**\n * Map style object.\n */\n style?: any,\n\n /**\n * The time in milliseconds to zoom into the location.\n */\n zoomDuration?: number\n};\n\nconst DEFAULT_BUFFER = 2;\nconst DEFAULT_ZOOM_DELAY = 1000;\n\nconst GeometryTypes = {\n geometryCollection: 'GeometryCollection',\n point: 'Point'\n};\n\n/**\n * This component renders a map with controls for drawing one or more geometries. Geometries can be a point (lat/long),\n * a line, or a polygon.\n */\nconst MapDraw = (props: Props) => {\n const [loaded, setLoaded] = useState(false);\n\n const drawRef = useRef<MapboxDraw>();\n const mapRef = useRef<MapRef>();\n\n /**\n * Calls the onChange prop with all of the geometries in the current drawer.\n *\n * @type {(function(): void)|*}\n */\n const onChange = useCallback(() => {\n props.onChange(drawRef.current.getAll());\n }, [props.onChange]);\n\n /**\n * Sets the map style.\n *\n * @type {{width: string, height: number}}\n */\n const style = useMemo(() => ({ height: 500, width: '100%', ...(props.style || {}) }), [props.style]);\n\n /**\n * Updates the map bounding box and drawer when the geometry is changed.\n */\n useEffect(() => {\n if (loaded && props.data) {\n // Get the bounding box for the passed data\n const boundingBox = MapUtils.getBoundingBox(props.data, props.buffer);\n\n // Sets the bounding box for the current geometry\n if (_.every(boundingBox, _.isFinite)) {\n const [minLng, minLat, maxLng, maxLat] = boundingBox;\n const bounds = [[minLng, minLat], [maxLng, maxLat]];\n\n mapRef.current.fitBounds(bounds, { duration: props.zoomDuration });\n }\n\n // Handle special cases for geometry collection (not supported by mabox-gl-draw) and point\n if (props.data.type === GeometryTypes.geometryCollection) {\n _.each(props.data.geometries, (geometry) => {\n drawRef.current.add(feature(geometry));\n });\n } else {\n drawRef.current.add(props.data);\n }\n }\n }, [loaded, props.data]);\n\n return (\n <Map\n attributionControl={false}\n onLoad={() => setLoaded(true)}\n mapLib={maplibregl}\n ref={mapRef}\n style={style}\n mapStyle={props.mapStyle}\n >\n <DrawControl\n ref={drawRef}\n controls={{\n line_string: true,\n point: true,\n polygon: true,\n trash: true\n }}\n displayControlsDefault={false}\n onCreate={onChange}\n onUpdate={onChange}\n onDelete={onChange}\n position='bottom-left'\n />\n { props.children }\n </Map>\n );\n};\n\nMapDraw.defaultProps = {\n buffer: DEFAULT_BUFFER,\n zoomDuration: DEFAULT_ZOOM_DELAY\n};\n\nexport default MapDraw;\n","// @flow\n\nimport React from 'react';\nimport { Layer, Source } from 'react-map-gl';\n\ntype Props = {\n maxzoom?: number,\n minzoom?: number,\n opacity?: number,\n tileSize?: number,\n url?: string,\n};\n\nconst RasterLayer = (props: Props) => (\n <Source\n tileSize={props.tileSize}\n tiles={[props.url]}\n type='raster'\n >\n <Layer\n type='raster'\n paint={{\n 'raster-opacity': props.opacity\n }}\n minzoom={props.minzoom}\n maxzoom={props.maxzoom}\n />\n </Source>\n);\n\nRasterLayer.defaultProps = {\n maxzoom: 22,\n minzoom: 0,\n opacity: 0.7,\n tileSize: 256\n};\n\nexport default RasterLayer;\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","require","forwardRef","props","ref","drawRef","useControl","MapboxDraw","_ref","map","on","onCreate","onUpdate","onDelete","_ref2","off","position","useImperativeHandle","DEFAULT_COLOR","HIGHLIGHT_COLOR","DEFAULT_FILL_STYLES","DEFAULT_LINE_STYLES","DEFAULT_POINT_STYLES","_useState2","useState","data","setData","getLayerStyles","useCallback","style","defaultStyle","_","fillStyle","useMemo","lineStyle","pointStyle","useEffect","url","fetch","then","response","json","React","Source","type","Layer","filter","paint","IControlImpl","redraw","_classCallCheck","_map","_container","_redraw","this","document","createElement","className","remove","setVersion","forceUpdate","v","ctrl","getMap","children","Children","toArray","child","cloneElement","mapRef","current","createPortal","getElement","LayerMenu","_slicedToArray","canvasHeight","setCanvasHeight","_useState4","visible","setVisible","_useState6","menuOpen","setMenuOpen","useRef","getLayerName","index","names","length","isVisible","visibleChildren","toggleVisibility","concat","instance","_canvas","_mapRef$current$_canv","offsetHeight","MapControl","onClick","prevMenuOpen","BsStack","size","maxHeight","role","onKeyDown","tabIndex","IoCheckmarkOutline","defaultProps","getBoundingBox","geometry","polygonBuffer","bufferDistance","arguments","undefined","box","bbox","polygon","bboxPolygon","buffer","units","LocationMarker","boundingBox","MapUtils","fitBounds","PulsingMarkerLayer","id","MixedGeoJSONLayer","strokeStyle","classes","CONTROL_BASE","CONTROL_PREFIX","CONTROL_GROUP","MapDraw","loaded","setLoaded","onChange","getAll","_objectSpread","height","width","_boundingBox","bounds","duration","zoomDuration","geometries","add","feature","Map","attributionControl","onLoad","mapLib","maplibregl","mapStyle","DrawControl","controls","line_string","point","trash","displayControlsDefault","RasterLayer","tileSize","tiles","opacity","minzoom","maxzoom"],"sourceRoot":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@performant-software/geospatial",
3
- "version": "1.2.0-beta.16",
3
+ "version": "1.2.0-beta.18",
4
4
  "description": "TODO: ADD",
5
5
  "license": "MIT",
6
6
  "main": "./build/index.js",
@@ -18,6 +18,7 @@
18
18
  "underscore": "^1.13.6"
19
19
  },
20
20
  "peerDependencies": {
21
+ "@peripleo/maplibre": "^0.3.3",
21
22
  "react": ">= 16.13.1 < 19.0.0",
22
23
  "react-dom": ">= 16.13.1 < 19.0.0"
23
24
  },
@@ -0,0 +1,80 @@
1
+ // @flow
2
+
3
+ import { MixedGeoJSONLayer, PulsingMarkerLayer, type Map } from '@peripleo/maplibre';
4
+ import React, { useEffect } from 'react';
5
+ import { DEFAULT_FILL_STYLE, DEFAULT_POINT_STYLE, DEFAULT_STROKE_STYLE } from '../utils/MapStyles';
6
+ import MapUtils from '../utils/Map';
7
+
8
+ type Props = {
9
+ /**
10
+ * The number of miles to buffer the GeoJSON data.
11
+ */
12
+ buffer: number,
13
+
14
+ /**
15
+ * The GeoJSON data representing the location.
16
+ */
17
+ data: { [key: string]: any },
18
+
19
+ /**
20
+ * GeoJSON layer fill style.
21
+ */
22
+ fillStyle?: { [key: string]: any },
23
+
24
+ /**
25
+ * TOOD: Comment me.
26
+ */
27
+ map?: Map,
28
+
29
+ /**
30
+ * GeoJSON layer point style.
31
+ */
32
+ pointStyle?: { [key: string]: any },
33
+
34
+ /**
35
+ * GeoJSON layer stroke style
36
+ */
37
+ strokeStyle?: { [key: string]: any }
38
+ };
39
+
40
+ const DEFAULT_BUFFER = 2;
41
+
42
+ /**
43
+ * This component renders a location marker to be used in a Peripleo context.
44
+ */
45
+ const LocationMarker = (props: Props) => {
46
+ /**
47
+ * Sets the bounding box on the map.
48
+ */
49
+ useEffect(() => {
50
+ if (props.map && props.data) {
51
+ const boundingBox = MapUtils.getBoundingBox(props.data, props.buffer);
52
+ props.map.fitBounds(boundingBox);
53
+ }
54
+ }, [props.buffer, props.data, props.map]);
55
+
56
+ return (
57
+ <>
58
+ <PulsingMarkerLayer
59
+ id='current'
60
+ data={props.data}
61
+ />
62
+ <MixedGeoJSONLayer
63
+ id='current'
64
+ data={props.data}
65
+ fillStyle={props.fillStyle}
66
+ strokeStyle={props.strokeStyle}
67
+ pointStyle={props.pointStyle}
68
+ />
69
+ </>
70
+ );
71
+ };
72
+
73
+ LocationMarker.defaultProps = {
74
+ buffer: DEFAULT_BUFFER,
75
+ fillStyle: DEFAULT_FILL_STYLE,
76
+ pointStyle: DEFAULT_POINT_STYLE,
77
+ strokeStyle: DEFAULT_STROKE_STYLE
78
+ };
79
+
80
+ export default LocationMarker;
package/src/index.js CHANGED
@@ -4,6 +4,7 @@
4
4
  export { default as DrawControl } from './components/DrawControl';
5
5
  export { default as GeoJsonLayer } from './components/GeoJsonLayer';
6
6
  export { default as LayerMenu } from './components/LayerMenu';
7
+ export { default as LocationMarker } from './components/LocationMarker';
7
8
  export { default as MapControl } from './components/MapControl';
8
9
  export { default as MapDraw } from './components/MapDraw';
9
10
  export { default as RasterLayer } from './components/RasterLayer';
@@ -0,0 +1,80 @@
1
+ // @flow
2
+
3
+ import { MixedGeoJSONLayer, PulsingMarkerLayer, type Map } from '@peripleo/maplibre';
4
+ import React, { useEffect } from 'react';
5
+ import { DEFAULT_FILL_STYLE, DEFAULT_POINT_STYLE, DEFAULT_STROKE_STYLE } from '../utils/MapStyles';
6
+ import MapUtils from '../utils/Map';
7
+
8
+ type Props = {
9
+ /**
10
+ * The number of miles to buffer the GeoJSON data.
11
+ */
12
+ buffer: number,
13
+
14
+ /**
15
+ * The GeoJSON data representing the location.
16
+ */
17
+ data: { [key: string]: any },
18
+
19
+ /**
20
+ * GeoJSON layer fill style.
21
+ */
22
+ fillStyle?: { [key: string]: any },
23
+
24
+ /**
25
+ * TOOD: Comment me.
26
+ */
27
+ map?: Map,
28
+
29
+ /**
30
+ * GeoJSON layer point style.
31
+ */
32
+ pointStyle?: { [key: string]: any },
33
+
34
+ /**
35
+ * GeoJSON layer stroke style
36
+ */
37
+ strokeStyle?: { [key: string]: any }
38
+ };
39
+
40
+ const DEFAULT_BUFFER = 2;
41
+
42
+ /**
43
+ * This component renders a location marker to be used in a Peripleo context.
44
+ */
45
+ const LocationMarker = (props: Props) => {
46
+ /**
47
+ * Sets the bounding box on the map.
48
+ */
49
+ useEffect(() => {
50
+ if (props.map && props.data) {
51
+ const boundingBox = MapUtils.getBoundingBox(props.data, props.buffer);
52
+ props.map.fitBounds(boundingBox);
53
+ }
54
+ }, [props.buffer, props.data, props.map]);
55
+
56
+ return (
57
+ <>
58
+ <PulsingMarkerLayer
59
+ id='current'
60
+ data={props.data}
61
+ />
62
+ <MixedGeoJSONLayer
63
+ id='current'
64
+ data={props.data}
65
+ fillStyle={props.fillStyle}
66
+ strokeStyle={props.strokeStyle}
67
+ pointStyle={props.pointStyle}
68
+ />
69
+ </>
70
+ );
71
+ };
72
+
73
+ LocationMarker.defaultProps = {
74
+ buffer: DEFAULT_BUFFER,
75
+ fillStyle: DEFAULT_FILL_STYLE,
76
+ pointStyle: DEFAULT_POINT_STYLE,
77
+ strokeStyle: DEFAULT_STROKE_STYLE
78
+ };
79
+
80
+ export default LocationMarker;
@@ -4,6 +4,7 @@
4
4
  export { default as DrawControl } from './components/DrawControl';
5
5
  export { default as GeoJsonLayer } from './components/GeoJsonLayer';
6
6
  export { default as LayerMenu } from './components/LayerMenu';
7
+ export { default as LocationMarker } from './components/LocationMarker';
7
8
  export { default as MapControl } from './components/MapControl';
8
9
  export { default as MapDraw } from './components/MapDraw';
9
10
  export { default as RasterLayer } from './components/RasterLayer';
package/webpack.config.js CHANGED
@@ -2,6 +2,9 @@ const { configure } = require('@performant-software/webpack-config');
2
2
  const path = require('path');
3
3
 
4
4
  module.exports = configure(__dirname, {
5
+ externals: [
6
+ '@peripleo/maplibre'
7
+ ],
5
8
  resolve: {
6
9
  alias: {
7
10
  './@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.css$': path.resolve(