@mapgis/mapbox-gl-draw-circle 10.5.5

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Anvesh Arrabochu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,82 @@
1
+ # mapbox-gl-draw-circle
2
+
3
+ Adds support for drawing and editing a circle feature using [mapbox-gl-draw](https://github.com/mapbox/mapbox-gl-draw) library.
4
+
5
+ ## Demo
6
+
7
+ ##### Circle mode
8
+ ![Circle Mode Demo](demo/CircleModeDemo.gif)
9
+
10
+ ##### Drag Circle mode
11
+ ![Drag Circle Mode Demo](demo/DragCircleDemo.gif)
12
+
13
+
14
+ ## Usage
15
+
16
+ ### Installation
17
+
18
+ ```
19
+ npm install mapbox-gl-draw-circle
20
+ ```
21
+
22
+ ```
23
+ import {
24
+ CircleMode,
25
+ DragCircleMode,
26
+ DirectMode,
27
+ SimpleSelectMode
28
+ } from 'mapbox-gl-draw-circle';
29
+
30
+
31
+ // userProperties has to be enabled
32
+ const draw = new MapboxDraw({
33
+ defaultMode: "draw_circle",
34
+ userProperties: true,
35
+ modes: {
36
+ ...MapboxDraw.modes,
37
+ draw_circle : CircleMode,
38
+ drag_circle : DragCircleMode,
39
+ direct_select: DirectMode,
40
+ simple_select: SimpleSelectMode
41
+ }
42
+ });
43
+
44
+ // Add this draw object to the map when map loads
45
+ map.addControl(draw);
46
+ ```
47
+
48
+ The default radius units are in **kilometers** and initial radius is **2km**.
49
+
50
+ ```
51
+ // Provide the default radius as an option to CircleMode
52
+ draw.changeMode('draw_circle', { initialRadiusInKm: 0.5 });
53
+ ```
54
+
55
+ It fires the same events as the mapbox-gl-draw library. For more information follow this [link](https://github.com/mapbox/mapbox-gl-draw/blob/master/docs/API.md#events).
56
+
57
+ Sample feature object returned in `draw.create` event
58
+ ```
59
+ {
60
+ "id": "e184898e58feaa5c2c56f20a178ffe2c",
61
+ "type": "Feature",
62
+ "properties": {
63
+ "isCircle": true,
64
+ "center": [
65
+ -0.2472604947478203,
66
+ 51.53200220026099
67
+ ],
68
+ "radiusInKm": 2
69
+ },
70
+ "geometry": {
71
+ "coordinates": [], // populated with 64 vertices used to render the circle
72
+ "type": "Polygon"
73
+ }
74
+ }
75
+ ```
76
+
77
+ ## Changelog
78
+
79
+ ### v1.1.0
80
+
81
+ * Added a new DragCircle mode.
82
+ * Fixed issue (#5), where the polygon mode was not working when used along with CircleMode.
package/_config.yml ADDED
@@ -0,0 +1 @@
1
+ theme: jekyll-theme-hacker
package/dist/main.js ADDED
@@ -0,0 +1 @@
1
+ !function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=12)}([function(e,t){e.exports={classes:{CONTROL_BASE:"mapboxgl-ctrl",CONTROL_PREFIX:"mapboxgl-ctrl-",CONTROL_BUTTON:"mapbox-gl-draw_ctrl-draw-btn",CONTROL_BUTTON_LINE:"mapbox-gl-draw_line",CONTROL_BUTTON_POLYGON:"mapbox-gl-draw_polygon",CONTROL_BUTTON_POINT:"mapbox-gl-draw_point",CONTROL_BUTTON_TRASH:"mapbox-gl-draw_trash",CONTROL_BUTTON_COMBINE_FEATURES:"mapbox-gl-draw_combine",CONTROL_BUTTON_UNCOMBINE_FEATURES:"mapbox-gl-draw_uncombine",CONTROL_GROUP:"mapboxgl-ctrl-group",ATTRIBUTION:"mapboxgl-ctrl-attrib",ACTIVE_BUTTON:"active",BOX_SELECT:"mapbox-gl-draw_boxselect"},sources:{HOT:"mapbox-gl-draw-hot",COLD:"mapbox-gl-draw-cold"},cursors:{ADD:"add",MOVE:"move",DRAG:"drag",POINTER:"pointer",NONE:"none"},types:{POLYGON:"polygon",LINE:"line_string",POINT:"point"},geojsonTypes:{FEATURE:"Feature",POLYGON:"Polygon",LINE_STRING:"LineString",POINT:"Point",FEATURE_COLLECTION:"FeatureCollection",MULTI_PREFIX:"Multi",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon"},modes:{DRAW_LINE_STRING:"draw_line_string",DRAW_POLYGON:"draw_polygon",DRAW_POINT:"draw_point",SIMPLE_SELECT:"simple_select",DIRECT_SELECT:"direct_select",STATIC:"static"},events:{CREATE:"draw.create",DELETE:"draw.delete",UPDATE:"draw.update",SELECTION_CHANGE:"draw.selectionchange",MODE_CHANGE:"draw.modechange",ACTIONABLE:"draw.actionable",RENDER:"draw.render",COMBINE_FEATURES:"draw.combine",UNCOMBINE_FEATURES:"draw.uncombine"},updateActions:{MOVE:"move",CHANGE_COORDINATES:"change_coordinates"},meta:{FEATURE:"feature",MIDPOINT:"midpoint",VERTEX:"vertex"},activeStates:{ACTIVE:"true",INACTIVE:"false"},interactions:["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate"],LAT_MIN:-90,LAT_RENDERED_MIN:-85,LAT_MAX:90,LAT_RENDERED_MAX:85,LNG_MIN:-270,LNG_MAX:270}},function(e,t,n){"use strict";function o(e,t,n){void 0===n&&(n={});var o={type:"Feature"};return(0===n.id||n.id)&&(o.id=n.id),n.bbox&&(o.bbox=n.bbox),o.properties=t||{},o.geometry=e,o}function r(e,t,n){return void 0===n&&(n={}),o({type:"Point",coordinates:e},t,n)}function i(e,t,n){void 0===n&&(n={});for(var r=0,i=e;r<i.length;r++){var s=i[r];if(s.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var a=0;a<s[s.length-1].length;a++)if(s[s.length-1][a]!==s[0][a])throw new Error("First and last Position are not equivalent.")}return o({type:"Polygon",coordinates:e},t,n)}function s(e,t,n){if(void 0===n&&(n={}),e.length<2)throw new Error("coordinates must be an array of two or more positions");return o({type:"LineString",coordinates:e},t,n)}function a(e,t){void 0===t&&(t={});var n={type:"FeatureCollection"};return t.id&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.features=e,n}function c(e,t,n){return void 0===n&&(n={}),o({type:"MultiLineString",coordinates:e},t,n)}function u(e,t,n){return void 0===n&&(n={}),o({type:"MultiPoint",coordinates:e},t,n)}function l(e,t,n){return void 0===n&&(n={}),o({type:"MultiPolygon",coordinates:e},t,n)}function p(e,n){void 0===n&&(n="kilometers");var o=t.factors[n];if(!o)throw new Error(n+" units is invalid");return e*o}function f(e,n){void 0===n&&(n="kilometers");var o=t.factors[n];if(!o)throw new Error(n+" units is invalid");return e/o}function d(e){return 180*(e%(2*Math.PI))/Math.PI}function h(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)&&!/^\s*$/.test(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.earthRadius=6371008.8,t.factors={centimeters:100*t.earthRadius,centimetres:100*t.earthRadius,degrees:t.earthRadius/111325,feet:3.28084*t.earthRadius,inches:39.37*t.earthRadius,kilometers:t.earthRadius/1e3,kilometres:t.earthRadius/1e3,meters:t.earthRadius,metres:t.earthRadius,miles:t.earthRadius/1609.344,millimeters:1e3*t.earthRadius,millimetres:1e3*t.earthRadius,nauticalmiles:t.earthRadius/1852,radians:1,yards:t.earthRadius/1.0936},t.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:.001,kilometres:.001,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/t.earthRadius,yards:1/1.0936},t.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046},t.feature=o,t.geometry=function(e,t,n){switch(void 0===n&&(n={}),e){case"Point":return r(t).geometry;case"LineString":return s(t).geometry;case"Polygon":return i(t).geometry;case"MultiPoint":return u(t).geometry;case"MultiLineString":return c(t).geometry;case"MultiPolygon":return l(t).geometry;default:throw new Error(e+" is invalid")}},t.point=r,t.points=function(e,t,n){return void 0===n&&(n={}),a(e.map((function(e){return r(e,t)})),n)},t.polygon=i,t.polygons=function(e,t,n){return void 0===n&&(n={}),a(e.map((function(e){return i(e,t)})),n)},t.lineString=s,t.lineStrings=function(e,t,n){return void 0===n&&(n={}),a(e.map((function(e){return s(e,t)})),n)},t.featureCollection=a,t.multiLineString=c,t.multiPoint=u,t.multiPolygon=l,t.geometryCollection=function(e,t,n){return void 0===n&&(n={}),o({type:"GeometryCollection",geometries:e},t,n)},t.round=function(e,t){if(void 0===t&&(t=0),t&&!(t>=0))throw new Error("precision must be a positive number");var n=Math.pow(10,t||0);return Math.round(e*n)/n},t.radiansToLength=p,t.lengthToRadians=f,t.lengthToDegrees=function(e,t){return d(f(e,t))},t.bearingToAzimuth=function(e){var t=e%360;return t<0&&(t+=360),t},t.radiansToDegrees=d,t.degreesToRadians=function(e){return e%360*Math.PI/180},t.convertLength=function(e,t,n){if(void 0===t&&(t="kilometers"),void 0===n&&(n="kilometers"),!(e>=0))throw new Error("length must be a positive number");return p(f(e,t),n)},t.convertArea=function(e,n,o){if(void 0===n&&(n="meters"),void 0===o&&(o="kilometers"),!(e>=0))throw new Error("area must be a positive number");var r=t.areaFactors[n];if(!r)throw new Error("invalid original units");var i=t.areaFactors[o];if(!i)throw new Error("invalid final units");return e/r*i},t.isNumber=h,t.isObject=function(e){return!!e&&e.constructor===Object},t.validateBBox=function(e){if(!e)throw new Error("bbox is required");if(!Array.isArray(e))throw new Error("bbox must be an Array");if(4!==e.length&&6!==e.length)throw new Error("bbox must be an Array of 4 or 6 numbers");e.forEach((function(e){if(!h(e))throw new Error("bbox must only contain numbers")}))},t.validateId=function(e){if(!e)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof e))throw new Error("id must be a number or a string")},t.radians2degrees=function(){throw new Error("method has been renamed to `radiansToDegrees`")},t.degrees2radians=function(){throw new Error("method has been renamed to `degreesToRadians`")},t.distanceToDegrees=function(){throw new Error("method has been renamed to `lengthToDegrees`")},t.distanceToRadians=function(){throw new Error("method has been renamed to `lengthToRadians`")},t.radiansToDistance=function(){throw new Error("method has been renamed to `radiansToLength`")},t.bearingToAngle=function(){throw new Error("method has been renamed to `bearingToAzimuth`")},t.convertDistance=function(){throw new Error("method has been renamed to `convertLength`")}},function(e,t,n){(function(t){var n;e.exports=function e(t,o,r){function i(a,c){if(!o[a]){if(!t[a]){if(!c&&"function"==typeof n&&n)return n(a,!0);if(s)return s(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var l=o[a]={exports:{}};t[a][0].call(l.exports,(function(e){return i(t[a][1][e]||e)}),l,l.exports,e,t,o,r)}return o[a].exports}for(var s="function"==typeof n&&n,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(e,t,n){"use strict";var o=e("./src/setup"),r=e("./src/options"),i=e("./src/api"),s=e("./src/constants");t.exports=function(e){!function(e,t){var n={options:e=r(e)};t=i(n,t),n.api=t;var a=o(n);t.onAdd=a.onAdd,t.onRemove=a.onRemove,t.types=s.types,t.options=e}(e,this)},t.exports.modes=e("./src/modes")},{"./src/api":22,"./src/constants":23,"./src/modes":56,"./src/options":61,"./src/setup":63}],2:[function(e,t,n){function o(e){if(!(this instanceof o))return new o(e);this._bbox=e||[1/0,1/0,-1/0,-1/0],this._valid=!!e}t.exports=o,o.prototype.include=function(e){return this._valid=!0,this._bbox[0]=Math.min(this._bbox[0],e[0]),this._bbox[1]=Math.min(this._bbox[1],e[1]),this._bbox[2]=Math.max(this._bbox[2],e[0]),this._bbox[3]=Math.max(this._bbox[3],e[1]),this},o.prototype.equals=function(e){var t;return t=e instanceof o?e.bbox():e,this._bbox[0]==t[0]&&this._bbox[1]==t[1]&&this._bbox[2]==t[2]&&this._bbox[3]==t[3]},o.prototype.center=function(e){return this._valid?[(this._bbox[0]+this._bbox[2])/2,(this._bbox[1]+this._bbox[3])/2]:null},o.prototype.union=function(e){var t;return this._valid=!0,t=e instanceof o?e.bbox():e,this._bbox[0]=Math.min(this._bbox[0],t[0]),this._bbox[1]=Math.min(this._bbox[1],t[1]),this._bbox[2]=Math.max(this._bbox[2],t[2]),this._bbox[3]=Math.max(this._bbox[3],t[3]),this},o.prototype.bbox=function(){return this._valid?this._bbox:null},o.prototype.contains=function(e){if(!e)return this._fastContains();if(!this._valid)return null;var t=e[0],n=e[1];return this._bbox[0]<=t&&this._bbox[1]<=n&&this._bbox[2]>=t&&this._bbox[3]>=n},o.prototype.intersect=function(e){return this._valid?(t=e instanceof o?e.bbox():e,!(this._bbox[0]>t[2]||this._bbox[2]<t[0]||this._bbox[3]<t[1]||this._bbox[1]>t[3])):null;var t},o.prototype._fastContains=function(){if(!this._valid)return new Function("return null;");var e="return "+this._bbox[0]+"<= ll[0] &&"+this._bbox[1]+"<= ll[1] &&"+this._bbox[2]+">= ll[0] &&"+this._bbox[3]+">= ll[1]";return new Function("ll",e)},o.prototype.polygon=function(){return this._valid?{type:"Polygon",coordinates:[[[this._bbox[0],this._bbox[1]],[this._bbox[2],this._bbox[1]],[this._bbox[2],this._bbox[3]],[this._bbox[0],this._bbox[3]],[this._bbox[0],this._bbox[1]]]]}:null}},{}],3:[function(e,t,n){function o(e){var t=0;if(e&&e.length>0){t+=Math.abs(r(e[0]));for(var n=1;n<e.length;n++)t-=Math.abs(r(e[n]))}return t}function r(e){var t,n,o,r,a,c,u=0,l=e.length;if(l>2){for(c=0;c<l;c++)c===l-2?(o=l-2,r=l-1,a=0):c===l-1?(o=l-1,r=0,a=1):(o=c,r=c+1,a=c+2),t=e[o],n=e[r],u+=(i(e[a][0])-i(t[0]))*Math.sin(i(n[1]));u=u*s.RADIUS*s.RADIUS/2}return u}function i(e){return e*Math.PI/180}var s=e("wgs84");t.exports.geometry=function e(t){var n,r=0;switch(t.type){case"Polygon":return o(t.coordinates);case"MultiPolygon":for(n=0;n<t.coordinates.length;n++)r+=o(t.coordinates[n]);return r;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0;case"GeometryCollection":for(n=0;n<t.geometries.length;n++)r+=e(t.geometries[n]);return r}},t.exports.ring=r},{wgs84:20}],4:[function(e,t,n){t.exports=function(e){return function e(t){return Array.isArray(t)&&t.length&&"number"==typeof t[0]?[t]:t.reduce((function(t,n){return Array.isArray(n)&&Array.isArray(n[0])?t.concat(e(n)):(t.push(n),t)}),[])}(e)}},{}],5:[function(e,t,n){var o=e("@mapbox/geojson-normalize"),r=e("geojson-flatten"),i=e("./flatten");t.exports=function(e){if(!e)return[];var t=[];return r(o(e)).features.forEach((function(e){e.geometry&&(t=t.concat(i(e.geometry.coordinates)))})),t}},{"./flatten":4,"@mapbox/geojson-normalize":7,"geojson-flatten":13}],6:[function(e,t,n){function o(e){for(var t=s(),n=r(e),o=0;o<n.length;o++)t.include(n[o]);return t}var r=e("@mapbox/geojson-coords"),i=e("traverse"),s=e("@mapbox/extent"),a={features:["FeatureCollection"],coordinates:["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],geometry:["Feature"],geometries:["GeometryCollection"]},c=Object.keys(a);t.exports=function(e){return o(e).bbox()},t.exports.polygon=function(e){return o(e).polygon()},t.exports.bboxify=function(e){return i(e).map((function(e){e&&c.some((function(t){return!!e[t]&&-1!==a[t].indexOf(e.type)}))&&(e.bbox=o(e).bbox(),this.update(e))}))}},{"@mapbox/extent":2,"@mapbox/geojson-coords":5,traverse:19}],7:[function(e,t,n){t.exports=function(e){if(!e||!e.type)return null;var t=o[e.type];return t?"geometry"===t?{type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:e}]}:"feature"===t?{type:"FeatureCollection",features:[e]}:"featurecollection"===t?e:void 0:null};var o={Point:"geometry",MultiPoint:"geometry",LineString:"geometry",MultiLineString:"geometry",Polygon:"geometry",MultiPolygon:"geometry",GeometryCollection:"geometry",Feature:"feature",FeatureCollection:"featurecollection"}},{}],8:[function(e,t,n){var o=e("jsonlint-lines"),r=e("./object");t.exports.hint=function(e,t){var n,i=[];if("object"==typeof e)n=e;else{if("string"!=typeof e)return[{message:"Expected string or object as input",line:0}];try{n=o.parse(e)}catch(e){var s=e.message.match(/line (\d+)/);return[{line:parseInt(s[1],10)-1,message:e.message,error:e}]}}return i.concat(r.hint(n,t))}},{"./object":9,"jsonlint-lines":15}],9:[function(e,t,n){var o=e("./rhr");t.exports.hint=function(e,t){function n(e){if(t&&!1===t.noDuplicateMembers||!e.__duplicateProperties__||p.push({message:"An object contained duplicate members, making parsing ambigous: "+e.__duplicateProperties__.join(", "),line:e.__line__}),!i(e,"type","string"))if(g[e.type])e&&g[e.type](e);else{var n=y[e.type.toLowerCase()];void 0!==n?p.push({message:"Expected "+n+" but got "+e.type+" (case sensitive)",line:e.__line__}):p.push({message:"The type "+e.type+" is unknown",line:e.__line__})}}function r(e,t){return e.every((function(e){return null!==e&&typeof e===t}))}function i(e,t,n){if(void 0===e[t])return p.push({message:'"'+t+'" member required',line:e.__line__});if("array"===n){if(!Array.isArray(e[t]))return p.push({message:'"'+t+'" member should be an array, but is an '+typeof e[t]+" instead",line:e.__line__})}else{if("object"===n&&e[t]&&"Object"!==e[t].constructor.name)return p.push({message:'"'+t+'" member should be '+n+", but is an "+e[t].constructor.name+" instead",line:e.__line__});if(n&&typeof e[t]!==n)return p.push({message:'"'+t+'" member should be '+n+", but is an "+typeof e[t]+" instead",line:e.__line__})}}function s(e,n){if(!Array.isArray(e))return p.push({message:"position should be an array, is a "+typeof e+" instead",line:e.__line__||n});if(e.length<2)return p.push({message:"position must have 2 or more elements",line:e.__line__||n});if(e.length>3)return p.push({message:"position should not have more than 3 elements",level:"message",line:e.__line__||n});if(!r(e,"number"))return p.push({message:"each element in a position must be a number",line:e.__line__||n});if(t&&t.precisionWarning){if(f===d)return f+=1,p.push({message:"truncated warnings: we've encountered coordinate precision warning "+d+" times, no more warnings will be reported",level:"message",line:e.__line__||n});f<d&&e.forEach((function(t){var o=0,r=String(t).split(".")[1];if(void 0!==r&&(o=r.length),o>h)return f+=1,p.push({message:"precision of coordinates should be reduced",level:"message",line:e.__line__||n})}))}}function a(e,t,n,o){if(void 0===o&&void 0!==e.__line__&&(o=e.__line__),0===n)return s(e,o);if(1===n&&t)if("LinearRing"===t){if(!Array.isArray(e[e.length-1]))return p.push({message:"a number was found where a coordinate array should have been found: this needs to be nested more deeply",line:o}),!0;if(e.length<4&&p.push({message:"a LinearRing of coordinates needs to have four or more positions",line:o}),e.length&&(e[e.length-1].length!==e[0].length||!e[e.length-1].every((function(t,n){return e[0][n]===t}))))return p.push({message:"the first and last positions in a LinearRing of coordinates must be the same",line:o}),!0}else if("Line"===t&&e.length<2)return p.push({message:"a line needs to have two or more coordinates to be valid",line:o});if(Array.isArray(e))return e.map((function(e){return a(e,t,n-1,e.__line__||o)})).some((function(e){return e}));p.push({message:"a number was found where a coordinate array should have been found: this needs to be nested more deeply",line:o})}function c(e){e.crs&&("object"==typeof e.crs&&e.crs.properties&&"urn:ogc:def:crs:OGC:1.3:CRS84"===e.crs.properties.name?p.push({message:"old-style crs member is not recommended, this object is equivalent to the default and should be removed",line:e.__line__}):p.push({message:"old-style crs member is not recommended",line:e.__line__}))}function u(e){if(e.bbox)return Array.isArray(e.bbox)?(r(e.bbox,"number")||p.push({message:"each element in a bbox member must be a number",line:e.bbox.__line__}),4!==e.bbox.length&&6!==e.bbox.length&&p.push({message:"bbox must contain 4 elements (for 2D) or 6 elements (for 3D)",line:e.bbox.__line__}),p.length):void p.push({message:"bbox member must be an array of numbers, but is a "+typeof e.bbox,line:e.__line__})}function l(e){c(e),u(e),void 0!==e.id&&"string"!=typeof e.id&&"number"!=typeof e.id&&p.push({message:'Feature "id" member must have a string or number value',line:e.__line__}),void 0!==e.features&&p.push({message:'Feature object cannot contain a "features" member',line:e.__line__}),void 0!==e.coordinates&&p.push({message:'Feature object cannot contain a "coordinates" member',line:e.__line__}),"Feature"!==e.type&&p.push({message:"GeoJSON features must have a type=feature member",line:e.__line__}),i(e,"properties","object"),i(e,"geometry","object")||e.geometry&&n(e.geometry)}var p=[],f=0,d=10,h=6,g={Point:function(e){c(e),u(e),function(e){void 0!==e.properties&&p.push({message:'geometry object cannot contain a "properties" member',line:e.__line__}),void 0!==e.geometry&&p.push({message:'geometry object cannot contain a "geometry" member',line:e.__line__}),void 0!==e.features&&p.push({message:'geometry object cannot contain a "features" member',line:e.__line__})}(e),i(e,"coordinates","array")||s(e.coordinates)},Feature:l,MultiPoint:function(e){c(e),u(e),i(e,"coordinates","array")||a(e.coordinates,"",1)},LineString:function(e){c(e),u(e),i(e,"coordinates","array")||a(e.coordinates,"Line",1)},MultiLineString:function(e){c(e),u(e),i(e,"coordinates","array")||a(e.coordinates,"Line",2)},FeatureCollection:function(e){if(c(e),u(e),void 0!==e.properties&&p.push({message:'FeatureCollection object cannot contain a "properties" member',line:e.__line__}),void 0!==e.coordinates&&p.push({message:'FeatureCollection object cannot contain a "coordinates" member',line:e.__line__}),!i(e,"features","array")){if(!r(e.features,"object"))return p.push({message:"Every feature must be an object",line:e.__line__});e.features.forEach(l)}},GeometryCollection:function(e){c(e),u(e),i(e,"geometries","array")||(r(e.geometries,"object")||p.push({message:"The geometries array in a GeometryCollection must contain only geometry objects",line:e.__line__}),1===e.geometries.length&&p.push({message:"GeometryCollection with a single geometry should be avoided in favor of single part or a single object of multi-part type",line:e.geometries.__line__}),e.geometries.forEach((function(t){t&&("GeometryCollection"===t.type&&p.push({message:"GeometryCollection should avoid nested geometry collections",line:e.geometries.__line__}),n(t))})))},Polygon:function(e){c(e),u(e),i(e,"coordinates","array")||a(e.coordinates,"LinearRing",2)||o(e,p)},MultiPolygon:function(e){c(e),u(e),i(e,"coordinates","array")||a(e.coordinates,"LinearRing",3)||o(e,p)}},y=Object.keys(g).reduce((function(e,t){return e[t.toLowerCase()]=t,e}),{});return"object"!=typeof e||null==e?(p.push({message:"The root of a GeoJSON object must be an object.",line:0}),p):(n(e),p.forEach((function(e){({}).hasOwnProperty.call(e,"line")&&void 0===e.line&&delete e.line})),p)}},{"./rhr":10}],10:[function(e,t,n){function o(e){return e*Math.PI/180}function r(e){var t=0;if(e.length>2)for(var n,r,i=0;i<e.length-1;i++)n=e[i],t+=o((r=e[i+1])[0]-n[0])*(2+Math.sin(o(n[1]))+Math.sin(o(r[1])));return t>=0}function i(e){if(e&&e.length>0){if(r(e[0]))return!1;if(!e.slice(1,e.length).every(r))return!1}return!0}t.exports=function(e,t){(function(e){return"Polygon"===e.type?i(e.coordinates):"MultiPolygon"===e.type?e.coordinates.every(i):void 0})(e)||t.push({message:"Polygons and MultiPolygons should follow the right-hand rule",level:"message",line:e.__line__})}},{}],11:[function(e,t,n){"use strict";function o(e,t){this.x=e,this.y=t}t.exports=o,o.prototype={clone:function(){return new o(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,n=e.y-this.y;return t*t+n*n},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[0]*this.x+e[1]*this.y,n=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=n,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),n=Math.sin(e),o=t*this.x-n*this.y,r=n*this.x+t*this.y;return this.x=o,this.y=r,this},_rotateAround:function(e,t){var n=Math.cos(e),o=Math.sin(e),r=t.x+n*(this.x-t.x)-o*(this.y-t.y),i=t.y+o*(this.x-t.x)+n*(this.y-t.y);return this.x=r,this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},o.convert=function(e){return e instanceof o?e:Array.isArray(e)?new o(e[0],e[1]):e}},{}],12:[function(e,t,n){},{}],13:[function(e,t,n){t.exports=function e(t){switch(t&&t.type||null){case"FeatureCollection":return t.features=t.features.reduce((function(t,n){return t.concat(e(n))}),[]),t;case"Feature":return t.geometry?e(t.geometry).map((function(e){return{type:"Feature",properties:JSON.parse(JSON.stringify(t.properties)),geometry:e}})):t;case"MultiPoint":return t.coordinates.map((function(e){return{type:"Point",coordinates:e}}));case"MultiPolygon":return t.coordinates.map((function(e){return{type:"Polygon",coordinates:e}}));case"MultiLineString":return t.coordinates.map((function(e){return{type:"LineString",coordinates:e}}));case"GeometryCollection":return t.geometries.map(e).reduce((function(e,t){return e.concat(t)}),[]);case"Point":case"Polygon":case"LineString":return[t]}}},{}],14:[function(e,t,n){var o=t.exports=function(e,t){if(t||(t=16),void 0===e&&(e=128),e<=0)return"0";for(var n=Math.log(Math.pow(2,e))/Math.log(t),r=2;n===1/0;r*=2)n=Math.log(Math.pow(2,e/r))/Math.log(t)*r;var i=n-Math.floor(n),s="";for(r=0;r<Math.floor(n);r++)s=(c=Math.floor(Math.random()*t).toString(t))+s;if(i){var a=Math.pow(t,i),c=Math.floor(Math.random()*a).toString(t);s=c+s}var u=parseInt(s,t);return u!==1/0&&u>=Math.pow(2,e)?o(e,t):s};o.rack=function(e,t,n){var r=function(r){var s=0;do{if(s++>10){if(!n)throw new Error("too many ID collisions, use more bits");e+=n}var a=o(e,t)}while(Object.hasOwnProperty.call(i,a));return i[a]=r,a},i=r.hats={};return r.get=function(e){return r.hats[e]},r.set=function(e,t){return r.hats[e]=t,r},r.bits=e||128,r.base=t||16,r}},{}],15:[function(e,t,n){(function(o){var r=function(){function e(){this.yy={}}var t=function(e,t,n,o){for(n=n||{},o=e.length;o--;n[e[o]]=t);return n},n=[1,12],o=[1,13],r=[1,9],i=[1,10],s=[1,11],a=[1,14],c=[1,15],u=[14,18,22,24],l=[18,22],p=[22,24],f={trace:function(){},yy:{},symbols_:{error:2,JSONString:3,STRING:4,JSONNumber:5,NUMBER:6,JSONNullLiteral:7,NULL:8,JSONBooleanLiteral:9,TRUE:10,FALSE:11,JSONText:12,JSONValue:13,EOF:14,JSONObject:15,JSONArray:16,"{":17,"}":18,JSONMemberList:19,JSONMember:20,":":21,",":22,"[":23,"]":24,JSONElementList:25,$accept:0,$end:1},terminals_:{2:"error",4:"STRING",6:"NUMBER",8:"NULL",10:"TRUE",11:"FALSE",14:"EOF",17:"{",18:"}",21:":",22:",",23:"[",24:"]"},productions_:[0,[3,1],[5,1],[7,1],[9,1],[9,1],[12,2],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[15,2],[15,3],[20,3],[19,1],[19,3],[16,2],[16,3],[25,1],[25,3]],performAction:function(e,t,n,o,r,i,s){var a=i.length-1;switch(r){case 1:this.$=e.replace(/\\(\\|")/g,"$1").replace(/\\n/g,"\n").replace(/\\r/g,"\r").replace(/\\t/g,"\t").replace(/\\v/g,"\v").replace(/\\f/g,"\f").replace(/\\b/g,"\b");break;case 2:this.$=Number(e);break;case 3:this.$=null;break;case 4:this.$=!0;break;case 5:this.$=!1;break;case 6:return this.$=i[a-1];case 13:this.$={},Object.defineProperty(this.$,"__line__",{value:this._$.first_line,enumerable:!1});break;case 14:case 19:this.$=i[a-1],Object.defineProperty(this.$,"__line__",{value:this._$.first_line,enumerable:!1});break;case 15:this.$=[i[a-2],i[a]];break;case 16:this.$={},this.$[i[a][0]]=i[a][1];break;case 17:this.$=i[a-2],void 0!==i[a-2][i[a][0]]&&(this.$.__duplicateProperties__||Object.defineProperty(this.$,"__duplicateProperties__",{value:[],enumerable:!1}),this.$.__duplicateProperties__.push(i[a][0])),i[a-2][i[a][0]]=i[a][1];break;case 18:this.$=[],Object.defineProperty(this.$,"__line__",{value:this._$.first_line,enumerable:!1});break;case 20:this.$=[i[a]];break;case 21:this.$=i[a-2],i[a-2].push(i[a])}},table:[{3:5,4:n,5:6,6:o,7:3,8:r,9:4,10:i,11:s,12:1,13:2,15:7,16:8,17:a,23:c},{1:[3]},{14:[1,16]},t(u,[2,7]),t(u,[2,8]),t(u,[2,9]),t(u,[2,10]),t(u,[2,11]),t(u,[2,12]),t(u,[2,3]),t(u,[2,4]),t(u,[2,5]),t([14,18,21,22,24],[2,1]),t(u,[2,2]),{3:20,4:n,18:[1,17],19:18,20:19},{3:5,4:n,5:6,6:o,7:3,8:r,9:4,10:i,11:s,13:23,15:7,16:8,17:a,23:c,24:[1,21],25:22},{1:[2,6]},t(u,[2,13]),{18:[1,24],22:[1,25]},t(l,[2,16]),{21:[1,26]},t(u,[2,18]),{22:[1,28],24:[1,27]},t(p,[2,20]),t(u,[2,14]),{3:20,4:n,20:29},{3:5,4:n,5:6,6:o,7:3,8:r,9:4,10:i,11:s,13:30,15:7,16:8,17:a,23:c},t(u,[2,19]),{3:5,4:n,5:6,6:o,7:3,8:r,9:4,10:i,11:s,13:31,15:7,16:8,17:a,23:c},t(l,[2,17]),t(l,[2,15]),t(p,[2,21])],defaultActions:{16:[2,6]},parseError:function(e,t){function n(e,t){this.message=e,this.hash=t}if(!t.recoverable)throw n.prototype=Error,new n(e,t);this.trace(e)},parse:function(e){var t=this,n=[0],o=[null],r=[],i=this.table,s="",a=0,c=0,u=0,l=r.slice.call(arguments,1),p=Object.create(this.lexer),f={yy:{}};for(var d in this.yy)Object.prototype.hasOwnProperty.call(this.yy,d)&&(f.yy[d]=this.yy[d]);p.setInput(e,f.yy),f.yy.lexer=p,f.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var h=p.yylloc;r.push(h);var g=p.options&&p.options.ranges;"function"==typeof f.yy.parseError?this.parseError=f.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var y,m,_,v,b,E,T,x,O,I=function(){var e;return"number"!=typeof(e=p.lex()||1)&&(e=t.symbols_[e]||e),e},S={};;){if(_=n[n.length-1],this.defaultActions[_]?v=this.defaultActions[_]:(null!=y||(y=I()),v=i[_]&&i[_][y]),void 0===v||!v.length||!v[0]){var C="";for(E in O=[],i[_])this.terminals_[E]&&E>2&&O.push("'"+this.terminals_[E]+"'");C=p.showPosition?"Parse error on line "+(a+1)+":\n"+p.showPosition()+"\nExpecting "+O.join(", ")+", got '"+(this.terminals_[y]||y)+"'":"Parse error on line "+(a+1)+": Unexpected "+(1==y?"end of input":"'"+(this.terminals_[y]||y)+"'"),this.parseError(C,{text:p.match,token:this.terminals_[y]||y,line:p.yylineno,loc:h,expected:O})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+_+", token: "+y);switch(v[0]){case 1:n.push(y),o.push(p.yytext),r.push(p.yylloc),n.push(v[1]),y=null,m?(y=m,m=null):(c=p.yyleng,s=p.yytext,a=p.yylineno,h=p.yylloc,u>0&&u--);break;case 2:if(T=this.productions_[v[1]][1],S.$=o[o.length-T],S._$={first_line:r[r.length-(T||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(T||1)].first_column,last_column:r[r.length-1].last_column},g&&(S._$.range=[r[r.length-(T||1)].range[0],r[r.length-1].range[1]]),void 0!==(b=this.performAction.apply(S,[s,c,a,f.yy,v[1],o,r].concat(l))))return b;T&&(n=n.slice(0,-1*T*2),o=o.slice(0,-1*T),r=r.slice(0,-1*T)),n.push(this.productions_[v[1]][0]),o.push(S.$),r.push(S._$),x=i[n[n.length-2]][n[n.length-1]],n.push(x);break;case 3:return!0}}return!0}},d={EOF:1,parseError:function(e,t){if(!this.yy.parser)throw new Error(e);this.yy.parser.parseError(e,t)},setInput:function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},unput:function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var o=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var r=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===o.length?this.yylloc.first_column:0)+o[o.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[r[0],r[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(e){this.unput(this.match.slice(e))},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=new Array(e.length+1).join("-");return e+this.upcomingInput()+"\n"+t+"^"},test_match:function(e,t){var n,o,r;if(this.options.backtrack_lexer&&(r={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(r.yylloc.range=this.yylloc.range.slice(0))),(o=e[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=o.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:o?o[o.length-1].length-o[o.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],n=this.performAction.call(this,this.yy,this,t,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var i in r)this[i]=r[i];return!1}return!1},next:function(){if(this.done)return this.EOF;var e,t,n,o;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var r=this._currentRules(),i=0;i<r.length;i++)if((n=this._input.match(this.rules[r[i]]))&&(!t||n[0].length>t[0].length)){if(t=n,o=i,this.options.backtrack_lexer){if(!1!==(e=this.test_match(n,r[i])))return e;if(this._backtrack){t=!1;continue}return!1}if(!this.options.flex)break}return t?!1!==(e=this.test_match(t,r[o]))&&e:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(e){this.conditionStack.push(e)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(e){return(e=this.conditionStack.length-1-Math.abs(e||0))>=0?this.conditionStack[e]:"INITIAL"},pushState:function(e){this.begin(e)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(e,t,n,o){switch(n){case 0:break;case 1:return 6;case 2:return t.yytext=t.yytext.substr(1,t.yyleng-2),4;case 3:return 17;case 4:return 18;case 5:return 23;case 6:return 24;case 7:return 22;case 8:return 21;case 9:return 10;case 10:return 11;case 11:return 8;case 12:return 14;case 13:return"INVALID"}},rules:[/^(?:\s+)/,/^(?:(-?([0-9]|[1-9][0-9]+))(\.[0-9]+)?([eE][-+]?[0-9]+)?\b)/,/^(?:"(?:\\[\\"bfnrt\/]|\\u[a-fA-F0-9]{4}|[^\\\0-\x09\x0a-\x1f"])*")/,/^(?:\{)/,/^(?:\})/,/^(?:\[)/,/^(?:\])/,/^(?:,)/,/^(?::)/,/^(?:true\b)/,/^(?:false\b)/,/^(?:null\b)/,/^(?:$)/,/^(?:.)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13],inclusive:!0}}};return f.lexer=d,e.prototype=f,f.Parser=e,new e}();void 0!==e&&void 0!==n&&(n.parser=r,n.Parser=r.Parser,n.parse=function(){return r.parse.apply(r,arguments)},n.main=function(t){t[1]||(console.log("Usage: "+t[0]+" FILE"),o.exit(1));var r=e("fs").readFileSync(e("path").normalize(t[1]),"utf8");return n.parser.parse(r)},void 0!==t&&e.main===t&&n.main(o.argv.slice(1)))}).call(this,e("_process"))},{_process:18,fs:12,path:17}],16:[function(e,n,o){(function(e){function t(e,t){for(var n=-1,o=null==e?0:e.length;++n<o;)if(t(e[n],n,e))return!0;return!1}function r(e,t){return e.has(t)}function i(e){var t=-1,n=Array(e.size);return e.forEach((function(e,o){n[++t]=[o,e]})),n}function s(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}function a(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}function u(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}function l(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new u;++t<n;)this.add(e[t])}function p(e){var t=this.__data__=new c(e);this.size=t.size}function f(e,t){var n=qe(e),o=!n&&Xe(e),r=!n&&!o&&Ke(e),i=!n&&!o&&!r&&We(e),s=n||o||r||i,a=s?function(e,t){for(var n=-1,o=Array(e);++n<e;)o[n]=t(n);return o}(e.length,String):[],c=a.length;for(var u in e)!t&&!ve.call(e,u)||s&&("length"==u||r&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||O(u,c))||a.push(u);return a}function d(e,t){for(var n=e.length;n--;)if(S(e[n][0],t))return n;return-1}function h(e){return null==e?void 0===e?Q:Y:Le&&Le in Object(e)?function(e){var t=ve.call(e,Le),n=e[Le];try{e[Le]=void 0;var o=!0}catch(e){}var r=Ee.call(e);return o&&(t?e[Le]=n:delete e[Le]),r}(e):function(e){return Ee.call(e)}(e)}function g(e){return w(e)&&h(e)==j}function y(e,t,n,o,r){return e===t||(null==e||null==t||!w(e)&&!w(t)?e!=e&&t!=t:function(e,t,n,o,r,i){var s=qe(e),a=qe(t),c=s?k:Ye(e),u=a?k:Ye(t),l=(c=c==j?X:c)==X,f=(u=u==j?X:u)==X,d=c==u;if(d&&Ke(e)){if(!Ke(t))return!1;s=!0,l=!1}if(d&&!l)return i||(i=new p),s||We(e)?v(e,t,n,o,r,i):b(e,t,c,n,o,r,i);if(!(n&P)){var h=l&&ve.call(e,"__wrapped__"),g=f&&ve.call(t,"__wrapped__");if(h||g){var y=h?e.value():e,m=g?t.value():t;return i||(i=new p),r(y,m,n,o,i)}}return!!d&&(i||(i=new p),function(e,t,n,o,r,i){var s=n&P,a=E(e),c=a.length;if(c!=E(t).length&&!s)return!1;for(var u=c;u--;){var l=a[u];if(!(s?l in t:ve.call(t,l)))return!1}var p=i.get(e);if(p&&i.get(t))return p==t;var f=!0;i.set(e,t),i.set(t,e);for(var d=s;++u<c;){var h=e[l=a[u]],g=t[l];if(o)var y=s?o(g,h,l,t,e,i):o(h,g,l,e,t,i);if(!(void 0===y?h===g||r(h,g,n,o,i):y)){f=!1;break}d||(d="constructor"==l)}if(f&&!d){var m=e.constructor,_=t.constructor;m!=_&&"constructor"in e&&"constructor"in t&&!("function"==typeof m&&m instanceof m&&"function"==typeof _&&_ instanceof _)&&(f=!1)}return i.delete(e),i.delete(t),f}(e,t,n,o,r,i))}(e,t,n,o,y,r))}function m(e){return!(!M(e)||function(e){return!!be&&be in e}(e))&&(C(e)?Te:ne).test(I(e))}function _(e){if(!function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ye)}(e))return Ne(e);var t=[];for(var n in Object(e))ve.call(e,n)&&"constructor"!=n&&t.push(n);return t}function v(e,n,o,i,s,a){var c=o&P,u=e.length,p=n.length;if(u!=p&&!(c&&p>u))return!1;var f=a.get(e);if(f&&a.get(n))return f==n;var d=-1,h=!0,g=o&F?new l:void 0;for(a.set(e,n),a.set(n,e);++d<u;){var y=e[d],m=n[d];if(i)var _=c?i(m,y,d,n,e,a):i(y,m,d,e,n,a);if(void 0!==_){if(_)continue;h=!1;break}if(g){if(!t(n,(function(e,t){if(!r(g,t)&&(y===e||s(y,e,o,i,a)))return g.push(t)}))){h=!1;break}}else if(y!==m&&!s(y,m,o,i,a)){h=!1;break}}return a.delete(e),a.delete(n),h}function b(e,t,n,o,r,a,c){switch(n){case te:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case ee:return!(e.byteLength!=t.byteLength||!a(new Ie(e),new Ie(t)));case U:case G:case z:return S(+e,+t);case V:return e.name==t.name&&e.message==t.message;case K:case Z:return e==t+"";case J:var u=i;case W:var l=o&P;if(u||(u=s),e.size!=t.size&&!l)return!1;var p=c.get(e);if(p)return p==t;o|=F,c.set(e,t);var f=v(u(e),u(t),o,r,a,c);return c.delete(e),f;case H:if(Je)return Je.call(e)==Je.call(t)}return!1}function E(e){return function(e,t,n){var o=t(e);return qe(e)?o:function(e,t){for(var n=-1,o=t.length,r=e.length;++n<o;)e[r+n]=t[n];return e}(o,n(e))}(e,N,ze)}function T(e,t){var n=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map}function x(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return m(n)?n:void 0}function O(e,t){return!!(t=null==t?R:t)&&("number"==typeof e||oe.test(e))&&e>-1&&e%1==0&&e<t}function I(e){if(null!=e){try{return _e.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function S(e,t){return e===t||e!=e&&t!=t}function C(e){if(!M(e))return!1;var t=h(e);return t==B||t==$||t==D||t==q}function L(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=R}function M(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function w(e){return null!=e&&"object"==typeof e}function N(e){return function(e){return null!=e&&L(e.length)&&!C(e)}(e)?f(e):_(e)}var A="__lodash_hash_undefined__",P=1,F=2,R=9007199254740991,j="[object Arguments]",k="[object Array]",D="[object AsyncFunction]",U="[object Boolean]",G="[object Date]",V="[object Error]",B="[object Function]",$="[object GeneratorFunction]",J="[object Map]",z="[object Number]",Y="[object Null]",X="[object Object]",q="[object Proxy]",K="[object RegExp]",W="[object Set]",Z="[object String]",H="[object Symbol]",Q="[object Undefined]",ee="[object ArrayBuffer]",te="[object DataView]",ne=/^\[object .+?Constructor\]$/,oe=/^(?:0|[1-9]\d*)$/,re={};re["[object Float32Array]"]=re["[object Float64Array]"]=re["[object Int8Array]"]=re["[object Int16Array]"]=re["[object Int32Array]"]=re["[object Uint8Array]"]=re["[object Uint8ClampedArray]"]=re["[object Uint16Array]"]=re["[object Uint32Array]"]=!0,re[j]=re[k]=re[ee]=re[U]=re[te]=re[G]=re[V]=re[B]=re[J]=re[z]=re[X]=re[K]=re[W]=re[Z]=re["[object WeakMap]"]=!1;var ie="object"==typeof e&&e&&e.Object===Object&&e,se="object"==typeof self&&self&&self.Object===Object&&self,ae=ie||se||Function("return this")(),ce="object"==typeof o&&o&&!o.nodeType&&o,ue=ce&&"object"==typeof n&&n&&!n.nodeType&&n,le=ue&&ue.exports===ce,pe=le&&ie.process,fe=function(){try{return pe&&pe.binding&&pe.binding("util")}catch(e){}}(),de=fe&&fe.isTypedArray,he=Array.prototype,ge=Function.prototype,ye=Object.prototype,me=ae["__core-js_shared__"],_e=ge.toString,ve=ye.hasOwnProperty,be=function(){var e=/[^.]+$/.exec(me&&me.keys&&me.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Ee=ye.toString,Te=RegExp("^"+_e.call(ve).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),xe=le?ae.Buffer:void 0,Oe=ae.Symbol,Ie=ae.Uint8Array,Se=ye.propertyIsEnumerable,Ce=he.splice,Le=Oe?Oe.toStringTag:void 0,Me=Object.getOwnPropertySymbols,we=xe?xe.isBuffer:void 0,Ne=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object),Ae=x(ae,"DataView"),Pe=x(ae,"Map"),Fe=x(ae,"Promise"),Re=x(ae,"Set"),je=x(ae,"WeakMap"),ke=x(Object,"create"),De=I(Ae),Ue=I(Pe),Ge=I(Fe),Ve=I(Re),Be=I(je),$e=Oe?Oe.prototype:void 0,Je=$e?$e.valueOf:void 0;a.prototype.clear=function(){this.__data__=ke?ke(null):{},this.size=0},a.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},a.prototype.get=function(e){var t=this.__data__;if(ke){var n=t[e];return n===A?void 0:n}return ve.call(t,e)?t[e]:void 0},a.prototype.has=function(e){var t=this.__data__;return ke?void 0!==t[e]:ve.call(t,e)},a.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=ke&&void 0===t?A:t,this},c.prototype.clear=function(){this.__data__=[],this.size=0},c.prototype.delete=function(e){var t=this.__data__,n=d(t,e);return!(n<0||(n==t.length-1?t.pop():Ce.call(t,n,1),--this.size,0))},c.prototype.get=function(e){var t=this.__data__,n=d(t,e);return n<0?void 0:t[n][1]},c.prototype.has=function(e){return d(this.__data__,e)>-1},c.prototype.set=function(e,t){var n=this.__data__,o=d(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this},u.prototype.clear=function(){this.size=0,this.__data__={hash:new a,map:new(Pe||c),string:new a}},u.prototype.delete=function(e){var t=T(this,e).delete(e);return this.size-=t?1:0,t},u.prototype.get=function(e){return T(this,e).get(e)},u.prototype.has=function(e){return T(this,e).has(e)},u.prototype.set=function(e,t){var n=T(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this},l.prototype.add=l.prototype.push=function(e){return this.__data__.set(e,A),this},l.prototype.has=function(e){return this.__data__.has(e)},p.prototype.clear=function(){this.__data__=new c,this.size=0},p.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},p.prototype.get=function(e){return this.__data__.get(e)},p.prototype.has=function(e){return this.__data__.has(e)},p.prototype.set=function(e,t){var n=this.__data__;if(n instanceof c){var o=n.__data__;if(!Pe||o.length<199)return o.push([e,t]),this.size=++n.size,this;n=this.__data__=new u(o)}return n.set(e,t),this.size=n.size,this};var ze=Me?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,o=null==e?0:e.length,r=0,i=[];++n<o;){var s=e[n];t(s,n,e)&&(i[r++]=s)}return i}(Me(e),(function(t){return Se.call(e,t)})))}:function(){return[]},Ye=h;(Ae&&Ye(new Ae(new ArrayBuffer(1)))!=te||Pe&&Ye(new Pe)!=J||Fe&&"[object Promise]"!=Ye(Fe.resolve())||Re&&Ye(new Re)!=W||je&&"[object WeakMap]"!=Ye(new je))&&(Ye=function(e){var t=h(e),n=t==X?e.constructor:void 0,o=n?I(n):"";if(o)switch(o){case De:return te;case Ue:return J;case Ge:return"[object Promise]";case Ve:return W;case Be:return"[object WeakMap]"}return t});var Xe=g(function(){return arguments}())?g:function(e){return w(e)&&ve.call(e,"callee")&&!Se.call(e,"callee")},qe=Array.isArray,Ke=we||function(){return!1},We=de?function(e){return function(t){return e(t)}}(de):function(e){return w(e)&&L(e.length)&&!!re[h(e)]};n.exports=function(e,t){return y(e,t)}}).call(this,void 0!==t?t:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],17:[function(e,t,n){(function(e){function t(e,t){for(var n=0,o=e.length-1;o>=0;o--){var r=e[o];"."===r?e.splice(o,1):".."===r?(e.splice(o,1),n++):n&&(e.splice(o,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function o(e,t){if(e.filter)return e.filter(t);for(var n=[],o=0;o<e.length;o++)t(e[o],o,e)&&n.push(e[o]);return n}var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,i=function(e){return r.exec(e).slice(1)};n.resolve=function(){for(var n="",r=!1,i=arguments.length-1;i>=-1&&!r;i--){var s=i>=0?arguments[i]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(n=s+"/"+n,r="/"===s.charAt(0))}return(r?"/":"")+(n=t(o(n.split("/"),(function(e){return!!e})),!r).join("/"))||"."},n.normalize=function(e){var r=n.isAbsolute(e),i="/"===s(e,-1);return(e=t(o(e.split("/"),(function(e){return!!e})),!r).join("/"))||r||(e="."),e&&i&&(e+="/"),(r?"/":"")+e},n.isAbsolute=function(e){return"/"===e.charAt(0)},n.join=function(){var e=Array.prototype.slice.call(arguments,0);return n.normalize(o(e,(function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e})).join("/"))},n.relative=function(e,t){function o(e){for(var t=0;t<e.length&&""===e[t];t++);for(var n=e.length-1;n>=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=n.resolve(e).substr(1),t=n.resolve(t).substr(1);for(var r=o(e.split("/")),i=o(t.split("/")),s=Math.min(r.length,i.length),a=s,c=0;c<s;c++)if(r[c]!==i[c]){a=c;break}var u=[];for(c=a;c<r.length;c++)u.push("..");return(u=u.concat(i.slice(a))).join("/")},n.sep="/",n.delimiter=":",n.dirname=function(e){var t=i(e),n=t[0],o=t[1];return n||o?(o&&(o=o.substr(0,o.length-1)),n+o):"."},n.basename=function(e,t){var n=i(e)[2];return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},n.extname=function(e){return i(e)[3]};var s="b"==="ab".substr(-1)?function(e,t,n){return e.substr(t,n)}:function(e,t,n){return t<0&&(t=e.length+t),e.substr(t,n)}}).call(this,e("_process"))},{_process:18}],18:[function(e,t,n){function o(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(e){if(l===setTimeout)return setTimeout(e,0);if((l===o||!l)&&setTimeout)return l=setTimeout,setTimeout(e,0);try{return l(e,0)}catch(t){try{return l.call(null,e,0)}catch(t){return l.call(this,e,0)}}}function s(){g&&d&&(g=!1,d.length?h=d.concat(h):y=-1,h.length&&a())}function a(){if(!g){var e=i(s);g=!0;for(var t=h.length;t;){for(d=h,h=[];++y<t;)d&&d[y].run();y=-1,t=h.length}d=null,g=!1,function(e){if(p===clearTimeout)return clearTimeout(e);if((p===r||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(e);try{p(e)}catch(t){try{return p.call(null,e)}catch(t){return p.call(this,e)}}}(e)}}function c(e,t){this.fun=e,this.array=t}function u(){}var l,p,f=t.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:o}catch(e){l=o}try{p="function"==typeof clearTimeout?clearTimeout:r}catch(e){p=r}}();var d,h=[],g=!1,y=-1;f.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];h.push(new c(e,t)),1!==h.length||g||i(a)},c.prototype.run=function(){this.fun.apply(null,this.array)},f.title="browser",f.browser=!0,f.env={},f.argv=[],f.version="",f.versions={},f.on=u,f.addListener=u,f.once=u,f.off=u,f.removeListener=u,f.removeAllListeners=u,f.emit=u,f.prependListener=u,f.prependOnceListener=u,f.listeners=function(e){return[]},f.binding=function(e){throw new Error("process.binding is not supported")},f.cwd=function(){return"/"},f.chdir=function(e){throw new Error("process.chdir is not supported")},f.umask=function(){return 0}},{}],19:[function(e,t,n){function o(e){this.value=e}function r(e,t,n){var o=[],r=[],s=!0;return function e(a){function f(){if("object"==typeof g.node&&null!==g.node){g.keys&&g.node_===g.node||(g.keys=c(g.node)),g.isLeaf=0==g.keys.length;for(var e=0;e<r.length;e++)if(r[e].node_===a){g.circular=r[e];break}}else g.isLeaf=!0,g.keys=null;g.notLeaf=!g.isLeaf,g.notRoot=!g.isRoot}var d={},h=!0,g={node:n?i(a):a,node_:a,path:[].concat(o),parent:r[r.length-1],parents:r,key:o.slice(-1)[0],isRoot:0===o.length,level:o.length,circular:null,update:function(e,t){g.isRoot||(g.parent.node[g.key]=e),g.node=e,t&&(h=!1)},delete:function(e){delete g.parent.node[g.key],e&&(h=!1)},remove:function(e){u(g.parent.node)?g.parent.node.splice(g.key,1):delete g.parent.node[g.key],e&&(h=!1)},keys:null,before:function(e){d.before=e},after:function(e){d.after=e},pre:function(e){d.pre=e},post:function(e){d.post=e},stop:function(){s=!1},block:function(){h=!1}};if(!s)return g;f();var y=t.call(g,g.node);return void 0!==y&&g.update&&g.update(y),d.before&&d.before.call(g,g.node),h?("object"!=typeof g.node||null===g.node||g.circular||(r.push(g),f(),l(g.keys,(function(t,r){o.push(t),d.pre&&d.pre.call(g,g.node[t],t);var i=e(g.node[t]);n&&p.call(g.node,t)&&(g.node[t]=i.node),i.isLast=r==g.keys.length-1,i.isFirst=0==r,d.post&&d.post.call(g,i),o.pop()})),r.pop()),d.after&&d.after.call(g,g.node),g):g}(e).node}function i(e){if("object"==typeof e&&null!==e){var t;if(u(e))t=[];else if(function(e){return"[object Date]"===s(e)}(e))t=new Date(e.getTime?e.getTime():e);else if(function(e){return"[object RegExp]"===s(e)}(e))t=new RegExp(e);else if(function(e){return"[object Error]"===s(e)}(e))t={message:e.message};else if(function(e){return"[object Boolean]"===s(e)}(e))t=new Boolean(e);else if(function(e){return"[object Number]"===s(e)}(e))t=new Number(e);else if(function(e){return"[object String]"===s(e)}(e))t=new String(e);else if(Object.create&&Object.getPrototypeOf)t=Object.create(Object.getPrototypeOf(e));else if(e.constructor===Object)t={};else{var n=e.constructor&&e.constructor.prototype||e.__proto__||{},o=function(){};o.prototype=n,t=new o}return l(c(e),(function(n){t[n]=e[n]})),t}return e}function s(e){return Object.prototype.toString.call(e)}var a=t.exports=function(e){return new o(e)};o.prototype.get=function(e){for(var t=this.value,n=0;n<e.length;n++){var o=e[n];if(!t||!p.call(t,o)){t=void 0;break}t=t[o]}return t},o.prototype.has=function(e){for(var t=this.value,n=0;n<e.length;n++){var o=e[n];if(!t||!p.call(t,o))return!1;t=t[o]}return!0},o.prototype.set=function(e,t){for(var n=this.value,o=0;o<e.length-1;o++){var r=e[o];p.call(n,r)||(n[r]={}),n=n[r]}return n[e[o]]=t,t},o.prototype.map=function(e){return r(this.value,e,!0)},o.prototype.forEach=function(e){return this.value=r(this.value,e,!1),this.value},o.prototype.reduce=function(e,t){var n=1===arguments.length,o=n?this.value:t;return this.forEach((function(t){this.isRoot&&n||(o=e.call(this,o,t))})),o},o.prototype.paths=function(){var e=[];return this.forEach((function(t){e.push(this.path)})),e},o.prototype.nodes=function(){var e=[];return this.forEach((function(t){e.push(this.node)})),e},o.prototype.clone=function(){var e=[],t=[];return function n(o){for(var r=0;r<e.length;r++)if(e[r]===o)return t[r];if("object"==typeof o&&null!==o){var s=i(o);return e.push(o),t.push(s),l(c(o),(function(e){s[e]=n(o[e])})),e.pop(),t.pop(),s}return o}(this.value)};var c=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t},u=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},l=function(e,t){if(e.forEach)return e.forEach(t);for(var n=0;n<e.length;n++)t(e[n],n,e)};l(c(o.prototype),(function(e){a[e]=function(t){var n=[].slice.call(arguments,1),r=new o(t);return r[e].apply(r,n)}}));var p=Object.hasOwnProperty||function(e,t){return t in e}},{}],20:[function(e,t,n){t.exports.RADIUS=6378137,t.exports.FLATTENING=1/298.257223563,t.exports.POLAR_RADIUS=6356752.3142},{}],21:[function(e,t,n){t.exports=function(){for(var e={},t=0;t<arguments.length;t++){var n=arguments[t];for(var r in n)o.call(n,r)&&(e[r]=n[r])}return e};var o=Object.prototype.hasOwnProperty},{}],22:[function(e,t,n){"use strict";var o=e("lodash.isequal"),r=e("@mapbox/geojson-normalize"),i=e("hat"),s=e("./lib/features_at"),a=e("./lib/string_sets_are_equal"),c=e("@mapbox/geojsonhint"),u=e("./constants"),l=e("./lib/string_set"),p={Polygon:e("./feature_types/polygon"),LineString:e("./feature_types/line_string"),Point:e("./feature_types/point"),MultiPolygon:e("./feature_types/multi_feature"),MultiLineString:e("./feature_types/multi_feature"),MultiPoint:e("./feature_types/multi_feature")};t.exports=function(e,t){return t.modes=u.modes,t.getFeatureIdsAt=function(t){return s.click({point:t},null,e).map((function(e){return e.properties.id}))},t.getSelectedIds=function(){return e.store.getSelectedIds()},t.getSelected=function(){return{type:u.geojsonTypes.FEATURE_COLLECTION,features:e.store.getSelectedIds().map((function(t){return e.store.get(t)})).map((function(e){return e.toGeoJSON()}))}},t.getSelectedPoints=function(){return{type:u.geojsonTypes.FEATURE_COLLECTION,features:e.store.getSelectedCoordinates().map((function(e){return{type:u.geojsonTypes.FEATURE,properties:{},geometry:{type:u.geojsonTypes.POINT,coordinates:e.coordinates}}}))}},t.set=function(n){if(void 0===n.type||n.type!==u.geojsonTypes.FEATURE_COLLECTION||!Array.isArray(n.features))throw new Error("Invalid FeatureCollection");var o=e.store.createRenderBatch(),r=e.store.getAllIds().slice(),i=t.add(n),s=new l(i);return(r=r.filter((function(e){return!s.has(e)}))).length&&t.delete(r),o(),i},t.add=function(t){var n=c.hint(t,{precisionWarning:!1}).filter((function(e){return"message"!==e.level}));if(n.length)throw new Error(n[0].message);var s=JSON.parse(JSON.stringify(r(t))).features.map((function(t){if(t.id=t.id||i(),null===t.geometry)throw new Error("Invalid geometry: null");if(void 0===e.store.get(t.id)||e.store.get(t.id).type!==t.geometry.type){var n=p[t.geometry.type];if(void 0===n)throw new Error("Invalid geometry type: ".concat(t.geometry.type,"."));var r=new n(e,t);e.store.add(r)}else{var s=e.store.get(t.id);s.properties=t.properties,o(s.getCoordinates(),t.geometry.coordinates)||s.incomingCoords(t.geometry.coordinates)}return t.id}));return e.store.render(),s},t.get=function(t){var n=e.store.get(t);if(n)return n.toGeoJSON()},t.getAll=function(){return{type:u.geojsonTypes.FEATURE_COLLECTION,features:e.store.getAll().map((function(e){return e.toGeoJSON()}))}},t.delete=function(n){return e.store.delete(n,{silent:!0}),t.getMode()!==u.modes.DIRECT_SELECT||e.store.getSelectedIds().length?e.store.render():e.events.changeMode(u.modes.SIMPLE_SELECT,void 0,{silent:!0}),t},t.deleteAll=function(){return e.store.delete(e.store.getAllIds(),{silent:!0}),t.getMode()===u.modes.DIRECT_SELECT?e.events.changeMode(u.modes.SIMPLE_SELECT,void 0,{silent:!0}):e.store.render(),t},t.changeMode=function(n){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n===u.modes.SIMPLE_SELECT&&t.getMode()===u.modes.SIMPLE_SELECT?a(o.featureIds||[],e.store.getSelectedIds())?t:(e.store.setSelected(o.featureIds,{silent:!0}),e.store.render(),t):n===u.modes.DIRECT_SELECT&&t.getMode()===u.modes.DIRECT_SELECT&&o.featureId===e.store.getSelectedIds()[0]?t:(e.events.changeMode(n,o,{silent:!0}),t)},t.getMode=function(){return e.events.getMode()},t.trash=function(){return e.events.trash({silent:!0}),t},t.combineFeatures=function(){return e.events.combineFeatures({silent:!0}),t},t.uncombineFeatures=function(){return e.events.uncombineFeatures({silent:!0}),t},t.setFeatureProperty=function(n,o,r){return e.store.setFeatureProperty(n,o,r),t},t}},{"./constants":23,"./feature_types/line_string":26,"./feature_types/multi_feature":27,"./feature_types/point":28,"./feature_types/polygon":29,"./lib/features_at":37,"./lib/string_set":47,"./lib/string_sets_are_equal":48,"@mapbox/geojson-normalize":7,"@mapbox/geojsonhint":8,hat:14,"lodash.isequal":16}],23:[function(e,t,n){"use strict";t.exports={classes:{CONTROL_BASE:"mapboxgl-ctrl",CONTROL_PREFIX:"mapboxgl-ctrl-",CONTROL_BUTTON:"mapbox-gl-draw_ctrl-draw-btn",CONTROL_BUTTON_LINE:"mapbox-gl-draw_line",CONTROL_BUTTON_POLYGON:"mapbox-gl-draw_polygon",CONTROL_BUTTON_POINT:"mapbox-gl-draw_point",CONTROL_BUTTON_TRASH:"mapbox-gl-draw_trash",CONTROL_BUTTON_COMBINE_FEATURES:"mapbox-gl-draw_combine",CONTROL_BUTTON_UNCOMBINE_FEATURES:"mapbox-gl-draw_uncombine",CONTROL_GROUP:"mapboxgl-ctrl-group",ATTRIBUTION:"mapboxgl-ctrl-attrib",ACTIVE_BUTTON:"active",BOX_SELECT:"mapbox-gl-draw_boxselect"},sources:{HOT:"mapbox-gl-draw-hot",COLD:"mapbox-gl-draw-cold"},cursors:{ADD:"add",MOVE:"move",DRAG:"drag",POINTER:"pointer",NONE:"none"},types:{POLYGON:"polygon",LINE:"line_string",POINT:"point"},geojsonTypes:{FEATURE:"Feature",POLYGON:"Polygon",LINE_STRING:"LineString",POINT:"Point",FEATURE_COLLECTION:"FeatureCollection",MULTI_PREFIX:"Multi",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon"},modes:{DRAW_LINE_STRING:"draw_line_string",DRAW_POLYGON:"draw_polygon",DRAW_POINT:"draw_point",SIMPLE_SELECT:"simple_select",DIRECT_SELECT:"direct_select",STATIC:"static"},events:{CREATE:"draw.create",DELETE:"draw.delete",UPDATE:"draw.update",SELECTION_CHANGE:"draw.selectionchange",MODE_CHANGE:"draw.modechange",ACTIONABLE:"draw.actionable",RENDER:"draw.render",COMBINE_FEATURES:"draw.combine",UNCOMBINE_FEATURES:"draw.uncombine"},updateActions:{MOVE:"move",CHANGE_COORDINATES:"change_coordinates"},meta:{FEATURE:"feature",MIDPOINT:"midpoint",VERTEX:"vertex"},activeStates:{ACTIVE:"true",INACTIVE:"false"},interactions:["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate"],LAT_MIN:-90,LAT_RENDERED_MIN:-85,LAT_MAX:90,LAT_RENDERED_MAX:85,LNG_MIN:-270,LNG_MAX:270}},{}],24:[function(e,t,n){"use strict";var o=e("./lib/mode_handler"),r=e("./lib/get_features_and_set_cursor"),i=e("./lib/features_at"),s=e("./lib/is_click"),a=e("./lib/is_tap"),c=e("./constants"),u=e("./modes/object_to_mode");t.exports=function(e){function t(t,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};h.stop();var s=n[t];if(void 0===s)throw new Error("".concat(t," is not valid"));d=t;var a=s(e,r);h=o(a,e),i.silent||e.map.fire(c.events.MODE_CHANGE,{mode:t}),e.store.setDirty(),e.store.render()}var n=Object.keys(e.options.modes).reduce((function(t,n){return t[n]=u(e.options.modes[n]),t}),{}),l={},p={},f={},d=null,h=null;f.drag=function(t,n){n({point:t.point,time:(new Date).getTime()})?(e.ui.queueMapClasses({mouse:c.cursors.DRAG}),h.drag(t)):t.originalEvent.stopPropagation()},f.mousedrag=function(e){f.drag(e,(function(e){return!s(l,e)}))},f.touchdrag=function(e){f.drag(e,(function(e){return!a(p,e)}))},f.mousemove=function(t){if(1===(void 0!==t.originalEvent.buttons?t.originalEvent.buttons:t.originalEvent.which))return f.mousedrag(t);var n=r(t,e);t.featureTarget=n,h.mousemove(t)},f.mousedown=function(t){l={time:(new Date).getTime(),point:t.point};var n=r(t,e);t.featureTarget=n,h.mousedown(t)},f.mouseup=function(t){var n=r(t,e);t.featureTarget=n,s(l,{point:t.point,time:(new Date).getTime()})?h.click(t):h.mouseup(t)},f.mouseout=function(e){h.mouseout(e)},f.touchstart=function(t){if(t.originalEvent.preventDefault(),e.options.touchEnabled){p={time:(new Date).getTime(),point:t.point};var n=i.touch(t,null,e)[0];t.featureTarget=n,h.touchstart(t)}},f.touchmove=function(t){if(t.originalEvent.preventDefault(),e.options.touchEnabled)return h.touchmove(t),f.touchdrag(t)},f.touchend=function(t){if(t.originalEvent.preventDefault(),e.options.touchEnabled){var n=i.touch(t,null,e)[0];t.featureTarget=n,a(p,{time:(new Date).getTime(),point:t.point})?h.tap(t):h.touchend(t)}};var g=function(e){return!(8===e||46===e||e>=48&&e<=57)};f.keydown=function(n){"mapboxgl-canvas"===(n.srcElement||n.target).classList[0]&&(8!==n.keyCode&&46!==n.keyCode||!e.options.controls.trash?g(n.keyCode)?h.keydown(n):49===n.keyCode&&e.options.controls.point?t(c.modes.DRAW_POINT):50===n.keyCode&&e.options.controls.line_string?t(c.modes.DRAW_LINE_STRING):51===n.keyCode&&e.options.controls.polygon&&t(c.modes.DRAW_POLYGON):(n.preventDefault(),h.trash()))},f.keyup=function(e){g(e.keyCode)&&h.keyup(e)},f.zoomend=function(){e.store.changeZoom()},f.data=function(t){if("style"===t.dataType){var n=e.setup,o=e.map,r=e.options,i=e.store;r.styles.some((function(e){return o.getLayer(e.id)}))||(n.addLayers(),i.setDirty(),i.render())}};var y={trash:!1,combineFeatures:!1,uncombineFeatures:!1};return{start:function(){d=e.options.defaultMode,h=o(n[d](e),e)},changeMode:t,actionable:function(t){var n=!1;Object.keys(t).forEach((function(e){if(void 0===y[e])throw new Error("Invalid action type");y[e]!==t[e]&&(n=!0),y[e]=t[e]})),n&&e.map.fire(c.events.ACTIONABLE,{actions:y})},currentModeName:function(){return d},currentModeRender:function(e,t){return h.render(e,t)},fire:function(e,t){f[e]&&f[e](t)},addEventListeners:function(){e.map.on("mousemove",f.mousemove),e.map.on("mousedown",f.mousedown),e.map.on("mouseup",f.mouseup),e.map.on("data",f.data),e.map.on("touchmove",f.touchmove),e.map.on("touchstart",f.touchstart),e.map.on("touchend",f.touchend),e.container.addEventListener("mouseout",f.mouseout),e.options.keybindings&&(e.container.addEventListener("keydown",f.keydown),e.container.addEventListener("keyup",f.keyup))},removeEventListeners:function(){e.map.off("mousemove",f.mousemove),e.map.off("mousedown",f.mousedown),e.map.off("mouseup",f.mouseup),e.map.off("data",f.data),e.map.off("touchmove",f.touchmove),e.map.off("touchstart",f.touchstart),e.map.off("touchend",f.touchend),e.container.removeEventListener("mouseout",f.mouseout),e.options.keybindings&&(e.container.removeEventListener("keydown",f.keydown),e.container.removeEventListener("keyup",f.keyup))},trash:function(e){h.trash(e)},combineFeatures:function(){h.combineFeatures()},uncombineFeatures:function(){h.uncombineFeatures()},getMode:function(){return d}}}},{"./constants":23,"./lib/features_at":37,"./lib/get_features_and_set_cursor":38,"./lib/is_click":39,"./lib/is_tap":41,"./lib/mode_handler":43,"./modes/object_to_mode":59}],25:[function(e,t,n){"use strict";var o=e("hat"),r=e("../constants"),i=function(e,t){this.ctx=e,this.properties=t.properties||{},this.coordinates=t.geometry.coordinates,this.id=t.id||o(),this.type=t.geometry.type};i.prototype.changed=function(){this.ctx.store.featureChanged(this.id)},i.prototype.incomingCoords=function(e){this.setCoordinates(e)},i.prototype.setCoordinates=function(e){this.coordinates=e,this.changed()},i.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.coordinates))},i.prototype.setProperty=function(e,t){this.properties[e]=t},i.prototype.toGeoJSON=function(){return JSON.parse(JSON.stringify({id:this.id,type:r.geojsonTypes.FEATURE,properties:this.properties,geometry:{coordinates:this.getCoordinates(),type:this.type}}))},i.prototype.internal=function(e){var t={id:this.id,meta:r.meta.FEATURE,"meta:type":this.type,active:r.activeStates.INACTIVE,mode:e};if(this.ctx.options.userProperties)for(var n in this.properties)t["user_".concat(n)]=this.properties[n];return{type:r.geojsonTypes.FEATURE,properties:t,geometry:{coordinates:this.getCoordinates(),type:this.type}}},t.exports=i},{"../constants":23,hat:14}],26:[function(e,t,n){"use strict";var o=e("./feature"),r=function(e,t){o.call(this,e,t)};(r.prototype=Object.create(o.prototype)).isValid=function(){return this.coordinates.length>1},r.prototype.addCoordinate=function(e,t,n){this.changed();var o=parseInt(e,10);this.coordinates.splice(o,0,[t,n])},r.prototype.getCoordinate=function(e){var t=parseInt(e,10);return JSON.parse(JSON.stringify(this.coordinates[t]))},r.prototype.removeCoordinate=function(e){this.changed(),this.coordinates.splice(parseInt(e,10),1)},r.prototype.updateCoordinate=function(e,t,n){var o=parseInt(e,10);this.coordinates[o]=[t,n],this.changed()},t.exports=r},{"./feature":25}],27:[function(e,t,n){"use strict";var o=e("./feature"),r=e("../constants"),i=e("hat"),s={MultiPoint:e("./point"),MultiLineString:e("./line_string"),MultiPolygon:e("./polygon")},a=function(e,t,n,o,r){var i=n.split("."),s=parseInt(i[0],10),a=i[1]?i.slice(1).join("."):null;return e[s][t](a,o,r)},c=function(e,t){if(o.call(this,e,t),delete this.coordinates,this.model=s[t.geometry.type],void 0===this.model)throw new TypeError("".concat(t.geometry.type," is not a valid type"));this.features=this._coordinatesToFeatures(t.geometry.coordinates)};(c.prototype=Object.create(o.prototype))._coordinatesToFeatures=function(e){var t=this,n=this.model.bind(this);return e.map((function(e){return new n(t.ctx,{id:i(),type:r.geojsonTypes.FEATURE,properties:{},geometry:{coordinates:e,type:t.type.replace("Multi","")}})}))},c.prototype.isValid=function(){return this.features.every((function(e){return e.isValid()}))},c.prototype.setCoordinates=function(e){this.features=this._coordinatesToFeatures(e),this.changed()},c.prototype.getCoordinate=function(e){return a(this.features,"getCoordinate",e)},c.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.features.map((function(e){return e.type===r.geojsonTypes.POLYGON?e.getCoordinates():e.coordinates}))))},c.prototype.updateCoordinate=function(e,t,n){a(this.features,"updateCoordinate",e,t,n),this.changed()},c.prototype.addCoordinate=function(e,t,n){a(this.features,"addCoordinate",e,t,n),this.changed()},c.prototype.removeCoordinate=function(e){a(this.features,"removeCoordinate",e),this.changed()},c.prototype.getFeatures=function(){return this.features},t.exports=c},{"../constants":23,"./feature":25,"./line_string":26,"./point":28,"./polygon":29,hat:14}],28:[function(e,t,n){"use strict";var o=e("./feature"),r=function(e,t){o.call(this,e,t)};(r.prototype=Object.create(o.prototype)).isValid=function(){return"number"==typeof this.coordinates[0]&&"number"==typeof this.coordinates[1]},r.prototype.updateCoordinate=function(e,t,n){3===arguments.length?this.coordinates=[t,n]:this.coordinates=[e,t],this.changed()},r.prototype.getCoordinate=function(){return this.getCoordinates()},t.exports=r},{"./feature":25}],29:[function(e,t,n){"use strict";var o=e("./feature"),r=function(e,t){o.call(this,e,t),this.coordinates=this.coordinates.map((function(e){return e.slice(0,-1)}))};(r.prototype=Object.create(o.prototype)).isValid=function(){return 0!==this.coordinates.length&&this.coordinates.every((function(e){return e.length>2}))},r.prototype.incomingCoords=function(e){this.coordinates=e.map((function(e){return e.slice(0,-1)})),this.changed()},r.prototype.setCoordinates=function(e){this.coordinates=e,this.changed()},r.prototype.addCoordinate=function(e,t,n){this.changed();var o=e.split(".").map((function(e){return parseInt(e,10)}));this.coordinates[o[0]].splice(o[1],0,[t,n])},r.prototype.removeCoordinate=function(e){this.changed();var t=e.split(".").map((function(e){return parseInt(e,10)})),n=this.coordinates[t[0]];n&&(n.splice(t[1],1),n.length<3&&this.coordinates.splice(t[0],1))},r.prototype.getCoordinate=function(e){var t=e.split(".").map((function(e){return parseInt(e,10)})),n=this.coordinates[t[0]];return JSON.parse(JSON.stringify(n[t[1]]))},r.prototype.getCoordinates=function(){return this.coordinates.map((function(e){return e.concat([e[0]])}))},r.prototype.updateCoordinate=function(e,t,n){this.changed();var o=e.split("."),r=parseInt(o[0],10),i=parseInt(o[1],10);void 0===this.coordinates[r]&&(this.coordinates[r]=[]),this.coordinates[r][i]=[t,n]},t.exports=r},{"./feature":25}],30:[function(e,t,n){"use strict";var o=e("../constants");t.exports={isOfMetaType:function(e){return function(t){var n=t.featureTarget;return!!n&&!!n.properties&&n.properties.meta===e}},isShiftMousedown:function(e){return!!e.originalEvent&&!!e.originalEvent.shiftKey&&0===e.originalEvent.button},isActiveFeature:function(e){return!!e.featureTarget&&!!e.featureTarget.properties&&e.featureTarget.properties.active===o.activeStates.ACTIVE&&e.featureTarget.properties.meta===o.meta.FEATURE},isInactiveFeature:function(e){return!!e.featureTarget&&!!e.featureTarget.properties&&e.featureTarget.properties.active===o.activeStates.INACTIVE&&e.featureTarget.properties.meta===o.meta.FEATURE},noTarget:function(e){return void 0===e.featureTarget},isFeature:function(e){return!!e.featureTarget&&!!e.featureTarget.properties&&e.featureTarget.properties.meta===o.meta.FEATURE},isVertex:function(e){var t=e.featureTarget;return!!t&&!!t.properties&&t.properties.meta===o.meta.VERTEX},isShiftDown:function(e){return!!e.originalEvent&&!0===e.originalEvent.shiftKey},isEscapeKey:function(e){return 27===e.keyCode},isEnterKey:function(e){return 13===e.keyCode},true:function(){return!0}}},{"../constants":23}],31:[function(e,t,n){"use strict";var o=e("@mapbox/geojson-extent"),r=e("../constants"),i=r.LAT_MIN,s=r.LAT_MAX,a=r.LAT_RENDERED_MIN,c=r.LAT_RENDERED_MAX,u=r.LNG_MIN,l=r.LNG_MAX;t.exports=function(e,t){var n=i,r=s,p=i,f=s,d=l,h=u;e.forEach((function(e){var t=o(e),i=t[1],s=t[3],a=t[0],c=t[2];i>n&&(n=i),s<r&&(r=s),s>p&&(p=s),i<f&&(f=i),a<d&&(d=a),c>h&&(h=c)}));var g=t;return n+g.lat>c&&(g.lat=c-n),p+g.lat>s&&(g.lat=s-p),r+g.lat<a&&(g.lat=a-r),f+g.lat<i&&(g.lat=i-f),d+g.lng<=u&&(g.lng+=360*Math.ceil(Math.abs(g.lng)/360)),h+g.lng>=l&&(g.lng-=360*Math.ceil(Math.abs(g.lng)/360)),g}},{"../constants":23,"@mapbox/geojson-extent":6}],32:[function(e,t,n){"use strict";var o=e("../constants");t.exports=function(e,t,n,r){var i=t.geometry.coordinates,s=n.geometry.coordinates;if(i[1]>o.LAT_RENDERED_MAX||i[1]<o.LAT_RENDERED_MIN||s[1]>o.LAT_RENDERED_MAX||s[1]<o.LAT_RENDERED_MIN)return null;var a=r.project([i[0],i[1]]),c=r.project([s[0],s[1]]),u=r.unproject([(a.x+c.x)/2,(a.y+c.y)/2]);return{type:o.geojsonTypes.FEATURE,properties:{meta:o.meta.MIDPOINT,parent:e,lng:u.lng,lat:u.lat,coord_path:n.properties.coord_path},geometry:{type:o.geojsonTypes.POINT,coordinates:[u.lng,u.lat]}}}},{"../constants":23}],33:[function(e,t,n){"use strict";var o=e("./create_vertex"),r=e("./create_midpoint"),i=e("../constants");t.exports=function e(t){function n(e,t){var n="",i=null;e.forEach((function(e,c){var u=null!=t?"".concat(t,".").concat(c):String(c),l=o(f,e,u,s(u));if(a.midpoints&&i){var p=r(f,i,l,a.map);p&&d.push(p)}i=l;var h=JSON.stringify(e);n!==h&&d.push(l),0===c&&(n=h)}))}function s(e){return!!a.selectedPaths&&-1!==a.selectedPaths.indexOf(e)}var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,u=t.geometry,l=u.type,p=u.coordinates,f=t.properties&&t.properties.id,d=[];return l===i.geojsonTypes.POINT?d.push(o(f,p,c,s(c))):l===i.geojsonTypes.POLYGON?p.forEach((function(e,t){n(e,null!==c?"".concat(c,".").concat(t):String(t))})):l===i.geojsonTypes.LINE_STRING?n(p,c):0===l.indexOf(i.geojsonTypes.MULTI_PREFIX)&&function(){var n=l.replace(i.geojsonTypes.MULTI_PREFIX,"");p.forEach((function(o,r){var s={type:i.geojsonTypes.FEATURE,properties:t.properties,geometry:{type:n,coordinates:o}};d=d.concat(e(s,a,r))}))}(),d}},{"../constants":23,"./create_midpoint":32,"./create_vertex":34}],34:[function(e,t,n){"use strict";var o=e("../constants");t.exports=function(e,t,n,r){return{type:o.geojsonTypes.FEATURE,properties:{meta:o.meta.VERTEX,parent:e,coord_path:n,active:r?o.activeStates.ACTIVE:o.activeStates.INACTIVE},geometry:{type:o.geojsonTypes.POINT,coordinates:t}}}},{"../constants":23}],35:[function(e,t,n){"use strict";t.exports={enable:function(e){setTimeout((function(){e.map&&e.map.doubleClickZoom&&e._ctx&&e._ctx.store&&e._ctx.store.getInitialConfigValue&&e._ctx.store.getInitialConfigValue("doubleClickZoom")&&e.map.doubleClickZoom.enable()}),0)},disable:function(e){setTimeout((function(){e.map&&e.map.doubleClickZoom&&e.map.doubleClickZoom.disable()}),0)}}},{}],36:[function(e,t,n){"use strict";t.exports=function(e,t){var n=e.x-t.x,o=e.y-t.y;return Math.sqrt(n*n+o*o)}},{}],37:[function(e,t,n){"use strict";function o(e,t,n,o){if(null===n.map)return[];var s=e?i(e,o):t,u={};n.options.styles&&(u.layers=n.options.styles.map((function(e){return e.id})));var l=n.map.queryRenderedFeatures(s,u).filter((function(e){return-1!==c.indexOf(e.properties.meta)})),p=new a,f=[];return l.forEach((function(e){var t=e.properties.id;p.has(t)||(p.add(t),f.push(e))})),r(f)}var r=e("./sort_features"),i=e("./map_event_to_bounding_box"),s=e("../constants"),a=e("./string_set"),c=[s.meta.FEATURE,s.meta.MIDPOINT,s.meta.VERTEX];t.exports={click:function(e,t,n){return o(e,t,n,n.options.clickBuffer)},touch:function(e,t,n){return o(e,t,n,n.options.touchBuffer)}}},{"../constants":23,"./map_event_to_bounding_box":42,"./sort_features":46,"./string_set":47}],38:[function(e,t,n){"use strict";var o=e("./features_at"),r=e("../constants");t.exports=function(e,t){var n=o.click(e,null,t),i={mouse:r.cursors.NONE};return n[0]&&(i.mouse=n[0].properties.active===r.activeStates.ACTIVE?r.cursors.MOVE:r.cursors.POINTER,i.feature=n[0].properties.meta),-1!==t.events.currentModeName().indexOf("draw")&&(i.mouse=r.cursors.ADD),t.ui.queueMapClasses(i),t.ui.updateMapClasses(),n[0]}},{"../constants":23,"./features_at":37}],39:[function(e,t,n){"use strict";var o=e("./euclidean_distance");t.exports=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=null!=n.fineTolerance?n.fineTolerance:4,i=null!=n.grossTolerance?n.grossTolerance:12,s=null!=n.interval?n.interval:500;e.point=e.point||t.point,e.time=e.time||t.time;var a=o(e.point,t.point);return a<r||a<i&&t.time-e.time<s}},{"./euclidean_distance":36}],40:[function(e,t,n){"use strict";t.exports=function(e,t){return!!e.lngLat&&e.lngLat.lng===t[0]&&e.lngLat.lat===t[1]}},{}],41:[function(e,t,n){"use strict";var o=e("./euclidean_distance");t.exports=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=null!=n.tolerance?n.tolerance:25,i=null!=n.interval?n.interval:250;return e.point=e.point||t.point,e.time=e.time||t.time,o(e.point,t.point)<r&&t.time-e.time<i}},{"./euclidean_distance":36}],42:[function(e,t,n){"use strict";t.exports=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return[[e.point.x-t,e.point.y-t],[e.point.x+t,e.point.y+t]]}},{}],43:[function(e,t,n){"use strict";t.exports=function(e,t){var n={drag:[],click:[],mousemove:[],mousedown:[],mouseup:[],mouseout:[],keydown:[],keyup:[],touchstart:[],touchmove:[],touchend:[],tap:[]},o={on:function(e,t,o){if(void 0===n[e])throw new Error("Invalid event type: ".concat(e));n[e].push({selector:t,fn:o})},render:function(e){t.store.featureChanged(e)}},r=function(e,r){for(var i=n[e],s=i.length;s--;){var a=i[s];if(a.selector(r)){a.fn.call(o,r),t.store.render(),t.ui.updateMapClasses();break}}};return e.start.call(o),{render:e.render,stop:function(){e.stop&&e.stop()},trash:function(){e.trash&&(e.trash(),t.store.render())},combineFeatures:function(){e.combineFeatures&&e.combineFeatures()},uncombineFeatures:function(){e.uncombineFeatures&&e.uncombineFeatures()},drag:function(e){r("drag",e)},click:function(e){r("click",e)},mousemove:function(e){r("mousemove",e)},mousedown:function(e){r("mousedown",e)},mouseup:function(e){r("mouseup",e)},mouseout:function(e){r("mouseout",e)},keydown:function(e){r("keydown",e)},keyup:function(e){r("keyup",e)},touchstart:function(e){r("touchstart",e)},touchmove:function(e){r("touchmove",e)},touchend:function(e){r("touchend",e)},tap:function(e){r("tap",e)}}}},{}],44:[function(e,t,n){"use strict";var o=e("@mapbox/point-geometry");t.exports=function(e,t){var n=t.getBoundingClientRect();return new o(e.clientX-n.left-(t.clientLeft||0),e.clientY-n.top-(t.clientTop||0))}},{"@mapbox/point-geometry":11}],45:[function(e,t,n){"use strict";var o=e("./constrain_feature_movement"),r=e("../constants");t.exports=function(e,t){var n=o(e.map((function(e){return e.toGeoJSON()})),t);e.forEach((function(e){var t,o=e.getCoordinates(),i=function(e){var t={lng:e[0]+n.lng,lat:e[1]+n.lat};return[t.lng,t.lat]},s=function(e){return e.map((function(e){return i(e)}))};e.type===r.geojsonTypes.POINT?t=i(o):e.type===r.geojsonTypes.LINE_STRING||e.type===r.geojsonTypes.MULTI_POINT?t=o.map(i):e.type===r.geojsonTypes.POLYGON||e.type===r.geojsonTypes.MULTI_LINE_STRING?t=o.map(s):e.type===r.geojsonTypes.MULTI_POLYGON&&(t=o.map((function(e){return e.map((function(e){return s(e)}))}))),e.incomingCoords(t)}))}},{"../constants":23,"./constrain_feature_movement":31}],46:[function(e,t,n){"use strict";function o(e,t){var n=s[e.geometry.type]-s[t.geometry.type];return 0===n&&e.geometry.type===i.geojsonTypes.POLYGON?e.area-t.area:n}var r=e("@mapbox/geojson-area"),i=e("../constants"),s={Point:0,LineString:1,Polygon:2};t.exports=function(e){return e.map((function(e){return e.geometry.type===i.geojsonTypes.POLYGON&&(e.area=r.geometry({type:i.geojsonTypes.FEATURE,property:{},geometry:e.geometry})),e})).sort(o).map((function(e){return delete e.area,e}))}},{"../constants":23,"@mapbox/geojson-area":3}],47:[function(e,t,n){"use strict";function o(e){if(this._items={},this._nums={},this._length=e?e.length:0,e)for(var t=0,n=e.length;t<n;t++)this.add(e[t]),void 0!==e[t]&&("string"==typeof e[t]?this._items[e[t]]=t:this._nums[e[t]]=t)}o.prototype.add=function(e){return this.has(e)?this:(this._length++,"string"==typeof e?this._items[e]=this._length:this._nums[e]=this._length,this)},o.prototype.delete=function(e){return!1===this.has(e)?this:(this._length--,delete this._items[e],delete this._nums[e],this)},o.prototype.has=function(e){return!("string"!=typeof e&&"number"!=typeof e||void 0===this._items[e]&&void 0===this._nums[e])},o.prototype.values=function(){var e=this,t=[];return Object.keys(this._items).forEach((function(n){t.push({k:n,v:e._items[n]})})),Object.keys(this._nums).forEach((function(n){t.push({k:JSON.parse(n),v:e._nums[n]})})),t.sort((function(e,t){return e.v-t.v})).map((function(e){return e.k}))},o.prototype.clear=function(){return this._length=0,this._items={},this._nums={},this},t.exports=o},{}],48:[function(e,t,n){"use strict";t.exports=function(e,t){return e.length===t.length&&JSON.stringify(e.map((function(e){return e})).sort())===JSON.stringify(t.map((function(e){return e})).sort())}},{}],49:[function(e,t,n){"use strict";t.exports=[{id:"gl-draw-polygon-fill-inactive",type:"fill",filter:["all",["==","active","false"],["==","$type","Polygon"],["!=","mode","static"]],paint:{"fill-color":"#3bb2d0","fill-outline-color":"#3bb2d0","fill-opacity":.1}},{id:"gl-draw-polygon-fill-active",type:"fill",filter:["all",["==","active","true"],["==","$type","Polygon"]],paint:{"fill-color":"#fbb03b","fill-outline-color":"#fbb03b","fill-opacity":.1}},{id:"gl-draw-polygon-midpoint",type:"circle",filter:["all",["==","$type","Point"],["==","meta","midpoint"]],paint:{"circle-radius":3,"circle-color":"#fbb03b"}},{id:"gl-draw-polygon-stroke-inactive",type:"line",filter:["all",["==","active","false"],["==","$type","Polygon"],["!=","mode","static"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3bb2d0","line-width":2}},{id:"gl-draw-polygon-stroke-active",type:"line",filter:["all",["==","active","true"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fbb03b","line-dasharray":[.2,2],"line-width":2}},{id:"gl-draw-line-inactive",type:"line",filter:["all",["==","active","false"],["==","$type","LineString"],["!=","mode","static"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3bb2d0","line-width":2}},{id:"gl-draw-line-active",type:"line",filter:["all",["==","$type","LineString"],["==","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fbb03b","line-dasharray":[.2,2],"line-width":2}},{id:"gl-draw-polygon-and-line-vertex-stroke-inactive",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"],["!=","mode","static"]],paint:{"circle-radius":5,"circle-color":"#fff"}},{id:"gl-draw-polygon-and-line-vertex-inactive",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"],["!=","mode","static"]],paint:{"circle-radius":3,"circle-color":"#fbb03b"}},{id:"gl-draw-point-point-stroke-inactive",type:"circle",filter:["all",["==","active","false"],["==","$type","Point"],["==","meta","feature"],["!=","mode","static"]],paint:{"circle-radius":5,"circle-opacity":1,"circle-color":"#fff"}},{id:"gl-draw-point-inactive",type:"circle",filter:["all",["==","active","false"],["==","$type","Point"],["==","meta","feature"],["!=","mode","static"]],paint:{"circle-radius":3,"circle-color":"#3bb2d0"}},{id:"gl-draw-point-stroke-active",type:"circle",filter:["all",["==","$type","Point"],["==","active","true"],["!=","meta","midpoint"]],paint:{"circle-radius":7,"circle-color":"#fff"}},{id:"gl-draw-point-active",type:"circle",filter:["all",["==","$type","Point"],["!=","meta","midpoint"],["==","active","true"]],paint:{"circle-radius":5,"circle-color":"#fbb03b"}},{id:"gl-draw-polygon-fill-static",type:"fill",filter:["all",["==","mode","static"],["==","$type","Polygon"]],paint:{"fill-color":"#404040","fill-outline-color":"#404040","fill-opacity":.1}},{id:"gl-draw-polygon-stroke-static",type:"line",filter:["all",["==","mode","static"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#404040","line-width":2}},{id:"gl-draw-line-static",type:"line",filter:["all",["==","mode","static"],["==","$type","LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#404040","line-width":2}},{id:"gl-draw-point-static",type:"circle",filter:["all",["==","mode","static"],["==","$type","Point"]],paint:{"circle-radius":5,"circle-color":"#404040"}}]},{}],50:[function(e,t,n){"use strict";t.exports=function(e,t,n){function o(){i=!1,s&&(r.apply(n,s),s=!1)}function r(){i?s=arguments:(i=!0,e.apply(n,arguments),setTimeout(o,t))}var i,s;return r}},{}],51:[function(e,t,n){"use strict";t.exports=function(e){return[].concat(e).filter((function(e){return void 0!==e}))}},{}],52:[function(e,t,n){"use strict";var o=e("../lib/common_selectors"),r=o.noTarget,i=o.isOfMetaType,s=o.isInactiveFeature,a=o.isShiftDown,c=e("../lib/create_supplementary_points"),u=e("../lib/constrain_feature_movement"),l=e("../lib/double_click_zoom"),p=e("../constants"),f=e("../lib/common_selectors"),d=e("../lib/move_features"),h=i(p.meta.VERTEX),g=i(p.meta.MIDPOINT),y={fireUpdate:function(){this.map.fire(p.events.UPDATE,{action:p.updateActions.CHANGE_COORDINATES,features:this.getSelected().map((function(e){return e.toGeoJSON()}))})},fireActionable:function(e){this.setActionableState({combineFeatures:!1,uncombineFeatures:!1,trash:e.selectedCoordPaths.length>0})},startDragging:function(e,t){this.map.dragPan.disable(),e.canDragMove=!0,e.dragMoveLocation=t.lngLat},stopDragging:function(e){this.map.dragPan.enable(),e.dragMoving=!1,e.canDragMove=!1,e.dragMoveLocation=null},onVertex:function(e,t){this.startDragging(e,t);var n=t.featureTarget.properties,o=e.selectedCoordPaths.indexOf(n.coord_path);a(t)||-1!==o?a(t)&&-1===o&&e.selectedCoordPaths.push(n.coord_path):e.selectedCoordPaths=[n.coord_path];var r=this.pathsToCoordinates(e.featureId,e.selectedCoordPaths);this.setSelectedCoordinates(r)},onMidpoint:function(e,t){this.startDragging(e,t);var n=t.featureTarget.properties;e.feature.addCoordinate(n.coord_path,n.lng,n.lat),this.fireUpdate(),e.selectedCoordPaths=[n.coord_path]},pathsToCoordinates:function(e,t){return t.map((function(t){return{feature_id:e,coord_path:t}}))},onFeature:function(e,t){0===e.selectedCoordPaths.length?this.startDragging(e,t):this.stopDragging(e)},dragFeature:function(e,t,n){d(this.getSelected(),n),e.dragMoveLocation=t.lngLat},dragVertex:function(e,t,n){for(var o=e.selectedCoordPaths.map((function(t){return e.feature.getCoordinate(t)})),r=o.map((function(e){return{type:p.geojsonTypes.FEATURE,properties:{},geometry:{type:p.geojsonTypes.POINT,coordinates:e}}})),i=u(r,n),s=0;s<o.length;s++){var a=o[s];e.feature.updateCoordinate(e.selectedCoordPaths[s],a[0]+i.lng,a[1]+i.lat)}},clickNoTarget:function(){this.changeMode(p.modes.SIMPLE_SELECT)},clickInactive:function(){this.changeMode(p.modes.SIMPLE_SELECT)},clickActiveFeature:function(e){e.selectedCoordPaths=[],this.clearSelectedCoordinates(),e.feature.changed()},onSetup:function(e){var t=e.featureId,n=this.getFeature(t);if(!n)throw new Error("You must provide a featureId to enter direct_select mode");if(n.type===p.geojsonTypes.POINT)throw new TypeError("direct_select mode doesn't handle point features");var o={featureId:t,feature:n,dragMoveLocation:e.startPos||null,dragMoving:!1,canDragMove:!1,selectedCoordPaths:e.coordPath?[e.coordPath]:[]};return this.setSelectedCoordinates(this.pathsToCoordinates(t,o.selectedCoordPaths)),this.setSelected(t),l.disable(this),this.setActionableState({trash:!0}),o},onStop:function(){l.enable(this),this.clearSelectedCoordinates()},toDisplayFeatures:function(e,t,n){e.featureId===t.properties.id?(t.properties.active=p.activeStates.ACTIVE,n(t),c(t,{map:this.map,midpoints:!0,selectedPaths:e.selectedCoordPaths}).forEach(n)):(t.properties.active=p.activeStates.INACTIVE,n(t)),this.fireActionable(e)},onTrash:function(e){e.selectedCoordPaths.sort().reverse().forEach((function(t){return e.feature.removeCoordinate(t)})),this.fireUpdate(),e.selectedCoordPaths=[],this.clearSelectedCoordinates(),this.fireActionable(e),!1===e.feature.isValid()&&(this.deleteFeature([e.featureId]),this.changeMode(p.modes.SIMPLE_SELECT,{}))},onMouseMove:function(e,t){var n=f.isActiveFeature(t),o=h(t),r=0===e.selectedCoordPaths.length;n&&r?this.updateUIClasses({mouse:p.cursors.MOVE}):o&&!r?this.updateUIClasses({mouse:p.cursors.MOVE}):this.updateUIClasses({mouse:p.cursors.NONE}),this.stopDragging(e)},onMouseOut:function(e){e.dragMoving&&this.fireUpdate()}};y.onTouchStart=y.onMouseDown=function(e,t){return h(t)?this.onVertex(e,t):f.isActiveFeature(t)?this.onFeature(e,t):g(t)?this.onMidpoint(e,t):void 0},y.onDrag=function(e,t){if(!0===e.canDragMove){e.dragMoving=!0,t.originalEvent.stopPropagation();var n={lng:t.lngLat.lng-e.dragMoveLocation.lng,lat:t.lngLat.lat-e.dragMoveLocation.lat};e.selectedCoordPaths.length>0?this.dragVertex(e,t,n):this.dragFeature(e,t,n),e.dragMoveLocation=t.lngLat}},y.onClick=function(e,t){return r(t)?this.clickNoTarget(e,t):f.isActiveFeature(t)?this.clickActiveFeature(e,t):s(t)?this.clickInactive(e,t):void this.stopDragging(e)},y.onTap=function(e,t){return r(t)?this.clickNoTarget(e,t):f.isActiveFeature(t)?this.clickActiveFeature(e,t):s(t)?this.clickInactive(e,t):void 0},y.onTouchEnd=y.onMouseUp=function(e){e.dragMoving&&this.fireUpdate(),this.stopDragging(e)},t.exports=y},{"../constants":23,"../lib/common_selectors":30,"../lib/constrain_feature_movement":31,"../lib/create_supplementary_points":33,"../lib/double_click_zoom":35,"../lib/move_features":45}],53:[function(e,t,n){"use strict";function o(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var r=e("../lib/common_selectors"),i=e("../lib/is_event_at_coordinates"),s=e("../lib/double_click_zoom"),a=e("../constants"),c=e("../lib/create_vertex"),u={onSetup:function(e){var t,n,r=(e=e||{}).featureId,i="forward";if(r){if(!(t=this.getFeature(r)))throw new Error("Could not find a feature with the provided featureId");var c=e.from;if(c&&"Feature"===c.type&&c.geometry&&"Point"===c.geometry.type&&(c=c.geometry),c&&"Point"===c.type&&c.coordinates&&2===c.coordinates.length&&(c=c.coordinates),!c||!Array.isArray(c))throw new Error("Please use the `from` property to indicate which point to continue the line from");var u=t.coordinates.length-1;if(t.coordinates[u][0]===c[0]&&t.coordinates[u][1]===c[1]){var l;n=u+1,(l=t).addCoordinate.apply(l,[n].concat(o(t.coordinates[u])))}else{if(t.coordinates[0][0]!==c[0]||t.coordinates[0][1]!==c[1])throw new Error("`from` should match the point at either the start or the end of the provided LineString");var p;i="backwards",n=0,(p=t).addCoordinate.apply(p,[n].concat(o(t.coordinates[0])))}}else t=this.newFeature({type:a.geojsonTypes.FEATURE,properties:{},geometry:{type:a.geojsonTypes.LINE_STRING,coordinates:[]}}),n=0,this.addFeature(t);return this.clearSelectedFeatures(),s.disable(this),this.updateUIClasses({mouse:a.cursors.ADD}),this.activateUIButton(a.types.LINE),this.setActionableState({trash:!0}),{line:t,currentVertexPosition:n,direction:i}},clickAnywhere:function(e,t){if(e.currentVertexPosition>0&&i(t,e.line.coordinates[e.currentVertexPosition-1])||"backwards"===e.direction&&i(t,e.line.coordinates[e.currentVertexPosition+1]))return this.changeMode(a.modes.SIMPLE_SELECT,{featureIds:[e.line.id]});this.updateUIClasses({mouse:a.cursors.ADD}),e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat),"forward"===e.direction?(e.currentVertexPosition++,e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat)):e.line.addCoordinate(0,t.lngLat.lng,t.lngLat.lat)},clickOnVertex:function(e){return this.changeMode(a.modes.SIMPLE_SELECT,{featureIds:[e.line.id]})},onMouseMove:function(e,t){e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat),r.isVertex(t)&&this.updateUIClasses({mouse:a.cursors.POINTER})}};u.onTap=u.onClick=function(e,t){if(r.isVertex(t))return this.clickOnVertex(e,t);this.clickAnywhere(e,t)},u.onKeyUp=function(e,t){r.isEnterKey(t)?this.changeMode(a.modes.SIMPLE_SELECT,{featureIds:[e.line.id]}):r.isEscapeKey(t)&&(this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(a.modes.SIMPLE_SELECT))},u.onStop=function(e){s.enable(this),this.activateUIButton(),void 0!==this.getFeature(e.line.id)&&(e.line.removeCoordinate("".concat(e.currentVertexPosition)),e.line.isValid()?this.map.fire(a.events.CREATE,{features:[e.line.toGeoJSON()]}):(this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(a.modes.SIMPLE_SELECT,{},{silent:!0})))},u.onTrash=function(e){this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(a.modes.SIMPLE_SELECT)},u.toDisplayFeatures=function(e,t,n){var o=t.properties.id===e.line.id;if(t.properties.active=o?a.activeStates.ACTIVE:a.activeStates.INACTIVE,!o)return n(t);t.geometry.coordinates.length<2||(t.properties.meta=a.meta.FEATURE,n(c(e.line.id,t.geometry.coordinates["forward"===e.direction?t.geometry.coordinates.length-2:1],"".concat("forward"===e.direction?t.geometry.coordinates.length-2:1),!1)),n(t))},t.exports=u},{"../constants":23,"../lib/common_selectors":30,"../lib/create_vertex":34,"../lib/double_click_zoom":35,"../lib/is_event_at_coordinates":40}],54:[function(e,t,n){"use strict";var o=e("../lib/common_selectors"),r=e("../constants"),i={onSetup:function(){var e=this.newFeature({type:r.geojsonTypes.FEATURE,properties:{},geometry:{type:r.geojsonTypes.POINT,coordinates:[]}});return this.addFeature(e),this.clearSelectedFeatures(),this.updateUIClasses({mouse:r.cursors.ADD}),this.activateUIButton(r.types.POINT),this.setActionableState({trash:!0}),{point:e}},stopDrawingAndRemove:function(e){this.deleteFeature([e.point.id],{silent:!0}),this.changeMode(r.modes.SIMPLE_SELECT)}};i.onTap=i.onClick=function(e,t){this.updateUIClasses({mouse:r.cursors.MOVE}),e.point.updateCoordinate("",t.lngLat.lng,t.lngLat.lat),this.map.fire(r.events.CREATE,{features:[e.point.toGeoJSON()]}),this.changeMode(r.modes.SIMPLE_SELECT,{featureIds:[e.point.id]})},i.onStop=function(e){this.activateUIButton(),e.point.getCoordinate().length||this.deleteFeature([e.point.id],{silent:!0})},i.toDisplayFeatures=function(e,t,n){var o=t.properties.id===e.point.id;if(t.properties.active=o?r.activeStates.ACTIVE:r.activeStates.INACTIVE,!o)return n(t)},i.onTrash=i.stopDrawingAndRemove,i.onKeyUp=function(e,t){if(o.isEscapeKey(t)||o.isEnterKey(t))return this.stopDrawingAndRemove(e,t)},t.exports=i},{"../constants":23,"../lib/common_selectors":30}],55:[function(e,t,n){"use strict";var o=e("../lib/common_selectors"),r=e("../lib/double_click_zoom"),i=e("../constants"),s=e("../lib/is_event_at_coordinates"),a=e("../lib/create_vertex"),c={onSetup:function(){var e=this.newFeature({type:i.geojsonTypes.FEATURE,properties:{},geometry:{type:i.geojsonTypes.POLYGON,coordinates:[[]]}});return this.addFeature(e),this.clearSelectedFeatures(),r.disable(this),this.updateUIClasses({mouse:i.cursors.ADD}),this.activateUIButton(i.types.POLYGON),this.setActionableState({trash:!0}),{polygon:e,currentVertexPosition:0}},clickAnywhere:function(e,t){if(e.currentVertexPosition>0&&s(t,e.polygon.coordinates[0][e.currentVertexPosition-1]))return this.changeMode(i.modes.SIMPLE_SELECT,{featureIds:[e.polygon.id]});this.updateUIClasses({mouse:i.cursors.ADD}),e.polygon.updateCoordinate("0.".concat(e.currentVertexPosition),t.lngLat.lng,t.lngLat.lat),e.currentVertexPosition++,e.polygon.updateCoordinate("0.".concat(e.currentVertexPosition),t.lngLat.lng,t.lngLat.lat)},clickOnVertex:function(e){return this.changeMode(i.modes.SIMPLE_SELECT,{featureIds:[e.polygon.id]})},onMouseMove:function(e,t){e.polygon.updateCoordinate("0.".concat(e.currentVertexPosition),t.lngLat.lng,t.lngLat.lat),o.isVertex(t)&&this.updateUIClasses({mouse:i.cursors.POINTER})}};c.onTap=c.onClick=function(e,t){return o.isVertex(t)?this.clickOnVertex(e,t):this.clickAnywhere(e,t)},c.onKeyUp=function(e,t){o.isEscapeKey(t)?(this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(i.modes.SIMPLE_SELECT)):o.isEnterKey(t)&&this.changeMode(i.modes.SIMPLE_SELECT,{featureIds:[e.polygon.id]})},c.onStop=function(e){this.updateUIClasses({mouse:i.cursors.NONE}),r.enable(this),this.activateUIButton(),void 0!==this.getFeature(e.polygon.id)&&(e.polygon.removeCoordinate("0.".concat(e.currentVertexPosition)),e.polygon.isValid()?this.map.fire(i.events.CREATE,{features:[e.polygon.toGeoJSON()]}):(this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(i.modes.SIMPLE_SELECT,{},{silent:!0})))},c.toDisplayFeatures=function(e,t,n){var o=t.properties.id===e.polygon.id;if(t.properties.active=o?i.activeStates.ACTIVE:i.activeStates.INACTIVE,!o)return n(t);if(0!==t.geometry.coordinates.length){var r=t.geometry.coordinates[0].length;if(!(r<3)){if(t.properties.meta=i.meta.FEATURE,n(a(e.polygon.id,t.geometry.coordinates[0][0],"0.0",!1)),r>3){var s=t.geometry.coordinates[0].length-3;n(a(e.polygon.id,t.geometry.coordinates[0][s],"0.".concat(s),!1))}if(r<=4){var c=[[t.geometry.coordinates[0][0][0],t.geometry.coordinates[0][0][1]],[t.geometry.coordinates[0][1][0],t.geometry.coordinates[0][1][1]]];if(n({type:i.geojsonTypes.FEATURE,properties:t.properties,geometry:{coordinates:c,type:i.geojsonTypes.LINE_STRING}}),3===r)return}return n(t)}}},c.onTrash=function(e){this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(i.modes.SIMPLE_SELECT)},t.exports=c},{"../constants":23,"../lib/common_selectors":30,"../lib/create_vertex":34,"../lib/double_click_zoom":35,"../lib/is_event_at_coordinates":40}],56:[function(e,t,n){"use strict";t.exports={simple_select:e("./simple_select"),direct_select:e("./direct_select"),draw_point:e("./draw_point"),draw_polygon:e("./draw_polygon"),draw_line_string:e("./draw_line_string")}},{"./direct_select":52,"./draw_line_string":53,"./draw_point":54,"./draw_polygon":55,"./simple_select":60}],57:[function(e,t,n){"use strict";var o=t.exports=e("./mode_interface_accessors");o.prototype.onSetup=function(){},o.prototype.onDrag=function(){},o.prototype.onClick=function(){},o.prototype.onMouseMove=function(){},o.prototype.onMouseDown=function(){},o.prototype.onMouseUp=function(){},o.prototype.onMouseOut=function(){},o.prototype.onKeyUp=function(){},o.prototype.onKeyDown=function(){},o.prototype.onTouchStart=function(){},o.prototype.onTouchMove=function(){},o.prototype.onTouchEnd=function(){},o.prototype.onTap=function(){},o.prototype.onStop=function(){},o.prototype.onTrash=function(){},o.prototype.onCombineFeature=function(){},o.prototype.onUncombineFeature=function(){},o.prototype.toDisplayFeatures=function(){throw new Error("You must overwrite toDisplayFeatures")}},{"./mode_interface_accessors":58}],58:[function(e,t,n){"use strict";var o=e("../constants"),r=e("../lib/features_at"),i=e("../feature_types/point"),s=e("../feature_types/line_string"),a=e("../feature_types/polygon"),c=e("../feature_types/multi_feature"),u=t.exports=function(e){this.map=e.map,this.drawConfig=JSON.parse(JSON.stringify(e.options||{})),this._ctx=e};u.prototype.setSelected=function(e){return this._ctx.store.setSelected(e)},u.prototype.setSelectedCoordinates=function(e){var t=this;this._ctx.store.setSelectedCoordinates(e),e.reduce((function(e,n){return void 0===e[n.feature_id]&&(e[n.feature_id]=!0,t._ctx.store.get(n.feature_id).changed()),e}),{})},u.prototype.getSelected=function(){return this._ctx.store.getSelected()},u.prototype.getSelectedIds=function(){return this._ctx.store.getSelectedIds()},u.prototype.isSelected=function(e){return this._ctx.store.isSelected(e)},u.prototype.getFeature=function(e){return this._ctx.store.get(e)},u.prototype.select=function(e){return this._ctx.store.select(e)},u.prototype.deselect=function(e){return this._ctx.store.deselect(e)},u.prototype.deleteFeature=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this._ctx.store.delete(e,t)},u.prototype.addFeature=function(e){return this._ctx.store.add(e)},u.prototype.clearSelectedFeatures=function(){return this._ctx.store.clearSelected()},u.prototype.clearSelectedCoordinates=function(){return this._ctx.store.clearSelectedCoordinates()},u.prototype.setActionableState=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={trash:e.trash||!1,combineFeatures:e.combineFeatures||!1,uncombineFeatures:e.uncombineFeatures||!1};return this._ctx.events.actionable(t)},u.prototype.changeMode=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this._ctx.events.changeMode(e,t,n)},u.prototype.updateUIClasses=function(e){return this._ctx.ui.queueMapClasses(e)},u.prototype.activateUIButton=function(e){return this._ctx.ui.setActiveButton(e)},u.prototype.featuresAt=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"click";if("click"!==n&&"touch"!==n)throw new Error("invalid buffer type");return r[n](e,t,this._ctx)},u.prototype.newFeature=function(e){var t=e.geometry.type;return t===o.geojsonTypes.POINT?new i(this._ctx,e):t===o.geojsonTypes.LINE_STRING?new s(this._ctx,e):t===o.geojsonTypes.POLYGON?new a(this._ctx,e):new c(this._ctx,e)},u.prototype.isInstanceOf=function(e,t){if(e===o.geojsonTypes.POINT)return t instanceof i;if(e===o.geojsonTypes.LINE_STRING)return t instanceof s;if(e===o.geojsonTypes.POLYGON)return t instanceof a;if("MultiFeature"===e)return t instanceof c;throw new Error("Unknown feature class: ".concat(e))},u.prototype.doRender=function(e){return this._ctx.store.featureChanged(e)}},{"../constants":23,"../feature_types/line_string":26,"../feature_types/multi_feature":27,"../feature_types/point":28,"../feature_types/polygon":29,"../lib/features_at":37}],59:[function(e,t,n){"use strict";var o=e("./mode_interface"),r={drag:"onDrag",click:"onClick",mousemove:"onMouseMove",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseout:"onMouseOut",keyup:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",tap:"onTap"},i=Object.keys(r);t.exports=function(e){var t=Object.keys(e);return function(n){function s(e){return function(t){u[e](c,t)}}var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c={},u=t.reduce((function(t,n){return t[n]=e[n],t}),new o(n));return{start:function(){var t=this;c=u.onSetup(a),i.forEach((function(n){var o=r[n],i=function(){return!1};e[o]&&(i=function(){return!0}),t.on(n,i,s(o))}))},stop:function(){u.onStop(c)},trash:function(){u.onTrash(c)},combineFeatures:function(){u.onCombineFeatures(c)},uncombineFeatures:function(){u.onUncombineFeatures(c)},render:function(e,t){u.toDisplayFeatures(c,e,t)}}}}},{"./mode_interface":57}],60:[function(e,t,n){"use strict";var o=e("../lib/common_selectors"),r=e("../lib/mouse_event_point"),i=e("../lib/create_supplementary_points"),s=e("../lib/string_set"),a=e("../lib/double_click_zoom"),c=e("../lib/move_features"),u=e("../constants"),l={onSetup:function(e){var t=this,n={dragMoveLocation:null,boxSelectStartLocation:null,boxSelectElement:void 0,boxSelecting:!1,canBoxSelect:!1,dragMoveing:!1,canDragMove:!1,initiallySelectedFeatureIds:e.featureIds||[]};return this.setSelected(n.initiallySelectedFeatureIds.filter((function(e){return void 0!==t.getFeature(e)}))),this.fireActionable(),this.setActionableState({combineFeatures:!0,uncombineFeatures:!0,trash:!0}),n},fireUpdate:function(){this.map.fire(u.events.UPDATE,{action:u.updateActions.MOVE,features:this.getSelected().map((function(e){return e.toGeoJSON()}))})},fireActionable:function(){var e=this,t=this.getSelected(),n=t.filter((function(t){return e.isInstanceOf("MultiFeature",t)})),o=!1;if(t.length>1){o=!0;var r=t[0].type.replace("Multi","");t.forEach((function(e){e.type.replace("Multi","")!==r&&(o=!1)}))}var i=n.length>0,s=t.length>0;this.setActionableState({combineFeatures:o,uncombineFeatures:i,trash:s})},getUniqueIds:function(e){return e.length?e.map((function(e){return e.properties.id})).filter((function(e){return void 0!==e})).reduce((function(e,t){return e.add(t),e}),new s).values():[]},stopExtendedInteractions:function(e){e.boxSelectElement&&(e.boxSelectElement.parentNode&&e.boxSelectElement.parentNode.removeChild(e.boxSelectElement),e.boxSelectElement=null),this.map.dragPan.enable(),e.boxSelecting=!1,e.canBoxSelect=!1,e.dragMoving=!1,e.canDragMove=!1},onStop:function(){a.enable(this)},onMouseMove:function(e){return this.stopExtendedInteractions(e)},onMouseOut:function(e){if(e.dragMoving)return this.fireUpdate()}};l.onTap=l.onClick=function(e,t){return o.noTarget(t)?this.clickAnywhere(e,t):o.isOfMetaType(u.meta.VERTEX)(t)?this.clickOnVertex(e,t):o.isFeature(t)?this.clickOnFeature(e,t):void 0},l.clickAnywhere=function(e){var t=this,n=this.getSelectedIds();n.length&&(this.clearSelectedFeatures(),n.forEach((function(e){return t.doRender(e)}))),a.enable(this),this.stopExtendedInteractions(e)},l.clickOnVertex=function(e,t){this.changeMode(u.modes.DIRECT_SELECT,{featureId:t.featureTarget.properties.parent,coordPath:t.featureTarget.properties.coord_path,startPos:t.lngLat}),this.updateUIClasses({mouse:u.cursors.MOVE})},l.startOnActiveFeature=function(e,t){this.stopExtendedInteractions(e),this.map.dragPan.disable(),this.doRender(t.featureTarget.properties.id),e.canDragMove=!0,e.dragMoveLocation=t.lngLat},l.clickOnFeature=function(e,t){var n=this;a.disable(this),this.stopExtendedInteractions(e);var r=o.isShiftDown(t),i=this.getSelectedIds(),s=t.featureTarget.properties.id,c=this.isSelected(s);if(!r&&c&&this.getFeature(s).type!==u.geojsonTypes.POINT)return this.changeMode(u.modes.DIRECT_SELECT,{featureId:s});c&&r?(this.deselect(s),this.updateUIClasses({mouse:u.cursors.POINTER}),1===i.length&&a.enable(this)):!c&&r?(this.select(s),this.updateUIClasses({mouse:u.cursors.MOVE})):c||r||(i.forEach((function(e){return n.doRender(e)})),this.setSelected(s),this.updateUIClasses({mouse:u.cursors.MOVE})),this.doRender(s)},l.onMouseDown=function(e,t){return o.isActiveFeature(t)?this.startOnActiveFeature(e,t):this.drawConfig.boxSelect&&o.isShiftMousedown(t)?this.startBoxSelect(e,t):void 0},l.startBoxSelect=function(e,t){this.stopExtendedInteractions(e),this.map.dragPan.disable(),e.boxSelectStartLocation=r(t.originalEvent,this.map.getContainer()),e.canBoxSelect=!0},l.onTouchStart=function(e,t){if(o.isActiveFeature(t))return this.startOnActiveFeature(e,t)},l.onDrag=function(e,t){return e.canDragMove?this.dragMove(e,t):this.drawConfig.boxSelect&&e.canBoxSelect?this.whileBoxSelect(e,t):void 0},l.whileBoxSelect=function(e,t){e.boxSelecting=!0,this.updateUIClasses({mouse:u.cursors.ADD}),e.boxSelectElement||(e.boxSelectElement=document.createElement("div"),e.boxSelectElement.classList.add(u.classes.BOX_SELECT),this.map.getContainer().appendChild(e.boxSelectElement));var n=r(t.originalEvent,this.map.getContainer()),o=Math.min(e.boxSelectStartLocation.x,n.x),i=Math.max(e.boxSelectStartLocation.x,n.x),s=Math.min(e.boxSelectStartLocation.y,n.y),a=Math.max(e.boxSelectStartLocation.y,n.y),c="translate(".concat(o,"px, ").concat(s,"px)");e.boxSelectElement.style.transform=c,e.boxSelectElement.style.WebkitTransform=c,e.boxSelectElement.style.width="".concat(i-o,"px"),e.boxSelectElement.style.height="".concat(a-s,"px")},l.dragMove=function(e,t){e.dragMoving=!0,t.originalEvent.stopPropagation();var n={lng:t.lngLat.lng-e.dragMoveLocation.lng,lat:t.lngLat.lat-e.dragMoveLocation.lat};c(this.getSelected(),n),e.dragMoveLocation=t.lngLat},l.onMouseUp=function(e,t){var n=this;if(e.dragMoving)this.fireUpdate();else if(e.boxSelecting){var o=[e.boxSelectStartLocation,r(t.originalEvent,this.map.getContainer())],i=this.featuresAt(null,o,"click"),s=this.getUniqueIds(i).filter((function(e){return!n.isSelected(e)}));s.length&&(this.select(s),s.forEach((function(e){return n.doRender(e)})),this.updateUIClasses({mouse:u.cursors.MOVE}))}this.stopExtendedInteractions(e)},l.toDisplayFeatures=function(e,t,n){t.properties.active=this.isSelected(t.properties.id)?u.activeStates.ACTIVE:u.activeStates.INACTIVE,n(t),this.fireActionable(),t.properties.active===u.activeStates.ACTIVE&&t.geometry.type!==u.geojsonTypes.POINT&&i(t).forEach(n)},l.onTrash=function(){this.deleteFeature(this.getSelectedIds()),this.fireActionable()},l.onCombineFeatures=function(){var e=this.getSelected();if(!(0===e.length||e.length<2)){for(var t=[],n=[],o=e[0].type.replace("Multi",""),r=0;r<e.length;r++){var i=e[r];if(i.type.replace("Multi","")!==o)return;i.type.includes("Multi")?i.getCoordinates().forEach((function(e){t.push(e)})):t.push(i.getCoordinates()),n.push(i.toGeoJSON())}if(n.length>1){var s=this.newFeature({type:u.geojsonTypes.FEATURE,properties:n[0].properties,geometry:{type:"Multi".concat(o),coordinates:t}});this.addFeature(s),this.deleteFeature(this.getSelectedIds(),{silent:!0}),this.setSelected([s.id]),this.map.fire(u.events.COMBINE_FEATURES,{createdFeatures:[s.toGeoJSON()],deletedFeatures:n})}this.fireActionable()}},l.onUncombineFeatures=function(){var e=this,t=this.getSelected();if(0!==t.length){for(var n=[],o=[],r=0;r<t.length;r++)!function(r){var i=t[r];e.isInstanceOf("MultiFeature",i)&&(i.getFeatures().forEach((function(t){e.addFeature(t),t.properties=i.properties,n.push(t.toGeoJSON()),e.select([t.id])})),e.deleteFeature(i.id,{silent:!0}),o.push(i.toGeoJSON()))}(r);n.length>1&&this.map.fire(u.events.UNCOMBINE_FEATURES,{createdFeatures:n,deletedFeatures:o}),this.fireActionable()}},t.exports=l},{"../constants":23,"../lib/common_selectors":30,"../lib/create_supplementary_points":33,"../lib/double_click_zoom":35,"../lib/mouse_event_point":44,"../lib/move_features":45,"../lib/string_set":47}],61:[function(e,t,n){"use strict";function o(e,t){return e.map((function(e){return e.source?e:r(e,{id:"".concat(e.id,".").concat(t),source:"hot"===t?i.sources.HOT:i.sources.COLD})}))}var r=e("xtend"),i=e("./constants"),s={defaultMode:i.modes.SIMPLE_SELECT,keybindings:!0,touchEnabled:!0,clickBuffer:2,touchBuffer:25,boxSelect:!0,displayControlsDefault:!0,styles:e("./lib/theme"),modes:e("./modes"),controls:{},userProperties:!1},a={point:!0,line_string:!0,polygon:!0,trash:!0,combine_features:!0,uncombine_features:!0},c={point:!1,line_string:!1,polygon:!1,trash:!1,combine_features:!1,uncombine_features:!1};t.exports=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=r(e);return e.controls||(t.controls={}),!1===e.displayControlsDefault?t.controls=r(c,e.controls):t.controls=r(a,e.controls),(t=r(s,t)).styles=o(t.styles,"cold").concat(o(t.styles,"hot")),t}},{"./constants":23,"./lib/theme":49,"./modes":56,xtend:21}],62:[function(e,t,n){"use strict";var o=e("./constants");t.exports=function(){function e(e,t){var o=n.get(e).internal(r);n.ctx.events.currentModeRender(o,(function(e){n.sources[t].push(e)}))}function t(){n.isDirty=!1,n.clearChangedIds()}var n=this;if(!n.ctx.map||void 0===n.ctx.map.getSource(o.sources.HOT))return t();var r=n.ctx.events.currentModeName();n.ctx.ui.queueMapClasses({mode:r});var i=[],s=[];n.isDirty?s=n.getAllIds():(i=n.getChangedIds().filter((function(e){return void 0!==n.get(e)})),s=n.sources.hot.filter((function(e){return e.properties.id&&-1===i.indexOf(e.properties.id)&&void 0!==n.get(e.properties.id)})).map((function(e){return e.properties.id}))),n.sources.hot=[];var a=n.sources.cold.length;n.sources.cold=n.isDirty?[]:n.sources.cold.filter((function(e){var t=e.properties.id||e.properties.parent;return-1===i.indexOf(t)}));var c=a!==n.sources.cold.length||s.length>0;if(i.forEach((function(t){return e(t,"hot")})),s.forEach((function(t){return e(t,"cold")})),c&&n.ctx.map.getSource(o.sources.COLD).setData({type:o.geojsonTypes.FEATURE_COLLECTION,features:n.sources.cold}),n.ctx.map.getSource(o.sources.HOT).setData({type:o.geojsonTypes.FEATURE_COLLECTION,features:n.sources.hot}),n._emitSelectionChange&&(n.ctx.map.fire(o.events.SELECTION_CHANGE,{features:n.getSelected().map((function(e){return e.toGeoJSON()})),points:n.getSelectedCoordinates().map((function(e){return{type:o.geojsonTypes.FEATURE,properties:{},geometry:{type:o.geojsonTypes.POINT,coordinates:e.coordinates}}}))}),n._emitSelectionChange=!1),n._deletedFeaturesToEmit.length){var u=n._deletedFeaturesToEmit.map((function(e){return e.toGeoJSON()}));n._deletedFeaturesToEmit=[],n.ctx.map.fire(o.events.DELETE,{features:u})}t(),n.ctx.map.fire(o.events.RENDER,{})}},{"./constants":23}],63:[function(e,t,n){"use strict";var o=e("./events"),r=e("./store"),i=e("./ui"),s=e("./constants"),a=e("xtend");t.exports=function(e){var t=null,n=null,c={onRemove:function(){return e.map.off("load",c.connect),clearInterval(n),c.removeLayers(),e.store.restoreMapConfig(),e.ui.removeButtons(),e.events.removeEventListeners(),e.ui.clearMapClasses(),e.map=null,e.container=null,e.store=null,t&&t.parentNode&&t.parentNode.removeChild(t),t=null,this},connect:function(){e.map.off("load",c.connect),clearInterval(n),c.addLayers(),e.store.storeMapConfig(),e.events.addEventListeners()},onAdd:function(s){var u=s.fire;return s.fire=function(e,t){var n=arguments;return 1===u.length&&1!==arguments.length&&(n=[a({},{type:e},t)]),u.apply(s,n)},e.map=s,e.events=o(e),e.ui=i(e),e.container=s.getContainer(),e.store=new r(e),t=e.ui.addButtons(),e.options.boxSelect&&(s.boxZoom.disable(),s.dragPan.disable(),s.dragPan.enable()),s.loaded()?c.connect():(s.on("load",c.connect),n=setInterval((function(){s.loaded()&&c.connect()}),16)),e.events.start(),t},addLayers:function(){e.map.addSource(s.sources.COLD,{data:{type:s.geojsonTypes.FEATURE_COLLECTION,features:[]},type:"geojson"}),e.map.addSource(s.sources.HOT,{data:{type:s.geojsonTypes.FEATURE_COLLECTION,features:[]},type:"geojson"}),e.options.styles.forEach((function(t){e.map.addLayer(t)})),e.store.setDirty(!0),e.store.render()},removeLayers:function(){e.options.styles.forEach((function(t){e.map.getLayer(t.id)&&e.map.removeLayer(t.id)})),e.map.getSource(s.sources.COLD)&&e.map.removeSource(s.sources.COLD),e.map.getSource(s.sources.HOT)&&e.map.removeSource(s.sources.HOT)}};return e.setup=c,c}},{"./constants":23,"./events":24,"./store":64,"./ui":65,xtend:21}],64:[function(e,t,n){"use strict";function o(e){var t=this,n=this._selectedCoordinates.filter((function(e){return t._selectedFeatureIds.has(e.feature_id)}));this._selectedCoordinates.length===n.length||e.silent||(this._emitSelectionChange=!0),this._selectedCoordinates=n}var r=e("./lib/throttle"),i=e("./lib/to_dense_array"),s=e("./lib/string_set"),a=e("./render"),c=e("./constants").interactions,u=t.exports=function(e){this._features={},this._featureIds=new s,this._selectedFeatureIds=new s,this._selectedCoordinates=[],this._changedFeatureIds=new s,this._deletedFeaturesToEmit=[],this._emitSelectionChange=!1,this._mapInitialConfig={},this.ctx=e,this.sources={hot:[],cold:[]},this.render=r(a,16,this),this.isDirty=!1};u.prototype.createRenderBatch=function(){var e=this,t=this.render,n=0;return this.render=function(){n++},function(){e.render=t,n>0&&e.render()}},u.prototype.setDirty=function(){return this.isDirty=!0,this},u.prototype.featureChanged=function(e){return this._changedFeatureIds.add(e),this},u.prototype.getChangedIds=function(){return this._changedFeatureIds.values()},u.prototype.clearChangedIds=function(){return this._changedFeatureIds.clear(),this},u.prototype.getAllIds=function(){return this._featureIds.values()},u.prototype.add=function(e){return this.featureChanged(e.id),this._features[e.id]=e,this._featureIds.add(e.id),this},u.prototype.delete=function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return i(e).forEach((function(e){t._featureIds.has(e)&&(t._featureIds.delete(e),t._selectedFeatureIds.delete(e),n.silent||-1===t._deletedFeaturesToEmit.indexOf(t._features[e])&&t._deletedFeaturesToEmit.push(t._features[e]),delete t._features[e],t.isDirty=!0)})),o.call(this,n),this},u.prototype.get=function(e){return this._features[e]},u.prototype.getAll=function(){var e=this;return Object.keys(this._features).map((function(t){return e._features[t]}))},u.prototype.select=function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return i(e).forEach((function(e){t._selectedFeatureIds.has(e)||(t._selectedFeatureIds.add(e),t._changedFeatureIds.add(e),n.silent||(t._emitSelectionChange=!0))})),this},u.prototype.deselect=function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return i(e).forEach((function(e){t._selectedFeatureIds.has(e)&&(t._selectedFeatureIds.delete(e),t._changedFeatureIds.add(e),n.silent||(t._emitSelectionChange=!0))})),o.call(this,n),this},u.prototype.clearSelected=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.deselect(this._selectedFeatureIds.values(),{silent:e.silent}),this},u.prototype.setSelected=function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e=i(e),this.deselect(this._selectedFeatureIds.values().filter((function(t){return-1===e.indexOf(t)})),{silent:n.silent}),this.select(e.filter((function(e){return!t._selectedFeatureIds.has(e)})),{silent:n.silent}),this},u.prototype.setSelectedCoordinates=function(e){return this._selectedCoordinates=e,this._emitSelectionChange=!0,this},u.prototype.clearSelectedCoordinates=function(){return this._selectedCoordinates=[],this._emitSelectionChange=!0,this},u.prototype.getSelectedIds=function(){return this._selectedFeatureIds.values()},u.prototype.getSelected=function(){var e=this;return this._selectedFeatureIds.values().map((function(t){return e.get(t)}))},u.prototype.getSelectedCoordinates=function(){var e=this;return this._selectedCoordinates.map((function(t){return{coordinates:e.get(t.feature_id).getCoordinate(t.coord_path)}}))},u.prototype.isSelected=function(e){return this._selectedFeatureIds.has(e)},u.prototype.setFeatureProperty=function(e,t,n){this.get(e).setProperty(t,n),this.featureChanged(e)},u.prototype.storeMapConfig=function(){var e=this;c.forEach((function(t){e.ctx.map[t]&&(e._mapInitialConfig[t]=e.ctx.map[t].isEnabled())}))},u.prototype.restoreMapConfig=function(){var e=this;Object.keys(this._mapInitialConfig).forEach((function(t){e._mapInitialConfig[t]?e.ctx.map[t].enable():e.ctx.map[t].disable()}))},u.prototype.getInitialConfigValue=function(e){return void 0===this._mapInitialConfig[e]||this._mapInitialConfig[e]}},{"./constants":23,"./lib/string_set":47,"./lib/throttle":50,"./lib/to_dense_array":51,"./render":62}],65:[function(e,t,n){"use strict";var o=e("xtend"),r=e("./constants"),i=["mode","feature","mouse"];t.exports=function(e){function t(e){f=o(f,e)}function n(){if(e.container){var t=[],n=[];i.forEach((function(e){f[e]!==p[e]&&(t.push("".concat(e,"-").concat(p[e])),null!==f[e]&&n.push("".concat(e,"-").concat(f[e])))})),t.length>0&&e.container.classList.remove.apply(e.container.classList,t),n.length>0&&e.container.classList.add.apply(e.container.classList,n),p=o(p,f)}}function s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=document.createElement("button");return n.className="".concat(r.classes.CONTROL_BUTTON," ").concat(t.className),n.setAttribute("title",t.title),t.container.appendChild(n),n.addEventListener("click",(function(n){n.preventDefault(),n.stopPropagation(),n.target!==l?(c(e),t.onActivate()):a()}),!0),n}function a(){l&&(l.classList.remove(r.classes.ACTIVE_BUTTON),l=null)}function c(e){a();var t=u[e];t&&t&&"trash"!==e&&(t.classList.add(r.classes.ACTIVE_BUTTON),l=t)}var u={},l=null,p={mode:null,feature:null,mouse:null},f={mode:null,feature:null,mouse:null};return{setActiveButton:c,queueMapClasses:t,updateMapClasses:n,clearMapClasses:function(){t({mode:null,feature:null,mouse:null}),n()},addButtons:function(){var t=e.options.controls,n=document.createElement("div");return n.className="".concat(r.classes.CONTROL_GROUP," ").concat(r.classes.CONTROL_BASE),t?(t[r.types.LINE]&&(u[r.types.LINE]=s(r.types.LINE,{container:n,className:r.classes.CONTROL_BUTTON_LINE,title:"LineString tool ".concat(e.options.keybindings?"(l)":""),onActivate:function(){return e.events.changeMode(r.modes.DRAW_LINE_STRING)}})),t[r.types.POLYGON]&&(u[r.types.POLYGON]=s(r.types.POLYGON,{container:n,className:r.classes.CONTROL_BUTTON_POLYGON,title:"Polygon tool ".concat(e.options.keybindings?"(p)":""),onActivate:function(){return e.events.changeMode(r.modes.DRAW_POLYGON)}})),t[r.types.POINT]&&(u[r.types.POINT]=s(r.types.POINT,{container:n,className:r.classes.CONTROL_BUTTON_POINT,title:"Marker tool ".concat(e.options.keybindings?"(m)":""),onActivate:function(){return e.events.changeMode(r.modes.DRAW_POINT)}})),t.trash&&(u.trash=s("trash",{container:n,className:r.classes.CONTROL_BUTTON_TRASH,title:"Delete",onActivate:function(){e.events.trash()}})),t.combine_features&&(u.combine_features=s("combineFeatures",{container:n,className:r.classes.CONTROL_BUTTON_COMBINE_FEATURES,title:"Combine",onActivate:function(){e.events.combineFeatures()}})),t.uncombine_features&&(u.uncombine_features=s("uncombineFeatures",{container:n,className:r.classes.CONTROL_BUTTON_UNCOMBINE_FEATURES,title:"Uncombine",onActivate:function(){e.events.uncombineFeatures()}})),n):n},removeButtons:function(){Object.keys(u).forEach((function(e){var t=u[e];t.parentNode&&t.parentNode.removeChild(t),delete u[e]}))}}}},{"./constants":23,xtend:21}]},{},[1])(1)}).call(this,n(14))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(15),r=n(1);t.default=function(e,t,n){void 0===n&&(n={});for(var i=n.steps||64,s=n.properties?n.properties:!Array.isArray(e)&&"Feature"===e.type&&e.properties?e.properties:{},a=[],c=0;c<i;c++)a.push(o.default(e,t,-360*c/i,n).geometry.coordinates);return a.push(a[0]),r.polygon([a],s)}},function(e,t){e.exports={enable(e){setTimeout(()=>{e.map&&e.map.doubleClickZoom&&e._ctx&&e._ctx.store&&e._ctx.store.getInitialConfigValue&&e._ctx.store.getInitialConfigValue("doubleClickZoom")&&e.map.doubleClickZoom.enable()},0)},disable(e){setTimeout(()=>{e.map&&e.map.doubleClickZoom&&e.map.doubleClickZoom.disable()},0)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(1);t.getCoord=function(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if("Feature"===e.type&&null!==e.geometry&&"Point"===e.geometry.type)return e.geometry.coordinates;if("Point"===e.type)return e.coordinates}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return e;throw new Error("coord must be GeoJSON Point or an Array of numbers")},t.getCoords=function(e){if(Array.isArray(e))return e;if("Feature"===e.type){if(null!==e.geometry)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")},t.containsNumber=function e(t){if(t.length>1&&o.isNumber(t[0])&&o.isNumber(t[1]))return!0;if(Array.isArray(t[0])&&t[0].length)return e(t[0]);throw new Error("coordinates must only contain numbers")},t.geojsonType=function(e,t,n){if(!t||!n)throw new Error("type and name required");if(!e||e.type!==t)throw new Error("Invalid input to "+n+": must be a "+t+", given "+e.type)},t.featureOf=function(e,t,n){if(!e)throw new Error("No feature passed");if(!n)throw new Error(".featureOf() requires a name");if(!e||"Feature"!==e.type||!e.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!e.geometry||e.geometry.type!==t)throw new Error("Invalid input to "+n+": must be a "+t+", given "+e.geometry.type)},t.collectionOf=function(e,t,n){if(!e)throw new Error("No featureCollection passed");if(!n)throw new Error(".collectionOf() requires a name");if(!e||"FeatureCollection"!==e.type)throw new Error("Invalid input to "+n+", FeatureCollection required");for(var o=0,r=e.features;o<r.length;o++){var i=r[o];if(!i||"Feature"!==i.type||!i.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!i.geometry||i.geometry.type!==t)throw new Error("Invalid input to "+n+": must be a "+t+", given "+i.geometry.type)}},t.getGeom=function(e){return"Feature"===e.type?e.geometry:e},t.getType=function(e,t){return"FeatureCollection"===e.type?"FeatureCollection":"GeometryCollection"===e.type?"GeometryCollection":"Feature"===e.type&&null!==e.geometry?e.geometry.type:e.type}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(5),r=n(1);t.default=function(e,t,n){void 0===n&&(n={});var i=o.getCoord(e),s=o.getCoord(t),a=r.degreesToRadians(s[1]-i[1]),c=r.degreesToRadians(s[0]-i[0]),u=r.degreesToRadians(i[1]),l=r.degreesToRadians(s[1]),p=Math.pow(Math.sin(a/2),2)+Math.pow(Math.sin(c/2),2)*Math.cos(u)*Math.cos(l);return r.radiansToLength(2*Math.atan2(Math.sqrt(p),Math.sqrt(1-p)),n.units)}},function(e,t,n){const o=n(8),r=n(19),i=n(0);e.exports=function e(t,n={},s=null){const{type:a,coordinates:c}=t.geometry,u=t.properties&&t.properties.id;let l=[];function p(e,t){let i="",s=null;e.forEach((e,a)=>{const c=null!=t?`${t}.${a}`:String(a),p=o(u,e,c,f(c));if(n.midpoints&&s){const e=r(u,s,p,n.map);e&&l.push(e)}s=p;const d=JSON.stringify(e);i!==d&&l.push(p),0===a&&(i=d)})}function f(e){return!!n.selectedPaths&&-1!==n.selectedPaths.indexOf(e)}return a===i.geojsonTypes.POINT?l.push(o(u,c,s,f(s))):a===i.geojsonTypes.POLYGON?c.forEach((e,t)=>{p(e,null!==s?`${s}.${t}`:String(t))}):a===i.geojsonTypes.LINE_STRING?p(c,s):0===a.indexOf(i.geojsonTypes.MULTI_PREFIX)&&function(){const o=a.replace(i.geojsonTypes.MULTI_PREFIX,"");c.forEach((r,s)=>{const a={type:i.geojsonTypes.FEATURE,properties:t.properties,geometry:{type:o,coordinates:r}};l=l.concat(e(a,n,s))})}(),l}},function(e,t,n){const o=n(0);e.exports=function(e,t,n,r){return{type:o.geojsonTypes.FEATURE,properties:{meta:o.meta.VERTEX,parent:e,coord_path:n,active:r?o.activeStates.ACTIVE:o.activeStates.INACTIVE},geometry:{type:o.geojsonTypes.POINT,coordinates:t}}}},function(e,t,n){const o=n(10),r=n(0);e.exports=function(e,t){const n=o(e.map(e=>e.toGeoJSON()),t);e.forEach(e=>{const t=e.getCoordinates(),o=e=>{const t={lng:e[0]+n.lng,lat:e[1]+n.lat};return[t.lng,t.lat]},i=e=>e.map(e=>o(e)),s=e=>e.map(e=>i(e));let a;e.type===r.geojsonTypes.POINT?a=o(t):e.type===r.geojsonTypes.LINE_STRING||e.type===r.geojsonTypes.MULTI_POINT?a=t.map(o):e.type===r.geojsonTypes.POLYGON||e.type===r.geojsonTypes.MULTI_LINE_STRING?a=t.map(i):e.type===r.geojsonTypes.MULTI_POLYGON&&(a=t.map(s)),e.incomingCoords(a)})}},function(e,t,n){const o=n(20),r=n(0),{LAT_MIN:i,LAT_MAX:s,LAT_RENDERED_MIN:a,LAT_RENDERED_MAX:c,LNG_MIN:u,LNG_MAX:l}=r;e.exports=function(e,t){let n=i,r=s,p=i,f=s,d=l,h=u;e.forEach(e=>{const t=o(e),i=t[1],s=t[3],a=t[0],c=t[2];i>n&&(n=i),s<r&&(r=s),s>p&&(p=s),i<f&&(f=i),a<d&&(d=a),c>h&&(h=c)});const g=t;return n+g.lat>c&&(g.lat=c-n),p+g.lat>s&&(g.lat=s-p),r+g.lat<a&&(g.lat=a-r),f+g.lat<i&&(g.lat=i-f),d+g.lng<=u&&(g.lng+=360*Math.ceil(Math.abs(g.lng)/360)),h+g.lng>=l&&(g.lng-=360*Math.ceil(Math.abs(g.lng)/360)),g}},function(e,t,n){const o=n(8);e.exports=function(e){const{properties:t,geometry:n}=e;if(!t.user_isCircle)return null;const r=[],i=n.coordinates[0].slice(0,-1);for(let e=0;e<i.length;e+=Math.round(i.length/4))r.push(o(t.id,i[e],`0.${e}`,!1));return r}},function(e,t,n){"use strict";n.r(t),n.d(t,"CircleMode",(function(){return o})),n.d(t,"DragCircleMode",(function(){return r})),n.d(t,"DirectMode",(function(){return i})),n.d(t,"SimpleSelectMode",(function(){return s}));const o=n(13),r=n(16),i=n(18),s=n(27)},function(e,t,n){const o=n(2),r=n(0),i=n(4),s=n(3).default,a={...o.modes.draw_polygon};a.onSetup=function(e){const t=this.newFeature({type:r.geojsonTypes.FEATURE,properties:{isCircle:!0,center:[]},geometry:{type:r.geojsonTypes.POLYGON,coordinates:[[]]}});return this.addFeature(t),this.clearSelectedFeatures(),i.disable(this),this.updateUIClasses({mouse:r.cursors.ADD}),this.activateUIButton(r.types.POLYGON),this.setActionableState({trash:!0}),{initialRadiusInKm:e.initialRadiusInKm||2,polygon:t,currentVertexPosition:0}},a.clickAnywhere=function(e,t){if(0===e.currentVertexPosition){e.currentVertexPosition++;const n=[t.lngLat.lng,t.lngLat.lat],o=s(n,e.initialRadiusInKm);e.polygon.incomingCoords(o.geometry.coordinates),e.polygon.properties.center=n,e.polygon.properties.radiusInKm=e.initialRadiusInKm}return this.changeMode(r.modes.SIMPLE_SELECT,{featureIds:[e.polygon.id]})},e.exports=a},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),r=n(5);t.default=function(e,t,n,i){void 0===i&&(i={});var s=r.getCoord(e),a=o.degreesToRadians(s[0]),c=o.degreesToRadians(s[1]),u=o.degreesToRadians(n),l=o.lengthToRadians(t,i.units),p=Math.asin(Math.sin(c)*Math.cos(l)+Math.cos(c)*Math.sin(l)*Math.cos(u)),f=a+Math.atan2(Math.sin(u)*Math.sin(l)*Math.cos(c),Math.cos(l)-Math.sin(c)*Math.sin(p)),d=o.radiansToDegrees(f),h=o.radiansToDegrees(p);return o.point([d,h],i.properties)}},function(e,t,n){const o=n(2),r=n(0),i=n(4),s=n(17),a=n(3).default,c=n(6).default,u=n(1),l={...o.modes.draw_polygon};l.onSetup=function(e){const t=this.newFeature({type:r.geojsonTypes.FEATURE,properties:{isCircle:!0,center:[]},geometry:{type:r.geojsonTypes.POLYGON,coordinates:[[]]}});return this.addFeature(t),this.clearSelectedFeatures(),i.disable(this),s.disable(this),this.updateUIClasses({mouse:r.cursors.ADD}),this.activateUIButton(r.types.POLYGON),this.setActionableState({trash:!0}),{polygon:t,currentVertexPosition:0}},l.onMouseDown=l.onTouchStart=function(e,t){0===e.polygon.properties.center.length&&(e.polygon.properties.center=[t.lngLat.lng,t.lngLat.lat])},l.onDrag=l.onMouseMove=function(e,t){const n=e.polygon.properties.center;if(n.length>0){const o=c(u.point(n),u.point([t.lngLat.lng,t.lngLat.lat]),{units:"kilometers"}),r=a(n,o);e.polygon.incomingCoords(r.geometry.coordinates),e.polygon.properties.radiusInKm=o}},l.onMouseUp=l.onTouchEnd=function(e,t){return s.enable(this),this.changeMode(r.modes.SIMPLE_SELECT,{featureIds:[e.polygon.id]})},l.onClick=l.onTap=function(e,t){e.polygon.properties.center=[]},l.toDisplayFeatures=function(e,t,n){const o=t.properties.id===e.polygon.id;return t.properties.active=o?r.activeStates.ACTIVE:r.activeStates.INACTIVE,n(t)},e.exports=l},function(e,t){e.exports={enable(e){setTimeout(()=>{e.map&&e.map.dragPan&&e._ctx&&e._ctx.store&&e._ctx.store.getInitialConfigValue&&e._ctx.store.getInitialConfigValue("dragPan")&&e.map.dragPan.enable()},0)},disable(e){setTimeout(()=>{e.map&&e.map.doubleClickZoom&&e.map.dragPan.disable()},0)}}},function(e,t,n){const o=n(2),r=n(7),i=n(9),s=n(0),a=n(10),c=n(6).default,u=n(1),l=n(3).default,p=n(11),f=o.modes.direct_select;f.dragFeature=function(e,t,n){i(this.getSelected(),n),this.getSelected().filter(e=>e.properties.isCircle).map(e=>e.properties.center).forEach(e=>{e[0]+=n.lng,e[1]+=n.lat}),e.dragMoveLocation=t.lngLat},f.dragVertex=function(e,t,n){if(e.feature.properties.isCircle){const n=e.feature.properties.center,o=[t.lngLat.lng,t.lngLat.lat],r=c(u.point(n),u.point(o),{units:"kilometers"}),i=l(n,r);e.feature.incomingCoords(i.geometry.coordinates),e.feature.properties.radiusInKm=r}else{const t=e.selectedCoordPaths.map(t=>e.feature.getCoordinate(t)),o=t.map(e=>({type:s.geojsonTypes.FEATURE,properties:{},geometry:{type:s.geojsonTypes.POINT,coordinates:e}})),r=a(o,n);for(let n=0;n<t.length;n++){const o=t[n];e.feature.updateCoordinate(e.selectedCoordPaths[n],o[0]+r.lng,o[1]+r.lat)}}},f.toDisplayFeatures=function(e,t,n){if(e.featureId===t.properties.id){t.properties.active=s.activeStates.ACTIVE,n(t),(t.properties.user_isCircle?p(t):r(t,{map:this.map,midpoints:!0,selectedPaths:e.selectedCoordPaths})).forEach(n)}else t.properties.active=s.activeStates.INACTIVE,n(t);this.fireActionable(e)},e.exports=f},function(e,t,n){const o=n(0);e.exports=function(e,t,n,r){const i=t.geometry.coordinates,s=n.geometry.coordinates;if(i[1]>o.LAT_RENDERED_MAX||i[1]<o.LAT_RENDERED_MIN||s[1]>o.LAT_RENDERED_MAX||s[1]<o.LAT_RENDERED_MIN)return null;const a=r.project([i[0],i[1]]),c=r.project([s[0],s[1]]),u=r.unproject([(a.x+c.x)/2,(a.y+c.y)/2]);return{type:o.geojsonTypes.FEATURE,properties:{meta:o.meta.MIDPOINT,parent:e,lng:u.lng,lat:u.lat,coord_path:n.properties.coord_path},geometry:{type:o.geojsonTypes.POINT,coordinates:[u.lng,u.lat]}}}},function(e,t,n){var o=n(21),r=n(25),i=n(26),s={features:["FeatureCollection"],coordinates:["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],geometry:["Feature"],geometries:["GeometryCollection"]},a=Object.keys(s);function c(e){for(var t=i(),n=o(e),r=0;r<n.length;r++)t.include(n[r]);return t}e.exports=function(e){return c(e).bbox()},e.exports.polygon=function(e){return c(e).polygon()},e.exports.bboxify=function(e){return r(e).map((function(e){e&&(a.some((function(t){return!!e[t]&&-1!==s[t].indexOf(e.type)}))&&(e.bbox=c(e).bbox(),this.update(e)))}))}},function(e,t,n){var o=n(22),r=n(23),i=n(24);e.exports=function(e){if(!e)return[];var t=r(o(e)),n=[];return t.features.forEach((function(e){e.geometry&&(n=n.concat(i(e.geometry.coordinates)))})),n}},function(e,t){e.exports=function(e){if(!e||!e.type)return null;var t=n[e.type];if(!t)return null;if("geometry"===t)return{type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:e}]};if("feature"===t)return{type:"FeatureCollection",features:[e]};if("featurecollection"===t)return e};var n={Point:"geometry",MultiPoint:"geometry",LineString:"geometry",MultiLineString:"geometry",Polygon:"geometry",MultiPolygon:"geometry",GeometryCollection:"geometry",Feature:"feature",FeatureCollection:"featurecollection"}},function(e,t){e.exports=function e(t){switch(t&&t.type||null){case"FeatureCollection":return t.features=t.features.reduce((function(t,n){return t.concat(e(n))}),[]),t;case"Feature":return t.geometry?e(t.geometry).map((function(e){var n={type:"Feature",properties:JSON.parse(JSON.stringify(t.properties)),geometry:e};return void 0!==t.id&&(n.id=t.id),n})):t;case"MultiPoint":return t.coordinates.map((function(e){return{type:"Point",coordinates:e}}));case"MultiPolygon":return t.coordinates.map((function(e){return{type:"Polygon",coordinates:e}}));case"MultiLineString":return t.coordinates.map((function(e){return{type:"LineString",coordinates:e}}));case"GeometryCollection":return t.geometries.map(e).reduce((function(e,t){return e.concat(t)}),[]);case"Point":case"Polygon":case"LineString":return[t]}}},function(e,t){e.exports=function(e){return function e(t){if(Array.isArray(t)&&t.length&&"number"==typeof t[0])return[t];return t.reduce((function(t,n){return Array.isArray(n)&&Array.isArray(n[0])?t.concat(e(n)):(t.push(n),t)}),[])}(e)}},function(e,t){var n=e.exports=function(e){return new o(e)};function o(e){this.value=e}function r(e,t,n){var o=[],r=[],a=!0;return function e(p){var f=n?i(p):p,d={},h=!0,g={node:f,node_:p,path:[].concat(o),parent:r[r.length-1],parents:r,key:o.slice(-1)[0],isRoot:0===o.length,level:o.length,circular:null,update:function(e,t){g.isRoot||(g.parent.node[g.key]=e),g.node=e,t&&(h=!1)},delete:function(e){delete g.parent.node[g.key],e&&(h=!1)},remove:function(e){c(g.parent.node)?g.parent.node.splice(g.key,1):delete g.parent.node[g.key],e&&(h=!1)},keys:null,before:function(e){d.before=e},after:function(e){d.after=e},pre:function(e){d.pre=e},post:function(e){d.post=e},stop:function(){a=!1},block:function(){h=!1}};if(!a)return g;function y(){if("object"==typeof g.node&&null!==g.node){g.keys&&g.node_===g.node||(g.keys=s(g.node)),g.isLeaf=0==g.keys.length;for(var e=0;e<r.length;e++)if(r[e].node_===p){g.circular=r[e];break}}else g.isLeaf=!0,g.keys=null;g.notLeaf=!g.isLeaf,g.notRoot=!g.isRoot}y();var m=t.call(g,g.node);return void 0!==m&&g.update&&g.update(m),d.before&&d.before.call(g,g.node),h?("object"!=typeof g.node||null===g.node||g.circular||(r.push(g),y(),u(g.keys,(function(t,r){o.push(t),d.pre&&d.pre.call(g,g.node[t],t);var i=e(g.node[t]);n&&l.call(g.node,t)&&(g.node[t]=i.node),i.isLast=r==g.keys.length-1,i.isFirst=0==r,d.post&&d.post.call(g,i),o.pop()})),r.pop()),d.after&&d.after.call(g,g.node),g):g}(e).node}function i(e){if("object"==typeof e&&null!==e){var t;if(c(e))t=[];else if("[object Date]"===a(e))t=new Date(e.getTime?e.getTime():e);else if(function(e){return"[object RegExp]"===a(e)}(e))t=new RegExp(e);else if(function(e){return"[object Error]"===a(e)}(e))t={message:e.message};else if(function(e){return"[object Boolean]"===a(e)}(e))t=new Boolean(e);else if(function(e){return"[object Number]"===a(e)}(e))t=new Number(e);else if(function(e){return"[object String]"===a(e)}(e))t=new String(e);else if(Object.create&&Object.getPrototypeOf)t=Object.create(Object.getPrototypeOf(e));else if(e.constructor===Object)t={};else{var n=e.constructor&&e.constructor.prototype||e.__proto__||{},o=function(){};o.prototype=n,t=new o}return u(s(e),(function(n){t[n]=e[n]})),t}return e}o.prototype.get=function(e){for(var t=this.value,n=0;n<e.length;n++){var o=e[n];if(!t||!l.call(t,o)){t=void 0;break}t=t[o]}return t},o.prototype.has=function(e){for(var t=this.value,n=0;n<e.length;n++){var o=e[n];if(!t||!l.call(t,o))return!1;t=t[o]}return!0},o.prototype.set=function(e,t){for(var n=this.value,o=0;o<e.length-1;o++){var r=e[o];l.call(n,r)||(n[r]={}),n=n[r]}return n[e[o]]=t,t},o.prototype.map=function(e){return r(this.value,e,!0)},o.prototype.forEach=function(e){return this.value=r(this.value,e,!1),this.value},o.prototype.reduce=function(e,t){var n=1===arguments.length,o=n?this.value:t;return this.forEach((function(t){this.isRoot&&n||(o=e.call(this,o,t))})),o},o.prototype.paths=function(){var e=[];return this.forEach((function(t){e.push(this.path)})),e},o.prototype.nodes=function(){var e=[];return this.forEach((function(t){e.push(this.node)})),e},o.prototype.clone=function(){var e=[],t=[];return function n(o){for(var r=0;r<e.length;r++)if(e[r]===o)return t[r];if("object"==typeof o&&null!==o){var a=i(o);return e.push(o),t.push(a),u(s(o),(function(e){a[e]=n(o[e])})),e.pop(),t.pop(),a}return o}(this.value)};var s=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};function a(e){return Object.prototype.toString.call(e)}var c=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},u=function(e,t){if(e.forEach)return e.forEach(t);for(var n=0;n<e.length;n++)t(e[n],n,e)};u(s(o.prototype),(function(e){n[e]=function(t){var n=[].slice.call(arguments,1),r=new o(t);return r[e].apply(r,n)}}));var l=Object.hasOwnProperty||function(e,t){return t in e}},function(e,t){function n(e){if(!(this instanceof n))return new n(e);this._bbox=e||[1/0,1/0,-1/0,-1/0],this._valid=!!e}e.exports=n,n.prototype.include=function(e){return this._valid=!0,this._bbox[0]=Math.min(this._bbox[0],e[0]),this._bbox[1]=Math.min(this._bbox[1],e[1]),this._bbox[2]=Math.max(this._bbox[2],e[0]),this._bbox[3]=Math.max(this._bbox[3],e[1]),this},n.prototype.equals=function(e){var t;return t=e instanceof n?e.bbox():e,this._bbox[0]==t[0]&&this._bbox[1]==t[1]&&this._bbox[2]==t[2]&&this._bbox[3]==t[3]},n.prototype.center=function(e){return this._valid?[(this._bbox[0]+this._bbox[2])/2,(this._bbox[1]+this._bbox[3])/2]:null},n.prototype.union=function(e){var t;return this._valid=!0,t=e instanceof n?e.bbox():e,this._bbox[0]=Math.min(this._bbox[0],t[0]),this._bbox[1]=Math.min(this._bbox[1],t[1]),this._bbox[2]=Math.max(this._bbox[2],t[2]),this._bbox[3]=Math.max(this._bbox[3],t[3]),this},n.prototype.bbox=function(){return this._valid?this._bbox:null},n.prototype.contains=function(e){if(!e)return this._fastContains();if(!this._valid)return null;var t=e[0],n=e[1];return this._bbox[0]<=t&&this._bbox[1]<=n&&this._bbox[2]>=t&&this._bbox[3]>=n},n.prototype.intersect=function(e){return this._valid?(t=e instanceof n?e.bbox():e,!(this._bbox[0]>t[2]||this._bbox[2]<t[0]||this._bbox[3]<t[1]||this._bbox[1]>t[3])):null;var t},n.prototype._fastContains=function(){if(!this._valid)return new Function("return null;");var e="return "+this._bbox[0]+"<= ll[0] &&"+this._bbox[1]+"<= ll[1] &&"+this._bbox[2]+">= ll[0] &&"+this._bbox[3]+">= ll[1]";return new Function("ll",e)},n.prototype.polygon=function(){return this._valid?{type:"Polygon",coordinates:[[[this._bbox[0],this._bbox[1]],[this._bbox[2],this._bbox[1]],[this._bbox[2],this._bbox[3]],[this._bbox[0],this._bbox[3]],[this._bbox[0],this._bbox[1]]]]}:null}},function(e,t,n){const o=n(2),r=n(7),i=n(9),s=n(0),a=n(11),c=o.modes.simple_select;c.dragMove=function(e,t){e.dragMoving=!0,t.originalEvent.stopPropagation();const n={lng:t.lngLat.lng-e.dragMoveLocation.lng,lat:t.lngLat.lat-e.dragMoveLocation.lat};i(this.getSelected(),n),this.getSelected().filter(e=>e.properties.isCircle).map(e=>e.properties.center).forEach(e=>{e[0]+=n.lng,e[1]+=n.lat}),e.dragMoveLocation=t.lngLat},c.toDisplayFeatures=function(e,t,n){if(t.properties.active=this.isSelected(t.properties.id)?s.activeStates.ACTIVE:s.activeStates.INACTIVE,n(t),this.fireActionable(),t.properties.active!==s.activeStates.ACTIVE||t.geometry.type===s.geojsonTypes.POINT)return;(t.properties.user_isCircle?a(t):r(t)).forEach(n)},e.exports=c}]);
package/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export const CircleMode = require('./lib/modes/CircleMode');
2
+ export const DragCircleMode = require('./lib/modes/DragCircleMode');
3
+ export const DirectMode = require('./lib/modes/DirectModeOverride');
4
+ export const SimpleSelectMode = require('./lib/modes/SimpleSelectModeOverride');
@@ -0,0 +1,53 @@
1
+ const MapboxDraw = require('@mapbox/mapbox-gl-draw');
2
+ const Constants = require('@mapbox/mapbox-gl-draw/src/constants');
3
+ const doubleClickZoom = require('@mapbox/mapbox-gl-draw/src/lib/double_click_zoom');
4
+ const circle = require('@turf/circle').default;
5
+ const createGeoJSONCircle = require('../utils/create_geojson_circle');
6
+
7
+ const CircleMode = {...MapboxDraw.modes.draw_polygon};
8
+ const DEFAULT_RADIUS_IN_KM = 2;
9
+
10
+ CircleMode.onSetup = function(opts) {
11
+ const polygon = this.newFeature({
12
+ type: Constants.geojsonTypes.FEATURE,
13
+ properties: {
14
+ isCircle: true,
15
+ center: []
16
+ },
17
+ geometry: {
18
+ type: Constants.geojsonTypes.POLYGON,
19
+ coordinates: [[]]
20
+ }
21
+ });
22
+
23
+ this.addFeature(polygon);
24
+
25
+ this.clearSelectedFeatures();
26
+ doubleClickZoom.disable(this);
27
+ this.updateUIClasses({ mouse: Constants.cursors.ADD });
28
+ this.activateUIButton(Constants.types.POLYGON);
29
+ this.setActionableState({
30
+ trash: true
31
+ });
32
+
33
+ return {
34
+ initialRadiusInKm: opts.initialRadiusInKm || DEFAULT_RADIUS_IN_KM,
35
+ polygon,
36
+ currentVertexPosition: 0
37
+ };
38
+ };
39
+
40
+ CircleMode.clickAnywhere = function(state, e) {
41
+ if (state.currentVertexPosition === 0) {
42
+ state.currentVertexPosition++;
43
+ const center = [e.lngLat.lng, e.lngLat.lat];
44
+ // const circleFeature = circle(center, state.initialRadiusInKm);
45
+ const circleFeature = createGeoJSONCircle(center, state.initialRadiusInKm,state.polygon.id);
46
+ state.polygon.incomingCoords(circleFeature.geometry.coordinates);
47
+ state.polygon.properties.center = center;
48
+ state.polygon.properties.radiusInKm = state.initialRadiusInKm;
49
+ }
50
+ return this.changeMode(Constants.modes.SIMPLE_SELECT, { featureIds: [state.polygon.id] });
51
+ };
52
+
53
+ module.exports = CircleMode;
@@ -0,0 +1,74 @@
1
+ const MapboxDraw = require('@mapbox/mapbox-gl-draw');
2
+ const createSupplementaryPoints = require('@mapbox/mapbox-gl-draw/src/lib/create_supplementary_points');
3
+ const moveFeatures = require('@mapbox/mapbox-gl-draw/src/lib/move_features');
4
+ const Constants = require('@mapbox/mapbox-gl-draw/src/constants');
5
+ const constrainFeatureMovement = require('@mapbox/mapbox-gl-draw/src/lib/constrain_feature_movement');
6
+ const distance = require('@turf/distance').default;
7
+ const turfHelpers = require('@turf/helpers');
8
+ const circle = require('@turf/circle').default;
9
+ const createGeoJSONCircle = require('../utils/create_geojson_circle');
10
+ const createSupplementaryPointsForCircle = require('../utils/create_supplementary_points_circle');
11
+
12
+
13
+ const DirectModeOverride = MapboxDraw.modes.direct_select;
14
+
15
+ DirectModeOverride.dragFeature = function(state, e, delta) {
16
+ moveFeatures(this.getSelected(), delta);
17
+ this.getSelected()
18
+ .filter(feature => feature.properties.isCircle)
19
+ .map(circle => circle.properties.center)
20
+ .forEach(center => {
21
+ center[0] += delta.lng;
22
+ center[1] += delta.lat;
23
+ });
24
+ state.dragMoveLocation = e.lngLat;
25
+ };
26
+
27
+ DirectModeOverride.dragVertex = function(state, e, delta) {
28
+ if (state.feature.properties.isCircle) {
29
+ const center = state.feature.properties.center;
30
+ const movedVertex = [e.lngLat.lng, e.lngLat.lat];
31
+ const radius = distance(turfHelpers.point(center), turfHelpers.point(movedVertex), {units: 'kilometers'});
32
+ // const circleFeature = circle(center, radius);
33
+ const circleFeature = createGeoJSONCircle(center, radius,state.feature.id);
34
+ state.feature.incomingCoords(circleFeature.geometry.coordinates);
35
+ state.feature.properties.radiusInKm = radius;
36
+ } else {
37
+ const selectedCoords = state.selectedCoordPaths.map(coord_path => state.feature.getCoordinate(coord_path));
38
+ const selectedCoordPoints = selectedCoords.map(coords => ({
39
+ type: Constants.geojsonTypes.FEATURE,
40
+ properties: {},
41
+ geometry: {
42
+ type: Constants.geojsonTypes.POINT,
43
+ coordinates: coords
44
+ }
45
+ }));
46
+
47
+ const constrainedDelta = constrainFeatureMovement(selectedCoordPoints, delta);
48
+ for (let i = 0; i < selectedCoords.length; i++) {
49
+ const coord = selectedCoords[i];
50
+ state.feature.updateCoordinate(state.selectedCoordPaths[i], coord[0] + constrainedDelta.lng, coord[1] + constrainedDelta.lat);
51
+ }
52
+ }
53
+ };
54
+
55
+ DirectModeOverride.toDisplayFeatures = function (state, geojson, push) {
56
+ if (state.featureId === geojson.properties.id) {
57
+ geojson.properties.active = Constants.activeStates.ACTIVE;
58
+ push(geojson);
59
+ const supplementaryPoints = geojson.properties.user_isCircle ? createSupplementaryPointsForCircle(geojson)
60
+ : createSupplementaryPoints(geojson, {
61
+ map: this.map,
62
+ midpoints: true,
63
+ selectedPaths: state.selectedCoordPaths
64
+ });
65
+ supplementaryPoints.forEach(push);
66
+ } else {
67
+ geojson.properties.active = Constants.activeStates.INACTIVE;
68
+ push(geojson);
69
+ }
70
+ this.fireActionable(state);
71
+
72
+ }
73
+
74
+ module.exports = DirectModeOverride;
@@ -0,0 +1,79 @@
1
+ const MapboxDraw = require('@mapbox/mapbox-gl-draw');
2
+ const Constants = require('@mapbox/mapbox-gl-draw/src/constants');
3
+ const doubleClickZoom = require('@mapbox/mapbox-gl-draw/src/lib/double_click_zoom');
4
+ const dragPan = require('../utils/drag_pan');
5
+ const circle = require('@turf/circle').default;
6
+ const createGeoJSONCircle = require('../utils/create_geojson_circle');
7
+ const distance = require('@turf/distance').default;
8
+ const turfHelpers = require('@turf/helpers');
9
+
10
+ const DragCircleMode = {...MapboxDraw.modes.draw_polygon};
11
+
12
+ DragCircleMode.onSetup = function(opts) {
13
+ const polygon = this.newFeature({
14
+ type: Constants.geojsonTypes.FEATURE,
15
+ properties: {
16
+ isCircle: true,
17
+ center: []
18
+ },
19
+ geometry: {
20
+ type: Constants.geojsonTypes.POLYGON,
21
+ coordinates: [[]]
22
+ }
23
+ });
24
+
25
+ this.addFeature(polygon);
26
+
27
+ this.clearSelectedFeatures();
28
+ doubleClickZoom.disable(this);
29
+ dragPan.disable(this);
30
+ this.updateUIClasses({ mouse: Constants.cursors.ADD });
31
+ this.activateUIButton(Constants.types.POLYGON);
32
+ this.setActionableState({
33
+ trash: true
34
+ });
35
+
36
+ return {
37
+ polygon,
38
+ currentVertexPosition: 0
39
+ };
40
+ };
41
+
42
+ DragCircleMode.onMouseDown = DragCircleMode.onTouchStart = function (state, e) {
43
+ const currentCenter = state.polygon.properties.center;
44
+ if (currentCenter.length === 0) {
45
+ state.polygon.properties.center = [e.lngLat.lng, e.lngLat.lat];
46
+ }
47
+ };
48
+
49
+ DragCircleMode.onDrag = DragCircleMode.onMouseMove = function (state, e) {
50
+ const center = state.polygon.properties.center;
51
+ if (center.length > 0) {
52
+ const distanceInKm = distance(
53
+ turfHelpers.point(center),
54
+ turfHelpers.point([e.lngLat.lng, e.lngLat.lat]),
55
+ { units : 'kilometers'});
56
+ // const circleFeature = circle(center, distanceInKm);
57
+ const circleFeature = createGeoJSONCircle(center, distanceInKm,state.polygon.id);
58
+ state.polygon.incomingCoords(circleFeature.geometry.coordinates);
59
+ state.polygon.properties.radiusInKm = distanceInKm;
60
+ }
61
+ };
62
+
63
+ DragCircleMode.onMouseUp = DragCircleMode.onTouchEnd = function (state, e) {
64
+ dragPan.enable(this);
65
+ return this.changeMode(Constants.modes.SIMPLE_SELECT, { featureIds: [state.polygon.id] });
66
+ };
67
+
68
+ DragCircleMode.onClick = DragCircleMode.onTap = function (state, e) {
69
+ // don't draw the circle if its a tap or click event
70
+ state.polygon.properties.center = [];
71
+ };
72
+
73
+ DragCircleMode.toDisplayFeatures = function(state, geojson, display) {
74
+ const isActivePolygon = geojson.properties.id === state.polygon.id;
75
+ geojson.properties.active = (isActivePolygon) ? Constants.activeStates.ACTIVE : Constants.activeStates.INACTIVE;
76
+ return display(geojson);
77
+ };
78
+
79
+ module.exports = DragCircleMode;
@@ -0,0 +1,45 @@
1
+ const MapboxDraw = require('@mapbox/mapbox-gl-draw');
2
+ const createSupplementaryPoints = require('@mapbox/mapbox-gl-draw/src/lib/create_supplementary_points');
3
+ const moveFeatures = require('@mapbox/mapbox-gl-draw/src/lib/move_features');
4
+ const Constants = require('@mapbox/mapbox-gl-draw/src/constants');
5
+ const createSupplementaryPointsForCircle = require('../utils/create_supplementary_points_circle');
6
+
7
+
8
+ const SimpleSelectModeOverride = MapboxDraw.modes.simple_select;
9
+
10
+ SimpleSelectModeOverride.dragMove = function(state, e) {
11
+ // Dragging when drag move is enabled
12
+ state.dragMoving = true;
13
+ e.originalEvent.stopPropagation();
14
+
15
+ const delta = {
16
+ lng: e.lngLat.lng - state.dragMoveLocation.lng,
17
+ lat: e.lngLat.lat - state.dragMoveLocation.lat
18
+ };
19
+
20
+ moveFeatures(this.getSelected(), delta);
21
+
22
+ this.getSelected()
23
+ .filter(feature => feature.properties.isCircle)
24
+ .map(circle => circle.properties.center)
25
+ .forEach(center => {
26
+ center[0] += delta.lng;
27
+ center[1] += delta.lat;
28
+ });
29
+
30
+ state.dragMoveLocation = e.lngLat;
31
+ };
32
+
33
+ SimpleSelectModeOverride.toDisplayFeatures = function(state, geojson, display) {
34
+ geojson.properties.active = (this.isSelected(geojson.properties.id)) ?
35
+ Constants.activeStates.ACTIVE : Constants.activeStates.INACTIVE;
36
+ display(geojson);
37
+ this.fireActionable();
38
+ if (geojson.properties.active !== Constants.activeStates.ACTIVE ||
39
+ geojson.geometry.type === Constants.geojsonTypes.POINT) return;
40
+ const supplementaryPoints = geojson.properties.user_isCircle ?
41
+ createSupplementaryPointsForCircle(geojson) : createSupplementaryPoints(geojson);
42
+ supplementaryPoints.forEach(display);
43
+ };
44
+
45
+ module.exports = SimpleSelectModeOverride;
@@ -0,0 +1,36 @@
1
+ function createGeoJSONCircle(center, radiusInKm, parentId, points = 64){
2
+ const coords = {
3
+ latitude: center[1],
4
+ longitude: center[0]
5
+ };
6
+
7
+ const km = radiusInKm;
8
+
9
+ const ret = [];
10
+ const distanceX = km / 111.32;
11
+ const distanceY = km / 110.574;
12
+
13
+ let theta;
14
+ let x;
15
+ let y;
16
+ for (let i = 0; i < points; i += 1) {
17
+ theta = (i / points) * (2 * Math.PI);
18
+ x = distanceX * Math.cos(theta);
19
+ y = distanceY * Math.sin(theta);
20
+
21
+ ret.push([coords.longitude + x, coords.latitude + y]);
22
+ }
23
+ ret.push(ret[0]);
24
+
25
+ return {
26
+ type: "Feature",
27
+ geometry: {
28
+ type: "Polygon",
29
+ coordinates: [ret]
30
+ },
31
+ properties: {
32
+ parent: parentId
33
+ }
34
+ };
35
+ }
36
+ module.exports = createGeoJSONCircle;
@@ -0,0 +1,16 @@
1
+ const createVertex = require('@mapbox/mapbox-gl-draw/src/lib/create_vertex');
2
+
3
+ function createSupplementaryPointsForCircle(geojson) {
4
+ const { properties, geometry } = geojson;
5
+
6
+ if (!properties.user_isCircle) return null;
7
+
8
+ const supplementaryPoints = [];
9
+ const vertices = geometry.coordinates[0].slice(0, -1);
10
+ for (let index = 0; index < vertices.length; index += Math.round((vertices.length / 4))) {
11
+ supplementaryPoints.push(createVertex(properties.id, vertices[index], `0.${index}`, false));
12
+ }
13
+ return supplementaryPoints;
14
+ }
15
+
16
+ module.exports = createSupplementaryPointsForCircle;
@@ -0,0 +1,18 @@
1
+ module.exports = {
2
+ enable(ctx) {
3
+ setTimeout(() => {
4
+ // First check we've got a map and some context.
5
+ if (!ctx.map || !ctx.map.dragPan || !ctx._ctx || !ctx._ctx.store || !ctx._ctx.store.getInitialConfigValue) return;
6
+ // Now check initial state wasn't false (we leave it disabled if so)
7
+ if (!ctx._ctx.store.getInitialConfigValue('dragPan')) return;
8
+ ctx.map.dragPan.enable();
9
+ }, 0);
10
+ },
11
+ disable(ctx) {
12
+ setTimeout(() => {
13
+ if (!ctx.map || !ctx.map.doubleClickZoom) return;
14
+ // Always disable here, as it's necessary in some cases.
15
+ ctx.map.dragPan.disable();
16
+ }, 0);
17
+ }
18
+ };
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@mapgis/mapbox-gl-draw-circle",
3
+ "version": "10.5.5",
4
+ "description": "",
5
+ "main": "index",
6
+ "scripts": {
7
+ "test": "jest --all",
8
+ "coverage": "jest --all --coverage"
9
+ },
10
+ "keywords": [
11
+ "mapbox",
12
+ "geojson",
13
+ "circle",
14
+ "mapbox",
15
+ "draw"
16
+ ],
17
+ "author": "",
18
+ "license": "MIT",
19
+ "dependencies": {
20
+ "@mapbox/mapbox-gl-draw": "1.1.1",
21
+ "@turf/along": "^6.0.1",
22
+ "@turf/circle": "^6.0.1",
23
+ "@turf/distance": "^6.0.1",
24
+ "@turf/helpers": "^6.1.4",
25
+ "@turf/length": "^6.0.2"
26
+ },
27
+ "devDependencies": {
28
+ "jest": "^24.5.0"
29
+ }
30
+ }