{"version":3,"file":"@mapbox-Co4wQjja.js","sources":["../../node_modules/@mapbox/mapbox-gl-draw/src/lib/mode_handler.js","../../node_modules/@mapbox/geojson-area/index.js","../../node_modules/@mapbox/mapbox-gl-draw/src/constants.js","../../node_modules/@mapbox/mapbox-gl-draw/src/lib/sort_features.js","../../node_modules/@mapbox/mapbox-gl-draw/src/lib/map_event_to_bounding_box.js","../../node_modules/@mapbox/mapbox-gl-draw/src/lib/string_set.js","../../node_modules/@mapbox/mapbox-gl-draw/src/lib/features_at.js","../../node_modules/@mapbox/mapbox-gl-draw/src/lib/get_features_and_set_cursor.js","../../node_modules/@mapbox/mapbox-gl-draw/src/lib/euclidean_distance.js","../../node_modules/@mapbox/mapbox-gl-draw/src/lib/is_click.js","../../node_modules/@mapbox/mapbox-gl-draw/src/lib/is_tap.js","../../node_modules/@mapbox/mapbox-gl-draw/node_modules/nanoid/non-secure/index.js","../../node_modules/@mapbox/mapbox-gl-draw/src/lib/id.js","../../node_modules/@mapbox/mapbox-gl-draw/src/feature_types/feature.js","../../node_modules/@mapbox/mapbox-gl-draw/src/feature_types/point.js","../../node_modules/@mapbox/mapbox-gl-draw/src/feature_types/line_string.js","../../node_modules/@mapbox/mapbox-gl-draw/src/feature_types/polygon.js","../../node_modules/@mapbox/mapbox-gl-draw/src/feature_types/multi_feature.js","../../node_modules/@mapbox/mapbox-gl-draw/src/modes/mode_interface_accessors.js","../../node_modules/@mapbox/mapbox-gl-draw/src/modes/mode_interface.js","../../node_modules/@mapbox/mapbox-gl-draw/src/modes/object_to_mode.js","../../node_modules/@mapbox/mapbox-gl-draw/src/events.js","../../node_modules/@mapbox/mapbox-gl-draw/src/lib/to_dense_array.js","../../node_modules/@mapbox/mapbox-gl-draw/src/render.js","../../node_modules/@mapbox/mapbox-gl-draw/src/store.js","../../node_modules/@mapbox/mapbox-gl-draw/src/ui.js","../../node_modules/@mapbox/mapbox-gl-draw/src/setup.js","../../node_modules/@mapbox/mapbox-gl-draw/src/lib/theme.js","../../node_modules/@mapbox/mapbox-gl-draw/src/lib/common_selectors.js","../../node_modules/@mapbox/mapbox-gl-draw/node_modules/@mapbox/point-geometry/index.js","../../node_modules/@mapbox/mapbox-gl-draw/src/lib/mouse_event_point.js","../../node_modules/@mapbox/mapbox-gl-draw/src/lib/create_vertex.js","../../node_modules/@mapbox/mapbox-gl-draw/src/lib/create_midpoint.js","../../node_modules/@mapbox/mapbox-gl-draw/src/lib/create_supplementary_points.js","../../node_modules/@mapbox/mapbox-gl-draw/src/lib/double_click_zoom.js","../../node_modules/@mapbox/mapbox-gl-draw/src/lib/constrain_feature_movement.js","../../node_modules/@mapbox/mapbox-gl-draw/src/lib/move_features.js","../../node_modules/@mapbox/mapbox-gl-draw/src/modes/simple_select.js","../../node_modules/@mapbox/mapbox-gl-draw/src/modes/direct_select.js","../../node_modules/@mapbox/mapbox-gl-draw/src/modes/draw_point.js","../../node_modules/@mapbox/mapbox-gl-draw/src/lib/is_event_at_coordinates.js","../../node_modules/@mapbox/mapbox-gl-draw/src/modes/draw_polygon.js","../../node_modules/@mapbox/mapbox-gl-draw/src/modes/draw_line_string.js","../../node_modules/@mapbox/mapbox-gl-draw/src/modes/index.js","../../node_modules/@mapbox/mapbox-gl-draw/src/options.js","../../node_modules/@mapbox/geojson-normalize/index.js","../../node_modules/@mapbox/mapbox-gl-draw/src/lib/string_sets_are_equal.js","../../node_modules/@mapbox/mapbox-gl-draw/src/api.js","../../node_modules/@mapbox/mapbox-gl-draw/index.js"],"sourcesContent":["\nconst ModeHandler = function(mode, DrawContext) {\n\n const handlers = {\n drag: [],\n click: [],\n mousemove: [],\n mousedown: [],\n mouseup: [],\n mouseout: [],\n keydown: [],\n keyup: [],\n touchstart: [],\n touchmove: [],\n touchend: [],\n tap: []\n };\n\n const ctx = {\n on(event, selector, fn) {\n if (handlers[event] === undefined) {\n throw new Error(`Invalid event type: ${event}`);\n }\n handlers[event].push({\n selector,\n fn\n });\n },\n render(id) {\n DrawContext.store.featureChanged(id);\n }\n };\n\n const delegate = function (eventName, event) {\n const handles = handlers[eventName];\n let iHandle = handles.length;\n while (iHandle--) {\n const handle = handles[iHandle];\n if (handle.selector(event)) {\n const skipRender = handle.fn.call(ctx, event);\n if (!skipRender) {\n DrawContext.store.render();\n }\n DrawContext.ui.updateMapClasses();\n\n // ensure an event is only handled once\n // we do this to let modes have multiple overlapping selectors\n // and relay on order of oppertations to filter\n break;\n }\n }\n };\n\n mode.start.call(ctx);\n\n return {\n render: mode.render,\n stop() {\n if (mode.stop) mode.stop();\n },\n trash() {\n if (mode.trash) {\n mode.trash();\n DrawContext.store.render();\n }\n },\n combineFeatures() {\n if (mode.combineFeatures) {\n mode.combineFeatures();\n }\n },\n uncombineFeatures() {\n if (mode.uncombineFeatures) {\n mode.uncombineFeatures();\n }\n },\n drag(event) {\n delegate('drag', event);\n },\n click(event) {\n delegate('click', event);\n },\n mousemove(event) {\n delegate('mousemove', event);\n },\n mousedown(event) {\n delegate('mousedown', event);\n },\n mouseup(event) {\n delegate('mouseup', event);\n },\n mouseout(event) {\n delegate('mouseout', event);\n },\n keydown(event) {\n delegate('keydown', event);\n },\n keyup(event) {\n delegate('keyup', event);\n },\n touchstart(event) {\n delegate('touchstart', event);\n },\n touchmove(event) {\n delegate('touchmove', event);\n },\n touchend(event) {\n delegate('touchend', event);\n },\n tap(event) {\n delegate('tap', event);\n }\n };\n};\n\nexport default ModeHandler;\n","var wgs84 = require('wgs84');\n\nmodule.exports.geometry = geometry;\nmodule.exports.ring = ringArea;\n\nfunction geometry(_) {\n var area = 0, i;\n switch (_.type) {\n case 'Polygon':\n return polygonArea(_.coordinates);\n case 'MultiPolygon':\n for (i = 0; i < _.coordinates.length; i++) {\n area += polygonArea(_.coordinates[i]);\n }\n return area;\n case 'Point':\n case 'MultiPoint':\n case 'LineString':\n case 'MultiLineString':\n return 0;\n case 'GeometryCollection':\n for (i = 0; i < _.geometries.length; i++) {\n area += geometry(_.geometries[i]);\n }\n return area;\n }\n}\n\nfunction polygonArea(coords) {\n var area = 0;\n if (coords && coords.length > 0) {\n area += Math.abs(ringArea(coords[0]));\n for (var i = 1; i < coords.length; i++) {\n area -= Math.abs(ringArea(coords[i]));\n }\n }\n return area;\n}\n\n/**\n * Calculate the approximate area of the polygon were it projected onto\n * the earth. Note that this area will be positive if ring is oriented\n * clockwise, otherwise it will be negative.\n *\n * Reference:\n * Robert. G. Chamberlain and William H. Duquette, \"Some Algorithms for\n * Polygons on a Sphere\", JPL Publication 07-03, Jet Propulsion\n * Laboratory, Pasadena, CA, June 2007 http://trs-new.jpl.nasa.gov/dspace/handle/2014/40409\n *\n * Returns:\n * {float} The approximate signed geodesic area of the polygon in square\n * meters.\n */\n\nfunction ringArea(coords) {\n var p1, p2, p3, lowerIndex, middleIndex, upperIndex, i,\n area = 0,\n coordsLength = coords.length;\n\n if (coordsLength > 2) {\n for (i = 0; i < coordsLength; i++) {\n if (i === coordsLength - 2) {// i = N-2\n lowerIndex = coordsLength - 2;\n middleIndex = coordsLength -1;\n upperIndex = 0;\n } else if (i === coordsLength - 1) {// i = N-1\n lowerIndex = coordsLength - 1;\n middleIndex = 0;\n upperIndex = 1;\n } else { // i = 0 to N-3\n lowerIndex = i;\n middleIndex = i+1;\n upperIndex = i+2;\n }\n p1 = coords[lowerIndex];\n p2 = coords[middleIndex];\n p3 = coords[upperIndex];\n area += ( rad(p3[0]) - rad(p1[0]) ) * Math.sin( rad(p2[1]));\n }\n\n area = area * wgs84.RADIUS * wgs84.RADIUS / 2;\n }\n\n return area;\n}\n\nfunction rad(_) {\n return _ * Math.PI / 180;\n}","export const classes = {\n CANVAS: 'mapboxgl-canvas',\n CONTROL_BASE: 'mapboxgl-ctrl',\n CONTROL_PREFIX: 'mapboxgl-ctrl-',\n CONTROL_BUTTON: 'mapbox-gl-draw_ctrl-draw-btn',\n CONTROL_BUTTON_LINE: 'mapbox-gl-draw_line',\n CONTROL_BUTTON_POLYGON: 'mapbox-gl-draw_polygon',\n CONTROL_BUTTON_POINT: 'mapbox-gl-draw_point',\n CONTROL_BUTTON_TRASH: 'mapbox-gl-draw_trash',\n CONTROL_BUTTON_COMBINE_FEATURES: 'mapbox-gl-draw_combine',\n CONTROL_BUTTON_UNCOMBINE_FEATURES: 'mapbox-gl-draw_uncombine',\n CONTROL_GROUP: 'mapboxgl-ctrl-group',\n ATTRIBUTION: 'mapboxgl-ctrl-attrib',\n ACTIVE_BUTTON: 'active',\n BOX_SELECT: 'mapbox-gl-draw_boxselect'\n};\n\nexport const sources = {\n HOT: 'mapbox-gl-draw-hot',\n COLD: 'mapbox-gl-draw-cold'\n};\n\nexport const cursors = {\n ADD: 'add',\n MOVE: 'move',\n DRAG: 'drag',\n POINTER: 'pointer',\n NONE: 'none'\n};\n\nexport const types = {\n POLYGON: 'polygon',\n LINE: 'line_string',\n POINT: 'point'\n};\n\nexport const geojsonTypes = {\n FEATURE: 'Feature',\n POLYGON: 'Polygon',\n LINE_STRING: 'LineString',\n POINT: 'Point',\n FEATURE_COLLECTION: 'FeatureCollection',\n MULTI_PREFIX: 'Multi',\n MULTI_POINT: 'MultiPoint',\n MULTI_LINE_STRING: 'MultiLineString',\n MULTI_POLYGON: 'MultiPolygon'\n};\n\nexport const modes = {\n DRAW_LINE_STRING: 'draw_line_string',\n DRAW_POLYGON: 'draw_polygon',\n DRAW_POINT: 'draw_point',\n SIMPLE_SELECT: 'simple_select',\n DIRECT_SELECT: 'direct_select'\n};\n\nexport const events = {\n CREATE: 'draw.create',\n DELETE: 'draw.delete',\n UPDATE: 'draw.update',\n SELECTION_CHANGE: 'draw.selectionchange',\n MODE_CHANGE: 'draw.modechange',\n ACTIONABLE: 'draw.actionable',\n RENDER: 'draw.render',\n COMBINE_FEATURES: 'draw.combine',\n UNCOMBINE_FEATURES: 'draw.uncombine'\n};\n\nexport const updateActions = {\n MOVE: 'move',\n CHANGE_PROPERTIES: 'change_properties',\n CHANGE_COORDINATES: 'change_coordinates'\n};\n\nexport const meta = {\n FEATURE: 'feature',\n MIDPOINT: 'midpoint',\n VERTEX: 'vertex'\n};\n\nexport const activeStates = {\n ACTIVE: 'true',\n INACTIVE: 'false'\n};\n\nexport const interactions = [\n 'scrollZoom',\n 'boxZoom',\n 'dragRotate',\n 'dragPan',\n 'keyboard',\n 'doubleClickZoom',\n 'touchZoomRotate'\n];\n\nexport const LAT_MIN = -90;\nexport const LAT_RENDERED_MIN = -85;\nexport const LAT_MAX = 90;\nexport const LAT_RENDERED_MAX = 85;\nexport const LNG_MIN = -270;\nexport const LNG_MAX = 270;\n","import area from '@mapbox/geojson-area';\nimport * as Constants from '../constants.js';\n\nconst FEATURE_SORT_RANKS = {\n Point: 0,\n LineString: 1,\n MultiLineString: 1,\n Polygon: 2\n};\n\nfunction comparator(a, b) {\n const score = FEATURE_SORT_RANKS[a.geometry.type] - FEATURE_SORT_RANKS[b.geometry.type];\n\n if (score === 0 && a.geometry.type === Constants.geojsonTypes.POLYGON) {\n return a.area - b.area;\n }\n\n return score;\n}\n\n// Sort in the order above, then sort polygons by area ascending.\nfunction sortFeatures(features) {\n return features.map((feature) => {\n if (feature.geometry.type === Constants.geojsonTypes.POLYGON) {\n feature.area = area.geometry({\n type: Constants.geojsonTypes.FEATURE,\n property: {},\n geometry: feature.geometry\n });\n }\n return feature;\n }).sort(comparator).map((feature) => {\n delete feature.area;\n return feature;\n });\n}\n\nexport default sortFeatures;\n","/**\n * Returns a bounding box representing the event's location.\n *\n * @param {Event} mapEvent - Mapbox GL JS map event, with a point properties.\n * @return {Array>} Bounding box.\n */\nfunction mapEventToBoundingBox(mapEvent, buffer = 0) {\n return [\n [mapEvent.point.x - buffer, mapEvent.point.y - buffer],\n [mapEvent.point.x + buffer, mapEvent.point.y + buffer]\n ];\n}\n\nexport default mapEventToBoundingBox;\n","function StringSet(items) {\n this._items = {};\n this._nums = {};\n this._length = items ? items.length : 0;\n if (!items) return;\n for (let i = 0, l = items.length; i < l; i++) {\n this.add(items[i]);\n if (items[i] === undefined) continue;\n if (typeof items[i] === 'string') this._items[items[i]] = i;\n else this._nums[items[i]] = i;\n\n }\n}\n\nStringSet.prototype.add = function(x) {\n if (this.has(x)) return this;\n this._length++;\n if (typeof x === 'string') this._items[x] = this._length;\n else this._nums[x] = this._length;\n return this;\n};\n\nStringSet.prototype.delete = function(x) {\n if (this.has(x) === false) return this;\n this._length--;\n delete this._items[x];\n delete this._nums[x];\n return this;\n};\n\nStringSet.prototype.has = function(x) {\n if (typeof x !== 'string' && typeof x !== 'number') return false;\n return this._items[x] !== undefined || this._nums[x] !== undefined;\n};\n\nStringSet.prototype.values = function() {\n const values = [];\n Object.keys(this._items).forEach((k) => {\n values.push({ k, v: this._items[k] });\n });\n Object.keys(this._nums).forEach((k) => {\n values.push({ k: JSON.parse(k), v: this._nums[k] });\n });\n\n return values.sort((a, b) => a.v - b.v).map(a => a.k);\n};\n\nStringSet.prototype.clear = function() {\n this._length = 0;\n this._items = {};\n this._nums = {};\n return this;\n};\n\nexport default StringSet;\n","import sortFeatures from './sort_features.js';\nimport mapEventToBoundingBox from './map_event_to_bounding_box.js';\nimport * as Constants from '../constants.js';\nimport StringSet from './string_set.js';\n\nconst META_TYPES = [\n Constants.meta.FEATURE,\n Constants.meta.MIDPOINT,\n Constants.meta.VERTEX\n];\n\n// Requires either event or bbox\nexport default {\n click: featuresAtClick,\n touch: featuresAtTouch\n};\n\nfunction featuresAtClick(event, bbox, ctx) {\n return featuresAt(event, bbox, ctx, ctx.options.clickBuffer);\n}\n\nfunction featuresAtTouch(event, bbox, ctx) {\n return featuresAt(event, bbox, ctx, ctx.options.touchBuffer);\n}\n\nfunction featuresAt(event, bbox, ctx, buffer) {\n if (ctx.map === null) return [];\n\n const box = (event) ? mapEventToBoundingBox(event, buffer) : bbox;\n\n const queryParams = {};\n\n if (ctx.options.styles) queryParams.layers = ctx.options.styles.map(s => s.id).filter(id => ctx.map.getLayer(id) != null);\n\n const features = ctx.map.queryRenderedFeatures(box, queryParams)\n .filter(feature => META_TYPES.indexOf(feature.properties.meta) !== -1);\n\n const featureIds = new StringSet();\n const uniqueFeatures = [];\n features.forEach((feature) => {\n const featureId = feature.properties.id;\n if (featureIds.has(featureId)) return;\n featureIds.add(featureId);\n uniqueFeatures.push(feature);\n });\n\n return sortFeatures(uniqueFeatures);\n}\n","import featuresAt from './features_at.js';\nimport * as Constants from '../constants.js';\n\nexport default function getFeatureAtAndSetCursors(event, ctx) {\n const features = featuresAt.click(event, null, ctx);\n const classes = { mouse: Constants.cursors.NONE };\n\n if (features[0]) {\n classes.mouse = (features[0].properties.active === Constants.activeStates.ACTIVE) ?\n Constants.cursors.MOVE : Constants.cursors.POINTER;\n classes.feature = features[0].properties.meta;\n }\n\n if (ctx.events.currentModeName().indexOf('draw') !== -1) {\n classes.mouse = Constants.cursors.ADD;\n }\n\n ctx.ui.queueMapClasses(classes);\n ctx.ui.updateMapClasses();\n\n return features[0];\n}\n","export default function(a, b) {\n const x = a.x - b.x;\n const y = a.y - b.y;\n return Math.sqrt((x * x) + (y * y));\n}\n","import euclideanDistance from './euclidean_distance.js';\n\nconst FINE_TOLERANCE = 4;\nconst GROSS_TOLERANCE = 12;\nconst INTERVAL = 500;\n\nexport default function isClick(start, end, options = {}) {\n const fineTolerance = (options.fineTolerance != null) ? options.fineTolerance : FINE_TOLERANCE;\n const grossTolerance = (options.grossTolerance != null) ? options.grossTolerance : GROSS_TOLERANCE;\n const interval = (options.interval != null) ? options.interval : INTERVAL;\n\n start.point = start.point || end.point;\n start.time = start.time || end.time;\n const moveDistance = euclideanDistance(start.point, end.point);\n\n return moveDistance < fineTolerance ||\n (moveDistance < grossTolerance && (end.time - start.time) < interval);\n}\n","import euclideanDistance from './euclidean_distance.js';\n\nexport const TAP_TOLERANCE = 25;\nexport const TAP_INTERVAL = 250;\n\nexport default function isTap(start, end, options = {}) {\n const tolerance = (options.tolerance != null) ? options.tolerance : TAP_TOLERANCE;\n const interval = (options.interval != null) ? options.interval : TAP_INTERVAL;\n\n start.point = start.point || end.point;\n start.time = start.time || end.time;\n const moveDistance = euclideanDistance(start.point, end.point);\n\n return moveDistance < tolerance && (end.time - start.time) < interval;\n}\n","let urlAlphabet =\n 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'\nexport let customAlphabet = (alphabet, defaultSize = 21) => {\n return (size = defaultSize) => {\n let id = ''\n let i = size | 0\n while (i--) {\n id += alphabet[(Math.random() * alphabet.length) | 0]\n }\n return id\n }\n}\nexport let nanoid = (size = 21) => {\n let id = ''\n let i = size | 0\n while (i--) {\n id += urlAlphabet[(Math.random() * 64) | 0]\n }\n return id\n}\n","import {customAlphabet} from 'nanoid/non-secure';\n\nconst nanoid = customAlphabet('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', 32);\n\nexport function generateID() {\n return nanoid();\n}\n","import {generateID} from '../lib/id.js';\nimport * as Constants from '../constants.js';\n\nconst Feature = function(ctx, geojson) {\n this.ctx = ctx;\n this.properties = geojson.properties || {};\n this.coordinates = geojson.geometry.coordinates;\n this.id = geojson.id || generateID();\n this.type = geojson.geometry.type;\n};\n\nFeature.prototype.changed = function() {\n this.ctx.store.featureChanged(this.id);\n};\n\nFeature.prototype.incomingCoords = function(coords) {\n this.setCoordinates(coords);\n};\n\nFeature.prototype.setCoordinates = function(coords) {\n this.coordinates = coords;\n this.changed();\n};\n\nFeature.prototype.getCoordinates = function() {\n return JSON.parse(JSON.stringify(this.coordinates));\n};\n\nFeature.prototype.setProperty = function(property, value) {\n this.properties[property] = value;\n};\n\nFeature.prototype.toGeoJSON = function() {\n return JSON.parse(JSON.stringify({\n id: this.id,\n type: Constants.geojsonTypes.FEATURE,\n properties: this.properties,\n geometry: {\n coordinates: this.getCoordinates(),\n type: this.type\n }\n }));\n};\n\nFeature.prototype.internal = function(mode) {\n const properties = {\n id: this.id,\n meta: Constants.meta.FEATURE,\n 'meta:type': this.type,\n active: Constants.activeStates.INACTIVE,\n mode\n };\n\n if (this.ctx.options.userProperties) {\n for (const name in this.properties) {\n properties[`user_${name}`] = this.properties[name];\n }\n }\n\n return {\n type: Constants.geojsonTypes.FEATURE,\n properties,\n geometry: {\n coordinates: this.getCoordinates(),\n type: this.type\n }\n };\n};\n\nexport default Feature;\n","import Feature from './feature.js';\n\nconst Point = function(ctx, geojson) {\n Feature.call(this, ctx, geojson);\n};\n\nPoint.prototype = Object.create(Feature.prototype);\n\nPoint.prototype.isValid = function() {\n return typeof this.coordinates[0] === 'number' &&\n typeof this.coordinates[1] === 'number';\n};\n\nPoint.prototype.updateCoordinate = function(pathOrLng, lngOrLat, lat) {\n if (arguments.length === 3) {\n this.coordinates = [lngOrLat, lat];\n } else {\n this.coordinates = [pathOrLng, lngOrLat];\n }\n this.changed();\n};\n\nPoint.prototype.getCoordinate = function() {\n return this.getCoordinates();\n};\n\nexport default Point;\n","import Feature from './feature.js';\n\nconst LineString = function(ctx, geojson) {\n Feature.call(this, ctx, geojson);\n};\n\nLineString.prototype = Object.create(Feature.prototype);\n\nLineString.prototype.isValid = function() {\n return this.coordinates.length > 1;\n};\n\nLineString.prototype.addCoordinate = function(path, lng, lat) {\n this.changed();\n const id = parseInt(path, 10);\n this.coordinates.splice(id, 0, [lng, lat]);\n};\n\nLineString.prototype.getCoordinate = function(path) {\n const id = parseInt(path, 10);\n return JSON.parse(JSON.stringify(this.coordinates[id]));\n};\n\nLineString.prototype.removeCoordinate = function(path) {\n this.changed();\n this.coordinates.splice(parseInt(path, 10), 1);\n};\n\nLineString.prototype.updateCoordinate = function(path, lng, lat) {\n const id = parseInt(path, 10);\n this.coordinates[id] = [lng, lat];\n this.changed();\n};\n\nexport default LineString;\n","import Feature from './feature.js';\n\nconst Polygon = function(ctx, geojson) {\n Feature.call(this, ctx, geojson);\n this.coordinates = this.coordinates.map(ring => ring.slice(0, -1));\n};\n\nPolygon.prototype = Object.create(Feature.prototype);\n\nPolygon.prototype.isValid = function() {\n if (this.coordinates.length === 0) return false;\n return this.coordinates.every(ring => ring.length > 2);\n};\n\n// Expects valid geoJSON polygon geometry: first and last positions must be equivalent.\nPolygon.prototype.incomingCoords = function(coords) {\n this.coordinates = coords.map(ring => ring.slice(0, -1));\n this.changed();\n};\n\n// Does NOT expect valid geoJSON polygon geometry: first and last positions should not be equivalent.\nPolygon.prototype.setCoordinates = function(coords) {\n this.coordinates = coords;\n this.changed();\n};\n\nPolygon.prototype.addCoordinate = function(path, lng, lat) {\n this.changed();\n const ids = path.split('.').map(x => parseInt(x, 10));\n\n const ring = this.coordinates[ids[0]];\n\n ring.splice(ids[1], 0, [lng, lat]);\n};\n\nPolygon.prototype.removeCoordinate = function(path) {\n this.changed();\n const ids = path.split('.').map(x => parseInt(x, 10));\n const ring = this.coordinates[ids[0]];\n if (ring) {\n ring.splice(ids[1], 1);\n if (ring.length < 3) {\n this.coordinates.splice(ids[0], 1);\n }\n }\n};\n\nPolygon.prototype.getCoordinate = function(path) {\n const ids = path.split('.').map(x => parseInt(x, 10));\n const ring = this.coordinates[ids[0]];\n return JSON.parse(JSON.stringify(ring[ids[1]]));\n};\n\nPolygon.prototype.getCoordinates = function() {\n return this.coordinates.map(coords => coords.concat([coords[0]]));\n};\n\nPolygon.prototype.updateCoordinate = function(path, lng, lat) {\n this.changed();\n const parts = path.split('.');\n const ringId = parseInt(parts[0], 10);\n const coordId = parseInt(parts[1], 10);\n\n if (this.coordinates[ringId] === undefined) {\n this.coordinates[ringId] = [];\n }\n\n this.coordinates[ringId][coordId] = [lng, lat];\n};\n\nexport default Polygon;\n","import {generateID} from '../lib/id.js';\nimport Feature from './feature.js';\nimport * as Constants from '../constants.js';\n\nimport MultiPoint from './point.js';\nimport MultiLineString from './line_string.js';\nimport MultiPolygon from './polygon.js';\n\nconst models = {\n MultiPoint,\n MultiLineString,\n MultiPolygon\n};\n\nconst takeAction = (features, action, path, lng, lat) => {\n const parts = path.split('.');\n const idx = parseInt(parts[0], 10);\n const tail = (!parts[1]) ? null : parts.slice(1).join('.');\n return features[idx][action](tail, lng, lat);\n};\n\nconst MultiFeature = function(ctx, geojson) {\n Feature.call(this, ctx, geojson);\n\n delete this.coordinates;\n this.model = models[geojson.geometry.type];\n if (this.model === undefined) throw new TypeError(`${geojson.geometry.type} is not a valid type`);\n this.features = this._coordinatesToFeatures(geojson.geometry.coordinates);\n};\n\nMultiFeature.prototype = Object.create(Feature.prototype);\n\nMultiFeature.prototype._coordinatesToFeatures = function(coordinates) {\n const Model = this.model.bind(this);\n return coordinates.map(coords => new Model(this.ctx, {\n id: generateID(),\n type: Constants.geojsonTypes.FEATURE,\n properties: {},\n geometry: {\n coordinates: coords,\n type: this.type.replace('Multi', '')\n }\n }));\n};\n\nMultiFeature.prototype.isValid = function() {\n return this.features.every(f => f.isValid());\n};\n\nMultiFeature.prototype.setCoordinates = function(coords) {\n this.features = this._coordinatesToFeatures(coords);\n this.changed();\n};\n\nMultiFeature.prototype.getCoordinate = function(path) {\n return takeAction(this.features, 'getCoordinate', path);\n};\n\nMultiFeature.prototype.getCoordinates = function() {\n return JSON.parse(JSON.stringify(this.features.map((f) => {\n if (f.type === Constants.geojsonTypes.POLYGON) return f.getCoordinates();\n return f.coordinates;\n })));\n};\n\nMultiFeature.prototype.updateCoordinate = function(path, lng, lat) {\n takeAction(this.features, 'updateCoordinate', path, lng, lat);\n this.changed();\n};\n\nMultiFeature.prototype.addCoordinate = function(path, lng, lat) {\n takeAction(this.features, 'addCoordinate', path, lng, lat);\n this.changed();\n};\n\nMultiFeature.prototype.removeCoordinate = function(path) {\n takeAction(this.features, 'removeCoordinate', path);\n this.changed();\n};\n\nMultiFeature.prototype.getFeatures = function() {\n return this.features;\n};\n\nexport default MultiFeature;\n","import * as Constants from '../constants.js';\nimport featuresAt from '../lib/features_at.js';\nimport Point from '../feature_types/point.js';\nimport LineString from '../feature_types/line_string.js';\nimport Polygon from '../feature_types/polygon.js';\nimport MultiFeature from '../feature_types/multi_feature.js';\n\nexport default function ModeInterface(ctx) {\n this.map = ctx.map;\n this.drawConfig = JSON.parse(JSON.stringify(ctx.options || {}));\n this._ctx = ctx;\n}\n\n/**\n * Sets Draw's interal selected state\n * @name this.setSelected\n * @param {DrawFeature[]} - whats selected as a [DrawFeature](https://github.com/mapbox/mapbox-gl-draw/blob/main/src/feature_types/feature.js)\n */\nModeInterface.prototype.setSelected = function(features) {\n return this._ctx.store.setSelected(features);\n};\n\n/**\n * Sets Draw's internal selected coordinate state\n * @name this.setSelectedCoordinates\n * @param {Object[]} coords - a array of {coord_path: 'string', feature_id: 'string'}\n */\nModeInterface.prototype.setSelectedCoordinates = function(coords) {\n this._ctx.store.setSelectedCoordinates(coords);\n coords.reduce((m, c) => {\n if (m[c.feature_id] === undefined) {\n m[c.feature_id] = true;\n this._ctx.store.get(c.feature_id).changed();\n }\n return m;\n }, {});\n};\n\n/**\n * Get all selected features as a [DrawFeature](https://github.com/mapbox/mapbox-gl-draw/blob/main/src/feature_types/feature.js)\n * @name this.getSelected\n * @returns {DrawFeature[]}\n */\nModeInterface.prototype.getSelected = function() {\n return this._ctx.store.getSelected();\n};\n\n/**\n * Get the ids of all currently selected features\n * @name this.getSelectedIds\n * @returns {String[]}\n */\nModeInterface.prototype.getSelectedIds = function() {\n return this._ctx.store.getSelectedIds();\n};\n\n/**\n * Check if a feature is selected\n * @name this.isSelected\n * @param {String} id - a feature id\n * @returns {Boolean}\n */\nModeInterface.prototype.isSelected = function(id) {\n return this._ctx.store.isSelected(id);\n};\n\n/**\n * Get a [DrawFeature](https://github.com/mapbox/mapbox-gl-draw/blob/main/src/feature_types/feature.js) by its id\n * @name this.getFeature\n * @param {String} id - a feature id\n * @returns {DrawFeature}\n */\nModeInterface.prototype.getFeature = function(id) {\n return this._ctx.store.get(id);\n};\n\n/**\n * Add a feature to draw's internal selected state\n * @name this.select\n * @param {String} id\n */\nModeInterface.prototype.select = function(id) {\n return this._ctx.store.select(id);\n};\n\n/**\n * Remove a feature from draw's internal selected state\n * @name this.delete\n * @param {String} id\n */\nModeInterface.prototype.deselect = function(id) {\n return this._ctx.store.deselect(id);\n};\n\n/**\n * Delete a feature from draw\n * @name this.deleteFeature\n * @param {String} id - a feature id\n */\nModeInterface.prototype.deleteFeature = function(id, opts = {}) {\n return this._ctx.store.delete(id, opts);\n};\n\n/**\n * Add a [DrawFeature](https://github.com/mapbox/mapbox-gl-draw/blob/main/src/feature_types/feature.js) to draw.\n * See `this.newFeature` for converting geojson into a DrawFeature\n * @name this.addFeature\n * @param {DrawFeature} feature - the feature to add\n */\nModeInterface.prototype.addFeature = function(feature, opts = {}) {\n return this._ctx.store.add(feature, opts);\n};\n\n/**\n * Clear all selected features\n */\nModeInterface.prototype.clearSelectedFeatures = function() {\n return this._ctx.store.clearSelected();\n};\n\n/**\n * Clear all selected coordinates\n */\nModeInterface.prototype.clearSelectedCoordinates = function() {\n return this._ctx.store.clearSelectedCoordinates();\n};\n\n/**\n * Indicate if the different action are currently possible with your mode\n * See [draw.actionalbe](https://github.com/mapbox/mapbox-gl-draw/blob/main/API.md#drawactionable) for a list of possible actions. All undefined actions are set to **false** by default\n * @name this.setActionableState\n * @param {Object} actions\n */\nModeInterface.prototype.setActionableState = function(actions = {}) {\n const newSet = {\n trash: actions.trash || false,\n combineFeatures: actions.combineFeatures || false,\n uncombineFeatures: actions.uncombineFeatures || false\n };\n return this._ctx.events.actionable(newSet);\n};\n\n/**\n * Trigger a mode change\n * @name this.changeMode\n * @param {String} mode - the mode to transition into\n * @param {Object} opts - the options object to pass to the new mode\n * @param {Object} eventOpts - used to control what kind of events are emitted.\n */\nModeInterface.prototype.changeMode = function(mode, opts = {}, eventOpts = {}) {\n return this._ctx.events.changeMode(mode, opts, eventOpts);\n};\n\n/**\n * Fire a map event\n * @name this.fire\n * @param {String} eventName - the event name.\n * @param {Object} eventData - the event data object.\n */\nModeInterface.prototype.fire = function(eventName, eventData) {\n return this._ctx.events.fire(eventName, eventData);\n};\n\n/**\n * Update the state of draw map classes\n * @name this.updateUIClasses\n * @param {Object} opts\n */\nModeInterface.prototype.updateUIClasses = function(opts) {\n return this._ctx.ui.queueMapClasses(opts);\n};\n\n/**\n * If a name is provided it makes that button active, else if makes all buttons inactive\n * @name this.activateUIButton\n * @param {String?} name - name of the button to make active, leave as undefined to set buttons to be inactive\n */\nModeInterface.prototype.activateUIButton = function(name) {\n return this._ctx.ui.setActiveButton(name);\n};\n\n/**\n * Get the features at the location of an event object or in a bbox\n * @name this.featuresAt\n * @param {Event||NULL} event - a mapbox-gl event object\n * @param {BBOX||NULL} bbox - the area to get features from\n * @param {String} bufferType - is this `click` or `tap` event, defaults to click\n */\nModeInterface.prototype.featuresAt = function(event, bbox, bufferType = 'click') {\n if (bufferType !== 'click' && bufferType !== 'touch') throw new Error('invalid buffer type');\n return featuresAt[bufferType](event, bbox, this._ctx);\n};\n\n/**\n * Create a new [DrawFeature](https://github.com/mapbox/mapbox-gl-draw/blob/main/src/feature_types/feature.js) from geojson\n * @name this.newFeature\n * @param {GeoJSONFeature} geojson\n * @returns {DrawFeature}\n */\nModeInterface.prototype.newFeature = function(geojson) {\n const type = geojson.geometry.type;\n if (type === Constants.geojsonTypes.POINT) return new Point(this._ctx, geojson);\n if (type === Constants.geojsonTypes.LINE_STRING) return new LineString(this._ctx, geojson);\n if (type === Constants.geojsonTypes.POLYGON) return new Polygon(this._ctx, geojson);\n return new MultiFeature(this._ctx, geojson);\n};\n\n/**\n * Check is an object is an instance of a [DrawFeature](https://github.com/mapbox/mapbox-gl-draw/blob/main/src/feature_types/feature.js)\n * @name this.isInstanceOf\n * @param {String} type - `Point`, `LineString`, `Polygon`, `MultiFeature`\n * @param {Object} feature - the object that needs to be checked\n * @returns {Boolean}\n */\nModeInterface.prototype.isInstanceOf = function(type, feature) {\n if (type === Constants.geojsonTypes.POINT) return feature instanceof Point;\n if (type === Constants.geojsonTypes.LINE_STRING) return feature instanceof LineString;\n if (type === Constants.geojsonTypes.POLYGON) return feature instanceof Polygon;\n if (type === 'MultiFeature') return feature instanceof MultiFeature;\n throw new Error(`Unknown feature class: ${type}`);\n};\n\n/**\n * Force draw to rerender the feature of the provided id\n * @name this.doRender\n * @param {String} id - a feature id\n */\nModeInterface.prototype.doRender = function(id) {\n return this._ctx.store.featureChanged(id);\n};\n\n","import ModeInterface from './mode_interface_accessors.js';\nexport default ModeInterface;\n\n/**\n * Triggered while a mode is being transitioned into.\n * @param opts {Object} - this is the object passed via `draw.changeMode('mode', opts)`;\n * @name MODE.onSetup\n * @returns {Object} - this object will be passed to all other life cycle functions\n */\nModeInterface.prototype.onSetup = function() {};\n\n/**\n * Triggered when a drag event is detected on the map\n * @name MODE.onDrag\n * @param state {Object} - a mutible state object created by onSetup\n * @param e {Object} - the captured event that is triggering this life cycle event\n */\nModeInterface.prototype.onDrag = function() {};\n\n/**\n * Triggered when the mouse is clicked\n * @name MODE.onClick\n * @param state {Object} - a mutible state object created by onSetup\n * @param e {Object} - the captured event that is triggering this life cycle event\n */\nModeInterface.prototype.onClick = function() {};\n\n/**\n * Triggered with the mouse is moved\n * @name MODE.onMouseMove\n * @param state {Object} - a mutible state object created by onSetup\n * @param e {Object} - the captured event that is triggering this life cycle event\n */\nModeInterface.prototype.onMouseMove = function() {};\n\n/**\n * Triggered when the mouse button is pressed down\n * @name MODE.onMouseDown\n * @param state {Object} - a mutible state object created by onSetup\n * @param e {Object} - the captured event that is triggering this life cycle event\n */\nModeInterface.prototype.onMouseDown = function() {};\n\n/**\n * Triggered when the mouse button is released\n * @name MODE.onMouseUp\n * @param state {Object} - a mutible state object created by onSetup\n * @param e {Object} - the captured event that is triggering this life cycle event\n */\nModeInterface.prototype.onMouseUp = function() {};\n\n/**\n * Triggered when the mouse leaves the map's container\n * @name MODE.onMouseOut\n * @param state {Object} - a mutible state object created by onSetup\n * @param e {Object} - the captured event that is triggering this life cycle event\n */\nModeInterface.prototype.onMouseOut = function() {};\n\n/**\n * Triggered when a key up event is detected\n * @name MODE.onKeyUp\n * @param state {Object} - a mutible state object created by onSetup\n * @param e {Object} - the captured event that is triggering this life cycle event\n */\nModeInterface.prototype.onKeyUp = function() {};\n\n/**\n * Triggered when a key down event is detected\n * @name MODE.onKeyDown\n * @param state {Object} - a mutible state object created by onSetup\n * @param e {Object} - the captured event that is triggering this life cycle event\n */\nModeInterface.prototype.onKeyDown = function() {};\n\n/**\n * Triggered when a touch event is started\n * @name MODE.onTouchStart\n * @param state {Object} - a mutible state object created by onSetup\n * @param e {Object} - the captured event that is triggering this life cycle event\n */\nModeInterface.prototype.onTouchStart = function() {};\n\n/**\n * Triggered when one drags thier finger on a mobile device\n * @name MODE.onTouchMove\n * @param state {Object} - a mutible state object created by onSetup\n * @param e {Object} - the captured event that is triggering this life cycle event\n */\nModeInterface.prototype.onTouchMove = function() {};\n\n/**\n * Triggered when one removes their finger from the map\n * @name MODE.onTouchEnd\n * @param state {Object} - a mutible state object created by onSetup\n * @param e {Object} - the captured event that is triggering this life cycle event\n */\nModeInterface.prototype.onTouchEnd = function() {};\n\n/**\n * Triggered when one quicly taps the map\n * @name MODE.onTap\n * @param state {Object} - a mutible state object created by onSetup\n * @param e {Object} - the captured event that is triggering this life cycle event\n */\nModeInterface.prototype.onTap = function() {};\n\n/**\n * Triggered when the mode is being exited, to be used for cleaning up artifacts such as invalid features\n * @name MODE.onStop\n * @param state {Object} - a mutible state object created by onSetup\n */\nModeInterface.prototype.onStop = function() {};\n\n/**\n * Triggered when [draw.trash()](https://github.com/mapbox/mapbox-gl-draw/blob/main/API.md#trash-draw) is called.\n * @name MODE.onTrash\n * @param state {Object} - a mutible state object created by onSetup\n */\nModeInterface.prototype.onTrash = function() {};\n\n/**\n * Triggered when [draw.combineFeatures()](https://github.com/mapbox/mapbox-gl-draw/blob/main/API.md#combinefeatures-draw) is called.\n * @name MODE.onCombineFeature\n * @param state {Object} - a mutible state object created by onSetup\n */\nModeInterface.prototype.onCombineFeature = function() {};\n\n/**\n * Triggered when [draw.uncombineFeatures()](https://github.com/mapbox/mapbox-gl-draw/blob/main/API.md#uncombinefeatures-draw) is called.\n * @name MODE.onUncombineFeature\n * @param state {Object} - a mutible state object created by onSetup\n */\nModeInterface.prototype.onUncombineFeature = function() {};\n\n/**\n * Triggered per feature on render to convert raw features into set of features for display on the map\n * See [styling draw](https://github.com/mapbox/mapbox-gl-draw/blob/main/API.md#styling-draw) for information about what geojson properties Draw uses as part of rendering.\n * @name MODE.toDisplayFeatures\n * @param state {Object} - a mutible state object created by onSetup\n * @param geojson {Object} - a geojson being evaulated. To render, pass to `display`.\n * @param display {Function} - all geojson objects passed to this be rendered onto the map\n */\nModeInterface.prototype.toDisplayFeatures = function() {\n throw new Error('You must overwrite toDisplayFeatures');\n};\n\n","import ModeInterface from './mode_interface.js';\n\nconst eventMapper = {\n drag: 'onDrag',\n click: 'onClick',\n mousemove: 'onMouseMove',\n mousedown: 'onMouseDown',\n mouseup: 'onMouseUp',\n mouseout: 'onMouseOut',\n keyup: 'onKeyUp',\n keydown: 'onKeyDown',\n touchstart: 'onTouchStart',\n touchmove: 'onTouchMove',\n touchend: 'onTouchEnd',\n tap: 'onTap'\n};\n\nconst eventKeys = Object.keys(eventMapper);\n\nexport default function(modeObject) {\n const modeObjectKeys = Object.keys(modeObject);\n\n return function(ctx, startOpts = {}) {\n let state = {};\n\n const mode = modeObjectKeys.reduce((m, k) => {\n m[k] = modeObject[k];\n return m;\n }, new ModeInterface(ctx));\n\n function wrapper(eh) {\n return e => mode[eh](state, e);\n }\n\n return {\n start() {\n state = mode.onSetup(startOpts); // this should set ui buttons\n\n // Adds event handlers for all event options\n // add sets the selector to false for all\n // handlers that are not present in the mode\n // to reduce on render calls for functions that\n // have no logic\n eventKeys.forEach((key) => {\n const modeHandler = eventMapper[key];\n let selector = () => false;\n if (modeObject[modeHandler]) {\n selector = () => true;\n }\n this.on(key, selector, wrapper(modeHandler));\n });\n\n },\n stop() {\n mode.onStop(state);\n },\n trash() {\n mode.onTrash(state);\n },\n combineFeatures() {\n mode.onCombineFeatures(state);\n },\n uncombineFeatures() {\n mode.onUncombineFeatures(state);\n },\n render(geojson, push) {\n mode.toDisplayFeatures(state, geojson, push);\n }\n };\n };\n}\n","import setupModeHandler from './lib/mode_handler.js';\nimport getFeaturesAndSetCursor from './lib/get_features_and_set_cursor.js';\nimport featuresAt from './lib/features_at.js';\nimport isClick from './lib/is_click.js';\nimport isTap from './lib/is_tap.js';\nimport * as Constants from './constants.js';\nimport objectToMode from './modes/object_to_mode.js';\n\nexport default function(ctx) {\n\n const modes = Object.keys(ctx.options.modes).reduce((m, k) => {\n m[k] = objectToMode(ctx.options.modes[k]);\n return m;\n }, {});\n\n let mouseDownInfo = {};\n let touchStartInfo = {};\n const events = {};\n let currentModeName = null;\n let currentMode = null;\n\n events.drag = function(event, isDrag) {\n if (isDrag({\n point: event.point,\n time: new Date().getTime()\n })) {\n ctx.ui.queueMapClasses({ mouse: Constants.cursors.DRAG });\n currentMode.drag(event);\n } else {\n event.originalEvent.stopPropagation();\n }\n };\n\n events.mousedrag = function(event) {\n events.drag(event, endInfo => !isClick(mouseDownInfo, endInfo));\n };\n\n events.touchdrag = function(event) {\n events.drag(event, endInfo => !isTap(touchStartInfo, endInfo));\n };\n\n events.mousemove = function(event) {\n const button = event.originalEvent.buttons !== undefined ? event.originalEvent.buttons : event.originalEvent.which;\n if (button === 1) {\n return events.mousedrag(event);\n }\n const target = getFeaturesAndSetCursor(event, ctx);\n event.featureTarget = target;\n currentMode.mousemove(event);\n };\n\n events.mousedown = function(event) {\n mouseDownInfo = {\n time: new Date().getTime(),\n point: event.point\n };\n const target = getFeaturesAndSetCursor(event, ctx);\n event.featureTarget = target;\n currentMode.mousedown(event);\n };\n\n events.mouseup = function(event) {\n const target = getFeaturesAndSetCursor(event, ctx);\n event.featureTarget = target;\n\n if (isClick(mouseDownInfo, {\n point: event.point,\n time: new Date().getTime()\n })) {\n currentMode.click(event);\n } else {\n currentMode.mouseup(event);\n }\n };\n\n events.mouseout = function(event) {\n currentMode.mouseout(event);\n };\n\n events.touchstart = function(event) {\n if (!ctx.options.touchEnabled) {\n return;\n }\n\n touchStartInfo = {\n time: new Date().getTime(),\n point: event.point\n };\n const target = featuresAt.touch(event, null, ctx)[0];\n event.featureTarget = target;\n currentMode.touchstart(event);\n };\n\n events.touchmove = function(event) {\n if (!ctx.options.touchEnabled) {\n return;\n }\n\n currentMode.touchmove(event);\n return events.touchdrag(event);\n };\n\n events.touchend = function(event) {\n // Prevent emulated mouse events because we will fully handle the touch here.\n // This does not stop the touch events from propogating to mapbox though.\n event.originalEvent.preventDefault();\n if (!ctx.options.touchEnabled) {\n return;\n }\n\n const target = featuresAt.touch(event, null, ctx)[0];\n event.featureTarget = target;\n if (isTap(touchStartInfo, {\n time: new Date().getTime(),\n point: event.point\n })) {\n currentMode.tap(event);\n } else {\n currentMode.touchend(event);\n }\n };\n\n // 8 - Backspace\n // 46 - Delete\n const isKeyModeValid = code => !(code === 8 || code === 46 || (code >= 48 && code <= 57));\n\n events.keydown = function(event) {\n const isMapElement = (event.srcElement || event.target).classList.contains(Constants.classes.CANVAS);\n if (!isMapElement) return; // we only handle events on the map\n\n if ((event.keyCode === 8 || event.keyCode === 46) && ctx.options.controls.trash) {\n event.preventDefault();\n currentMode.trash();\n } else if (isKeyModeValid(event.keyCode)) {\n currentMode.keydown(event);\n } else if (event.keyCode === 49 && ctx.options.controls.point) {\n changeMode(Constants.modes.DRAW_POINT);\n } else if (event.keyCode === 50 && ctx.options.controls.line_string) {\n changeMode(Constants.modes.DRAW_LINE_STRING);\n } else if (event.keyCode === 51 && ctx.options.controls.polygon) {\n changeMode(Constants.modes.DRAW_POLYGON);\n }\n };\n\n events.keyup = function(event) {\n if (isKeyModeValid(event.keyCode)) {\n currentMode.keyup(event);\n }\n };\n\n events.zoomend = function() {\n ctx.store.changeZoom();\n };\n\n events.data = function(event) {\n if (event.dataType === 'style') {\n const { setup, map, options, store } = ctx;\n const hasLayers = options.styles.some(style => map.getLayer(style.id));\n if (!hasLayers) {\n setup.addLayers();\n store.setDirty();\n store.render();\n }\n }\n };\n\n function changeMode(modename, nextModeOptions, eventOptions = {}) {\n currentMode.stop();\n\n const modebuilder = modes[modename];\n if (modebuilder === undefined) {\n throw new Error(`${modename} is not valid`);\n }\n currentModeName = modename;\n const mode = modebuilder(ctx, nextModeOptions);\n currentMode = setupModeHandler(mode, ctx);\n\n if (!eventOptions.silent) {\n ctx.map.fire(Constants.events.MODE_CHANGE, { mode: modename});\n }\n\n ctx.store.setDirty();\n ctx.store.render();\n }\n\n const actionState = {\n trash: false,\n combineFeatures: false,\n uncombineFeatures: false\n };\n\n function actionable(actions) {\n let changed = false;\n Object.keys(actions).forEach((action) => {\n if (actionState[action] === undefined) throw new Error('Invalid action type');\n if (actionState[action] !== actions[action]) changed = true;\n actionState[action] = actions[action];\n });\n if (changed) ctx.map.fire(Constants.events.ACTIONABLE, { actions: actionState });\n }\n\n const api = {\n start() {\n currentModeName = ctx.options.defaultMode;\n currentMode = setupModeHandler(modes[currentModeName](ctx), ctx);\n },\n changeMode,\n actionable,\n currentModeName() {\n return currentModeName;\n },\n currentModeRender(geojson, push) {\n return currentMode.render(geojson, push);\n },\n fire(eventName, eventData) {\n if (!ctx.map) return;\n ctx.map.fire(eventName, eventData);\n },\n addEventListeners() {\n ctx.map.on('mousemove', events.mousemove);\n ctx.map.on('mousedown', events.mousedown);\n ctx.map.on('mouseup', events.mouseup);\n ctx.map.on('data', events.data);\n\n ctx.map.on('touchmove', events.touchmove);\n ctx.map.on('touchstart', events.touchstart);\n ctx.map.on('touchend', events.touchend);\n\n ctx.container.addEventListener('mouseout', events.mouseout);\n\n if (ctx.options.keybindings) {\n ctx.container.addEventListener('keydown', events.keydown);\n ctx.container.addEventListener('keyup', events.keyup);\n }\n },\n removeEventListeners() {\n ctx.map.off('mousemove', events.mousemove);\n ctx.map.off('mousedown', events.mousedown);\n ctx.map.off('mouseup', events.mouseup);\n ctx.map.off('data', events.data);\n\n ctx.map.off('touchmove', events.touchmove);\n ctx.map.off('touchstart', events.touchstart);\n ctx.map.off('touchend', events.touchend);\n\n ctx.container.removeEventListener('mouseout', events.mouseout);\n\n if (ctx.options.keybindings) {\n ctx.container.removeEventListener('keydown', events.keydown);\n ctx.container.removeEventListener('keyup', events.keyup);\n }\n },\n trash(options) {\n currentMode.trash(options);\n },\n combineFeatures() {\n currentMode.combineFeatures();\n },\n uncombineFeatures() {\n currentMode.uncombineFeatures();\n },\n getMode() {\n return currentModeName;\n }\n };\n\n return api;\n}\n","/**\n * Derive a dense array (no `undefined`s) from a single value or array.\n *\n * @param {any} x\n * @return {Array}\n */\nfunction toDenseArray(x) {\n return [].concat(x).filter(y => y !== undefined);\n}\n\nexport default toDenseArray;\n","import * as Constants from './constants.js';\n\nexport default function render() {\n // eslint-disable-next-line no-invalid-this\n const store = this;\n const mapExists = store.ctx.map && store.ctx.map.getSource(Constants.sources.HOT) !== undefined;\n if (!mapExists) return cleanup();\n\n const mode = store.ctx.events.currentModeName();\n\n store.ctx.ui.queueMapClasses({ mode });\n\n let newHotIds = [];\n let newColdIds = [];\n\n if (store.isDirty) {\n newColdIds = store.getAllIds();\n } else {\n newHotIds = store.getChangedIds().filter(id => store.get(id) !== undefined);\n newColdIds = store.sources.hot.filter(geojson => geojson.properties.id && newHotIds.indexOf(geojson.properties.id) === -1 && store.get(geojson.properties.id) !== undefined).map(geojson => geojson.properties.id);\n }\n\n store.sources.hot = [];\n const lastColdCount = store.sources.cold.length;\n store.sources.cold = store.isDirty ? [] : store.sources.cold.filter((geojson) => {\n const id = geojson.properties.id || geojson.properties.parent;\n return newHotIds.indexOf(id) === -1;\n });\n\n const coldChanged = lastColdCount !== store.sources.cold.length || newColdIds.length > 0;\n newHotIds.forEach(id => renderFeature(id, 'hot'));\n newColdIds.forEach(id => renderFeature(id, 'cold'));\n\n function renderFeature(id, source) {\n const feature = store.get(id);\n const featureInternal = feature.internal(mode);\n store.ctx.events.currentModeRender(featureInternal, (geojson) => {\n geojson.properties.mode = mode;\n store.sources[source].push(geojson);\n });\n }\n\n if (coldChanged) {\n store.ctx.map.getSource(Constants.sources.COLD).setData({\n type: Constants.geojsonTypes.FEATURE_COLLECTION,\n features: store.sources.cold\n });\n }\n\n store.ctx.map.getSource(Constants.sources.HOT).setData({\n type: Constants.geojsonTypes.FEATURE_COLLECTION,\n features: store.sources.hot\n });\n\n cleanup();\n\n function cleanup() {\n store.isDirty = false;\n store.clearChangedIds();\n }\n}\n","import toDenseArray from './lib/to_dense_array.js';\nimport StringSet from './lib/string_set.js';\nimport render from './render.js';\nimport * as Constants from './constants.js';\n\nexport default function Store(ctx) {\n this._features = {};\n this._featureIds = new StringSet();\n this._selectedFeatureIds = new StringSet();\n this._selectedCoordinates = [];\n this._changedFeatureIds = new StringSet();\n this._emitSelectionChange = false;\n this._mapInitialConfig = {};\n this.ctx = ctx;\n this.sources = {\n hot: [],\n cold: []\n };\n\n // Deduplicate requests to render and tie them to animation frames.\n let renderRequest;\n this.render = () => {\n if (!renderRequest) {\n renderRequest = requestAnimationFrame(() => {\n renderRequest = null;\n render.call(this);\n\n // Fire deduplicated selection change event\n if (this._emitSelectionChange) {\n this.ctx.events.fire(Constants.events.SELECTION_CHANGE, {\n features: this.getSelected().map(feature => feature.toGeoJSON()),\n points: this.getSelectedCoordinates().map(coordinate => ({\n type: Constants.geojsonTypes.FEATURE,\n properties: {},\n geometry: {\n type: Constants.geojsonTypes.POINT,\n coordinates: coordinate.coordinates\n }\n }))\n });\n\n this._emitSelectionChange = false;\n }\n\n // Fire render event\n this.ctx.events.fire(Constants.events.RENDER, {});\n });\n }\n };\n\n this.isDirty = false;\n}\n\n/**\n * Delays all rendering until the returned function is invoked\n * @return {Function} renderBatch\n */\nStore.prototype.createRenderBatch = function() {\n const holdRender = this.render;\n let numRenders = 0;\n this.render = function() {\n numRenders++;\n };\n\n return () => {\n this.render = holdRender;\n if (numRenders > 0) {\n this.render();\n }\n };\n};\n\n/**\n * Sets the store's state to dirty.\n * @return {Store} this\n */\nStore.prototype.setDirty = function() {\n this.isDirty = true;\n return this;\n};\n\n/**\n * Sets a feature's state to changed.\n * @param {string} featureId\n * @return {Store} this\n */\nStore.prototype.featureCreated = function(featureId, options = {}) {\n this._changedFeatureIds.add(featureId);\n\n const silent = options.silent != null ? options.silent : this.ctx.options.suppressAPIEvents;\n if (silent !== true) {\n const feature = this.get(featureId);\n this.ctx.events.fire(Constants.events.CREATE, {\n features: [feature.toGeoJSON()]\n });\n }\n\n return this;\n};\n\n/**\n * Sets a feature's state to changed.\n * @param {string} featureId\n * @return {Store} this\n */\nStore.prototype.featureChanged = function(featureId, options = {}) {\n this._changedFeatureIds.add(featureId);\n\n const silent = options.silent != null ? options.silent : this.ctx.options.suppressAPIEvents;\n if (silent !== true) {\n this.ctx.events.fire(Constants.events.UPDATE, {\n action: options.action ? options.action : Constants.updateActions.CHANGE_COORDINATES,\n features: [this.get(featureId).toGeoJSON()]\n });\n }\n\n return this;\n};\n\n/**\n * Gets the ids of all features currently in changed state.\n * @return {Store} this\n */\nStore.prototype.getChangedIds = function() {\n return this._changedFeatureIds.values();\n};\n\n/**\n * Sets all features to unchanged state.\n * @return {Store} this\n */\nStore.prototype.clearChangedIds = function() {\n this._changedFeatureIds.clear();\n return this;\n};\n\n/**\n * Gets the ids of all features in the store.\n * @return {Store} this\n */\nStore.prototype.getAllIds = function() {\n return this._featureIds.values();\n};\n\n/**\n * Adds a feature to the store.\n * @param {Object} feature\n * @param {Object} [options]\n * @param {Object} [options.silent] - If `true`, this invocation will not fire an event.\n *\n * @return {Store} this\n */\nStore.prototype.add = function(feature, options = {}) {\n this._features[feature.id] = feature;\n this._featureIds.add(feature.id);\n this.featureCreated(feature.id, {silent: options.silent});\n return this;\n};\n\n/**\n * Deletes a feature or array of features from the store.\n * Cleans up after the deletion by deselecting the features.\n * If changes were made, sets the state to the dirty\n * and fires an event.\n * @param {string | Array} featureIds\n * @param {Object} [options]\n * @param {Object} [options.silent] - If `true`, this invocation will not fire an event.\n * @return {Store} this\n */\nStore.prototype.delete = function(featureIds, options = {}) {\n const deletedFeaturesToEmit = [];\n toDenseArray(featureIds).forEach((id) => {\n if (!this._featureIds.has(id)) return;\n this._featureIds.delete(id);\n this._selectedFeatureIds.delete(id);\n if (!options.silent) {\n if (deletedFeaturesToEmit.indexOf(this._features[id]) === -1) {\n deletedFeaturesToEmit.push(this._features[id].toGeoJSON());\n }\n }\n delete this._features[id];\n this.isDirty = true;\n });\n\n if (deletedFeaturesToEmit.length) {\n this.ctx.events.fire(Constants.events.DELETE, {features: deletedFeaturesToEmit});\n }\n\n refreshSelectedCoordinates(this, options);\n return this;\n};\n\n/**\n * Returns a feature in the store matching the specified value.\n * @return {Object | undefined} feature\n */\nStore.prototype.get = function(id) {\n return this._features[id];\n};\n\n/**\n * Returns all features in the store.\n * @return {Array}\n */\nStore.prototype.getAll = function() {\n return Object.keys(this._features).map(id => this._features[id]);\n};\n\n/**\n * Adds features to the current selection.\n * @param {string | Array} featureIds\n * @param {Object} [options]\n * @param {Object} [options.silent] - If `true`, this invocation will not fire an event.\n * @return {Store} this\n */\nStore.prototype.select = function(featureIds, options = {}) {\n toDenseArray(featureIds).forEach((id) => {\n if (this._selectedFeatureIds.has(id)) return;\n this._selectedFeatureIds.add(id);\n this._changedFeatureIds.add(id);\n if (!options.silent) {\n this._emitSelectionChange = true;\n }\n });\n return this;\n};\n\n/**\n * Deletes features from the current selection.\n * @param {string | Array} featureIds\n * @param {Object} [options]\n * @param {Object} [options.silent] - If `true`, this invocation will not fire an event.\n * @return {Store} this\n */\nStore.prototype.deselect = function(featureIds, options = {}) {\n toDenseArray(featureIds).forEach((id) => {\n if (!this._selectedFeatureIds.has(id)) return;\n this._selectedFeatureIds.delete(id);\n this._changedFeatureIds.add(id);\n if (!options.silent) {\n this._emitSelectionChange = true;\n }\n });\n refreshSelectedCoordinates(this, options);\n return this;\n};\n\n/**\n * Clears the current selection.\n * @param {Object} [options]\n * @param {Object} [options.silent] - If `true`, this invocation will not fire an event.\n * @return {Store} this\n */\nStore.prototype.clearSelected = function(options = {}) {\n this.deselect(this._selectedFeatureIds.values(), { silent: options.silent });\n return this;\n};\n\n/**\n * Sets the store's selection, clearing any prior values.\n * If no feature ids are passed, the store is just cleared.\n * @param {string | Array | undefined} featureIds\n * @param {Object} [options]\n * @param {Object} [options.silent] - If `true`, this invocation will not fire an event.\n * @return {Store} this\n */\nStore.prototype.setSelected = function(featureIds, options = {}) {\n featureIds = toDenseArray(featureIds);\n\n // Deselect any features not in the new selection\n this.deselect(this._selectedFeatureIds.values().filter(id => featureIds.indexOf(id) === -1), { silent: options.silent });\n\n // Select any features in the new selection that were not already selected\n this.select(featureIds.filter(id => !this._selectedFeatureIds.has(id)), { silent: options.silent });\n\n return this;\n};\n\n/**\n * Sets the store's coordinates selection, clearing any prior values.\n * @param {Array>} coordinates\n * @return {Store} this\n */\nStore.prototype.setSelectedCoordinates = function(coordinates) {\n this._selectedCoordinates = coordinates;\n this._emitSelectionChange = true;\n return this;\n};\n\n/**\n * Clears the current coordinates selection.\n * @param {Object} [options]\n * @return {Store} this\n */\nStore.prototype.clearSelectedCoordinates = function() {\n this._selectedCoordinates = [];\n this._emitSelectionChange = true;\n return this;\n};\n\n/**\n * Returns the ids of features in the current selection.\n * @return {Array} Selected feature ids.\n */\nStore.prototype.getSelectedIds = function() {\n return this._selectedFeatureIds.values();\n};\n\n/**\n * Returns features in the current selection.\n * @return {Array} Selected features.\n */\nStore.prototype.getSelected = function() {\n return this.getSelectedIds().map(id => this.get(id));\n};\n\n/**\n * Returns selected coordinates in the currently selected feature.\n * @return {Array} Selected coordinates.\n */\nStore.prototype.getSelectedCoordinates = function() {\n const selected = this._selectedCoordinates.map((coordinate) => {\n const feature = this.get(coordinate.feature_id);\n return {\n coordinates: feature.getCoordinate(coordinate.coord_path)\n };\n });\n return selected;\n};\n\n/**\n * Indicates whether a feature is selected.\n * @param {string} featureId\n * @return {boolean} `true` if the feature is selected, `false` if not.\n */\nStore.prototype.isSelected = function(featureId) {\n return this._selectedFeatureIds.has(featureId);\n};\n\n/**\n * Sets a property on the given feature\n * @param {string} featureId\n * @param {string} property property\n * @param {string} property value\n * @param {Object} [options]\n * @param {Object} [options.silent] - If `true`, this invocation will not fire an event.\n*/\nStore.prototype.setFeatureProperty = function(featureId, property, value, options = {}) {\n this.get(featureId).setProperty(property, value);\n\n this.featureChanged(featureId, {\n silent: options.silent,\n action: Constants.updateActions.CHANGE_PROPERTIES\n });\n};\n\nfunction refreshSelectedCoordinates(store, options = {}) {\n const newSelectedCoordinates = store._selectedCoordinates.filter(point => store._selectedFeatureIds.has(point.feature_id));\n if (store._selectedCoordinates.length !== newSelectedCoordinates.length && !options.silent) {\n store._emitSelectionChange = true;\n }\n store._selectedCoordinates = newSelectedCoordinates;\n}\n\n/**\n * Stores the initial config for a map, so that we can set it again after we're done.\n*/\nStore.prototype.storeMapConfig = function() {\n Constants.interactions.forEach((interaction) => {\n const interactionSet = this.ctx.map[interaction];\n if (interactionSet) {\n this._mapInitialConfig[interaction] = this.ctx.map[interaction].isEnabled();\n }\n });\n};\n\n/**\n * Restores the initial config for a map, ensuring all is well.\n*/\nStore.prototype.restoreMapConfig = function() {\n Object.keys(this._mapInitialConfig).forEach((key) => {\n const value = this._mapInitialConfig[key];\n if (value) {\n this.ctx.map[key].enable();\n } else {\n this.ctx.map[key].disable();\n }\n });\n};\n\n/**\n * Returns the initial state of an interaction setting.\n * @param {string} interaction\n * @return {boolean} `true` if the interaction is enabled, `false` if not.\n * Defaults to `true`. (Todo: include defaults.)\n*/\nStore.prototype.getInitialConfigValue = function(interaction) {\n if (this._mapInitialConfig[interaction] !== undefined) {\n return this._mapInitialConfig[interaction];\n } else {\n // This needs to be set to whatever the default is for that interaction\n // It seems to be true for all cases currently, so let's send back `true`.\n return true;\n }\n};\n","import * as Constants from './constants.js';\n\nconst classTypes = ['mode', 'feature', 'mouse'];\n\nexport default function(ctx) {\n\n\n const buttonElements = {};\n let activeButton = null;\n\n let currentMapClasses = {\n mode: null, // e.g. mode-direct_select\n feature: null, // e.g. feature-vertex\n mouse: null // e.g. mouse-move\n };\n\n let nextMapClasses = {\n mode: null,\n feature: null,\n mouse: null\n };\n\n function clearMapClasses() {\n queueMapClasses({mode:null, feature:null, mouse:null});\n updateMapClasses();\n }\n\n function queueMapClasses(options) {\n nextMapClasses = Object.assign(nextMapClasses, options);\n }\n\n function updateMapClasses() {\n if (!ctx.container) return;\n\n const classesToRemove = [];\n const classesToAdd = [];\n\n classTypes.forEach((type) => {\n if (nextMapClasses[type] === currentMapClasses[type]) return;\n\n classesToRemove.push(`${type}-${currentMapClasses[type]}`);\n if (nextMapClasses[type] !== null) {\n classesToAdd.push(`${type}-${nextMapClasses[type]}`);\n }\n });\n\n if (classesToRemove.length > 0) {\n ctx.container.classList.remove(...classesToRemove);\n }\n\n if (classesToAdd.length > 0) {\n ctx.container.classList.add(...classesToAdd);\n }\n\n currentMapClasses = Object.assign(currentMapClasses, nextMapClasses);\n }\n\n function createControlButton(id, options = {}) {\n const button = document.createElement('button');\n button.className = `${Constants.classes.CONTROL_BUTTON} ${options.className}`;\n button.setAttribute('title', options.title);\n options.container.appendChild(button);\n\n button.addEventListener('click', (e) => {\n e.preventDefault();\n e.stopPropagation();\n\n const clickedButton = e.target;\n if (clickedButton === activeButton) {\n deactivateButtons();\n options.onDeactivate();\n return;\n }\n\n setActiveButton(id);\n options.onActivate();\n }, true);\n\n return button;\n }\n\n function deactivateButtons() {\n if (!activeButton) return;\n activeButton.classList.remove(Constants.classes.ACTIVE_BUTTON);\n activeButton = null;\n }\n\n function setActiveButton(id) {\n deactivateButtons();\n\n const button = buttonElements[id];\n if (!button) return;\n\n if (button && id !== 'trash') {\n button.classList.add(Constants.classes.ACTIVE_BUTTON);\n activeButton = button;\n }\n }\n\n function addButtons() {\n const controls = ctx.options.controls;\n const controlGroup = document.createElement('div');\n controlGroup.className = `${Constants.classes.CONTROL_GROUP} ${Constants.classes.CONTROL_BASE}`;\n\n if (!controls) return controlGroup;\n\n if (controls[Constants.types.LINE]) {\n buttonElements[Constants.types.LINE] = createControlButton(Constants.types.LINE, {\n container: controlGroup,\n className: Constants.classes.CONTROL_BUTTON_LINE,\n title: `LineString tool ${ctx.options.keybindings ? '(l)' : ''}`,\n onActivate: () => ctx.events.changeMode(Constants.modes.DRAW_LINE_STRING),\n onDeactivate: () => ctx.events.trash()\n });\n }\n\n if (controls[Constants.types.POLYGON]) {\n buttonElements[Constants.types.POLYGON] = createControlButton(Constants.types.POLYGON, {\n container: controlGroup,\n className: Constants.classes.CONTROL_BUTTON_POLYGON,\n title: `Polygon tool ${ctx.options.keybindings ? '(p)' : ''}`,\n onActivate: () => ctx.events.changeMode(Constants.modes.DRAW_POLYGON),\n onDeactivate: () => ctx.events.trash()\n });\n }\n\n if (controls[Constants.types.POINT]) {\n buttonElements[Constants.types.POINT] = createControlButton(Constants.types.POINT, {\n container: controlGroup,\n className: Constants.classes.CONTROL_BUTTON_POINT,\n title: `Marker tool ${ctx.options.keybindings ? '(m)' : ''}`,\n onActivate: () => ctx.events.changeMode(Constants.modes.DRAW_POINT),\n onDeactivate: () => ctx.events.trash()\n });\n }\n\n if (controls.trash) {\n buttonElements.trash = createControlButton('trash', {\n container: controlGroup,\n className: Constants.classes.CONTROL_BUTTON_TRASH,\n title: 'Delete',\n onActivate: () => {\n ctx.events.trash();\n }\n });\n }\n\n if (controls.combine_features) {\n buttonElements.combine_features = createControlButton('combineFeatures', {\n container: controlGroup,\n className: Constants.classes.CONTROL_BUTTON_COMBINE_FEATURES,\n title: 'Combine',\n onActivate: () => {\n ctx.events.combineFeatures();\n }\n });\n }\n\n if (controls.uncombine_features) {\n buttonElements.uncombine_features = createControlButton('uncombineFeatures', {\n container: controlGroup,\n className: Constants.classes.CONTROL_BUTTON_UNCOMBINE_FEATURES,\n title: 'Uncombine',\n onActivate: () => {\n ctx.events.uncombineFeatures();\n }\n });\n }\n\n return controlGroup;\n }\n\n function removeButtons() {\n Object.keys(buttonElements).forEach((buttonId) => {\n const button = buttonElements[buttonId];\n if (button.parentNode) {\n button.parentNode.removeChild(button);\n }\n delete buttonElements[buttonId];\n });\n }\n\n return {\n setActiveButton,\n queueMapClasses,\n updateMapClasses,\n clearMapClasses,\n addButtons,\n removeButtons\n };\n}\n","import events from './events.js';\nimport Store from './store.js';\nimport ui from './ui.js';\nimport * as Constants from './constants.js';\n\nexport default function(ctx) {\n\n let controlContainer = null;\n let mapLoadedInterval = null;\n\n const setup = {\n onRemove() {\n // Stop connect attempt in the event that control is removed before map is loaded\n ctx.map.off('load', setup.connect);\n clearInterval(mapLoadedInterval);\n\n setup.removeLayers();\n ctx.store.restoreMapConfig();\n ctx.ui.removeButtons();\n ctx.events.removeEventListeners();\n ctx.ui.clearMapClasses();\n if (ctx.boxZoomInitial) ctx.map.boxZoom.enable();\n ctx.map = null;\n ctx.container = null;\n ctx.store = null;\n\n if (controlContainer && controlContainer.parentNode) controlContainer.parentNode.removeChild(controlContainer);\n controlContainer = null;\n\n return this;\n },\n connect() {\n ctx.map.off('load', setup.connect);\n clearInterval(mapLoadedInterval);\n setup.addLayers();\n ctx.store.storeMapConfig();\n ctx.events.addEventListeners();\n },\n onAdd(map) {\n ctx.map = map;\n ctx.events = events(ctx);\n ctx.ui = ui(ctx);\n ctx.container = map.getContainer();\n ctx.store = new Store(ctx);\n\n\n controlContainer = ctx.ui.addButtons();\n\n if (ctx.options.boxSelect) {\n ctx.boxZoomInitial = map.boxZoom.isEnabled();\n map.boxZoom.disable();\n const dragPanIsEnabled = map.dragPan.isEnabled();\n // Need to toggle dragPan on and off or else first\n // dragPan disable attempt in simple_select doesn't work\n map.dragPan.disable();\n map.dragPan.enable();\n if (!dragPanIsEnabled) {\n map.dragPan.disable();\n }\n }\n\n if (map.loaded()) {\n setup.connect();\n } else {\n map.on('load', setup.connect);\n mapLoadedInterval = setInterval(() => { if (map.loaded()) setup.connect(); }, 16);\n }\n\n ctx.events.start();\n return controlContainer;\n },\n addLayers() {\n // drawn features style\n ctx.map.addSource(Constants.sources.COLD, {\n data: {\n type: Constants.geojsonTypes.FEATURE_COLLECTION,\n features: []\n },\n type: 'geojson'\n });\n\n // hot features style\n ctx.map.addSource(Constants.sources.HOT, {\n data: {\n type: Constants.geojsonTypes.FEATURE_COLLECTION,\n features: []\n },\n type: 'geojson'\n });\n\n ctx.options.styles.forEach((style) => {\n ctx.map.addLayer(style);\n });\n\n ctx.store.setDirty(true);\n ctx.store.render();\n },\n // Check for layers and sources before attempting to remove\n // If user adds draw control and removes it before the map is loaded, layers and sources will be missing\n removeLayers() {\n ctx.options.styles.forEach((style) => {\n if (ctx.map.getLayer(style.id)) {\n ctx.map.removeLayer(style.id);\n }\n });\n\n if (ctx.map.getSource(Constants.sources.COLD)) {\n ctx.map.removeSource(Constants.sources.COLD);\n }\n\n if (ctx.map.getSource(Constants.sources.HOT)) {\n ctx.map.removeSource(Constants.sources.HOT);\n }\n }\n };\n\n ctx.setup = setup;\n\n return setup;\n}\n","/* eslint comma-dangle: [\"error\", \"always-multiline\"] */\n\nconst blue = '#3bb2d0';\nconst orange = '#fbb03b';\nconst white = '#fff';\n\nexport default [\n // Polygons\n // Solid fill\n // Active state defines color\n {\n 'id': 'gl-draw-polygon-fill',\n 'type': 'fill',\n 'filter': [\n 'all',\n ['==', '$type', 'Polygon'],\n ],\n 'paint': {\n 'fill-color': [\n 'case',\n ['==', ['get', 'active'], 'true'], orange,\n blue,\n ],\n 'fill-opacity': 0.1,\n },\n },\n // Lines\n // Polygon\n // Matches Lines AND Polygons\n // Active state defines color\n {\n 'id': 'gl-draw-lines',\n 'type': 'line',\n 'filter': [\n 'any',\n ['==', '$type', 'LineString'],\n ['==', '$type', 'Polygon'],\n ],\n 'layout': {\n 'line-cap': 'round',\n 'line-join': 'round',\n },\n 'paint': {\n 'line-color': [\n 'case',\n ['==', ['get', 'active'], 'true'], orange,\n blue,\n ],\n 'line-dasharray': [\n 'case',\n ['==', ['get', 'active'], 'true'], [0.2, 2],\n [2, 0],\n ],\n 'line-width': 2,\n },\n },\n // Points\n // Circle with an outline\n // Active state defines size and color\n {\n 'id': 'gl-draw-point-outer',\n 'type': 'circle',\n 'filter': [\n 'all',\n ['==', '$type', 'Point'],\n ['==', 'meta', 'feature'],\n ],\n 'paint': {\n 'circle-radius': [\n 'case',\n ['==', ['get', 'active'], 'true'], 7,\n 5,\n ],\n 'circle-color': white,\n },\n },\n {\n 'id': 'gl-draw-point-inner',\n 'type': 'circle',\n 'filter': [\n 'all',\n ['==', '$type', 'Point'],\n ['==', 'meta', 'feature'],\n ],\n 'paint': {\n 'circle-radius': [\n 'case',\n ['==', ['get', 'active'], 'true'], 5,\n 3,\n ],\n 'circle-color': [\n 'case',\n ['==', ['get', 'active'], 'true'], orange,\n blue,\n ],\n },\n },\n // Vertex\n // Visible when editing polygons and lines\n // Similar behaviour to Points\n // Active state defines size\n {\n 'id': 'gl-draw-vertex-outer',\n 'type': 'circle',\n 'filter': [\n 'all',\n ['==', '$type', 'Point'],\n ['==', 'meta', 'vertex'],\n ['!=', 'mode', 'simple_select'],\n ],\n 'paint': {\n 'circle-radius': [\n 'case',\n ['==', ['get', 'active'], 'true'], 7,\n 5,\n ],\n 'circle-color': white,\n },\n },\n {\n 'id': 'gl-draw-vertex-inner',\n 'type': 'circle',\n 'filter': [\n 'all',\n ['==', '$type', 'Point'],\n ['==', 'meta', 'vertex'],\n ['!=', 'mode', 'simple_select'],\n ],\n 'paint': {\n 'circle-radius': [\n 'case',\n ['==', ['get', 'active'], 'true'], 5,\n 3,\n ],\n 'circle-color': orange,\n },\n },\n // Midpoint\n // Visible when editing polygons and lines\n // Tapping or dragging them adds a new vertex to the feature\n {\n 'id': 'gl-draw-midpoint',\n 'type': 'circle',\n 'filter': [\n 'all',\n ['==', 'meta', 'midpoint'],\n ],\n 'paint': {\n 'circle-radius': 3,\n 'circle-color': orange,\n },\n },\n];\n","import * as Constants from '../constants.js';\n\nexport function isOfMetaType(type) {\n return function(e) {\n const featureTarget = e.featureTarget;\n if (!featureTarget) return false;\n if (!featureTarget.properties) return false;\n return featureTarget.properties.meta === type;\n };\n}\n\nexport function isShiftMousedown(e) {\n if (!e.originalEvent) return false;\n if (!e.originalEvent.shiftKey) return false;\n return e.originalEvent.button === 0;\n}\n\nexport function isActiveFeature(e) {\n if (!e.featureTarget) return false;\n if (!e.featureTarget.properties) return false;\n return e.featureTarget.properties.active === Constants.activeStates.ACTIVE &&\n e.featureTarget.properties.meta === Constants.meta.FEATURE;\n}\n\nexport function isInactiveFeature(e) {\n if (!e.featureTarget) return false;\n if (!e.featureTarget.properties) return false;\n return e.featureTarget.properties.active === Constants.activeStates.INACTIVE &&\n e.featureTarget.properties.meta === Constants.meta.FEATURE;\n}\n\nexport function noTarget(e) {\n return e.featureTarget === undefined;\n}\n\nexport function isFeature(e) {\n if (!e.featureTarget) return false;\n if (!e.featureTarget.properties) return false;\n return e.featureTarget.properties.meta === Constants.meta.FEATURE;\n}\n\nexport function isVertex(e) {\n const featureTarget = e.featureTarget;\n if (!featureTarget) return false;\n if (!featureTarget.properties) return false;\n return featureTarget.properties.meta === Constants.meta.VERTEX;\n}\n\nexport function isShiftDown(e) {\n if (!e.originalEvent) return false;\n return e.originalEvent.shiftKey === true;\n}\n\nexport function isEscapeKey(e) {\n return e.keyCode === 27;\n}\n\nexport function isEnterKey(e) {\n return e.keyCode === 13;\n}\n\nexport function isTrue() {\n return true;\n}\n","/**\n * A standalone point geometry with useful accessor, comparison, and\n * modification methods.\n *\n * @class\n * @param {number} x the x-coordinate. This could be longitude or screen pixels, or any other sort of unit.\n * @param {number} y the y-coordinate. This could be latitude or screen pixels, or any other sort of unit.\n *\n * @example\n * const point = new Point(-77, 38);\n */\nexport default function Point(x, y) {\n this.x = x;\n this.y = y;\n}\n\nPoint.prototype = {\n /**\n * Clone this point, returning a new point that can be modified\n * without affecting the old one.\n * @return {Point} the clone\n */\n clone() { return new Point(this.x, this.y); },\n\n /**\n * Add this point's x & y coordinates to another point,\n * yielding a new point.\n * @param {Point} p the other point\n * @return {Point} output point\n */\n add(p) { return this.clone()._add(p); },\n\n /**\n * Subtract this point's x & y coordinates to from point,\n * yielding a new point.\n * @param {Point} p the other point\n * @return {Point} output point\n */\n sub(p) { return this.clone()._sub(p); },\n\n /**\n * Multiply this point's x & y coordinates by point,\n * yielding a new point.\n * @param {Point} p the other point\n * @return {Point} output point\n */\n multByPoint(p) { return this.clone()._multByPoint(p); },\n\n /**\n * Divide this point's x & y coordinates by point,\n * yielding a new point.\n * @param {Point} p the other point\n * @return {Point} output point\n */\n divByPoint(p) { return this.clone()._divByPoint(p); },\n\n /**\n * Multiply this point's x & y coordinates by a factor,\n * yielding a new point.\n * @param {number} k factor\n * @return {Point} output point\n */\n mult(k) { return this.clone()._mult(k); },\n\n /**\n * Divide this point's x & y coordinates by a factor,\n * yielding a new point.\n * @param {number} k factor\n * @return {Point} output point\n */\n div(k) { return this.clone()._div(k); },\n\n /**\n * Rotate this point around the 0, 0 origin by an angle a,\n * given in radians\n * @param {number} a angle to rotate around, in radians\n * @return {Point} output point\n */\n rotate(a) { return this.clone()._rotate(a); },\n\n /**\n * Rotate this point around p point by an angle a,\n * given in radians\n * @param {number} a angle to rotate around, in radians\n * @param {Point} p Point to rotate around\n * @return {Point} output point\n */\n rotateAround(a, p) { return this.clone()._rotateAround(a, p); },\n\n /**\n * Multiply this point by a 4x1 transformation matrix\n * @param {[number, number, number, number]} m transformation matrix\n * @return {Point} output point\n */\n matMult(m) { return this.clone()._matMult(m); },\n\n /**\n * Calculate this point but as a unit vector from 0, 0, meaning\n * that the distance from the resulting point to the 0, 0\n * coordinate will be equal to 1 and the angle from the resulting\n * point to the 0, 0 coordinate will be the same as before.\n * @return {Point} unit vector point\n */\n unit() { return this.clone()._unit(); },\n\n /**\n * Compute a perpendicular point, where the new y coordinate\n * is the old x coordinate and the new x coordinate is the old y\n * coordinate multiplied by -1\n * @return {Point} perpendicular point\n */\n perp() { return this.clone()._perp(); },\n\n /**\n * Return a version of this point with the x & y coordinates\n * rounded to integers.\n * @return {Point} rounded point\n */\n round() { return this.clone()._round(); },\n\n /**\n * Return the magnitude of this point: this is the Euclidean\n * distance from the 0, 0 coordinate to this point's x and y\n * coordinates.\n * @return {number} magnitude\n */\n mag() {\n return Math.sqrt(this.x * this.x + this.y * this.y);\n },\n\n /**\n * Judge whether this point is equal to another point, returning\n * true or false.\n * @param {Point} other the other point\n * @return {boolean} whether the points are equal\n */\n equals(other) {\n return this.x === other.x &&\n this.y === other.y;\n },\n\n /**\n * Calculate the distance from this point to another point\n * @param {Point} p the other point\n * @return {number} distance\n */\n dist(p) {\n return Math.sqrt(this.distSqr(p));\n },\n\n /**\n * Calculate the distance from this point to another point,\n * without the square root step. Useful if you're comparing\n * relative distances.\n * @param {Point} p the other point\n * @return {number} distance\n */\n distSqr(p) {\n const dx = p.x - this.x,\n dy = p.y - this.y;\n return dx * dx + dy * dy;\n },\n\n /**\n * Get the angle from the 0, 0 coordinate to this point, in radians\n * coordinates.\n * @return {number} angle\n */\n angle() {\n return Math.atan2(this.y, this.x);\n },\n\n /**\n * Get the angle from this point to another point, in radians\n * @param {Point} b the other point\n * @return {number} angle\n */\n angleTo(b) {\n return Math.atan2(this.y - b.y, this.x - b.x);\n },\n\n /**\n * Get the angle between this point and another point, in radians\n * @param {Point} b the other point\n * @return {number} angle\n */\n angleWith(b) {\n return this.angleWithSep(b.x, b.y);\n },\n\n /**\n * Find the angle of the two vectors, solving the formula for\n * the cross product a x b = |a||b|sin(θ) for θ.\n * @param {number} x the x-coordinate\n * @param {number} y the y-coordinate\n * @return {number} the angle in radians\n */\n angleWithSep(x, y) {\n return Math.atan2(\n this.x * y - this.y * x,\n this.x * x + this.y * y);\n },\n\n /** @param {[number, number, number, number]} m */\n _matMult(m) {\n const x = m[0] * this.x + m[1] * this.y,\n y = m[2] * this.x + m[3] * this.y;\n this.x = x;\n this.y = y;\n return this;\n },\n\n /** @param {Point} p */\n _add(p) {\n this.x += p.x;\n this.y += p.y;\n return this;\n },\n\n /** @param {Point} p */\n _sub(p) {\n this.x -= p.x;\n this.y -= p.y;\n return this;\n },\n\n /** @param {number} k */\n _mult(k) {\n this.x *= k;\n this.y *= k;\n return this;\n },\n\n /** @param {number} k */\n _div(k) {\n this.x /= k;\n this.y /= k;\n return this;\n },\n\n /** @param {Point} p */\n _multByPoint(p) {\n this.x *= p.x;\n this.y *= p.y;\n return this;\n },\n\n /** @param {Point} p */\n _divByPoint(p) {\n this.x /= p.x;\n this.y /= p.y;\n return this;\n },\n\n _unit() {\n this._div(this.mag());\n return this;\n },\n\n _perp() {\n const y = this.y;\n this.y = this.x;\n this.x = -y;\n return this;\n },\n\n /** @param {number} angle */\n _rotate(angle) {\n const cos = Math.cos(angle),\n sin = Math.sin(angle),\n x = cos * this.x - sin * this.y,\n y = sin * this.x + cos * this.y;\n this.x = x;\n this.y = y;\n return this;\n },\n\n /**\n * @param {number} angle\n * @param {Point} p\n */\n _rotateAround(angle, p) {\n const cos = Math.cos(angle),\n sin = Math.sin(angle),\n x = p.x + cos * (this.x - p.x) - sin * (this.y - p.y),\n y = p.y + sin * (this.x - p.x) + cos * (this.y - p.y);\n this.x = x;\n this.y = y;\n return this;\n },\n\n _round() {\n this.x = Math.round(this.x);\n this.y = Math.round(this.y);\n return this;\n },\n\n constructor: Point\n};\n\n/**\n * Construct a point from an array if necessary, otherwise if the input\n * is already a Point, return it unchanged.\n * @param {Point | [number, number] | {x: number, y: number}} p input value\n * @return {Point} constructed point.\n * @example\n * // this\n * var point = Point.convert([0, 1]);\n * // is equivalent to\n * var point = new Point(0, 1);\n */\nPoint.convert = function (p) {\n if (p instanceof Point) {\n return /** @type {Point} */ (p);\n }\n if (Array.isArray(p)) {\n return new Point(+p[0], +p[1]);\n }\n if (p.x !== undefined && p.y !== undefined) {\n return new Point(+p.x, +p.y);\n }\n throw new Error('Expected [x, y] or {x, y} point format');\n};\n","import Point from '@mapbox/point-geometry';\n\n/**\n * Returns a Point representing a mouse event's position\n * relative to a containing element.\n *\n * @param {MouseEvent} mouseEvent\n * @param {Node} container\n * @returns {Point}\n */\nfunction mouseEventPoint(mouseEvent, container) {\n const rect = container.getBoundingClientRect();\n return new Point(\n mouseEvent.clientX - rect.left - (container.clientLeft || 0),\n mouseEvent.clientY - rect.top - (container.clientTop || 0)\n );\n}\n\nexport default mouseEventPoint;\n","import * as Constants from '../constants.js';\n\n/**\n * Returns GeoJSON for a Point representing the\n * vertex of another feature.\n *\n * @param {string} parentId\n * @param {Array} coordinates\n * @param {string} path - Dot-separated numbers indicating exactly\n * where the point exists within its parent feature's coordinates.\n * @param {boolean} selected\n * @return {GeoJSON} Point\n */\n\nexport default function(parentId, coordinates, path, selected) {\n return {\n type: Constants.geojsonTypes.FEATURE,\n properties: {\n meta: Constants.meta.VERTEX,\n parent: parentId,\n coord_path: path,\n active: (selected) ? Constants.activeStates.ACTIVE : Constants.activeStates.INACTIVE\n },\n geometry: {\n type: Constants.geojsonTypes.POINT,\n coordinates\n }\n };\n}\n","import * as Constants from '../constants.js';\n\nexport default function(parent, startVertex, endVertex) {\n const startCoord = startVertex.geometry.coordinates;\n const endCoord = endVertex.geometry.coordinates;\n\n // If a coordinate exceeds the projection, we can't calculate a midpoint,\n // so run away\n if (startCoord[1] > Constants.LAT_RENDERED_MAX ||\n startCoord[1] < Constants.LAT_RENDERED_MIN ||\n endCoord[1] > Constants.LAT_RENDERED_MAX ||\n endCoord[1] < Constants.LAT_RENDERED_MIN) {\n return null;\n }\n\n const mid = {\n lng: (startCoord[0] + endCoord[0]) / 2,\n lat: (startCoord[1] + endCoord[1]) / 2\n };\n\n return {\n type: Constants.geojsonTypes.FEATURE,\n properties: {\n meta: Constants.meta.MIDPOINT,\n parent,\n lng: mid.lng,\n lat: mid.lat,\n coord_path: endVertex.properties.coord_path\n },\n geometry: {\n type: Constants.geojsonTypes.POINT,\n coordinates: [mid.lng, mid.lat]\n }\n };\n}\n","import createVertex from './create_vertex.js';\nimport createMidpoint from './create_midpoint.js';\nimport * as Constants from '../constants.js';\n\nfunction createSupplementaryPoints(geojson, options = {}, basePath = null) {\n const { type, coordinates } = geojson.geometry;\n const featureId = geojson.properties && geojson.properties.id;\n\n let supplementaryPoints = [];\n\n if (type === Constants.geojsonTypes.POINT) {\n // For points, just create a vertex\n supplementaryPoints.push(createVertex(featureId, coordinates, basePath, isSelectedPath(basePath)));\n } else if (type === Constants.geojsonTypes.POLYGON) {\n // Cycle through a Polygon's rings and\n // process each line\n coordinates.forEach((line, lineIndex) => {\n processLine(line, (basePath !== null) ? `${basePath}.${lineIndex}` : String(lineIndex));\n });\n } else if (type === Constants.geojsonTypes.LINE_STRING) {\n processLine(coordinates, basePath);\n } else if (type.indexOf(Constants.geojsonTypes.MULTI_PREFIX) === 0) {\n processMultiGeometry();\n }\n\n function processLine(line, lineBasePath) {\n let firstPointString = '';\n let lastVertex = null;\n line.forEach((point, pointIndex) => {\n const pointPath = (lineBasePath !== undefined && lineBasePath !== null) ? `${lineBasePath}.${pointIndex}` : String(pointIndex);\n const vertex = createVertex(featureId, point, pointPath, isSelectedPath(pointPath));\n\n // If we're creating midpoints, check if there was a\n // vertex before this one. If so, add a midpoint\n // between that vertex and this one.\n if (options.midpoints && lastVertex) {\n const midpoint = createMidpoint(featureId, lastVertex, vertex);\n if (midpoint) {\n supplementaryPoints.push(midpoint);\n }\n }\n lastVertex = vertex;\n\n // A Polygon line's last point is the same as the first point. If we're on the last\n // point, we want to draw a midpoint before it but not another vertex on it\n // (since we already a vertex there, from the first point).\n const stringifiedPoint = JSON.stringify(point);\n if (firstPointString !== stringifiedPoint) {\n supplementaryPoints.push(vertex);\n }\n if (pointIndex === 0) {\n firstPointString = stringifiedPoint;\n }\n });\n }\n\n function isSelectedPath(path) {\n if (!options.selectedPaths) return false;\n return options.selectedPaths.indexOf(path) !== -1;\n }\n\n // Split a multi-geometry into constituent\n // geometries, and accumulate the supplementary points\n // for each of those constituents\n function processMultiGeometry() {\n const subType = type.replace(Constants.geojsonTypes.MULTI_PREFIX, '');\n coordinates.forEach((subCoordinates, index) => {\n const subFeature = {\n type: Constants.geojsonTypes.FEATURE,\n properties: geojson.properties,\n geometry: {\n type: subType,\n coordinates: subCoordinates\n }\n };\n supplementaryPoints = supplementaryPoints.concat(createSupplementaryPoints(subFeature, options, index));\n });\n }\n\n return supplementaryPoints;\n}\n\nexport default createSupplementaryPoints;\n","export default {\n enable(ctx) {\n setTimeout(() => {\n // First check we've got a map and some context.\n if (!ctx.map || !ctx.map.doubleClickZoom || !ctx._ctx || !ctx._ctx.store || !ctx._ctx.store.getInitialConfigValue) return;\n // Now check initial state wasn't false (we leave it disabled if so)\n if (!ctx._ctx.store.getInitialConfigValue('doubleClickZoom')) return;\n ctx.map.doubleClickZoom.enable();\n }, 0);\n },\n disable(ctx) {\n setTimeout(() => {\n if (!ctx.map || !ctx.map.doubleClickZoom) return;\n // Always disable here, as it's necessary in some cases.\n ctx.map.doubleClickZoom.disable();\n }, 0);\n }\n};\n","import * as Constants from '../constants.js';\n\nconst {\n LAT_MIN,\n LAT_MAX,\n LAT_RENDERED_MIN,\n LAT_RENDERED_MAX,\n LNG_MIN,\n LNG_MAX,\n} = Constants;\nfunction extent(feature) {\n const depth = {\n Point: 0,\n LineString: 1,\n Polygon: 2,\n MultiPoint: 1,\n MultiLineString: 2,\n MultiPolygon: 3,\n }[feature.geometry.type];\n\n const coords = [feature.geometry.coordinates].flat(depth);\n const lngs = coords.map(coord => coord[0]);\n const lats = coords.map(coord => coord[1]);\n const min = vals => Math.min.apply(null, vals);\n const max = vals => Math.max.apply(null, vals);\n return [min(lngs), min(lats), max(lngs), max(lats)];\n}\n\n// Ensure that we do not drag north-south far enough for\n// - any part of any feature to exceed the poles\n// - any feature to be completely lost in the space between the projection's\n// edge and the poles, such that it couldn't be re-selected and moved back\nexport default function(geojsonFeatures, delta) {\n // \"inner edge\" = a feature's latitude closest to the equator\n let northInnerEdge = LAT_MIN;\n let southInnerEdge = LAT_MAX;\n // \"outer edge\" = a feature's latitude furthest from the equator\n let northOuterEdge = LAT_MIN;\n let southOuterEdge = LAT_MAX;\n\n let westEdge = LNG_MAX;\n let eastEdge = LNG_MIN;\n\n geojsonFeatures.forEach((feature) => {\n const bounds = extent(feature);\n const featureSouthEdge = bounds[1];\n const featureNorthEdge = bounds[3];\n const featureWestEdge = bounds[0];\n const featureEastEdge = bounds[2];\n if (featureSouthEdge > northInnerEdge) northInnerEdge = featureSouthEdge;\n if (featureNorthEdge < southInnerEdge) southInnerEdge = featureNorthEdge;\n if (featureNorthEdge > northOuterEdge) northOuterEdge = featureNorthEdge;\n if (featureSouthEdge < southOuterEdge) southOuterEdge = featureSouthEdge;\n if (featureWestEdge < westEdge) westEdge = featureWestEdge;\n if (featureEastEdge > eastEdge) eastEdge = featureEastEdge;\n });\n\n\n // These changes are not mutually exclusive: we might hit the inner\n // edge but also have hit the outer edge and therefore need\n // another readjustment\n const constrainedDelta = delta;\n if (northInnerEdge + constrainedDelta.lat > LAT_RENDERED_MAX) {\n constrainedDelta.lat = LAT_RENDERED_MAX - northInnerEdge;\n }\n if (northOuterEdge + constrainedDelta.lat > LAT_MAX) {\n constrainedDelta.lat = LAT_MAX - northOuterEdge;\n }\n if (southInnerEdge + constrainedDelta.lat < LAT_RENDERED_MIN) {\n constrainedDelta.lat = LAT_RENDERED_MIN - southInnerEdge;\n }\n if (southOuterEdge + constrainedDelta.lat < LAT_MIN) {\n constrainedDelta.lat = LAT_MIN - southOuterEdge;\n }\n if (westEdge + constrainedDelta.lng <= LNG_MIN) {\n constrainedDelta.lng += Math.ceil(Math.abs(constrainedDelta.lng) / 360) * 360;\n }\n if (eastEdge + constrainedDelta.lng >= LNG_MAX) {\n constrainedDelta.lng -= Math.ceil(Math.abs(constrainedDelta.lng) / 360) * 360;\n }\n\n return constrainedDelta;\n}\n","import constrainFeatureMovement from './constrain_feature_movement.js';\nimport * as Constants from '../constants.js';\n\nexport default function(features, delta) {\n const constrainedDelta = constrainFeatureMovement(features.map(feature => feature.toGeoJSON()), delta);\n\n features.forEach((feature) => {\n const currentCoordinates = feature.getCoordinates();\n\n const moveCoordinate = (coord) => {\n const point = {\n lng: coord[0] + constrainedDelta.lng,\n lat: coord[1] + constrainedDelta.lat\n };\n return [point.lng, point.lat];\n };\n const moveRing = ring => ring.map(coord => moveCoordinate(coord));\n const moveMultiPolygon = multi => multi.map(ring => moveRing(ring));\n\n let nextCoordinates;\n if (feature.type === Constants.geojsonTypes.POINT) {\n nextCoordinates = moveCoordinate(currentCoordinates);\n } else if (feature.type === Constants.geojsonTypes.LINE_STRING || feature.type === Constants.geojsonTypes.MULTI_POINT) {\n nextCoordinates = currentCoordinates.map(moveCoordinate);\n } else if (feature.type === Constants.geojsonTypes.POLYGON || feature.type === Constants.geojsonTypes.MULTI_LINE_STRING) {\n nextCoordinates = currentCoordinates.map(moveRing);\n } else if (feature.type === Constants.geojsonTypes.MULTI_POLYGON) {\n nextCoordinates = currentCoordinates.map(moveMultiPolygon);\n }\n\n feature.incomingCoords(nextCoordinates);\n });\n}\n","import * as CommonSelectors from '../lib/common_selectors.js';\nimport mouseEventPoint from '../lib/mouse_event_point.js';\nimport createSupplementaryPoints from '../lib/create_supplementary_points.js';\nimport StringSet from '../lib/string_set.js';\nimport doubleClickZoom from '../lib/double_click_zoom.js';\nimport moveFeatures from '../lib/move_features.js';\nimport * as Constants from '../constants.js';\n\nconst SimpleSelect = {};\n\nSimpleSelect.onSetup = function(opts) {\n // turn the opts into state.\n const state = {\n dragMoveLocation: null,\n boxSelectStartLocation: null,\n boxSelectElement: undefined,\n boxSelecting: false,\n canBoxSelect: false,\n dragMoving: false,\n canDragMove: false,\n initialDragPanState: this.map.dragPan.isEnabled(),\n initiallySelectedFeatureIds: opts.featureIds || []\n };\n\n this.setSelected(state.initiallySelectedFeatureIds.filter(id => this.getFeature(id) !== undefined));\n this.fireActionable();\n\n this.setActionableState({\n combineFeatures: true,\n uncombineFeatures: true,\n trash: true\n });\n\n return state;\n};\n\nSimpleSelect.fireUpdate = function() {\n this.fire(Constants.events.UPDATE, {\n action: Constants.updateActions.MOVE,\n features: this.getSelected().map(f => f.toGeoJSON())\n });\n};\n\nSimpleSelect.fireActionable = function() {\n const selectedFeatures = this.getSelected();\n\n const multiFeatures = selectedFeatures.filter(\n feature => this.isInstanceOf('MultiFeature', feature)\n );\n\n let combineFeatures = false;\n\n if (selectedFeatures.length > 1) {\n combineFeatures = true;\n const featureType = selectedFeatures[0].type.replace('Multi', '');\n selectedFeatures.forEach((feature) => {\n if (feature.type.replace('Multi', '') !== featureType) {\n combineFeatures = false;\n }\n });\n }\n\n const uncombineFeatures = multiFeatures.length > 0;\n const trash = selectedFeatures.length > 0;\n\n this.setActionableState({\n combineFeatures, uncombineFeatures, trash\n });\n};\n\nSimpleSelect.getUniqueIds = function(allFeatures) {\n if (!allFeatures.length) return [];\n const ids = allFeatures.map(s => s.properties.id)\n .filter(id => id !== undefined)\n .reduce((memo, id) => {\n memo.add(id);\n return memo;\n }, new StringSet());\n\n return ids.values();\n};\n\nSimpleSelect.stopExtendedInteractions = function(state) {\n if (state.boxSelectElement) {\n if (state.boxSelectElement.parentNode) state.boxSelectElement.parentNode.removeChild(state.boxSelectElement);\n state.boxSelectElement = null;\n }\n\n if ((state.canDragMove || state.canBoxSelect) && state.initialDragPanState === true) {\n this.map.dragPan.enable();\n }\n\n state.boxSelecting = false;\n state.canBoxSelect = false;\n state.dragMoving = false;\n state.canDragMove = false;\n};\n\nSimpleSelect.onStop = function() {\n doubleClickZoom.enable(this);\n};\n\nSimpleSelect.onMouseMove = function(state, e) {\n const isFeature = CommonSelectors.isFeature(e);\n if (isFeature && state.dragMoving) this.fireUpdate();\n\n // On mousemove that is not a drag, stop extended interactions.\n // This is useful if you drag off the canvas, release the button,\n // then move the mouse back over the canvas --- we don't allow the\n // interaction to continue then, but we do let it continue if you held\n // the mouse button that whole time\n this.stopExtendedInteractions(state);\n\n // Skip render\n return true;\n};\n\nSimpleSelect.onMouseOut = function(state) {\n // As soon as you mouse leaves the canvas, update the feature\n if (state.dragMoving) return this.fireUpdate();\n\n // Skip render\n return true;\n};\n\nSimpleSelect.onTap = SimpleSelect.onClick = function(state, e) {\n // Click (with or without shift) on no feature\n if (CommonSelectors.noTarget(e)) return this.clickAnywhere(state, e); // also tap\n if (CommonSelectors.isOfMetaType(Constants.meta.VERTEX)(e)) return this.clickOnVertex(state, e); //tap\n if (CommonSelectors.isFeature(e)) return this.clickOnFeature(state, e);\n};\n\nSimpleSelect.clickAnywhere = function (state) {\n // Clear the re-render selection\n const wasSelected = this.getSelectedIds();\n if (wasSelected.length) {\n this.clearSelectedFeatures();\n wasSelected.forEach(id => this.doRender(id));\n }\n doubleClickZoom.enable(this);\n this.stopExtendedInteractions(state);\n};\n\nSimpleSelect.clickOnVertex = function(state, e) {\n // Enter direct select mode\n this.changeMode(Constants.modes.DIRECT_SELECT, {\n featureId: e.featureTarget.properties.parent,\n coordPath: e.featureTarget.properties.coord_path,\n startPos: e.lngLat\n });\n this.updateUIClasses({ mouse: Constants.cursors.MOVE });\n};\n\nSimpleSelect.startOnActiveFeature = function(state, e) {\n // Stop any already-underway extended interactions\n this.stopExtendedInteractions(state);\n\n // Disable map.dragPan immediately so it can't start\n this.map.dragPan.disable();\n\n // Re-render it and enable drag move\n this.doRender(e.featureTarget.properties.id);\n\n // Set up the state for drag moving\n state.canDragMove = true;\n state.dragMoveLocation = e.lngLat;\n};\n\nSimpleSelect.clickOnFeature = function(state, e) {\n // Stop everything\n doubleClickZoom.disable(this);\n this.stopExtendedInteractions(state);\n\n const isShiftClick = CommonSelectors.isShiftDown(e);\n const selectedFeatureIds = this.getSelectedIds();\n const featureId = e.featureTarget.properties.id;\n const isFeatureSelected = this.isSelected(featureId);\n\n // Click (without shift) on any selected feature but a point\n if (!isShiftClick && isFeatureSelected && this.getFeature(featureId).type !== Constants.geojsonTypes.POINT) {\n // Enter direct select mode\n return this.changeMode(Constants.modes.DIRECT_SELECT, {\n featureId\n });\n }\n\n // Shift-click on a selected feature\n if (isFeatureSelected && isShiftClick) {\n // Deselect it\n this.deselect(featureId);\n this.updateUIClasses({ mouse: Constants.cursors.POINTER });\n if (selectedFeatureIds.length === 1) {\n doubleClickZoom.enable(this);\n }\n // Shift-click on an unselected feature\n } else if (!isFeatureSelected && isShiftClick) {\n // Add it to the selection\n this.select(featureId);\n this.updateUIClasses({ mouse: Constants.cursors.MOVE });\n // Click (without shift) on an unselected feature\n } else if (!isFeatureSelected && !isShiftClick) {\n // Make it the only selected feature\n selectedFeatureIds.forEach(id => this.doRender(id));\n this.setSelected(featureId);\n this.updateUIClasses({ mouse: Constants.cursors.MOVE });\n }\n\n // No matter what, re-render the clicked feature\n this.doRender(featureId);\n};\n\nSimpleSelect.onMouseDown = function(state, e) {\n state.initialDragPanState = this.map.dragPan.isEnabled();\n if (CommonSelectors.isActiveFeature(e)) return this.startOnActiveFeature(state, e);\n if (this.drawConfig.boxSelect && CommonSelectors.isShiftMousedown(e)) return this.startBoxSelect(state, e);\n};\n\nSimpleSelect.startBoxSelect = function(state, e) {\n this.stopExtendedInteractions(state);\n this.map.dragPan.disable();\n // Enable box select\n state.boxSelectStartLocation = mouseEventPoint(e.originalEvent, this.map.getContainer());\n state.canBoxSelect = true;\n};\n\nSimpleSelect.onTouchStart = function(state, e) {\n if (CommonSelectors.isActiveFeature(e)) return this.startOnActiveFeature(state, e);\n};\n\nSimpleSelect.onDrag = function(state, e) {\n if (state.canDragMove) return this.dragMove(state, e);\n if (this.drawConfig.boxSelect && state.canBoxSelect) return this.whileBoxSelect(state, e);\n};\n\nSimpleSelect.whileBoxSelect = function(state, e) {\n state.boxSelecting = true;\n this.updateUIClasses({ mouse: Constants.cursors.ADD });\n\n // Create the box node if it doesn't exist\n if (!state.boxSelectElement) {\n state.boxSelectElement = document.createElement('div');\n state.boxSelectElement.classList.add(Constants.classes.BOX_SELECT);\n this.map.getContainer().appendChild(state.boxSelectElement);\n }\n\n // Adjust the box node's width and xy position\n const current = mouseEventPoint(e.originalEvent, this.map.getContainer());\n const minX = Math.min(state.boxSelectStartLocation.x, current.x);\n const maxX = Math.max(state.boxSelectStartLocation.x, current.x);\n const minY = Math.min(state.boxSelectStartLocation.y, current.y);\n const maxY = Math.max(state.boxSelectStartLocation.y, current.y);\n const translateValue = `translate(${minX}px, ${minY}px)`;\n state.boxSelectElement.style.transform = translateValue;\n state.boxSelectElement.style.WebkitTransform = translateValue;\n state.boxSelectElement.style.width = `${maxX - minX}px`;\n state.boxSelectElement.style.height = `${maxY - minY}px`;\n};\n\nSimpleSelect.dragMove = function(state, e) {\n // Dragging when drag move is enabled\n state.dragMoving = true;\n e.originalEvent.stopPropagation();\n\n const delta = {\n lng: e.lngLat.lng - state.dragMoveLocation.lng,\n lat: e.lngLat.lat - state.dragMoveLocation.lat\n };\n\n moveFeatures(this.getSelected(), delta);\n\n state.dragMoveLocation = e.lngLat;\n};\n\nSimpleSelect.onTouchEnd = SimpleSelect.onMouseUp = function(state, e) {\n // End any extended interactions\n if (state.dragMoving) {\n this.fireUpdate();\n } else if (state.boxSelecting) {\n const bbox = [\n state.boxSelectStartLocation,\n mouseEventPoint(e.originalEvent, this.map.getContainer())\n ];\n const featuresInBox = this.featuresAt(null, bbox, 'click');\n const idsToSelect = this.getUniqueIds(featuresInBox)\n .filter(id => !this.isSelected(id));\n\n if (idsToSelect.length) {\n this.select(idsToSelect);\n idsToSelect.forEach(id => this.doRender(id));\n this.updateUIClasses({ mouse: Constants.cursors.MOVE });\n }\n }\n this.stopExtendedInteractions(state);\n};\n\nSimpleSelect.toDisplayFeatures = function(state, geojson, display) {\n geojson.properties.active = (this.isSelected(geojson.properties.id)) ?\n Constants.activeStates.ACTIVE : Constants.activeStates.INACTIVE;\n display(geojson);\n this.fireActionable();\n if (geojson.properties.active !== Constants.activeStates.ACTIVE ||\n geojson.geometry.type === Constants.geojsonTypes.POINT) return;\n createSupplementaryPoints(geojson).forEach(display);\n};\n\nSimpleSelect.onTrash = function() {\n this.deleteFeature(this.getSelectedIds());\n this.fireActionable();\n};\n\nSimpleSelect.onCombineFeatures = function() {\n const selectedFeatures = this.getSelected();\n\n if (selectedFeatures.length === 0 || selectedFeatures.length < 2) return;\n\n const coordinates = [], featuresCombined = [];\n const featureType = selectedFeatures[0].type.replace('Multi', '');\n\n for (let i = 0; i < selectedFeatures.length; i++) {\n const feature = selectedFeatures[i];\n\n if (feature.type.replace('Multi', '') !== featureType) {\n return;\n }\n if (feature.type.includes('Multi')) {\n feature.getCoordinates().forEach((subcoords) => {\n coordinates.push(subcoords);\n });\n } else {\n coordinates.push(feature.getCoordinates());\n }\n\n featuresCombined.push(feature.toGeoJSON());\n }\n\n if (featuresCombined.length > 1) {\n const multiFeature = this.newFeature({\n type: Constants.geojsonTypes.FEATURE,\n properties: featuresCombined[0].properties,\n geometry: {\n type: `Multi${featureType}`,\n coordinates\n }\n });\n\n this.addFeature(multiFeature);\n this.deleteFeature(this.getSelectedIds(), { silent: true });\n this.setSelected([multiFeature.id]);\n\n this.fire(Constants.events.COMBINE_FEATURES, {\n createdFeatures: [multiFeature.toGeoJSON()],\n deletedFeatures: featuresCombined\n });\n }\n this.fireActionable();\n};\n\nSimpleSelect.onUncombineFeatures = function() {\n const selectedFeatures = this.getSelected();\n if (selectedFeatures.length === 0) return;\n\n const createdFeatures = [];\n const featuresUncombined = [];\n\n for (let i = 0; i < selectedFeatures.length; i++) {\n const feature = selectedFeatures[i];\n\n if (this.isInstanceOf('MultiFeature', feature)) {\n feature.getFeatures().forEach((subFeature) => {\n this.addFeature(subFeature);\n subFeature.properties = feature.properties;\n createdFeatures.push(subFeature.toGeoJSON());\n this.select([subFeature.id]);\n });\n this.deleteFeature(feature.id, { silent: true });\n featuresUncombined.push(feature.toGeoJSON());\n }\n }\n\n if (createdFeatures.length > 1) {\n this.fire(Constants.events.UNCOMBINE_FEATURES, {\n createdFeatures,\n deletedFeatures: featuresUncombined\n });\n }\n this.fireActionable();\n};\n\nexport default SimpleSelect;\n","import { noTarget, isOfMetaType, isActiveFeature, isInactiveFeature, isShiftDown } from '../lib/common_selectors.js';\nimport createSupplementaryPoints from '../lib/create_supplementary_points.js';\nimport constrainFeatureMovement from '../lib/constrain_feature_movement.js';\nimport doubleClickZoom from '../lib/double_click_zoom.js';\nimport * as Constants from '../constants.js';\nimport moveFeatures from '../lib/move_features.js';\n\nconst isVertex = isOfMetaType(Constants.meta.VERTEX);\nconst isMidpoint = isOfMetaType(Constants.meta.MIDPOINT);\n\nconst DirectSelect = {};\n\n// INTERNAL FUCNTIONS\n\nDirectSelect.fireUpdate = function() {\n this.fire(Constants.events.UPDATE, {\n action: Constants.updateActions.CHANGE_COORDINATES,\n features: this.getSelected().map(f => f.toGeoJSON())\n });\n};\n\nDirectSelect.fireActionable = function(state) {\n this.setActionableState({\n combineFeatures: false,\n uncombineFeatures: false,\n trash: state.selectedCoordPaths.length > 0\n });\n};\n\nDirectSelect.startDragging = function(state, e) {\n state.initialDragPanState = this.map.dragPan.isEnabled();\n\n this.map.dragPan.disable();\n state.canDragMove = true;\n state.dragMoveLocation = e.lngLat;\n};\n\nDirectSelect.stopDragging = function(state) {\n if (state.canDragMove && state.initialDragPanState === true) {\n this.map.dragPan.enable();\n }\n state.dragMoving = false;\n state.canDragMove = false;\n state.dragMoveLocation = null;\n};\n\nDirectSelect.onVertex = function (state, e) {\n this.startDragging(state, e);\n const about = e.featureTarget.properties;\n const selectedIndex = state.selectedCoordPaths.indexOf(about.coord_path);\n if (!isShiftDown(e) && selectedIndex === -1) {\n state.selectedCoordPaths = [about.coord_path];\n } else if (isShiftDown(e) && selectedIndex === -1) {\n state.selectedCoordPaths.push(about.coord_path);\n }\n\n const selectedCoordinates = this.pathsToCoordinates(state.featureId, state.selectedCoordPaths);\n this.setSelectedCoordinates(selectedCoordinates);\n};\n\nDirectSelect.onMidpoint = function(state, e) {\n this.startDragging(state, e);\n const about = e.featureTarget.properties;\n state.feature.addCoordinate(about.coord_path, about.lng, about.lat);\n this.fireUpdate();\n state.selectedCoordPaths = [about.coord_path];\n};\n\nDirectSelect.pathsToCoordinates = function(featureId, paths) {\n return paths.map(coord_path => ({ feature_id: featureId, coord_path }));\n};\n\nDirectSelect.onFeature = function(state, e) {\n if (state.selectedCoordPaths.length === 0) this.startDragging(state, e);\n else this.stopDragging(state);\n};\n\nDirectSelect.dragFeature = function(state, e, delta) {\n moveFeatures(this.getSelected(), delta);\n state.dragMoveLocation = e.lngLat;\n};\n\nDirectSelect.dragVertex = function(state, e, delta) {\n const selectedCoords = state.selectedCoordPaths.map(coord_path => state.feature.getCoordinate(coord_path));\n const selectedCoordPoints = selectedCoords.map(coords => ({\n type: Constants.geojsonTypes.FEATURE,\n properties: {},\n geometry: {\n type: Constants.geojsonTypes.POINT,\n coordinates: coords\n }\n }));\n\n const constrainedDelta = constrainFeatureMovement(selectedCoordPoints, delta);\n for (let i = 0; i < selectedCoords.length; i++) {\n const coord = selectedCoords[i];\n state.feature.updateCoordinate(state.selectedCoordPaths[i], coord[0] + constrainedDelta.lng, coord[1] + constrainedDelta.lat);\n }\n};\n\nDirectSelect.clickNoTarget = function () {\n this.changeMode(Constants.modes.SIMPLE_SELECT);\n};\n\nDirectSelect.clickInactive = function () {\n this.changeMode(Constants.modes.SIMPLE_SELECT);\n};\n\nDirectSelect.clickActiveFeature = function (state) {\n state.selectedCoordPaths = [];\n this.clearSelectedCoordinates();\n state.feature.changed();\n};\n\n// EXTERNAL FUNCTIONS\n\nDirectSelect.onSetup = function(opts) {\n const featureId = opts.featureId;\n const feature = this.getFeature(featureId);\n\n if (!feature) {\n throw new Error('You must provide a featureId to enter direct_select mode');\n }\n\n if (feature.type === Constants.geojsonTypes.POINT) {\n throw new TypeError('direct_select mode doesn\\'t handle point features');\n }\n\n const state = {\n featureId,\n feature,\n dragMoveLocation: opts.startPos || null,\n dragMoving: false,\n canDragMove: false,\n selectedCoordPaths: opts.coordPath ? [opts.coordPath] : [],\n };\n\n this.setSelectedCoordinates(this.pathsToCoordinates(featureId, state.selectedCoordPaths));\n this.setSelected(featureId);\n doubleClickZoom.disable(this);\n\n this.setActionableState({\n trash: true\n });\n\n return state;\n};\n\nDirectSelect.onStop = function() {\n doubleClickZoom.enable(this);\n this.clearSelectedCoordinates();\n};\n\nDirectSelect.toDisplayFeatures = function(state, geojson, push) {\n if (state.featureId === geojson.properties.id) {\n geojson.properties.active = Constants.activeStates.ACTIVE;\n push(geojson);\n createSupplementaryPoints(geojson, {\n map: this.map,\n midpoints: true,\n selectedPaths: state.selectedCoordPaths\n }).forEach(push);\n } else {\n geojson.properties.active = Constants.activeStates.INACTIVE;\n push(geojson);\n }\n this.fireActionable(state);\n};\n\nDirectSelect.onTrash = function(state) {\n // Uses number-aware sorting to make sure '9' < '10'. Comparison is reversed because we want them\n // in reverse order so that we can remove by index safely.\n state.selectedCoordPaths\n .sort((a, b) => b.localeCompare(a, 'en', { numeric: true }))\n .forEach(id => state.feature.removeCoordinate(id));\n this.fireUpdate();\n state.selectedCoordPaths = [];\n this.clearSelectedCoordinates();\n this.fireActionable(state);\n if (state.feature.isValid() === false) {\n this.deleteFeature([state.featureId]);\n this.changeMode(Constants.modes.SIMPLE_SELECT, {});\n }\n};\n\nDirectSelect.onMouseMove = function(state, e) {\n // On mousemove that is not a drag, stop vertex movement.\n const isFeature = isActiveFeature(e);\n const onVertex = isVertex(e);\n const isMidPoint = isMidpoint(e);\n const noCoords = state.selectedCoordPaths.length === 0;\n if (isFeature && noCoords) this.updateUIClasses({ mouse: Constants.cursors.MOVE });\n else if (onVertex && !noCoords) this.updateUIClasses({ mouse: Constants.cursors.MOVE });\n else this.updateUIClasses({ mouse: Constants.cursors.NONE });\n\n const isDraggableItem = onVertex || isFeature || isMidPoint;\n if (isDraggableItem && state.dragMoving) this.fireUpdate();\n\n this.stopDragging(state);\n\n // Skip render\n return true;\n};\n\nDirectSelect.onMouseOut = function(state) {\n // As soon as you mouse leaves the canvas, update the feature\n if (state.dragMoving) this.fireUpdate();\n\n // Skip render\n return true;\n};\n\nDirectSelect.onTouchStart = DirectSelect.onMouseDown = function(state, e) {\n if (isVertex(e)) return this.onVertex(state, e);\n if (isActiveFeature(e)) return this.onFeature(state, e);\n if (isMidpoint(e)) return this.onMidpoint(state, e);\n};\n\nDirectSelect.onDrag = function(state, e) {\n if (state.canDragMove !== true) return;\n state.dragMoving = true;\n e.originalEvent.stopPropagation();\n\n const delta = {\n lng: e.lngLat.lng - state.dragMoveLocation.lng,\n lat: e.lngLat.lat - state.dragMoveLocation.lat\n };\n if (state.selectedCoordPaths.length > 0) this.dragVertex(state, e, delta);\n else this.dragFeature(state, e, delta);\n\n state.dragMoveLocation = e.lngLat;\n};\n\nDirectSelect.onClick = function(state, e) {\n if (noTarget(e)) return this.clickNoTarget(state, e);\n if (isActiveFeature(e)) return this.clickActiveFeature(state, e);\n if (isInactiveFeature(e)) return this.clickInactive(state, e);\n this.stopDragging(state);\n};\n\nDirectSelect.onTap = function(state, e) {\n if (noTarget(e)) return this.clickNoTarget(state, e);\n if (isActiveFeature(e)) return this.clickActiveFeature(state, e);\n if (isInactiveFeature(e)) return this.clickInactive(state, e);\n};\n\nDirectSelect.onTouchEnd = DirectSelect.onMouseUp = function(state) {\n if (state.dragMoving) {\n this.fireUpdate();\n }\n this.stopDragging(state);\n};\n\nexport default DirectSelect;\n\n","import * as CommonSelectors from '../lib/common_selectors.js';\nimport * as Constants from '../constants.js';\n\nconst DrawPoint = {};\n\nDrawPoint.onSetup = function() {\n const point = this.newFeature({\n type: Constants.geojsonTypes.FEATURE,\n properties: {},\n geometry: {\n type: Constants.geojsonTypes.POINT,\n coordinates: []\n }\n });\n\n this.addFeature(point);\n\n this.clearSelectedFeatures();\n this.updateUIClasses({ mouse: Constants.cursors.ADD });\n this.activateUIButton(Constants.types.POINT);\n\n this.setActionableState({\n trash: true\n });\n\n return { point };\n};\n\nDrawPoint.stopDrawingAndRemove = function(state) {\n this.deleteFeature([state.point.id], { silent: true });\n this.changeMode(Constants.modes.SIMPLE_SELECT);\n};\n\nDrawPoint.onTap = DrawPoint.onClick = function(state, e) {\n this.updateUIClasses({ mouse: Constants.cursors.MOVE });\n state.point.updateCoordinate('', e.lngLat.lng, e.lngLat.lat);\n this.fire(Constants.events.CREATE, {\n features: [state.point.toGeoJSON()]\n });\n this.changeMode(Constants.modes.SIMPLE_SELECT, { featureIds: [state.point.id] });\n};\n\nDrawPoint.onStop = function(state) {\n this.activateUIButton();\n if (!state.point.getCoordinate().length) {\n this.deleteFeature([state.point.id], { silent: true });\n }\n};\n\nDrawPoint.toDisplayFeatures = function(state, geojson, display) {\n // Never render the point we're drawing\n const isActivePoint = geojson.properties.id === state.point.id;\n geojson.properties.active = (isActivePoint) ? Constants.activeStates.ACTIVE : Constants.activeStates.INACTIVE;\n if (!isActivePoint) return display(geojson);\n};\n\nDrawPoint.onTrash = DrawPoint.stopDrawingAndRemove;\n\nDrawPoint.onKeyUp = function(state, e) {\n if (CommonSelectors.isEscapeKey(e) || CommonSelectors.isEnterKey(e)) {\n return this.stopDrawingAndRemove(state, e);\n }\n};\n\nexport default DrawPoint;\n","function isEventAtCoordinates(event, coordinates) {\n if (!event.lngLat) return false;\n return event.lngLat.lng === coordinates[0] && event.lngLat.lat === coordinates[1];\n}\n\nexport default isEventAtCoordinates;\n","import * as CommonSelectors from '../lib/common_selectors.js';\nimport doubleClickZoom from '../lib/double_click_zoom.js';\nimport * as Constants from '../constants.js';\nimport isEventAtCoordinates from '../lib/is_event_at_coordinates.js';\nimport createVertex from '../lib/create_vertex.js';\n\nconst DrawPolygon = {};\n\nDrawPolygon.onSetup = function() {\n const polygon = this.newFeature({\n type: Constants.geojsonTypes.FEATURE,\n properties: {},\n geometry: {\n type: Constants.geojsonTypes.POLYGON,\n coordinates: [[]]\n }\n });\n\n this.addFeature(polygon);\n\n this.clearSelectedFeatures();\n doubleClickZoom.disable(this);\n this.updateUIClasses({ mouse: Constants.cursors.ADD });\n this.activateUIButton(Constants.types.POLYGON);\n this.setActionableState({\n trash: true\n });\n\n return {\n polygon,\n currentVertexPosition: 0\n };\n};\n\nDrawPolygon.clickAnywhere = function(state, e) {\n if (state.currentVertexPosition > 0 && isEventAtCoordinates(e, state.polygon.coordinates[0][state.currentVertexPosition - 1])) {\n return this.changeMode(Constants.modes.SIMPLE_SELECT, { featureIds: [state.polygon.id] });\n }\n this.updateUIClasses({ mouse: Constants.cursors.ADD });\n state.polygon.updateCoordinate(`0.${state.currentVertexPosition}`, e.lngLat.lng, e.lngLat.lat);\n state.currentVertexPosition++;\n state.polygon.updateCoordinate(`0.${state.currentVertexPosition}`, e.lngLat.lng, e.lngLat.lat);\n};\n\nDrawPolygon.clickOnVertex = function(state) {\n return this.changeMode(Constants.modes.SIMPLE_SELECT, { featureIds: [state.polygon.id] });\n};\n\nDrawPolygon.onMouseMove = function(state, e) {\n state.polygon.updateCoordinate(`0.${state.currentVertexPosition}`, e.lngLat.lng, e.lngLat.lat);\n if (CommonSelectors.isVertex(e)) {\n this.updateUIClasses({ mouse: Constants.cursors.POINTER });\n }\n};\n\nDrawPolygon.onTap = DrawPolygon.onClick = function(state, e) {\n if (CommonSelectors.isVertex(e)) return this.clickOnVertex(state, e);\n return this.clickAnywhere(state, e);\n};\n\nDrawPolygon.onKeyUp = function(state, e) {\n if (CommonSelectors.isEscapeKey(e)) {\n this.deleteFeature([state.polygon.id], { silent: true });\n this.changeMode(Constants.modes.SIMPLE_SELECT);\n } else if (CommonSelectors.isEnterKey(e)) {\n this.changeMode(Constants.modes.SIMPLE_SELECT, { featureIds: [state.polygon.id] });\n }\n};\n\nDrawPolygon.onStop = function(state) {\n this.updateUIClasses({ mouse: Constants.cursors.NONE });\n doubleClickZoom.enable(this);\n this.activateUIButton();\n\n // check to see if we've deleted this feature\n if (this.getFeature(state.polygon.id) === undefined) return;\n\n //remove last added coordinate\n state.polygon.removeCoordinate(`0.${state.currentVertexPosition}`);\n if (state.polygon.isValid()) {\n this.fire(Constants.events.CREATE, {\n features: [state.polygon.toGeoJSON()]\n });\n } else {\n this.deleteFeature([state.polygon.id], { silent: true });\n this.changeMode(Constants.modes.SIMPLE_SELECT, {}, { silent: true });\n }\n};\n\nDrawPolygon.toDisplayFeatures = function(state, geojson, display) {\n const isActivePolygon = geojson.properties.id === state.polygon.id;\n geojson.properties.active = (isActivePolygon) ? Constants.activeStates.ACTIVE : Constants.activeStates.INACTIVE;\n if (!isActivePolygon) return display(geojson);\n\n // Don't render a polygon until it has two positions\n // (and a 3rd which is just the first repeated)\n if (geojson.geometry.coordinates.length === 0) return;\n\n const coordinateCount = geojson.geometry.coordinates[0].length;\n // 2 coordinates after selecting a draw type\n // 3 after creating the first point\n if (coordinateCount < 3) {\n return;\n }\n geojson.properties.meta = Constants.meta.FEATURE;\n display(createVertex(state.polygon.id, geojson.geometry.coordinates[0][0], '0.0', false));\n if (coordinateCount > 3) {\n // Add a start position marker to the map, clicking on this will finish the feature\n // This should only be shown when we're in a valid spot\n const endPos = geojson.geometry.coordinates[0].length - 3;\n display(createVertex(state.polygon.id, geojson.geometry.coordinates[0][endPos], `0.${endPos}`, false));\n }\n if (coordinateCount <= 4) {\n // If we've only drawn two positions (plus the closer),\n // make a LineString instead of a Polygon\n const lineCoordinates = [\n [geojson.geometry.coordinates[0][0][0], geojson.geometry.coordinates[0][0][1]], [geojson.geometry.coordinates[0][1][0], geojson.geometry.coordinates[0][1][1]]\n ];\n // create an initial vertex so that we can track the first point on mobile devices\n display({\n type: Constants.geojsonTypes.FEATURE,\n properties: geojson.properties,\n geometry: {\n coordinates: lineCoordinates,\n type: Constants.geojsonTypes.LINE_STRING\n }\n });\n if (coordinateCount === 3) {\n return;\n }\n }\n // render the Polygon\n return display(geojson);\n};\n\nDrawPolygon.onTrash = function(state) {\n this.deleteFeature([state.polygon.id], { silent: true });\n this.changeMode(Constants.modes.SIMPLE_SELECT);\n};\n\nexport default DrawPolygon;\n","import * as CommonSelectors from '../lib/common_selectors.js';\nimport isEventAtCoordinates from '../lib/is_event_at_coordinates.js';\nimport doubleClickZoom from '../lib/double_click_zoom.js';\nimport * as Constants from '../constants.js';\nimport createVertex from '../lib/create_vertex.js';\n\nconst DrawLineString = {};\n\nDrawLineString.onSetup = function(opts) {\n opts = opts || {};\n const featureId = opts.featureId;\n\n let line, currentVertexPosition;\n let direction = 'forward';\n if (featureId) {\n line = this.getFeature(featureId);\n if (!line) {\n throw new Error('Could not find a feature with the provided featureId');\n }\n let from = opts.from;\n if (from && from.type === 'Feature' && from.geometry && from.geometry.type === 'Point') {\n from = from.geometry;\n }\n if (from && from.type === 'Point' && from.coordinates && from.coordinates.length === 2) {\n from = from.coordinates;\n }\n if (!from || !Array.isArray(from)) {\n throw new Error('Please use the `from` property to indicate which point to continue the line from');\n }\n const lastCoord = line.coordinates.length - 1;\n if (line.coordinates[lastCoord][0] === from[0] && line.coordinates[lastCoord][1] === from[1]) {\n currentVertexPosition = lastCoord + 1;\n // add one new coordinate to continue from\n line.addCoordinate(currentVertexPosition, ...line.coordinates[lastCoord]);\n } else if (line.coordinates[0][0] === from[0] && line.coordinates[0][1] === from[1]) {\n direction = 'backwards';\n currentVertexPosition = 0;\n // add one new coordinate to continue from\n line.addCoordinate(currentVertexPosition, ...line.coordinates[0]);\n } else {\n throw new Error('`from` should match the point at either the start or the end of the provided LineString');\n }\n } else {\n line = this.newFeature({\n type: Constants.geojsonTypes.FEATURE,\n properties: {},\n geometry: {\n type: Constants.geojsonTypes.LINE_STRING,\n coordinates: []\n }\n });\n currentVertexPosition = 0;\n this.addFeature(line);\n }\n\n this.clearSelectedFeatures();\n doubleClickZoom.disable(this);\n this.updateUIClasses({ mouse: Constants.cursors.ADD });\n this.activateUIButton(Constants.types.LINE);\n this.setActionableState({\n trash: true\n });\n\n return {\n line,\n currentVertexPosition,\n direction\n };\n};\n\nDrawLineString.clickAnywhere = function(state, e) {\n if (state.currentVertexPosition > 0 && isEventAtCoordinates(e, state.line.coordinates[state.currentVertexPosition - 1]) ||\n state.direction === 'backwards' && isEventAtCoordinates(e, state.line.coordinates[state.currentVertexPosition + 1])) {\n return this.changeMode(Constants.modes.SIMPLE_SELECT, { featureIds: [state.line.id] });\n }\n this.updateUIClasses({ mouse: Constants.cursors.ADD });\n state.line.updateCoordinate(state.currentVertexPosition, e.lngLat.lng, e.lngLat.lat);\n if (state.direction === 'forward') {\n state.currentVertexPosition++;\n state.line.updateCoordinate(state.currentVertexPosition, e.lngLat.lng, e.lngLat.lat);\n } else {\n state.line.addCoordinate(0, e.lngLat.lng, e.lngLat.lat);\n }\n};\n\nDrawLineString.clickOnVertex = function(state) {\n return this.changeMode(Constants.modes.SIMPLE_SELECT, { featureIds: [state.line.id] });\n};\n\nDrawLineString.onMouseMove = function(state, e) {\n state.line.updateCoordinate(state.currentVertexPosition, e.lngLat.lng, e.lngLat.lat);\n if (CommonSelectors.isVertex(e)) {\n this.updateUIClasses({ mouse: Constants.cursors.POINTER });\n }\n};\n\nDrawLineString.onTap = DrawLineString.onClick = function(state, e) {\n if (CommonSelectors.isVertex(e)) return this.clickOnVertex(state, e);\n this.clickAnywhere(state, e);\n};\n\nDrawLineString.onKeyUp = function(state, e) {\n if (CommonSelectors.isEnterKey(e)) {\n this.changeMode(Constants.modes.SIMPLE_SELECT, { featureIds: [state.line.id] });\n } else if (CommonSelectors.isEscapeKey(e)) {\n this.deleteFeature([state.line.id], { silent: true });\n this.changeMode(Constants.modes.SIMPLE_SELECT);\n }\n};\n\nDrawLineString.onStop = function(state) {\n doubleClickZoom.enable(this);\n this.activateUIButton();\n\n // check to see if we've deleted this feature\n if (this.getFeature(state.line.id) === undefined) return;\n\n //remove last added coordinate\n state.line.removeCoordinate(`${state.currentVertexPosition}`);\n if (state.line.isValid()) {\n this.fire(Constants.events.CREATE, {\n features: [state.line.toGeoJSON()]\n });\n } else {\n this.deleteFeature([state.line.id], { silent: true });\n this.changeMode(Constants.modes.SIMPLE_SELECT, {}, { silent: true });\n }\n};\n\nDrawLineString.onTrash = function(state) {\n this.deleteFeature([state.line.id], { silent: true });\n this.changeMode(Constants.modes.SIMPLE_SELECT);\n};\n\nDrawLineString.toDisplayFeatures = function(state, geojson, display) {\n const isActiveLine = geojson.properties.id === state.line.id;\n geojson.properties.active = (isActiveLine) ? Constants.activeStates.ACTIVE : Constants.activeStates.INACTIVE;\n if (!isActiveLine) return display(geojson);\n // Only render the line if it has at least one real coordinate\n if (geojson.geometry.coordinates.length < 2) return;\n geojson.properties.meta = Constants.meta.FEATURE;\n display(createVertex(\n state.line.id,\n geojson.geometry.coordinates[state.direction === 'forward' ? geojson.geometry.coordinates.length - 2 : 1],\n `${state.direction === 'forward' ? geojson.geometry.coordinates.length - 2 : 1}`,\n false\n ));\n\n display(geojson);\n};\n\nexport default DrawLineString;\n","\nimport simple_select from './simple_select.js';\nimport direct_select from './direct_select.js';\nimport draw_point from './draw_point.js';\nimport draw_polygon from './draw_polygon.js';\nimport draw_line_string from './draw_line_string.js';\n\nexport default {\n simple_select,\n direct_select,\n draw_point,\n draw_polygon,\n draw_line_string,\n};\n","import * as Constants from './constants.js';\n\nimport styles from './lib/theme.js';\nimport modes from './modes/index.js';\n\nconst defaultOptions = {\n defaultMode: Constants.modes.SIMPLE_SELECT,\n keybindings: true,\n touchEnabled: true,\n clickBuffer: 2,\n touchBuffer: 25,\n boxSelect: true,\n displayControlsDefault: true,\n styles,\n modes,\n controls: {},\n userProperties: false,\n suppressAPIEvents: true\n};\n\nconst showControls = {\n point: true,\n line_string: true,\n polygon: true,\n trash: true,\n combine_features: true,\n uncombine_features: true\n};\n\nconst hideControls = {\n point: false,\n line_string: false,\n polygon: false,\n trash: false,\n combine_features: false,\n uncombine_features: false\n};\n\nfunction addSources(styles, sourceBucket) {\n return styles.map((style) => {\n if (style.source) return style;\n return Object.assign({}, style, {\n id: `${style.id}.${sourceBucket}`,\n source: (sourceBucket === 'hot') ? Constants.sources.HOT : Constants.sources.COLD\n });\n });\n}\n\nexport default function(options = {}) {\n let withDefaults = Object.assign({}, options);\n\n if (!options.controls) {\n withDefaults.controls = {};\n }\n\n if (options.displayControlsDefault === false) {\n withDefaults.controls = Object.assign({}, hideControls, options.controls);\n } else {\n withDefaults.controls = Object.assign({}, showControls, options.controls);\n }\n\n withDefaults = Object.assign({}, defaultOptions, withDefaults);\n\n // Layers with a shared source should be adjacent for performance reasons\n withDefaults.styles = addSources(withDefaults.styles, 'cold').concat(addSources(withDefaults.styles, 'hot'));\n\n return withDefaults;\n}\n","module.exports = normalize;\n\nvar types = {\n Point: 'geometry',\n MultiPoint: 'geometry',\n LineString: 'geometry',\n MultiLineString: 'geometry',\n Polygon: 'geometry',\n MultiPolygon: 'geometry',\n GeometryCollection: 'geometry',\n Feature: 'feature',\n FeatureCollection: 'featurecollection'\n};\n\n/**\n * Normalize a GeoJSON feature into a FeatureCollection.\n *\n * @param {object} gj geojson data\n * @returns {object} normalized geojson data\n */\nfunction normalize(gj) {\n if (!gj || !gj.type) return null;\n var type = types[gj.type];\n if (!type) return null;\n\n if (type === 'geometry') {\n return {\n type: 'FeatureCollection',\n features: [{\n type: 'Feature',\n properties: {},\n geometry: gj\n }]\n };\n } else if (type === 'feature') {\n return {\n type: 'FeatureCollection',\n features: [gj]\n };\n } else if (type === 'featurecollection') {\n return gj;\n }\n}\n","export default function(a, b) {\n if (a.length !== b.length) return false;\n return JSON.stringify(a.map(id => id).sort()) === JSON.stringify(b.map(id => id).sort());\n}\n","import isEqual from 'fast-deep-equal';\nimport normalize from '@mapbox/geojson-normalize';\nimport {generateID} from './lib/id.js';\nimport featuresAt from './lib/features_at.js';\nimport stringSetsAreEqual from './lib/string_sets_are_equal.js';\nimport * as Constants from './constants.js';\nimport StringSet from './lib/string_set.js';\n\nimport Polygon from './feature_types/polygon.js';\nimport LineString from './feature_types/line_string.js';\nimport Point from './feature_types/point.js';\nimport MultiFeature from './feature_types/multi_feature.js';\n\nconst featureTypes = {\n Polygon,\n LineString,\n Point,\n MultiPolygon: MultiFeature,\n MultiLineString: MultiFeature,\n MultiPoint: MultiFeature\n};\n\nexport default function(ctx, api) {\n api.modes = Constants.modes;\n\n // API doesn't emit events by default\n const silent = ctx.options.suppressAPIEvents !== undefined ? !!ctx.options.suppressAPIEvents : true;\n\n api.getFeatureIdsAt = function(point) {\n const features = featuresAt.click({ point }, null, ctx);\n return features.map(feature => feature.properties.id);\n };\n\n api.getSelectedIds = function() {\n return ctx.store.getSelectedIds();\n };\n\n api.getSelected = function() {\n return {\n type: Constants.geojsonTypes.FEATURE_COLLECTION,\n features: ctx.store.getSelectedIds().map(id => ctx.store.get(id)).map(feature => feature.toGeoJSON())\n };\n };\n\n api.getSelectedPoints = function() {\n return {\n type: Constants.geojsonTypes.FEATURE_COLLECTION,\n features: ctx.store.getSelectedCoordinates().map(coordinate => ({\n type: Constants.geojsonTypes.FEATURE,\n properties: {},\n geometry: {\n type: Constants.geojsonTypes.POINT,\n coordinates: coordinate.coordinates\n }\n }))\n };\n };\n\n api.set = function(featureCollection) {\n if (featureCollection.type === undefined || featureCollection.type !== Constants.geojsonTypes.FEATURE_COLLECTION || !Array.isArray(featureCollection.features)) {\n throw new Error('Invalid FeatureCollection');\n }\n const renderBatch = ctx.store.createRenderBatch();\n let toDelete = ctx.store.getAllIds().slice();\n const newIds = api.add(featureCollection);\n const newIdsLookup = new StringSet(newIds);\n\n toDelete = toDelete.filter(id => !newIdsLookup.has(id));\n if (toDelete.length) {\n api.delete(toDelete);\n }\n\n renderBatch();\n return newIds;\n };\n\n api.add = function(geojson) {\n const featureCollection = JSON.parse(JSON.stringify(normalize(geojson)));\n\n const ids = featureCollection.features.map((feature) => {\n feature.id = feature.id || generateID();\n\n if (feature.geometry === null) {\n throw new Error('Invalid geometry: null');\n }\n\n if (ctx.store.get(feature.id) === undefined || ctx.store.get(feature.id).type !== feature.geometry.type) {\n // If the feature has not yet been created ...\n const Model = featureTypes[feature.geometry.type];\n if (Model === undefined) {\n throw new Error(`Invalid geometry type: ${feature.geometry.type}.`);\n }\n const internalFeature = new Model(ctx, feature);\n ctx.store.add(internalFeature, { silent });\n } else {\n // If a feature of that id has already been created, and we are swapping it out ...\n const internalFeature = ctx.store.get(feature.id);\n const originalProperties = internalFeature.properties;\n internalFeature.properties = feature.properties;\n if (!isEqual(originalProperties, feature.properties)) {\n ctx.store.featureChanged(internalFeature.id, { silent });\n }\n if (!isEqual(internalFeature.getCoordinates(), feature.geometry.coordinates)) {\n internalFeature.incomingCoords(feature.geometry.coordinates);\n }\n }\n return feature.id;\n });\n\n ctx.store.render();\n return ids;\n };\n\n\n api.get = function(id) {\n const feature = ctx.store.get(id);\n if (feature) {\n return feature.toGeoJSON();\n }\n };\n\n api.getAll = function() {\n return {\n type: Constants.geojsonTypes.FEATURE_COLLECTION,\n features: ctx.store.getAll().map(feature => feature.toGeoJSON())\n };\n };\n\n api.delete = function(featureIds) {\n ctx.store.delete(featureIds, { silent });\n // If we were in direct select mode and our selected feature no longer exists\n // (because it was deleted), we need to get out of that mode.\n if (api.getMode() === Constants.modes.DIRECT_SELECT && !ctx.store.getSelectedIds().length) {\n ctx.events.changeMode(Constants.modes.SIMPLE_SELECT, undefined, { silent });\n } else {\n ctx.store.render();\n }\n\n return api;\n };\n\n api.deleteAll = function() {\n ctx.store.delete(ctx.store.getAllIds(), { silent });\n // If we were in direct select mode, now our selected feature no longer exists,\n // so escape that mode.\n if (api.getMode() === Constants.modes.DIRECT_SELECT) {\n ctx.events.changeMode(Constants.modes.SIMPLE_SELECT, undefined, { silent });\n } else {\n ctx.store.render();\n }\n\n return api;\n };\n\n api.changeMode = function(mode, modeOptions = {}) {\n // Avoid changing modes just to re-select what's already selected\n if (mode === Constants.modes.SIMPLE_SELECT && api.getMode() === Constants.modes.SIMPLE_SELECT) {\n if (stringSetsAreEqual((modeOptions.featureIds || []), ctx.store.getSelectedIds())) return api;\n // And if we are changing the selection within simple_select mode, just change the selection,\n // instead of stopping and re-starting the mode\n ctx.store.setSelected(modeOptions.featureIds, { silent });\n ctx.store.render();\n return api;\n }\n\n if (mode === Constants.modes.DIRECT_SELECT && api.getMode() === Constants.modes.DIRECT_SELECT &&\n modeOptions.featureId === ctx.store.getSelectedIds()[0]) {\n return api;\n }\n\n ctx.events.changeMode(mode, modeOptions, { silent });\n return api;\n };\n\n api.getMode = function() {\n return ctx.events.getMode();\n };\n\n api.trash = function() {\n ctx.events.trash({ silent });\n return api;\n };\n\n api.combineFeatures = function() {\n ctx.events.combineFeatures({ silent });\n return api;\n };\n\n api.uncombineFeatures = function() {\n ctx.events.uncombineFeatures({ silent });\n return api;\n };\n\n api.setFeatureProperty = function(featureId, property, value) {\n ctx.store.setFeatureProperty(featureId, property, value, { silent });\n return api;\n };\n\n return api;\n}\n","import runSetup from './src/setup.js';\nimport setupOptions from './src/options.js';\nimport setupAPI from './src/api.js';\nimport modes from './src/modes/index.js';\nimport * as Constants from './src/constants.js';\nimport * as lib from './src/lib/index.js';\n\nconst setupDraw = function(options, api) {\n options = setupOptions(options);\n\n const ctx = {\n options\n };\n\n api = setupAPI(ctx, api);\n ctx.api = api;\n\n const setup = runSetup(ctx);\n\n api.onAdd = setup.onAdd;\n api.onRemove = setup.onRemove;\n api.types = Constants.types;\n api.options = options;\n\n return api;\n};\n\nfunction MapboxDraw(options) {\n setupDraw(options, this);\n}\n\nMapboxDraw.modes = modes;\nMapboxDraw.constants = Constants;\nMapboxDraw.lib = lib;\n\nexport default MapboxDraw;\n"],"names":["ModeHandler","mode","DrawContext","handlers","ctx","event","selector","fn","id","delegate","eventName","handles","iHandle","handle","wgs84","require$$0","geojsonArea","geometry","ringArea","_","area","i","polygonArea","coords","p1","p2","p3","lowerIndex","middleIndex","upperIndex","coordsLength","rad","classes","sources","cursors","types","geojsonTypes","modes","events","updateActions","meta","activeStates","interactions","LAT_MIN","LAT_RENDERED_MIN","LAT_MAX","LAT_RENDERED_MAX","LNG_MIN","LNG_MAX","FEATURE_SORT_RANKS","comparator","a","b","score","Constants.geojsonTypes","sortFeatures","features","feature","mapEventToBoundingBox","mapEvent","buffer","StringSet","items","l","x","values","k","META_TYPES","Constants.meta","featuresAt","featuresAtClick","featuresAtTouch","bbox","box","queryParams","s","featureIds","uniqueFeatures","featureId","getFeatureAtAndSetCursors","Constants.cursors","Constants.activeStates","euclideanDistance","y","FINE_TOLERANCE","GROSS_TOLERANCE","INTERVAL","isClick","start","end","options","fineTolerance","grossTolerance","interval","moveDistance","TAP_TOLERANCE","TAP_INTERVAL","isTap","tolerance","customAlphabet","alphabet","defaultSize","size","nanoid","generateID","Feature","geojson","property","value","properties","name","Point","pathOrLng","lngOrLat","lat","LineString","path","lng","Polygon","ring","ids","parts","ringId","coordId","models","MultiPoint","MultiLineString","MultiPolygon","takeAction","action","idx","tail","MultiFeature","coordinates","Model","f","ModeInterface","m","c","opts","actions","newSet","eventOpts","eventData","bufferType","type","eventMapper","eventKeys","objectToMode","modeObject","modeObjectKeys","startOpts","state","wrapper","eh","e","key","modeHandler","push","mouseDownInfo","touchStartInfo","currentModeName","currentMode","isDrag","endInfo","target","getFeaturesAndSetCursor","isKeyModeValid","code","Constants.classes","changeMode","Constants.modes","setup","map","store","style","modename","nextModeOptions","eventOptions","modebuilder","setupModeHandler","Constants.events","actionState","actionable","changed","toDenseArray","render","Constants.sources","cleanup","newHotIds","newColdIds","lastColdCount","coldChanged","renderFeature","source","featureInternal","Store","renderRequest","coordinate","holdRender","numRenders","Constants.updateActions","deletedFeaturesToEmit","refreshSelectedCoordinates","newSelectedCoordinates","point","Constants.interactions","interaction","classTypes","ui","buttonElements","activeButton","currentMapClasses","nextMapClasses","clearMapClasses","queueMapClasses","updateMapClasses","classesToRemove","classesToAdd","createControlButton","button","deactivateButtons","setActiveButton","addButtons","controls","controlGroup","Constants.types","removeButtons","buttonId","runSetup","controlContainer","mapLoadedInterval","dragPanIsEnabled","blue","orange","white","styles","isOfMetaType","featureTarget","isShiftMousedown","isActiveFeature","isInactiveFeature","noTarget","isFeature","isVertex","isShiftDown","isEscapeKey","isEnterKey","isTrue","p","other","dx","dy","angle","cos","sin","mouseEventPoint","mouseEvent","container","rect","createVertex","parentId","selected","createMidpoint","parent","startVertex","endVertex","startCoord","endCoord","Constants.LAT_RENDERED_MAX","Constants.LAT_RENDERED_MIN","mid","createSupplementaryPoints","basePath","supplementaryPoints","isSelectedPath","line","lineIndex","processLine","processMultiGeometry","lineBasePath","firstPointString","lastVertex","pointIndex","pointPath","vertex","midpoint","stringifiedPoint","subType","subCoordinates","index","subFeature","doubleClickZoom","Constants","extent","depth","lngs","coord","lats","min","vals","max","constrainFeatureMovement","geojsonFeatures","delta","northInnerEdge","southInnerEdge","northOuterEdge","southOuterEdge","westEdge","eastEdge","bounds","featureSouthEdge","featureNorthEdge","featureWestEdge","featureEastEdge","constrainedDelta","moveFeatures","currentCoordinates","moveCoordinate","moveRing","moveMultiPolygon","multi","nextCoordinates","SimpleSelect","selectedFeatures","multiFeatures","combineFeatures","featureType","uncombineFeatures","trash","allFeatures","memo","CommonSelectors.isFeature","CommonSelectors.noTarget","CommonSelectors.isOfMetaType","wasSelected","isShiftClick","CommonSelectors.isShiftDown","selectedFeatureIds","isFeatureSelected","CommonSelectors.isActiveFeature","CommonSelectors.isShiftMousedown","current","minX","maxX","minY","maxY","translateValue","featuresInBox","idsToSelect","display","featuresCombined","subcoords","multiFeature","createdFeatures","featuresUncombined","isMidpoint","DirectSelect","about","selectedIndex","selectedCoordinates","paths","coord_path","selectedCoords","selectedCoordPoints","onVertex","isMidPoint","noCoords","DrawPoint","isActivePoint","CommonSelectors.isEscapeKey","CommonSelectors.isEnterKey","isEventAtCoordinates","DrawPolygon","polygon","CommonSelectors.isVertex","isActivePolygon","coordinateCount","endPos","lineCoordinates","DrawLineString","currentVertexPosition","direction","from","lastCoord","isActiveLine","simple_select","direct_select","draw_point","draw_polygon","draw_line_string","defaultOptions","showControls","hideControls","addSources","sourceBucket","setupOptions","withDefaults","geojsonNormalize","normalize","gj","stringSetsAreEqual","featureTypes","setupAPI","api","silent","featureCollection","renderBatch","toDelete","newIds","newIdsLookup","internalFeature","originalProperties","isEqual","modeOptions","setupDraw","MapboxDraw","lib"],"mappings":"qmCACA,MAAMA,GAAc,SAASC,EAAMC,EAAa,CAE9C,MAAMC,EAAW,CACf,KAAM,CAAE,EACR,MAAO,CAAE,EACT,UAAW,CAAE,EACb,UAAW,CAAE,EACb,QAAS,CAAE,EACX,SAAU,CAAE,EACZ,QAAS,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