{"version":3,"file":"mapbox-gl-draw.js","sources":["../src/lib/mode_handler.js","../node_modules/wgs84/index.js","../node_modules/@mapbox/geojson-area/index.js","../src/constants.js","../src/lib/sort_features.js","../src/lib/map_event_to_bounding_box.js","../src/lib/string_set.js","../src/lib/features_at.js","../src/lib/get_features_and_set_cursor.js","../src/lib/euclidean_distance.js","../src/lib/is_click.js","../src/lib/is_tap.js","../node_modules/hat/index.js","../src/feature_types/feature.js","../src/feature_types/point.js","../src/feature_types/line_string.js","../src/feature_types/polygon.js","../src/feature_types/multi_feature.js","../src/modes/mode_interface_accessors.js","../src/modes/mode_interface.js","../src/modes/object_to_mode.js","../src/lib/to_dense_array.js","../src/render.js","../src/store.js","../node_modules/xtend/immutable.js","../src/ui.js","../src/setup.js","../src/events.js","../src/lib/theme.js","../src/lib/common_selectors.js","../node_modules/@mapbox/point-geometry/index.js","../src/lib/mouse_event_point.js","../src/lib/create_vertex.js","../src/lib/create_midpoint.js","../src/lib/create_supplementary_points.js","../src/lib/double_click_zoom.js","../node_modules/@mapbox/geojson-normalize/index.js","../node_modules/geojson-flatten/dist/index.es.js","../node_modules/@mapbox/geojson-coords/index.js","../node_modules/@mapbox/geojson-coords/flatten.js","../node_modules/traverse/index.js","../node_modules/@mapbox/extent/index.js","../node_modules/@mapbox/geojson-extent/index.js","../src/lib/constrain_feature_movement.js","../src/lib/move_features.js","../src/modes/simple_select.js","../src/modes/direct_select.js","../src/modes/draw_point.js","../src/lib/is_event_at_coordinates.js","../src/modes/draw_polygon.js","../src/modes/draw_line_string.js","../src/modes/index.js","../src/options.js","../node_modules/lodash.isequal/index.js","../src/lib/string_sets_are_equal.js","../src/api.js","../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","module.exports.RADIUS = 6378137;\nmodule.exports.FLATTENING = 1/298.257223563;\nmodule.exports.POLAR_RADIUS = 6356752.3142;\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 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 STATIC: 'static'\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_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';\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';\nimport mapEventToBoundingBox from './map_event_to_bounding_box';\nimport * as Constants from '../constants';\nimport StringSet from './string_set';\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';\nimport * as Constants from '../constants';\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';\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';\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","var hat = module.exports = function (bits, base) {\n if (!base) base = 16;\n if (bits === undefined) bits = 128;\n if (bits <= 0) return '0';\n \n var digits = Math.log(Math.pow(2, bits)) / Math.log(base);\n for (var i = 2; digits === Infinity; i *= 2) {\n digits = Math.log(Math.pow(2, bits / i)) / Math.log(base) * i;\n }\n \n var rem = digits - Math.floor(digits);\n \n var res = '';\n \n for (var i = 0; i < Math.floor(digits); i++) {\n var x = Math.floor(Math.random() * base).toString(base);\n res = x + res;\n }\n \n if (rem) {\n var b = Math.pow(base, rem);\n var x = Math.floor(Math.random() * b).toString(base);\n res = x + res;\n }\n \n var parsed = parseInt(res, base);\n if (parsed !== Infinity && parsed >= Math.pow(2, bits)) {\n return hat(bits, base)\n }\n else return res;\n};\n\nhat.rack = function (bits, base, expandBy) {\n var fn = function (data) {\n var iters = 0;\n do {\n if (iters ++ > 10) {\n if (expandBy) bits += expandBy;\n else throw new Error('too many ID collisions, use more bits')\n }\n \n var id = hat(bits, base);\n } while (Object.hasOwnProperty.call(hats, id));\n \n hats[id] = data;\n return id;\n };\n var hats = fn.hats = {};\n \n fn.get = function (id) {\n return fn.hats[id];\n };\n \n fn.set = function (id, value) {\n fn.hats[id] = value;\n return fn;\n };\n \n fn.bits = bits || 128;\n fn.base = base || 16;\n return fn;\n};\n","import hat from 'hat';\nimport * as Constants from '../constants';\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 || hat();\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';\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';\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';\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 Feature from './feature';\nimport * as Constants from '../constants';\nimport hat from 'hat';\n\nimport MultiPoint from './point';\nimport MultiLineString from './line_string';\nimport MultiPolygon from './polygon';\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: hat(),\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';\nimport featuresAt from '../lib/features_at';\nimport Point from '../feature_types/point';\nimport LineString from '../feature_types/line_string';\nimport Polygon from '../feature_types/polygon';\nimport MultiFeature from '../feature_types/multi_feature';\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) {\n return this._ctx.store.add(feature);\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 * 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';\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';\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","/**\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';\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 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 if (store._emitSelectionChange) {\n store.ctx.map.fire(Constants.events.SELECTION_CHANGE, {\n features: store.getSelected().map(feature => feature.toGeoJSON()),\n points: 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 store._emitSelectionChange = false;\n }\n\n if (store._deletedFeaturesToEmit.length) {\n const geojsonToEmit = store._deletedFeaturesToEmit.map(feature => feature.toGeoJSON());\n\n store._deletedFeaturesToEmit = [];\n\n store.ctx.map.fire(Constants.events.DELETE, {\n features: geojsonToEmit\n });\n }\n\n cleanup();\n store.ctx.map.fire(Constants.events.RENDER, {});\n\n function cleanup() {\n store.isDirty = false;\n store.clearChangedIds();\n }\n}\n","import toDenseArray from './lib/to_dense_array';\nimport StringSet from './lib/string_set';\nimport render from './render';\nimport {interactions} from './constants';\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._deletedFeaturesToEmit = [];\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 }\n };\n this.isDirty = false;\n}\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.featureChanged = function(featureId) {\n this._changedFeatureIds.add(featureId);\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 *\n * @return {Store} this\n */\nStore.prototype.add = function(feature) {\n this.featureChanged(feature.id);\n this._features[feature.id] = feature;\n this._featureIds.add(feature.id);\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 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 (this._deletedFeaturesToEmit.indexOf(this._features[id]) === -1) {\n this._deletedFeaturesToEmit.push(this._features[id]);\n }\n }\n delete this._features[id];\n this.isDirty = true;\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._selectedFeatureIds.values().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*/\nStore.prototype.setFeatureProperty = function(featureId, property, value) {\n this.get(featureId).setProperty(property, value);\n this.featureChanged(featureId);\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 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","module.exports = extend\n\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\nfunction extend() {\n var target = {}\n\n for (var i = 0; i < arguments.length; i++) {\n var source = arguments[i]\n\n for (var key in source) {\n if (hasOwnProperty.call(source, key)) {\n target[key] = source[key]\n }\n }\n }\n\n return target\n}\n","import xtend from 'xtend';\nimport * as Constants from './constants';\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 = xtend(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 = xtend(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';\nimport Store from './store';\nimport ui from './ui';\nimport * as Constants from './constants';\nimport xtend from 'xtend';\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 if (process.env.NODE_ENV !== 'test') {\n // Monkey patch to resolve breaking change to `fire` introduced by\n // mapbox-gl-js. See mapbox/mapbox-gl-draw/issues/766.\n const _fire = map.fire;\n map.fire = function(type, event) {\n // eslint-disable-next-line\n let args = arguments;\n\n if (_fire.length === 1 && arguments.length !== 1) {\n args = [xtend({}, { type }, event)];\n }\n\n return _fire.apply(map, args);\n };\n }\n\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 // 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 }\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","import setupModeHandler from './lib/mode_handler';\nimport getFeaturesAndSetCursor from './lib/get_features_and_set_cursor';\nimport featuresAt from './lib/features_at';\nimport isClick from './lib/is_click';\nimport isTap from './lib/is_tap';\nimport * as Constants from './constants';\nimport objectToMode from './modes/object_to_mode';\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('mapboxgl-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(name, event) {\n if (events[name]) {\n events[name](event);\n }\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","export default [\n {\n 'id': 'gl-draw-polygon-fill-inactive',\n 'type': 'fill',\n 'filter': ['all',\n ['==', 'active', 'false'],\n ['==', '$type', 'Polygon'],\n ['!=', 'mode', 'static']\n ],\n 'paint': {\n 'fill-color': '#3bb2d0',\n 'fill-outline-color': '#3bb2d0',\n 'fill-opacity': 0.1\n }\n },\n {\n 'id': 'gl-draw-polygon-fill-active',\n 'type': 'fill',\n 'filter': ['all', ['==', 'active', 'true'], ['==', '$type', 'Polygon']],\n 'paint': {\n 'fill-color': '#fbb03b',\n 'fill-outline-color': '#fbb03b',\n 'fill-opacity': 0.1\n }\n },\n {\n 'id': 'gl-draw-polygon-midpoint',\n 'type': 'circle',\n 'filter': ['all',\n ['==', '$type', 'Point'],\n ['==', 'meta', 'midpoint']],\n 'paint': {\n 'circle-radius': 3,\n 'circle-color': '#fbb03b'\n }\n },\n {\n 'id': 'gl-draw-polygon-stroke-inactive',\n 'type': 'line',\n 'filter': ['all',\n ['==', 'active', 'false'],\n ['==', '$type', 'Polygon'],\n ['!=', 'mode', 'static']\n ],\n 'layout': {\n 'line-cap': 'round',\n 'line-join': 'round'\n },\n 'paint': {\n 'line-color': '#3bb2d0',\n 'line-width': 2\n }\n },\n {\n 'id': 'gl-draw-polygon-stroke-active',\n 'type': 'line',\n 'filter': ['all', ['==', 'active', 'true'], ['==', '$type', 'Polygon']],\n 'layout': {\n 'line-cap': 'round',\n 'line-join': 'round'\n },\n 'paint': {\n 'line-color': '#fbb03b',\n 'line-dasharray': [0.2, 2],\n 'line-width': 2\n }\n },\n {\n 'id': 'gl-draw-line-inactive',\n 'type': 'line',\n 'filter': ['all',\n ['==', 'active', 'false'],\n ['==', '$type', 'LineString'],\n ['!=', 'mode', 'static']\n ],\n 'layout': {\n 'line-cap': 'round',\n 'line-join': 'round'\n },\n 'paint': {\n 'line-color': '#3bb2d0',\n 'line-width': 2\n }\n },\n {\n 'id': 'gl-draw-line-active',\n 'type': 'line',\n 'filter': ['all',\n ['==', '$type', 'LineString'],\n ['==', 'active', 'true']\n ],\n 'layout': {\n 'line-cap': 'round',\n 'line-join': 'round'\n },\n 'paint': {\n 'line-color': '#fbb03b',\n 'line-dasharray': [0.2, 2],\n 'line-width': 2\n }\n },\n {\n 'id': 'gl-draw-polygon-and-line-vertex-stroke-inactive',\n 'type': 'circle',\n 'filter': ['all',\n ['==', 'meta', 'vertex'],\n ['==', '$type', 'Point'],\n ['!=', 'mode', 'static']\n ],\n 'paint': {\n 'circle-radius': 5,\n 'circle-color': '#fff'\n }\n },\n {\n 'id': 'gl-draw-polygon-and-line-vertex-inactive',\n 'type': 'circle',\n 'filter': ['all',\n ['==', 'meta', 'vertex'],\n ['==', '$type', 'Point'],\n ['!=', 'mode', 'static']\n ],\n 'paint': {\n 'circle-radius': 3,\n 'circle-color': '#fbb03b'\n }\n },\n {\n 'id': 'gl-draw-point-point-stroke-inactive',\n 'type': 'circle',\n 'filter': ['all',\n ['==', 'active', 'false'],\n ['==', '$type', 'Point'],\n ['==', 'meta', 'feature'],\n ['!=', 'mode', 'static']\n ],\n 'paint': {\n 'circle-radius': 5,\n 'circle-opacity': 1,\n 'circle-color': '#fff'\n }\n },\n {\n 'id': 'gl-draw-point-inactive',\n 'type': 'circle',\n 'filter': ['all',\n ['==', 'active', 'false'],\n ['==', '$type', 'Point'],\n ['==', 'meta', 'feature'],\n ['!=', 'mode', 'static']\n ],\n 'paint': {\n 'circle-radius': 3,\n 'circle-color': '#3bb2d0'\n }\n },\n {\n 'id': 'gl-draw-point-stroke-active',\n 'type': 'circle',\n 'filter': ['all',\n ['==', '$type', 'Point'],\n ['==', 'active', 'true'],\n ['!=', 'meta', 'midpoint']\n ],\n 'paint': {\n 'circle-radius': 7,\n 'circle-color': '#fff'\n }\n },\n {\n 'id': 'gl-draw-point-active',\n 'type': 'circle',\n 'filter': ['all',\n ['==', '$type', 'Point'],\n ['!=', 'meta', 'midpoint'],\n ['==', 'active', 'true']],\n 'paint': {\n 'circle-radius': 5,\n 'circle-color': '#fbb03b'\n }\n },\n {\n 'id': 'gl-draw-polygon-fill-static',\n 'type': 'fill',\n 'filter': ['all', ['==', 'mode', 'static'], ['==', '$type', 'Polygon']],\n 'paint': {\n 'fill-color': '#404040',\n 'fill-outline-color': '#404040',\n 'fill-opacity': 0.1\n }\n },\n {\n 'id': 'gl-draw-polygon-stroke-static',\n 'type': 'line',\n 'filter': ['all', ['==', 'mode', 'static'], ['==', '$type', 'Polygon']],\n 'layout': {\n 'line-cap': 'round',\n 'line-join': 'round'\n },\n 'paint': {\n 'line-color': '#404040',\n 'line-width': 2\n }\n },\n {\n 'id': 'gl-draw-line-static',\n 'type': 'line',\n 'filter': ['all', ['==', 'mode', 'static'], ['==', '$type', 'LineString']],\n 'layout': {\n 'line-cap': 'round',\n 'line-join': 'round'\n },\n 'paint': {\n 'line-color': '#404040',\n 'line-width': 2\n }\n },\n {\n 'id': 'gl-draw-point-static',\n 'type': 'circle',\n 'filter': ['all', ['==', 'mode', 'static'], ['==', '$type', 'Point']],\n 'paint': {\n 'circle-radius': 5,\n 'circle-color': '#404040'\n }\n }\n];\n","import * as Constants from '../constants';\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","'use strict';\n\nmodule.exports = Point;\n\n/**\n * A standalone point geometry with useful accessor, comparison, and\n * modification methods.\n *\n * @class Point\n * @param {Number} x the x-coordinate. this could be longitude or screen\n * pixels, or any other sort of unit.\n * @param {Number} y the y-coordinate. this could be latitude or screen\n * pixels, or any other sort of unit.\n * @example\n * var point = new Point(-77, 38);\n */\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n}\n\nPoint.prototype = {\n\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: function() { 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: function(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: function(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: function(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: function(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 {Point} k factor\n * @return {Point} output point\n */\n mult: function(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 {Point} k factor\n * @return {Point} output point\n */\n div: function(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: function(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: function(a,p) { return this.clone()._rotateAround(a,p); },\n\n /**\n * Multiply this point by a 4x1 transformation matrix\n * @param {Array} m transformation matrix\n * @return {Point} output point\n */\n matMult: function(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: function() { 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: function() { 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: function() { return this.clone()._round(); },\n\n /**\n * Return the magitude 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: function() {\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: function(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: function(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: function(p) {\n var 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: function() {\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: function(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: function(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: function(x, y) {\n return Math.atan2(\n this.x * y - this.y * x,\n this.x * x + this.y * y);\n },\n\n _matMult: function(m) {\n var 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 _add: function(p) {\n this.x += p.x;\n this.y += p.y;\n return this;\n },\n\n _sub: function(p) {\n this.x -= p.x;\n this.y -= p.y;\n return this;\n },\n\n _mult: function(k) {\n this.x *= k;\n this.y *= k;\n return this;\n },\n\n _div: function(k) {\n this.x /= k;\n this.y /= k;\n return this;\n },\n\n _multByPoint: function(p) {\n this.x *= p.x;\n this.y *= p.y;\n return this;\n },\n\n _divByPoint: function(p) {\n this.x /= p.x;\n this.y /= p.y;\n return this;\n },\n\n _unit: function() {\n this._div(this.mag());\n return this;\n },\n\n _perp: function() {\n var y = this.y;\n this.y = this.x;\n this.x = -y;\n return this;\n },\n\n _rotate: function(angle) {\n var 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 _rotateAround: function(angle, p) {\n var 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: function() {\n this.x = Math.round(this.x);\n this.y = Math.round(this.y);\n return this;\n }\n};\n\n/**\n * Construct a point from an array if necessary, otherwise if the input\n * is already a Point, or an unknown type, return it unchanged\n * @param {Array|Point|*} a any kind of input value\n * @return {Point} constructed point, or passed-through value.\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 (a) {\n if (a instanceof Point) {\n return a;\n }\n if (Array.isArray(a)) {\n return new Point(a[0], a[1]);\n }\n return a;\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';\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 */\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';\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';\nimport createMidpoint from './create_midpoint';\nimport * as Constants from '../constants';\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","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 e(t){switch(t&&t.type||null){case\"FeatureCollection\":return t.features=t.features.reduce(function(t,r){return t.concat(e(r))},[]),t;case\"Feature\":return t.geometry?e(t.geometry).map(function(e){var r={type:\"Feature\",properties:JSON.parse(JSON.stringify(t.properties)),geometry:e};return void 0!==t.id&&(r.id=t.id),r}):[t];case\"MultiPoint\":return t.coordinates.map(function(e){return{type:\"Point\",coordinates:e}});case\"MultiPolygon\":return t.coordinates.map(function(e){return{type:\"Polygon\",coordinates:e}});case\"MultiLineString\":return t.coordinates.map(function(e){return{type:\"LineString\",coordinates:e}});case\"GeometryCollection\":return t.geometries.map(e).reduce(function(e,t){return e.concat(t)},[]);case\"Point\":case\"Polygon\":case\"LineString\":return[t]}}\n//# sourceMappingURL=index.es.js.map\n","var geojsonNormalize = require('@mapbox/geojson-normalize'),\n geojsonFlatten = require('geojson-flatten'),\n flatten = require('./flatten');\n\nif (!(geojsonFlatten instanceof Function)) geojsonFlatten = geojsonFlatten.default;\n\nmodule.exports = function(_) {\n if (!_) return [];\n var normalized = geojsonFlatten(geojsonNormalize(_)),\n coordinates = [];\n normalized.features.forEach(function(feature) {\n if (!feature.geometry) return;\n coordinates = coordinates.concat(flatten(feature.geometry.coordinates));\n });\n return coordinates;\n};\n","module.exports = function flatten(list) {\n return _flatten(list);\n\n function _flatten(list) {\n if (Array.isArray(list) && list.length &&\n typeof list[0] === 'number') {\n return [list];\n }\n return list.reduce(function (acc, item) {\n if (Array.isArray(item) && Array.isArray(item[0])) {\n return acc.concat(_flatten(item));\n } else {\n acc.push(item);\n return acc;\n }\n }, []);\n }\n};\n","var traverse = module.exports = function (obj) {\n return new Traverse(obj);\n};\n\nfunction Traverse (obj) {\n this.value = obj;\n}\n\nTraverse.prototype.get = function (ps) {\n var node = this.value;\n for (var i = 0; i < ps.length; i ++) {\n var key = ps[i];\n if (!node || !hasOwnProperty.call(node, key)) {\n node = undefined;\n break;\n }\n node = node[key];\n }\n return node;\n};\n\nTraverse.prototype.has = function (ps) {\n var node = this.value;\n for (var i = 0; i < ps.length; i ++) {\n var key = ps[i];\n if (!node || !hasOwnProperty.call(node, key)) {\n return false;\n }\n node = node[key];\n }\n return true;\n};\n\nTraverse.prototype.set = function (ps, value) {\n var node = this.value;\n for (var i = 0; i < ps.length - 1; i ++) {\n var key = ps[i];\n if (!hasOwnProperty.call(node, key)) node[key] = {};\n node = node[key];\n }\n node[ps[i]] = value;\n return value;\n};\n\nTraverse.prototype.map = function (cb) {\n return walk(this.value, cb, true);\n};\n\nTraverse.prototype.forEach = function (cb) {\n this.value = walk(this.value, cb, false);\n return this.value;\n};\n\nTraverse.prototype.reduce = function (cb, init) {\n var skip = arguments.length === 1;\n var acc = skip ? this.value : init;\n this.forEach(function (x) {\n if (!this.isRoot || !skip) {\n acc = cb.call(this, acc, x);\n }\n });\n return acc;\n};\n\nTraverse.prototype.paths = function () {\n var acc = [];\n this.forEach(function (x) {\n acc.push(this.path); \n });\n return acc;\n};\n\nTraverse.prototype.nodes = function () {\n var acc = [];\n this.forEach(function (x) {\n acc.push(this.node);\n });\n return acc;\n};\n\nTraverse.prototype.clone = function () {\n var parents = [], nodes = [];\n \n return (function clone (src) {\n for (var i = 0; i < parents.length; i++) {\n if (parents[i] === src) {\n return nodes[i];\n }\n }\n \n if (typeof src === 'object' && src !== null) {\n var dst = copy(src);\n \n parents.push(src);\n nodes.push(dst);\n \n forEach(objectKeys(src), function (key) {\n dst[key] = clone(src[key]);\n });\n \n parents.pop();\n nodes.pop();\n return dst;\n }\n else {\n return src;\n }\n })(this.value);\n};\n\nfunction walk (root, cb, immutable) {\n var path = [];\n var parents = [];\n var alive = true;\n \n return (function walker (node_) {\n var node = immutable ? copy(node_) : node_;\n var modifiers = {};\n \n var keepGoing = true;\n \n var state = {\n node : node,\n node_ : node_,\n path : [].concat(path),\n parent : parents[parents.length - 1],\n parents : parents,\n key : path.slice(-1)[0],\n isRoot : path.length === 0,\n level : path.length,\n circular : null,\n update : function (x, stopHere) {\n if (!state.isRoot) {\n state.parent.node[state.key] = x;\n }\n state.node = x;\n if (stopHere) keepGoing = false;\n },\n 'delete' : function (stopHere) {\n delete state.parent.node[state.key];\n if (stopHere) keepGoing = false;\n },\n remove : function (stopHere) {\n if (isArray(state.parent.node)) {\n state.parent.node.splice(state.key, 1);\n }\n else {\n delete state.parent.node[state.key];\n }\n if (stopHere) keepGoing = false;\n },\n keys : null,\n before : function (f) { modifiers.before = f },\n after : function (f) { modifiers.after = f },\n pre : function (f) { modifiers.pre = f },\n post : function (f) { modifiers.post = f },\n stop : function () { alive = false },\n block : function () { keepGoing = false }\n };\n \n if (!alive) return state;\n \n function updateState() {\n if (typeof state.node === 'object' && state.node !== null) {\n if (!state.keys || state.node_ !== state.node) {\n state.keys = objectKeys(state.node)\n }\n \n state.isLeaf = state.keys.length == 0;\n \n for (var i = 0; i < parents.length; i++) {\n if (parents[i].node_ === node_) {\n state.circular = parents[i];\n break;\n }\n }\n }\n else {\n state.isLeaf = true;\n state.keys = null;\n }\n \n state.notLeaf = !state.isLeaf;\n state.notRoot = !state.isRoot;\n }\n \n updateState();\n \n // use return values to update if defined\n var ret = cb.call(state, state.node);\n if (ret !== undefined && state.update) state.update(ret);\n \n if (modifiers.before) modifiers.before.call(state, state.node);\n \n if (!keepGoing) return state;\n \n if (typeof state.node == 'object'\n && state.node !== null && !state.circular) {\n parents.push(state);\n \n updateState();\n \n forEach(state.keys, function (key, i) {\n path.push(key);\n \n if (modifiers.pre) modifiers.pre.call(state, state.node[key], key);\n \n var child = walker(state.node[key]);\n if (immutable && hasOwnProperty.call(state.node, key)) {\n state.node[key] = child.node;\n }\n \n child.isLast = i == state.keys.length - 1;\n child.isFirst = i == 0;\n \n if (modifiers.post) modifiers.post.call(state, child);\n \n path.pop();\n });\n parents.pop();\n }\n \n if (modifiers.after) modifiers.after.call(state, state.node);\n \n return state;\n })(root).node;\n}\n\nfunction copy (src) {\n if (typeof src === 'object' && src !== null) {\n var dst;\n \n if (isArray(src)) {\n dst = [];\n }\n else if (isDate(src)) {\n dst = new Date(src.getTime ? src.getTime() : src);\n }\n else if (isRegExp(src)) {\n dst = new RegExp(src);\n }\n else if (isError(src)) {\n dst = { message: src.message };\n }\n else if (isBoolean(src)) {\n dst = new Boolean(src);\n }\n else if (isNumber(src)) {\n dst = new Number(src);\n }\n else if (isString(src)) {\n dst = new String(src);\n }\n else if (Object.create && Object.getPrototypeOf) {\n dst = Object.create(Object.getPrototypeOf(src));\n }\n else if (src.constructor === Object) {\n dst = {};\n }\n else {\n var proto =\n (src.constructor && src.constructor.prototype)\n || src.__proto__\n || {}\n ;\n var T = function () {};\n T.prototype = proto;\n dst = new T;\n }\n \n forEach(objectKeys(src), function (key) {\n dst[key] = src[key];\n });\n return dst;\n }\n else return src;\n}\n\nvar objectKeys = Object.keys || function keys (obj) {\n var res = [];\n for (var key in obj) res.push(key)\n return res;\n};\n\nfunction toS (obj) { return Object.prototype.toString.call(obj) }\nfunction isDate (obj) { return toS(obj) === '[object Date]' }\nfunction isRegExp (obj) { return toS(obj) === '[object RegExp]' }\nfunction isError (obj) { return toS(obj) === '[object Error]' }\nfunction isBoolean (obj) { return toS(obj) === '[object Boolean]' }\nfunction isNumber (obj) { return toS(obj) === '[object Number]' }\nfunction isString (obj) { return toS(obj) === '[object String]' }\n\nvar isArray = Array.isArray || function isArray (xs) {\n return Object.prototype.toString.call(xs) === '[object Array]';\n};\n\nvar forEach = function (xs, fn) {\n if (xs.forEach) return xs.forEach(fn)\n else for (var i = 0; i < xs.length; i++) {\n fn(xs[i], i, xs);\n }\n};\n\nforEach(objectKeys(Traverse.prototype), function (key) {\n traverse[key] = function (obj) {\n var args = [].slice.call(arguments, 1);\n var t = new Traverse(obj);\n return t[key].apply(t, args);\n };\n});\n\nvar hasOwnProperty = Object.hasOwnProperty || function (obj, key) {\n return key in obj;\n};\n","module.exports = Extent;\n\nfunction Extent(bbox) {\n if (!(this instanceof Extent)) {\n return new Extent(bbox);\n }\n this._bbox = bbox || [Infinity, Infinity, -Infinity, -Infinity];\n this._valid = !!bbox;\n}\n\nExtent.prototype.include = function(ll) {\n this._valid = true;\n this._bbox[0] = Math.min(this._bbox[0], ll[0]);\n this._bbox[1] = Math.min(this._bbox[1], ll[1]);\n this._bbox[2] = Math.max(this._bbox[2], ll[0]);\n this._bbox[3] = Math.max(this._bbox[3], ll[1]);\n return this;\n};\n\nExtent.prototype.equals = function(_) {\n var other;\n if (_ instanceof Extent) { other = _.bbox(); } else { other = _; }\n return this._bbox[0] == other[0] &&\n this._bbox[1] == other[1] &&\n this._bbox[2] == other[2] &&\n this._bbox[3] == other[3];\n};\n\nExtent.prototype.center = function(_) {\n if (!this._valid) return null;\n return [\n (this._bbox[0] + this._bbox[2]) / 2,\n (this._bbox[1] + this._bbox[3]) / 2]\n};\n\nExtent.prototype.union = function(_) {\n this._valid = true;\n var other;\n if (_ instanceof Extent) { other = _.bbox(); } else { other = _; }\n this._bbox[0] = Math.min(this._bbox[0], other[0]);\n this._bbox[1] = Math.min(this._bbox[1], other[1]);\n this._bbox[2] = Math.max(this._bbox[2], other[2]);\n this._bbox[3] = Math.max(this._bbox[3], other[3]);\n return this;\n};\n\nExtent.prototype.bbox = function() {\n if (!this._valid) return null;\n return this._bbox;\n};\n\nExtent.prototype.contains = function(ll) {\n if (!ll) return this._fastContains();\n if (!this._valid) return null;\n var lon = ll[0], lat = ll[1];\n return this._bbox[0] <= lon &&\n this._bbox[1] <= lat &&\n this._bbox[2] >= lon &&\n this._bbox[3] >= lat;\n};\n\nExtent.prototype.intersect = function(_) {\n if (!this._valid) return null;\n\n var other;\n if (_ instanceof Extent) { other = _.bbox(); } else { other = _; }\n\n return !(\n this._bbox[0] > other[2] ||\n this._bbox[2] < other[0] ||\n this._bbox[3] < other[1] ||\n this._bbox[1] > other[3]\n );\n};\n\nExtent.prototype._fastContains = function() {\n if (!this._valid) return new Function('return null;');\n var body = 'return ' +\n this._bbox[0] + '<= ll[0] &&' +\n this._bbox[1] + '<= ll[1] &&' +\n this._bbox[2] + '>= ll[0] &&' +\n this._bbox[3] + '>= ll[1]';\n return new Function('ll', body);\n};\n\nExtent.prototype.polygon = function() {\n if (!this._valid) return null;\n return {\n type: 'Polygon',\n coordinates: [\n [\n // W, S\n [this._bbox[0], this._bbox[1]],\n // E, S\n [this._bbox[2], this._bbox[1]],\n // E, N\n [this._bbox[2], this._bbox[3]],\n // W, N\n [this._bbox[0], this._bbox[3]],\n // W, S\n [this._bbox[0], this._bbox[1]]\n ]\n ]\n };\n};\n","var geojsonCoords = require('@mapbox/geojson-coords'),\n traverse = require('traverse'),\n extent = require('@mapbox/extent');\n\nvar geojsonTypesByDataAttributes = {\n features: ['FeatureCollection'],\n coordinates: ['Point', 'MultiPoint', 'LineString', 'MultiLineString', 'Polygon', 'MultiPolygon'],\n geometry: ['Feature'],\n geometries: ['GeometryCollection']\n}\n\nvar dataAttributes = Object.keys(geojsonTypesByDataAttributes);\n\nmodule.exports = function(_) {\n return getExtent(_).bbox();\n};\n\nmodule.exports.polygon = function(_) {\n return getExtent(_).polygon();\n};\n\nmodule.exports.bboxify = function(_) {\n return traverse(_).map(function(value) {\n if (!value) return ;\n\n var isValid = dataAttributes.some(function(attribute){\n if(value[attribute]) {\n return geojsonTypesByDataAttributes[attribute].indexOf(value.type) !== -1;\n }\n return false;\n });\n\n if(isValid){\n value.bbox = getExtent(value).bbox();\n this.update(value);\n }\n\n });\n};\n\nfunction getExtent(_) {\n var ext = extent(),\n coords = geojsonCoords(_);\n for (var i = 0; i < coords.length; i++) ext.include(coords[i]);\n return ext;\n}\n","import extent from '@mapbox/geojson-extent';\nimport * as Constants from '../constants';\n\nconst {\n LAT_MIN,\n LAT_MAX,\n LAT_RENDERED_MIN,\n LAT_RENDERED_MAX,\n LNG_MIN,\n LNG_MAX\n} = Constants;\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';\nimport * as Constants from '../constants';\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';\nimport mouseEventPoint from '../lib/mouse_event_point';\nimport createSupplementaryPoints from '../lib/create_supplementary_points';\nimport StringSet from '../lib/string_set';\nimport doubleClickZoom from '../lib/double_click_zoom';\nimport moveFeatures from '../lib/move_features';\nimport * as Constants from '../constants';\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 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.map.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 this.map.dragPan.enable();\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 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.map.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.map.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';\nimport createSupplementaryPoints from '../lib/create_supplementary_points';\nimport constrainFeatureMovement from '../lib/constrain_feature_movement';\nimport doubleClickZoom from '../lib/double_click_zoom';\nimport * as Constants from '../constants';\nimport moveFeatures from '../lib/move_features';\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.map.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 this.map.dragPan.disable();\n state.canDragMove = true;\n state.dragMoveLocation = e.lngLat;\n};\n\nDirectSelect.stopDragging = function(state) {\n this.map.dragPan.enable();\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';\nimport * as Constants from '../constants';\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.map.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';\nimport doubleClickZoom from '../lib/double_click_zoom';\nimport * as Constants from '../constants';\nimport isEventAtCoordinates from '../lib/is_event_at_coordinates';\nimport createVertex from '../lib/create_vertex';\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.map.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';\nimport isEventAtCoordinates from '../lib/is_event_at_coordinates';\nimport doubleClickZoom from '../lib/double_click_zoom';\nimport * as Constants from '../constants';\nimport createVertex from '../lib/create_vertex';\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.map.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';\nimport direct_select from './direct_select';\nimport draw_point from './draw_point';\nimport draw_polygon from './draw_polygon';\nimport draw_line_string from './draw_line_string';\n\nexport default {\n simple_select,\n direct_select,\n draw_point,\n draw_polygon,\n draw_line_string,\n};\n","import xtend from 'xtend';\nimport * as Constants from './constants';\n\nimport styles from './lib/theme';\nimport modes from './modes/index';\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};\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 xtend(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 = xtend(options);\n\n if (!options.controls) {\n withDefaults.controls = {};\n }\n\n if (options.displayControlsDefault === false) {\n withDefaults.controls = xtend(hideControls, options.controls);\n } else {\n withDefaults.controls = xtend(showControls, options.controls);\n }\n\n withDefaults = xtend(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","/**\n * Lodash (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright JS Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n asyncTag = '[object AsyncFunction]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n nullTag = '[object Null]',\n objectTag = '[object Object]',\n promiseTag = '[object Promise]',\n proxyTag = '[object Proxy]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]',\n undefinedTag = '[object Undefined]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * A specialized version of `_.filter` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\nfunction arrayFilter(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result[resIndex++] = value;\n }\n }\n return result;\n}\n\n/**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\nfunction arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n}\n\n/**\n * A specialized version of `_.some` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\nfunction arraySome(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (predicate(array[index], index, array)) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\n/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\n/**\n * Checks if a `cache` value for `key` exists.\n *\n * @private\n * @param {Object} cache The cache to query.\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction cacheHas(cache, key) {\n return cache.has(key);\n}\n\n/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\n/**\n * Converts `map` to its key-value pairs.\n *\n * @private\n * @param {Object} map The map to convert.\n * @returns {Array} Returns the key-value pairs.\n */\nfunction mapToArray(map) {\n var index = -1,\n result = Array(map.size);\n\n map.forEach(function(value, key) {\n result[++index] = [key, value];\n });\n return result;\n}\n\n/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\n/**\n * Converts `set` to an array of its values.\n *\n * @private\n * @param {Object} set The set to convert.\n * @returns {Array} Returns the values.\n */\nfunction setToArray(set) {\n var index = -1,\n result = Array(set.size);\n\n set.forEach(function(value) {\n result[++index] = value;\n });\n return result;\n}\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype,\n funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined,\n Symbol = root.Symbol,\n Uint8Array = root.Uint8Array,\n propertyIsEnumerable = objectProto.propertyIsEnumerable,\n splice = arrayProto.splice,\n symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols,\n nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,\n nativeKeys = overArg(Object.keys, Object);\n\n/* Built-in method references that are verified to be native. */\nvar DataView = getNative(root, 'DataView'),\n Map = getNative(root, 'Map'),\n Promise = getNative(root, 'Promise'),\n Set = getNative(root, 'Set'),\n WeakMap = getNative(root, 'WeakMap'),\n nativeCreate = getNative(Object, 'create');\n\n/** Used to detect maps, sets, and weakmaps. */\nvar dataViewCtorString = toSource(DataView),\n mapCtorString = toSource(Map),\n promiseCtorString = toSource(Promise),\n setCtorString = toSource(Set),\n weakMapCtorString = toSource(WeakMap);\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n}\n\n/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n}\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n}\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n}\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n}\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n}\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\n/**\n *\n * Creates an array cache object to store unique values.\n *\n * @private\n * @constructor\n * @param {Array} [values] The values to cache.\n */\nfunction SetCache(values) {\n var index = -1,\n length = values == null ? 0 : values.length;\n\n this.__data__ = new MapCache;\n while (++index < length) {\n this.add(values[index]);\n }\n}\n\n/**\n * Adds `value` to the array cache.\n *\n * @private\n * @name add\n * @memberOf SetCache\n * @alias push\n * @param {*} value The value to cache.\n * @returns {Object} Returns the cache instance.\n */\nfunction setCacheAdd(value) {\n this.__data__.set(value, HASH_UNDEFINED);\n return this;\n}\n\n/**\n * Checks if `value` is in the array cache.\n *\n * @private\n * @name has\n * @memberOf SetCache\n * @param {*} value The value to search for.\n * @returns {number} Returns `true` if `value` is found, else `false`.\n */\nfunction setCacheHas(value) {\n return this.__data__.has(value);\n}\n\n// Add methods to `SetCache`.\nSetCache.prototype.add = SetCache.prototype.push = setCacheAdd;\nSetCache.prototype.has = setCacheHas;\n\n/**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Stack(entries) {\n var data = this.__data__ = new ListCache(entries);\n this.size = data.size;\n}\n\n/**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\nfunction stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n}\n\n/**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction stackDelete(key) {\n var data = this.__data__,\n result = data['delete'](key);\n\n this.size = data.size;\n return result;\n}\n\n/**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction stackGet(key) {\n return this.__data__.get(key);\n}\n\n/**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction stackHas(key) {\n return this.__data__.has(key);\n}\n\n/**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\nfunction stackSet(key, value) {\n var data = this.__data__;\n if (data instanceof ListCache) {\n var pairs = data.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n this.size = ++data.size;\n return this;\n }\n data = this.__data__ = new MapCache(pairs);\n }\n data.set(key, value);\n this.size = data.size;\n return this;\n}\n\n// Add methods to `Stack`.\nStack.prototype.clear = stackClear;\nStack.prototype['delete'] = stackDelete;\nStack.prototype.get = stackGet;\nStack.prototype.has = stackHas;\nStack.prototype.set = stackSet;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\n/**\n * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @param {Function} symbolsFunc The function to get the symbols of `object`.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction baseGetAllKeys(object, keysFunc, symbolsFunc) {\n var result = keysFunc(object);\n return isArray(object) ? result : arrayPush(result, symbolsFunc(object));\n}\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\n/**\n * The base implementation of `_.isEqual` which supports partial comparisons\n * and tracks traversed objects.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Unordered comparison\n * 2 - Partial comparison\n * @param {Function} [customizer] The function to customize comparisons.\n * @param {Object} [stack] Tracks traversed `value` and `other` objects.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n */\nfunction baseIsEqual(value, other, bitmask, customizer, stack) {\n if (value === other) {\n return true;\n }\n if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {\n return value !== value && other !== other;\n }\n return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);\n}\n\n/**\n * A specialized version of `baseIsEqual` for arrays and objects which performs\n * deep comparisons and tracks traversed objects enabling objects with circular\n * references to be compared.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} [stack] Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {\n var objIsArr = isArray(object),\n othIsArr = isArray(other),\n objTag = objIsArr ? arrayTag : getTag(object),\n othTag = othIsArr ? arrayTag : getTag(other);\n\n objTag = objTag == argsTag ? objectTag : objTag;\n othTag = othTag == argsTag ? objectTag : othTag;\n\n var objIsObj = objTag == objectTag,\n othIsObj = othTag == objectTag,\n isSameTag = objTag == othTag;\n\n if (isSameTag && isBuffer(object)) {\n if (!isBuffer(other)) {\n return false;\n }\n objIsArr = true;\n objIsObj = false;\n }\n if (isSameTag && !objIsObj) {\n stack || (stack = new Stack);\n return (objIsArr || isTypedArray(object))\n ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)\n : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);\n }\n if (!(bitmask & COMPARE_PARTIAL_FLAG)) {\n var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),\n othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');\n\n if (objIsWrapped || othIsWrapped) {\n var objUnwrapped = objIsWrapped ? object.value() : object,\n othUnwrapped = othIsWrapped ? other.value() : other;\n\n stack || (stack = new Stack);\n return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);\n }\n }\n if (!isSameTag) {\n return false;\n }\n stack || (stack = new Stack);\n return equalObjects(object, other, bitmask, customizer, equalFunc, stack);\n}\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * A specialized version of `baseIsEqualDeep` for arrays with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Array} array The array to compare.\n * @param {Array} other The other array to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `array` and `other` objects.\n * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.\n */\nfunction equalArrays(array, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n arrLength = array.length,\n othLength = other.length;\n\n if (arrLength != othLength && !(isPartial && othLength > arrLength)) {\n return false;\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(array);\n if (stacked && stack.get(other)) {\n return stacked == other;\n }\n var index = -1,\n result = true,\n seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;\n\n stack.set(array, other);\n stack.set(other, array);\n\n // Ignore non-index properties.\n while (++index < arrLength) {\n var arrValue = array[index],\n othValue = other[index];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, arrValue, index, other, array, stack)\n : customizer(arrValue, othValue, index, array, other, stack);\n }\n if (compared !== undefined) {\n if (compared) {\n continue;\n }\n result = false;\n break;\n }\n // Recursively compare arrays (susceptible to call stack limits).\n if (seen) {\n if (!arraySome(other, function(othValue, othIndex) {\n if (!cacheHas(seen, othIndex) &&\n (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {\n return seen.push(othIndex);\n }\n })) {\n result = false;\n break;\n }\n } else if (!(\n arrValue === othValue ||\n equalFunc(arrValue, othValue, bitmask, customizer, stack)\n )) {\n result = false;\n break;\n }\n }\n stack['delete'](array);\n stack['delete'](other);\n return result;\n}\n\n/**\n * A specialized version of `baseIsEqualDeep` for comparing objects of\n * the same `toStringTag`.\n *\n * **Note:** This function only supports comparing values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {string} tag The `toStringTag` of the objects to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {\n switch (tag) {\n case dataViewTag:\n if ((object.byteLength != other.byteLength) ||\n (object.byteOffset != other.byteOffset)) {\n return false;\n }\n object = object.buffer;\n other = other.buffer;\n\n case arrayBufferTag:\n if ((object.byteLength != other.byteLength) ||\n !equalFunc(new Uint8Array(object), new Uint8Array(other))) {\n return false;\n }\n return true;\n\n case boolTag:\n case dateTag:\n case numberTag:\n // Coerce booleans to `1` or `0` and dates to milliseconds.\n // Invalid dates are coerced to `NaN`.\n return eq(+object, +other);\n\n case errorTag:\n return object.name == other.name && object.message == other.message;\n\n case regexpTag:\n case stringTag:\n // Coerce regexes to strings and treat strings, primitives and objects,\n // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring\n // for more details.\n return object == (other + '');\n\n case mapTag:\n var convert = mapToArray;\n\n case setTag:\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG;\n convert || (convert = setToArray);\n\n if (object.size != other.size && !isPartial) {\n return false;\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(object);\n if (stacked) {\n return stacked == other;\n }\n bitmask |= COMPARE_UNORDERED_FLAG;\n\n // Recursively compare objects (susceptible to call stack limits).\n stack.set(object, other);\n var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);\n stack['delete'](object);\n return result;\n\n case symbolTag:\n if (symbolValueOf) {\n return symbolValueOf.call(object) == symbolValueOf.call(other);\n }\n }\n return false;\n}\n\n/**\n * A specialized version of `baseIsEqualDeep` for objects with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalObjects(object, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n objProps = getAllKeys(object),\n objLength = objProps.length,\n othProps = getAllKeys(other),\n othLength = othProps.length;\n\n if (objLength != othLength && !isPartial) {\n return false;\n }\n var index = objLength;\n while (index--) {\n var key = objProps[index];\n if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {\n return false;\n }\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(object);\n if (stacked && stack.get(other)) {\n return stacked == other;\n }\n var result = true;\n stack.set(object, other);\n stack.set(other, object);\n\n var skipCtor = isPartial;\n while (++index < objLength) {\n key = objProps[index];\n var objValue = object[key],\n othValue = other[key];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, objValue, key, other, object, stack)\n : customizer(objValue, othValue, key, object, other, stack);\n }\n // Recursively compare objects (susceptible to call stack limits).\n if (!(compared === undefined\n ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))\n : compared\n )) {\n result = false;\n break;\n }\n skipCtor || (skipCtor = key == 'constructor');\n }\n if (result && !skipCtor) {\n var objCtor = object.constructor,\n othCtor = other.constructor;\n\n // Non `Object` object instances with different constructors are not equal.\n if (objCtor != othCtor &&\n ('constructor' in object && 'constructor' in other) &&\n !(typeof objCtor == 'function' && objCtor instanceof objCtor &&\n typeof othCtor == 'function' && othCtor instanceof othCtor)) {\n result = false;\n }\n }\n stack['delete'](object);\n stack['delete'](other);\n return result;\n}\n\n/**\n * Creates an array of own enumerable property names and symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeys(object) {\n return baseGetAllKeys(object, keys, getSymbols);\n}\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\n/**\n * Creates an array of the own enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbols = !nativeGetSymbols ? stubArray : function(object) {\n if (object == null) {\n return [];\n }\n object = Object(object);\n return arrayFilter(nativeGetSymbols(object), function(symbol) {\n return propertyIsEnumerable.call(object, symbol);\n });\n};\n\n/**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nvar getTag = baseGetTag;\n\n// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.\nif ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\n (Map && getTag(new Map) != mapTag) ||\n (Promise && getTag(Promise.resolve()) != promiseTag) ||\n (Set && getTag(new Set) != setTag) ||\n (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n getTag = function(value) {\n var result = baseGetTag(value),\n Ctor = result == objectTag ? value.constructor : undefined,\n ctorString = Ctor ? toSource(Ctor) : '';\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString: return dataViewTag;\n case mapCtorString: return mapTag;\n case promiseCtorString: return promiseTag;\n case setCtorString: return setTag;\n case weakMapCtorString: return weakMapTag;\n }\n }\n return result;\n };\n}\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n length = length == null ? MAX_SAFE_INTEGER : length;\n return !!length &&\n (typeof value == 'number' || reIsUint.test(value)) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\n/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\n/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\n/**\n * Performs a deep comparison between two values to determine if they are\n * equivalent.\n *\n * **Note:** This method supports comparing arrays, array buffers, booleans,\n * date objects, error objects, maps, numbers, `Object` objects, regexes,\n * sets, strings, symbols, and typed arrays. `Object` objects are compared\n * by their own, not inherited, enumerable properties. Functions and DOM\n * nodes are compared by strict equality, i.e. `===`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.isEqual(object, other);\n * // => true\n *\n * object === other;\n * // => false\n */\nfunction isEqual(value, other) {\n return baseIsEqual(value, other);\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\n/**\n * This method returns a new empty array.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {Array} Returns the new empty array.\n * @example\n *\n * var arrays = _.times(2, _.stubArray);\n *\n * console.log(arrays);\n * // => [[], []]\n *\n * console.log(arrays[0] === arrays[1]);\n * // => false\n */\nfunction stubArray() {\n return [];\n}\n\n/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nmodule.exports = isEqual;\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 'lodash.isequal';\nimport normalize from '@mapbox/geojson-normalize';\nimport hat from 'hat';\nimport featuresAt from './lib/features_at';\nimport stringSetsAreEqual from './lib/string_sets_are_equal';\nimport * as Constants from './constants';\nimport StringSet from './lib/string_set';\n\nimport Polygon from './feature_types/polygon';\nimport LineString from './feature_types/line_string';\nimport Point from './feature_types/point';\nimport MultiFeature from './feature_types/multi_feature';\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\n api.modes = Constants.modes;\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 || hat();\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);\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 internalFeature.properties = feature.properties;\n if (!isEqual(internalFeature.properties, feature.properties)) {\n ctx.store.featureChanged(internalFeature.id);\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: true });\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: true });\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: true });\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: true });\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: true });\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: true });\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: true });\n return api;\n };\n\n api.combineFeatures = function() {\n ctx.events.combineFeatures({ silent: true });\n return api;\n };\n\n api.uncombineFeatures = function() {\n ctx.events.uncombineFeatures({ silent: true });\n return api;\n };\n\n api.setFeatureProperty = function(featureId, property, value) {\n ctx.store.setFeatureProperty(featureId, property, value);\n return api;\n };\n\n return api;\n}\n","import runSetup from './src/setup';\nimport setupOptions from './src/options';\nimport setupAPI from './src/api';\nimport * as Constants from './src/constants';\nimport * as lib from './src/lib';\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\nimport modes from './src/modes/index';\nMapboxDraw.modes = modes;\nMapboxDraw.constants = Constants;\nMapboxDraw.lib = lib;\n\nexport default MapboxDraw;\n"],"names":["const","ModeHandler","mode","DrawContext","handlers","drag","click","mousemove","mousedown","mouseup","mouseout","keydown","keyup","touchstart","touchmove","touchend","tap","ctx","on","event","selector","fn","undefined","Error","push","render","id","store","featureChanged","delegate","eventName","handles","iHandle","length","handle","call","ui","updateMapClasses","start","stop","trash","combineFeatures","uncombineFeatures","wgs84","require$$0","polygonArea","coords","area","Math","abs","ringArea","i","p1","p2","lowerIndex","middleIndex","upperIndex","coordsLength","rad","sin","RADIUS","_","PI","geojsonArea","geometry","type","coordinates","geometries","ring","classes","CONTROL_BASE","CONTROL_PREFIX","CONTROL_BUTTON","CONTROL_BUTTON_LINE","CONTROL_BUTTON_POLYGON","CONTROL_BUTTON_POINT","CONTROL_BUTTON_TRASH","CONTROL_BUTTON_COMBINE_FEATURES","CONTROL_BUTTON_UNCOMBINE_FEATURES","CONTROL_GROUP","ATTRIBUTION","ACTIVE_BUTTON","BOX_SELECT","sources","HOT","COLD","cursors","ADD","MOVE","DRAG","POINTER","NONE","types","POLYGON","LINE","POINT","geojsonTypes","FEATURE","LINE_STRING","FEATURE_COLLECTION","MULTI_PREFIX","MULTI_POINT","MULTI_LINE_STRING","MULTI_POLYGON","modes","DRAW_LINE_STRING","DRAW_POLYGON","DRAW_POINT","SIMPLE_SELECT","DIRECT_SELECT","STATIC","events","CREATE","DELETE","UPDATE","SELECTION_CHANGE","MODE_CHANGE","ACTIONABLE","RENDER","COMBINE_FEATURES","UNCOMBINE_FEATURES","updateActions","CHANGE_COORDINATES","meta","MIDPOINT","VERTEX","activeStates","ACTIVE","INACTIVE","interactions","LAT_RENDERED_MIN","FEATURE_SORT_RANKS","Point","LineString","MultiLineString","Polygon","comparator","a","b","score","Constants.geojsonTypes","sortFeatures","features","map","feature","property","sort","mapEventToBoundingBox","mapEvent","buffer","point","x","y","StringSet","items","this","_items","_nums","_length","let","l","add","prototype","has","delete","values","Object","keys","forEach","k","v","JSON","parse","clear","META_TYPES","Constants.meta","featuresAt","bbox","options","clickBuffer","touch","touchBuffer","box","queryParams","styles","layers","s","filter","getLayer","queryRenderedFeatures","indexOf","properties","featureIds","uniqueFeatures","featureId","getFeatureAtAndSetCursors","mouse","Constants.cursors","active","Constants.activeStates","currentModeName","queueMapClasses","euclideanDistance","sqrt","isClick","end","fineTolerance","grossTolerance","interval","time","moveDistance","isTap","tolerance","hat","hatModule","exports","bits","base","digits","log","pow","Infinity","rem","floor","res","random","toString","parsed","parseInt","rack","expandBy","data","iters","hasOwnProperty","hats","get","set","value","Feature","geojson","changed","incomingCoords","setCoordinates","getCoordinates","stringify","setProperty","toGeoJSON","internal","userProperties","name","create","isValid","updateCoordinate","pathOrLng","lngOrLat","lat","arguments","getCoordinate","addCoordinate","path","lng","splice","removeCoordinate","slice","every","ids","split","concat","parts","ringId","coordId","models","MultiPoint","MultiPolygon","takeAction","action","idx","tail","join","MultiFeature","model","TypeError","_coordinatesToFeatures","ModeInterface","drawConfig","_ctx","Model","bind","replace","f","getFeatures","setSelected","setSelectedCoordinates","reduce","m","c","feature_id","getSelected","getSelectedIds","isSelected","getFeature","select","deselect","deleteFeature","opts","addFeature","clearSelectedFeatures","clearSelected","clearSelectedCoordinates","setActionableState","actions","newSet","actionable","changeMode","eventOpts","updateUIClasses","activateUIButton","setActiveButton","bufferType","newFeature","isInstanceOf","doRender","onSetup","onDrag","onClick","onMouseMove","onMouseDown","onMouseUp","onMouseOut","onKeyUp","onKeyDown","onTouchStart","onTouchMove","onTouchEnd","onTap","onStop","onTrash","onCombineFeature","onUncombineFeature","toDisplayFeatures","eventMapper","eventKeys","objectToMode","modeObject","modeObjectKeys","startOpts","state","key","eh","modeHandler","e","onCombineFeatures","onUncombineFeatures","toDenseArray","getSource","Constants.sources","cleanup","newHotIds","newColdIds","isDirty","getAllIds","getChangedIds","hot","lastColdCount","cold","parent","coldChanged","renderFeature","source","featureInternal","currentModeRender","setData","_emitSelectionChange","fire","Constants.events","points","getSelectedCoordinates","coordinate","_deletedFeaturesToEmit","geojsonToEmit","clearChangedIds","Store","renderRequest","_features","_featureIds","_selectedFeatureIds","_selectedCoordinates","_changedFeatureIds","_mapInitialConfig","requestAnimationFrame","refreshSelectedCoordinates","newSelectedCoordinates","silent","createRenderBatch","holdRender","numRenders","setDirty","getAll","coord_path","setFeatureProperty","storeMapConfig","interaction","isEnabled","restoreMapConfig","enable","disable","getInitialConfigValue","immutable","target","classTypes","runSetup","controlContainer","mapLoadedInterval","setup","onRemove","off","connect","clearInterval","removeLayers","removeButtons","removeEventListeners","clearMapClasses","boxZoomInitial","boxZoom","container","parentNode","removeChild","addLayers","addEventListeners","onAdd","_fire","args","xtend","apply","mouseDownInfo","touchStartInfo","currentMode","isDrag","Date","getTime","originalEvent","stopPropagation","mousedrag","endInfo","touchdrag","buttons","which","getFeaturesAndSetCursor","featureTarget","touchEnabled","preventDefault","isKeyModeValid","code","modename","nextModeOptions","eventOptions","modebuilder","setupModeHandler","srcElement","classList","contains","keyCode","controls","Constants.modes","line_string","polygon","zoomend","changeZoom","dataType","some","style","actionState","defaultMode","addEventListener","keybindings","removeEventListener","getMode","buttonElements","activeButton","currentMapClasses","nextMapClasses","classesToRemove","classesToAdd","ref","remove","ref$1","createControlButton","button","document","createElement","className","Constants.classes","setAttribute","title","appendChild","deactivateButtons","onDeactivate","onActivate","addButtons","controlGroup","Constants.types","combine_features","uncombine_features","buttonId","getContainer","boxSelect","dragPan","loaded","setInterval","addSource","addLayer","removeLayer","removeSource","paint","layout","isOfMetaType","isShiftMousedown","shiftKey","isActiveFeature","isInactiveFeature","noTarget","isFeature","isVertex","isShiftDown","isEscapeKey","isEnterKey","pointGeometry","clone","p","_add","sub","_sub","multByPoint","_multByPoint","divByPoint","_divByPoint","mult","_mult","div","_div","rotate","_rotate","rotateAround","_rotateAround","matMult","_matMult","unit","_unit","perp","_perp","round","_round","mag","equals","other","dist","distSqr","dx","dy","angle","atan2","angleTo","angleWith","angleWithSep","cos","convert","Array","isArray","mouseEventPoint","mouseEvent","rect","getBoundingClientRect","clientX","left","clientLeft","clientY","top","clientTop","createVertex","parentId","selected","createMidpoint","startVertex","endVertex","startCoord","endCoord","Constants.LAT_RENDERED_MIN","mid","createSupplementaryPoints","basePath","subType","supplementaryPoints","processLine","line","lineBasePath","firstPointString","lastVertex","pointIndex","pointPath","String","vertex","isSelectedPath","midpoints","midpoint","stringifiedPoint","selectedPaths","lineIndex","subCoordinates","index","subFeature","doubleClickZoom","setTimeout","geojsonNormalize","gj","GeometryCollection","FeatureCollection","t","r","geojsonFlatten","flatten","list","_flatten","acc","item","Function","default","traverse","traverseModule","obj","Traverse","walk","root","cb","parents","alive","walker","node_","node","copy","modifiers","keepGoing","isRoot","level","circular","update","stopHere","before","after","pre","post","block","updateState","objectKeys","isLeaf","notLeaf","notRoot","ret","child","isLast","isFirst","pop","src","dst","toS","isRegExp","RegExp","isError","message","isBoolean","Boolean","isNumber","Number","isString","getPrototypeOf","constructor","proto","__proto__","T","ps","init","skip","paths","nodes","xs","extent","Extent","_bbox","_valid","include","ll","min","max","center","union","_fastContains","lon","intersect","body","geojsonCoords","normalized","require$$1","require$$2","geojsonTypesByDataAttributes","dataAttributes","getExtent","ext","geojsonExtentModule","bboxify","attribute","LAT_MIN","constrainFeatureMovement","geojsonFeatures","delta","northInnerEdge","southInnerEdge","northOuterEdge","southOuterEdge","westEdge","eastEdge","bounds","featureSouthEdge","featureNorthEdge","featureWestEdge","featureEastEdge","constrainedDelta","ceil","moveFeatures","nextCoordinates","currentCoordinates","moveCoordinate","coord","moveRing","multi","SimpleSelect","dragMoveLocation","boxSelectStartLocation","boxSelectElement","boxSelecting","canBoxSelect","dragMoving","canDragMove","initiallySelectedFeatureIds","fireActionable","Constants.updateActions","selectedFeatures","multiFeatures","featureType","allFeatures","memo","CommonSelectors.isFeature","fireUpdate","stopExtendedInteractions","CommonSelectors.noTarget","clickAnywhere","CommonSelectors.isOfMetaType","clickOnVertex","clickOnFeature","wasSelected","coordPath","startPos","lngLat","startOnActiveFeature","isShiftClick","CommonSelectors.isShiftDown","selectedFeatureIds","isFeatureSelected","CommonSelectors.isActiveFeature","CommonSelectors.isShiftMousedown","startBoxSelect","dragMove","whileBoxSelect","current","minX","maxX","minY","maxY","translateValue","transform","WebkitTransform","width","height","featuresInBox","idsToSelect","getUniqueIds","display","featuresCombined","includes","subcoords","multiFeature","createdFeatures","deletedFeatures","featuresUncombined","loop","isMidpoint","DirectSelect","selectedCoordPaths","startDragging","about","selectedIndex","selectedCoordinates","pathsToCoordinates","stopDragging","selectedCoords","localeCompare","numeric","onVertex","isMidPoint","noCoords","onFeature","onMidpoint","dragVertex","dragFeature","clickNoTarget","clickActiveFeature","clickInactive","DrawPoint","isEventAtCoordinates","stopDrawingAndRemove","isActivePoint","CommonSelectors.isEscapeKey","CommonSelectors.isEnterKey","DrawPolygon","currentVertexPosition","CommonSelectors.isVertex","isActivePolygon","coordinateCount","endPos","lineCoordinates","DrawLineString","direction","from","lastCoord","isActiveLine","simple_select","direct_select","draw_point","draw_polygon","draw_line_string","defaultOptions","displayControlsDefault","showControls","hideControls","addSources","sourceBucket","HASH_UNDEFINED","MAX_SAFE_INTEGER","argsTag","arrayTag","boolTag","dateTag","errorTag","funcTag","mapTag","numberTag","objectTag","promiseTag","regexpTag","setTag","stringTag","symbolTag","weakMapTag","arrayBufferTag","dataViewTag","reIsHostCtor","reIsUint","typedArrayTags","freeGlobal","global","freeSelf","self","freeExports","nodeType","freeModule","module","moduleExports","freeProcess","process","nodeUtil","binding","nodeIsTypedArray","isTypedArray","arraySome","array","predicate","mapToArray","result","size","setToArray","uid","func","arrayProto","funcProto","objectProto","coreJsData","funcToString","maskSrcKey","exec","IE_PROTO","nativeObjectToString","reIsNative","Buffer","Symbol","Uint8Array","propertyIsEnumerable","symToStringTag","toStringTag","nativeGetSymbols","getOwnPropertySymbols","nativeIsBuffer","isBuffer","nativeKeys","arg","DataView","getNative","Map","Promise","Set","WeakMap","nativeCreate","dataViewCtorString","toSource","mapCtorString","promiseCtorString","setCtorString","weakMapCtorString","symbolProto","symbolValueOf","valueOf","Hash","entries","entry","ListCache","MapCache","SetCache","__data__","Stack","arrayLikeKeys","inherited","isArr","isArg","isArguments","isBuff","isType","skipIndexes","n","iteratee","baseTimes","isIndex","assocIndexOf","eq","baseGetTag","isOwn","tag","unmasked","getRawTag","objectToString","baseIsArguments","isObjectLike","baseIsEqual","bitmask","customizer","stack","object","equalFunc","objIsArr","othIsArr","objTag","getTag","othTag","objIsObj","othIsObj","isSameTag","equalArrays","byteLength","byteOffset","isPartial","stacked","equalByTag","objIsWrapped","othIsWrapped","objUnwrapped","othUnwrapped","objProps","getAllKeys","objLength","othLength","skipCtor","objValue","othValue","compared","objCtor","othCtor","equalObjects","baseIsEqualDeep","baseIsNative","isObject","isMasked","isFunction","test","baseKeys","Ctor","arrLength","seen","arrValue","othIndex","keysFunc","symbolsFunc","offset","arrayPush","baseGetAllKeys","getSymbols","getMapData","getValue","hash","string","pairs","LARGE_ARRAY_SIZE","resIndex","arrayFilter","symbol","ArrayBuffer","resolve","ctorString","isLength","baseUnary","stringSetsAreEqual","featureTypes","setupDraw","api","withDefaults","setupOptions","getFeatureIdsAt","getSelectedPoints","featureCollection","renderBatch","toDelete","newIds","newIdsLookup","normalize","internalFeature","isEqual","deleteAll","modeOptions","setupAPI","MapboxDraw","constants","Constants","lib"],"mappings":"2OACAA,IAAMC,EAAc,SAASC,EAAMC,GAEjCH,IAAMI,EAAW,CACfC,KAAM,GACNC,MAAO,GACPC,UAAW,GACXC,UAAW,GACXC,QAAS,GACTC,SAAU,GACVC,QAAS,GACTC,MAAO,GACPC,WAAY,GACZC,UAAW,GACXC,SAAU,GACVC,IAAK,IAGDC,EAAM,CACVC,YAAGC,EAAOC,EAAUC,GAClB,QAAwBC,IAApBlB,EAASe,GACX,MAAM,IAAII,MAA6B,uBAAAJ,GAEzCf,EAASe,GAAOK,KAAK,CAC3BJ,SAAQA,EACRC,GAAQA,GAEH,EACDI,OAAA,SAAOC,GACLvB,EAAYwB,MAAMC,eAAeF,EAClC,GAGGG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