{"version":3,"file":"mapbox-gl.js","sources":["../rollup/build/mapboxgl/node_modules/@mapbox/unitbezier/index.js","../rollup/build/mapboxgl/src/geo/coordinate.js","../rollup/build/mapboxgl/node_modules/@mapbox/point-geometry/index.js","../rollup/build/mapboxgl/src/util/util.js","../rollup/build/mapboxgl/src/util/ajax.js","../rollup/build/mapboxgl/src/util/evented.js","../rollup/build/mapboxgl/src/style-spec/error/validation_error.js","../rollup/build/mapboxgl/src/style-spec/validate/validate_constants.js","../rollup/build/mapboxgl/src/style-spec/util/unbundle_jsonlint.js","../rollup/build/mapboxgl/src/style-spec/expression/parsing_error.js","../rollup/build/mapboxgl/src/style-spec/expression/scope.js","../rollup/build/mapboxgl/src/style-spec/expression/types.js","../rollup/build/mapboxgl/node_modules/csscolorparser/csscolorparser.js","../rollup/build/mapboxgl/src/style-spec/util/color.js","../rollup/build/mapboxgl/src/style-spec/expression/definitions/collator.js","../rollup/build/mapboxgl/src/style-spec/expression/values.js","../rollup/build/mapboxgl/src/style-spec/expression/definitions/literal.js","../rollup/build/mapboxgl/src/style-spec/expression/runtime_error.js","../rollup/build/mapboxgl/src/style-spec/expression/definitions/assertion.js","../rollup/build/mapboxgl/src/style-spec/expression/definitions/array.js","../rollup/build/mapboxgl/src/style-spec/expression/definitions/coercion.js","../rollup/build/mapboxgl/src/style-spec/expression/evaluation_context.js","../rollup/build/mapboxgl/src/style-spec/expression/compound_expression.js","../rollup/build/mapboxgl/src/style-spec/expression/is_constant.js","../rollup/build/mapboxgl/src/style-spec/expression/definitions/var.js","../rollup/build/mapboxgl/src/style-spec/expression/parsing_context.js","../rollup/build/mapboxgl/src/style-spec/expression/stops.js","../rollup/build/mapboxgl/src/style-spec/expression/definitions/step.js","../rollup/build/mapboxgl/src/style-spec/util/interpolate.js","../rollup/build/mapboxgl/src/style-spec/expression/definitions/interpolate.js","../rollup/build/mapboxgl/src/style-spec/expression/definitions/coalesce.js","../rollup/build/mapboxgl/src/style-spec/expression/definitions/let.js","../rollup/build/mapboxgl/src/style-spec/expression/definitions/at.js","../rollup/build/mapboxgl/src/style-spec/expression/definitions/match.js","../rollup/build/mapboxgl/src/style-spec/expression/definitions/case.js","../rollup/build/mapboxgl/src/style-spec/expression/definitions/equals.js","../rollup/build/mapboxgl/src/style-spec/expression/definitions/length.js","../rollup/build/mapboxgl/src/style-spec/expression/definitions/index.js","../rollup/build/mapboxgl/src/style-spec/util/result.js","../rollup/build/mapboxgl/src/style-spec/util/color_spaces.js","../rollup/build/mapboxgl/src/style-spec/util/get_type.js","../rollup/build/mapboxgl/src/style-spec/function/index.js","../rollup/build/mapboxgl/src/style-spec/expression/index.js","../rollup/build/mapboxgl/src/style-spec/validate/validate_object.js","../rollup/build/mapboxgl/src/style-spec/validate/validate_array.js","../rollup/build/mapboxgl/src/style-spec/validate/validate_number.js","../rollup/build/mapboxgl/src/style-spec/validate/validate_function.js","../rollup/build/mapboxgl/src/style-spec/validate/validate_expression.js","../rollup/build/mapboxgl/src/style-spec/validate/validate_enum.js","../rollup/build/mapboxgl/src/style-spec/feature_filter/index.js","../rollup/build/mapboxgl/src/style-spec/validate/validate_filter.js","../rollup/build/mapboxgl/src/style-spec/validate/validate_property.js","../rollup/build/mapboxgl/src/style-spec/validate/validate_paint_property.js","../rollup/build/mapboxgl/src/style-spec/validate/validate_layout_property.js","../rollup/build/mapboxgl/src/style-spec/validate/validate_layer.js","../rollup/build/mapboxgl/src/style-spec/validate/validate_source.js","../rollup/build/mapboxgl/src/style-spec/validate/validate_light.js","../rollup/build/mapboxgl/src/style-spec/validate/validate_string.js","../rollup/build/mapboxgl/src/style-spec/validate/validate.js","../rollup/build/mapboxgl/src/style-spec/validate/validate_boolean.js","../rollup/build/mapboxgl/src/style-spec/validate/validate_color.js","../rollup/build/mapboxgl/src/style-spec/validate_style.min.js","../rollup/build/mapboxgl/src/style/validate_style.js","../rollup/build/mapboxgl/node_modules/grid-index/grid-index.js","../rollup/build/mapboxgl/src/util/web_worker_transfer.js","../rollup/build/mapboxgl/src/style/zoom_history.js","../rollup/build/mapboxgl/src/util/is_char_in_unicode_block.js","../rollup/build/mapboxgl/src/util/script_detection.js","../rollup/build/mapboxgl/src/source/rtl_text_plugin.js","../rollup/build/mapboxgl/src/style/evaluation_parameters.js","../rollup/build/mapboxgl/src/style/properties.js","../rollup/build/mapboxgl/src/style/style_layer.js","../rollup/build/mapboxgl/src/util/struct_array.js","../rollup/build/mapboxgl/src/data/array_types.js","../rollup/build/mapboxgl/src/data/bucket/circle_attributes.js","../rollup/build/mapboxgl/src/data/segment.js","../rollup/build/mapboxgl/src/shaders/encode_attribute.js","../rollup/build/mapboxgl/src/data/program_configuration.js","../rollup/build/mapboxgl/src/data/extent.js","../rollup/build/mapboxgl/src/data/load_geometry.js","../rollup/build/mapboxgl/src/data/bucket/circle_bucket.js","../rollup/build/mapboxgl/src/util/intersection_tests.js","../rollup/build/mapboxgl/src/style/query_utils.js","../rollup/build/mapboxgl/src/style/style_layer/circle_style_layer_properties.js","../rollup/build/mapboxgl/node_modules/@mapbox/gl-matrix/dist/gl-matrix.js","../rollup/build/mapboxgl/src/style/style_layer/circle_style_layer.js","../rollup/build/mapboxgl/src/data/bucket/heatmap_bucket.js","../rollup/build/mapboxgl/src/util/image.js","../rollup/build/mapboxgl/src/style/style_layer/heatmap_style_layer_properties.js","../rollup/build/mapboxgl/src/util/color_ramp.js","../rollup/build/mapboxgl/src/style/style_layer/heatmap_style_layer.js","../rollup/build/mapboxgl/src/style/style_layer/hillshade_style_layer_properties.js","../rollup/build/mapboxgl/src/style/style_layer/hillshade_style_layer.js","../rollup/build/mapboxgl/src/data/bucket/fill_attributes.js","../rollup/build/mapboxgl/node_modules/earcut/src/earcut.js","../rollup/build/mapboxgl/node_modules/quickselect/index.js","../rollup/build/mapboxgl/src/util/classify_rings.js","../rollup/build/mapboxgl/src/data/bucket/fill_bucket.js","../rollup/build/mapboxgl/src/style/style_layer/fill_style_layer_properties.js","../rollup/build/mapboxgl/src/style/style_layer/fill_style_layer.js","../rollup/build/mapboxgl/src/data/bucket/fill_extrusion_attributes.js","../rollup/build/mapboxgl/src/data/bucket/fill_extrusion_bucket.js","../rollup/build/mapboxgl/src/style/style_layer/fill_extrusion_style_layer_properties.js","../rollup/build/mapboxgl/src/style/style_layer/fill_extrusion_style_layer.js","../rollup/build/mapboxgl/src/data/bucket/line_attributes.js","../rollup/build/mapboxgl/node_modules/@mapbox/vector-tile/lib/vectortilefeature.js","../rollup/build/mapboxgl/node_modules/@mapbox/vector-tile/lib/vectortilelayer.js","../rollup/build/mapboxgl/node_modules/@mapbox/vector-tile/lib/vectortile.js","../rollup/build/mapboxgl/node_modules/@mapbox/vector-tile/index.js","../rollup/build/mapboxgl/src/data/bucket/line_bucket.js","../rollup/build/mapboxgl/src/style/style_layer/line_style_layer_properties.js","../rollup/build/mapboxgl/src/style/style_layer/line_style_layer.js","../rollup/build/mapboxgl/src/data/bucket/symbol_attributes.js","../rollup/build/mapboxgl/src/util/verticalize_punctuation.js","../rollup/build/mapboxgl/src/symbol/anchor.js","../rollup/build/mapboxgl/src/symbol/symbol_size.js","../rollup/build/mapboxgl/src/data/bucket/symbol_bucket.js","../rollup/build/mapboxgl/src/style/style_layer/symbol_style_layer_properties.js","../rollup/build/mapboxgl/src/style/style_layer/symbol_style_layer.js","../rollup/build/mapboxgl/src/util/token.js","../rollup/build/mapboxgl/src/style/style_layer/background_style_layer_properties.js","../rollup/build/mapboxgl/src/style/style_layer/background_style_layer.js","../rollup/build/mapboxgl/src/style/style_layer/raster_style_layer_properties.js","../rollup/build/mapboxgl/src/style/create_style_layer.js","../rollup/build/mapboxgl/src/style/style_layer/raster_style_layer.js","../rollup/build/mapboxgl/node_modules/@mapbox/shelf-pack/index.umd.js","../rollup/build/mapboxgl/src/render/image_atlas.js","../rollup/build/mapboxgl/node_modules/ieee754/index.js","../rollup/build/mapboxgl/node_modules/pbf/index.js","../rollup/build/mapboxgl/src/style/parse_glyph_pbf.js","../rollup/build/mapboxgl/src/util/actor.js","../rollup/build/mapboxgl/node_modules/@mapbox/whoots-js/index.umd.js","../rollup/build/mapboxgl/src/source/tile_id.js","../rollup/build/mapboxgl/src/data/dem_data.js","../rollup/build/mapboxgl/src/util/dictionary_coder.js","../rollup/build/mapboxgl/src/util/vectortile_to_geojson.js","../rollup/build/mapboxgl/src/data/feature_index.js","../rollup/build/mapboxgl/src/style-spec/util/ref_properties.js","../rollup/build/mapboxgl/src/symbol/shaping.js","../rollup/build/mapboxgl/src/style-spec/util/deep_equal.js","../rollup/build/mapboxgl/src/style-spec/group_by_layout.js","../rollup/build/mapboxgl/src/style/style_layer_index.js","../rollup/build/mapboxgl/src/symbol/check_max_angle.js","../rollup/build/mapboxgl/src/symbol/get_anchors.js","../rollup/build/mapboxgl/src/symbol/opacity_state.js","../rollup/build/mapboxgl/src/symbol/collision_feature.js","../rollup/build/mapboxgl/node_modules/tinyqueue/index.js","../rollup/build/mapboxgl/src/util/find_pole_of_inaccessibility.js","../rollup/build/mapboxgl/src/symbol/symbol_layout.js","../rollup/build/mapboxgl/src/symbol/quads.js","../rollup/build/mapboxgl/src/symbol/clip_line.js","../rollup/build/mapboxgl/src/render/glyph_atlas.js","../rollup/build/mapboxgl/src/source/worker_tile.js","../rollup/build/mapboxgl/src/util/performance.js","../rollup/build/mapboxgl/src/source/vector_tile_worker_source.js","../rollup/build/mapboxgl/src/source/raster_dem_tile_worker_source.js","../rollup/build/mapboxgl/node_modules/wgs84/index.js","../rollup/build/mapboxgl/node_modules/@mapbox/geojson-area/index.js","../rollup/build/mapboxgl/node_modules/geojson-rewind/index.js","../rollup/build/mapboxgl/src/source/geojson_wrapper.js","../rollup/build/mapboxgl/node_modules/vt-pbf/lib/geojson_wrapper.js","../rollup/build/mapboxgl/node_modules/vt-pbf/index.js","../rollup/build/mapboxgl/node_modules/kdbush/src/sort.js","../rollup/build/mapboxgl/node_modules/kdbush/src/range.js","../rollup/build/mapboxgl/node_modules/kdbush/src/within.js","../rollup/build/mapboxgl/node_modules/kdbush/src/kdbush.js","../rollup/build/mapboxgl/node_modules/supercluster/index.js","../rollup/build/mapboxgl/node_modules/geojson-vt/src/simplify.js","../rollup/build/mapboxgl/node_modules/geojson-vt/src/feature.js","../rollup/build/mapboxgl/node_modules/geojson-vt/src/convert.js","../rollup/build/mapboxgl/node_modules/geojson-vt/src/clip.js","../rollup/build/mapboxgl/node_modules/geojson-vt/src/wrap.js","../rollup/build/mapboxgl/node_modules/geojson-vt/src/transform.js","../rollup/build/mapboxgl/node_modules/geojson-vt/src/tile.js","../rollup/build/mapboxgl/node_modules/geojson-vt/src/index.js","../rollup/build/mapboxgl/src/source/geojson_worker_source.js","../rollup/build/mapboxgl/src/source/worker.js","../rollup/build/mapboxgl/node_modules/@mapbox/mapbox-gl-supported/index.js","../rollup/build/mapboxgl/src/util/browser.js","../rollup/build/mapboxgl/src/util/dom.js","../rollup/build/mapboxgl/src/util/config.js","../rollup/build/mapboxgl/src/util/mapbox.js","../rollup/build/mapboxgl/src/render/texture.js","../rollup/build/mapboxgl/src/render/image_manager.js","../rollup/build/mapboxgl/node_modules/@mapbox/tiny-sdf/index.js","../rollup/build/mapboxgl/src/render/glyph_manager.js","../rollup/build/mapboxgl/src/style/light.js","../rollup/build/mapboxgl/src/render/line_atlas.js","../rollup/build/mapboxgl/src/util/dispatcher.js","../rollup/build/mapboxgl/src/geo/lng_lat.js","../rollup/build/mapboxgl/src/geo/lng_lat_bounds.js","../rollup/build/mapboxgl/src/source/tile_bounds.js","../rollup/build/mapboxgl/src/source/vector_tile_source.js","../rollup/build/mapboxgl/src/source/raster_tile_source.js","../rollup/build/mapboxgl/src/source/raster_dem_tile_source.js","../rollup/build/mapboxgl/src/source/geojson_source.js","../rollup/build/mapboxgl/src/data/raster_bounds_attributes.js","../rollup/build/mapboxgl/src/render/vertex_array_object.js","../rollup/build/mapboxgl/src/source/image_source.js","../rollup/build/mapboxgl/src/source/video_source.js","../rollup/build/mapboxgl/src/source/canvas_source.js","../rollup/build/mapboxgl/src/source/source.js","../rollup/build/mapboxgl/src/source/query_features.js","../rollup/build/mapboxgl/src/source/tile.js","../rollup/build/mapboxgl/src/data/bucket.js","../rollup/build/mapboxgl/src/source/tile_cache.js","../rollup/build/mapboxgl/src/gl/index_buffer.js","../rollup/build/mapboxgl/src/gl/vertex_buffer.js","../rollup/build/mapboxgl/src/gl/value.js","../rollup/build/mapboxgl/src/gl/framebuffer.js","../rollup/build/mapboxgl/src/gl/depth_mode.js","../rollup/build/mapboxgl/src/gl/stencil_mode.js","../rollup/build/mapboxgl/src/gl/color_mode.js","../rollup/build/mapboxgl/src/gl/context.js","../rollup/build/mapboxgl/src/source/source_cache.js","../rollup/build/mapboxgl/src/util/worker_pool.js","../rollup/build/mapboxgl/src/util/global_worker_pool.js","../rollup/build/mapboxgl/src/style-spec/deref.js","../rollup/build/mapboxgl/src/style-spec/diff.js","../rollup/build/mapboxgl/src/symbol/grid_index.js","../rollup/build/mapboxgl/src/symbol/projection.js","../rollup/build/mapboxgl/src/symbol/collision_index.js","../rollup/build/mapboxgl/src/symbol/placement.js","../rollup/build/mapboxgl/src/style/pauseable_placement.js","../rollup/build/mapboxgl/src/symbol/cross_tile_symbol_index.js","../rollup/build/mapboxgl/src/style/style.js","../rollup/build/mapboxgl/src/data/pos_attributes.js","../rollup/build/mapboxgl/src/render/program.js","../rollup/build/mapboxgl/src/render/tile_mask.js","../rollup/build/mapboxgl/src/render/draw_collision_debug.js","../rollup/build/mapboxgl/src/render/draw_symbol.js","../rollup/build/mapboxgl/src/render/draw_line.js","../rollup/build/mapboxgl/src/render/pattern.js","../rollup/build/mapboxgl/src/render/draw_fill.js","../rollup/build/mapboxgl/src/render/draw_fill_extrusion.js","../rollup/build/mapboxgl/src/render/draw_hillshade.js","../rollup/build/mapboxgl/src/render/draw_raster.js","../rollup/build/mapboxgl/src/render/draw_debug.js","../rollup/build/mapboxgl/src/render/painter.js","../rollup/build/mapboxgl/src/render/draw_circle.js","../rollup/build/mapboxgl/src/render/draw_heatmap.js","../rollup/build/mapboxgl/src/render/draw_background.js","../rollup/build/mapboxgl/src/util/tile_cover.js","../rollup/build/mapboxgl/src/geo/transform.js","../rollup/build/mapboxgl/src/ui/hash.js","../rollup/build/mapboxgl/src/util/throttle.js","../rollup/build/mapboxgl/src/ui/events.js","../rollup/build/mapboxgl/src/ui/handler/scroll_zoom.js","../rollup/build/mapboxgl/src/ui/handler/box_zoom.js","../rollup/build/mapboxgl/src/ui/handler/drag_rotate.js","../rollup/build/mapboxgl/src/ui/handler/drag_pan.js","../rollup/build/mapboxgl/src/ui/handler/keyboard.js","../rollup/build/mapboxgl/src/ui/handler/dblclick_zoom.js","../rollup/build/mapboxgl/src/ui/handler/touch_zoom_rotate.js","../rollup/build/mapboxgl/src/ui/bind_handlers.js","../rollup/build/mapboxgl/src/ui/camera.js","../rollup/build/mapboxgl/src/ui/control/attribution_control.js","../rollup/build/mapboxgl/src/ui/control/logo_control.js","../rollup/build/mapboxgl/src/util/task_queue.js","../rollup/build/mapboxgl/src/ui/map.js","../rollup/build/mapboxgl/src/ui/control/navigation_control.js","../rollup/build/mapboxgl/src/ui/anchor.js","../rollup/build/mapboxgl/src/ui/marker.js","../rollup/build/mapboxgl/src/ui/control/geolocate_control.js","../rollup/build/mapboxgl/src/ui/control/scale_control.js","../rollup/build/mapboxgl/src/ui/control/fullscreen_control.js","../rollup/build/mapboxgl/src/ui/popup.js","../rollup/build/mapboxgl/src/index.js","../rollup/mapboxgl.js"],"sourcesContent":["/*\n * Copyright (C) 2008 Apple Inc. All Rights Reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR\n * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\n * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * Ported from Webkit\n * http://svn.webkit.org/repository/webkit/trunk/Source/WebCore/platform/graphics/UnitBezier.h\n */\n\nmodule.exports = UnitBezier;\n\nfunction UnitBezier(p1x, p1y, p2x, p2y) {\n // Calculate the polynomial coefficients, implicit first and last control points are (0,0) and (1,1).\n this.cx = 3.0 * p1x;\n this.bx = 3.0 * (p2x - p1x) - this.cx;\n this.ax = 1.0 - this.cx - this.bx;\n\n this.cy = 3.0 * p1y;\n this.by = 3.0 * (p2y - p1y) - this.cy;\n this.ay = 1.0 - this.cy - this.by;\n\n this.p1x = p1x;\n this.p1y = p2y;\n this.p2x = p2x;\n this.p2y = p2y;\n}\n\nUnitBezier.prototype.sampleCurveX = function(t) {\n // `ax t^3 + bx t^2 + cx t' expanded using Horner's rule.\n return ((this.ax * t + this.bx) * t + this.cx) * t;\n};\n\nUnitBezier.prototype.sampleCurveY = function(t) {\n return ((this.ay * t + this.by) * t + this.cy) * t;\n};\n\nUnitBezier.prototype.sampleCurveDerivativeX = function(t) {\n return (3.0 * this.ax * t + 2.0 * this.bx) * t + this.cx;\n};\n\nUnitBezier.prototype.solveCurveX = function(x, epsilon) {\n if (typeof epsilon === 'undefined') epsilon = 1e-6;\n\n var t0, t1, t2, x2, i;\n\n // First try a few iterations of Newton's method -- normally very fast.\n for (t2 = x, i = 0; i < 8; i++) {\n\n x2 = this.sampleCurveX(t2) - x;\n if (Math.abs(x2) < epsilon) return t2;\n\n var d2 = this.sampleCurveDerivativeX(t2);\n if (Math.abs(d2) < 1e-6) break;\n\n t2 = t2 - x2 / d2;\n }\n\n // Fall back to the bisection method for reliability.\n t0 = 0.0;\n t1 = 1.0;\n t2 = x;\n\n if (t2 < t0) return t0;\n if (t2 > t1) return t1;\n\n while (t0 < t1) {\n\n x2 = this.sampleCurveX(t2);\n if (Math.abs(x2 - x) < epsilon) return t2;\n\n if (x > x2) {\n t0 = t2;\n } else {\n t1 = t2;\n }\n\n t2 = (t1 - t0) * 0.5 + t0;\n }\n\n // Failure.\n return t2;\n};\n\nUnitBezier.prototype.solve = function(x, epsilon) {\n return this.sampleCurveY(this.solveCurveX(x, epsilon));\n};\n","// @flow\n\n/**\n * A coordinate is a column, row, zoom combination, often used\n * as the data component of a tile.\n *\n * @param {number} column\n * @param {number} row\n * @param {number} zoom\n * @private\n */\nclass Coordinate {\n column: number;\n row: number;\n zoom: number;\n constructor(column: number, row: number, zoom: number) {\n this.column = column;\n this.row = row;\n this.zoom = zoom;\n }\n\n /**\n * Create a clone of this coordinate that can be mutated without\n * changing the original coordinate\n *\n * @returns {Coordinate} clone\n * @private\n * var coord = new Coordinate(0, 0, 0);\n * var c2 = coord.clone();\n * // since coord is cloned, modifying a property of c2 does\n * // not modify it.\n * c2.zoom = 2;\n */\n clone() {\n return new Coordinate(this.column, this.row, this.zoom);\n }\n\n /**\n * Zoom this coordinate to a given zoom level. This returns a new\n * coordinate object, not mutating the old one.\n *\n * @param {number} zoom\n * @returns {Coordinate} zoomed coordinate\n * @private\n * @example\n * var coord = new Coordinate(0, 0, 0);\n * var c2 = coord.zoomTo(1);\n * c2 // equals new Coordinate(0, 0, 1);\n */\n zoomTo(zoom: number) { return this.clone()._zoomTo(zoom); }\n\n /**\n * Subtract the column and row values of this coordinate from those\n * of another coordinate. The other coordinat will be zoomed to the\n * same level as `this` before the subtraction occurs\n *\n * @param {Coordinate} c other coordinate\n * @returns {Coordinate} result\n * @private\n */\n sub(c: Coordinate) { return this.clone()._sub(c); }\n\n _zoomTo(zoom: number) {\n const scale = Math.pow(2, zoom - this.zoom);\n this.column *= scale;\n this.row *= scale;\n this.zoom = zoom;\n return this;\n }\n\n _sub(c: Coordinate) {\n c = c.zoomTo(this.zoom);\n this.column -= c.column;\n this.row -= c.row;\n return this;\n }\n}\n\nexport default Coordinate;\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","// @flow\n\nimport UnitBezier from '@mapbox/unitbezier';\n\nimport Coordinate from '../geo/coordinate';\nimport Point from '@mapbox/point-geometry';\n\nimport type {Callback} from '../types/callback';\n\n/**\n * @module util\n * @private\n */\n\n/**\n * Given a value `t` that varies between 0 and 1, return\n * an interpolation function that eases between 0 and 1 in a pleasing\n * cubic in-out fashion.\n *\n * @private\n */\nexport function easeCubicInOut(t: number): number {\n if (t <= 0) return 0;\n if (t >= 1) return 1;\n const t2 = t * t,\n t3 = t2 * t;\n return 4 * (t < 0.5 ? t3 : 3 * (t - t2) + t3 - 0.75);\n}\n\n/**\n * Given given (x, y), (x1, y1) control points for a bezier curve,\n * return a function that interpolates along that curve.\n *\n * @param p1x control point 1 x coordinate\n * @param p1y control point 1 y coordinate\n * @param p2x control point 2 x coordinate\n * @param p2y control point 2 y coordinate\n * @private\n */\nexport function bezier(p1x: number, p1y: number, p2x: number, p2y: number): (t: number) => number {\n const bezier = new UnitBezier(p1x, p1y, p2x, p2y);\n return function(t: number) {\n return bezier.solve(t);\n };\n}\n\n/**\n * A default bezier-curve powered easing function with\n * control points (0.25, 0.1) and (0.25, 1)\n *\n * @private\n */\nexport const ease = bezier(0.25, 0.1, 0.25, 1);\n\n/**\n * constrain n to the given range via min + max\n *\n * @param n value\n * @param min the minimum value to be returned\n * @param max the maximum value to be returned\n * @returns the clamped value\n * @private\n */\nexport function clamp(n: number, min: number, max: number): number {\n return Math.min(max, Math.max(min, n));\n}\n\n/**\n * constrain n to the given range, excluding the minimum, via modular arithmetic\n *\n * @param n value\n * @param min the minimum value to be returned, exclusive\n * @param max the maximum value to be returned, inclusive\n * @returns constrained number\n * @private\n */\nexport function wrap(n: number, min: number, max: number): number {\n const d = max - min;\n const w = ((n - min) % d + d) % d + min;\n return (w === min) ? max : w;\n}\n\n/*\n * Call an asynchronous function on an array of arguments,\n * calling `callback` with the completed results of all calls.\n *\n * @param array input to each call of the async function.\n * @param fn an async function with signature (data, callback)\n * @param callback a callback run after all async work is done.\n * called with an array, containing the results of each async call.\n * @private\n */\nexport function asyncAll(\n array: Array,\n fn: (item: Item, fnCallback: Callback) => void,\n callback: Callback>\n) {\n if (!array.length) { return callback(null, []); }\n let remaining = array.length;\n const results = new Array(array.length);\n let error = null;\n array.forEach((item, i) => {\n fn(item, (err, result) => {\n if (err) error = err;\n results[i] = ((result: any): Result); // https://github.com/facebook/flow/issues/2123\n if (--remaining === 0) callback(error, results);\n });\n });\n}\n\n/*\n * Polyfill for Object.values. Not fully spec compliant, but we don't\n * need it to be.\n *\n * @private\n */\nexport function values(obj: {[key: string]: T}): Array {\n const result = [];\n for (const k in obj) {\n result.push(obj[k]);\n }\n return result;\n}\n\n/*\n * Compute the difference between the keys in one object and the keys\n * in another object.\n *\n * @returns keys difference\n * @private\n */\nexport function keysDifference(obj: {[key: string]: S}, other: {[key: string]: T}): Array {\n const difference = [];\n for (const i in obj) {\n if (!(i in other)) {\n difference.push(i);\n }\n }\n return difference;\n}\n\n/**\n * Given a destination object and optionally many source objects,\n * copy all properties from the source objects into the destination.\n * The last source object given overrides properties from previous\n * source objects.\n *\n * @param dest destination object\n * @param sources sources from which properties are pulled\n * @private\n */\nexport function extend(dest: Object, ...sources: Array): Object {\n for (const src of sources) {\n for (const k in src) {\n dest[k] = src[k];\n }\n }\n return dest;\n}\n\n/**\n * Given an object and a number of properties as strings, return version\n * of that object with only those properties.\n *\n * @param src the object\n * @param properties an array of property names chosen\n * to appear on the resulting object.\n * @returns object with limited properties.\n * @example\n * var foo = { name: 'Charlie', age: 10 };\n * var justName = pick(foo, ['name']);\n * // justName = { name: 'Charlie' }\n * @private\n */\nexport function pick(src: Object, properties: Array): Object {\n const result = {};\n for (let i = 0; i < properties.length; i++) {\n const k = properties[i];\n if (k in src) {\n result[k] = src[k];\n }\n }\n return result;\n}\n\nlet id = 1;\n\n/**\n * Return a unique numeric id, starting at 1 and incrementing with\n * each call.\n *\n * @returns unique numeric id.\n * @private\n */\nexport function uniqueId(): number {\n return id++;\n}\n\n/**\n * Given an array of member function names as strings, replace all of them\n * with bound versions that will always refer to `context` as `this`. This\n * is useful for classes where otherwise event bindings would reassign\n * `this` to the evented object or some other value: this lets you ensure\n * the `this` value always.\n *\n * @param fns list of member function names\n * @param context the context value\n * @example\n * function MyClass() {\n * bindAll(['ontimer'], this);\n * this.name = 'Tom';\n * }\n * MyClass.prototype.ontimer = function() {\n * alert(this.name);\n * };\n * var myClass = new MyClass();\n * setTimeout(myClass.ontimer, 100);\n * @private\n */\nexport function bindAll(fns: Array, context: Object): void {\n fns.forEach((fn) => {\n if (!context[fn]) { return; }\n context[fn] = context[fn].bind(context);\n });\n}\n\n/**\n * Given a list of coordinates, get their center as a coordinate.\n *\n * @returns centerpoint\n * @private\n */\nexport function getCoordinatesCenter(coords: Array): Coordinate {\n let minX = Infinity;\n let minY = Infinity;\n let maxX = -Infinity;\n let maxY = -Infinity;\n\n for (let i = 0; i < coords.length; i++) {\n minX = Math.min(minX, coords[i].column);\n minY = Math.min(minY, coords[i].row);\n maxX = Math.max(maxX, coords[i].column);\n maxY = Math.max(maxY, coords[i].row);\n }\n\n const dx = maxX - minX;\n const dy = maxY - minY;\n const dMax = Math.max(dx, dy);\n const zoom = Math.max(0, Math.floor(-Math.log(dMax) / Math.LN2));\n return new Coordinate((minX + maxX) / 2, (minY + maxY) / 2, 0)\n .zoomTo(zoom);\n}\n\n/**\n * Determine if a string ends with a particular substring\n *\n * @private\n */\nexport function endsWith(string: string, suffix: string): boolean {\n return string.indexOf(suffix, string.length - suffix.length) !== -1;\n}\n\n/**\n * Create an object by mapping all the values of an existing object while\n * preserving their keys.\n *\n * @private\n */\nexport function mapObject(input: Object, iterator: Function, context?: Object): Object {\n const output = {};\n for (const key in input) {\n output[key] = iterator.call(context || this, input[key], key, input);\n }\n return output;\n}\n\n/**\n * Create an object by filtering out values of an existing object.\n *\n * @private\n */\nexport function filterObject(input: Object, iterator: Function, context?: Object): Object {\n const output = {};\n for (const key in input) {\n if (iterator.call(context || this, input[key], key, input)) {\n output[key] = input[key];\n }\n }\n return output;\n}\n\nimport deepEqual from '../style-spec/util/deep_equal';\nexport { deepEqual };\n\n/**\n * Deeply clones two objects.\n *\n * @private\n */\nexport function clone(input: T): T {\n if (Array.isArray(input)) {\n return input.map(clone);\n } else if (typeof input === 'object' && input) {\n return ((mapObject(input, clone): any): T);\n } else {\n return input;\n }\n}\n\n/**\n * Check if two arrays have at least one common element.\n *\n * @private\n */\nexport function arraysIntersect(a: Array, b: Array): boolean {\n for (let l = 0; l < a.length; l++) {\n if (b.indexOf(a[l]) >= 0) return true;\n }\n return false;\n}\n\n/**\n * Print a warning message to the console and ensure duplicate warning messages\n * are not printed.\n *\n * @private\n */\nconst warnOnceHistory: {[key: string]: boolean} = {};\n\nexport function warnOnce(message: string): void {\n if (!warnOnceHistory[message]) {\n // console isn't defined in some WebWorkers, see #2558\n if (typeof console !== \"undefined\") console.warn(message);\n warnOnceHistory[message] = true;\n }\n}\n\n/**\n * Indicates if the provided Points are in a counter clockwise (true) or clockwise (false) order\n *\n * @private\n * @returns true for a counter clockwise set of points\n */\n// http://bryceboe.com/2006/10/23/line-segment-intersection-algorithm/\nexport function isCounterClockwise(a: Point, b: Point, c: Point): boolean {\n return (c.y - a.y) * (b.x - a.x) > (b.y - a.y) * (c.x - a.x);\n}\n\n/**\n * Returns the signed area for the polygon ring. Postive areas are exterior rings and\n * have a clockwise winding. Negative areas are interior rings and have a counter clockwise\n * ordering.\n *\n * @private\n * @param ring Exterior or interior ring\n */\nexport function calculateSignedArea(ring: Array): number {\n let sum = 0;\n for (let i = 0, len = ring.length, j = len - 1, p1, p2; i < len; j = i++) {\n p1 = ring[i];\n p2 = ring[j];\n sum += (p2.x - p1.x) * (p1.y + p2.y);\n }\n return sum;\n}\n\n/**\n * Detects closed polygons, first + last point are equal\n *\n * @private\n * @param points array of points\n * @return true if the points are a closed polygon\n */\nexport function isClosedPolygon(points: Array): boolean {\n // If it is 2 points that are the same then it is a point\n // If it is 3 points with start and end the same then it is a line\n if (points.length < 4)\n return false;\n\n const p1 = points[0];\n const p2 = points[points.length - 1];\n\n if (Math.abs(p1.x - p2.x) > 0 ||\n Math.abs(p1.y - p2.y) > 0) {\n return false;\n }\n\n // polygon simplification can produce polygons with zero area and more than 3 points\n return Math.abs(calculateSignedArea(points)) > 0.01;\n}\n\n/**\n * Converts spherical coordinates to cartesian coordinates.\n *\n * @private\n * @param spherical Spherical coordinates, in [radial, azimuthal, polar]\n * @return cartesian coordinates in [x, y, z]\n */\n\nexport function sphericalToCartesian([r, azimuthal, polar]: [number, number, number]): {x: number, y: number, z: number} {\n // We abstract \"north\"/\"up\" (compass-wise) to be 0° when really this is 90° (π/2):\n // correct for that here\n azimuthal += 90;\n\n // Convert azimuthal and polar angles to radians\n azimuthal *= Math.PI / 180;\n polar *= Math.PI / 180;\n\n return {\n x: r * Math.cos(azimuthal) * Math.sin(polar),\n y: r * Math.sin(azimuthal) * Math.sin(polar),\n z: r * Math.cos(polar)\n };\n}\n\n/**\n * Parses data from 'Cache-Control' headers.\n *\n * @private\n * @param cacheControl Value of 'Cache-Control' header\n * @return object containing parsed header info.\n */\n\nexport function parseCacheControl(cacheControl: string): Object {\n // Taken from [Wreck](https://github.com/hapijs/wreck)\n const re = /(?:^|(?:\\s*\\,\\s*))([^\\x00-\\x20\\(\\)<>@\\,;\\:\\\\\"\\/\\[\\]\\?\\=\\{\\}\\x7F]+)(?:\\=(?:([^\\x00-\\x20\\(\\)<>@\\,;\\:\\\\\"\\/\\[\\]\\?\\=\\{\\}\\x7F]+)|(?:\\\"((?:[^\"\\\\]|\\\\.)*)\\\")))?/g;\n\n const header = {};\n cacheControl.replace(re, ($0, $1, $2, $3) => {\n const value = $2 || $3;\n header[$1] = value ? value.toLowerCase() : true;\n return '';\n });\n\n if (header['max-age']) {\n const maxAge = parseInt(header['max-age'], 10);\n if (isNaN(maxAge)) delete header['max-age'];\n else header['max-age'] = maxAge;\n }\n\n return header;\n}\n","// @flow\n\nimport window from './window';\n\nimport type { Callback } from '../types/callback';\n\n/**\n * The type of a resource.\n * @private\n * @readonly\n * @enum {string}\n */\nconst ResourceType = {\n Unknown: 'Unknown',\n Style: 'Style',\n Source: 'Source',\n Tile: 'Tile',\n Glyphs: 'Glyphs',\n SpriteImage: 'SpriteImage',\n SpriteJSON: 'SpriteJSON',\n Image: 'Image'\n};\nexport { ResourceType };\n\nif (typeof Object.freeze == 'function') {\n Object.freeze(ResourceType);\n}\n\n/**\n * A `RequestParameters` object to be returned from Map.options.transformRequest callbacks.\n * @typedef {Object} RequestParameters\n * @property {string} url The URL to be requested.\n * @property {Object} headers The headers to be sent with the request.\n * @property {string} credentials `'same-origin'|'include'` Use 'include' to send cookies with cross-origin requests.\n */\nexport type RequestParameters = {\n url: string,\n headers?: Object,\n credentials?: 'same-origin' | 'include',\n collectResourceTiming?: boolean\n};\n\nclass AJAXError extends Error {\n status: number;\n url: string;\n constructor(message: string, status: number, url: string) {\n super(message);\n this.status = status;\n this.url = url;\n\n // work around for https://github.com/Rich-Harris/buble/issues/40\n this.name = this.constructor.name;\n this.message = message;\n }\n\n toString() {\n return `${this.name}: ${this.message} (${this.status}): ${this.url}`;\n }\n}\n\nfunction makeRequest(requestParameters: RequestParameters): XMLHttpRequest {\n const xhr: XMLHttpRequest = new window.XMLHttpRequest();\n\n xhr.open('GET', requestParameters.url, true);\n for (const k in requestParameters.headers) {\n xhr.setRequestHeader(k, requestParameters.headers[k]);\n }\n xhr.withCredentials = requestParameters.credentials === 'include';\n return xhr;\n}\n\nexport const getJSON = function(requestParameters: RequestParameters, callback: Callback) {\n const xhr = makeRequest(requestParameters);\n xhr.setRequestHeader('Accept', 'application/json');\n xhr.onerror = function() {\n callback(new Error(xhr.statusText));\n };\n xhr.onload = function() {\n if (xhr.status >= 200 && xhr.status < 300 && xhr.response) {\n let data;\n try {\n data = JSON.parse(xhr.response);\n } catch (err) {\n return callback(err);\n }\n callback(null, data);\n } else {\n if (xhr.status === 401 && requestParameters.url.match(/mapbox.com/)) {\n callback(new AJAXError(`${xhr.statusText}: you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens`, xhr.status, requestParameters.url));\n } else {\n callback(new AJAXError(xhr.statusText, xhr.status, requestParameters.url));\n }\n }\n };\n xhr.send();\n return xhr;\n};\n\nexport const getArrayBuffer = function(requestParameters: RequestParameters, callback: Callback<{data: ArrayBuffer, cacheControl: ?string, expires: ?string}>) {\n const xhr = makeRequest(requestParameters);\n xhr.responseType = 'arraybuffer';\n xhr.onerror = function() {\n callback(new Error(xhr.statusText));\n };\n xhr.onload = function() {\n const response: ArrayBuffer = xhr.response;\n if (response.byteLength === 0 && xhr.status === 200) {\n return callback(new Error('http status 200 returned without content.'));\n }\n if (xhr.status >= 200 && xhr.status < 300 && xhr.response) {\n callback(null, {\n data: response,\n cacheControl: xhr.getResponseHeader('Cache-Control'),\n expires: xhr.getResponseHeader('Expires')\n });\n } else {\n callback(new AJAXError(xhr.statusText, xhr.status, requestParameters.url));\n }\n };\n xhr.send();\n return xhr;\n};\n\nfunction sameOrigin(url) {\n const a: HTMLAnchorElement = window.document.createElement('a');\n a.href = url;\n return a.protocol === window.document.location.protocol && a.host === window.document.location.host;\n}\n\nconst transparentPngUrl = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=';\n\nexport const getImage = function(requestParameters: RequestParameters, callback: Callback) {\n // request the image with XHR to work around caching issues\n // see https://github.com/mapbox/mapbox-gl-js/issues/1470\n return getArrayBuffer(requestParameters, (err, imgData) => {\n if (err) {\n callback(err);\n } else if (imgData) {\n const img: HTMLImageElement = new window.Image();\n const URL = window.URL || window.webkitURL;\n img.onload = () => {\n callback(null, img);\n URL.revokeObjectURL(img.src);\n };\n const blob: Blob = new window.Blob([new Uint8Array(imgData.data)], { type: 'image/png' });\n (img: any).cacheControl = imgData.cacheControl;\n (img: any).expires = imgData.expires;\n img.src = imgData.data.byteLength ? URL.createObjectURL(blob) : transparentPngUrl;\n }\n });\n};\n\nexport const getVideo = function(urls: Array, callback: Callback) {\n const video: HTMLVideoElement = window.document.createElement('video');\n video.onloadstart = function() {\n callback(null, video);\n };\n for (let i = 0; i < urls.length; i++) {\n const s: HTMLSourceElement = window.document.createElement('source');\n if (!sameOrigin(urls[i])) {\n video.crossOrigin = 'Anonymous';\n }\n s.src = urls[i];\n video.appendChild(s);\n }\n return video;\n};\n","// @flow\n\nimport { extend, endsWith } from './util';\n\ntype Listener = (Object) => any;\ntype Listeners = { [string]: Array };\n\nfunction _addEventListener(type: string, listener: Listener, listenerList: Listeners) {\n listenerList[type] = listenerList[type] || [];\n listenerList[type].push(listener);\n}\n\nfunction _removeEventListener(type: string, listener: Listener, listenerList: Listeners) {\n if (listenerList && listenerList[type]) {\n const index = listenerList[type].indexOf(listener);\n if (index !== -1) {\n listenerList[type].splice(index, 1);\n }\n }\n}\n\nexport class Event {\n +type: string;\n\n constructor(type: string, data: Object = {}) {\n extend(this, data);\n this.type = type;\n }\n}\n\nexport class ErrorEvent extends Event {\n constructor(error: Error, data: Object = {}) {\n super('error', extend({error}, data));\n }\n}\n\n/**\n * Methods mixed in to other classes for event capabilities.\n *\n * @mixin Evented\n */\nexport class Evented {\n _listeners: Listeners;\n _oneTimeListeners: Listeners;\n _eventedParent: ?Evented;\n _eventedParentData: ?(Object | () => Object);\n\n /**\n * Adds a listener to a specified event type.\n *\n * @param {string} type The event type to add a listen for.\n * @param {Function} listener The function to be called when the event is fired.\n * The listener function is called with the data object passed to `fire`,\n * extended with `target` and `type` properties.\n * @returns {Object} `this`\n */\n on(type: *, listener: Listener): this {\n this._listeners = this._listeners || {};\n _addEventListener(type, listener, this._listeners);\n\n return this;\n }\n\n /**\n * Removes a previously registered event listener.\n *\n * @param {string} type The event type to remove listeners for.\n * @param {Function} listener The listener function to remove.\n * @returns {Object} `this`\n */\n off(type: *, listener: Listener) {\n _removeEventListener(type, listener, this._listeners);\n _removeEventListener(type, listener, this._oneTimeListeners);\n\n return this;\n }\n\n /**\n * Adds a listener that will be called only once to a specified event type.\n *\n * The listener will be called first time the event fires after the listener is registered.\n *\n * @param {string} type The event type to listen for.\n * @param {Function} listener The function to be called when the event is fired the first time.\n * @returns {Object} `this`\n */\n once(type: string, listener: Listener) {\n this._oneTimeListeners = this._oneTimeListeners || {};\n _addEventListener(type, listener, this._oneTimeListeners);\n\n return this;\n }\n\n fire(event: Event) {\n // Compatibility with (type: string, properties: Object) signature from previous versions.\n // See https://github.com/mapbox/mapbox-gl-js/issues/6522,\n // https://github.com/mapbox/mapbox-gl-draw/issues/766\n if (typeof event === 'string') {\n event = new Event(event, arguments[1] || {});\n }\n\n const type = event.type;\n\n if (this.listens(type)) {\n (event: any).target = this;\n\n // make sure adding or removing listeners inside other listeners won't cause an infinite loop\n const listeners = this._listeners && this._listeners[type] ? this._listeners[type].slice() : [];\n for (const listener of listeners) {\n listener.call(this, event);\n }\n\n const oneTimeListeners = this._oneTimeListeners && this._oneTimeListeners[type] ? this._oneTimeListeners[type].slice() : [];\n for (const listener of oneTimeListeners) {\n _removeEventListener(type, listener, this._oneTimeListeners);\n listener.call(this, event);\n }\n\n const parent = this._eventedParent;\n if (parent) {\n extend(\n event,\n typeof this._eventedParentData === 'function' ? this._eventedParentData() : this._eventedParentData\n );\n parent.fire(event);\n }\n\n // To ensure that no error events are dropped, print them to the\n // console if they have no listeners.\n } else if (endsWith(type, 'error')) {\n console.error((event && event.error) || event || 'Empty error event');\n } else if (endsWith(type, 'warning')) {\n console.warn((event && event.warning) || event || 'Empty warning event');\n }\n\n return this;\n }\n\n /**\n * Returns a true if this instance of Evented or any forwardeed instances of Evented have a listener for the specified type.\n *\n * @param {string} type The event type\n * @returns {boolean} `true` if there is at least one registered listener for specified event type, `false` otherwise\n * @private\n */\n listens(type: string) {\n return (\n (this._listeners && this._listeners[type] && this._listeners[type].length > 0) ||\n (this._oneTimeListeners && this._oneTimeListeners[type] && this._oneTimeListeners[type].length > 0) ||\n (this._eventedParent && this._eventedParent.listens(type))\n );\n }\n\n /**\n * Bubble all events fired by this instance of Evented to this parent instance of Evented.\n *\n * @private\n * @returns {Object} `this`\n * @private\n */\n setEventedParent(parent: ?Evented, data?: Object | () => Object) {\n this._eventedParent = parent;\n this._eventedParentData = data;\n\n return this;\n }\n}\n","\nexport default class ValidationError {\n constructor(key, value, message, identifier) {\n this.message = (key ? `${key}: ` : '') + message;\n if (identifier) this.identifier = identifier;\n\n if (value !== null && value !== undefined && value.__line__) {\n this.line = value.__line__;\n }\n }\n}\n","\nimport ValidationError from '../error/validation_error';\n\nexport default function validateConstants(options) {\n const key = options.key;\n const constants = options.value;\n\n if (constants) {\n return [new ValidationError(key, constants, 'constants have been deprecated as of v8')];\n } else {\n return [];\n }\n}\n","\n// Turn jsonlint-lines-primitives objects into primitive objects\nexport function unbundle(value) {\n if (value instanceof Number || value instanceof String || value instanceof Boolean) {\n return value.valueOf();\n } else {\n return value;\n }\n}\n\nexport function deepUnbundle(value) {\n if (Array.isArray(value)) {\n return value.map(deepUnbundle);\n }\n return unbundle(value);\n}\n\n","// @flow\n\nclass ParsingError extends Error {\n key: string;\n message: string;\n constructor(key: string, message: string) {\n super(message);\n this.message = message;\n this.key = key;\n }\n}\n\nexport default ParsingError;\n","// @flow\n\nimport type {Expression} from './expression';\n\n/**\n * Tracks `let` bindings during expression parsing.\n * @private\n */\nclass Scope {\n parent: ?Scope;\n bindings: {[string]: Expression};\n constructor(parent?: Scope, bindings: Array<[string, Expression]> = []) {\n this.parent = parent;\n this.bindings = {};\n for (const [name, expression] of bindings) {\n this.bindings[name] = expression;\n }\n }\n\n concat(bindings: Array<[string, Expression]>) {\n return new Scope(this, bindings);\n }\n\n get(name: string): Expression {\n if (this.bindings[name]) { return this.bindings[name]; }\n if (this.parent) { return this.parent.get(name); }\n throw new Error(`${name} not found in scope.`);\n }\n\n has(name: string): boolean {\n if (this.bindings[name]) return true;\n return this.parent ? this.parent.has(name) : false;\n }\n}\n\nexport default Scope;\n","// @flow\n\nexport type NullTypeT = { kind: 'null' };\nexport type NumberTypeT = { kind: 'number' };\nexport type StringTypeT = { kind: 'string' };\nexport type BooleanTypeT = { kind: 'boolean' };\nexport type ColorTypeT = { kind: 'color' };\nexport type ObjectTypeT = { kind: 'object' };\nexport type ValueTypeT = { kind: 'value' };\nexport type ErrorTypeT = { kind: 'error' };\nexport type CollatorTypeT = { kind: 'collator' };\n\nexport type Type =\n NullTypeT |\n NumberTypeT |\n StringTypeT |\n BooleanTypeT |\n ColorTypeT |\n ObjectTypeT |\n ValueTypeT |\n ArrayType | // eslint-disable-line no-use-before-define\n ErrorTypeT |\n CollatorTypeT\n\nexport type ArrayType = {\n kind: 'array',\n itemType: Type,\n N: ?number\n}\n\nexport const NullType = { kind: 'null' };\nexport const NumberType = { kind: 'number' };\nexport const StringType = { kind: 'string' };\nexport const BooleanType = { kind: 'boolean' };\nexport const ColorType = { kind: 'color' };\nexport const ObjectType = { kind: 'object' };\nexport const ValueType = { kind: 'value' };\nexport const ErrorType = { kind: 'error' };\nexport const CollatorType = { kind: 'collator' };\n\nexport function array(itemType: Type, N: ?number): ArrayType {\n return {\n kind: 'array',\n itemType,\n N\n };\n}\n\nexport function toString(type: Type): string {\n if (type.kind === 'array') {\n const itemType = toString(type.itemType);\n return typeof type.N === 'number' ?\n `array<${itemType}, ${type.N}>` :\n type.itemType.kind === 'value' ? 'array' : `array<${itemType}>`;\n } else {\n return type.kind;\n }\n}\n\nconst valueMemberTypes = [\n NullType,\n NumberType,\n StringType,\n BooleanType,\n ColorType,\n ObjectType,\n array(ValueType)\n];\n\n/**\n * Returns null if `t` is a subtype of `expected`; otherwise returns an\n * error message.\n * @private\n */\nexport function checkSubtype(expected: Type, t: Type): ?string {\n if (t.kind === 'error') {\n // Error is a subtype of every type\n return null;\n } else if (expected.kind === 'array') {\n if (t.kind === 'array' &&\n !checkSubtype(expected.itemType, t.itemType) &&\n (typeof expected.N !== 'number' || expected.N === t.N)) {\n return null;\n }\n } else if (expected.kind === t.kind) {\n return null;\n } else if (expected.kind === 'value') {\n for (const memberType of valueMemberTypes) {\n if (!checkSubtype(memberType, t)) {\n return null;\n }\n }\n }\n\n return `Expected ${toString(expected)} but found ${toString(t)} instead.`;\n}\n","// (c) Dean McNamee , 2012.\n//\n// https://github.com/deanm/css-color-parser-js\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to\n// deal in the Software without restriction, including without limitation the\n// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n// sell copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n// IN THE SOFTWARE.\n\n// http://www.w3.org/TR/css3-color/\nvar kCSSColorTable = {\n \"transparent\": [0,0,0,0], \"aliceblue\": [240,248,255,1],\n \"antiquewhite\": [250,235,215,1], \"aqua\": [0,255,255,1],\n \"aquamarine\": [127,255,212,1], \"azure\": [240,255,255,1],\n \"beige\": [245,245,220,1], \"bisque\": [255,228,196,1],\n \"black\": [0,0,0,1], \"blanchedalmond\": [255,235,205,1],\n \"blue\": [0,0,255,1], \"blueviolet\": [138,43,226,1],\n \"brown\": [165,42,42,1], \"burlywood\": [222,184,135,1],\n \"cadetblue\": [95,158,160,1], \"chartreuse\": [127,255,0,1],\n \"chocolate\": [210,105,30,1], \"coral\": [255,127,80,1],\n \"cornflowerblue\": [100,149,237,1], \"cornsilk\": [255,248,220,1],\n \"crimson\": [220,20,60,1], \"cyan\": [0,255,255,1],\n \"darkblue\": [0,0,139,1], \"darkcyan\": [0,139,139,1],\n \"darkgoldenrod\": [184,134,11,1], \"darkgray\": [169,169,169,1],\n \"darkgreen\": [0,100,0,1], \"darkgrey\": [169,169,169,1],\n \"darkkhaki\": [189,183,107,1], \"darkmagenta\": [139,0,139,1],\n \"darkolivegreen\": [85,107,47,1], \"darkorange\": [255,140,0,1],\n \"darkorchid\": [153,50,204,1], \"darkred\": [139,0,0,1],\n \"darksalmon\": [233,150,122,1], \"darkseagreen\": [143,188,143,1],\n \"darkslateblue\": [72,61,139,1], \"darkslategray\": [47,79,79,1],\n \"darkslategrey\": [47,79,79,1], \"darkturquoise\": [0,206,209,1],\n \"darkviolet\": [148,0,211,1], \"deeppink\": [255,20,147,1],\n \"deepskyblue\": [0,191,255,1], \"dimgray\": [105,105,105,1],\n \"dimgrey\": [105,105,105,1], \"dodgerblue\": [30,144,255,1],\n \"firebrick\": [178,34,34,1], \"floralwhite\": [255,250,240,1],\n \"forestgreen\": [34,139,34,1], \"fuchsia\": [255,0,255,1],\n \"gainsboro\": [220,220,220,1], \"ghostwhite\": [248,248,255,1],\n \"gold\": [255,215,0,1], \"goldenrod\": [218,165,32,1],\n \"gray\": [128,128,128,1], \"green\": [0,128,0,1],\n \"greenyellow\": [173,255,47,1], \"grey\": [128,128,128,1],\n \"honeydew\": [240,255,240,1], \"hotpink\": [255,105,180,1],\n \"indianred\": [205,92,92,1], \"indigo\": [75,0,130,1],\n \"ivory\": [255,255,240,1], \"khaki\": [240,230,140,1],\n \"lavender\": [230,230,250,1], \"lavenderblush\": [255,240,245,1],\n \"lawngreen\": [124,252,0,1], \"lemonchiffon\": [255,250,205,1],\n \"lightblue\": [173,216,230,1], \"lightcoral\": [240,128,128,1],\n \"lightcyan\": [224,255,255,1], \"lightgoldenrodyellow\": [250,250,210,1],\n \"lightgray\": [211,211,211,1], \"lightgreen\": [144,238,144,1],\n \"lightgrey\": [211,211,211,1], \"lightpink\": [255,182,193,1],\n \"lightsalmon\": [255,160,122,1], \"lightseagreen\": [32,178,170,1],\n \"lightskyblue\": [135,206,250,1], \"lightslategray\": [119,136,153,1],\n \"lightslategrey\": [119,136,153,1], \"lightsteelblue\": [176,196,222,1],\n \"lightyellow\": [255,255,224,1], \"lime\": [0,255,0,1],\n \"limegreen\": [50,205,50,1], \"linen\": [250,240,230,1],\n \"magenta\": [255,0,255,1], \"maroon\": [128,0,0,1],\n \"mediumaquamarine\": [102,205,170,1], \"mediumblue\": [0,0,205,1],\n \"mediumorchid\": [186,85,211,1], \"mediumpurple\": [147,112,219,1],\n \"mediumseagreen\": [60,179,113,1], \"mediumslateblue\": [123,104,238,1],\n \"mediumspringgreen\": [0,250,154,1], \"mediumturquoise\": [72,209,204,1],\n \"mediumvioletred\": [199,21,133,1], \"midnightblue\": [25,25,112,1],\n \"mintcream\": [245,255,250,1], \"mistyrose\": [255,228,225,1],\n \"moccasin\": [255,228,181,1], \"navajowhite\": [255,222,173,1],\n \"navy\": [0,0,128,1], \"oldlace\": [253,245,230,1],\n \"olive\": [128,128,0,1], \"olivedrab\": [107,142,35,1],\n \"orange\": [255,165,0,1], \"orangered\": [255,69,0,1],\n \"orchid\": [218,112,214,1], \"palegoldenrod\": [238,232,170,1],\n \"palegreen\": [152,251,152,1], \"paleturquoise\": [175,238,238,1],\n \"palevioletred\": [219,112,147,1], \"papayawhip\": [255,239,213,1],\n \"peachpuff\": [255,218,185,1], \"peru\": [205,133,63,1],\n \"pink\": [255,192,203,1], \"plum\": [221,160,221,1],\n \"powderblue\": [176,224,230,1], \"purple\": [128,0,128,1],\n \"rebeccapurple\": [102,51,153,1],\n \"red\": [255,0,0,1], \"rosybrown\": [188,143,143,1],\n \"royalblue\": [65,105,225,1], \"saddlebrown\": [139,69,19,1],\n \"salmon\": [250,128,114,1], \"sandybrown\": [244,164,96,1],\n \"seagreen\": [46,139,87,1], \"seashell\": [255,245,238,1],\n \"sienna\": [160,82,45,1], \"silver\": [192,192,192,1],\n \"skyblue\": [135,206,235,1], \"slateblue\": [106,90,205,1],\n \"slategray\": [112,128,144,1], \"slategrey\": [112,128,144,1],\n \"snow\": [255,250,250,1], \"springgreen\": [0,255,127,1],\n \"steelblue\": [70,130,180,1], \"tan\": [210,180,140,1],\n \"teal\": [0,128,128,1], \"thistle\": [216,191,216,1],\n \"tomato\": [255,99,71,1], \"turquoise\": [64,224,208,1],\n \"violet\": [238,130,238,1], \"wheat\": [245,222,179,1],\n \"white\": [255,255,255,1], \"whitesmoke\": [245,245,245,1],\n \"yellow\": [255,255,0,1], \"yellowgreen\": [154,205,50,1]}\n\nfunction clamp_css_byte(i) { // Clamp to integer 0 .. 255.\n i = Math.round(i); // Seems to be what Chrome does (vs truncation).\n return i < 0 ? 0 : i > 255 ? 255 : i;\n}\n\nfunction clamp_css_float(f) { // Clamp to float 0.0 .. 1.0.\n return f < 0 ? 0 : f > 1 ? 1 : f;\n}\n\nfunction parse_css_int(str) { // int or percentage.\n if (str[str.length - 1] === '%')\n return clamp_css_byte(parseFloat(str) / 100 * 255);\n return clamp_css_byte(parseInt(str));\n}\n\nfunction parse_css_float(str) { // float or percentage.\n if (str[str.length - 1] === '%')\n return clamp_css_float(parseFloat(str) / 100);\n return clamp_css_float(parseFloat(str));\n}\n\nfunction css_hue_to_rgb(m1, m2, h) {\n if (h < 0) h += 1;\n else if (h > 1) h -= 1;\n\n if (h * 6 < 1) return m1 + (m2 - m1) * h * 6;\n if (h * 2 < 1) return m2;\n if (h * 3 < 2) return m1 + (m2 - m1) * (2/3 - h) * 6;\n return m1;\n}\n\nfunction parseCSSColor(css_str) {\n // Remove all whitespace, not compliant, but should just be more accepting.\n var str = css_str.replace(/ /g, '').toLowerCase();\n\n // Color keywords (and transparent) lookup.\n if (str in kCSSColorTable) return kCSSColorTable[str].slice(); // dup.\n\n // #abc and #abc123 syntax.\n if (str[0] === '#') {\n if (str.length === 4) {\n var iv = parseInt(str.substr(1), 16); // TODO(deanm): Stricter parsing.\n if (!(iv >= 0 && iv <= 0xfff)) return null; // Covers NaN.\n return [((iv & 0xf00) >> 4) | ((iv & 0xf00) >> 8),\n (iv & 0xf0) | ((iv & 0xf0) >> 4),\n (iv & 0xf) | ((iv & 0xf) << 4),\n 1];\n } else if (str.length === 7) {\n var iv = parseInt(str.substr(1), 16); // TODO(deanm): Stricter parsing.\n if (!(iv >= 0 && iv <= 0xffffff)) return null; // Covers NaN.\n return [(iv & 0xff0000) >> 16,\n (iv & 0xff00) >> 8,\n iv & 0xff,\n 1];\n }\n\n return null;\n }\n\n var op = str.indexOf('('), ep = str.indexOf(')');\n if (op !== -1 && ep + 1 === str.length) {\n var fname = str.substr(0, op);\n var params = str.substr(op+1, ep-(op+1)).split(',');\n var alpha = 1; // To allow case fallthrough.\n switch (fname) {\n case 'rgba':\n if (params.length !== 4) return null;\n alpha = parse_css_float(params.pop());\n // Fall through.\n case 'rgb':\n if (params.length !== 3) return null;\n return [parse_css_int(params[0]),\n parse_css_int(params[1]),\n parse_css_int(params[2]),\n alpha];\n case 'hsla':\n if (params.length !== 4) return null;\n alpha = parse_css_float(params.pop());\n // Fall through.\n case 'hsl':\n if (params.length !== 3) return null;\n var h = (((parseFloat(params[0]) % 360) + 360) % 360) / 360; // 0 .. 1\n // NOTE(deanm): According to the CSS spec s/l should only be\n // percentages, but we don't bother and let float or percentage.\n var s = parse_css_float(params[1]);\n var l = parse_css_float(params[2]);\n var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;\n var m1 = l * 2 - m2;\n return [clamp_css_byte(css_hue_to_rgb(m1, m2, h+1/3) * 255),\n clamp_css_byte(css_hue_to_rgb(m1, m2, h) * 255),\n clamp_css_byte(css_hue_to_rgb(m1, m2, h-1/3) * 255),\n alpha];\n default:\n return null;\n }\n }\n\n return null;\n}\n\ntry { exports.parseCSSColor = parseCSSColor } catch(e) { }\n","// @flow\n\nimport { parseCSSColor } from 'csscolorparser';\n\n/**\n * An RGBA color value. Create instances from color strings using the static\n * method `Color.parse`. The constructor accepts RGB channel values in the range\n * `[0, 1]`, premultiplied by A.\n *\n * @param {number} r The red channel.\n * @param {number} g The green channel.\n * @param {number} b The blue channel.\n * @param {number} a The alpha channel.\n * @private\n */\nclass Color {\n r: number;\n g: number;\n b: number;\n a: number;\n\n constructor(r: number, g: number, b: number, a: number = 1) {\n this.r = r;\n this.g = g;\n this.b = b;\n this.a = a;\n }\n\n static black: Color;\n static white: Color;\n static transparent: Color;\n\n /**\n * Parses valid CSS color strings and returns a `Color` instance.\n * @returns A `Color` instance, or `undefined` if the input is not a valid color string.\n */\n static parse(input: ?string): Color | void {\n if (!input) {\n return undefined;\n }\n\n if (input instanceof Color) {\n return input;\n }\n\n if (typeof input !== 'string') {\n return undefined;\n }\n\n const rgba = parseCSSColor(input);\n if (!rgba) {\n return undefined;\n }\n\n return new Color(\n rgba[0] / 255 * rgba[3],\n rgba[1] / 255 * rgba[3],\n rgba[2] / 255 * rgba[3],\n rgba[3]\n );\n }\n\n /**\n * Returns an RGBA string representing the color value.\n *\n * @returns An RGBA string.\n * @example\n * var purple = new Color.parse('purple');\n * purple.toString; // = \"rgba(128,0,128,1)\"\n * var translucentGreen = new Color.parse('rgba(26, 207, 26, .73)');\n * translucentGreen.toString(); // = \"rgba(26,207,26,0.73)\"\n */\n toString(): string {\n const [r, g, b, a] = this.toArray();\n return `rgba(${Math.round(r)},${Math.round(g)},${Math.round(b)},${a})`;\n }\n\n toArray(): [number, number, number, number] {\n const {r, g, b, a} = this;\n return a === 0 ? [0, 0, 0, 0] : [\n r * 255 / a,\n g * 255 / a,\n b * 255 / a,\n a\n ];\n }\n}\n\nColor.black = new Color(0, 0, 0, 1);\nColor.white = new Color(1, 1, 1, 1);\nColor.transparent = new Color(0, 0, 0, 0);\n\nexport default Color;\n","// @flow\n\nimport { StringType, BooleanType, CollatorType } from '../types';\n\nimport type { Expression } from '../expression';\nimport type EvaluationContext from '../evaluation_context';\nimport type ParsingContext from '../parsing_context';\nimport type { Type } from '../types';\n\n// Flow type declarations for Intl cribbed from\n// https://github.com/facebook/flow/issues/1270\n\ndeclare var Intl: {\n Collator: Class\n}\n\ndeclare class Intl$Collator {\n constructor (\n locales?: string | string[],\n options?: CollatorOptions\n ): Intl$Collator;\n\n static (\n locales?: string | string[],\n options?: CollatorOptions\n ): Intl$Collator;\n\n compare (a: string, b: string): number;\n\n resolvedOptions(): any;\n}\n\ntype CollatorOptions = {\n localeMatcher?: 'lookup' | 'best fit',\n usage?: 'sort' | 'search',\n sensitivity?: 'base' | 'accent' | 'case' | 'variant',\n ignorePunctuation?: boolean,\n numeric?: boolean,\n caseFirst?: 'upper' | 'lower' | 'false'\n}\n\nexport class Collator {\n locale: string | null;\n sensitivity: 'base' | 'accent' | 'case' | 'variant';\n collator: Intl$Collator;\n\n constructor(caseSensitive: boolean, diacriticSensitive: boolean, locale: string | null) {\n if (caseSensitive)\n this.sensitivity = diacriticSensitive ? 'variant' : 'case';\n else\n this.sensitivity = diacriticSensitive ? 'accent' : 'base';\n\n this.locale = locale;\n this.collator = new Intl.Collator(this.locale ? this.locale : [],\n { sensitivity: this.sensitivity, usage: 'search' });\n }\n\n compare(lhs: string, rhs: string): number {\n return this.collator.compare(lhs, rhs);\n }\n\n resolvedLocale(): string {\n // We create a Collator without \"usage: search\" because we don't want\n // the search options encoded in our result (e.g. \"en-u-co-search\")\n return new Intl.Collator(this.locale ? this.locale : [])\n .resolvedOptions().locale;\n }\n}\n\nexport class CollatorExpression implements Expression {\n type: Type;\n caseSensitive: Expression;\n diacriticSensitive: Expression;\n locale: Expression | null;\n\n constructor(caseSensitive: Expression, diacriticSensitive: Expression, locale: Expression | null) {\n this.type = CollatorType;\n this.locale = locale;\n this.caseSensitive = caseSensitive;\n this.diacriticSensitive = diacriticSensitive;\n }\n\n static parse(args: Array, context: ParsingContext): ?Expression {\n if (args.length !== 2)\n return context.error(`Expected one argument.`);\n\n const options = (args[1]: any);\n if (typeof options !== \"object\" || Array.isArray(options))\n return context.error(`Collator options argument must be an object.`);\n\n const caseSensitive = context.parse(\n options['case-sensitive'] === undefined ? false : options['case-sensitive'], 1, BooleanType);\n if (!caseSensitive) return null;\n\n const diacriticSensitive = context.parse(\n options['diacritic-sensitive'] === undefined ? false : options['diacritic-sensitive'], 1, BooleanType);\n if (!diacriticSensitive) return null;\n\n let locale = null;\n if (options['locale']) {\n locale = context.parse(options['locale'], 1, StringType);\n if (!locale) return null;\n }\n\n return new CollatorExpression(caseSensitive, diacriticSensitive, locale);\n }\n\n evaluate(ctx: EvaluationContext) {\n return new Collator(this.caseSensitive.evaluate(ctx), this.diacriticSensitive.evaluate(ctx), this.locale ? this.locale.evaluate(ctx) : null);\n }\n\n eachChild(fn: (Expression) => void) {\n fn(this.caseSensitive);\n fn(this.diacriticSensitive);\n if (this.locale) {\n fn(this.locale);\n }\n }\n\n possibleOutputs() {\n // Technically the set of possible outputs is the combinatoric set of Collators produced\n // by all possibleOutputs of locale/caseSensitive/diacriticSensitive\n // But for the primary use of Collators in comparison operators, we ignore the Collator's\n // possibleOutputs anyway, so we can get away with leaving this undefined for now.\n return [undefined];\n }\n\n serialize() {\n const options = {};\n options['case-sensitive'] = this.caseSensitive.serialize();\n options['diacritic-sensitive'] = this.diacriticSensitive.serialize();\n if (this.locale) {\n options['locale'] = this.locale.serialize();\n }\n return [\"collator\", options];\n }\n}\n","// @flow\n\nimport assert from 'assert';\n\nimport Color from '../util/color';\nimport { Collator } from './definitions/collator';\nimport { NullType, NumberType, StringType, BooleanType, ColorType, ObjectType, ValueType, CollatorType, array } from './types';\n\nimport type { Type } from './types';\n\nexport function validateRGBA(r: mixed, g: mixed, b: mixed, a?: mixed): ?string {\n if (!(\n typeof r === 'number' && r >= 0 && r <= 255 &&\n typeof g === 'number' && g >= 0 && g <= 255 &&\n typeof b === 'number' && b >= 0 && b <= 255\n )) {\n const value = typeof a === 'number' ? [r, g, b, a] : [r, g, b];\n return `Invalid rgba value [${value.join(', ')}]: 'r', 'g', and 'b' must be between 0 and 255.`;\n }\n\n if (!(\n typeof a === 'undefined' || (typeof a === 'number' && a >= 0 && a <= 1)\n )) {\n return `Invalid rgba value [${[r, g, b, a].join(', ')}]: 'a' must be between 0 and 1.`;\n }\n\n return null;\n}\n\nexport type Value = null | string | boolean | number | Color | Collator | $ReadOnlyArray | { +[string]: Value }\n\nexport function isValue(mixed: mixed): boolean {\n if (mixed === null) {\n return true;\n } else if (typeof mixed === 'string') {\n return true;\n } else if (typeof mixed === 'boolean') {\n return true;\n } else if (typeof mixed === 'number') {\n return true;\n } else if (mixed instanceof Color) {\n return true;\n } else if (mixed instanceof Collator) {\n return true;\n } else if (Array.isArray(mixed)) {\n for (const item of mixed) {\n if (!isValue(item)) {\n return false;\n }\n }\n return true;\n } else if (typeof mixed === 'object') {\n for (const key in mixed) {\n if (!isValue(mixed[key])) {\n return false;\n }\n }\n return true;\n } else {\n return false;\n }\n}\n\nexport function typeOf(value: Value): Type {\n if (value === null) {\n return NullType;\n } else if (typeof value === 'string') {\n return StringType;\n } else if (typeof value === 'boolean') {\n return BooleanType;\n } else if (typeof value === 'number') {\n return NumberType;\n } else if (value instanceof Color) {\n return ColorType;\n } else if (value instanceof Collator) {\n return CollatorType;\n } else if (Array.isArray(value)) {\n const length = value.length;\n let itemType: ?Type;\n\n for (const item of value) {\n const t = typeOf(item);\n if (!itemType) {\n itemType = t;\n } else if (itemType === t) {\n continue;\n } else {\n itemType = ValueType;\n break;\n }\n }\n\n return array(itemType || ValueType, length);\n } else {\n assert(typeof value === 'object');\n return ObjectType;\n }\n}\n\nexport { Color, Collator };\n","// @flow\n\nimport assert from 'assert';\nimport { isValue, typeOf, Color } from '../values';\n\nimport type { Type } from '../types';\nimport type { Value } from '../values';\nimport type { Expression } from '../expression';\nimport type ParsingContext from '../parsing_context';\n\nclass Literal implements Expression {\n type: Type;\n value: Value;\n\n constructor(type: Type, value: Value) {\n this.type = type;\n this.value = value;\n }\n\n static parse(args: Array, context: ParsingContext) {\n if (args.length !== 2)\n return context.error(`'literal' expression requires exactly one argument, but found ${args.length - 1} instead.`);\n\n if (!isValue(args[1]))\n return context.error(`invalid value`);\n\n const value = (args[1]: any);\n let type = typeOf(value);\n\n // special case: infer the item type if possible for zero-length arrays\n const expected = context.expectedType;\n if (\n type.kind === 'array' &&\n type.N === 0 &&\n expected &&\n expected.kind === 'array' &&\n (typeof expected.N !== 'number' || expected.N === 0)\n ) {\n type = expected;\n }\n\n return new Literal(type, value);\n }\n\n evaluate() {\n return this.value;\n }\n\n eachChild() {}\n\n possibleOutputs() {\n return [this.value];\n }\n\n serialize() {\n if (this.type.kind === 'array' || this.type.kind === 'object') {\n return [\"literal\", this.value];\n } else if (this.value instanceof Color) {\n // Constant-folding can generate Literal expressions that you\n // couldn't actually generate with a \"literal\" expression,\n // so we have to implement an equivalent serialization here\n return [\"rgba\"].concat(this.value.toArray());\n } else {\n assert(this.value === null ||\n typeof this.value === 'string' ||\n typeof this.value === 'number' ||\n typeof this.value === 'boolean');\n return (this.value: any);\n }\n }\n}\n\nexport default Literal;\n","// @flow\n\nclass RuntimeError {\n name: string;\n message: string;\n\n constructor(message: string) {\n this.name = 'ExpressionEvaluationError';\n this.message = message;\n }\n\n toJSON() {\n return this.message;\n }\n}\n\nexport default RuntimeError;\n","// @flow\n\nimport assert from 'assert';\n\nimport {\n ObjectType,\n ValueType,\n StringType,\n NumberType,\n BooleanType,\n checkSubtype,\n toString\n} from '../types';\nimport RuntimeError from '../runtime_error';\nimport { typeOf } from '../values';\n\nimport type { Expression } from '../expression';\nimport type ParsingContext from '../parsing_context';\nimport type EvaluationContext from '../evaluation_context';\nimport type { Type } from '../types';\n\nconst types = {\n string: StringType,\n number: NumberType,\n boolean: BooleanType,\n object: ObjectType\n};\n\nclass Assertion implements Expression {\n type: Type;\n args: Array;\n\n constructor(type: Type, args: Array) {\n this.type = type;\n this.args = args;\n }\n\n static parse(args: Array, context: ParsingContext): ?Expression {\n if (args.length < 2)\n return context.error(`Expected at least one argument.`);\n\n const name: string = (args[0]: any);\n assert(types[name], name);\n\n const type = types[name];\n\n const parsed = [];\n for (let i = 1; i < args.length; i++) {\n const input = context.parse(args[i], i, ValueType);\n if (!input) return null;\n parsed.push(input);\n }\n\n return new Assertion(type, parsed);\n }\n\n evaluate(ctx: EvaluationContext) {\n for (let i = 0; i < this.args.length; i++) {\n const value = this.args[i].evaluate(ctx);\n const error = checkSubtype(this.type, typeOf(value));\n if (!error) {\n return value;\n } else if (i === this.args.length - 1) {\n throw new RuntimeError(`Expected value to be of type ${toString(this.type)}, but found ${toString(typeOf(value))} instead.`);\n }\n }\n\n assert(false);\n return null;\n }\n\n eachChild(fn: (Expression) => void) {\n this.args.forEach(fn);\n }\n\n possibleOutputs() {\n return [].concat(...this.args.map((arg) => arg.possibleOutputs()));\n }\n\n serialize() {\n return [this.type.kind].concat(this.args.map(arg => arg.serialize()));\n }\n}\n\nexport default Assertion;\n","// @flow\n\nimport { toString, array, ValueType, StringType, NumberType, BooleanType, checkSubtype } from '../types';\n\nimport { typeOf } from '../values';\nimport RuntimeError from '../runtime_error';\n\nimport type { Expression } from '../expression';\nimport type ParsingContext from '../parsing_context';\nimport type EvaluationContext from '../evaluation_context';\nimport type { ArrayType } from '../types';\n\nconst types = {\n string: StringType,\n number: NumberType,\n boolean: BooleanType\n};\n\nclass ArrayAssertion implements Expression {\n type: ArrayType;\n input: Expression;\n\n constructor(type: ArrayType, input: Expression) {\n this.type = type;\n this.input = input;\n }\n\n static parse(args: Array, context: ParsingContext): ?Expression {\n if (args.length < 2 || args.length > 4)\n return context.error(`Expected 1, 2, or 3 arguments, but found ${args.length - 1} instead.`);\n\n let itemType;\n let N;\n if (args.length > 2) {\n const type = args[1];\n if (typeof type !== 'string' || !(type in types))\n return context.error('The item type argument of \"array\" must be one of string, number, boolean', 1);\n itemType = types[type];\n } else {\n itemType = ValueType;\n }\n\n if (args.length > 3) {\n if (\n typeof args[2] !== 'number' ||\n args[2] < 0 ||\n args[2] !== Math.floor(args[2])\n ) {\n return context.error('The length argument to \"array\" must be a positive integer literal', 2);\n }\n N = args[2];\n }\n\n const type = array(itemType, N);\n\n const input = context.parse(args[args.length - 1], args.length - 1, ValueType);\n if (!input) return null;\n\n return new ArrayAssertion(type, input);\n }\n\n evaluate(ctx: EvaluationContext) {\n const value = this.input.evaluate(ctx);\n const error = checkSubtype(this.type, typeOf(value));\n if (error) {\n throw new RuntimeError(`Expected value to be of type ${toString(this.type)}, but found ${toString(typeOf(value))} instead.`);\n }\n return value;\n }\n\n eachChild(fn: (Expression) => void) {\n fn(this.input);\n }\n\n possibleOutputs() {\n return this.input.possibleOutputs();\n }\n\n serialize() {\n const serialized = [\"array\"];\n const itemType = this.type.itemType;\n if (itemType.kind === 'string' ||\n itemType.kind === 'number' ||\n itemType.kind === 'boolean') {\n serialized.push(itemType.kind);\n const N = this.type.N;\n if (typeof N === 'number') {\n serialized.push(N);\n }\n }\n serialized.push(this.input.serialize());\n return serialized;\n }\n}\n\nexport default ArrayAssertion;\n","// @flow\n\nimport assert from 'assert';\n\nimport { ColorType, ValueType, NumberType } from '../types';\nimport { Color, validateRGBA } from '../values';\nimport RuntimeError from '../runtime_error';\n\nimport type { Expression } from '../expression';\nimport type ParsingContext from '../parsing_context';\nimport type EvaluationContext from '../evaluation_context';\nimport type { Type } from '../types';\n\nconst types = {\n 'to-number': NumberType,\n 'to-color': ColorType\n};\n\n/**\n * Special form for error-coalescing coercion expressions \"to-number\",\n * \"to-color\". Since these coercions can fail at runtime, they accept multiple\n * arguments, only evaluating one at a time until one succeeds.\n *\n * @private\n */\nclass Coercion implements Expression {\n type: Type;\n args: Array;\n\n constructor(type: Type, args: Array) {\n this.type = type;\n this.args = args;\n }\n\n static parse(args: Array, context: ParsingContext): ?Expression {\n if (args.length < 2)\n return context.error(`Expected at least one argument.`);\n\n const name: string = (args[0]: any);\n assert(types[name], name);\n\n const type = types[name];\n\n const parsed = [];\n for (let i = 1; i < args.length; i++) {\n const input = context.parse(args[i], i, ValueType);\n if (!input) return null;\n parsed.push(input);\n }\n\n return new Coercion(type, parsed);\n }\n\n evaluate(ctx: EvaluationContext) {\n if (this.type.kind === 'color') {\n let input;\n let error;\n for (const arg of this.args) {\n input = arg.evaluate(ctx);\n error = null;\n if (typeof input === 'string') {\n const c = ctx.parseColor(input);\n if (c) return c;\n } else if (Array.isArray(input)) {\n if (input.length < 3 || input.length > 4) {\n error = `Invalid rbga value ${JSON.stringify(input)}: expected an array containing either three or four numeric values.`;\n } else {\n error = validateRGBA(input[0], input[1], input[2], input[3]);\n }\n if (!error) {\n return new Color((input[0]: any) / 255, (input[1]: any) / 255, (input[2]: any) / 255, (input[3]: any));\n }\n }\n }\n throw new RuntimeError(error || `Could not parse color from value '${typeof input === 'string' ? input : JSON.stringify(input)}'`);\n } else {\n let value = null;\n for (const arg of this.args) {\n value = arg.evaluate(ctx);\n if (value === null) continue;\n const num = Number(value);\n if (isNaN(num)) continue;\n return num;\n }\n throw new RuntimeError(`Could not convert ${JSON.stringify(value)} to number.`);\n }\n }\n\n eachChild(fn: (Expression) => void) {\n this.args.forEach(fn);\n }\n\n possibleOutputs() {\n return [].concat(...this.args.map((arg) => arg.possibleOutputs()));\n }\n\n serialize() {\n const serialized = [`to-${this.type.kind}`];\n this.eachChild(child => { serialized.push(child.serialize()); });\n return serialized;\n }\n}\n\nexport default Coercion;\n","// @flow\n\nimport { Color } from './values';\n\nimport type { Feature, GlobalProperties } from './index';\n\nconst geometryTypes = ['Unknown', 'Point', 'LineString', 'Polygon'];\n\nclass EvaluationContext {\n globals: GlobalProperties;\n feature: ?Feature;\n\n _parseColorCache: {[string]: ?Color};\n\n constructor() {\n this._parseColorCache = {};\n }\n\n id() {\n return this.feature && 'id' in this.feature ? this.feature.id : null;\n }\n\n geometryType() {\n return this.feature ? typeof this.feature.type === 'number' ? geometryTypes[this.feature.type] : this.feature.type : null;\n }\n\n properties() {\n return this.feature && this.feature.properties || {};\n }\n\n parseColor(input: string): ?Color {\n let cached = this._parseColorCache[input];\n if (!cached) {\n cached = this._parseColorCache[input] = Color.parse(input);\n }\n return cached;\n }\n}\n\nexport default EvaluationContext;\n","// @flow\n\nimport { toString } from './types';\n\nimport ParsingContext from './parsing_context';\nimport EvaluationContext from './evaluation_context';\nimport assert from 'assert';\n\nimport type { Expression, ExpressionRegistry } from './expression';\nimport type { Type } from './types';\nimport type { Value } from './values';\n\nexport type Varargs = {| type: Type |};\ntype Signature = Array | Varargs;\ntype Evaluate = (EvaluationContext, Array) => Value;\ntype Definition = [Type, Signature, Evaluate] |\n {|type: Type, overloads: Array<[Signature, Evaluate]>|};\n\nclass CompoundExpression implements Expression {\n name: string;\n type: Type;\n _evaluate: Evaluate;\n args: Array;\n\n static definitions: { [string]: Definition };\n\n constructor(name: string, type: Type, evaluate: Evaluate, args: Array) {\n this.name = name;\n this.type = type;\n this._evaluate = evaluate;\n this.args = args;\n }\n\n evaluate(ctx: EvaluationContext) {\n return this._evaluate(ctx, this.args);\n }\n\n eachChild(fn: (Expression) => void) {\n this.args.forEach(fn);\n }\n\n possibleOutputs() {\n return [undefined];\n }\n\n serialize() {\n return [this.name].concat(this.args.map(arg => arg.serialize()));\n }\n\n static parse(args: Array, context: ParsingContext): ?Expression {\n const op: string = (args[0]: any);\n const definition = CompoundExpression.definitions[op];\n if (!definition) {\n return context.error(`Unknown expression \"${op}\". If you wanted a literal array, use [\"literal\", [...]].`, 0);\n }\n\n // Now check argument types against each signature\n const type = Array.isArray(definition) ?\n definition[0] : definition.type;\n\n const availableOverloads = Array.isArray(definition) ?\n [[definition[1], definition[2]]] :\n definition.overloads;\n\n const overloads = availableOverloads.filter(([signature]) => (\n !Array.isArray(signature) || // varags\n signature.length === args.length - 1 // correct param count\n ));\n\n // First parse all the args\n const parsedArgs: Array = [];\n for (let i = 1; i < args.length; i++) {\n const arg = args[i];\n let expected;\n if (overloads.length === 1) {\n const params = overloads[0][0];\n expected = Array.isArray(params) ?\n params[i - 1] :\n params.type;\n }\n const parsed = context.parse(arg, 1 + parsedArgs.length, expected);\n if (!parsed) return null;\n parsedArgs.push(parsed);\n }\n\n let signatureContext: ParsingContext = (null: any);\n\n for (const [params, evaluate] of overloads) {\n // Use a fresh context for each attempted signature so that, if\n // we eventually succeed, we haven't polluted `context.errors`.\n signatureContext = new ParsingContext(context.registry, context.path, null, context.scope);\n\n if (Array.isArray(params)) {\n if (params.length !== parsedArgs.length) {\n signatureContext.error(`Expected ${params.length} arguments, but found ${parsedArgs.length} instead.`);\n continue;\n }\n }\n\n for (let i = 0; i < parsedArgs.length; i++) {\n const expected = Array.isArray(params) ? params[i] : params.type;\n const arg = parsedArgs[i];\n signatureContext.concat(i + 1).checkSubtype(expected, arg.type);\n }\n\n if (signatureContext.errors.length === 0) {\n return new CompoundExpression(op, type, evaluate, parsedArgs);\n }\n }\n\n assert(!signatureContext || signatureContext.errors.length > 0);\n\n if (overloads.length === 1) {\n context.errors.push.apply(context.errors, signatureContext.errors);\n } else {\n const expected = overloads.length ? overloads : availableOverloads;\n const signatures = expected\n .map(([params]) => stringifySignature(params))\n .join(' | ');\n const actualTypes = parsedArgs\n .map(arg => toString(arg.type))\n .join(', ');\n context.error(`Expected arguments of type ${signatures}, but found (${actualTypes}) instead.`);\n }\n\n return null;\n }\n\n static register(\n registry: ExpressionRegistry,\n definitions: { [string]: Definition }\n ) {\n assert(!CompoundExpression.definitions);\n CompoundExpression.definitions = definitions;\n for (const name in definitions) {\n registry[name] = CompoundExpression;\n }\n }\n}\n\nfunction stringifySignature(signature: Signature): string {\n if (Array.isArray(signature)) {\n return `(${signature.map(toString).join(', ')})`;\n } else {\n return `(${toString(signature.type)}...)`;\n }\n}\n\nexport default CompoundExpression;\n","// @flow\n\nimport CompoundExpression from './compound_expression';\n\nimport type { Expression } from './expression.js';\n\nfunction isFeatureConstant(e: Expression) {\n if (e instanceof CompoundExpression) {\n if (e.name === 'get' && e.args.length === 1) {\n return false;\n } else if (e.name === 'has' && e.args.length === 1) {\n return false;\n } else if (\n e.name === 'properties' ||\n e.name === 'geometry-type' ||\n e.name === 'id'\n ) {\n return false;\n } else if (/^filter-/.test(e.name)) {\n return false;\n }\n }\n\n let result = true;\n e.eachChild(arg => {\n if (result && !isFeatureConstant(arg)) { result = false; }\n });\n return result;\n}\n\nfunction isGlobalPropertyConstant(e: Expression, properties: Array) {\n if (e instanceof CompoundExpression && properties.indexOf(e.name) >= 0) { return false; }\n let result = true;\n e.eachChild((arg) => {\n if (result && !isGlobalPropertyConstant(arg, properties)) { result = false; }\n });\n return result;\n}\n\nexport { isFeatureConstant, isGlobalPropertyConstant };\n","// @flow\n\nimport type { Type } from '../types';\nimport type { Expression } from '../expression';\nimport type ParsingContext from '../parsing_context';\nimport type EvaluationContext from '../evaluation_context';\n\nclass Var implements Expression {\n type: Type;\n name: string;\n boundExpression: Expression;\n\n constructor(name: string, boundExpression: Expression) {\n this.type = boundExpression.type;\n this.name = name;\n this.boundExpression = boundExpression;\n }\n\n static parse(args: Array, context: ParsingContext) {\n if (args.length !== 2 || typeof args[1] !== 'string')\n return context.error(`'var' expression requires exactly one string literal argument.`);\n\n const name = args[1];\n if (!context.scope.has(name)) {\n return context.error(`Unknown variable \"${name}\". Make sure \"${name}\" has been bound in an enclosing \"let\" expression before using it.`, 1);\n }\n\n return new Var(name, context.scope.get(name));\n }\n\n evaluate(ctx: EvaluationContext) {\n return this.boundExpression.evaluate(ctx);\n }\n\n eachChild() {}\n\n possibleOutputs() {\n return [undefined];\n }\n\n serialize() {\n return [\"var\", this.name];\n }\n}\n\nexport default Var;\n","// @flow\n\nimport Scope from './scope';\n\nimport { checkSubtype } from './types';\nimport ParsingError from './parsing_error';\nimport Literal from './definitions/literal';\nimport Assertion from './definitions/assertion';\nimport ArrayAssertion from './definitions/array';\nimport Coercion from './definitions/coercion';\nimport EvaluationContext from './evaluation_context';\nimport CompoundExpression from './compound_expression';\nimport { CollatorExpression } from './definitions/collator';\nimport {isGlobalPropertyConstant, isFeatureConstant} from './is_constant';\nimport Var from './definitions/var';\n\n\nimport type {Expression, ExpressionRegistry} from './expression';\nimport type {Type} from './types';\n\n/**\n * State associated parsing at a given point in an expression tree.\n * @private\n */\nclass ParsingContext {\n registry: ExpressionRegistry;\n path: Array;\n key: string;\n scope: Scope;\n errors: Array;\n\n // The expected type of this expression. Provided only to allow Expression\n // implementations to infer argument types: Expression#parse() need not\n // check that the output type of the parsed expression matches\n // `expectedType`.\n expectedType: ?Type;\n\n constructor(\n registry: ExpressionRegistry,\n path: Array = [],\n expectedType: ?Type,\n scope: Scope = new Scope(),\n errors: Array = []\n ) {\n this.registry = registry;\n this.path = path;\n this.key = path.map(part => `[${part}]`).join('');\n this.scope = scope;\n this.errors = errors;\n this.expectedType = expectedType;\n }\n\n /**\n * @param expr the JSON expression to parse\n * @param index the optional argument index if this expression is an argument of a parent expression that's being parsed\n * @param options\n * @param options.omitTypeAnnotations set true to omit inferred type annotations. Caller beware: with this option set, the parsed expression's type will NOT satisfy `expectedType` if it would normally be wrapped in an inferred annotation.\n * @private\n */\n parse(\n expr: mixed,\n index?: number,\n expectedType?: ?Type,\n bindings?: Array<[string, Expression]>,\n options: {omitTypeAnnotations?: boolean} = {}\n ): ?Expression {\n if (index) {\n return this.concat(index, expectedType, bindings)._parse(expr, options);\n }\n return this._parse(expr, options);\n }\n\n _parse(expr: mixed, options: {omitTypeAnnotations?: boolean}): ?Expression {\n\n if (expr === null || typeof expr === 'string' || typeof expr === 'boolean' || typeof expr === 'number') {\n expr = ['literal', expr];\n }\n\n if (Array.isArray(expr)) {\n if (expr.length === 0) {\n return this.error(`Expected an array with at least one element. If you wanted a literal array, use [\"literal\", []].`);\n }\n\n const op = expr[0];\n if (typeof op !== 'string') {\n this.error(`Expression name must be a string, but found ${typeof op} instead. If you wanted a literal array, use [\"literal\", [...]].`, 0);\n return null;\n }\n\n const Expr = this.registry[op];\n if (Expr) {\n let parsed = Expr.parse(expr, this);\n if (!parsed) return null;\n\n if (this.expectedType) {\n const expected = this.expectedType;\n const actual = parsed.type;\n\n // When we expect a number, string, boolean, or array but\n // have a Value, we can wrap it in a refining assertion.\n // When we expect a Color but have a String or Value, we\n // can wrap it in \"to-color\" coercion.\n // Otherwise, we do static type-checking.\n if ((expected.kind === 'string' || expected.kind === 'number' || expected.kind === 'boolean' || expected.kind === 'object') && actual.kind === 'value') {\n if (!options.omitTypeAnnotations) {\n parsed = new Assertion(expected, [parsed]);\n }\n } else if (expected.kind === 'array' && actual.kind === 'value') {\n if (!options.omitTypeAnnotations) {\n parsed = new ArrayAssertion(expected, parsed);\n }\n } else if (expected.kind === 'color' && (actual.kind === 'value' || actual.kind === 'string')) {\n if (!options.omitTypeAnnotations) {\n parsed = new Coercion(expected, [parsed]);\n }\n } else if (this.checkSubtype(this.expectedType, parsed.type)) {\n return null;\n }\n }\n\n // If an expression's arguments are all literals, we can evaluate\n // it immediately and replace it with a literal value in the\n // parsed/compiled result.\n if (!(parsed instanceof Literal) && isConstant(parsed)) {\n const ec = new EvaluationContext();\n try {\n parsed = new Literal(parsed.type, parsed.evaluate(ec));\n } catch (e) {\n this.error(e.message);\n return null;\n }\n }\n\n return parsed;\n }\n\n return this.error(`Unknown expression \"${op}\". If you wanted a literal array, use [\"literal\", [...]].`, 0);\n } else if (typeof expr === 'undefined') {\n return this.error(`'undefined' value invalid. Use null instead.`);\n } else if (typeof expr === 'object') {\n return this.error(`Bare objects invalid. Use [\"literal\", {...}] instead.`);\n } else {\n return this.error(`Expected an array, but found ${typeof expr} instead.`);\n }\n }\n\n /**\n * Returns a copy of this context suitable for parsing the subexpression at\n * index `index`, optionally appending to 'let' binding map.\n *\n * Note that `errors` property, intended for collecting errors while\n * parsing, is copied by reference rather than cloned.\n * @private\n */\n concat(index: number, expectedType?: ?Type, bindings?: Array<[string, Expression]>) {\n const path = typeof index === 'number' ? this.path.concat(index) : this.path;\n const scope = bindings ? this.scope.concat(bindings) : this.scope;\n return new ParsingContext(\n this.registry,\n path,\n expectedType || null,\n scope,\n this.errors\n );\n }\n\n /**\n * Push a parsing (or type checking) error into the `this.errors`\n * @param error The message\n * @param keys Optionally specify the source of the error at a child\n * of the current expression at `this.key`.\n * @private\n */\n error(error: string, ...keys: Array) {\n const key = `${this.key}${keys.map(k => `[${k}]`).join('')}`;\n this.errors.push(new ParsingError(key, error));\n }\n\n /**\n * Returns null if `t` is a subtype of `expected`; otherwise returns an\n * error message and also pushes it to `this.errors`.\n */\n checkSubtype(expected: Type, t: Type): ?string {\n const error = checkSubtype(expected, t);\n if (error) this.error(error);\n return error;\n }\n}\n\nexport default ParsingContext;\n\nfunction isConstant(expression: Expression) {\n if (expression instanceof Var) {\n return isConstant(expression.boundExpression);\n } else if (expression instanceof CompoundExpression && expression.name === 'error') {\n return false;\n } else if (expression instanceof CollatorExpression) {\n // Although the results of a Collator expression with fixed arguments\n // generally shouldn't change between executions, we can't serialize them\n // as constant expressions because results change based on environment.\n return false;\n }\n\n const isTypeAnnotation = expression instanceof Coercion ||\n expression instanceof Assertion ||\n expression instanceof ArrayAssertion;\n\n let childrenConstant = true;\n expression.eachChild(child => {\n // We can _almost_ assume that if `expressions` children are constant,\n // they would already have been evaluated to Literal values when they\n // were parsed. Type annotations are the exception, because they might\n // have been inferred and added after a child was parsed.\n\n // So we recurse into isConstant() for the children of type annotations,\n // but otherwise simply check whether they are Literals.\n if (isTypeAnnotation) {\n childrenConstant = childrenConstant && isConstant(child);\n } else {\n childrenConstant = childrenConstant && child instanceof Literal;\n }\n });\n if (!childrenConstant) {\n return false;\n }\n\n return isFeatureConstant(expression) &&\n isGlobalPropertyConstant(expression, ['zoom', 'heatmap-density', 'line-progress', 'is-supported-script']);\n}\n","// @flow\n\nimport RuntimeError from './runtime_error';\n\nimport type { Expression } from './expression';\n\nexport type Stops = Array<[number, Expression]>;\n\n/**\n * Returns the index of the last stop <= input, or 0 if it doesn't exist.\n * @private\n */\nexport function findStopLessThanOrEqualTo(stops: Array, input: number) {\n const n = stops.length;\n let lowerIndex = 0;\n let upperIndex = n - 1;\n let currentIndex = 0;\n let currentValue, upperValue;\n\n while (lowerIndex <= upperIndex) {\n currentIndex = Math.floor((lowerIndex + upperIndex) / 2);\n currentValue = stops[currentIndex];\n upperValue = stops[currentIndex + 1];\n if (input === currentValue || input > currentValue && input < upperValue) { // Search complete\n return currentIndex;\n } else if (currentValue < input) {\n lowerIndex = currentIndex + 1;\n } else if (currentValue > input) {\n upperIndex = currentIndex - 1;\n } else {\n throw new RuntimeError('Input is not a number.');\n }\n }\n\n return Math.max(currentIndex - 1, 0);\n}\n","// @flow\n\nimport { NumberType } from '../types';\n\nimport { findStopLessThanOrEqualTo } from '../stops';\n\nimport type { Stops } from '../stops';\nimport type { Expression } from '../expression';\nimport type ParsingContext from '../parsing_context';\nimport type EvaluationContext from '../evaluation_context';\nimport type { Type } from '../types';\n\nclass Step implements Expression {\n type: Type;\n\n input: Expression;\n labels: Array;\n outputs: Array;\n\n constructor(type: Type, input: Expression, stops: Stops) {\n this.type = type;\n this.input = input;\n\n this.labels = [];\n this.outputs = [];\n for (const [label, expression] of stops) {\n this.labels.push(label);\n this.outputs.push(expression);\n }\n }\n\n static parse(args: Array, context: ParsingContext) {\n let [ , input, ...rest] = args;\n\n if (args.length - 1 < 4) {\n return context.error(`Expected at least 4 arguments, but found only ${args.length - 1}.`);\n }\n\n if ((args.length - 1) % 2 !== 0) {\n return context.error(`Expected an even number of arguments.`);\n }\n\n input = context.parse(input, 1, NumberType);\n if (!input) return null;\n\n const stops: Stops = [];\n\n let outputType: Type = (null: any);\n if (context.expectedType && context.expectedType.kind !== 'value') {\n outputType = context.expectedType;\n }\n\n rest.unshift(-Infinity);\n\n for (let i = 0; i < rest.length; i += 2) {\n const label = rest[i];\n const value = rest[i + 1];\n\n const labelKey = i + 1;\n const valueKey = i + 2;\n\n if (typeof label !== 'number') {\n return context.error('Input/output pairs for \"step\" expressions must be defined using literal numeric values (not computed expressions) for the input values.', labelKey);\n }\n\n if (stops.length && stops[stops.length - 1][0] >= label) {\n return context.error('Input/output pairs for \"step\" expressions must be arranged with input values in strictly ascending order.', labelKey);\n }\n\n const parsed = context.parse(value, valueKey, outputType);\n if (!parsed) return null;\n outputType = outputType || parsed.type;\n stops.push([label, parsed]);\n }\n\n return new Step(outputType, input, stops);\n }\n\n evaluate(ctx: EvaluationContext) {\n const labels = this.labels;\n const outputs = this.outputs;\n\n if (labels.length === 1) {\n return outputs[0].evaluate(ctx);\n }\n\n const value = ((this.input.evaluate(ctx): any): number);\n if (value <= labels[0]) {\n return outputs[0].evaluate(ctx);\n }\n\n const stopCount = labels.length;\n if (value >= labels[stopCount - 1]) {\n return outputs[stopCount - 1].evaluate(ctx);\n }\n\n const index = findStopLessThanOrEqualTo(labels, value);\n return outputs[index].evaluate(ctx);\n }\n\n eachChild(fn: (Expression) => void) {\n fn(this.input);\n for (const expression of this.outputs) {\n fn(expression);\n }\n }\n\n possibleOutputs() {\n return [].concat(...this.outputs.map((output) => output.possibleOutputs()));\n }\n\n serialize() {\n const serialized = [\"step\", this.input.serialize()];\n for (let i = 0; i < this.labels.length; i++) {\n if (i > 0) {\n serialized.push(this.labels[i]);\n }\n serialized.push(this.outputs[i].serialize());\n }\n return serialized;\n }\n}\n\nexport default Step;\n","// @flow\n\nimport Color from './color';\n\nexport function number(a: number, b: number, t: number) {\n return (a * (1 - t)) + (b * t);\n}\n\nexport function color(from: Color, to: Color, t: number) {\n return new Color(\n number(from.r, to.r, t),\n number(from.g, to.g, t),\n number(from.b, to.b, t),\n number(from.a, to.a, t)\n );\n}\n\nexport function array(from: Array, to: Array, t: number) {\n return from.map((d, i) => {\n return number(d, to[i], t);\n });\n}\n","// @flow\n\nimport UnitBezier from '@mapbox/unitbezier';\n\nimport * as interpolate from '../../util/interpolate';\nimport { toString, NumberType } from '../types';\nimport { findStopLessThanOrEqualTo } from '../stops';\n\nimport type { Stops } from '../stops';\nimport type { Expression } from '../expression';\nimport type ParsingContext from '../parsing_context';\nimport type EvaluationContext from '../evaluation_context';\nimport type { Type } from '../types';\n\nexport type InterpolationType =\n { name: 'linear' } |\n { name: 'exponential', base: number } |\n { name: 'cubic-bezier', controlPoints: [number, number, number, number] };\n\nclass Interpolate implements Expression {\n type: Type;\n\n interpolation: InterpolationType;\n input: Expression;\n labels: Array;\n outputs: Array;\n\n constructor(type: Type, interpolation: InterpolationType, input: Expression, stops: Stops) {\n this.type = type;\n this.interpolation = interpolation;\n this.input = input;\n\n this.labels = [];\n this.outputs = [];\n for (const [label, expression] of stops) {\n this.labels.push(label);\n this.outputs.push(expression);\n }\n }\n\n static interpolationFactor(interpolation: InterpolationType, input: number, lower: number, upper: number) {\n let t = 0;\n if (interpolation.name === 'exponential') {\n t = exponentialInterpolation(input, interpolation.base, lower, upper);\n } else if (interpolation.name === 'linear') {\n t = exponentialInterpolation(input, 1, lower, upper);\n } else if (interpolation.name === 'cubic-bezier') {\n const c = interpolation.controlPoints;\n const ub = new UnitBezier(c[0], c[1], c[2], c[3]);\n t = ub.solve(exponentialInterpolation(input, 1, lower, upper));\n }\n return t;\n }\n\n static parse(args: Array, context: ParsingContext) {\n let [ , interpolation, input, ...rest] = args;\n\n if (!Array.isArray(interpolation) || interpolation.length === 0) {\n return context.error(`Expected an interpolation type expression.`, 1);\n }\n\n if (interpolation[0] === 'linear') {\n interpolation = { name: 'linear' };\n } else if (interpolation[0] === 'exponential') {\n const base = interpolation[1];\n if (typeof base !== 'number')\n return context.error(`Exponential interpolation requires a numeric base.`, 1, 1);\n interpolation = {\n name: 'exponential',\n base\n };\n } else if (interpolation[0] === 'cubic-bezier') {\n const controlPoints = interpolation.slice(1);\n if (\n controlPoints.length !== 4 ||\n controlPoints.some(t => typeof t !== 'number' || t < 0 || t > 1)\n ) {\n return context.error('Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.', 1);\n }\n\n interpolation = {\n name: 'cubic-bezier',\n controlPoints: (controlPoints: any)\n };\n } else {\n return context.error(`Unknown interpolation type ${String(interpolation[0])}`, 1, 0);\n }\n\n if (args.length - 1 < 4) {\n return context.error(`Expected at least 4 arguments, but found only ${args.length - 1}.`);\n }\n\n if ((args.length - 1) % 2 !== 0) {\n return context.error(`Expected an even number of arguments.`);\n }\n\n input = context.parse(input, 2, NumberType);\n if (!input) return null;\n\n const stops: Stops = [];\n\n let outputType: Type = (null: any);\n if (context.expectedType && context.expectedType.kind !== 'value') {\n outputType = context.expectedType;\n }\n\n for (let i = 0; i < rest.length; i += 2) {\n const label = rest[i];\n const value = rest[i + 1];\n\n const labelKey = i + 3;\n const valueKey = i + 4;\n\n if (typeof label !== 'number') {\n return context.error('Input/output pairs for \"interpolate\" expressions must be defined using literal numeric values (not computed expressions) for the input values.', labelKey);\n }\n\n if (stops.length && stops[stops.length - 1][0] >= label) {\n return context.error('Input/output pairs for \"interpolate\" expressions must be arranged with input values in strictly ascending order.', labelKey);\n }\n\n const parsed = context.parse(value, valueKey, outputType);\n if (!parsed) return null;\n outputType = outputType || parsed.type;\n stops.push([label, parsed]);\n }\n\n if (outputType.kind !== 'number' &&\n outputType.kind !== 'color' &&\n !(\n outputType.kind === 'array' &&\n outputType.itemType.kind === 'number' &&\n typeof outputType.N === 'number'\n )\n ) {\n return context.error(`Type ${toString(outputType)} is not interpolatable.`);\n }\n\n return new Interpolate(outputType, interpolation, input, stops);\n }\n\n evaluate(ctx: EvaluationContext) {\n const labels = this.labels;\n const outputs = this.outputs;\n\n if (labels.length === 1) {\n return outputs[0].evaluate(ctx);\n }\n\n const value = ((this.input.evaluate(ctx): any): number);\n if (value <= labels[0]) {\n return outputs[0].evaluate(ctx);\n }\n\n const stopCount = labels.length;\n if (value >= labels[stopCount - 1]) {\n return outputs[stopCount - 1].evaluate(ctx);\n }\n\n const index = findStopLessThanOrEqualTo(labels, value);\n const lower = labels[index];\n const upper = labels[index + 1];\n const t = Interpolate.interpolationFactor(this.interpolation, value, lower, upper);\n\n const outputLower = outputs[index].evaluate(ctx);\n const outputUpper = outputs[index + 1].evaluate(ctx);\n\n return (interpolate[this.type.kind.toLowerCase()]: any)(outputLower, outputUpper, t); // eslint-disable-line import/namespace\n }\n\n eachChild(fn: (Expression) => void) {\n fn(this.input);\n for (const expression of this.outputs) {\n fn(expression);\n }\n }\n\n possibleOutputs() {\n return [].concat(...this.outputs.map((output) => output.possibleOutputs()));\n }\n\n serialize() {\n let interpolation;\n if (this.interpolation.name === 'linear') {\n interpolation = [\"linear\"];\n } else if (this.interpolation.name === 'exponential') {\n if (this.interpolation.base === 1) {\n interpolation = [\"linear\"];\n } else {\n interpolation = [\"exponential\", this.interpolation.base];\n }\n } else {\n interpolation = [\"cubic-bezier\" ].concat(this.interpolation.controlPoints);\n }\n\n const serialized = [\"interpolate\", interpolation, this.input.serialize()];\n\n for (let i = 0; i < this.labels.length; i++) {\n serialized.push(\n this.labels[i],\n this.outputs[i].serialize()\n );\n }\n return serialized;\n }\n}\n\n/**\n * Returns a ratio that can be used to interpolate between exponential function\n * stops.\n * How it works: Two consecutive stop values define a (scaled and shifted) exponential function `f(x) = a * base^x + b`, where `base` is the user-specified base,\n * and `a` and `b` are constants affording sufficient degrees of freedom to fit\n * the function to the given stops.\n *\n * Here's a bit of algebra that lets us compute `f(x)` directly from the stop\n * values without explicitly solving for `a` and `b`:\n *\n * First stop value: `f(x0) = y0 = a * base^x0 + b`\n * Second stop value: `f(x1) = y1 = a * base^x1 + b`\n * => `y1 - y0 = a(base^x1 - base^x0)`\n * => `a = (y1 - y0)/(base^x1 - base^x0)`\n *\n * Desired value: `f(x) = y = a * base^x + b`\n * => `f(x) = y0 + a * (base^x - base^x0)`\n *\n * From the above, we can replace the `a` in `a * (base^x - base^x0)` and do a\n * little algebra:\n * ```\n * a * (base^x - base^x0) = (y1 - y0)/(base^x1 - base^x0) * (base^x - base^x0)\n * = (y1 - y0) * (base^x - base^x0) / (base^x1 - base^x0)\n * ```\n *\n * If we let `(base^x - base^x0) / (base^x1 base^x0)`, then we have\n * `f(x) = y0 + (y1 - y0) * ratio`. In other words, `ratio` may be treated as\n * an interpolation factor between the two stops' output values.\n *\n * (Note: a slightly different form for `ratio`,\n * `(base^(x-x0) - 1) / (base^(x1-x0) - 1) `, is equivalent, but requires fewer\n * expensive `Math.pow()` operations.)\n *\n * @private\n*/\nfunction exponentialInterpolation(input, base, lowerValue, upperValue) {\n const difference = upperValue - lowerValue;\n const progress = input - lowerValue;\n\n if (difference === 0) {\n return 0;\n } else if (base === 1) {\n return progress / difference;\n } else {\n return (Math.pow(base, progress) - 1) / (Math.pow(base, difference) - 1);\n }\n}\n\nexport default Interpolate;\n","// @flow\n\nimport assert from 'assert';\n\nimport { checkSubtype, ValueType } from '../types';\n\nimport type { Expression } from '../expression';\nimport type ParsingContext from '../parsing_context';\nimport type EvaluationContext from '../evaluation_context';\nimport type { Type } from '../types';\n\nclass Coalesce implements Expression {\n type: Type;\n args: Array;\n\n constructor(type: Type, args: Array) {\n this.type = type;\n this.args = args;\n }\n\n static parse(args: Array, context: ParsingContext) {\n if (args.length < 2) {\n return context.error(\"Expectected at least one argument.\");\n }\n let outputType: Type = (null: any);\n const expectedType = context.expectedType;\n if (expectedType && expectedType.kind !== 'value') {\n outputType = expectedType;\n }\n const parsedArgs = [];\n\n for (const arg of args.slice(1)) {\n const parsed = context.parse(arg, 1 + parsedArgs.length, outputType, undefined, {omitTypeAnnotations: true});\n if (!parsed) return null;\n outputType = outputType || parsed.type;\n parsedArgs.push(parsed);\n }\n assert(outputType);\n\n // Above, we parse arguments without inferred type annotation so that\n // they don't produce a runtime error for `null` input, which would\n // preempt the desired null-coalescing behavior.\n // Thus, if any of our arguments would have needed an annotation, we\n // need to wrap the enclosing coalesce expression with it instead.\n const needsAnnotation = expectedType &&\n parsedArgs.some(arg => checkSubtype(expectedType, arg.type));\n\n return needsAnnotation ?\n new Coalesce(ValueType, parsedArgs) :\n new Coalesce((outputType: any), parsedArgs);\n }\n\n evaluate(ctx: EvaluationContext) {\n let result = null;\n for (const arg of this.args) {\n result = arg.evaluate(ctx);\n if (result !== null) break;\n }\n return result;\n }\n\n eachChild(fn: (Expression) => void) {\n this.args.forEach(fn);\n }\n\n possibleOutputs() {\n return [].concat(...this.args.map((arg) => arg.possibleOutputs()));\n }\n\n serialize() {\n const serialized = [\"coalesce\"];\n this.eachChild(child => { serialized.push(child.serialize()); });\n return serialized;\n }\n}\n\nexport default Coalesce;\n","// @flow\n\nimport type { Type } from '../types';\nimport type { Expression } from '../expression';\nimport type ParsingContext from '../parsing_context';\nimport type EvaluationContext from '../evaluation_context';\n\nclass Let implements Expression {\n type: Type;\n bindings: Array<[string, Expression]>;\n result: Expression;\n\n constructor(bindings: Array<[string, Expression]>, result: Expression) {\n this.type = result.type;\n this.bindings = [].concat(bindings);\n this.result = result;\n }\n\n evaluate(ctx: EvaluationContext) {\n return this.result.evaluate(ctx);\n }\n\n eachChild(fn: (Expression) => void) {\n for (const binding of this.bindings) {\n fn(binding[1]);\n }\n fn(this.result);\n }\n\n static parse(args: Array, context: ParsingContext) {\n if (args.length < 4)\n return context.error(`Expected at least 3 arguments, but found ${args.length - 1} instead.`);\n\n const bindings: Array<[string, Expression]> = [];\n for (let i = 1; i < args.length - 1; i += 2) {\n const name = args[i];\n\n if (typeof name !== 'string') {\n return context.error(`Expected string, but found ${typeof name} instead.`, i);\n }\n\n if (/[^a-zA-Z0-9_]/.test(name)) {\n return context.error(`Variable names must contain only alphanumeric characters or '_'.`, i);\n }\n\n const value = context.parse(args[i + 1], i + 1);\n if (!value) return null;\n\n bindings.push([name, value]);\n }\n\n const result = context.parse(args[args.length - 1], args.length - 1, undefined, bindings);\n if (!result) return null;\n\n return new Let(bindings, result);\n }\n\n possibleOutputs() {\n return this.result.possibleOutputs();\n }\n\n serialize() {\n const serialized = [\"let\"];\n for (const [name, expr] of this.bindings) {\n serialized.push(name, expr.serialize());\n }\n serialized.push(this.result.serialize());\n return serialized;\n }\n}\n\nexport default Let;\n","// @flow\n\nimport { array, ValueType, NumberType } from '../types';\n\nimport RuntimeError from '../runtime_error';\n\nimport type { Expression } from '../expression';\nimport type ParsingContext from '../parsing_context';\nimport type EvaluationContext from '../evaluation_context';\nimport type { Type, ArrayType } from '../types';\nimport type { Value } from '../values';\n\nclass At implements Expression {\n type: Type;\n index: Expression;\n input: Expression;\n\n constructor(type: Type, index: Expression, input: Expression) {\n this.type = type;\n this.index = index;\n this.input = input;\n }\n\n static parse(args: Array, context: ParsingContext) {\n if (args.length !== 3)\n return context.error(`Expected 2 arguments, but found ${args.length - 1} instead.`);\n\n const index = context.parse(args[1], 1, NumberType);\n const input = context.parse(args[2], 2, array(context.expectedType || ValueType));\n\n if (!index || !input) return null;\n\n const t: ArrayType = (input.type: any);\n return new At(t.itemType, index, input);\n }\n\n evaluate(ctx: EvaluationContext) {\n const index = ((this.index.evaluate(ctx): any): number);\n const array = ((this.input.evaluate(ctx): any): Array);\n\n if (index < 0) {\n throw new RuntimeError(`Array index out of bounds: ${index} < 0.`);\n }\n\n if (index >= array.length) {\n throw new RuntimeError(`Array index out of bounds: ${index} > ${array.length - 1}.`);\n }\n\n if (index !== Math.floor(index)) {\n throw new RuntimeError(`Array index must be an integer, but found ${index} instead.`);\n }\n\n return array[index];\n }\n\n eachChild(fn: (Expression) => void) {\n fn(this.index);\n fn(this.input);\n }\n\n possibleOutputs() {\n return [undefined];\n }\n\n serialize() {\n return [\"at\", this.index.serialize(), this.input.serialize()];\n }\n}\n\nexport default At;\n","// @flow\n\nimport assert from 'assert';\n\nimport { typeOf } from '../values';\n\nimport type { Expression } from '../expression';\nimport type ParsingContext from '../parsing_context';\nimport type EvaluationContext from '../evaluation_context';\nimport type { Type } from '../types';\n\n// Map input label values to output expression index\ntype Cases = {[number | string]: number};\n\nclass Match implements Expression {\n type: Type;\n inputType: Type;\n\n input: Expression;\n cases: Cases;\n outputs: Array;\n otherwise: Expression;\n\n constructor(inputType: Type, outputType: Type, input: Expression, cases: Cases, outputs: Array, otherwise: Expression) {\n this.inputType = inputType;\n this.type = outputType;\n this.input = input;\n this.cases = cases;\n this.outputs = outputs;\n this.otherwise = otherwise;\n }\n\n static parse(args: Array, context: ParsingContext) {\n if (args.length < 5)\n return context.error(`Expected at least 4 arguments, but found only ${args.length - 1}.`);\n if (args.length % 2 !== 1)\n return context.error(`Expected an even number of arguments.`);\n\n let inputType;\n let outputType;\n if (context.expectedType && context.expectedType.kind !== 'value') {\n outputType = context.expectedType;\n }\n const cases = {};\n const outputs = [];\n for (let i = 2; i < args.length - 1; i += 2) {\n let labels = args[i];\n const value = args[i + 1];\n\n if (!Array.isArray(labels)) {\n labels = [labels];\n }\n\n const labelContext = context.concat(i);\n if (labels.length === 0) {\n return labelContext.error('Expected at least one branch label.');\n }\n\n for (const label of labels) {\n if (typeof label !== 'number' && typeof label !== 'string') {\n return labelContext.error(`Branch labels must be numbers or strings.`);\n } else if (typeof label === 'number' && Math.abs(label) > Number.MAX_SAFE_INTEGER) {\n return labelContext.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);\n\n } else if (typeof label === 'number' && Math.floor(label) !== label) {\n return labelContext.error(`Numeric branch labels must be integer values.`);\n\n } else if (!inputType) {\n inputType = typeOf(label);\n } else if (labelContext.checkSubtype(inputType, typeOf(label))) {\n return null;\n }\n\n if (typeof cases[String(label)] !== 'undefined') {\n return labelContext.error('Branch labels must be unique.');\n }\n\n cases[String(label)] = outputs.length;\n }\n\n const result = context.parse(value, i, outputType);\n if (!result) return null;\n outputType = outputType || result.type;\n outputs.push(result);\n }\n\n const input = context.parse(args[1], 1, inputType);\n if (!input) return null;\n\n const otherwise = context.parse(args[args.length - 1], args.length - 1, outputType);\n if (!otherwise) return null;\n\n assert(inputType && outputType);\n return new Match((inputType: any), (outputType: any), input, cases, outputs, otherwise);\n }\n\n evaluate(ctx: EvaluationContext) {\n const input = (this.input.evaluate(ctx): any);\n return (this.outputs[this.cases[input]] || this.otherwise).evaluate(ctx);\n }\n\n eachChild(fn: (Expression) => void) {\n fn(this.input);\n this.outputs.forEach(fn);\n fn(this.otherwise);\n }\n\n possibleOutputs() {\n return []\n .concat(...this.outputs.map((out) => out.possibleOutputs()))\n .concat(this.otherwise.possibleOutputs());\n }\n\n serialize() {\n const serialized = [\"match\", this.input.serialize()];\n\n // Sort so serialization has an arbitrary defined order, even though\n // branch order doesn't affect evaluation\n const sortedLabels = Object.keys(this.cases).sort();\n\n // Group branches by unique match expression to support condensed\n // serializations of the form [case1, case2, ...] -> matchExpression\n const groupedByOutput: Array<[number, Array]> = [];\n const outputLookup: {[index: number]: number} = {}; // lookup index into groupedByOutput for a given output expression\n for (const label of sortedLabels) {\n const outputIndex = outputLookup[this.cases[label]];\n if (outputIndex === undefined) {\n // First time seeing this output, add it to the end of the grouped list\n outputLookup[this.cases[label]] = groupedByOutput.length;\n groupedByOutput.push([this.cases[label], [label]]);\n } else {\n // We've seen this expression before, add the label to that output's group\n groupedByOutput[outputIndex][1].push(label);\n }\n }\n\n const coerceLabel = (label) => this.input.type.kind === 'number' ? Number(label) : label;\n\n for (const [outputIndex, labels] of groupedByOutput) {\n if (labels.length === 1) {\n // Only a single label matches this output expression\n serialized.push(coerceLabel(labels[0]));\n } else {\n // Array of literal labels pointing to this output expression\n serialized.push(labels.map(coerceLabel));\n }\n serialized.push(this.outputs[outputIndex].serialize());\n }\n serialized.push(this.otherwise.serialize());\n return serialized;\n }\n}\n\nexport default Match;\n","// @flow\n\nimport assert from 'assert';\n\nimport { BooleanType } from '../types';\n\nimport type { Expression } from '../expression';\nimport type ParsingContext from '../parsing_context';\nimport type EvaluationContext from '../evaluation_context';\nimport type { Type } from '../types';\n\ntype Branches = Array<[Expression, Expression]>;\n\nclass Case implements Expression {\n type: Type;\n\n branches: Branches;\n otherwise: Expression;\n\n constructor(type: Type, branches: Branches, otherwise: Expression) {\n this.type = type;\n this.branches = branches;\n this.otherwise = otherwise;\n }\n\n static parse(args: Array, context: ParsingContext) {\n if (args.length < 4)\n return context.error(`Expected at least 3 arguments, but found only ${args.length - 1}.`);\n if (args.length % 2 !== 0)\n return context.error(`Expected an odd number of arguments.`);\n\n let outputType: ?Type;\n if (context.expectedType && context.expectedType.kind !== 'value') {\n outputType = context.expectedType;\n }\n\n const branches = [];\n for (let i = 1; i < args.length - 1; i += 2) {\n const test = context.parse(args[i], i, BooleanType);\n if (!test) return null;\n\n const result = context.parse(args[i + 1], i + 1, outputType);\n if (!result) return null;\n\n branches.push([test, result]);\n\n outputType = outputType || result.type;\n }\n\n const otherwise = context.parse(args[args.length - 1], args.length - 1, outputType);\n if (!otherwise) return null;\n\n assert(outputType);\n return new Case((outputType: any), branches, otherwise);\n }\n\n evaluate(ctx: EvaluationContext) {\n for (const [test, expression] of this.branches) {\n if (test.evaluate(ctx)) {\n return expression.evaluate(ctx);\n }\n }\n return this.otherwise.evaluate(ctx);\n }\n\n eachChild(fn: (Expression) => void) {\n for (const [test, expression] of this.branches) {\n fn(test);\n fn(expression);\n }\n fn(this.otherwise);\n }\n\n possibleOutputs() {\n return []\n .concat(...this.branches.map(([_, out]) => out.possibleOutputs()))\n .concat(this.otherwise.possibleOutputs());\n }\n\n serialize() {\n const serialized = [\"case\"];\n this.eachChild(child => { serialized.push(child.serialize()); });\n return serialized;\n }\n}\n\nexport default Case;\n","// @flow\n\nimport { toString, ValueType, BooleanType, CollatorType } from '../types';\n\nimport type { Expression } from '../expression';\nimport type EvaluationContext from '../evaluation_context';\nimport type ParsingContext from '../parsing_context';\nimport type { Type } from '../types';\n\nfunction isComparableType(type: Type) {\n return type.kind === 'string' ||\n type.kind === 'number' ||\n type.kind === 'boolean' ||\n type.kind === 'null';\n}\n\n/**\n * Special form for ==, !=, implementing the following signatures:\n * - (T1: Comparable, T2: Comparable) => boolean { T1 == T2 }\n * - (Comparable, value) => boolean\n * - (value, Comparable) => boolean\n *\n * Where Comparable = string | number | boolean | null.\n *\n * Evaluation semantics for the value cases are equivalent to Javascript's\n * strict equality (===/!==) -- i.e., when the value argument's type doesn't\n * match that of the Comparable argument, == evaluates to false, != to true.\n *\n * @private\n */\nfunction makeComparison(op: string, negate: boolean) {\n return class Comparison implements Expression {\n type: Type;\n lhs: Expression;\n rhs: Expression;\n collator: Expression | null;\n\n constructor(lhs: Expression, rhs: Expression, collator: Expression | null) {\n this.type = BooleanType;\n this.lhs = lhs;\n this.rhs = rhs;\n this.collator = collator;\n }\n\n static parse(args: Array, context: ParsingContext): ?Expression {\n if (args.length !== 3 && args.length !== 4)\n return context.error(`Expected two or three arguments.`);\n\n const lhs = context.parse(args[1], 1, ValueType);\n if (!lhs) return null;\n const rhs = context.parse(args[2], 2, ValueType);\n if (!rhs) return null;\n\n if (!isComparableType(lhs.type) && !isComparableType(rhs.type)) {\n return context.error(`Expected at least one argument to be a string, number, boolean, or null, but found (${toString(lhs.type)}, ${toString(rhs.type)}) instead.`);\n }\n\n if (lhs.type.kind !== rhs.type.kind && lhs.type.kind !== 'value' && rhs.type.kind !== 'value') {\n return context.error(`Cannot compare ${toString(lhs.type)} and ${toString(rhs.type)}.`);\n }\n\n let collator = null;\n if (args.length === 4) {\n if (lhs.type.kind !== 'string' && rhs.type.kind !== 'string') {\n return context.error(`Cannot use collator to compare non-string types.`);\n }\n collator = context.parse(args[3], 3, CollatorType);\n if (!collator) return null;\n }\n\n return new Comparison(lhs, rhs, collator);\n }\n\n evaluate(ctx: EvaluationContext) {\n const equal = this.collator ?\n this.collator.evaluate(ctx).compare(this.lhs.evaluate(ctx), this.rhs.evaluate(ctx)) === 0 :\n this.lhs.evaluate(ctx) === this.rhs.evaluate(ctx);\n\n return negate ? !equal : equal;\n }\n\n eachChild(fn: (Expression) => void) {\n fn(this.lhs);\n fn(this.rhs);\n if (this.collator) {\n fn(this.collator);\n }\n }\n\n possibleOutputs() {\n return [true, false];\n }\n\n serialize() {\n const serialized = [op];\n this.eachChild(child => { serialized.push(child.serialize()); });\n return serialized;\n }\n };\n}\n\nexport const Equals = makeComparison('==', false);\nexport const NotEquals = makeComparison('!=', true);\n","// @flow\n\nimport { NumberType, toString } from '../types';\n\nimport { typeOf } from '../values';\nimport RuntimeError from '../runtime_error';\n\nimport type { Expression } from '../expression';\nimport type ParsingContext from '../parsing_context';\nimport type EvaluationContext from '../evaluation_context';\nimport type { Type } from '../types';\n\nclass Length implements Expression {\n type: Type;\n input: Expression;\n\n constructor(input: Expression) {\n this.type = NumberType;\n this.input = input;\n }\n\n static parse(args: Array, context: ParsingContext) {\n if (args.length !== 2)\n return context.error(`Expected 1 argument, but found ${args.length - 1} instead.`);\n\n const input = context.parse(args[1], 1);\n if (!input) return null;\n\n if (input.type.kind !== 'array' && input.type.kind !== 'string' && input.type.kind !== 'value')\n return context.error(`Expected argument of type string or array, but found ${toString(input.type)} instead.`);\n\n return new Length(input);\n }\n\n evaluate(ctx: EvaluationContext) {\n const input = this.input.evaluate(ctx);\n if (typeof input === 'string') {\n return input.length;\n } else if (Array.isArray(input)) {\n return input.length;\n } else {\n throw new RuntimeError(`Expected value to be of type string or array, but found ${toString(typeOf(input))} instead.`);\n }\n }\n\n eachChild(fn: (Expression) => void) {\n fn(this.input);\n }\n\n possibleOutputs() {\n return [undefined];\n }\n\n serialize() {\n const serialized = [\"length\"];\n this.eachChild(child => { serialized.push(child.serialize()); });\n return serialized;\n }\n}\n\nexport default Length;\n","// @flow\n\nimport { NumberType, StringType, BooleanType, ColorType, ObjectType, ValueType, ErrorType, CollatorType, array, toString } from '../types';\n\nimport { typeOf, Color, validateRGBA } from '../values';\nimport CompoundExpression from '../compound_expression';\nimport RuntimeError from '../runtime_error';\nimport Let from './let';\nimport Var from './var';\nimport Literal from './literal';\nimport Assertion from './assertion';\nimport ArrayAssertion from './array';\nimport Coercion from './coercion';\nimport At from './at';\nimport Match from './match';\nimport Case from './case';\nimport Step from './step';\nimport Interpolate from './interpolate';\nimport Coalesce from './coalesce';\nimport { Equals, NotEquals } from './equals';\nimport { CollatorExpression } from './collator';\nimport Length from './length';\n\nimport type { Type } from '../types';\nimport type { Varargs } from '../compound_expression';\nimport type { ExpressionRegistry } from '../expression';\n\nconst expressions: ExpressionRegistry = {\n // special forms\n '==': Equals,\n '!=': NotEquals,\n 'array': ArrayAssertion,\n 'at': At,\n 'boolean': Assertion,\n 'case': Case,\n 'coalesce': Coalesce,\n 'collator': CollatorExpression,\n 'interpolate': Interpolate,\n 'length': Length,\n 'let': Let,\n 'literal': Literal,\n 'match': Match,\n 'number': Assertion,\n 'object': Assertion,\n 'step': Step,\n 'string': Assertion,\n 'to-color': Coercion,\n 'to-number': Coercion,\n 'var': Var\n};\n\nfunction rgba(ctx, [r, g, b, a]) {\n r = r.evaluate(ctx);\n g = g.evaluate(ctx);\n b = b.evaluate(ctx);\n const alpha = a ? a.evaluate(ctx) : 1;\n const error = validateRGBA(r, g, b, alpha);\n if (error) throw new RuntimeError(error);\n return new Color(r / 255 * alpha, g / 255 * alpha, b / 255 * alpha, alpha);\n}\n\nfunction has(key, obj) {\n return key in obj;\n}\n\nfunction get(key, obj) {\n const v = obj[key];\n return typeof v === 'undefined' ? null : v;\n}\n\nfunction lt(ctx, [a, b]) { return a.evaluate(ctx) < b.evaluate(ctx); }\nfunction gt(ctx, [a, b]) { return a.evaluate(ctx) > b.evaluate(ctx); }\nfunction lteq(ctx, [a, b]) { return a.evaluate(ctx) <= b.evaluate(ctx); }\nfunction gteq(ctx, [a, b]) { return a.evaluate(ctx) >= b.evaluate(ctx); }\n\nfunction ltCollate(ctx, [a, b, c]) { return c.evaluate(ctx).compare(a.evaluate(ctx), b.evaluate(ctx)) < 0; }\nfunction gtCollate(ctx, [a, b, c]) { return c.evaluate(ctx).compare(a.evaluate(ctx), b.evaluate(ctx)) > 0; }\nfunction lteqCollate(ctx, [a, b, c]) { return c.evaluate(ctx).compare(a.evaluate(ctx), b.evaluate(ctx)) <= 0; }\nfunction gteqCollate(ctx, [a, b, c]) { return c.evaluate(ctx).compare(a.evaluate(ctx), b.evaluate(ctx)) >= 0; }\n\nfunction binarySearch(v, a, i, j) {\n while (i <= j) {\n const m = (i + j) >> 1;\n if (a[m] === v)\n return true;\n if (a[m] > v)\n j = m - 1;\n else\n i = m + 1;\n }\n return false;\n}\n\nfunction varargs(type: Type): Varargs {\n return { type };\n}\n\nCompoundExpression.register(expressions, {\n 'error': [\n ErrorType,\n [StringType],\n (ctx, [v]) => { throw new RuntimeError(v.evaluate(ctx)); }\n ],\n 'typeof': [\n StringType,\n [ValueType],\n (ctx, [v]) => toString(typeOf(v.evaluate(ctx)))\n ],\n 'to-string': [\n StringType,\n [ValueType],\n (ctx, [v]) => {\n v = v.evaluate(ctx);\n const type = typeof v;\n if (v === null) {\n return '';\n } else if (type === 'string' || type === 'number' || type === 'boolean') {\n return String(v);\n } else if (v instanceof Color) {\n return v.toString();\n } else {\n return JSON.stringify(v);\n }\n }\n ],\n 'to-boolean': [\n BooleanType,\n [ValueType],\n (ctx, [v]) => Boolean(v.evaluate(ctx))\n ],\n 'to-rgba': [\n array(NumberType, 4),\n [ColorType],\n (ctx, [v]) => {\n return v.evaluate(ctx).toArray();\n }\n ],\n 'rgb': [\n ColorType,\n [NumberType, NumberType, NumberType],\n rgba\n ],\n 'rgba': [\n ColorType,\n [NumberType, NumberType, NumberType, NumberType],\n rgba\n ],\n 'has': {\n type: BooleanType,\n overloads: [\n [\n [StringType],\n (ctx, [key]) => has(key.evaluate(ctx), ctx.properties())\n ], [\n [StringType, ObjectType],\n (ctx, [key, obj]) => has(key.evaluate(ctx), obj.evaluate(ctx))\n ]\n ]\n },\n 'get': {\n type: ValueType,\n overloads: [\n [\n [StringType],\n (ctx, [key]) => get(key.evaluate(ctx), ctx.properties())\n ], [\n [StringType, ObjectType],\n (ctx, [key, obj]) => get(key.evaluate(ctx), obj.evaluate(ctx))\n ]\n ]\n },\n 'properties': [\n ObjectType,\n [],\n (ctx) => ctx.properties()\n ],\n 'geometry-type': [\n StringType,\n [],\n (ctx) => ctx.geometryType()\n ],\n 'id': [\n ValueType,\n [],\n (ctx) => ctx.id()\n ],\n 'zoom': [\n NumberType,\n [],\n (ctx) => ctx.globals.zoom\n ],\n 'heatmap-density': [\n NumberType,\n [],\n (ctx) => ctx.globals.heatmapDensity || 0\n ],\n 'line-progress': [\n NumberType,\n [],\n (ctx) => ctx.globals.lineProgress || 0\n ],\n '+': [\n NumberType,\n varargs(NumberType),\n (ctx, args) => {\n let result = 0;\n for (const arg of args) {\n result += arg.evaluate(ctx);\n }\n return result;\n }\n ],\n '*': [\n NumberType,\n varargs(NumberType),\n (ctx, args) => {\n let result = 1;\n for (const arg of args) {\n result *= arg.evaluate(ctx);\n }\n return result;\n }\n ],\n '-': {\n type: NumberType,\n overloads: [\n [\n [NumberType, NumberType],\n (ctx, [a, b]) => a.evaluate(ctx) - b.evaluate(ctx)\n ], [\n [NumberType],\n (ctx, [a]) => -a.evaluate(ctx)\n ]\n ]\n },\n '/': [\n NumberType,\n [NumberType, NumberType],\n (ctx, [a, b]) => a.evaluate(ctx) / b.evaluate(ctx)\n ],\n '%': [\n NumberType,\n [NumberType, NumberType],\n (ctx, [a, b]) => a.evaluate(ctx) % b.evaluate(ctx)\n ],\n 'ln2': [\n NumberType,\n [],\n () => Math.LN2\n ],\n 'pi': [\n NumberType,\n [],\n () => Math.PI\n ],\n 'e': [\n NumberType,\n [],\n () => Math.E\n ],\n '^': [\n NumberType,\n [NumberType, NumberType],\n (ctx, [b, e]) => Math.pow(b.evaluate(ctx), e.evaluate(ctx))\n ],\n 'sqrt': [\n NumberType,\n [NumberType],\n (ctx, [x]) => Math.sqrt(x.evaluate(ctx))\n ],\n 'log10': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.log10(n.evaluate(ctx))\n ],\n 'ln': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.log(n.evaluate(ctx))\n ],\n 'log2': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.log2(n.evaluate(ctx))\n ],\n 'sin': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.sin(n.evaluate(ctx))\n ],\n 'cos': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.cos(n.evaluate(ctx))\n ],\n 'tan': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.tan(n.evaluate(ctx))\n ],\n 'asin': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.asin(n.evaluate(ctx))\n ],\n 'acos': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.acos(n.evaluate(ctx))\n ],\n 'atan': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.atan(n.evaluate(ctx))\n ],\n 'min': [\n NumberType,\n varargs(NumberType),\n (ctx, args) => Math.min(...args.map(arg => arg.evaluate(ctx)))\n ],\n 'max': [\n NumberType,\n varargs(NumberType),\n (ctx, args) => Math.max(...args.map(arg => arg.evaluate(ctx)))\n ],\n 'abs': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.abs(n.evaluate(ctx))\n ],\n 'round': [\n NumberType,\n [NumberType],\n (ctx, [n]) => {\n const v = n.evaluate(ctx);\n // Javascript's Math.round() rounds towards +Infinity for halfway\n // values, even when they're negative. It's more common to round\n // away from 0 (e.g., this is what python and C++ do)\n return v < 0 ? -Math.round(-v) : Math.round(v);\n }\n ],\n 'floor': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.floor(n.evaluate(ctx))\n ],\n 'ceil': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.ceil(n.evaluate(ctx))\n ],\n 'filter-==': [\n BooleanType,\n [StringType, ValueType],\n (ctx, [k, v]) => ctx.properties()[(k: any).value] === (v: any).value\n ],\n 'filter-id-==': [\n BooleanType,\n [ValueType],\n (ctx, [v]) => ctx.id() === (v: any).value\n ],\n 'filter-type-==': [\n BooleanType,\n [StringType],\n (ctx, [v]) => ctx.geometryType() === (v: any).value\n ],\n 'filter-<': [\n BooleanType,\n [StringType, ValueType],\n (ctx, [k, v]) => {\n const a = ctx.properties()[(k: any).value];\n const b = (v: any).value;\n return typeof a === typeof b && a < b;\n }\n ],\n 'filter-id-<': [\n BooleanType,\n [ValueType],\n (ctx, [v]) => {\n const a = ctx.id();\n const b = (v: any).value;\n return typeof a === typeof b && a < b;\n }\n ],\n 'filter->': [\n BooleanType,\n [StringType, ValueType],\n (ctx, [k, v]) => {\n const a = ctx.properties()[(k: any).value];\n const b = (v: any).value;\n return typeof a === typeof b && a > b;\n }\n ],\n 'filter-id->': [\n BooleanType,\n [ValueType],\n (ctx, [v]) => {\n const a = ctx.id();\n const b = (v: any).value;\n return typeof a === typeof b && a > b;\n }\n ],\n 'filter-<=': [\n BooleanType,\n [StringType, ValueType],\n (ctx, [k, v]) => {\n const a = ctx.properties()[(k: any).value];\n const b = (v: any).value;\n return typeof a === typeof b && a <= b;\n }\n ],\n 'filter-id-<=': [\n BooleanType,\n [ValueType],\n (ctx, [v]) => {\n const a = ctx.id();\n const b = (v: any).value;\n return typeof a === typeof b && a <= b;\n }\n ],\n 'filter->=': [\n BooleanType,\n [StringType, ValueType],\n (ctx, [k, v]) => {\n const a = ctx.properties()[(k: any).value];\n const b = (v: any).value;\n return typeof a === typeof b && a >= b;\n }\n ],\n 'filter-id->=': [\n BooleanType,\n [ValueType],\n (ctx, [v]) => {\n const a = ctx.id();\n const b = (v: any).value;\n return typeof a === typeof b && a >= b;\n }\n ],\n 'filter-has': [\n BooleanType,\n [ValueType],\n (ctx, [k]) => (k: any).value in ctx.properties()\n ],\n 'filter-has-id': [\n BooleanType,\n [],\n (ctx) => ctx.id() !== null\n ],\n 'filter-type-in': [\n BooleanType,\n [array(StringType)],\n (ctx, [v]) => (v: any).value.indexOf(ctx.geometryType()) >= 0\n ],\n 'filter-id-in': [\n BooleanType,\n [array(ValueType)],\n (ctx, [v]) => (v: any).value.indexOf(ctx.id()) >= 0\n ],\n 'filter-in-small': [\n BooleanType,\n [StringType, array(ValueType)],\n // assumes v is an array literal\n (ctx, [k, v]) => (v: any).value.indexOf(ctx.properties()[(k: any).value]) >= 0\n ],\n 'filter-in-large': [\n BooleanType,\n [StringType, array(ValueType)],\n // assumes v is a array literal with values sorted in ascending order and of a single type\n (ctx, [k, v]) => binarySearch(ctx.properties()[(k: any).value], (v: any).value, 0, (v: any).value.length - 1)\n ],\n '>': {\n type: BooleanType,\n overloads: [\n [[NumberType, NumberType], gt],\n [[StringType, StringType], gt],\n [[StringType, StringType, CollatorType], gtCollate]\n ]\n },\n '<': {\n type: BooleanType,\n overloads: [\n [[NumberType, NumberType], lt],\n [[StringType, StringType], lt],\n [[StringType, StringType, CollatorType], ltCollate]\n ]\n },\n '>=': {\n type: BooleanType,\n overloads: [\n [[NumberType, NumberType], gteq],\n [[StringType, StringType], gteq],\n [[StringType, StringType, CollatorType], gteqCollate]\n ]\n },\n '<=': {\n type: BooleanType,\n overloads: [\n [[NumberType, NumberType], lteq],\n [[StringType, StringType], lteq],\n [[StringType, StringType, CollatorType], lteqCollate]\n ]\n },\n 'all': {\n type: BooleanType,\n overloads: [\n [\n [BooleanType, BooleanType],\n (ctx, [a, b]) => a.evaluate(ctx) && b.evaluate(ctx)\n ],\n [\n varargs(BooleanType),\n (ctx, args) => {\n for (const arg of args) {\n if (!arg.evaluate(ctx))\n return false;\n }\n return true;\n }\n ]\n ]\n },\n 'any': {\n type: BooleanType,\n overloads: [\n [\n [BooleanType, BooleanType],\n (ctx, [a, b]) => a.evaluate(ctx) || b.evaluate(ctx)\n ],\n [\n varargs(BooleanType),\n (ctx, args) => {\n for (const arg of args) {\n if (arg.evaluate(ctx))\n return true;\n }\n return false;\n }\n ]\n ]\n },\n '!': [\n BooleanType,\n [BooleanType],\n (ctx, [b]) => !b.evaluate(ctx)\n ],\n 'is-supported-script': [\n BooleanType,\n [StringType],\n // At parse time this will always return true, so we need to exclude this expression with isGlobalPropertyConstant\n (ctx, [s]) => {\n const isSupportedScript = ctx.globals && ctx.globals.isSupportedScript;\n if (isSupportedScript) {\n return isSupportedScript(s.evaluate(ctx));\n }\n return true;\n }\n ],\n 'upcase': [\n StringType,\n [StringType],\n (ctx, [s]) => s.evaluate(ctx).toUpperCase()\n ],\n 'downcase': [\n StringType,\n [StringType],\n (ctx, [s]) => s.evaluate(ctx).toLowerCase()\n ],\n 'concat': [\n StringType,\n varargs(StringType),\n (ctx, args) => args.map(arg => arg.evaluate(ctx)).join('')\n ],\n 'resolved-locale': [\n StringType,\n [CollatorType],\n (ctx, [collator]) => collator.evaluate(ctx).resolvedLocale()\n ]\n});\n\nexport default expressions;\n","// @flow\n\n/**\n * A type used for returning and propagating errors. The first element of the union\n * represents success and contains a value, and the second represents an error and\n * contains an error value.\n * @private\n */\nexport type Result =\n | {| result: 'success', value: T |}\n | {| result: 'error', value: E |};\n\nexport function success(value: T): Result {\n return { result: 'success', value };\n}\n\nexport function error(value: E): Result {\n return { result: 'error', value };\n}\n","// @flow\n\nimport Color from './color';\n\nimport {number as interpolateNumber} from './interpolate';\n\ntype LABColor = {\n l: number,\n a: number,\n b: number,\n alpha: number\n};\n\ntype HCLColor = {\n h: number,\n c: number,\n l: number,\n alpha: number\n};\n\n// Constants\nconst Xn = 0.950470, // D65 standard referent\n Yn = 1,\n Zn = 1.088830,\n t0 = 4 / 29,\n t1 = 6 / 29,\n t2 = 3 * t1 * t1,\n t3 = t1 * t1 * t1,\n deg2rad = Math.PI / 180,\n rad2deg = 180 / Math.PI;\n\n// Utilities\nfunction xyz2lab(t) {\n return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;\n}\n\nfunction lab2xyz(t) {\n return t > t1 ? t * t * t : t2 * (t - t0);\n}\n\nfunction xyz2rgb(x) {\n return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);\n}\n\nfunction rgb2xyz(x) {\n x /= 255;\n return x <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);\n}\n\n// LAB\nfunction rgbToLab(rgbColor: Color): LABColor {\n const b = rgb2xyz(rgbColor.r),\n a = rgb2xyz(rgbColor.g),\n l = rgb2xyz(rgbColor.b),\n x = xyz2lab((0.4124564 * b + 0.3575761 * a + 0.1804375 * l) / Xn),\n y = xyz2lab((0.2126729 * b + 0.7151522 * a + 0.0721750 * l) / Yn),\n z = xyz2lab((0.0193339 * b + 0.1191920 * a + 0.9503041 * l) / Zn);\n\n return {\n l: 116 * y - 16,\n a: 500 * (x - y),\n b: 200 * (y - z),\n alpha: rgbColor.a\n };\n}\n\nfunction labToRgb(labColor: LABColor): Color {\n let y = (labColor.l + 16) / 116,\n x = isNaN(labColor.a) ? y : y + labColor.a / 500,\n z = isNaN(labColor.b) ? y : y - labColor.b / 200;\n y = Yn * lab2xyz(y);\n x = Xn * lab2xyz(x);\n z = Zn * lab2xyz(z);\n return new Color(\n xyz2rgb(3.2404542 * x - 1.5371385 * y - 0.4985314 * z), // D65 -> sRGB\n xyz2rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z),\n xyz2rgb(0.0556434 * x - 0.2040259 * y + 1.0572252 * z),\n labColor.alpha\n );\n}\n\nfunction interpolateLab(from: LABColor, to: LABColor, t: number) {\n return {\n l: interpolateNumber(from.l, to.l, t),\n a: interpolateNumber(from.a, to.a, t),\n b: interpolateNumber(from.b, to.b, t),\n alpha: interpolateNumber(from.alpha, to.alpha, t)\n };\n}\n\n// HCL\nfunction rgbToHcl(rgbColor: Color): HCLColor {\n const {l, a, b} = rgbToLab(rgbColor);\n const h = Math.atan2(b, a) * rad2deg;\n return {\n h: h < 0 ? h + 360 : h,\n c: Math.sqrt(a * a + b * b),\n l: l,\n alpha: rgbColor.a\n };\n}\n\nfunction hclToRgb(hclColor: HCLColor): Color {\n const h = hclColor.h * deg2rad,\n c = hclColor.c,\n l = hclColor.l;\n return labToRgb({\n l: l,\n a: Math.cos(h) * c,\n b: Math.sin(h) * c,\n alpha: hclColor.alpha\n });\n}\n\nfunction interpolateHue(a: number, b: number, t: number) {\n const d = b - a;\n return a + t * (d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d);\n}\n\nfunction interpolateHcl(from: HCLColor, to: HCLColor, t: number) {\n return {\n h: interpolateHue(from.h, to.h, t),\n c: interpolateNumber(from.c, to.c, t),\n l: interpolateNumber(from.l, to.l, t),\n alpha: interpolateNumber(from.alpha, to.alpha, t)\n };\n}\n\nexport const lab = {\n forward: rgbToLab,\n reverse: labToRgb,\n interpolate: interpolateLab\n};\n\nexport const hcl = {\n forward: rgbToHcl,\n reverse: hclToRgb,\n interpolate: interpolateHcl\n};\n","\nexport default function getType(val) {\n if (val instanceof Number) {\n return 'number';\n } else if (val instanceof String) {\n return 'string';\n } else if (val instanceof Boolean) {\n return 'boolean';\n } else if (Array.isArray(val)) {\n return 'array';\n } else if (val === null) {\n return 'null';\n } else {\n return typeof val;\n }\n}\n","\nimport * as colorSpaces from '../util/color_spaces';\nimport Color from '../util/color';\nimport extend from '../util/extend';\nimport getType from '../util/get_type';\nimport * as interpolate from '../util/interpolate';\nimport Interpolate from '../expression/definitions/interpolate';\n\nexport function isFunction(value) {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction identityFunction(x) {\n return x;\n}\n\nexport function createFunction(parameters, propertySpec) {\n const isColor = propertySpec.type === 'color';\n const zoomAndFeatureDependent = parameters.stops && typeof parameters.stops[0][0] === 'object';\n const featureDependent = zoomAndFeatureDependent || parameters.property !== undefined;\n const zoomDependent = zoomAndFeatureDependent || !featureDependent;\n const type = parameters.type || (propertySpec.function === 'interpolated' ? 'exponential' : 'interval');\n\n if (isColor) {\n parameters = extend({}, parameters);\n\n if (parameters.stops) {\n parameters.stops = parameters.stops.map((stop) => {\n return [stop[0], Color.parse(stop[1])];\n });\n }\n\n if (parameters.default) {\n parameters.default = Color.parse(parameters.default);\n } else {\n parameters.default = Color.parse(propertySpec.default);\n }\n }\n\n if (parameters.colorSpace && parameters.colorSpace !== 'rgb' && !colorSpaces[parameters.colorSpace]) { // eslint-disable-line import/namespace\n throw new Error(`Unknown color space: ${parameters.colorSpace}`);\n }\n\n let innerFun;\n let hashedStops;\n let categoricalKeyType;\n if (type === 'exponential') {\n innerFun = evaluateExponentialFunction;\n } else if (type === 'interval') {\n innerFun = evaluateIntervalFunction;\n } else if (type === 'categorical') {\n innerFun = evaluateCategoricalFunction;\n\n // For categorical functions, generate an Object as a hashmap of the stops for fast searching\n hashedStops = Object.create(null);\n for (const stop of parameters.stops) {\n hashedStops[stop[0]] = stop[1];\n }\n\n // Infer key type based on first stop key-- used to encforce strict type checking later\n categoricalKeyType = typeof parameters.stops[0][0];\n\n } else if (type === 'identity') {\n innerFun = evaluateIdentityFunction;\n } else {\n throw new Error(`Unknown function type \"${type}\"`);\n }\n\n if (zoomAndFeatureDependent) {\n const featureFunctions = {};\n const zoomStops = [];\n for (let s = 0; s < parameters.stops.length; s++) {\n const stop = parameters.stops[s];\n const zoom = stop[0].zoom;\n if (featureFunctions[zoom] === undefined) {\n featureFunctions[zoom] = {\n zoom: zoom,\n type: parameters.type,\n property: parameters.property,\n default: parameters.default,\n stops: []\n };\n zoomStops.push(zoom);\n }\n featureFunctions[zoom].stops.push([stop[0].value, stop[1]]);\n }\n\n const featureFunctionStops = [];\n for (const z of zoomStops) {\n featureFunctionStops.push([featureFunctions[z].zoom, createFunction(featureFunctions[z], propertySpec)]);\n }\n\n return {\n kind: 'composite',\n interpolationFactor: Interpolate.interpolationFactor.bind(undefined, {name: 'linear'}),\n zoomStops: featureFunctionStops.map(s => s[0]),\n evaluate({zoom}, properties) {\n return evaluateExponentialFunction({\n stops: featureFunctionStops,\n base: parameters.base\n }, propertySpec, zoom).evaluate(zoom, properties);\n }\n };\n } else if (zoomDependent) {\n return {\n kind: 'camera',\n interpolationFactor: type === 'exponential' ?\n Interpolate.interpolationFactor.bind(undefined, {name: 'exponential', base: parameters.base !== undefined ? parameters.base : 1}) :\n () => 0,\n zoomStops: parameters.stops.map(s => s[0]),\n evaluate: ({zoom}) => innerFun(parameters, propertySpec, zoom, hashedStops, categoricalKeyType)\n };\n } else {\n return {\n kind: 'source',\n evaluate(_, feature) {\n const value = feature && feature.properties ? feature.properties[parameters.property] : undefined;\n if (value === undefined) {\n return coalesce(parameters.default, propertySpec.default);\n }\n return innerFun(parameters, propertySpec, value, hashedStops, categoricalKeyType);\n }\n };\n }\n}\n\nfunction coalesce(a, b, c) {\n if (a !== undefined) return a;\n if (b !== undefined) return b;\n if (c !== undefined) return c;\n}\n\nfunction evaluateCategoricalFunction(parameters, propertySpec, input, hashedStops, keyType) {\n const evaluated = typeof input === keyType ? hashedStops[input] : undefined; // Enforce strict typing on input\n return coalesce(evaluated, parameters.default, propertySpec.default);\n}\n\nfunction evaluateIntervalFunction(parameters, propertySpec, input) {\n // Edge cases\n if (getType(input) !== 'number') return coalesce(parameters.default, propertySpec.default);\n const n = parameters.stops.length;\n if (n === 1) return parameters.stops[0][1];\n if (input <= parameters.stops[0][0]) return parameters.stops[0][1];\n if (input >= parameters.stops[n - 1][0]) return parameters.stops[n - 1][1];\n\n const index = findStopLessThanOrEqualTo(parameters.stops, input);\n\n return parameters.stops[index][1];\n}\n\nfunction evaluateExponentialFunction(parameters, propertySpec, input) {\n const base = parameters.base !== undefined ? parameters.base : 1;\n\n // Edge cases\n if (getType(input) !== 'number') return coalesce(parameters.default, propertySpec.default);\n const n = parameters.stops.length;\n if (n === 1) return parameters.stops[0][1];\n if (input <= parameters.stops[0][0]) return parameters.stops[0][1];\n if (input >= parameters.stops[n - 1][0]) return parameters.stops[n - 1][1];\n\n const index = findStopLessThanOrEqualTo(parameters.stops, input);\n const t = interpolationFactor(\n input, base,\n parameters.stops[index][0],\n parameters.stops[index + 1][0]);\n\n const outputLower = parameters.stops[index][1];\n const outputUpper = parameters.stops[index + 1][1];\n let interp = interpolate[propertySpec.type] || identityFunction; // eslint-disable-line import/namespace\n\n if (parameters.colorSpace && parameters.colorSpace !== 'rgb') {\n const colorspace = colorSpaces[parameters.colorSpace]; // eslint-disable-line import/namespace\n interp = (a, b) => colorspace.reverse(colorspace.interpolate(colorspace.forward(a), colorspace.forward(b), t));\n }\n\n if (typeof outputLower.evaluate === 'function') {\n return {\n evaluate(...args) {\n const evaluatedLower = outputLower.evaluate.apply(undefined, args);\n const evaluatedUpper = outputUpper.evaluate.apply(undefined, args);\n // Special case for fill-outline-color, which has no spec default.\n if (evaluatedLower === undefined || evaluatedUpper === undefined) {\n return undefined;\n }\n return interp(evaluatedLower, evaluatedUpper, t);\n }\n };\n }\n\n return interp(outputLower, outputUpper, t);\n}\n\nfunction evaluateIdentityFunction(parameters, propertySpec, input) {\n if (propertySpec.type === 'color') {\n input = Color.parse(input);\n } else if (getType(input) !== propertySpec.type && (propertySpec.type !== 'enum' || !propertySpec.values[input])) {\n input = undefined;\n }\n return coalesce(input, parameters.default, propertySpec.default);\n}\n\n/**\n * Returns the index of the last stop <= input, or 0 if it doesn't exist.\n *\n * @private\n */\nfunction findStopLessThanOrEqualTo(stops, input) {\n const n = stops.length;\n let lowerIndex = 0;\n let upperIndex = n - 1;\n let currentIndex = 0;\n let currentValue, upperValue;\n\n while (lowerIndex <= upperIndex) {\n currentIndex = Math.floor((lowerIndex + upperIndex) / 2);\n currentValue = stops[currentIndex][0];\n upperValue = stops[currentIndex + 1][0];\n if (input === currentValue || input > currentValue && input < upperValue) { // Search complete\n return currentIndex;\n } else if (currentValue < input) {\n lowerIndex = currentIndex + 1;\n } else if (currentValue > input) {\n upperIndex = currentIndex - 1;\n }\n }\n\n return Math.max(currentIndex - 1, 0);\n}\n\n/**\n * Returns a ratio that can be used to interpolate between exponential function\n * stops.\n *\n * How it works:\n * Two consecutive stop values define a (scaled and shifted) exponential\n * function `f(x) = a * base^x + b`, where `base` is the user-specified base,\n * and `a` and `b` are constants affording sufficient degrees of freedom to fit\n * the function to the given stops.\n *\n * Here's a bit of algebra that lets us compute `f(x)` directly from the stop\n * values without explicitly solving for `a` and `b`:\n *\n * First stop value: `f(x0) = y0 = a * base^x0 + b`\n * Second stop value: `f(x1) = y1 = a * base^x1 + b`\n * => `y1 - y0 = a(base^x1 - base^x0)`\n * => `a = (y1 - y0)/(base^x1 - base^x0)`\n *\n * Desired value: `f(x) = y = a * base^x + b`\n * => `f(x) = y0 + a * (base^x - base^x0)`\n *\n * From the above, we can replace the `a` in `a * (base^x - base^x0)` and do a\n * little algebra:\n * ```\n * a * (base^x - base^x0) = (y1 - y0)/(base^x1 - base^x0) * (base^x - base^x0)\n * = (y1 - y0) * (base^x - base^x0) / (base^x1 - base^x0)\n * ```\n *\n * If we let `(base^x - base^x0) / (base^x1 base^x0)`, then we have\n * `f(x) = y0 + (y1 - y0) * ratio`. In other words, `ratio` may be treated as\n * an interpolation factor between the two stops' output values.\n *\n * (Note: a slightly different form for `ratio`,\n * `(base^(x-x0) - 1) / (base^(x1-x0) - 1) `, is equivalent, but requires fewer\n * expensive `Math.pow()` operations.)\n *\n * @private\n */\nfunction interpolationFactor(input, base, lowerValue, upperValue) {\n const difference = upperValue - lowerValue;\n const progress = input - lowerValue;\n\n if (difference === 0) {\n return 0;\n } else if (base === 1) {\n return progress / difference;\n } else {\n return (Math.pow(base, progress) - 1) / (Math.pow(base, difference) - 1);\n }\n}\n","// @flow\n\nimport assert from 'assert';\n\nimport extend from '../util/extend';\nimport ParsingError from './parsing_error';\nimport ParsingContext from './parsing_context';\nimport EvaluationContext from './evaluation_context';\nimport CompoundExpression from './compound_expression';\nimport Step from './definitions/step';\nimport Interpolate from './definitions/interpolate';\nimport Coalesce from './definitions/coalesce';\nimport Let from './definitions/let';\nimport definitions from './definitions';\nimport * as isConstant from './is_constant';\nimport RuntimeError from './runtime_error';\nimport { success, error } from '../util/result';\n\nimport type {Type} from './types';\nimport type {Value} from './values';\nimport type {Expression} from './expression';\nimport type {StylePropertySpecification} from '../style-spec';\nimport type {Result} from '../util/result';\nimport type {InterpolationType} from './definitions/interpolate';\n\nexport type Feature = {\n +type: 1 | 2 | 3 | 'Unknown' | 'Point' | 'MultiPoint' | 'LineString' | 'MultiLineString' | 'Polygon' | 'MultiPolygon',\n +id?: any,\n +properties: {[string]: any}\n};\n\nexport type GlobalProperties = $ReadOnly<{\n zoom: number,\n heatmapDensity?: number,\n lineProgress?: number,\n isSupportedScript?: (string) => boolean\n}>;\n\nexport class StyleExpression {\n expression: Expression;\n\n _evaluator: EvaluationContext;\n _defaultValue: Value;\n _warningHistory: {[key: string]: boolean};\n _enumValues: {[string]: any};\n\n constructor(expression: Expression, propertySpec: StylePropertySpecification) {\n this.expression = expression;\n this._warningHistory = {};\n this._defaultValue = getDefaultValue(propertySpec);\n if (propertySpec.type === 'enum') {\n this._enumValues = propertySpec.values;\n }\n }\n\n evaluateWithoutErrorHandling(globals: GlobalProperties, feature?: Feature): any {\n if (!this._evaluator) {\n this._evaluator = new EvaluationContext();\n }\n\n this._evaluator.globals = globals;\n this._evaluator.feature = feature;\n\n return this.expression.evaluate(this._evaluator);\n }\n\n evaluate(globals: GlobalProperties, feature?: Feature): any {\n if (!this._evaluator) {\n this._evaluator = new EvaluationContext();\n }\n\n this._evaluator.globals = globals;\n this._evaluator.feature = feature;\n\n try {\n const val = this.expression.evaluate(this._evaluator);\n if (val === null || val === undefined) {\n return this._defaultValue;\n }\n if (this._enumValues && !(val in this._enumValues)) {\n throw new RuntimeError(`Expected value to be one of ${Object.keys(this._enumValues).map(v => JSON.stringify(v)).join(', ')}, but found ${JSON.stringify(val)} instead.`);\n }\n return val;\n } catch (e) {\n if (!this._warningHistory[e.message]) {\n this._warningHistory[e.message] = true;\n if (typeof console !== 'undefined') {\n console.warn(e.message);\n }\n }\n return this._defaultValue;\n }\n }\n}\n\nexport function isExpression(expression: mixed) {\n return Array.isArray(expression) && expression.length > 0 &&\n typeof expression[0] === 'string' && expression[0] in definitions;\n}\n\n/**\n * Parse and typecheck the given style spec JSON expression. If\n * options.defaultValue is provided, then the resulting StyleExpression's\n * `evaluate()` method will handle errors by logging a warning (once per\n * message) and returning the default value. Otherwise, it will throw\n * evaluation errors.\n *\n * @private\n */\nexport function createExpression(expression: mixed, propertySpec: StylePropertySpecification): Result> {\n const parser = new ParsingContext(definitions, [], getExpectedType(propertySpec));\n const parsed = parser.parse(expression);\n if (!parsed) {\n assert(parser.errors.length > 0);\n return error(parser.errors);\n }\n\n return success(new StyleExpression(parsed, propertySpec));\n}\n\nexport class ZoomConstantExpression {\n kind: Kind;\n _styleExpression: StyleExpression;\n\n constructor(kind: Kind, expression: StyleExpression) {\n this.kind = kind;\n this._styleExpression = expression;\n }\n\n evaluateWithoutErrorHandling(globals: GlobalProperties, feature?: Feature): any {\n return this._styleExpression.evaluateWithoutErrorHandling(globals, feature);\n }\n\n evaluate(globals: GlobalProperties, feature?: Feature): any {\n return this._styleExpression.evaluate(globals, feature);\n }\n}\n\nexport class ZoomDependentExpression {\n kind: Kind;\n zoomStops: Array;\n\n _styleExpression: StyleExpression;\n _interpolationType: ?InterpolationType;\n\n constructor(kind: Kind, expression: StyleExpression, zoomCurve: Step | Interpolate) {\n this.kind = kind;\n this.zoomStops = zoomCurve.labels;\n this._styleExpression = expression;\n if (zoomCurve instanceof Interpolate) {\n this._interpolationType = zoomCurve.interpolation;\n }\n }\n\n evaluateWithoutErrorHandling(globals: GlobalProperties, feature?: Feature): any {\n return this._styleExpression.evaluateWithoutErrorHandling(globals, feature);\n }\n\n evaluate(globals: GlobalProperties, feature?: Feature): any {\n return this._styleExpression.evaluate(globals, feature);\n }\n\n interpolationFactor(input: number, lower: number, upper: number): number {\n if (this._interpolationType) {\n return Interpolate.interpolationFactor(this._interpolationType, input, lower, upper);\n } else {\n return 0;\n }\n }\n}\n\nexport type ConstantExpression = {\n kind: 'constant',\n +evaluate: (globals: GlobalProperties, feature?: Feature) => any,\n}\n\nexport type SourceExpression = {\n kind: 'source',\n +evaluate: (globals: GlobalProperties, feature?: Feature) => any,\n};\n\nexport type CameraExpression = {\n kind: 'camera',\n +evaluate: (globals: GlobalProperties, feature?: Feature) => any,\n +interpolationFactor: (input: number, lower: number, upper: number) => number,\n zoomStops: Array\n};\n\nexport type CompositeExpression = {\n kind: 'composite',\n +evaluate: (globals: GlobalProperties, feature?: Feature) => any,\n +interpolationFactor: (input: number, lower: number, upper: number) => number,\n zoomStops: Array\n};\n\nexport type StylePropertyExpression =\n | ConstantExpression\n | SourceExpression\n | CameraExpression\n | CompositeExpression;\n\nexport function createPropertyExpression(expression: mixed, propertySpec: StylePropertySpecification): Result> {\n expression = createExpression(expression, propertySpec);\n if (expression.result === 'error') {\n return expression;\n }\n\n const parsed = expression.value.expression;\n\n const isFeatureConstant = isConstant.isFeatureConstant(parsed);\n if (!isFeatureConstant && !propertySpec['property-function']) {\n return error([new ParsingError('', 'property expressions not supported')]);\n }\n\n const isZoomConstant = isConstant.isGlobalPropertyConstant(parsed, ['zoom']);\n if (!isZoomConstant && propertySpec['zoom-function'] === false) {\n return error([new ParsingError('', 'zoom expressions not supported')]);\n }\n\n const zoomCurve = findZoomCurve(parsed);\n if (!zoomCurve && !isZoomConstant) {\n return error([new ParsingError('', '\"zoom\" expression may only be used as input to a top-level \"step\" or \"interpolate\" expression.')]);\n } else if (zoomCurve instanceof ParsingError) {\n return error([zoomCurve]);\n } else if (zoomCurve instanceof Interpolate && propertySpec['function'] === 'piecewise-constant') {\n return error([new ParsingError('', '\"interpolate\" expressions cannot be used with this property')]);\n }\n\n if (!zoomCurve) {\n return success(isFeatureConstant ?\n (new ZoomConstantExpression('constant', expression.value): ConstantExpression) :\n (new ZoomConstantExpression('source', expression.value): SourceExpression));\n }\n\n return success(isFeatureConstant ?\n (new ZoomDependentExpression('camera', expression.value, zoomCurve): CameraExpression) :\n (new ZoomDependentExpression('composite', expression.value, zoomCurve): CompositeExpression));\n}\n\nimport { isFunction, createFunction } from '../function';\nimport { Color } from './values';\n\n// serialization wrapper for old-style stop functions normalized to the\n// expression interface\nexport class StylePropertyFunction {\n _parameters: PropertyValueSpecification;\n _specification: StylePropertySpecification;\n\n kind: 'constant' | 'source' | 'camera' | 'composite';\n evaluate: (globals: GlobalProperties, feature?: Feature) => any;\n interpolationFactor: ?(input: number, lower: number, upper: number) => number;\n zoomStops: ?Array;\n\n constructor(parameters: PropertyValueSpecification, specification: StylePropertySpecification) {\n this._parameters = parameters;\n this._specification = specification;\n extend(this, createFunction(this._parameters, this._specification));\n }\n\n static deserialize(serialized: {_parameters: PropertyValueSpecification, _specification: StylePropertySpecification}) {\n return ((new StylePropertyFunction(serialized._parameters, serialized._specification)): StylePropertyFunction);\n }\n\n static serialize(input: StylePropertyFunction) {\n return {\n _parameters: input._parameters,\n _specification: input._specification\n };\n }\n}\n\nexport function normalizePropertyExpression(value: PropertyValueSpecification, specification: StylePropertySpecification): StylePropertyExpression {\n if (isFunction(value)) {\n return (new StylePropertyFunction(value, specification): any);\n\n } else if (isExpression(value)) {\n const expression = createPropertyExpression(value, specification);\n if (expression.result === 'error') {\n // this should have been caught in validation\n throw new Error(expression.value.map(err => `${err.key}: ${err.message}`).join(', '));\n }\n return expression.value;\n\n } else {\n let constant: any = value;\n if (typeof value === 'string' && specification.type === 'color') {\n constant = Color.parse(value);\n }\n return {\n kind: 'constant',\n evaluate: () => constant\n };\n }\n}\n\n// Zoom-dependent expressions may only use [\"zoom\"] as the input to a top-level \"step\" or \"interpolate\"\n// expression (collectively referred to as a \"curve\"). The curve may be wrapped in one or more \"let\" or\n// \"coalesce\" expressions.\nfunction findZoomCurve(expression: Expression): Step | Interpolate | ParsingError | null {\n let result = null;\n if (expression instanceof Let) {\n result = findZoomCurve(expression.result);\n\n } else if (expression instanceof Coalesce) {\n for (const arg of expression.args) {\n result = findZoomCurve(arg);\n if (result) {\n break;\n }\n }\n\n } else if ((expression instanceof Step || expression instanceof Interpolate) &&\n expression.input instanceof CompoundExpression &&\n expression.input.name === 'zoom') {\n\n result = expression;\n }\n\n if (result instanceof ParsingError) {\n return result;\n }\n\n expression.eachChild((child) => {\n const childResult = findZoomCurve(child);\n if (childResult instanceof ParsingError) {\n result = childResult;\n } else if (!result && childResult) {\n result = new ParsingError('', '\"zoom\" expression may only be used as input to a top-level \"step\" or \"interpolate\" expression.');\n } else if (result && childResult && result !== childResult) {\n result = new ParsingError('', 'Only one zoom-based \"step\" or \"interpolate\" subexpression may be used in an expression.');\n }\n });\n\n return result;\n}\n\nimport { ColorType, StringType, NumberType, BooleanType, ValueType, array } from './types';\n\nfunction getExpectedType(spec: StylePropertySpecification): Type | null {\n const types = {\n color: ColorType,\n string: StringType,\n number: NumberType,\n enum: StringType,\n boolean: BooleanType\n };\n\n if (spec.type === 'array') {\n return array(types[spec.value] || ValueType, spec.length);\n }\n\n return types[spec.type] || null;\n}\n\nfunction getDefaultValue(spec: StylePropertySpecification): Value {\n if (spec.type === 'color' && isFunction(spec.default)) {\n // Special case for heatmap-color: it uses the 'default:' to define a\n // default color ramp, but createExpression expects a simple value to fall\n // back to in case of runtime errors\n return new Color(0, 0, 0, 0);\n } else if (spec.type === 'color') {\n return Color.parse(spec.default) || null;\n } else if (spec.default === undefined) {\n return null;\n } else {\n return spec.default;\n }\n}\n","\nimport ValidationError from '../error/validation_error';\nimport getType from '../util/get_type';\nimport validateSpec from './validate';\n\nexport default function validateObject(options) {\n const key = options.key;\n const object = options.value;\n const elementSpecs = options.valueSpec || {};\n const elementValidators = options.objectElementValidators || {};\n const style = options.style;\n const styleSpec = options.styleSpec;\n let errors = [];\n\n const type = getType(object);\n if (type !== 'object') {\n return [new ValidationError(key, object, `object expected, ${type} found`)];\n }\n\n for (const objectKey in object) {\n const elementSpecKey = objectKey.split('.')[0]; // treat 'paint.*' as 'paint'\n const elementSpec = elementSpecs[elementSpecKey] || elementSpecs['*'];\n\n let validateElement;\n if (elementValidators[elementSpecKey]) {\n validateElement = elementValidators[elementSpecKey];\n } else if (elementSpecs[elementSpecKey]) {\n validateElement = validateSpec;\n } else if (elementValidators['*']) {\n validateElement = elementValidators['*'];\n } else if (elementSpecs['*']) {\n validateElement = validateSpec;\n } else {\n errors.push(new ValidationError(key, object[objectKey], `unknown property \"${objectKey}\"`));\n continue;\n }\n\n errors = errors.concat(validateElement({\n key: (key ? `${key}.` : key) + objectKey,\n value: object[objectKey],\n valueSpec: elementSpec,\n style: style,\n styleSpec: styleSpec,\n object: object,\n objectKey: objectKey\n }, object));\n }\n\n for (const elementSpecKey in elementSpecs) {\n // Don't check `required` when there's a custom validator for that property.\n if (elementValidators[elementSpecKey]) {\n continue;\n }\n\n if (elementSpecs[elementSpecKey].required && elementSpecs[elementSpecKey]['default'] === undefined && object[elementSpecKey] === undefined) {\n errors.push(new ValidationError(key, object, `missing required property \"${elementSpecKey}\"`));\n }\n }\n\n return errors;\n}\n","\nimport getType from '../util/get_type';\nimport validate from './validate';\nimport ValidationError from '../error/validation_error';\n\nexport default function validateArray(options) {\n const array = options.value;\n const arraySpec = options.valueSpec;\n const style = options.style;\n const styleSpec = options.styleSpec;\n const key = options.key;\n const validateArrayElement = options.arrayElementValidator || validate;\n\n if (getType(array) !== 'array') {\n return [new ValidationError(key, array, `array expected, ${getType(array)} found`)];\n }\n\n if (arraySpec.length && array.length !== arraySpec.length) {\n return [new ValidationError(key, array, `array length ${arraySpec.length} expected, length ${array.length} found`)];\n }\n\n if (arraySpec['min-length'] && array.length < arraySpec['min-length']) {\n return [new ValidationError(key, array, `array length at least ${arraySpec['min-length']} expected, length ${array.length} found`)];\n }\n\n let arrayElementSpec = {\n \"type\": arraySpec.value\n };\n\n if (styleSpec.$version < 7) {\n arrayElementSpec.function = arraySpec.function;\n }\n\n if (getType(arraySpec.value) === 'object') {\n arrayElementSpec = arraySpec.value;\n }\n\n let errors = [];\n for (let i = 0; i < array.length; i++) {\n errors = errors.concat(validateArrayElement({\n array: array,\n arrayIndex: i,\n value: array[i],\n valueSpec: arrayElementSpec,\n style: style,\n styleSpec: styleSpec,\n key: `${key}[${i}]`\n }));\n }\n return errors;\n}\n","\nimport getType from '../util/get_type';\nimport ValidationError from '../error/validation_error';\n\nexport default function validateNumber(options) {\n const key = options.key;\n const value = options.value;\n const valueSpec = options.valueSpec;\n const type = getType(value);\n\n if (type !== 'number') {\n return [new ValidationError(key, value, `number expected, ${type} found`)];\n }\n\n if ('minimum' in valueSpec && value < valueSpec.minimum) {\n return [new ValidationError(key, value, `${value} is less than the minimum value ${valueSpec.minimum}`)];\n }\n\n if ('maximum' in valueSpec && value > valueSpec.maximum) {\n return [new ValidationError(key, value, `${value} is greater than the maximum value ${valueSpec.maximum}`)];\n }\n\n return [];\n}\n","\nimport ValidationError from '../error/validation_error';\nimport getType from '../util/get_type';\nimport validate from './validate';\nimport validateObject from './validate_object';\nimport validateArray from './validate_array';\nimport validateNumber from './validate_number';\nimport { unbundle } from '../util/unbundle_jsonlint';\n\nexport default function validateFunction(options) {\n const functionValueSpec = options.valueSpec;\n const functionType = unbundle(options.value.type);\n let stopKeyType;\n let stopDomainValues = {};\n let previousStopDomainValue;\n let previousStopDomainZoom;\n\n const isZoomFunction = functionType !== 'categorical' && options.value.property === undefined;\n const isPropertyFunction = !isZoomFunction;\n const isZoomAndPropertyFunction =\n getType(options.value.stops) === 'array' &&\n getType(options.value.stops[0]) === 'array' &&\n getType(options.value.stops[0][0]) === 'object';\n\n const errors = validateObject({\n key: options.key,\n value: options.value,\n valueSpec: options.styleSpec.function,\n style: options.style,\n styleSpec: options.styleSpec,\n objectElementValidators: {\n stops: validateFunctionStops,\n default: validateFunctionDefault\n }\n });\n\n if (functionType === 'identity' && isZoomFunction) {\n errors.push(new ValidationError(options.key, options.value, 'missing required property \"property\"'));\n }\n\n if (functionType !== 'identity' && !options.value.stops) {\n errors.push(new ValidationError(options.key, options.value, 'missing required property \"stops\"'));\n }\n\n if (functionType === 'exponential' && options.valueSpec['function'] === 'piecewise-constant') {\n errors.push(new ValidationError(options.key, options.value, 'exponential functions not supported'));\n }\n\n if (options.styleSpec.$version >= 8) {\n if (isPropertyFunction && !options.valueSpec['property-function']) {\n errors.push(new ValidationError(options.key, options.value, 'property functions not supported'));\n } else if (isZoomFunction && !options.valueSpec['zoom-function'] && options.objectKey !== 'heatmap-color' && options.objectKey !== 'line-gradient') {\n errors.push(new ValidationError(options.key, options.value, 'zoom functions not supported'));\n }\n }\n\n if ((functionType === 'categorical' || isZoomAndPropertyFunction) && options.value.property === undefined) {\n errors.push(new ValidationError(options.key, options.value, '\"property\" property is required'));\n }\n\n return errors;\n\n function validateFunctionStops(options) {\n if (functionType === 'identity') {\n return [new ValidationError(options.key, options.value, 'identity function may not have a \"stops\" property')];\n }\n\n let errors = [];\n const value = options.value;\n\n errors = errors.concat(validateArray({\n key: options.key,\n value: value,\n valueSpec: options.valueSpec,\n style: options.style,\n styleSpec: options.styleSpec,\n arrayElementValidator: validateFunctionStop\n }));\n\n if (getType(value) === 'array' && value.length === 0) {\n errors.push(new ValidationError(options.key, value, 'array must have at least one stop'));\n }\n\n return errors;\n }\n\n function validateFunctionStop(options) {\n let errors = [];\n const value = options.value;\n const key = options.key;\n\n if (getType(value) !== 'array') {\n return [new ValidationError(key, value, `array expected, ${getType(value)} found`)];\n }\n\n if (value.length !== 2) {\n return [new ValidationError(key, value, `array length 2 expected, length ${value.length} found`)];\n }\n\n if (isZoomAndPropertyFunction) {\n if (getType(value[0]) !== 'object') {\n return [new ValidationError(key, value, `object expected, ${getType(value[0])} found`)];\n }\n if (value[0].zoom === undefined) {\n return [new ValidationError(key, value, 'object stop key must have zoom')];\n }\n if (value[0].value === undefined) {\n return [new ValidationError(key, value, 'object stop key must have value')];\n }\n if (previousStopDomainZoom && previousStopDomainZoom > unbundle(value[0].zoom)) {\n return [new ValidationError(key, value[0].zoom, 'stop zoom values must appear in ascending order')];\n }\n if (unbundle(value[0].zoom) !== previousStopDomainZoom) {\n previousStopDomainZoom = unbundle(value[0].zoom);\n previousStopDomainValue = undefined;\n stopDomainValues = {};\n }\n errors = errors.concat(validateObject({\n key: `${key}[0]`,\n value: value[0],\n valueSpec: { zoom: {} },\n style: options.style,\n styleSpec: options.styleSpec,\n objectElementValidators: { zoom: validateNumber, value: validateStopDomainValue }\n }));\n } else {\n errors = errors.concat(validateStopDomainValue({\n key: `${key}[0]`,\n value: value[0],\n valueSpec: {},\n style: options.style,\n styleSpec: options.styleSpec\n }, value));\n }\n\n return errors.concat(validate({\n key: `${key}[1]`,\n value: value[1],\n valueSpec: functionValueSpec,\n style: options.style,\n styleSpec: options.styleSpec\n }));\n }\n\n function validateStopDomainValue(options, stop) {\n const type = getType(options.value);\n const value = unbundle(options.value);\n\n const reportValue = options.value !== null ? options.value : stop;\n\n if (!stopKeyType) {\n stopKeyType = type;\n } else if (type !== stopKeyType) {\n return [new ValidationError(options.key, reportValue, `${type} stop domain type must match previous stop domain type ${stopKeyType}`)];\n }\n\n if (type !== 'number' && type !== 'string' && type !== 'boolean') {\n return [new ValidationError(options.key, reportValue, 'stop domain value must be a number, string, or boolean')];\n }\n\n if (type !== 'number' && functionType !== 'categorical') {\n let message = `number expected, ${type} found`;\n if (functionValueSpec['property-function'] && functionType === undefined) {\n message += '\\nIf you intended to use a categorical function, specify `\"type\": \"categorical\"`.';\n }\n return [new ValidationError(options.key, reportValue, message)];\n }\n\n if (functionType === 'categorical' && type === 'number' && (!isFinite(value) || Math.floor(value) !== value)) {\n return [new ValidationError(options.key, reportValue, `integer expected, found ${value}`)];\n }\n\n if (functionType !== 'categorical' && type === 'number' && previousStopDomainValue !== undefined && value < previousStopDomainValue) {\n return [new ValidationError(options.key, reportValue, 'stop domain values must appear in ascending order')];\n } else {\n previousStopDomainValue = value;\n }\n\n if (functionType === 'categorical' && value in stopDomainValues) {\n return [new ValidationError(options.key, reportValue, 'stop domain values must be unique')];\n } else {\n stopDomainValues[value] = true;\n }\n\n return [];\n }\n\n function validateFunctionDefault(options) {\n return validate({\n key: options.key,\n value: options.value,\n valueSpec: functionValueSpec,\n style: options.style,\n styleSpec: options.styleSpec\n });\n }\n}\n","// @flow\n\nimport ValidationError from '../error/validation_error';\n\nimport { createExpression, createPropertyExpression } from '../expression';\nimport { deepUnbundle } from '../util/unbundle_jsonlint';\n\nexport default function validateExpression(options: any) {\n const expression = (options.expressionContext === 'property' ? createPropertyExpression : createExpression)(deepUnbundle(options.value), options.valueSpec);\n if (expression.result === 'error') {\n return expression.value.map((error) => {\n return new ValidationError(`${options.key}${error.key}`, options.value, error.message);\n });\n }\n\n if (options.expressionContext === 'property' && options.propertyKey === 'text-font' &&\n (expression.value: any)._styleExpression.expression.possibleOutputs().indexOf(undefined) !== -1) {\n return [new ValidationError(options.key, options.value, 'Invalid data expression for \"text-font\". Output values must be contained as literals within the expression.')];\n }\n\n return [];\n}\n","\nimport ValidationError from '../error/validation_error';\nimport { unbundle } from '../util/unbundle_jsonlint';\n\nexport default function validateEnum(options) {\n const key = options.key;\n const value = options.value;\n const valueSpec = options.valueSpec;\n const errors = [];\n\n if (Array.isArray(valueSpec.values)) { // <=v7\n if (valueSpec.values.indexOf(unbundle(value)) === -1) {\n errors.push(new ValidationError(key, value, `expected one of [${valueSpec.values.join(', ')}], ${JSON.stringify(value)} found`));\n }\n } else { // >=v8\n if (Object.keys(valueSpec.values).indexOf(unbundle(value)) === -1) {\n errors.push(new ValidationError(key, value, `expected one of [${Object.keys(valueSpec.values).join(', ')}], ${JSON.stringify(value)} found`));\n }\n }\n return errors;\n}\n","// @flow\n\nimport { createExpression } from '../expression';\n\nimport type {GlobalProperties} from '../expression';\nexport type FeatureFilter = (globalProperties: GlobalProperties, feature: VectorTileFeature) => boolean;\n\nexport default createFilter;\nexport { isExpressionFilter };\n\nfunction isExpressionFilter(filter: any) {\n if (!Array.isArray(filter) || filter.length === 0) {\n return false;\n }\n switch (filter[0]) {\n case 'has':\n return filter.length >= 2 && filter[1] !== '$id' && filter[1] !== '$type';\n\n case 'in':\n case '!in':\n case '!has':\n case 'none':\n return false;\n\n case '==':\n case '!=':\n case '>':\n case '>=':\n case '<':\n case '<=':\n return filter.length === 3 && (Array.isArray(filter[1]) || Array.isArray(filter[2]));\n\n case 'any':\n case 'all':\n for (const f of filter.slice(1)) {\n if (!isExpressionFilter(f) && typeof f !== 'boolean') {\n return false;\n }\n }\n return true;\n\n default:\n return true;\n }\n}\n\nconst filterSpec = {\n 'type': 'boolean',\n 'default': false,\n 'function': true,\n 'property-function': true,\n 'zoom-function': true\n};\n\n/**\n * Given a filter expressed as nested arrays, return a new function\n * that evaluates whether a given feature (with a .properties or .tags property)\n * passes its test.\n *\n * @private\n * @param {Array} filter mapbox gl filter\n * @returns {Function} filter-evaluating function\n */\nfunction createFilter(filter: any): FeatureFilter {\n if (!filter) {\n return () => true;\n }\n\n if (!isExpressionFilter(filter)) {\n filter = convertFilter(filter);\n }\n\n const compiled = createExpression(filter, filterSpec);\n if (compiled.result === 'error') {\n throw new Error(compiled.value.map(err => `${err.key}: ${err.message}`).join(', '));\n } else {\n return (globalProperties: GlobalProperties, feature: VectorTileFeature) => compiled.value.evaluate(globalProperties, feature);\n }\n}\n\n// Comparison function to sort numbers and strings\nfunction compare(a, b) {\n return a < b ? -1 : a > b ? 1 : 0;\n}\n\nfunction convertFilter(filter: ?Array): mixed {\n if (!filter) return true;\n const op = filter[0];\n if (filter.length <= 1) return (op !== 'any');\n const converted =\n op === '==' ? convertComparisonOp(filter[1], filter[2], '==') :\n op === '!=' ? convertNegation(convertComparisonOp(filter[1], filter[2], '==')) :\n op === '<' ||\n op === '>' ||\n op === '<=' ||\n op === '>=' ? convertComparisonOp(filter[1], filter[2], op) :\n op === 'any' ? convertDisjunctionOp(filter.slice(1)) :\n op === 'all' ? ['all'].concat(filter.slice(1).map(convertFilter)) :\n op === 'none' ? ['all'].concat(filter.slice(1).map(convertFilter).map(convertNegation)) :\n op === 'in' ? convertInOp(filter[1], filter.slice(2)) :\n op === '!in' ? convertNegation(convertInOp(filter[1], filter.slice(2))) :\n op === 'has' ? convertHasOp(filter[1]) :\n op === '!has' ? convertNegation(convertHasOp(filter[1])) :\n true;\n return converted;\n}\n\nfunction convertComparisonOp(property: string, value: any, op: string) {\n switch (property) {\n case '$type':\n return [`filter-type-${op}`, value];\n case '$id':\n return [`filter-id-${op}`, value];\n default:\n return [`filter-${op}`, property, value];\n }\n}\n\nfunction convertDisjunctionOp(filters: Array>) {\n return ['any'].concat(filters.map(convertFilter));\n}\n\nfunction convertInOp(property: string, values: Array) {\n if (values.length === 0) { return false; }\n switch (property) {\n case '$type':\n return [`filter-type-in`, ['literal', values]];\n case '$id':\n return [`filter-id-in`, ['literal', values]];\n default:\n if (values.length > 200 && !values.some(v => typeof v !== typeof values[0])) {\n return ['filter-in-large', property, ['literal', values.sort(compare)]];\n } else {\n return ['filter-in-small', property, ['literal', values]];\n }\n }\n}\n\nfunction convertHasOp(property: string) {\n switch (property) {\n case '$type':\n return true;\n case '$id':\n return [`filter-has-id`];\n default:\n return [`filter-has`, property];\n }\n}\n\nfunction convertNegation(filter: mixed) {\n return ['!', filter];\n}\n\n","\nimport ValidationError from '../error/validation_error';\nimport validateExpression from './validate_expression';\nimport validateEnum from './validate_enum';\nimport getType from '../util/get_type';\nimport { unbundle, deepUnbundle } from '../util/unbundle_jsonlint';\nimport extend from '../util/extend';\nimport { isExpressionFilter } from '../feature_filter';\n\nexport default function validateFilter(options) {\n if (isExpressionFilter(deepUnbundle(options.value))) {\n return validateExpression(extend({}, options, {\n expressionContext: 'filter',\n valueSpec: { value: 'boolean' }\n }));\n } else {\n return validateNonExpressionFilter(options);\n }\n}\n\nfunction validateNonExpressionFilter(options) {\n const value = options.value;\n const key = options.key;\n\n if (getType(value) !== 'array') {\n return [new ValidationError(key, value, `array expected, ${getType(value)} found`)];\n }\n\n const styleSpec = options.styleSpec;\n let type;\n\n let errors = [];\n\n if (value.length < 1) {\n return [new ValidationError(key, value, 'filter array must have at least 1 element')];\n }\n\n errors = errors.concat(validateEnum({\n key: `${key}[0]`,\n value: value[0],\n valueSpec: styleSpec.filter_operator,\n style: options.style,\n styleSpec: options.styleSpec\n }));\n\n switch (unbundle(value[0])) {\n case '<':\n case '<=':\n case '>':\n case '>=':\n if (value.length >= 2 && unbundle(value[1]) === '$type') {\n errors.push(new ValidationError(key, value, `\"$type\" cannot be use with operator \"${value[0]}\"`));\n }\n /* falls through */\n case '==':\n case '!=':\n if (value.length !== 3) {\n errors.push(new ValidationError(key, value, `filter array for operator \"${value[0]}\" must have 3 elements`));\n }\n /* falls through */\n case 'in':\n case '!in':\n if (value.length >= 2) {\n type = getType(value[1]);\n if (type !== 'string') {\n errors.push(new ValidationError(`${key}[1]`, value[1], `string expected, ${type} found`));\n }\n }\n for (let i = 2; i < value.length; i++) {\n type = getType(value[i]);\n if (unbundle(value[1]) === '$type') {\n errors = errors.concat(validateEnum({\n key: `${key}[${i}]`,\n value: value[i],\n valueSpec: styleSpec.geometry_type,\n style: options.style,\n styleSpec: options.styleSpec\n }));\n } else if (type !== 'string' && type !== 'number' && type !== 'boolean') {\n errors.push(new ValidationError(`${key}[${i}]`, value[i], `string, number, or boolean expected, ${type} found`));\n }\n }\n break;\n\n case 'any':\n case 'all':\n case 'none':\n for (let i = 1; i < value.length; i++) {\n errors = errors.concat(validateNonExpressionFilter({\n key: `${key}[${i}]`,\n value: value[i],\n style: options.style,\n styleSpec: options.styleSpec\n }));\n }\n break;\n\n case 'has':\n case '!has':\n type = getType(value[1]);\n if (value.length !== 2) {\n errors.push(new ValidationError(key, value, `filter array for \"${value[0]}\" operator must have 2 elements`));\n } else if (type !== 'string') {\n errors.push(new ValidationError(`${key}[1]`, value[1], `string expected, ${type} found`));\n }\n break;\n\n }\n\n return errors;\n}\n","\nimport validate from './validate';\nimport ValidationError from '../error/validation_error';\nimport getType from '../util/get_type';\nimport { isFunction } from '../function';\nimport { unbundle, deepUnbundle } from '../util/unbundle_jsonlint';\n\nexport default function validateProperty(options, propertyType) {\n const key = options.key;\n const style = options.style;\n const styleSpec = options.styleSpec;\n const value = options.value;\n const propertyKey = options.objectKey;\n const layerSpec = styleSpec[`${propertyType}_${options.layerType}`];\n\n if (!layerSpec) return [];\n\n const transitionMatch = propertyKey.match(/^(.*)-transition$/);\n if (propertyType === 'paint' && transitionMatch && layerSpec[transitionMatch[1]] && layerSpec[transitionMatch[1]].transition) {\n return validate({\n key: key,\n value: value,\n valueSpec: styleSpec.transition,\n style: style,\n styleSpec: styleSpec\n });\n }\n\n const valueSpec = options.valueSpec || layerSpec[propertyKey];\n if (!valueSpec) {\n return [new ValidationError(key, value, `unknown property \"${propertyKey}\"`)];\n }\n\n let tokenMatch;\n if (getType(value) === 'string' && valueSpec['property-function'] && !valueSpec.tokens && (tokenMatch = /^{([^}]+)}$/.exec(value))) {\n return [new ValidationError(\n key, value,\n `\"${propertyKey}\" does not support interpolation syntax\\n` +\n `Use an identity property function instead: \\`{ \"type\": \"identity\", \"property\": ${JSON.stringify(tokenMatch[1])} }\\`.`)];\n }\n\n const errors = [];\n\n if (options.layerType === 'symbol') {\n if (propertyKey === 'text-field' && style && !style.glyphs) {\n errors.push(new ValidationError(key, value, 'use of \"text-field\" requires a style \"glyphs\" property'));\n }\n if (propertyKey === 'text-font' && isFunction(deepUnbundle(value)) && unbundle(value.type) === 'identity') {\n errors.push(new ValidationError(key, value, '\"text-font\" does not support identity functions'));\n }\n }\n\n return errors.concat(validate({\n key: options.key,\n value: value,\n valueSpec: valueSpec,\n style: style,\n styleSpec: styleSpec,\n expressionContext: 'property',\n propertyKey\n }));\n}\n","\nimport validateProperty from './validate_property';\n\nexport default function validatePaintProperty(options) {\n return validateProperty(options, 'paint');\n}\n","\nimport validateProperty from './validate_property';\n\nexport default function validateLayoutProperty(options) {\n return validateProperty(options, 'layout');\n}\n","\nimport ValidationError from '../error/validation_error';\nimport { unbundle } from '../util/unbundle_jsonlint';\nimport validateObject from './validate_object';\nimport validateFilter from './validate_filter';\nimport validatePaintProperty from './validate_paint_property';\nimport validateLayoutProperty from './validate_layout_property';\nimport validateSpec from './validate';\nimport extend from '../util/extend';\n\nexport default function validateLayer(options) {\n let errors = [];\n\n const layer = options.value;\n const key = options.key;\n const style = options.style;\n const styleSpec = options.styleSpec;\n\n if (!layer.type && !layer.ref) {\n errors.push(new ValidationError(key, layer, 'either \"type\" or \"ref\" is required'));\n }\n let type = unbundle(layer.type);\n const ref = unbundle(layer.ref);\n\n if (layer.id) {\n const layerId = unbundle(layer.id);\n for (let i = 0; i < options.arrayIndex; i++) {\n const otherLayer = style.layers[i];\n if (unbundle(otherLayer.id) === layerId) {\n errors.push(new ValidationError(key, layer.id, `duplicate layer id \"${layer.id}\", previously used at line ${otherLayer.id.__line__}`));\n }\n }\n }\n\n if ('ref' in layer) {\n ['type', 'source', 'source-layer', 'filter', 'layout'].forEach((p) => {\n if (p in layer) {\n errors.push(new ValidationError(key, layer[p], `\"${p}\" is prohibited for ref layers`));\n }\n });\n\n let parent;\n\n style.layers.forEach((layer) => {\n if (unbundle(layer.id) === ref) parent = layer;\n });\n\n if (!parent) {\n errors.push(new ValidationError(key, layer.ref, `ref layer \"${ref}\" not found`));\n } else if (parent.ref) {\n errors.push(new ValidationError(key, layer.ref, 'ref cannot reference another ref layer'));\n } else {\n type = unbundle(parent.type);\n }\n } else if (type !== 'background') {\n if (!layer.source) {\n errors.push(new ValidationError(key, layer, 'missing required property \"source\"'));\n } else {\n const source = style.sources && style.sources[layer.source];\n const sourceType = source && unbundle(source.type);\n if (!source) {\n errors.push(new ValidationError(key, layer.source, `source \"${layer.source}\" not found`));\n } else if (sourceType === 'vector' && type === 'raster') {\n errors.push(new ValidationError(key, layer.source, `layer \"${layer.id}\" requires a raster source`));\n } else if (sourceType === 'raster' && type !== 'raster') {\n errors.push(new ValidationError(key, layer.source, `layer \"${layer.id}\" requires a vector source`));\n } else if (sourceType === 'vector' && !layer['source-layer']) {\n errors.push(new ValidationError(key, layer, `layer \"${layer.id}\" must specify a \"source-layer\"`));\n } else if (sourceType === 'raster-dem' && type !== 'hillshade') {\n errors.push(new ValidationError(key, layer.source, 'raster-dem source can only be used with layer type \\'hillshade\\'.'));\n } else if (type === 'line' && layer.paint && layer.paint['line-gradient'] &&\n (sourceType !== 'geojson' || !source.lineMetrics)) {\n errors.push(new ValidationError(key, layer, `layer \"${layer.id}\" specifies a line-gradient, which requires a GeoJSON source with \\`lineMetrics\\` enabled.`));\n }\n }\n }\n\n errors = errors.concat(validateObject({\n key: key,\n value: layer,\n valueSpec: styleSpec.layer,\n style: options.style,\n styleSpec: options.styleSpec,\n objectElementValidators: {\n '*': function() {\n return [];\n },\n // We don't want to enforce the spec's `\"requires\": true` for backward compatibility with refs;\n // the actual requirement is validated above. See https://github.com/mapbox/mapbox-gl-js/issues/5772.\n type: function() {\n return validateSpec({\n key: `${key}.type`,\n value: layer.type,\n valueSpec: styleSpec.layer.type,\n style: options.style,\n styleSpec: options.styleSpec,\n object: layer,\n objectKey: 'type'\n });\n },\n filter: validateFilter,\n layout: function(options) {\n return validateObject({\n layer: layer,\n key: options.key,\n value: options.value,\n style: options.style,\n styleSpec: options.styleSpec,\n objectElementValidators: {\n '*': function(options) {\n return validateLayoutProperty(extend({layerType: type}, options));\n }\n }\n });\n },\n paint: function(options) {\n return validateObject({\n layer: layer,\n key: options.key,\n value: options.value,\n style: options.style,\n styleSpec: options.styleSpec,\n objectElementValidators: {\n '*': function(options) {\n return validatePaintProperty(extend({layerType: type}, options));\n }\n }\n });\n }\n }\n }));\n\n return errors;\n}\n","\nimport ValidationError from '../error/validation_error';\nimport { unbundle } from '../util/unbundle_jsonlint';\nimport validateObject from './validate_object';\nimport validateEnum from './validate_enum';\n\nexport default function validateSource(options) {\n const value = options.value;\n const key = options.key;\n const styleSpec = options.styleSpec;\n const style = options.style;\n\n if (!value.type) {\n return [new ValidationError(key, value, '\"type\" is required')];\n }\n\n const type = unbundle(value.type);\n let errors = [];\n\n switch (type) {\n case 'vector':\n case 'raster':\n case 'raster-dem':\n errors = errors.concat(validateObject({\n key: key,\n value: value,\n valueSpec: styleSpec[`source_${type.replace('-', '_')}`],\n style: options.style,\n styleSpec: styleSpec\n }));\n if ('url' in value) {\n for (const prop in value) {\n if (['type', 'url', 'tileSize'].indexOf(prop) < 0) {\n errors.push(new ValidationError(`${key}.${prop}`, value[prop], `a source with a \"url\" property may not include a \"${prop}\" property`));\n }\n }\n }\n return errors;\n\n case 'geojson':\n return validateObject({\n key: key,\n value: value,\n valueSpec: styleSpec.source_geojson,\n style: style,\n styleSpec: styleSpec\n });\n\n case 'video':\n return validateObject({\n key: key,\n value: value,\n valueSpec: styleSpec.source_video,\n style: style,\n styleSpec: styleSpec\n });\n\n case 'image':\n return validateObject({\n key: key,\n value: value,\n valueSpec: styleSpec.source_image,\n style: style,\n styleSpec: styleSpec\n });\n\n case 'canvas':\n errors.push(new ValidationError(key, null, `Please use runtime APIs to add canvas sources, rather than including them in stylesheets.`, 'source.canvas'));\n return errors;\n\n default:\n return validateEnum({\n key: `${key}.type`,\n value: value.type,\n valueSpec: {values: ['vector', 'raster', 'raster-dem', 'geojson', 'video', 'image']},\n style: style,\n styleSpec: styleSpec\n });\n }\n}\n","\nimport ValidationError from '../error/validation_error';\nimport getType from '../util/get_type';\nimport validate from './validate';\n\nexport default function validateLight(options) {\n const light = options.value;\n const styleSpec = options.styleSpec;\n const lightSpec = styleSpec.light;\n const style = options.style;\n\n let errors = [];\n\n const rootType = getType(light);\n if (light === undefined) {\n return errors;\n } else if (rootType !== 'object') {\n errors = errors.concat([new ValidationError('light', light, `object expected, ${rootType} found`)]);\n return errors;\n }\n\n for (const key in light) {\n const transitionMatch = key.match(/^(.*)-transition$/);\n\n if (transitionMatch && lightSpec[transitionMatch[1]] && lightSpec[transitionMatch[1]].transition) {\n errors = errors.concat(validate({\n key: key,\n value: light[key],\n valueSpec: styleSpec.transition,\n style: style,\n styleSpec: styleSpec\n }));\n } else if (lightSpec[key]) {\n errors = errors.concat(validate({\n key: key,\n value: light[key],\n valueSpec: lightSpec[key],\n style: style,\n styleSpec: styleSpec\n }));\n } else {\n errors = errors.concat([new ValidationError(key, light[key], `unknown property \"${key}\"`)]);\n }\n }\n\n return errors;\n}\n","\nimport getType from '../util/get_type';\nimport ValidationError from '../error/validation_error';\n\nexport default function validateString(options) {\n const value = options.value;\n const key = options.key;\n const type = getType(value);\n\n if (type !== 'string') {\n return [new ValidationError(key, value, `string expected, ${type} found`)];\n }\n\n return [];\n}\n","\nimport extend from '../util/extend';\nimport { unbundle, deepUnbundle } from '../util/unbundle_jsonlint';\nimport { isExpression } from '../expression';\nimport { isFunction } from '../function';\n\nimport validateFunction from './validate_function';\nimport validateExpression from './validate_expression';\nimport validateObject from './validate_object';\nimport validateArray from './validate_array';\nimport validateBoolean from './validate_boolean';\nimport validateNumber from './validate_number';\nimport validateColor from './validate_color';\nimport validateConstants from './validate_constants';\nimport validateEnum from './validate_enum';\nimport validateFilter from './validate_filter';\nimport validateLayer from './validate_layer';\nimport validateSource from './validate_source';\nimport validateLight from './validate_light';\nimport validateString from './validate_string';\n\nconst VALIDATORS = {\n '*': function() {\n return [];\n },\n 'array': validateArray,\n 'boolean': validateBoolean,\n 'number': validateNumber,\n 'color': validateColor,\n 'constants': validateConstants,\n 'enum': validateEnum,\n 'filter': validateFilter,\n 'function': validateFunction,\n 'layer': validateLayer,\n 'object': validateObject,\n 'source': validateSource,\n 'light': validateLight,\n 'string': validateString\n};\n\n\n// Main recursive validation function. Tracks:\n//\n// - key: string representing location of validation in style tree. Used only\n// for more informative error reporting.\n// - value: current value from style being evaluated. May be anything from a\n// high level object that needs to be descended into deeper or a simple\n// scalar value.\n// - valueSpec: current spec being evaluated. Tracks value.\n// - styleSpec: current full spec being evaluated.\n\nexport default function validate(options) {\n const value = options.value;\n const valueSpec = options.valueSpec;\n const styleSpec = options.styleSpec;\n\n if (valueSpec.function && isFunction(unbundle(value))) {\n return validateFunction(options);\n\n } else if (valueSpec.function && isExpression(deepUnbundle(value))) {\n return validateExpression(options);\n\n } else if (valueSpec.type && VALIDATORS[valueSpec.type]) {\n return VALIDATORS[valueSpec.type](options);\n\n } else {\n return validateObject(extend({}, options, {\n valueSpec: valueSpec.type ? styleSpec[valueSpec.type] : valueSpec\n }));\n }\n}\n","\nimport getType from '../util/get_type';\nimport ValidationError from '../error/validation_error';\n\nexport default function validateBoolean(options) {\n const value = options.value;\n const key = options.key;\n const type = getType(value);\n\n if (type !== 'boolean') {\n return [new ValidationError(key, value, `boolean expected, ${type} found`)];\n }\n\n return [];\n}\n","\nimport ValidationError from '../error/validation_error';\nimport getType from '../util/get_type';\nimport { parseCSSColor } from 'csscolorparser';\n\nexport default function validateColor(options) {\n const key = options.key;\n const value = options.value;\n const type = getType(value);\n\n if (type !== 'string') {\n return [new ValidationError(key, value, `color expected, ${type} found`)];\n }\n\n if (parseCSSColor(value) === null) {\n return [new ValidationError(key, value, `color expected, \"${value}\" found`)];\n }\n\n return [];\n}\n","\nimport validateConstants from './validate/validate_constants';\nimport validate from './validate/validate';\nimport latestStyleSpec from './reference/latest';\nimport validateGlyphsURL from './validate/validate_glyphs_url';\n\nimport validateSource from './validate/validate_source';\nimport validateLight from './validate/validate_light';\nimport validateLayer from './validate/validate_layer';\nimport validateFilter from './validate/validate_filter';\nimport validatePaintProperty from './validate/validate_paint_property';\nimport validateLayoutProperty from './validate/validate_layout_property';\n\n/**\n * Validate a Mapbox GL style against the style specification. This entrypoint,\n * `mapbox-gl-style-spec/lib/validate_style.min`, is designed to produce as\n * small a browserify bundle as possible by omitting unnecessary functionality\n * and legacy style specifications.\n *\n * @private\n * @param {Object} style The style to be validated.\n * @param {Object} [styleSpec] The style specification to validate against.\n * If omitted, the latest style spec is used.\n * @returns {Array}\n * @example\n * var validate = require('mapbox-gl-style-spec/lib/validate_style.min');\n * var errors = validate(style);\n */\nfunction validateStyleMin(style, styleSpec) {\n styleSpec = styleSpec || latestStyleSpec;\n\n let errors = [];\n\n errors = errors.concat(validate({\n key: '',\n value: style,\n valueSpec: styleSpec.$root,\n styleSpec: styleSpec,\n style: style,\n objectElementValidators: {\n glyphs: validateGlyphsURL,\n '*': function() {\n return [];\n }\n }\n }));\n\n if (style.constants) {\n errors = errors.concat(validateConstants({\n key: 'constants',\n value: style.constants,\n style: style,\n styleSpec: styleSpec\n }));\n }\n\n return sortErrors(errors);\n}\n\nvalidateStyleMin.source = wrapCleanErrors(validateSource);\nvalidateStyleMin.light = wrapCleanErrors(validateLight);\nvalidateStyleMin.layer = wrapCleanErrors(validateLayer);\nvalidateStyleMin.filter = wrapCleanErrors(validateFilter);\nvalidateStyleMin.paintProperty = wrapCleanErrors(validatePaintProperty);\nvalidateStyleMin.layoutProperty = wrapCleanErrors(validateLayoutProperty);\n\nfunction sortErrors(errors) {\n return [].concat(errors).sort((a, b) => {\n return a.line - b.line;\n });\n}\n\nfunction wrapCleanErrors(inner) {\n return function() {\n return sortErrors(inner.apply(this, arguments));\n };\n}\n\nexport default validateStyleMin;\n","// @flow\nimport validateStyleMin from '../style-spec/validate_style.min';\nimport { ErrorEvent } from '../util/evented';\n\nimport type {Evented} from '../util/evented';\n\ntype ValidationError = {\n message: string,\n line: number,\n identifier?: string\n};\n\ntype Validator = (Object) => $ReadOnlyArray;\n\nexport const validateStyle = (validateStyleMin: (Object, ?Object) => $ReadOnlyArray);\n\nexport const validateSource = (validateStyleMin.source: Validator);\nexport const validateLight = (validateStyleMin.light: Validator);\nexport const validateFilter = (validateStyleMin.filter: Validator);\nexport const validatePaintProperty = (validateStyleMin.paintProperty: Validator);\nexport const validateLayoutProperty = (validateStyleMin.layoutProperty: Validator);\n\nexport function emitValidationErrors(emitter: Evented, errors: ?$ReadOnlyArray<{message: string, identifier?: string}>): boolean {\n let hasErrors = false;\n if (errors && errors.length) {\n for (const error of errors) {\n emitter.fire(new ErrorEvent(new Error(error.message)));\n hasErrors = true;\n }\n }\n return hasErrors;\n}\n","'use strict';\n\nmodule.exports = GridIndex;\n\nvar NUM_PARAMS = 3;\n\nfunction GridIndex(extent, n, padding) {\n var cells = this.cells = [];\n\n if (extent instanceof ArrayBuffer) {\n this.arrayBuffer = extent;\n var array = new Int32Array(this.arrayBuffer);\n extent = array[0];\n n = array[1];\n padding = array[2];\n\n this.d = n + 2 * padding;\n for (var k = 0; k < this.d * this.d; k++) {\n var start = array[NUM_PARAMS + k];\n var end = array[NUM_PARAMS + k + 1];\n cells.push(start === end ?\n null :\n array.subarray(start, end));\n }\n var keysOffset = array[NUM_PARAMS + cells.length];\n var bboxesOffset = array[NUM_PARAMS + cells.length + 1];\n this.keys = array.subarray(keysOffset, bboxesOffset);\n this.bboxes = array.subarray(bboxesOffset);\n\n this.insert = this._insertReadonly;\n\n } else {\n this.d = n + 2 * padding;\n for (var i = 0; i < this.d * this.d; i++) {\n cells.push([]);\n }\n this.keys = [];\n this.bboxes = [];\n }\n\n this.n = n;\n this.extent = extent;\n this.padding = padding;\n this.scale = n / extent;\n this.uid = 0;\n\n var p = (padding / n) * extent;\n this.min = -p;\n this.max = extent + p;\n}\n\n\nGridIndex.prototype.insert = function(key, x1, y1, x2, y2) {\n this._forEachCell(x1, y1, x2, y2, this._insertCell, this.uid++);\n this.keys.push(key);\n this.bboxes.push(x1);\n this.bboxes.push(y1);\n this.bboxes.push(x2);\n this.bboxes.push(y2);\n};\n\nGridIndex.prototype._insertReadonly = function() {\n throw 'Cannot insert into a GridIndex created from an ArrayBuffer.';\n};\n\nGridIndex.prototype._insertCell = function(x1, y1, x2, y2, cellIndex, uid) {\n this.cells[cellIndex].push(uid);\n};\n\nGridIndex.prototype.query = function(x1, y1, x2, y2) {\n var min = this.min;\n var max = this.max;\n if (x1 <= min && y1 <= min && max <= x2 && max <= y2) {\n // We use `Array#slice` because `this.keys` may be a `Int32Array` and\n // some browsers (Safari and IE) do not support `TypedArray#slice`\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/slice#Browser_compatibility\n return Array.prototype.slice.call(this.keys);\n\n } else {\n var result = [];\n var seenUids = {};\n this._forEachCell(x1, y1, x2, y2, this._queryCell, result, seenUids);\n return result;\n }\n};\n\nGridIndex.prototype._queryCell = function(x1, y1, x2, y2, cellIndex, result, seenUids) {\n var cell = this.cells[cellIndex];\n if (cell !== null) {\n var keys = this.keys;\n var bboxes = this.bboxes;\n for (var u = 0; u < cell.length; u++) {\n var uid = cell[u];\n if (seenUids[uid] === undefined) {\n var offset = uid * 4;\n if ((x1 <= bboxes[offset + 2]) &&\n (y1 <= bboxes[offset + 3]) &&\n (x2 >= bboxes[offset + 0]) &&\n (y2 >= bboxes[offset + 1])) {\n seenUids[uid] = true;\n result.push(keys[uid]);\n } else {\n seenUids[uid] = false;\n }\n }\n }\n }\n};\n\nGridIndex.prototype._forEachCell = function(x1, y1, x2, y2, fn, arg1, arg2) {\n var cx1 = this._convertToCellCoord(x1);\n var cy1 = this._convertToCellCoord(y1);\n var cx2 = this._convertToCellCoord(x2);\n var cy2 = this._convertToCellCoord(y2);\n for (var x = cx1; x <= cx2; x++) {\n for (var y = cy1; y <= cy2; y++) {\n var cellIndex = this.d * y + x;\n if (fn.call(this, x1, y1, x2, y2, cellIndex, arg1, arg2)) return;\n }\n }\n};\n\nGridIndex.prototype._convertToCellCoord = function(x) {\n return Math.max(0, Math.min(this.d - 1, Math.floor(x * this.scale) + this.padding));\n};\n\nGridIndex.prototype.toArrayBuffer = function() {\n if (this.arrayBuffer) return this.arrayBuffer;\n\n var cells = this.cells;\n\n var metadataLength = NUM_PARAMS + this.cells.length + 1 + 1;\n var totalCellLength = 0;\n for (var i = 0; i < this.cells.length; i++) {\n totalCellLength += this.cells[i].length;\n }\n\n var array = new Int32Array(metadataLength + totalCellLength + this.keys.length + this.bboxes.length);\n array[0] = this.extent;\n array[1] = this.n;\n array[2] = this.padding;\n\n var offset = metadataLength;\n for (var k = 0; k < cells.length; k++) {\n var cell = cells[k];\n array[NUM_PARAMS + k] = offset;\n array.set(cell, offset);\n offset += cell.length;\n }\n\n array[NUM_PARAMS + cells.length] = offset;\n array.set(this.keys, offset);\n offset += this.keys.length;\n\n array[NUM_PARAMS + cells.length + 1] = offset;\n array.set(this.bboxes, offset);\n offset += this.bboxes.length;\n\n return array.buffer;\n};\n","// @flow\n\nimport assert from 'assert';\n\nimport Grid from 'grid-index';\nimport Color from '../style-spec/util/color';\nimport { StylePropertyFunction, StyleExpression, ZoomDependentExpression, ZoomConstantExpression } from '../style-spec/expression';\nimport CompoundExpression from '../style-spec/expression/compound_expression';\nimport expressions from '../style-spec/expression/definitions';\nimport window from './window';\nconst { ImageData } = window;\n\nimport type {Transferable} from '../types/transferable';\n\nexport type Serialized =\n | null\n | void\n | boolean\n | number\n | string\n | Boolean\n | Number\n | String\n | Date\n | RegExp\n | ArrayBuffer\n | $ArrayBufferView\n | ImageData\n | Array\n | {| name: string, properties: {+[string]: Serialized} |};\n\ntype Registry = {\n [string]: {\n klass: Class,\n omit: $ReadOnlyArray,\n shallow: $ReadOnlyArray\n }\n};\n\ntype RegisterOptions = {\n omit?: $ReadOnlyArray<$Keys>,\n shallow?: $ReadOnlyArray<$Keys>\n}\n\nconst registry: Registry = {};\n\n/**\n * Register the given class as serializable.\n *\n * @param options\n * @param options.omit List of properties to omit from serialization (e.g., cached/computed properties)\n * @param options.shallow List of properties that should be serialized by a simple shallow copy, rather than by a recursive call to serialize().\n *\n * @private\n */\nexport function register(name: string, klass: Class, options: RegisterOptions = {}) {\n assert(!registry[name], `${name} is already registered.`);\n (Object.defineProperty: any)(klass, '_classRegistryKey', {\n value: name,\n writeable: false\n });\n registry[name] = {\n klass,\n omit: options.omit || [],\n shallow: options.shallow || []\n };\n}\n\nregister('Object', Object);\n\nGrid.serialize = function serializeGrid(grid: Grid, transferables?: Array): Serialized {\n const ab = grid.toArrayBuffer();\n if (transferables) {\n transferables.push(ab);\n }\n return ab;\n};\n\nGrid.deserialize = function deserializeGrid(serialized: ArrayBuffer): Grid {\n return new Grid(serialized);\n};\nregister('Grid', Grid);\n\nregister('Color', Color);\nregister('Error', Error);\n\nregister('StylePropertyFunction', StylePropertyFunction);\nregister('StyleExpression', StyleExpression, {omit: ['_evaluator']});\n\nregister('ZoomDependentExpression', ZoomDependentExpression);\nregister('ZoomConstantExpression', ZoomConstantExpression);\nregister('CompoundExpression', CompoundExpression, {omit: ['_evaluate']});\nfor (const name in expressions) {\n if ((expressions[name]: any)._classRegistryKey) continue;\n register(`Expression_${name}`, expressions[name]);\n}\n\n/**\n * Serialize the given object for transfer to or from a web worker.\n *\n * For non-builtin types, recursively serialize each property (possibly\n * omitting certain properties - see register()), and package the result along\n * with the constructor's `name` so that the appropriate constructor can be\n * looked up in `deserialize()`.\n *\n * If a `transferables` array is provided, add any transferable objects (i.e.,\n * any ArrayBuffers or ArrayBuffer views) to the list. (If a copy is needed,\n * this should happen in the client code, before using serialize().)\n *\n * @private\n */\nexport function serialize(input: mixed, transferables?: Array): Serialized {\n if (input === null ||\n input === undefined ||\n typeof input === 'boolean' ||\n typeof input === 'number' ||\n typeof input === 'string' ||\n input instanceof Boolean ||\n input instanceof Number ||\n input instanceof String ||\n input instanceof Date ||\n input instanceof RegExp) {\n return input;\n }\n\n if (input instanceof ArrayBuffer) {\n if (transferables) {\n transferables.push(input);\n }\n return input;\n }\n\n if (ArrayBuffer.isView(input)) {\n const view: $ArrayBufferView = (input: any);\n if (transferables) {\n transferables.push(view.buffer);\n }\n return view;\n }\n\n if (input instanceof ImageData) {\n if (transferables) {\n transferables.push(input.data.buffer);\n }\n return input;\n }\n\n if (Array.isArray(input)) {\n const serialized = [];\n for (const item of input) {\n serialized.push(serialize(item, transferables));\n }\n return serialized;\n }\n\n if (typeof input === 'object') {\n const klass = (input.constructor: any);\n const name = klass._classRegistryKey;\n if (!name) {\n throw new Error(`can't serialize object of unregistered class`);\n }\n assert(registry[name]);\n\n const properties: {[string]: Serialized} = {};\n\n if (klass.serialize) {\n // (Temporary workaround) allow a class to provide static\n // `serialize()` and `deserialize()` methods to bypass the generic\n // approach.\n // This temporary workaround lets us use the generic serialization\n // approach for objects whose members include instances of dynamic\n // StructArray types. Once we refactor StructArray to be static,\n // we can remove this complexity.\n properties._serialized = (klass.serialize: typeof serialize)(input, transferables);\n } else {\n for (const key in input) {\n // any cast due to https://github.com/facebook/flow/issues/5393\n if (!(input: any).hasOwnProperty(key)) continue;\n if (registry[name].omit.indexOf(key) >= 0) continue;\n const property = (input: any)[key];\n properties[key] = registry[name].shallow.indexOf(key) >= 0 ?\n property :\n serialize(property, transferables);\n }\n\n if (input instanceof Error) {\n properties.message = input.message;\n }\n }\n\n return {name, properties};\n }\n\n throw new Error(`can't serialize object of type ${typeof input}`);\n}\n\nexport function deserialize(input: Serialized): mixed {\n if (input === null ||\n input === undefined ||\n typeof input === 'boolean' ||\n typeof input === 'number' ||\n typeof input === 'string' ||\n input instanceof Boolean ||\n input instanceof Number ||\n input instanceof String ||\n input instanceof Date ||\n input instanceof RegExp ||\n input instanceof ArrayBuffer ||\n ArrayBuffer.isView(input) ||\n input instanceof ImageData) {\n return input;\n }\n\n if (Array.isArray(input)) {\n return input.map((i) => deserialize(i));\n }\n\n if (typeof input === 'object') {\n const {name, properties} = (input: any);\n if (!name) {\n throw new Error(`can't deserialize object of anonymous class`);\n }\n\n const {klass} = registry[name];\n if (!klass) {\n throw new Error(`can't deserialize unregistered class ${name}`);\n }\n\n if (klass.deserialize) {\n return (klass.deserialize: typeof deserialize)(properties._serialized);\n }\n\n const result = Object.create(klass.prototype);\n\n for (const key of Object.keys(properties)) {\n result[key] = registry[name].shallow.indexOf(key) >= 0 ?\n properties[key] : deserialize(properties[key]);\n }\n\n return result;\n }\n\n throw new Error(`can't deserialize object of type ${typeof input}`);\n}\n","// @flow\n\nclass ZoomHistory {\n lastZoom: number;\n lastFloorZoom: number;\n lastIntegerZoom: number;\n lastIntegerZoomTime: number;\n first: boolean;\n\n constructor() {\n this.first = true;\n }\n\n update(z: number, now: number) {\n const floorZ = Math.floor(z);\n\n if (this.first) {\n this.first = false;\n this.lastIntegerZoom = floorZ;\n this.lastIntegerZoomTime = 0;\n this.lastZoom = z;\n this.lastFloorZoom = floorZ;\n return true;\n }\n\n if (this.lastFloorZoom > floorZ) {\n this.lastIntegerZoom = floorZ + 1;\n this.lastIntegerZoomTime = now;\n } else if (this.lastFloorZoom < floorZ) {\n this.lastIntegerZoom = floorZ;\n this.lastIntegerZoomTime = now;\n }\n\n if (z !== this.lastZoom) {\n this.lastZoom = z;\n this.lastFloorZoom = floorZ;\n return true;\n }\n\n return false;\n }\n}\n\nexport default ZoomHistory;\n","// @flow\n\n// The following table comes from .\n// Keep it synchronized with .\n\ntype UnicodeBlockLookup = {[key: string]: (char: number) => boolean};\n\nconst unicodeBlockLookup: UnicodeBlockLookup = {\n // 'Basic Latin': (char) => char >= 0x0000 && char <= 0x007F,\n 'Latin-1 Supplement': (char) => char >= 0x0080 && char <= 0x00FF,\n // 'Latin Extended-A': (char) => char >= 0x0100 && char <= 0x017F,\n // 'Latin Extended-B': (char) => char >= 0x0180 && char <= 0x024F,\n // 'IPA Extensions': (char) => char >= 0x0250 && char <= 0x02AF,\n // 'Spacing Modifier Letters': (char) => char >= 0x02B0 && char <= 0x02FF,\n // 'Combining Diacritical Marks': (char) => char >= 0x0300 && char <= 0x036F,\n // 'Greek and Coptic': (char) => char >= 0x0370 && char <= 0x03FF,\n // 'Cyrillic': (char) => char >= 0x0400 && char <= 0x04FF,\n // 'Cyrillic Supplement': (char) => char >= 0x0500 && char <= 0x052F,\n // 'Armenian': (char) => char >= 0x0530 && char <= 0x058F,\n //'Hebrew': (char) => char >= 0x0590 && char <= 0x05FF,\n 'Arabic': (char) => char >= 0x0600 && char <= 0x06FF,\n //'Syriac': (char) => char >= 0x0700 && char <= 0x074F,\n 'Arabic Supplement': (char) => char >= 0x0750 && char <= 0x077F,\n // 'Thaana': (char) => char >= 0x0780 && char <= 0x07BF,\n // 'NKo': (char) => char >= 0x07C0 && char <= 0x07FF,\n // 'Samaritan': (char) => char >= 0x0800 && char <= 0x083F,\n // 'Mandaic': (char) => char >= 0x0840 && char <= 0x085F,\n // 'Syriac Supplement': (char) => char >= 0x0860 && char <= 0x086F,\n 'Arabic Extended-A': (char) => char >= 0x08A0 && char <= 0x08FF,\n // 'Devanagari': (char) => char >= 0x0900 && char <= 0x097F,\n // 'Bengali': (char) => char >= 0x0980 && char <= 0x09FF,\n // 'Gurmukhi': (char) => char >= 0x0A00 && char <= 0x0A7F,\n // 'Gujarati': (char) => char >= 0x0A80 && char <= 0x0AFF,\n // 'Oriya': (char) => char >= 0x0B00 && char <= 0x0B7F,\n // 'Tamil': (char) => char >= 0x0B80 && char <= 0x0BFF,\n // 'Telugu': (char) => char >= 0x0C00 && char <= 0x0C7F,\n // 'Kannada': (char) => char >= 0x0C80 && char <= 0x0CFF,\n // 'Malayalam': (char) => char >= 0x0D00 && char <= 0x0D7F,\n // 'Sinhala': (char) => char >= 0x0D80 && char <= 0x0DFF,\n // 'Thai': (char) => char >= 0x0E00 && char <= 0x0E7F,\n // 'Lao': (char) => char >= 0x0E80 && char <= 0x0EFF,\n // 'Tibetan': (char) => char >= 0x0F00 && char <= 0x0FFF,\n // 'Myanmar': (char) => char >= 0x1000 && char <= 0x109F,\n // 'Georgian': (char) => char >= 0x10A0 && char <= 0x10FF,\n 'Hangul Jamo': (char) => char >= 0x1100 && char <= 0x11FF,\n // 'Ethiopic': (char) => char >= 0x1200 && char <= 0x137F,\n // 'Ethiopic Supplement': (char) => char >= 0x1380 && char <= 0x139F,\n // 'Cherokee': (char) => char >= 0x13A0 && char <= 0x13FF,\n 'Unified Canadian Aboriginal Syllabics': (char) => char >= 0x1400 && char <= 0x167F,\n // 'Ogham': (char) => char >= 0x1680 && char <= 0x169F,\n // 'Runic': (char) => char >= 0x16A0 && char <= 0x16FF,\n // 'Tagalog': (char) => char >= 0x1700 && char <= 0x171F,\n // 'Hanunoo': (char) => char >= 0x1720 && char <= 0x173F,\n // 'Buhid': (char) => char >= 0x1740 && char <= 0x175F,\n // 'Tagbanwa': (char) => char >= 0x1760 && char <= 0x177F,\n 'Khmer': (char) => char >= 0x1780 && char <= 0x17FF,\n // 'Mongolian': (char) => char >= 0x1800 && char <= 0x18AF,\n 'Unified Canadian Aboriginal Syllabics Extended': (char) => char >= 0x18B0 && char <= 0x18FF,\n // 'Limbu': (char) => char >= 0x1900 && char <= 0x194F,\n // 'Tai Le': (char) => char >= 0x1950 && char <= 0x197F,\n // 'New Tai Lue': (char) => char >= 0x1980 && char <= 0x19DF,\n // 'Khmer Symbols': (char) => char >= 0x19E0 && char <= 0x19FF,\n // 'Buginese': (char) => char >= 0x1A00 && char <= 0x1A1F,\n // 'Tai Tham': (char) => char >= 0x1A20 && char <= 0x1AAF,\n // 'Combining Diacritical Marks Extended': (char) => char >= 0x1AB0 && char <= 0x1AFF,\n // 'Balinese': (char) => char >= 0x1B00 && char <= 0x1B7F,\n // 'Sundanese': (char) => char >= 0x1B80 && char <= 0x1BBF,\n // 'Batak': (char) => char >= 0x1BC0 && char <= 0x1BFF,\n // 'Lepcha': (char) => char >= 0x1C00 && char <= 0x1C4F,\n // 'Ol Chiki': (char) => char >= 0x1C50 && char <= 0x1C7F,\n // 'Cyrillic Extended-C': (char) => char >= 0x1C80 && char <= 0x1C8F,\n // 'Sundanese Supplement': (char) => char >= 0x1CC0 && char <= 0x1CCF,\n // 'Vedic Extensions': (char) => char >= 0x1CD0 && char <= 0x1CFF,\n // 'Phonetic Extensions': (char) => char >= 0x1D00 && char <= 0x1D7F,\n // 'Phonetic Extensions Supplement': (char) => char >= 0x1D80 && char <= 0x1DBF,\n // 'Combining Diacritical Marks Supplement': (char) => char >= 0x1DC0 && char <= 0x1DFF,\n // 'Latin Extended Additional': (char) => char >= 0x1E00 && char <= 0x1EFF,\n // 'Greek Extended': (char) => char >= 0x1F00 && char <= 0x1FFF,\n 'General Punctuation': (char) => char >= 0x2000 && char <= 0x206F,\n // 'Superscripts and Subscripts': (char) => char >= 0x2070 && char <= 0x209F,\n // 'Currency Symbols': (char) => char >= 0x20A0 && char <= 0x20CF,\n // 'Combining Diacritical Marks for Symbols': (char) => char >= 0x20D0 && char <= 0x20FF,\n 'Letterlike Symbols': (char) => char >= 0x2100 && char <= 0x214F,\n 'Number Forms': (char) => char >= 0x2150 && char <= 0x218F,\n // 'Arrows': (char) => char >= 0x2190 && char <= 0x21FF,\n // 'Mathematical Operators': (char) => char >= 0x2200 && char <= 0x22FF,\n 'Miscellaneous Technical': (char) => char >= 0x2300 && char <= 0x23FF,\n 'Control Pictures': (char) => char >= 0x2400 && char <= 0x243F,\n 'Optical Character Recognition': (char) => char >= 0x2440 && char <= 0x245F,\n 'Enclosed Alphanumerics': (char) => char >= 0x2460 && char <= 0x24FF,\n // 'Box Drawing': (char) => char >= 0x2500 && char <= 0x257F,\n // 'Block Elements': (char) => char >= 0x2580 && char <= 0x259F,\n 'Geometric Shapes': (char) => char >= 0x25A0 && char <= 0x25FF,\n 'Miscellaneous Symbols': (char) => char >= 0x2600 && char <= 0x26FF,\n // 'Dingbats': (char) => char >= 0x2700 && char <= 0x27BF,\n // 'Miscellaneous Mathematical Symbols-A': (char) => char >= 0x27C0 && char <= 0x27EF,\n // 'Supplemental Arrows-A': (char) => char >= 0x27F0 && char <= 0x27FF,\n // 'Braille Patterns': (char) => char >= 0x2800 && char <= 0x28FF,\n // 'Supplemental Arrows-B': (char) => char >= 0x2900 && char <= 0x297F,\n // 'Miscellaneous Mathematical Symbols-B': (char) => char >= 0x2980 && char <= 0x29FF,\n // 'Supplemental Mathematical Operators': (char) => char >= 0x2A00 && char <= 0x2AFF,\n 'Miscellaneous Symbols and Arrows': (char) => char >= 0x2B00 && char <= 0x2BFF,\n // 'Glagolitic': (char) => char >= 0x2C00 && char <= 0x2C5F,\n // 'Latin Extended-C': (char) => char >= 0x2C60 && char <= 0x2C7F,\n // 'Coptic': (char) => char >= 0x2C80 && char <= 0x2CFF,\n // 'Georgian Supplement': (char) => char >= 0x2D00 && char <= 0x2D2F,\n // 'Tifinagh': (char) => char >= 0x2D30 && char <= 0x2D7F,\n // 'Ethiopic Extended': (char) => char >= 0x2D80 && char <= 0x2DDF,\n // 'Cyrillic Extended-A': (char) => char >= 0x2DE0 && char <= 0x2DFF,\n // 'Supplemental Punctuation': (char) => char >= 0x2E00 && char <= 0x2E7F,\n 'CJK Radicals Supplement': (char) => char >= 0x2E80 && char <= 0x2EFF,\n 'Kangxi Radicals': (char) => char >= 0x2F00 && char <= 0x2FDF,\n 'Ideographic Description Characters': (char) => char >= 0x2FF0 && char <= 0x2FFF,\n 'CJK Symbols and Punctuation': (char) => char >= 0x3000 && char <= 0x303F,\n 'Hiragana': (char) => char >= 0x3040 && char <= 0x309F,\n 'Katakana': (char) => char >= 0x30A0 && char <= 0x30FF,\n 'Bopomofo': (char) => char >= 0x3100 && char <= 0x312F,\n 'Hangul Compatibility Jamo': (char) => char >= 0x3130 && char <= 0x318F,\n 'Kanbun': (char) => char >= 0x3190 && char <= 0x319F,\n 'Bopomofo Extended': (char) => char >= 0x31A0 && char <= 0x31BF,\n 'CJK Strokes': (char) => char >= 0x31C0 && char <= 0x31EF,\n 'Katakana Phonetic Extensions': (char) => char >= 0x31F0 && char <= 0x31FF,\n 'Enclosed CJK Letters and Months': (char) => char >= 0x3200 && char <= 0x32FF,\n 'CJK Compatibility': (char) => char >= 0x3300 && char <= 0x33FF,\n 'CJK Unified Ideographs Extension A': (char) => char >= 0x3400 && char <= 0x4DBF,\n 'Yijing Hexagram Symbols': (char) => char >= 0x4DC0 && char <= 0x4DFF,\n 'CJK Unified Ideographs': (char) => char >= 0x4E00 && char <= 0x9FFF,\n 'Yi Syllables': (char) => char >= 0xA000 && char <= 0xA48F,\n 'Yi Radicals': (char) => char >= 0xA490 && char <= 0xA4CF,\n // 'Lisu': (char) => char >= 0xA4D0 && char <= 0xA4FF,\n // 'Vai': (char) => char >= 0xA500 && char <= 0xA63F,\n // 'Cyrillic Extended-B': (char) => char >= 0xA640 && char <= 0xA69F,\n // 'Bamum': (char) => char >= 0xA6A0 && char <= 0xA6FF,\n // 'Modifier Tone Letters': (char) => char >= 0xA700 && char <= 0xA71F,\n // 'Latin Extended-D': (char) => char >= 0xA720 && char <= 0xA7FF,\n // 'Syloti Nagri': (char) => char >= 0xA800 && char <= 0xA82F,\n // 'Common Indic Number Forms': (char) => char >= 0xA830 && char <= 0xA83F,\n // 'Phags-pa': (char) => char >= 0xA840 && char <= 0xA87F,\n // 'Saurashtra': (char) => char >= 0xA880 && char <= 0xA8DF,\n // 'Devanagari Extended': (char) => char >= 0xA8E0 && char <= 0xA8FF,\n // 'Kayah Li': (char) => char >= 0xA900 && char <= 0xA92F,\n // 'Rejang': (char) => char >= 0xA930 && char <= 0xA95F,\n 'Hangul Jamo Extended-A': (char) => char >= 0xA960 && char <= 0xA97F,\n // 'Javanese': (char) => char >= 0xA980 && char <= 0xA9DF,\n // 'Myanmar Extended-B': (char) => char >= 0xA9E0 && char <= 0xA9FF,\n // 'Cham': (char) => char >= 0xAA00 && char <= 0xAA5F,\n // 'Myanmar Extended-A': (char) => char >= 0xAA60 && char <= 0xAA7F,\n // 'Tai Viet': (char) => char >= 0xAA80 && char <= 0xAADF,\n // 'Meetei Mayek Extensions': (char) => char >= 0xAAE0 && char <= 0xAAFF,\n // 'Ethiopic Extended-A': (char) => char >= 0xAB00 && char <= 0xAB2F,\n // 'Latin Extended-E': (char) => char >= 0xAB30 && char <= 0xAB6F,\n // 'Cherokee Supplement': (char) => char >= 0xAB70 && char <= 0xABBF,\n // 'Meetei Mayek': (char) => char >= 0xABC0 && char <= 0xABFF,\n 'Hangul Syllables': (char) => char >= 0xAC00 && char <= 0xD7AF,\n 'Hangul Jamo Extended-B': (char) => char >= 0xD7B0 && char <= 0xD7FF,\n // 'High Surrogates': (char) => char >= 0xD800 && char <= 0xDB7F,\n // 'High Private Use Surrogates': (char) => char >= 0xDB80 && char <= 0xDBFF,\n // 'Low Surrogates': (char) => char >= 0xDC00 && char <= 0xDFFF,\n 'Private Use Area': (char) => char >= 0xE000 && char <= 0xF8FF,\n 'CJK Compatibility Ideographs': (char) => char >= 0xF900 && char <= 0xFAFF,\n // 'Alphabetic Presentation Forms': (char) => char >= 0xFB00 && char <= 0xFB4F,\n 'Arabic Presentation Forms-A': (char) => char >= 0xFB50 && char <= 0xFDFF,\n // 'Variation Selectors': (char) => char >= 0xFE00 && char <= 0xFE0F,\n 'Vertical Forms': (char) => char >= 0xFE10 && char <= 0xFE1F,\n // 'Combining Half Marks': (char) => char >= 0xFE20 && char <= 0xFE2F,\n 'CJK Compatibility Forms': (char) => char >= 0xFE30 && char <= 0xFE4F,\n 'Small Form Variants': (char) => char >= 0xFE50 && char <= 0xFE6F,\n 'Arabic Presentation Forms-B': (char) => char >= 0xFE70 && char <= 0xFEFF,\n 'Halfwidth and Fullwidth Forms': (char) => char >= 0xFF00 && char <= 0xFFEF\n // 'Specials': (char) => char >= 0xFFF0 && char <= 0xFFFF,\n // 'Linear B Syllabary': (char) => char >= 0x10000 && char <= 0x1007F,\n // 'Linear B Ideograms': (char) => char >= 0x10080 && char <= 0x100FF,\n // 'Aegean Numbers': (char) => char >= 0x10100 && char <= 0x1013F,\n // 'Ancient Greek Numbers': (char) => char >= 0x10140 && char <= 0x1018F,\n // 'Ancient Symbols': (char) => char >= 0x10190 && char <= 0x101CF,\n // 'Phaistos Disc': (char) => char >= 0x101D0 && char <= 0x101FF,\n // 'Lycian': (char) => char >= 0x10280 && char <= 0x1029F,\n // 'Carian': (char) => char >= 0x102A0 && char <= 0x102DF,\n // 'Coptic Epact Numbers': (char) => char >= 0x102E0 && char <= 0x102FF,\n // 'Old Italic': (char) => char >= 0x10300 && char <= 0x1032F,\n // 'Gothic': (char) => char >= 0x10330 && char <= 0x1034F,\n // 'Old Permic': (char) => char >= 0x10350 && char <= 0x1037F,\n // 'Ugaritic': (char) => char >= 0x10380 && char <= 0x1039F,\n // 'Old Persian': (char) => char >= 0x103A0 && char <= 0x103DF,\n // 'Deseret': (char) => char >= 0x10400 && char <= 0x1044F,\n // 'Shavian': (char) => char >= 0x10450 && char <= 0x1047F,\n // 'Osmanya': (char) => char >= 0x10480 && char <= 0x104AF,\n // 'Osage': (char) => char >= 0x104B0 && char <= 0x104FF,\n // 'Elbasan': (char) => char >= 0x10500 && char <= 0x1052F,\n // 'Caucasian Albanian': (char) => char >= 0x10530 && char <= 0x1056F,\n // 'Linear A': (char) => char >= 0x10600 && char <= 0x1077F,\n // 'Cypriot Syllabary': (char) => char >= 0x10800 && char <= 0x1083F,\n // 'Imperial Aramaic': (char) => char >= 0x10840 && char <= 0x1085F,\n // 'Palmyrene': (char) => char >= 0x10860 && char <= 0x1087F,\n // 'Nabataean': (char) => char >= 0x10880 && char <= 0x108AF,\n // 'Hatran': (char) => char >= 0x108E0 && char <= 0x108FF,\n // 'Phoenician': (char) => char >= 0x10900 && char <= 0x1091F,\n // 'Lydian': (char) => char >= 0x10920 && char <= 0x1093F,\n // 'Meroitic Hieroglyphs': (char) => char >= 0x10980 && char <= 0x1099F,\n // 'Meroitic Cursive': (char) => char >= 0x109A0 && char <= 0x109FF,\n // 'Kharoshthi': (char) => char >= 0x10A00 && char <= 0x10A5F,\n // 'Old South Arabian': (char) => char >= 0x10A60 && char <= 0x10A7F,\n // 'Old North Arabian': (char) => char >= 0x10A80 && char <= 0x10A9F,\n // 'Manichaean': (char) => char >= 0x10AC0 && char <= 0x10AFF,\n // 'Avestan': (char) => char >= 0x10B00 && char <= 0x10B3F,\n // 'Inscriptional Parthian': (char) => char >= 0x10B40 && char <= 0x10B5F,\n // 'Inscriptional Pahlavi': (char) => char >= 0x10B60 && char <= 0x10B7F,\n // 'Psalter Pahlavi': (char) => char >= 0x10B80 && char <= 0x10BAF,\n // 'Old Turkic': (char) => char >= 0x10C00 && char <= 0x10C4F,\n // 'Old Hungarian': (char) => char >= 0x10C80 && char <= 0x10CFF,\n // 'Rumi Numeral Symbols': (char) => char >= 0x10E60 && char <= 0x10E7F,\n // 'Brahmi': (char) => char >= 0x11000 && char <= 0x1107F,\n // 'Kaithi': (char) => char >= 0x11080 && char <= 0x110CF,\n // 'Sora Sompeng': (char) => char >= 0x110D0 && char <= 0x110FF,\n // 'Chakma': (char) => char >= 0x11100 && char <= 0x1114F,\n // 'Mahajani': (char) => char >= 0x11150 && char <= 0x1117F,\n // 'Sharada': (char) => char >= 0x11180 && char <= 0x111DF,\n // 'Sinhala Archaic Numbers': (char) => char >= 0x111E0 && char <= 0x111FF,\n // 'Khojki': (char) => char >= 0x11200 && char <= 0x1124F,\n // 'Multani': (char) => char >= 0x11280 && char <= 0x112AF,\n // 'Khudawadi': (char) => char >= 0x112B0 && char <= 0x112FF,\n // 'Grantha': (char) => char >= 0x11300 && char <= 0x1137F,\n // 'Newa': (char) => char >= 0x11400 && char <= 0x1147F,\n // 'Tirhuta': (char) => char >= 0x11480 && char <= 0x114DF,\n // 'Siddham': (char) => char >= 0x11580 && char <= 0x115FF,\n // 'Modi': (char) => char >= 0x11600 && char <= 0x1165F,\n // 'Mongolian Supplement': (char) => char >= 0x11660 && char <= 0x1167F,\n // 'Takri': (char) => char >= 0x11680 && char <= 0x116CF,\n // 'Ahom': (char) => char >= 0x11700 && char <= 0x1173F,\n // 'Warang Citi': (char) => char >= 0x118A0 && char <= 0x118FF,\n // 'Zanabazar Square': (char) => char >= 0x11A00 && char <= 0x11A4F,\n // 'Soyombo': (char) => char >= 0x11A50 && char <= 0x11AAF,\n // 'Pau Cin Hau': (char) => char >= 0x11AC0 && char <= 0x11AFF,\n // 'Bhaiksuki': (char) => char >= 0x11C00 && char <= 0x11C6F,\n // 'Marchen': (char) => char >= 0x11C70 && char <= 0x11CBF,\n // 'Masaram Gondi': (char) => char >= 0x11D00 && char <= 0x11D5F,\n // 'Cuneiform': (char) => char >= 0x12000 && char <= 0x123FF,\n // 'Cuneiform Numbers and Punctuation': (char) => char >= 0x12400 && char <= 0x1247F,\n // 'Early Dynastic Cuneiform': (char) => char >= 0x12480 && char <= 0x1254F,\n // 'Egyptian Hieroglyphs': (char) => char >= 0x13000 && char <= 0x1342F,\n // 'Anatolian Hieroglyphs': (char) => char >= 0x14400 && char <= 0x1467F,\n // 'Bamum Supplement': (char) => char >= 0x16800 && char <= 0x16A3F,\n // 'Mro': (char) => char >= 0x16A40 && char <= 0x16A6F,\n // 'Bassa Vah': (char) => char >= 0x16AD0 && char <= 0x16AFF,\n // 'Pahawh Hmong': (char) => char >= 0x16B00 && char <= 0x16B8F,\n // 'Miao': (char) => char >= 0x16F00 && char <= 0x16F9F,\n // 'Ideographic Symbols and Punctuation': (char) => char >= 0x16FE0 && char <= 0x16FFF,\n // 'Tangut': (char) => char >= 0x17000 && char <= 0x187FF,\n // 'Tangut Components': (char) => char >= 0x18800 && char <= 0x18AFF,\n // 'Kana Supplement': (char) => char >= 0x1B000 && char <= 0x1B0FF,\n // 'Kana Extended-A': (char) => char >= 0x1B100 && char <= 0x1B12F,\n // 'Nushu': (char) => char >= 0x1B170 && char <= 0x1B2FF,\n // 'Duployan': (char) => char >= 0x1BC00 && char <= 0x1BC9F,\n // 'Shorthand Format Controls': (char) => char >= 0x1BCA0 && char <= 0x1BCAF,\n // 'Byzantine Musical Symbols': (char) => char >= 0x1D000 && char <= 0x1D0FF,\n // 'Musical Symbols': (char) => char >= 0x1D100 && char <= 0x1D1FF,\n // 'Ancient Greek Musical Notation': (char) => char >= 0x1D200 && char <= 0x1D24F,\n // 'Tai Xuan Jing Symbols': (char) => char >= 0x1D300 && char <= 0x1D35F,\n // 'Counting Rod Numerals': (char) => char >= 0x1D360 && char <= 0x1D37F,\n // 'Mathematical Alphanumeric Symbols': (char) => char >= 0x1D400 && char <= 0x1D7FF,\n // 'Sutton SignWriting': (char) => char >= 0x1D800 && char <= 0x1DAAF,\n // 'Glagolitic Supplement': (char) => char >= 0x1E000 && char <= 0x1E02F,\n // 'Mende Kikakui': (char) => char >= 0x1E800 && char <= 0x1E8DF,\n // 'Adlam': (char) => char >= 0x1E900 && char <= 0x1E95F,\n // 'Arabic Mathematical Alphabetic Symbols': (char) => char >= 0x1EE00 && char <= 0x1EEFF,\n // 'Mahjong Tiles': (char) => char >= 0x1F000 && char <= 0x1F02F,\n // 'Domino Tiles': (char) => char >= 0x1F030 && char <= 0x1F09F,\n // 'Playing Cards': (char) => char >= 0x1F0A0 && char <= 0x1F0FF,\n // 'Enclosed Alphanumeric Supplement': (char) => char >= 0x1F100 && char <= 0x1F1FF,\n // 'Enclosed Ideographic Supplement': (char) => char >= 0x1F200 && char <= 0x1F2FF,\n // 'Miscellaneous Symbols and Pictographs': (char) => char >= 0x1F300 && char <= 0x1F5FF,\n // 'Emoticons': (char) => char >= 0x1F600 && char <= 0x1F64F,\n // 'Ornamental Dingbats': (char) => char >= 0x1F650 && char <= 0x1F67F,\n // 'Transport and Map Symbols': (char) => char >= 0x1F680 && char <= 0x1F6FF,\n // 'Alchemical Symbols': (char) => char >= 0x1F700 && char <= 0x1F77F,\n // 'Geometric Shapes Extended': (char) => char >= 0x1F780 && char <= 0x1F7FF,\n // 'Supplemental Arrows-C': (char) => char >= 0x1F800 && char <= 0x1F8FF,\n // 'Supplemental Symbols and Pictographs': (char) => char >= 0x1F900 && char <= 0x1F9FF,\n // 'CJK Unified Ideographs Extension B': (char) => char >= 0x20000 && char <= 0x2A6DF,\n // 'CJK Unified Ideographs Extension C': (char) => char >= 0x2A700 && char <= 0x2B73F,\n // 'CJK Unified Ideographs Extension D': (char) => char >= 0x2B740 && char <= 0x2B81F,\n // 'CJK Unified Ideographs Extension E': (char) => char >= 0x2B820 && char <= 0x2CEAF,\n // 'CJK Unified Ideographs Extension F': (char) => char >= 0x2CEB0 && char <= 0x2EBEF,\n // 'CJK Compatibility Ideographs Supplement': (char) => char >= 0x2F800 && char <= 0x2FA1F,\n // 'Tags': (char) => char >= 0xE0000 && char <= 0xE007F,\n // 'Variation Selectors Supplement': (char) => char >= 0xE0100 && char <= 0xE01EF,\n // 'Supplementary Private Use Area-A': (char) => char >= 0xF0000 && char <= 0xFFFFF,\n // 'Supplementary Private Use Area-B': (char) => char >= 0x100000 && char <= 0x10FFFF,\n};\n\nexport default unicodeBlockLookup;\n","// @flow\n\n/* eslint-disable new-cap */\n\nimport isChar from './is_char_in_unicode_block';\n\nexport function allowsIdeographicBreaking(chars: string) {\n for (const char of chars) {\n if (!charAllowsIdeographicBreaking(char.charCodeAt(0))) return false;\n }\n return true;\n}\n\nexport function allowsVerticalWritingMode(chars: string) {\n for (const char of chars) {\n if (charHasUprightVerticalOrientation(char.charCodeAt(0))) return true;\n }\n return false;\n}\n\nexport function allowsLetterSpacing(chars: string) {\n for (const char of chars) {\n if (!charAllowsLetterSpacing(char.charCodeAt(0))) return false;\n }\n return true;\n}\n\nexport function charAllowsLetterSpacing(char: number) {\n if (isChar['Arabic'](char)) return false;\n if (isChar['Arabic Supplement'](char)) return false;\n if (isChar['Arabic Extended-A'](char)) return false;\n if (isChar['Arabic Presentation Forms-A'](char)) return false;\n if (isChar['Arabic Presentation Forms-B'](char)) return false;\n\n return true;\n}\n\nexport function charAllowsIdeographicBreaking(char: number) {\n // Return early for characters outside all ideographic ranges.\n if (char < 0x2E80) return false;\n\n if (isChar['Bopomofo Extended'](char)) return true;\n if (isChar['Bopomofo'](char)) return true;\n if (isChar['CJK Compatibility Forms'](char)) return true;\n if (isChar['CJK Compatibility Ideographs'](char)) return true;\n if (isChar['CJK Compatibility'](char)) return true;\n if (isChar['CJK Radicals Supplement'](char)) return true;\n if (isChar['CJK Strokes'](char)) return true;\n if (isChar['CJK Symbols and Punctuation'](char)) return true;\n if (isChar['CJK Unified Ideographs Extension A'](char)) return true;\n if (isChar['CJK Unified Ideographs'](char)) return true;\n if (isChar['Enclosed CJK Letters and Months'](char)) return true;\n if (isChar['Halfwidth and Fullwidth Forms'](char)) return true;\n if (isChar['Hiragana'](char)) return true;\n if (isChar['Ideographic Description Characters'](char)) return true;\n if (isChar['Kangxi Radicals'](char)) return true;\n if (isChar['Katakana Phonetic Extensions'](char)) return true;\n if (isChar['Katakana'](char)) return true;\n if (isChar['Vertical Forms'](char)) return true;\n if (isChar['Yi Radicals'](char)) return true;\n if (isChar['Yi Syllables'](char)) return true;\n\n return false;\n}\n\n// The following logic comes from\n// .\n// The data file denotes with “U” or “Tu” any codepoint that may be drawn\n// upright in vertical text but does not distinguish between upright and\n// “neutral” characters.\n\n// Blocks in the Unicode supplementary planes are excluded from this module due\n// to .\n\n/**\n * Returns true if the given Unicode codepoint identifies a character with\n * upright orientation.\n *\n * A character has upright orientation if it is drawn upright (unrotated)\n * whether the line is oriented horizontally or vertically, even if both\n * adjacent characters can be rotated. For example, a Chinese character is\n * always drawn upright. An uprightly oriented character causes an adjacent\n * “neutral” character to be drawn upright as well.\n * @private\n */\nexport function charHasUprightVerticalOrientation(char: number) {\n if (char === 0x02EA /* modifier letter yin departing tone mark */ ||\n char === 0x02EB /* modifier letter yang departing tone mark */) {\n return true;\n }\n\n // Return early for characters outside all ranges whose characters remain\n // upright in vertical writing mode.\n if (char < 0x1100) return false;\n\n if (isChar['Bopomofo Extended'](char)) return true;\n if (isChar['Bopomofo'](char)) return true;\n if (isChar['CJK Compatibility Forms'](char)) {\n if (!((char >= 0xFE49 /* dashed overline */ && char <= 0xFE4F) /* wavy low line */)) {\n return true;\n }\n }\n if (isChar['CJK Compatibility Ideographs'](char)) return true;\n if (isChar['CJK Compatibility'](char)) return true;\n if (isChar['CJK Radicals Supplement'](char)) return true;\n if (isChar['CJK Strokes'](char)) return true;\n if (isChar['CJK Symbols and Punctuation'](char)) {\n if (!((char >= 0x3008 /* left angle bracket */ && char <= 0x3011) /* right black lenticular bracket */) &&\n !((char >= 0x3014 /* left tortoise shell bracket */ && char <= 0x301F) /* low double prime quotation mark */) &&\n char !== 0x3030 /* wavy dash */) {\n return true;\n }\n }\n if (isChar['CJK Unified Ideographs Extension A'](char)) return true;\n if (isChar['CJK Unified Ideographs'](char)) return true;\n if (isChar['Enclosed CJK Letters and Months'](char)) return true;\n if (isChar['Hangul Compatibility Jamo'](char)) return true;\n if (isChar['Hangul Jamo Extended-A'](char)) return true;\n if (isChar['Hangul Jamo Extended-B'](char)) return true;\n if (isChar['Hangul Jamo'](char)) return true;\n if (isChar['Hangul Syllables'](char)) return true;\n if (isChar['Hiragana'](char)) return true;\n if (isChar['Ideographic Description Characters'](char)) return true;\n if (isChar['Kanbun'](char)) return true;\n if (isChar['Kangxi Radicals'](char)) return true;\n if (isChar['Katakana Phonetic Extensions'](char)) return true;\n if (isChar['Katakana'](char)) {\n if (char !== 0x30FC /* katakana-hiragana prolonged sound mark */) {\n return true;\n }\n }\n if (isChar['Halfwidth and Fullwidth Forms'](char)) {\n if (char !== 0xFF08 /* fullwidth left parenthesis */ &&\n char !== 0xFF09 /* fullwidth right parenthesis */ &&\n char !== 0xFF0D /* fullwidth hyphen-minus */ &&\n !((char >= 0xFF1A /* fullwidth colon */ && char <= 0xFF1E) /* fullwidth greater-than sign */) &&\n char !== 0xFF3B /* fullwidth left square bracket */ &&\n char !== 0xFF3D /* fullwidth right square bracket */ &&\n char !== 0xFF3F /* fullwidth low line */ &&\n !(char >= 0xFF5B /* fullwidth left curly bracket */ && char <= 0xFFDF) &&\n char !== 0xFFE3 /* fullwidth macron */ &&\n !(char >= 0xFFE8 /* halfwidth forms light vertical */ && char <= 0xFFEF)) {\n return true;\n }\n }\n if (isChar['Small Form Variants'](char)) {\n if (!((char >= 0xFE58 /* small em dash */ && char <= 0xFE5E) /* small right tortoise shell bracket */) &&\n !((char >= 0xFE63 /* small hyphen-minus */ && char <= 0xFE66) /* small equals sign */)) {\n return true;\n }\n }\n if (isChar['Unified Canadian Aboriginal Syllabics'](char)) return true;\n if (isChar['Unified Canadian Aboriginal Syllabics Extended'](char)) return true;\n if (isChar['Vertical Forms'](char)) return true;\n if (isChar['Yijing Hexagram Symbols'](char)) return true;\n if (isChar['Yi Syllables'](char)) return true;\n if (isChar['Yi Radicals'](char)) return true;\n\n return false;\n}\n\n/**\n * Returns true if the given Unicode codepoint identifies a character with\n * neutral orientation.\n *\n * A character has neutral orientation if it may be drawn rotated or unrotated\n * when the line is oriented vertically, depending on the orientation of the\n * adjacent characters. For example, along a verticlly oriented line, the vulgar\n * fraction ½ is drawn upright among Chinese characters but rotated among Latin\n * letters. A neutrally oriented character does not influence whether an\n * adjacent character is drawn upright or rotated.\n * @private\n */\nexport function charHasNeutralVerticalOrientation(char: number) {\n if (isChar['Latin-1 Supplement'](char)) {\n if (char === 0x00A7 /* section sign */ ||\n char === 0x00A9 /* copyright sign */ ||\n char === 0x00AE /* registered sign */ ||\n char === 0x00B1 /* plus-minus sign */ ||\n char === 0x00BC /* vulgar fraction one quarter */ ||\n char === 0x00BD /* vulgar fraction one half */ ||\n char === 0x00BE /* vulgar fraction three quarters */ ||\n char === 0x00D7 /* multiplication sign */ ||\n char === 0x00F7 /* division sign */) {\n return true;\n }\n }\n if (isChar['General Punctuation'](char)) {\n if (char === 0x2016 /* double vertical line */ ||\n char === 0x2020 /* dagger */ ||\n char === 0x2021 /* double dagger */ ||\n char === 0x2030 /* per mille sign */ ||\n char === 0x2031 /* per ten thousand sign */ ||\n char === 0x203B /* reference mark */ ||\n char === 0x203C /* double exclamation mark */ ||\n char === 0x2042 /* asterism */ ||\n char === 0x2047 /* double question mark */ ||\n char === 0x2048 /* question exclamation mark */ ||\n char === 0x2049 /* exclamation question mark */ ||\n char === 0x2051 /* two asterisks aligned vertically */) {\n return true;\n }\n }\n if (isChar['Letterlike Symbols'](char)) return true;\n if (isChar['Number Forms'](char)) return true;\n if (isChar['Miscellaneous Technical'](char)) {\n if ((char >= 0x2300 /* diameter sign */ && char <= 0x2307 /* wavy line */) ||\n (char >= 0x230C /* bottom right crop */ && char <= 0x231F /* bottom right corner */) ||\n (char >= 0x2324 /* up arrowhead between two horizontal bars */ && char <= 0x2328 /* keyboard */) ||\n char === 0x232B /* erase to the left */ ||\n (char >= 0x237D /* shouldered open box */ && char <= 0x239A /* clear screen symbol */) ||\n (char >= 0x23BE /* dentistry symbol light vertical and top right */ && char <= 0x23CD /* square foot */) ||\n char === 0x23CF /* eject symbol */ ||\n (char >= 0x23D1 /* metrical breve */ && char <= 0x23DB /* fuse */) ||\n (char >= 0x23E2 /* white trapezium */ && char <= 0x23FF)) {\n return true;\n }\n }\n if (isChar['Control Pictures'](char) && char !== 0x2423 /* open box */) return true;\n if (isChar['Optical Character Recognition'](char)) return true;\n if (isChar['Enclosed Alphanumerics'](char)) return true;\n if (isChar['Geometric Shapes'](char)) return true;\n if (isChar['Miscellaneous Symbols'](char)) {\n if (!((char >= 0x261A /* black left pointing index */ && char <= 0x261F) /* white down pointing index */)) {\n return true;\n }\n }\n if (isChar['Miscellaneous Symbols and Arrows'](char)) {\n if ((char >= 0x2B12 /* square with top half black */ && char <= 0x2B2F /* white vertical ellipse */) ||\n (char >= 0x2B50 /* white medium star */ && char <= 0x2B59 /* heavy circled saltire */) ||\n (char >= 0x2BB8 /* upwards white arrow from bar with horizontal bar */ && char <= 0x2BEB)) {\n return true;\n }\n }\n if (isChar['CJK Symbols and Punctuation'](char)) return true;\n if (isChar['Katakana'](char)) return true;\n if (isChar['Private Use Area'](char)) return true;\n if (isChar['CJK Compatibility Forms'](char)) return true;\n if (isChar['Small Form Variants'](char)) return true;\n if (isChar['Halfwidth and Fullwidth Forms'](char)) return true;\n\n if (char === 0x221E /* infinity */ ||\n char === 0x2234 /* therefore */ ||\n char === 0x2235 /* because */ ||\n (char >= 0x2700 /* black safety scissors */ && char <= 0x2767 /* rotated floral heart bullet */) ||\n (char >= 0x2776 /* dingbat negative circled digit one */ && char <= 0x2793 /* dingbat negative circled sans-serif number ten */) ||\n char === 0xFFFC /* object replacement character */ ||\n char === 0xFFFD /* replacement character */) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Returns true if the given Unicode codepoint identifies a character with\n * rotated orientation.\n *\n * A character has rotated orientation if it is drawn rotated when the line is\n * oriented vertically, even if both adjacent characters are upright. For\n * example, a Latin letter is drawn rotated along a vertical line. A rotated\n * character causes an adjacent “neutral” character to be drawn rotated as well.\n * @private\n */\nexport function charHasRotatedVerticalOrientation(char: number) {\n return !(charHasUprightVerticalOrientation(char) ||\n charHasNeutralVerticalOrientation(char));\n}\n\nexport function charInSupportedScript(char: number, canRenderRTL: boolean) {\n // This is a rough heuristic: whether we \"can render\" a script\n // actually depends on the properties of the font being used\n // and whether differences from the ideal rendering are considered\n // semantically significant.\n\n // Even in Latin script, we \"can't render\" combinations such as the fi\n // ligature, but we don't consider that semantically significant.\n if (!canRenderRTL &&\n ((char >= 0x0590 && char <= 0x08FF) ||\n isChar['Arabic Presentation Forms-A'](char) ||\n isChar['Arabic Presentation Forms-B'](char))) {\n // Main blocks for Hebrew, Arabic, Thaana and other RTL scripts\n return false;\n }\n if ((char >= 0x0900 && char <= 0x0DFF) ||\n // Main blocks for Indic scripts and Sinhala\n (char >= 0x0F00 && char <= 0x109F) ||\n // Main blocks for Tibetan and Myanmar\n isChar['Khmer'](char)) {\n // These blocks cover common scripts that require\n // complex text shaping, based on unicode script metadata:\n // http://www.unicode.org/repos/cldr/trunk/common/properties/scriptMetadata.txt\n // where \"Web Rank <= 32\" \"Shaping Required = YES\"\n return false;\n }\n return true;\n}\n\nexport function isStringInSupportedScript(chars: string, canRenderRTL: boolean) {\n for (const char of chars) {\n if (!charInSupportedScript(char.charCodeAt(0), canRenderRTL)) {\n return false;\n }\n }\n return true;\n}\n","// @flow\n\nimport { Event, Evented } from '../util/evented';\n\nlet pluginRequested = false;\nlet pluginURL = null;\nlet foregroundLoadComplete = false;\n\nexport const evented = new Evented();\n\ntype CompletionCallback = (error?: Error) => void;\ntype ErrorCallback = (error: Error) => void;\n\nlet _completionCallback;\n\nexport const registerForPluginAvailability = function(\n callback: (args: {pluginURL: string, completionCallback: CompletionCallback}) => void\n) {\n if (pluginURL) {\n callback({ pluginURL: pluginURL, completionCallback: _completionCallback});\n } else {\n evented.once('pluginAvailable', callback);\n }\n return callback;\n};\n\nexport const clearRTLTextPlugin = function() {\n pluginRequested = false;\n pluginURL = null;\n};\n\nexport const setRTLTextPlugin = function(url: string, callback: ErrorCallback) {\n if (pluginRequested) {\n throw new Error('setRTLTextPlugin cannot be called multiple times.');\n }\n pluginRequested = true;\n pluginURL = url;\n _completionCallback = (error?: Error) => {\n if (error) {\n // Clear loaded state to allow retries\n clearRTLTextPlugin();\n if (callback) {\n callback(error);\n }\n } else {\n // Called once for each worker\n foregroundLoadComplete = true;\n }\n };\n evented.fire(new Event('pluginAvailable', { pluginURL: pluginURL, completionCallback: _completionCallback }));\n};\n\nexport const plugin: {\n applyArabicShaping: ?Function,\n processBidirectionalText: ?(string, Array) => Array,\n isLoaded: () => boolean\n} = {\n applyArabicShaping: null,\n processBidirectionalText: null,\n isLoaded: function() {\n return foregroundLoadComplete || // Foreground: loaded if the completion callback returned successfully\n plugin.applyArabicShaping != null; // Background: loaded if the plugin functions have been compiled\n }\n};\n","// @flow\n\nimport ZoomHistory from './zoom_history';\nimport {isStringInSupportedScript} from '../util/script_detection';\nimport {plugin as rtlTextPlugin} from '../source/rtl_text_plugin';\n\nclass EvaluationParameters {\n zoom: number;\n now: number;\n fadeDuration: number;\n zoomHistory: ZoomHistory;\n transition: TransitionSpecification;\n\n // \"options\" may also be another EvaluationParameters to copy, see CrossFadedProperty.possiblyEvaluate\n constructor(zoom: number, options?: *) {\n this.zoom = zoom;\n\n if (options) {\n this.now = options.now;\n this.fadeDuration = options.fadeDuration;\n this.zoomHistory = options.zoomHistory;\n this.transition = options.transition;\n } else {\n this.now = 0;\n this.fadeDuration = 0;\n this.zoomHistory = new ZoomHistory();\n this.transition = {};\n }\n }\n\n isSupportedScript(str: string): boolean {\n return isStringInSupportedScript(str, rtlTextPlugin.isLoaded());\n }\n\n crossFadingFactor() {\n if (this.fadeDuration === 0) {\n return 1;\n } else {\n return Math.min((this.now - this.zoomHistory.lastIntegerZoomTime) / this.fadeDuration, 1);\n }\n }\n}\n\nexport default EvaluationParameters;\n","// @flow\n\nimport assert from 'assert';\n\nimport { clone, extend, easeCubicInOut } from '../util/util';\nimport * as interpolate from '../style-spec/util/interpolate';\nimport { normalizePropertyExpression } from '../style-spec/expression';\nimport Color from '../style-spec/util/color';\nimport { register } from '../util/web_worker_transfer';\nimport EvaluationParameters from './evaluation_parameters';\n\nimport type {StylePropertySpecification} from '../style-spec/style-spec';\nimport type {CrossFaded} from './cross_faded';\n\nimport type {\n Feature,\n GlobalProperties,\n StylePropertyExpression,\n SourceExpression,\n CompositeExpression\n} from '../style-spec/expression';\n\ntype TimePoint = number;\n\n/**\n * Implements a number of classes that define state and behavior for paint and layout properties, most\n * importantly their respective evaluation chains:\n *\n * Transitionable paint property value\n * → Transitioning paint property value\n * → Possibly evaluated paint property value\n * → Fully evaluated paint property value\n *\n * Layout property value\n * → Possibly evaluated layout property value\n * → Fully evaluated layout property value\n *\n * @module\n * @private\n */\n\n/**\n * Implementations of the `Property` interface:\n *\n * * Hold metadata about a property that's independent of any specific value: stuff like the type of the value,\n * the default value, etc. This comes from the style specification JSON.\n * * Define behavior that needs to be polymorphic across different properties: \"possibly evaluating\"\n * an input value (see below), and interpolating between two possibly-evaluted values.\n *\n * The type `T` is the fully-evaluated value type (e.g. `number`, `string`, `Color`).\n * The type `R` is the intermediate \"possibly evaluated\" value type. See below.\n *\n * There are two main implementations of the interface -- one for properties that allow data-driven values,\n * and one for properties that don't. There are a few \"special case\" implementations as well: one for properties\n * which cross-fade between two values rather than interpolating, one for `heatmap-color` and `line-gradient`,\n * and one for `light-position`.\n *\n * @private\n */\nexport interface Property {\n specification: StylePropertySpecification;\n possiblyEvaluate(value: PropertyValue, parameters: EvaluationParameters): R;\n interpolate(a: R, b: R, t: number): R;\n}\n\n/**\n * `PropertyValue` represents the value part of a property key-value unit. It's used to represent both\n * paint and layout property values, and regardless of whether or not their property supports data-driven\n * expressions.\n *\n * `PropertyValue` stores the raw input value as seen in a style or a runtime styling API call, i.e. one of the\n * following:\n *\n * * A constant value of the type appropriate for the property\n * * A function which produces a value of that type (but functions are quasi-deprecated in favor of expressions)\n * * An expression which produces a value of that type\n * * \"undefined\"/\"not present\", in which case the property is assumed to take on its default value.\n *\n * In addition to storing the original input value, `PropertyValue` also stores a normalized representation,\n * effectively treating functions as if they are expressions, and constant or default values as if they are\n * (constant) expressions.\n *\n * @private\n */\nexport class PropertyValue {\n property: Property;\n value: PropertyValueSpecification | void;\n expression: StylePropertyExpression;\n\n constructor(property: Property, value: PropertyValueSpecification | void) {\n this.property = property;\n this.value = value;\n this.expression = normalizePropertyExpression(value === undefined ? property.specification.default : value, property.specification);\n }\n\n isDataDriven(): boolean {\n return this.expression.kind === 'source' || this.expression.kind === 'composite';\n }\n\n possiblyEvaluate(parameters: EvaluationParameters): R {\n return this.property.possiblyEvaluate(this, parameters);\n }\n}\n\n// ------- Transitionable -------\n\nexport type TransitionParameters = {\n now: TimePoint,\n transition: TransitionSpecification\n};\n\n/**\n * Paint properties are _transitionable_: they can change in a fluid manner, interpolating or cross-fading between\n * old and new value. The duration of the transition, and the delay before it begins, is configurable.\n *\n * `TransitionablePropertyValue` is a compositional class that stores both the property value and that transition\n * configuration.\n *\n * A `TransitionablePropertyValue` can calculate the next step in the evaluation chain for paint property values:\n * `TransitioningPropertyValue`.\n *\n * @private\n */\nclass TransitionablePropertyValue {\n property: Property;\n value: PropertyValue;\n transition: TransitionSpecification | void;\n\n constructor(property: Property) {\n this.property = property;\n this.value = new PropertyValue(property, undefined);\n }\n\n transitioned(parameters: TransitionParameters,\n prior: TransitioningPropertyValue): TransitioningPropertyValue {\n return new TransitioningPropertyValue(this.property, this.value, prior, // eslint-disable-line no-use-before-define\n extend({}, parameters.transition, this.transition), parameters.now);\n }\n\n untransitioned(): TransitioningPropertyValue {\n return new TransitioningPropertyValue(this.property, this.value, null, {}, 0); // eslint-disable-line no-use-before-define\n }\n}\n\n/**\n * A helper type: given an object type `Properties` whose values are each of type `Property`, it calculates\n * an object type with the same keys and values of type `TransitionablePropertyValue`.\n *\n * @private\n */\ntype TransitionablePropertyValues\n = $Exact<$ObjMap(p: Property) => TransitionablePropertyValue>>\n\n/**\n * `Transitionable` stores a map of all (property name, `TransitionablePropertyValue`) pairs for paint properties of a\n * given layer type. It can calculate the `TransitioningPropertyValue`s for all of them at once, producing a\n * `Transitioning` instance for the same set of properties.\n *\n * @private\n */\nexport class Transitionable {\n _properties: Properties;\n _values: TransitionablePropertyValues;\n\n constructor(properties: Properties) {\n this._properties = properties;\n this._values = (Object.create(properties.defaultTransitionablePropertyValues): any);\n }\n\n getValue(name: S): PropertyValueSpecification | void {\n return clone(this._values[name].value.value);\n }\n\n setValue(name: S, value: PropertyValueSpecification | void) {\n if (!this._values.hasOwnProperty(name)) {\n this._values[name] = new TransitionablePropertyValue(this._values[name].property);\n }\n // Note that we do not _remove_ an own property in the case where a value is being reset\n // to the default: the transition might still be non-default.\n this._values[name].value = new PropertyValue(this._values[name].property, value === null ? undefined : clone(value));\n }\n\n getTransition(name: S): TransitionSpecification | void {\n return clone(this._values[name].transition);\n }\n\n setTransition(name: S, value: TransitionSpecification | void) {\n if (!this._values.hasOwnProperty(name)) {\n this._values[name] = new TransitionablePropertyValue(this._values[name].property);\n }\n this._values[name].transition = clone(value) || undefined;\n }\n\n serialize() {\n const result: any = {};\n for (const property of Object.keys(this._values)) {\n const value = this.getValue(property);\n if (value !== undefined) {\n result[property] = value;\n }\n\n const transition = this.getTransition(property);\n if (transition !== undefined) {\n result[`${property}-transition`] = transition;\n }\n }\n return result;\n }\n\n transitioned(parameters: TransitionParameters, prior: Transitioning): Transitioning {\n const result = new Transitioning(this._properties); // eslint-disable-line no-use-before-define\n for (const property of Object.keys(this._values)) {\n result._values[property] = this._values[property].transitioned(parameters, prior._values[property]);\n }\n return result;\n }\n\n untransitioned(): Transitioning {\n const result = new Transitioning(this._properties); // eslint-disable-line no-use-before-define\n for (const property of Object.keys(this._values)) {\n result._values[property] = this._values[property].untransitioned();\n }\n return result;\n }\n}\n\n// ------- Transitioning -------\n\n/**\n * `TransitioningPropertyValue` implements the first of two intermediate steps in the evaluation chain of a paint\n * property value. In this step, transitions between old and new values are handled: as long as the transition is in\n * progress, `TransitioningPropertyValue` maintains a reference to the prior value, and interpolates between it and\n * the new value based on the current time and the configured transition duration and delay. The product is the next\n * step in the evaluation chain: the \"possibly evaluated\" result type `R`. See below for more on this concept.\n *\n * @private\n */\nclass TransitioningPropertyValue {\n property: Property;\n value: PropertyValue;\n prior: ?TransitioningPropertyValue;\n begin: TimePoint;\n end: TimePoint;\n\n constructor(property: Property,\n value: PropertyValue,\n prior: ?TransitioningPropertyValue,\n transition: TransitionSpecification,\n now: TimePoint) {\n this.property = property;\n this.value = value;\n this.begin = now + transition.delay || 0;\n this.end = this.begin + transition.duration || 0;\n if (property.specification.transition && (transition.delay || transition.duration)) {\n this.prior = prior;\n }\n }\n\n possiblyEvaluate(parameters: EvaluationParameters): R {\n const now = parameters.now || 0;\n const finalValue = this.value.possiblyEvaluate(parameters);\n const prior = this.prior;\n if (!prior) {\n // No prior value.\n return finalValue;\n } else if (now > this.end) {\n // Transition from prior value is now complete.\n this.prior = null;\n return finalValue;\n } else if (this.value.isDataDriven()) {\n // Transitions to data-driven properties are not supported.\n // We snap immediately to the data-driven value so that, when we perform layout,\n // we see the data-driven function and can use it to populate vertex buffers.\n this.prior = null;\n return finalValue;\n } else if (now < this.begin) {\n // Transition hasn't started yet.\n return prior.possiblyEvaluate(parameters);\n } else {\n // Interpolate between recursively-calculated prior value and final.\n const t = (now - this.begin) / (this.end - this.begin);\n return this.property.interpolate(prior.possiblyEvaluate(parameters), finalValue, easeCubicInOut(t));\n }\n }\n}\n\n/**\n * A helper type: given an object type `Properties` whose values are each of type `Property`, it calculates\n * an object type with the same keys and values of type `TransitioningPropertyValue`.\n *\n * @private\n */\ntype TransitioningPropertyValues\n = $Exact<$ObjMap(p: Property) => TransitioningPropertyValue>>\n\n/**\n * `Transitioning` stores a map of all (property name, `TransitioningPropertyValue`) pairs for paint properties of a\n * given layer type. It can calculate the possibly-evaluated values for all of them at once, producing a\n * `PossiblyEvaluated` instance for the same set of properties.\n *\n * @private\n */\nexport class Transitioning {\n _properties: Properties;\n _values: TransitioningPropertyValues;\n\n constructor(properties: Properties) {\n this._properties = properties;\n this._values = (Object.create(properties.defaultTransitioningPropertyValues): any);\n }\n\n possiblyEvaluate(parameters: EvaluationParameters): PossiblyEvaluated {\n const result = new PossiblyEvaluated(this._properties); // eslint-disable-line no-use-before-define\n for (const property of Object.keys(this._values)) {\n result._values[property] = this._values[property].possiblyEvaluate(parameters);\n }\n return result;\n }\n\n hasTransition() {\n for (const property of Object.keys(this._values)) {\n if (this._values[property].prior) {\n return true;\n }\n }\n return false;\n }\n}\n\n// ------- Layout -------\n\n/**\n * A helper type: given an object type `Properties` whose values are each of type `Property`, it calculates\n * an object type with the same keys and values of type `PropertyValue`.\n *\n * @private\n */\ntype PropertyValues\n = $Exact<$ObjMap(p: Property) => PropertyValue>>\n\n/**\n * Because layout properties are not transitionable, they have a simpler representation and evaluation chain than\n * paint properties: `PropertyValue`s are possibly evaluated, producing possibly evaluated values, which are then\n * fully evaluated.\n *\n * `Layout` stores a map of all (property name, `PropertyValue`) pairs for layout properties of a\n * given layer type. It can calculate the possibly-evaluated values for all of them at once, producing a\n * `PossiblyEvaluated` instance for the same set of properties.\n *\n * @private\n */\nexport class Layout {\n _properties: Properties;\n _values: PropertyValues;\n\n constructor(properties: Properties) {\n this._properties = properties;\n this._values = (Object.create(properties.defaultPropertyValues): any);\n }\n\n getValue(name: S) {\n return clone(this._values[name].value);\n }\n\n setValue(name: S, value: *) {\n this._values[name] = new PropertyValue(this._values[name].property, value === null ? undefined : clone(value));\n }\n\n serialize() {\n const result: any = {};\n for (const property of Object.keys(this._values)) {\n const value = this.getValue(property);\n if (value !== undefined) {\n result[property] = value;\n }\n }\n return result;\n }\n\n possiblyEvaluate(parameters: EvaluationParameters): PossiblyEvaluated {\n const result = new PossiblyEvaluated(this._properties); // eslint-disable-line no-use-before-define\n for (const property of Object.keys(this._values)) {\n result._values[property] = this._values[property].possiblyEvaluate(parameters);\n }\n return result;\n }\n}\n\n// ------- PossiblyEvaluated -------\n\n/**\n * \"Possibly evaluated value\" is an intermediate stage in the evaluation chain for both paint and layout property\n * values. The purpose of this stage is to optimize away unnecessary recalculations for data-driven properties. Code\n * which uses data-driven property values must assume that the value is dependent on feature data, and request that it\n * be evaluated for each feature. But when that property value is in fact a constant or camera function, the calculation\n * will not actually depend on the feature, and we can benefit from returning the prior result of having done the\n * evaluation once, ahead of time, in an intermediate step whose inputs are just the value and \"global\" parameters\n * such as current zoom level.\n *\n * `PossiblyEvaluatedValue` represents the three possible outcomes of this step: if the input value was a constant or\n * camera expression, then the \"possibly evaluated\" result is a constant value. Otherwise, the input value was either\n * a source or composite expression, and we must defer final evaluation until supplied a feature. We separate\n * the source and composite cases because they are handled differently when generating GL attributes, buffers, and\n * uniforms.\n *\n * Note that `PossiblyEvaluatedValue` (and `PossiblyEvaluatedPropertyValue`, below) are _not_ used for properties that\n * do not allow data-driven values. For such properties, we know that the \"possibly evaluated\" result is always a constant\n * scalar value. See below.\n *\n * @private\n */\ntype PossiblyEvaluatedValue =\n | {kind: 'constant', value: T}\n | SourceExpression\n | CompositeExpression;\n\n/**\n * `PossiblyEvaluatedPropertyValue` is used for data-driven paint and layout property values. It holds a\n * `PossiblyEvaluatedValue` and the `GlobalProperties` that were used to generate it. You're not allowed to supply\n * a different set of `GlobalProperties` when performing the final evaluation because they would be ignored in the\n * case where the input value was a constant or camera function.\n *\n * @private\n */\nexport class PossiblyEvaluatedPropertyValue {\n property: DataDrivenProperty;\n value: PossiblyEvaluatedValue;\n globals: GlobalProperties;\n\n constructor(property: DataDrivenProperty, value: PossiblyEvaluatedValue, globals: GlobalProperties) {\n this.property = property;\n this.value = value;\n this.globals = globals;\n }\n\n isConstant(): boolean {\n return this.value.kind === 'constant';\n }\n\n constantOr(value: T): T {\n if (this.value.kind === 'constant') {\n return this.value.value;\n } else {\n return value;\n }\n }\n\n evaluate(feature: Feature): T {\n return this.property.evaluate(this.value, this.globals, feature);\n }\n}\n\n/**\n * A helper type: given an object type `Properties` whose values are each of type `Property`, it calculates\n * an object type with the same keys, and values of type `R`.\n *\n * For properties that don't allow data-driven values, `R` is a scalar type such as `number`, `string`, or `Color`.\n * For data-driven properties, it is `PossiblyEvaluatedPropertyValue`. Critically, the type definitions are set up\n * in a way that allows flow to know which of these two cases applies for any given property name, and if you attempt\n * to use a `PossiblyEvaluatedPropertyValue` as if it was a scalar, or vice versa, you will get a type error. (However,\n * there's at least one case in which flow fails to produce a type error that you should be aware of: in a context such\n * as `layer.paint.get('foo-opacity') === 0`, if `foo-opacity` is data-driven, than the left-hand side is of type\n * `PossiblyEvaluatedPropertyValue`, but flow will not complain about comparing this to a number using `===`.\n * See https://github.com/facebook/flow/issues/2359.)\n *\n * There's also a third, special case possiblity for `R`: for cross-faded properties, it's `?CrossFaded`.\n *\n * @private\n */\ntype PossiblyEvaluatedPropertyValues\n = $Exact<$ObjMap(p: Property) => R>>\n\n/**\n * `PossiblyEvaluated` stores a map of all (property name, `R`) pairs for paint or layout properties of a\n * given layer type.\n * @private\n */\nexport class PossiblyEvaluated {\n _properties: Properties;\n _values: PossiblyEvaluatedPropertyValues;\n\n constructor(properties: Properties) {\n this._properties = properties;\n this._values = (Object.create(properties.defaultPossiblyEvaluatedValues): any);\n }\n\n get(name: S): $ElementType, S> {\n return this._values[name];\n }\n}\n\n/**\n * An implementation of `Property` for properties that do not permit data-driven (source or composite) expressions.\n * This restriction allows us to declare statically that the result of possibly evaluating this kind of property\n * is in fact always the scalar type `T`, and can be used without further evaluating the value on a per-feature basis.\n *\n * @private\n */\nexport class DataConstantProperty implements Property {\n specification: StylePropertySpecification;\n\n constructor(specification: StylePropertySpecification) {\n this.specification = specification;\n }\n\n possiblyEvaluate(value: PropertyValue, parameters: EvaluationParameters): T {\n assert(!value.isDataDriven());\n return value.expression.evaluate(parameters);\n }\n\n interpolate(a: T, b: T, t: number): T {\n const interp: ?(a: T, b: T, t: number) => T = (interpolate: any)[this.specification.type];\n if (interp) {\n return interp(a, b, t);\n } else {\n return a;\n }\n }\n}\n\n/**\n * An implementation of `Property` for properties that permit data-driven (source or composite) expressions.\n * The result of possibly evaluating this kind of property is `PossiblyEvaluatedPropertyValue`; obtaining\n * a scalar value `T` requires further evaluation on a per-feature basis.\n *\n * @private\n */\nexport class DataDrivenProperty implements Property> {\n specification: StylePropertySpecification;\n\n constructor(specification: StylePropertySpecification) {\n this.specification = specification;\n }\n\n possiblyEvaluate(value: PropertyValue>, parameters: EvaluationParameters): PossiblyEvaluatedPropertyValue {\n if (value.expression.kind === 'constant' || value.expression.kind === 'camera') {\n return new PossiblyEvaluatedPropertyValue(this, {kind: 'constant', value: value.expression.evaluate(parameters)}, parameters);\n } else {\n return new PossiblyEvaluatedPropertyValue(this, value.expression, parameters);\n }\n }\n\n interpolate(a: PossiblyEvaluatedPropertyValue,\n b: PossiblyEvaluatedPropertyValue,\n t: number): PossiblyEvaluatedPropertyValue {\n // If either possibly-evaluated value is non-constant, give up: we aren't able to interpolate data-driven values.\n if (a.value.kind !== 'constant' || b.value.kind !== 'constant') {\n return a;\n }\n\n // Special case hack solely for fill-outline-color. The undefined value is subsequently handled in\n // FillStyleLayer#recalculate, which sets fill-outline-color to the fill-color value if the former\n // is a PossiblyEvaluatedPropertyValue containing a constant undefined value. In addition to the\n // return value here, the other source of a PossiblyEvaluatedPropertyValue containing a constant\n // undefined value is the \"default value\" for fill-outline-color held in\n // `Properties#defaultPossiblyEvaluatedValues`, which serves as the prototype of\n // `PossiblyEvaluated#_values`.\n if (a.value.value === undefined || b.value.value === undefined) {\n return new PossiblyEvaluatedPropertyValue(this, {kind: 'constant', value: (undefined: any)}, a.globals);\n }\n\n const interp: ?(a: T, b: T, t: number) => T = (interpolate: any)[this.specification.type];\n if (interp) {\n return new PossiblyEvaluatedPropertyValue(this, {kind: 'constant', value: interp(a.value.value, b.value.value, t)}, a.globals);\n } else {\n return a;\n }\n }\n\n evaluate(value: PossiblyEvaluatedValue, globals: GlobalProperties, feature: Feature): T {\n if (value.kind === 'constant') {\n return value.value;\n } else {\n return value.evaluate(globals, feature);\n }\n }\n}\n\n/**\n * An implementation of `Property` for `*-pattern` and `line-dasharray`, which are transitioned by cross-fading\n * rather than interpolation.\n *\n * @private\n */\nexport class CrossFadedProperty implements Property> {\n specification: StylePropertySpecification;\n\n constructor(specification: StylePropertySpecification) {\n this.specification = specification;\n }\n\n possiblyEvaluate(value: PropertyValue>, parameters: EvaluationParameters): ?CrossFaded {\n if (value.value === undefined) {\n return undefined;\n } else if (value.expression.kind === 'constant') {\n const constant = value.expression.evaluate(parameters);\n return this._calculate(constant, constant, constant, parameters);\n } else {\n assert(!value.isDataDriven());\n return this._calculate(\n value.expression.evaluate(new EvaluationParameters(Math.floor(parameters.zoom - 1.0), parameters)),\n value.expression.evaluate(new EvaluationParameters(Math.floor(parameters.zoom), parameters)),\n value.expression.evaluate(new EvaluationParameters(Math.floor(parameters.zoom + 1.0), parameters)),\n parameters);\n }\n }\n\n _calculate(min: T, mid: T, max: T, parameters: EvaluationParameters): ?CrossFaded {\n const z = parameters.zoom;\n const fraction = z - Math.floor(z);\n const t = parameters.crossFadingFactor();\n return z > parameters.zoomHistory.lastIntegerZoom ?\n { from: min, to: mid, fromScale: 2, toScale: 1, t: fraction + (1 - fraction) * t } :\n { from: max, to: mid, fromScale: 0.5, toScale: 1, t: 1 - (1 - t) * fraction };\n }\n\n interpolate(a: ?CrossFaded): ?CrossFaded {\n return a;\n }\n}\n\n/**\n * An implementation of `Property` for `heatmap-color` and `line-gradient`. Interpolation is a no-op, and\n * evaluation returns a boolean value in order to indicate its presence, but the real\n * evaluation happens in StyleLayer classes.\n *\n * @private\n */\n\nexport class ColorRampProperty implements Property {\n specification: StylePropertySpecification;\n\n constructor(specification: StylePropertySpecification) {\n this.specification = specification;\n }\n\n possiblyEvaluate(value: PropertyValue, parameters: EvaluationParameters): boolean {\n return !!value.expression.evaluate(parameters);\n }\n\n interpolate(): boolean { return false; }\n}\n\n/**\n * `Properties` holds objects containing default values for the layout or paint property set of a given\n * layer type. These objects are immutable, and they are used as the prototypes for the `_values` members of\n * `Transitionable`, `Transitioning`, `Layout`, and `PossiblyEvaluated`. This allows these classes to avoid\n * doing work in the common case where a property has no explicit value set and should be considered to take\n * on the default value: using `for (const property of Object.keys(this._values))`, they can iterate over\n * only the _own_ properties of `_values`, skipping repeated calculation of transitions and possible/final\n * evaluations for defaults, the result of which will always be the same.\n *\n * @private\n */\nexport class Properties {\n properties: Props;\n defaultPropertyValues: PropertyValues;\n defaultTransitionablePropertyValues: TransitionablePropertyValues;\n defaultTransitioningPropertyValues: TransitioningPropertyValues;\n defaultPossiblyEvaluatedValues: PossiblyEvaluatedPropertyValues;\n\n constructor(properties: Props) {\n this.properties = properties;\n this.defaultPropertyValues = ({}: any);\n this.defaultTransitionablePropertyValues = ({}: any);\n this.defaultTransitioningPropertyValues = ({}: any);\n this.defaultPossiblyEvaluatedValues = ({}: any);\n\n for (const property in properties) {\n const prop = properties[property];\n const defaultPropertyValue = this.defaultPropertyValues[property] =\n new PropertyValue(prop, undefined);\n const defaultTransitionablePropertyValue = this.defaultTransitionablePropertyValues[property] =\n new TransitionablePropertyValue(prop);\n this.defaultTransitioningPropertyValues[property] =\n defaultTransitionablePropertyValue.untransitioned();\n this.defaultPossiblyEvaluatedValues[property] =\n defaultPropertyValue.possiblyEvaluate(({}: any));\n }\n }\n}\n\nregister('DataDrivenProperty', DataDrivenProperty);\nregister('DataConstantProperty', DataConstantProperty);\nregister('CrossFadedProperty', CrossFadedProperty);\nregister('ColorRampProperty', ColorRampProperty);\n","// @flow\n\nimport { endsWith, filterObject } from '../util/util';\n\nimport styleSpec from '../style-spec/reference/latest';\nimport {\n validateStyle,\n validateLayoutProperty,\n validatePaintProperty,\n emitValidationErrors\n} from './validate_style';\nimport { Evented } from '../util/evented';\nimport { Layout, Transitionable, Transitioning, Properties } from './properties';\n\nimport type {Bucket} from '../data/bucket';\nimport type Point from '@mapbox/point-geometry';\nimport type {FeatureFilter} from '../style-spec/feature_filter';\nimport type {TransitionParameters} from './properties';\nimport type EvaluationParameters from './evaluation_parameters';\nimport type Transform from '../geo/transform';\n\nconst TRANSITION_SUFFIX = '-transition';\n\nclass StyleLayer extends Evented {\n id: string;\n metadata: mixed;\n type: string;\n source: string;\n sourceLayer: ?string;\n minzoom: ?number;\n maxzoom: ?number;\n filter: FilterSpecification | void;\n visibility: 'visible' | 'none';\n\n _unevaluatedLayout: Layout;\n +layout: mixed;\n\n _transitionablePaint: Transitionable;\n _transitioningPaint: Transitioning;\n +paint: mixed;\n\n _featureFilter: FeatureFilter;\n\n +queryRadius: (bucket: Bucket) => number;\n +queryIntersectsFeature: (queryGeometry: Array>,\n feature: VectorTileFeature,\n geometry: Array>,\n zoom: number,\n transform: Transform,\n pixelsToTileUnits: number,\n posMatrix: Float32Array) => boolean;\n\n constructor(layer: LayerSpecification, properties: {layout?: Properties<*>, paint: Properties<*>}) {\n super();\n\n this.id = layer.id;\n this.metadata = layer.metadata;\n this.type = layer.type;\n this.minzoom = layer.minzoom;\n this.maxzoom = layer.maxzoom;\n this.visibility = 'visible';\n\n if (layer.type !== 'background') {\n this.source = layer.source;\n this.sourceLayer = layer['source-layer'];\n this.filter = layer.filter;\n }\n\n this._featureFilter = () => true;\n\n if (properties.layout) {\n this._unevaluatedLayout = new Layout(properties.layout);\n }\n\n this._transitionablePaint = new Transitionable(properties.paint);\n\n for (const property in layer.paint) {\n this.setPaintProperty(property, layer.paint[property], {validate: false});\n }\n for (const property in layer.layout) {\n this.setLayoutProperty(property, layer.layout[property], {validate: false});\n }\n\n this._transitioningPaint = this._transitionablePaint.untransitioned();\n }\n\n getLayoutProperty(name: string) {\n if (name === 'visibility') {\n return this.visibility;\n }\n\n return this._unevaluatedLayout.getValue(name);\n }\n\n setLayoutProperty(name: string, value: mixed, options: {validate: boolean}) {\n if (value !== null && value !== undefined) {\n const key = `layers.${this.id}.layout.${name}`;\n if (this._validate(validateLayoutProperty, key, name, value, options)) {\n return;\n }\n }\n\n if (name === 'visibility') {\n this.visibility = value === 'none' ? value : 'visible';\n return;\n }\n\n this._unevaluatedLayout.setValue(name, value);\n }\n\n getPaintProperty(name: string) {\n if (endsWith(name, TRANSITION_SUFFIX)) {\n return this._transitionablePaint.getTransition(name.slice(0, -TRANSITION_SUFFIX.length));\n } else {\n return this._transitionablePaint.getValue(name);\n }\n }\n\n setPaintProperty(name: string, value: mixed, options: {validate: boolean}) {\n if (value !== null && value !== undefined) {\n const key = `layers.${this.id}.paint.${name}`;\n if (this._validate(validatePaintProperty, key, name, value, options)) {\n return;\n }\n }\n\n if (endsWith(name, TRANSITION_SUFFIX)) {\n this._transitionablePaint.setTransition(name.slice(0, -TRANSITION_SUFFIX.length), (value: any) || undefined);\n } else {\n this._transitionablePaint.setValue(name, value);\n }\n }\n\n isHidden(zoom: number) {\n if (this.minzoom && zoom < this.minzoom) return true;\n if (this.maxzoom && zoom >= this.maxzoom) return true;\n return this.visibility === 'none';\n }\n\n updateTransitions(parameters: TransitionParameters) {\n this._transitioningPaint = this._transitionablePaint.transitioned(parameters, this._transitioningPaint);\n }\n\n hasTransition() {\n return this._transitioningPaint.hasTransition();\n }\n\n recalculate(parameters: EvaluationParameters) {\n if (this._unevaluatedLayout) {\n (this: any).layout = this._unevaluatedLayout.possiblyEvaluate(parameters);\n }\n\n (this: any).paint = this._transitioningPaint.possiblyEvaluate(parameters);\n }\n\n serialize() {\n const output : any = {\n 'id': this.id,\n 'type': this.type,\n 'source': this.source,\n 'source-layer': this.sourceLayer,\n 'metadata': this.metadata,\n 'minzoom': this.minzoom,\n 'maxzoom': this.maxzoom,\n 'filter': this.filter,\n 'layout': this._unevaluatedLayout && this._unevaluatedLayout.serialize(),\n 'paint': this._transitionablePaint && this._transitionablePaint.serialize()\n };\n\n if (this.visibility === 'none') {\n output.layout = output.layout || {};\n output.layout.visibility = 'none';\n }\n\n return filterObject(output, (value, key) => {\n return value !== undefined &&\n !(key === 'layout' && !Object.keys(value).length) &&\n !(key === 'paint' && !Object.keys(value).length);\n });\n }\n\n _validate(validate: Function, key: string, name: string, value: mixed, options: {validate: boolean}) {\n if (options && options.validate === false) {\n return false;\n }\n return emitValidationErrors(this, validate.call(validateStyle, {\n key: key,\n layerType: this.type,\n objectKey: name,\n value: value,\n styleSpec: styleSpec,\n // Workaround for https://github.com/mapbox/mapbox-gl-js/issues/2407\n style: {glyphs: true, sprite: true}\n }));\n }\n\n hasOffscreenPass() {\n return false;\n }\n\n resize() {\n // noop\n }\n}\n\nexport default StyleLayer;\n\n\n","// @flow\n\n// Note: all \"sizes\" are measured in bytes\n\nimport assert from 'assert';\n\nimport type {Transferable} from '../types/transferable';\n\nconst viewTypes = {\n 'Int8': Int8Array,\n 'Uint8': Uint8Array,\n 'Int16': Int16Array,\n 'Uint16': Uint16Array,\n 'Int32': Int32Array,\n 'Uint32': Uint32Array,\n 'Float32': Float32Array\n};\n\nexport type ViewType = $Keys;\n\n/**\n * @private\n */\nclass Struct {\n _pos1: number;\n _pos2: number;\n _pos4: number;\n _pos8: number;\n +_structArray: StructArray;\n\n // The following properties are defined on the prototype of sub classes.\n size: number;\n\n /**\n * @param {StructArray} structArray The StructArray the struct is stored in\n * @param {number} index The index of the struct in the StructArray.\n * @private\n */\n constructor(structArray: StructArray, index: number) {\n (this: any)._structArray = structArray;\n this._pos1 = index * this.size;\n this._pos2 = this._pos1 / 2;\n this._pos4 = this._pos1 / 4;\n this._pos8 = this._pos1 / 8;\n }\n}\n\nconst DEFAULT_CAPACITY = 128;\nconst RESIZE_MULTIPLIER = 5;\n\nexport type StructArrayMember = {\n name: string,\n type: ViewType,\n components: number,\n offset: number\n};\n\nexport type StructArrayLayout = {\n members: Array,\n size: number,\n alignment: ?number\n}\n\nexport type SerializedStructArray = {\n length: number,\n arrayBuffer: ArrayBuffer\n};\n\n/**\n * `StructArray` provides an abstraction over `ArrayBuffer` and `TypedArray`\n * making it behave like an array of typed structs.\n *\n * Conceptually, a StructArray is comprised of elements, i.e., instances of its\n * associated struct type. Each particular struct type, together with an\n * alignment size, determines the memory layout of a StructArray whose elements\n * are of that type. Thus, for each such layout that we need, we have\n * a corrseponding StructArrayLayout class, inheriting from StructArray and\n * implementing `emplaceBack()` and `_refreshViews()`.\n *\n * In some cases, where we need to access particular elements of a StructArray,\n * we implement a more specific subclass that inherits from one of the\n * StructArrayLayouts and adds a `get(i): T` accessor that returns a structured\n * object whose properties are proxies into the underlying memory space for the\n * i-th element. This affords the convience of working with (seemingly) plain\n * Javascript objects without the overhead of serializing/deserializing them\n * into ArrayBuffers for efficient web worker transfer.\n *\n * @private\n */\nclass StructArray {\n capacity: number;\n length: number;\n isTransferred: boolean;\n arrayBuffer: ArrayBuffer;\n uint8: Uint8Array;\n\n // The following properties are defined on the prototype.\n members: Array;\n bytesPerElement: number;\n +emplaceBack: Function;\n\n constructor() {\n this.isTransferred = false;\n this.capacity = -1;\n this.resize(0);\n }\n\n /**\n * Serialize a StructArray instance. Serializes both the raw data and the\n * metadata needed to reconstruct the StructArray base class during\n * deserialization.\n */\n static serialize(array: StructArray, transferables?: Array): SerializedStructArray {\n assert(!array.isTransferred);\n\n array._trim();\n\n if (transferables) {\n array.isTransferred = true;\n transferables.push(array.arrayBuffer);\n }\n\n return {\n length: array.length,\n arrayBuffer: array.arrayBuffer,\n };\n }\n\n static deserialize(input: SerializedStructArray) {\n const structArray = Object.create(this.prototype);\n structArray.arrayBuffer = input.arrayBuffer;\n structArray.length = input.length;\n structArray.capacity = input.arrayBuffer.byteLength / structArray.bytesPerElement;\n structArray._refreshViews();\n return structArray;\n }\n\n /**\n * Resize the array to discard unused capacity.\n */\n _trim() {\n if (this.length !== this.capacity) {\n this.capacity = this.length;\n this.arrayBuffer = this.arrayBuffer.slice(0, this.length * this.bytesPerElement);\n this._refreshViews();\n }\n }\n\n /**\n * Resets the the length of the array to 0 without de-allocating capcacity.\n */\n clear() {\n this.length = 0;\n }\n\n /**\n * Resize the array.\n * If `n` is greater than the current length then additional elements with undefined values are added.\n * If `n` is less than the current length then the array will be reduced to the first `n` elements.\n * @param {number} n The new size of the array.\n */\n resize(n: number) {\n assert(!this.isTransferred);\n this.reserve(n);\n this.length = n;\n }\n\n /**\n * Indicate a planned increase in size, so that any necessary allocation may\n * be done once, ahead of time.\n * @param {number} n The expected size of the array.\n */\n reserve(n: number) {\n if (n > this.capacity) {\n this.capacity = Math.max(n, Math.floor(this.capacity * RESIZE_MULTIPLIER), DEFAULT_CAPACITY);\n this.arrayBuffer = new ArrayBuffer(this.capacity * this.bytesPerElement);\n\n const oldUint8Array = this.uint8;\n this._refreshViews();\n if (oldUint8Array) this.uint8.set(oldUint8Array);\n }\n }\n\n /**\n * Create TypedArray views for the current ArrayBuffer.\n */\n _refreshViews() {\n throw new Error('_refreshViews() must be implemented by each concrete StructArray layout');\n }\n}\n\n/**\n * Given a list of member fields, create a full StructArrayLayout, in\n * particular calculating the correct byte offset for each field. This data\n * is used at build time to generate StructArrayLayout_*#emplaceBack() and\n * other accessors, and at runtime for binding vertex buffer attributes.\n *\n * @private\n */\nfunction createLayout(\n members: Array<{ name: string, type: ViewType, +components?: number, }>,\n alignment: number = 1\n): StructArrayLayout {\n\n let offset = 0;\n let maxSize = 0;\n const layoutMembers = members.map((member) => {\n assert(member.name.length);\n const typeSize = sizeOf(member.type);\n const memberOffset = offset = align(offset, Math.max(alignment, typeSize));\n const components = member.components || 1;\n\n maxSize = Math.max(maxSize, typeSize);\n offset += typeSize * components;\n\n return {\n name: member.name,\n type: member.type,\n components: components,\n offset: memberOffset,\n };\n });\n\n const size = align(offset, Math.max(maxSize, alignment));\n\n return {\n members: layoutMembers,\n size,\n alignment\n };\n}\n\nfunction sizeOf(type: ViewType): number {\n return viewTypes[type].BYTES_PER_ELEMENT;\n}\n\nfunction align(offset: number, size: number): number {\n return Math.ceil(offset / size) * size;\n}\n\nexport { StructArray, Struct, viewTypes, createLayout };\n","// This file is generated. Edit build/generate-struct-arrays.js, then run `yarn run codegen`.\n// @flow\n\nimport assert from 'assert';\nimport {Struct, StructArray} from '../util/struct_array';\nimport {register} from '../util/web_worker_transfer';\nimport Point from '@mapbox/point-geometry';\n\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Int16[2]\n *\n * @private\n */\nclass StructArrayLayout2i4 extends StructArray {\n uint8: Uint8Array;\n int16: Int16Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.int16 = new Int16Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number) {\n const i = this.length;\n this.resize(i + 1);\n const o2 = i * 2;\n this.int16[o2 + 0] = v0;\n this.int16[o2 + 1] = v1;\n return i;\n }\n\n}\n\nStructArrayLayout2i4.prototype.bytesPerElement = 4;\nregister('StructArrayLayout2i4', StructArrayLayout2i4);\n\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Int16[4]\n *\n * @private\n */\nclass StructArrayLayout4i8 extends StructArray {\n uint8: Uint8Array;\n int16: Int16Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.int16 = new Int16Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number, v2: number, v3: number) {\n const i = this.length;\n this.resize(i + 1);\n const o2 = i * 4;\n this.int16[o2 + 0] = v0;\n this.int16[o2 + 1] = v1;\n this.int16[o2 + 2] = v2;\n this.int16[o2 + 3] = v3;\n return i;\n }\n\n}\n\nStructArrayLayout4i8.prototype.bytesPerElement = 8;\nregister('StructArrayLayout4i8', StructArrayLayout4i8);\n\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Int16[2]\n * [4]: Int16[4]\n *\n * @private\n */\nclass StructArrayLayout2i4i12 extends StructArray {\n uint8: Uint8Array;\n int16: Int16Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.int16 = new Int16Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number, v2: number, v3: number, v4: number, v5: number) {\n const i = this.length;\n this.resize(i + 1);\n const o2 = i * 6;\n this.int16[o2 + 0] = v0;\n this.int16[o2 + 1] = v1;\n this.int16[o2 + 2] = v2;\n this.int16[o2 + 3] = v3;\n this.int16[o2 + 4] = v4;\n this.int16[o2 + 5] = v5;\n return i;\n }\n\n}\n\nStructArrayLayout2i4i12.prototype.bytesPerElement = 12;\nregister('StructArrayLayout2i4i12', StructArrayLayout2i4i12);\n\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Int16[4]\n * [8]: Uint8[4]\n *\n * @private\n */\nclass StructArrayLayout4i4ub12 extends StructArray {\n uint8: Uint8Array;\n int16: Int16Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.int16 = new Int16Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number) {\n const i = this.length;\n this.resize(i + 1);\n const o2 = i * 6;\n const o1 = i * 12;\n this.int16[o2 + 0] = v0;\n this.int16[o2 + 1] = v1;\n this.int16[o2 + 2] = v2;\n this.int16[o2 + 3] = v3;\n this.uint8[o1 + 8] = v4;\n this.uint8[o1 + 9] = v5;\n this.uint8[o1 + 10] = v6;\n this.uint8[o1 + 11] = v7;\n return i;\n }\n\n}\n\nStructArrayLayout4i4ub12.prototype.bytesPerElement = 12;\nregister('StructArrayLayout4i4ub12', StructArrayLayout4i4ub12);\n\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Int16[4]\n * [8]: Uint16[4]\n *\n * @private\n */\nclass StructArrayLayout4i4ui16 extends StructArray {\n uint8: Uint8Array;\n int16: Int16Array;\n uint16: Uint16Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.int16 = new Int16Array(this.arrayBuffer);\n this.uint16 = new Uint16Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number) {\n const i = this.length;\n this.resize(i + 1);\n const o2 = i * 8;\n this.int16[o2 + 0] = v0;\n this.int16[o2 + 1] = v1;\n this.int16[o2 + 2] = v2;\n this.int16[o2 + 3] = v3;\n this.uint16[o2 + 4] = v4;\n this.uint16[o2 + 5] = v5;\n this.uint16[o2 + 6] = v6;\n this.uint16[o2 + 7] = v7;\n return i;\n }\n\n}\n\nStructArrayLayout4i4ui16.prototype.bytesPerElement = 16;\nregister('StructArrayLayout4i4ui16', StructArrayLayout4i4ui16);\n\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Float32[3]\n *\n * @private\n */\nclass StructArrayLayout3f12 extends StructArray {\n uint8: Uint8Array;\n float32: Float32Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.float32 = new Float32Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number, v2: number) {\n const i = this.length;\n this.resize(i + 1);\n const o4 = i * 3;\n this.float32[o4 + 0] = v0;\n this.float32[o4 + 1] = v1;\n this.float32[o4 + 2] = v2;\n return i;\n }\n\n}\n\nStructArrayLayout3f12.prototype.bytesPerElement = 12;\nregister('StructArrayLayout3f12', StructArrayLayout3f12);\n\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Uint32[1]\n *\n * @private\n */\nclass StructArrayLayout1ul4 extends StructArray {\n uint8: Uint8Array;\n uint32: Uint32Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.uint32 = new Uint32Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number) {\n const i = this.length;\n this.resize(i + 1);\n const o4 = i * 1;\n this.uint32[o4 + 0] = v0;\n return i;\n }\n\n}\n\nStructArrayLayout1ul4.prototype.bytesPerElement = 4;\nregister('StructArrayLayout1ul4', StructArrayLayout1ul4);\n\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Int16[6]\n * [12]: Uint32[1]\n * [16]: Uint16[2]\n * [20]: Int16[2]\n *\n * @private\n */\nclass StructArrayLayout6i1ul2ui2i24 extends StructArray {\n uint8: Uint8Array;\n int16: Int16Array;\n uint32: Uint32Array;\n uint16: Uint16Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.int16 = new Int16Array(this.arrayBuffer);\n this.uint32 = new Uint32Array(this.arrayBuffer);\n this.uint16 = new Uint16Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number, v9: number, v10: number) {\n const i = this.length;\n this.resize(i + 1);\n const o2 = i * 12;\n const o4 = i * 6;\n this.int16[o2 + 0] = v0;\n this.int16[o2 + 1] = v1;\n this.int16[o2 + 2] = v2;\n this.int16[o2 + 3] = v3;\n this.int16[o2 + 4] = v4;\n this.int16[o2 + 5] = v5;\n this.uint32[o4 + 3] = v6;\n this.uint16[o2 + 8] = v7;\n this.uint16[o2 + 9] = v8;\n this.int16[o2 + 10] = v9;\n this.int16[o2 + 11] = v10;\n return i;\n }\n\n}\n\nStructArrayLayout6i1ul2ui2i24.prototype.bytesPerElement = 24;\nregister('StructArrayLayout6i1ul2ui2i24', StructArrayLayout6i1ul2ui2i24);\n\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Int16[2]\n * [4]: Int16[2]\n * [8]: Int16[2]\n *\n * @private\n */\nclass StructArrayLayout2i2i2i12 extends StructArray {\n uint8: Uint8Array;\n int16: Int16Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.int16 = new Int16Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number, v2: number, v3: number, v4: number, v5: number) {\n const i = this.length;\n this.resize(i + 1);\n const o2 = i * 6;\n this.int16[o2 + 0] = v0;\n this.int16[o2 + 1] = v1;\n this.int16[o2 + 2] = v2;\n this.int16[o2 + 3] = v3;\n this.int16[o2 + 4] = v4;\n this.int16[o2 + 5] = v5;\n return i;\n }\n\n}\n\nStructArrayLayout2i2i2i12.prototype.bytesPerElement = 12;\nregister('StructArrayLayout2i2i2i12', StructArrayLayout2i2i2i12);\n\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Uint8[2]\n *\n * @private\n */\nclass StructArrayLayout2ub4 extends StructArray {\n uint8: Uint8Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number) {\n const i = this.length;\n this.resize(i + 1);\n const o1 = i * 4;\n this.uint8[o1 + 0] = v0;\n this.uint8[o1 + 1] = v1;\n return i;\n }\n\n}\n\nStructArrayLayout2ub4.prototype.bytesPerElement = 4;\nregister('StructArrayLayout2ub4', StructArrayLayout2ub4);\n\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Int16[2]\n * [4]: Uint16[2]\n * [8]: Uint32[3]\n * [20]: Uint16[3]\n * [28]: Float32[2]\n * [36]: Uint8[2]\n *\n * @private\n */\nclass StructArrayLayout2i2ui3ul3ui2f2ub40 extends StructArray {\n uint8: Uint8Array;\n int16: Int16Array;\n uint16: Uint16Array;\n uint32: Uint32Array;\n float32: Float32Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.int16 = new Int16Array(this.arrayBuffer);\n this.uint16 = new Uint16Array(this.arrayBuffer);\n this.uint32 = new Uint32Array(this.arrayBuffer);\n this.float32 = new Float32Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number, v9: number, v10: number, v11: number, v12: number, v13: number) {\n const i = this.length;\n this.resize(i + 1);\n const o2 = i * 20;\n const o4 = i * 10;\n const o1 = i * 40;\n this.int16[o2 + 0] = v0;\n this.int16[o2 + 1] = v1;\n this.uint16[o2 + 2] = v2;\n this.uint16[o2 + 3] = v3;\n this.uint32[o4 + 2] = v4;\n this.uint32[o4 + 3] = v5;\n this.uint32[o4 + 4] = v6;\n this.uint16[o2 + 10] = v7;\n this.uint16[o2 + 11] = v8;\n this.uint16[o2 + 12] = v9;\n this.float32[o4 + 7] = v10;\n this.float32[o4 + 8] = v11;\n this.uint8[o1 + 36] = v12;\n this.uint8[o1 + 37] = v13;\n return i;\n }\n\n}\n\nStructArrayLayout2i2ui3ul3ui2f2ub40.prototype.bytesPerElement = 40;\nregister('StructArrayLayout2i2ui3ul3ui2f2ub40', StructArrayLayout2i2ui3ul3ui2f2ub40);\n\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Float32[1]\n *\n * @private\n */\nclass StructArrayLayout1f4 extends StructArray {\n uint8: Uint8Array;\n float32: Float32Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.float32 = new Float32Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number) {\n const i = this.length;\n this.resize(i + 1);\n const o4 = i * 1;\n this.float32[o4 + 0] = v0;\n return i;\n }\n\n}\n\nStructArrayLayout1f4.prototype.bytesPerElement = 4;\nregister('StructArrayLayout1f4', StructArrayLayout1f4);\n\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Int16[3]\n *\n * @private\n */\nclass StructArrayLayout3i6 extends StructArray {\n uint8: Uint8Array;\n int16: Int16Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.int16 = new Int16Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number, v2: number) {\n const i = this.length;\n this.resize(i + 1);\n const o2 = i * 3;\n this.int16[o2 + 0] = v0;\n this.int16[o2 + 1] = v1;\n this.int16[o2 + 2] = v2;\n return i;\n }\n\n}\n\nStructArrayLayout3i6.prototype.bytesPerElement = 6;\nregister('StructArrayLayout3i6', StructArrayLayout3i6);\n\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Uint32[1]\n * [4]: Uint16[2]\n *\n * @private\n */\nclass StructArrayLayout1ul2ui8 extends StructArray {\n uint8: Uint8Array;\n uint32: Uint32Array;\n uint16: Uint16Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.uint32 = new Uint32Array(this.arrayBuffer);\n this.uint16 = new Uint16Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number, v2: number) {\n const i = this.length;\n this.resize(i + 1);\n const o4 = i * 2;\n const o2 = i * 4;\n this.uint32[o4 + 0] = v0;\n this.uint16[o2 + 2] = v1;\n this.uint16[o2 + 3] = v2;\n return i;\n }\n\n}\n\nStructArrayLayout1ul2ui8.prototype.bytesPerElement = 8;\nregister('StructArrayLayout1ul2ui8', StructArrayLayout1ul2ui8);\n\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Uint16[3]\n *\n * @private\n */\nclass StructArrayLayout3ui6 extends StructArray {\n uint8: Uint8Array;\n uint16: Uint16Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.uint16 = new Uint16Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number, v2: number) {\n const i = this.length;\n this.resize(i + 1);\n const o2 = i * 3;\n this.uint16[o2 + 0] = v0;\n this.uint16[o2 + 1] = v1;\n this.uint16[o2 + 2] = v2;\n return i;\n }\n\n}\n\nStructArrayLayout3ui6.prototype.bytesPerElement = 6;\nregister('StructArrayLayout3ui6', StructArrayLayout3ui6);\n\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Uint16[2]\n *\n * @private\n */\nclass StructArrayLayout2ui4 extends StructArray {\n uint8: Uint8Array;\n uint16: Uint16Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.uint16 = new Uint16Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number) {\n const i = this.length;\n this.resize(i + 1);\n const o2 = i * 2;\n this.uint16[o2 + 0] = v0;\n this.uint16[o2 + 1] = v1;\n return i;\n }\n\n}\n\nStructArrayLayout2ui4.prototype.bytesPerElement = 4;\nregister('StructArrayLayout2ui4', StructArrayLayout2ui4);\n\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Float32[2]\n *\n * @private\n */\nclass StructArrayLayout2f8 extends StructArray {\n uint8: Uint8Array;\n float32: Float32Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.float32 = new Float32Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number) {\n const i = this.length;\n this.resize(i + 1);\n const o4 = i * 2;\n this.float32[o4 + 0] = v0;\n this.float32[o4 + 1] = v1;\n return i;\n }\n\n}\n\nStructArrayLayout2f8.prototype.bytesPerElement = 8;\nregister('StructArrayLayout2f8', StructArrayLayout2f8);\n\n\n/**\n * Implementation of the StructArray layout:\n * [0]: Float32[4]\n *\n * @private\n */\nclass StructArrayLayout4f16 extends StructArray {\n uint8: Uint8Array;\n float32: Float32Array;\n\n _refreshViews() {\n this.uint8 = new Uint8Array(this.arrayBuffer);\n this.float32 = new Float32Array(this.arrayBuffer);\n }\n\n emplaceBack(v0: number, v1: number, v2: number, v3: number) {\n const i = this.length;\n this.resize(i + 1);\n const o4 = i * 4;\n this.float32[o4 + 0] = v0;\n this.float32[o4 + 1] = v1;\n this.float32[o4 + 2] = v2;\n this.float32[o4 + 3] = v3;\n return i;\n }\n\n}\n\nStructArrayLayout4f16.prototype.bytesPerElement = 16;\nregister('StructArrayLayout4f16', StructArrayLayout4f16);\n\n\nclass CollisionBoxStruct extends Struct {\n _structArray: CollisionBoxArray;\n anchorPointX: number;\n anchorPointY: number;\n x1: number;\n y1: number;\n x2: number;\n y2: number;\n featureIndex: number;\n sourceLayerIndex: number;\n bucketIndex: number;\n radius: number;\n signedDistanceFromAnchor: number;\n anchorPoint: Point;\n get anchorPointX() { return this._structArray.int16[this._pos2 + 0]; }\n set anchorPointX(x) { this._structArray.int16[this._pos2 + 0] = x; }\n get anchorPointY() { return this._structArray.int16[this._pos2 + 1]; }\n set anchorPointY(x) { this._structArray.int16[this._pos2 + 1] = x; }\n get x1() { return this._structArray.int16[this._pos2 + 2]; }\n set x1(x) { this._structArray.int16[this._pos2 + 2] = x; }\n get y1() { return this._structArray.int16[this._pos2 + 3]; }\n set y1(x) { this._structArray.int16[this._pos2 + 3] = x; }\n get x2() { return this._structArray.int16[this._pos2 + 4]; }\n set x2(x) { this._structArray.int16[this._pos2 + 4] = x; }\n get y2() { return this._structArray.int16[this._pos2 + 5]; }\n set y2(x) { this._structArray.int16[this._pos2 + 5] = x; }\n get featureIndex() { return this._structArray.uint32[this._pos4 + 3]; }\n set featureIndex(x) { this._structArray.uint32[this._pos4 + 3] = x; }\n get sourceLayerIndex() { return this._structArray.uint16[this._pos2 + 8]; }\n set sourceLayerIndex(x) { this._structArray.uint16[this._pos2 + 8] = x; }\n get bucketIndex() { return this._structArray.uint16[this._pos2 + 9]; }\n set bucketIndex(x) { this._structArray.uint16[this._pos2 + 9] = x; }\n get radius() { return this._structArray.int16[this._pos2 + 10]; }\n set radius(x) { this._structArray.int16[this._pos2 + 10] = x; }\n get signedDistanceFromAnchor() { return this._structArray.int16[this._pos2 + 11]; }\n set signedDistanceFromAnchor(x) { this._structArray.int16[this._pos2 + 11] = x; }\n get anchorPoint() { return new Point(this.anchorPointX, this.anchorPointY); }\n}\n\nCollisionBoxStruct.prototype.size = 24;\n\nexport type CollisionBox = CollisionBoxStruct;\n\n\n/**\n * @private\n */\nexport class CollisionBoxArray extends StructArrayLayout6i1ul2ui2i24 {\n /**\n * Return the CollisionBoxStruct at the given location in the array.\n * @param {number} index The index of the element.\n */\n get(index: number): CollisionBoxStruct {\n assert(!this.isTransferred);\n return new CollisionBoxStruct(this, index);\n }\n}\n\nregister('CollisionBoxArray', CollisionBoxArray);\n\nclass PlacedSymbolStruct extends Struct {\n _structArray: PlacedSymbolArray;\n anchorX: number;\n anchorY: number;\n glyphStartIndex: number;\n numGlyphs: number;\n vertexStartIndex: number;\n lineStartIndex: number;\n lineLength: number;\n segment: number;\n lowerSize: number;\n upperSize: number;\n lineOffsetX: number;\n lineOffsetY: number;\n writingMode: number;\n hidden: number;\n get anchorX() { return this._structArray.int16[this._pos2 + 0]; }\n set anchorX(x) { this._structArray.int16[this._pos2 + 0] = x; }\n get anchorY() { return this._structArray.int16[this._pos2 + 1]; }\n set anchorY(x) { this._structArray.int16[this._pos2 + 1] = x; }\n get glyphStartIndex() { return this._structArray.uint16[this._pos2 + 2]; }\n set glyphStartIndex(x) { this._structArray.uint16[this._pos2 + 2] = x; }\n get numGlyphs() { return this._structArray.uint16[this._pos2 + 3]; }\n set numGlyphs(x) { this._structArray.uint16[this._pos2 + 3] = x; }\n get vertexStartIndex() { return this._structArray.uint32[this._pos4 + 2]; }\n set vertexStartIndex(x) { this._structArray.uint32[this._pos4 + 2] = x; }\n get lineStartIndex() { return this._structArray.uint32[this._pos4 + 3]; }\n set lineStartIndex(x) { this._structArray.uint32[this._pos4 + 3] = x; }\n get lineLength() { return this._structArray.uint32[this._pos4 + 4]; }\n set lineLength(x) { this._structArray.uint32[this._pos4 + 4] = x; }\n get segment() { return this._structArray.uint16[this._pos2 + 10]; }\n set segment(x) { this._structArray.uint16[this._pos2 + 10] = x; }\n get lowerSize() { return this._structArray.uint16[this._pos2 + 11]; }\n set lowerSize(x) { this._structArray.uint16[this._pos2 + 11] = x; }\n get upperSize() { return this._structArray.uint16[this._pos2 + 12]; }\n set upperSize(x) { this._structArray.uint16[this._pos2 + 12] = x; }\n get lineOffsetX() { return this._structArray.float32[this._pos4 + 7]; }\n set lineOffsetX(x) { this._structArray.float32[this._pos4 + 7] = x; }\n get lineOffsetY() { return this._structArray.float32[this._pos4 + 8]; }\n set lineOffsetY(x) { this._structArray.float32[this._pos4 + 8] = x; }\n get writingMode() { return this._structArray.uint8[this._pos1 + 36]; }\n set writingMode(x) { this._structArray.uint8[this._pos1 + 36] = x; }\n get hidden() { return this._structArray.uint8[this._pos1 + 37]; }\n set hidden(x) { this._structArray.uint8[this._pos1 + 37] = x; }\n}\n\nPlacedSymbolStruct.prototype.size = 40;\n\nexport type PlacedSymbol = PlacedSymbolStruct;\n\n\n/**\n * @private\n */\nexport class PlacedSymbolArray extends StructArrayLayout2i2ui3ul3ui2f2ub40 {\n /**\n * Return the PlacedSymbolStruct at the given location in the array.\n * @param {number} index The index of the element.\n */\n get(index: number): PlacedSymbolStruct {\n assert(!this.isTransferred);\n return new PlacedSymbolStruct(this, index);\n }\n}\n\nregister('PlacedSymbolArray', PlacedSymbolArray);\n\nclass GlyphOffsetStruct extends Struct {\n _structArray: GlyphOffsetArray;\n offsetX: number;\n get offsetX() { return this._structArray.float32[this._pos4 + 0]; }\n set offsetX(x) { this._structArray.float32[this._pos4 + 0] = x; }\n}\n\nGlyphOffsetStruct.prototype.size = 4;\n\nexport type GlyphOffset = GlyphOffsetStruct;\n\n\n/**\n * @private\n */\nexport class GlyphOffsetArray extends StructArrayLayout1f4 {\n getoffsetX(index: number) { return this.float32[index * 1 + 0]; }\n /**\n * Return the GlyphOffsetStruct at the given location in the array.\n * @param {number} index The index of the element.\n */\n get(index: number): GlyphOffsetStruct {\n assert(!this.isTransferred);\n return new GlyphOffsetStruct(this, index);\n }\n}\n\nregister('GlyphOffsetArray', GlyphOffsetArray);\n\nclass SymbolLineVertexStruct extends Struct {\n _structArray: SymbolLineVertexArray;\n x: number;\n y: number;\n tileUnitDistanceFromAnchor: number;\n get x() { return this._structArray.int16[this._pos2 + 0]; }\n set x(x) { this._structArray.int16[this._pos2 + 0] = x; }\n get y() { return this._structArray.int16[this._pos2 + 1]; }\n set y(x) { this._structArray.int16[this._pos2 + 1] = x; }\n get tileUnitDistanceFromAnchor() { return this._structArray.int16[this._pos2 + 2]; }\n set tileUnitDistanceFromAnchor(x) { this._structArray.int16[this._pos2 + 2] = x; }\n}\n\nSymbolLineVertexStruct.prototype.size = 6;\n\nexport type SymbolLineVertex = SymbolLineVertexStruct;\n\n\n/**\n * @private\n */\nexport class SymbolLineVertexArray extends StructArrayLayout3i6 {\n getx(index: number) { return this.int16[index * 3 + 0]; }\n gety(index: number) { return this.int16[index * 3 + 1]; }\n gettileUnitDistanceFromAnchor(index: number) { return this.int16[index * 3 + 2]; }\n /**\n * Return the SymbolLineVertexStruct at the given location in the array.\n * @param {number} index The index of the element.\n */\n get(index: number): SymbolLineVertexStruct {\n assert(!this.isTransferred);\n return new SymbolLineVertexStruct(this, index);\n }\n}\n\nregister('SymbolLineVertexArray', SymbolLineVertexArray);\n\nclass FeatureIndexStruct extends Struct {\n _structArray: FeatureIndexArray;\n featureIndex: number;\n sourceLayerIndex: number;\n bucketIndex: number;\n get featureIndex() { return this._structArray.uint32[this._pos4 + 0]; }\n set featureIndex(x) { this._structArray.uint32[this._pos4 + 0] = x; }\n get sourceLayerIndex() { return this._structArray.uint16[this._pos2 + 2]; }\n set sourceLayerIndex(x) { this._structArray.uint16[this._pos2 + 2] = x; }\n get bucketIndex() { return this._structArray.uint16[this._pos2 + 3]; }\n set bucketIndex(x) { this._structArray.uint16[this._pos2 + 3] = x; }\n}\n\nFeatureIndexStruct.prototype.size = 8;\n\nexport type FeatureIndex = FeatureIndexStruct;\n\n\n/**\n * @private\n */\nexport class FeatureIndexArray extends StructArrayLayout1ul2ui8 {\n /**\n * Return the FeatureIndexStruct at the given location in the array.\n * @param {number} index The index of the element.\n */\n get(index: number): FeatureIndexStruct {\n assert(!this.isTransferred);\n return new FeatureIndexStruct(this, index);\n }\n}\n\nregister('FeatureIndexArray', FeatureIndexArray);\n\n\nexport {\n StructArrayLayout2i4,\n StructArrayLayout4i8,\n StructArrayLayout2i4i12,\n StructArrayLayout4i4ub12,\n StructArrayLayout4i4ui16,\n StructArrayLayout3f12,\n StructArrayLayout1ul4,\n StructArrayLayout6i1ul2ui2i24,\n StructArrayLayout2i2i2i12,\n StructArrayLayout2ub4,\n StructArrayLayout2i2ui3ul3ui2f2ub40,\n StructArrayLayout1f4,\n StructArrayLayout3i6,\n StructArrayLayout1ul2ui8,\n StructArrayLayout3ui6,\n StructArrayLayout2ui4,\n StructArrayLayout2f8,\n StructArrayLayout4f16,\n StructArrayLayout2i4 as PosArray,\n StructArrayLayout4i8 as RasterBoundsArray,\n StructArrayLayout2i4 as CircleLayoutArray,\n StructArrayLayout2i4 as FillLayoutArray,\n StructArrayLayout2i4i12 as FillExtrusionLayoutArray,\n StructArrayLayout2i4 as HeatmapLayoutArray,\n StructArrayLayout4i4ub12 as LineLayoutArray,\n StructArrayLayout4i4ui16 as SymbolLayoutArray,\n StructArrayLayout3f12 as SymbolDynamicLayoutArray,\n StructArrayLayout1ul4 as SymbolOpacityArray,\n StructArrayLayout2i2i2i12 as CollisionBoxLayoutArray,\n StructArrayLayout2i2i2i12 as CollisionCircleLayoutArray,\n StructArrayLayout2ub4 as CollisionVertexArray,\n StructArrayLayout3ui6 as TriangleIndexArray,\n StructArrayLayout2ui4 as LineIndexArray\n};\n","// @flow\nimport { createLayout } from '../../util/struct_array';\n\nconst layout = createLayout([\n {name: 'a_pos', components: 2, type: 'Int16'}\n], 4);\n\nexport default layout;\nexport const {members, size, alignment} = layout;\n","// @flow\n\nimport { warnOnce } from '../util/util';\n\nimport { register } from '../util/web_worker_transfer';\n\nimport type VertexArrayObject from '../render/vertex_array_object';\nimport type {StructArray} from '../util/struct_array';\n\nexport type Segment = {\n vertexOffset: number,\n primitiveOffset: number,\n vertexLength: number,\n primitiveLength: number,\n vaos: {[string]: VertexArrayObject}\n}\n\nclass SegmentVector {\n static MAX_VERTEX_ARRAY_LENGTH: number;\n segments: Array;\n\n constructor(segments?: Array = []) {\n this.segments = segments;\n }\n\n prepareSegment(numVertices: number, layoutVertexArray: StructArray, indexArray: StructArray): Segment {\n let segment: Segment = this.segments[this.segments.length - 1];\n if (numVertices > SegmentVector.MAX_VERTEX_ARRAY_LENGTH) warnOnce(`Max vertices per segment is ${SegmentVector.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${numVertices}`);\n if (!segment || segment.vertexLength + numVertices > SegmentVector.MAX_VERTEX_ARRAY_LENGTH) {\n segment = ({\n vertexOffset: layoutVertexArray.length,\n primitiveOffset: indexArray.length,\n vertexLength: 0,\n primitiveLength: 0\n }: any);\n this.segments.push(segment);\n }\n return segment;\n }\n\n get() {\n return this.segments;\n }\n\n destroy() {\n for (const segment of this.segments) {\n for (const k in segment.vaos) {\n segment.vaos[k].destroy();\n }\n }\n }\n}\n\n/*\n * The maximum size of a vertex array. This limit is imposed by WebGL's 16 bit\n * addressing of vertex buffers.\n * @private\n * @readonly\n */\nSegmentVector.MAX_VERTEX_ARRAY_LENGTH = Math.pow(2, 16) - 1;\n\nregister('SegmentVector', SegmentVector);\nexport default SegmentVector;\n","// @flow\n\nimport { clamp } from '../util/util';\n\n/**\n * Packs two numbers, interpreted as 8-bit unsigned integers, into a single\n * float. Unpack them in the shader using the `unpack_float()` function,\n * defined in _prelude.vertex.glsl\n *\n * @private\n */\nexport const packUint8ToFloat = function pack(a: number, b: number) {\n // coerce a and b to 8-bit ints\n a = clamp(Math.floor(a), 0, 255);\n b = clamp(Math.floor(b), 0, 255);\n return 256 * a + b;\n};\n\n","// @flow\n\nimport { packUint8ToFloat } from '../shaders/encode_attribute';\nimport Color from '../style-spec/util/color';\nimport { register } from '../util/web_worker_transfer';\nimport { PossiblyEvaluatedPropertyValue } from '../style/properties';\nimport { StructArrayLayout1f4, StructArrayLayout2f8, StructArrayLayout4f16 } from './array_types';\nimport EvaluationParameters from '../style/evaluation_parameters';\n\nimport type Context from '../gl/context';\nimport type {TypedStyleLayer} from '../style/style_layer/typed_style_layer';\nimport type {StructArray, StructArrayMember} from '../util/struct_array';\nimport type VertexBuffer from '../gl/vertex_buffer';\nimport type Program from '../render/program';\nimport type {\n Feature,\n GlobalProperties,\n SourceExpression,\n CompositeExpression\n} from '../style-spec/expression';\nimport type {PossiblyEvaluated} from '../style/properties';\n\nfunction packColor(color: Color): [number, number] {\n return [\n packUint8ToFloat(255 * color.r, 255 * color.g),\n packUint8ToFloat(255 * color.b, 255 * color.a)\n ];\n}\n\n/**\n * `Binder` is the interface definition for the strategies for constructing,\n * uploading, and binding paint property data as GLSL attributes.\n *\n * It has three implementations, one for each of the three strategies we use:\n *\n * * For _constant_ properties -- those whose value is a constant, or the constant\n * result of evaluating a camera expression at a particular camera position -- we\n * don't need a vertex buffer, and instead use a uniform.\n * * For data expressions, we use a vertex buffer with a single attribute value,\n * the evaluated result of the source function for the given feature.\n * * For composite expressions, we use a vertex buffer with two attributes: min and\n * max values covering the range of zooms at which we expect the tile to be\n * displayed. These values are calculated by evaluating the composite expression for\n * the given feature at strategically chosen zoom levels. In addition to this\n * attribute data, we also use a uniform value which the shader uses to interpolate\n * between the min and max value at the final displayed zoom level. The use of a\n * uniform allows us to cheaply update the value on every frame.\n *\n * Note that the shader source varies depending on whether we're using a uniform or\n * attribute. We dynamically compile shaders at runtime to accomodate this.\n *\n * @private\n */\ninterface Binder {\n statistics: { max: number };\n\n populatePaintArray(length: number, feature: Feature): void;\n upload(Context): void;\n destroy(): void;\n\n defines(): Array;\n\n setUniforms(context: Context,\n program: Program,\n globals: GlobalProperties,\n currentValue: PossiblyEvaluatedPropertyValue): void;\n}\n\nclass ConstantBinder implements Binder {\n value: T;\n name: string;\n type: string;\n statistics: { max: number };\n\n constructor(value: T, name: string, type: string) {\n this.value = value;\n this.name = name;\n this.type = type;\n this.statistics = { max: -Infinity };\n }\n\n defines() {\n return [`#define HAS_UNIFORM_u_${this.name}`];\n }\n\n populatePaintArray() {}\n upload() {}\n destroy() {}\n\n setUniforms(context: Context,\n program: Program,\n globals: GlobalProperties,\n currentValue: PossiblyEvaluatedPropertyValue) {\n const value: any = currentValue.constantOr(this.value);\n const gl = context.gl;\n if (this.type === 'color') {\n gl.uniform4f(program.uniforms[`u_${this.name}`], value.r, value.g, value.b, value.a);\n } else {\n gl.uniform1f(program.uniforms[`u_${this.name}`], value);\n }\n }\n}\n\nclass SourceExpressionBinder implements Binder {\n expression: SourceExpression;\n name: string;\n type: string;\n statistics: { max: number };\n\n paintVertexArray: StructArray;\n paintVertexAttributes: Array;\n paintVertexBuffer: ?VertexBuffer;\n\n constructor(expression: SourceExpression, name: string, type: string) {\n this.expression = expression;\n this.name = name;\n this.type = type;\n this.statistics = { max: -Infinity };\n const PaintVertexArray = type === 'color' ? StructArrayLayout2f8 : StructArrayLayout1f4;\n this.paintVertexAttributes = [{\n name: `a_${name}`,\n type: 'Float32',\n components: type === 'color' ? 2 : 1,\n offset: 0\n }];\n this.paintVertexArray = new PaintVertexArray();\n }\n\n defines() {\n return [];\n }\n\n populatePaintArray(length: number, feature: Feature) {\n const paintArray = this.paintVertexArray;\n\n const start = paintArray.length;\n paintArray.reserve(length);\n\n const value = this.expression.evaluate(new EvaluationParameters(0), feature);\n\n if (this.type === 'color') {\n const color = packColor(value);\n for (let i = start; i < length; i++) {\n paintArray.emplaceBack(color[0], color[1]);\n }\n } else {\n for (let i = start; i < length; i++) {\n paintArray.emplaceBack(value);\n }\n\n this.statistics.max = Math.max(this.statistics.max, value);\n }\n }\n\n upload(context: Context) {\n if (this.paintVertexArray) {\n this.paintVertexBuffer = context.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes);\n }\n }\n\n destroy() {\n if (this.paintVertexBuffer) {\n this.paintVertexBuffer.destroy();\n }\n }\n\n setUniforms(context: Context, program: Program) {\n context.gl.uniform1f(program.uniforms[`a_${this.name}_t`], 0);\n }\n}\n\nclass CompositeExpressionBinder implements Binder {\n expression: CompositeExpression;\n name: string;\n type: string;\n useIntegerZoom: boolean;\n zoom: number;\n statistics: { max: number };\n\n paintVertexArray: StructArray;\n paintVertexAttributes: Array;\n paintVertexBuffer: ?VertexBuffer;\n\n constructor(expression: CompositeExpression, name: string, type: string, useIntegerZoom: boolean, zoom: number) {\n this.expression = expression;\n this.name = name;\n this.type = type;\n this.useIntegerZoom = useIntegerZoom;\n this.zoom = zoom;\n this.statistics = { max: -Infinity };\n const PaintVertexArray = type === 'color' ? StructArrayLayout4f16 : StructArrayLayout2f8;\n this.paintVertexAttributes = [{\n name: `a_${name}`,\n type: 'Float32',\n components: type === 'color' ? 4 : 2,\n offset: 0\n }];\n this.paintVertexArray = new PaintVertexArray();\n }\n\n defines() {\n return [];\n }\n\n populatePaintArray(length: number, feature: Feature) {\n const paintArray = this.paintVertexArray;\n\n const start = paintArray.length;\n paintArray.reserve(length);\n\n const min = this.expression.evaluate(new EvaluationParameters(this.zoom), feature);\n const max = this.expression.evaluate(new EvaluationParameters(this.zoom + 1), feature);\n\n if (this.type === 'color') {\n const minColor = packColor(min);\n const maxColor = packColor(max);\n for (let i = start; i < length; i++) {\n paintArray.emplaceBack(minColor[0], minColor[1], maxColor[0], maxColor[1]);\n }\n } else {\n for (let i = start; i < length; i++) {\n paintArray.emplaceBack(min, max);\n }\n\n this.statistics.max = Math.max(this.statistics.max, min, max);\n }\n }\n\n upload(context: Context) {\n if (this.paintVertexArray) {\n this.paintVertexBuffer = context.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes);\n }\n }\n\n destroy() {\n if (this.paintVertexBuffer) {\n this.paintVertexBuffer.destroy();\n }\n }\n\n interpolationFactor(currentZoom: number) {\n if (this.useIntegerZoom) {\n return this.expression.interpolationFactor(Math.floor(currentZoom), this.zoom, this.zoom + 1);\n } else {\n return this.expression.interpolationFactor(currentZoom, this.zoom, this.zoom + 1);\n }\n }\n\n setUniforms(context: Context, program: Program, globals: GlobalProperties) {\n context.gl.uniform1f(program.uniforms[`a_${this.name}_t`], this.interpolationFactor(globals.zoom));\n }\n}\n\n/**\n * ProgramConfiguration contains the logic for binding style layer properties and tile\n * layer feature data into GL program uniforms and vertex attributes.\n *\n * Non-data-driven property values are bound to shader uniforms. Data-driven property\n * values are bound to vertex attributes. In order to support a uniform GLSL syntax over\n * both, [Mapbox GL Shaders](https://github.com/mapbox/mapbox-gl-shaders) defines a `#pragma`\n * abstraction, which ProgramConfiguration is responsible for implementing. At runtime,\n * it examines the attributes of a particular layer, combines this with fixed knowledge\n * about how layers of the particular type are implemented, and determines which uniforms\n * and vertex attributes will be required. It can then substitute the appropriate text\n * into the shader source code, create and link a program, and bind the uniforms and\n * vertex attributes in preparation for drawing.\n *\n * When a vector tile is parsed, this same configuration information is used to\n * populate the attribute buffers needed for data-driven styling using the zoom\n * level and feature property data.\n *\n * @private\n */\nexport default class ProgramConfiguration {\n binders: { [string]: Binder };\n cacheKey: string;\n layoutAttributes: Array;\n\n _buffers: Array;\n\n constructor() {\n this.binders = {};\n this.cacheKey = '';\n\n this._buffers = [];\n }\n\n static createDynamic(layer: Layer, zoom: number, filterProperties: (string) => boolean) {\n const self = new ProgramConfiguration();\n const keys = [];\n\n for (const property in layer.paint._values) {\n if (!filterProperties(property)) continue;\n const value = layer.paint.get(property);\n if (!(value instanceof PossiblyEvaluatedPropertyValue) || !value.property.specification['property-function']) {\n continue;\n }\n const name = paintAttributeName(property, layer.type);\n const type = value.property.specification.type;\n const useIntegerZoom = value.property.useIntegerZoom;\n\n if (value.value.kind === 'constant') {\n self.binders[property] = new ConstantBinder(value.value, name, type);\n keys.push(`/u_${name}`);\n } else if (value.value.kind === 'source') {\n self.binders[property] = new SourceExpressionBinder(value.value, name, type);\n keys.push(`/a_${name}`);\n } else {\n self.binders[property] = new CompositeExpressionBinder(value.value, name, type, useIntegerZoom, zoom);\n keys.push(`/z_${name}`);\n }\n }\n\n self.cacheKey = keys.sort().join('');\n\n return self;\n }\n\n populatePaintArrays(length: number, feature: Feature) {\n for (const property in this.binders) {\n this.binders[property].populatePaintArray(length, feature);\n }\n }\n\n defines(): Array {\n const result = [];\n for (const property in this.binders) {\n result.push.apply(result, this.binders[property].defines());\n }\n return result;\n }\n\n setUniforms(context: Context, program: Program, properties: PossiblyEvaluated, globals: GlobalProperties) {\n for (const property in this.binders) {\n const binder = this.binders[property];\n binder.setUniforms(context, program, globals, properties.get(property));\n }\n }\n\n getPaintVertexBuffers(): Array {\n return this._buffers;\n }\n\n upload(context: Context) {\n for (const property in this.binders) {\n this.binders[property].upload(context);\n }\n\n const buffers = [];\n for (const property in this.binders) {\n const binder = this.binders[property];\n if ((binder instanceof SourceExpressionBinder ||\n binder instanceof CompositeExpressionBinder) &&\n binder.paintVertexBuffer\n ) {\n buffers.push(binder.paintVertexBuffer);\n }\n }\n this._buffers = buffers;\n }\n\n destroy() {\n for (const property in this.binders) {\n this.binders[property].destroy();\n }\n }\n}\n\nexport class ProgramConfigurationSet {\n programConfigurations: {[string]: ProgramConfiguration};\n\n constructor(layoutAttributes: Array, layers: $ReadOnlyArray, zoom: number, filterProperties: (string) => boolean = () => true) {\n this.programConfigurations = {};\n for (const layer of layers) {\n this.programConfigurations[layer.id] = ProgramConfiguration.createDynamic(layer, zoom, filterProperties);\n this.programConfigurations[layer.id].layoutAttributes = layoutAttributes;\n }\n }\n\n populatePaintArrays(length: number, feature: Feature) {\n for (const key in this.programConfigurations) {\n this.programConfigurations[key].populatePaintArrays(length, feature);\n }\n }\n\n get(layerId: string) {\n return this.programConfigurations[layerId];\n }\n\n upload(context: Context) {\n for (const layerId in this.programConfigurations) {\n this.programConfigurations[layerId].upload(context);\n }\n }\n\n destroy() {\n for (const layerId in this.programConfigurations) {\n this.programConfigurations[layerId].destroy();\n }\n }\n}\n\n// paint property arrays\nfunction paintAttributeName(property, type) {\n const attributeNameExceptions = {\n 'text-opacity': 'opacity',\n 'icon-opacity': 'opacity',\n 'text-color': 'fill_color',\n 'icon-color': 'fill_color',\n 'text-halo-color': 'halo_color',\n 'icon-halo-color': 'halo_color',\n 'text-halo-blur': 'halo_blur',\n 'icon-halo-blur': 'halo_blur',\n 'text-halo-width': 'halo_width',\n 'icon-halo-width': 'halo_width',\n 'line-gap-width': 'gapwidth'\n };\n return attributeNameExceptions[property] ||\n property.replace(`${type}-`, '').replace(/-/g, '_');\n}\n\nregister('ConstantBinder', ConstantBinder);\nregister('SourceExpressionBinder', SourceExpressionBinder);\nregister('CompositeExpressionBinder', CompositeExpressionBinder);\nregister('ProgramConfiguration', ProgramConfiguration, {omit: ['_buffers']});\nregister('ProgramConfigurationSet', ProgramConfigurationSet);\n","// @flow\n\n/**\n * The maximum value of a coordinate in the internal tile coordinate system. Coordinates of\n * all source features normalized to this extent upon load.\n *\n * The value is a consequence of the following:\n *\n * * Vertex buffer store positions as signed 16 bit integers.\n * * One bit is lost for signedness to support tile buffers.\n * * One bit is lost because the line vertex buffer used to pack 1 bit of other data into the int.\n * This is no longer the case but we're reserving this bit anyway.\n * * One bit is lost to support features extending past the extent on the right edge of the tile.\n * * This leaves us with 2^13 = 8192\n *\n * @private\n * @readonly\n */\nexport default 8192;\n","// @flow\n\nimport { warnOnce } from '../util/util';\n\nimport EXTENT from './extent';\n\nimport type Point from '@mapbox/point-geometry';\n\n// These bounds define the minimum and maximum supported coordinate values.\n// While visible coordinates are within [0, EXTENT], tiles may theoretically\n// contain cordinates within [-Infinity, Infinity]. Our range is limited by the\n// number of bits used to represent the coordinate.\nfunction createBounds(bits) {\n return {\n min: -1 * Math.pow(2, bits - 1),\n max: Math.pow(2, bits - 1) - 1\n };\n}\n\nconst bounds = createBounds(16);\n\n/**\n * Loads a geometry from a VectorTileFeature and scales it to the common extent\n * used internally.\n * @param {VectorTileFeature} feature\n * @private\n */\nexport default function loadGeometry(feature: VectorTileFeature): Array> {\n const scale = EXTENT / feature.extent;\n const geometry = feature.loadGeometry();\n for (let r = 0; r < geometry.length; r++) {\n const ring = geometry[r];\n for (let p = 0; p < ring.length; p++) {\n const point = ring[p];\n // round here because mapbox-gl-native uses integers to represent\n // points and we need to do the same to avoid renering differences.\n point.x = Math.round(point.x * scale);\n point.y = Math.round(point.y * scale);\n\n if (point.x < bounds.min || point.x > bounds.max || point.y < bounds.min || point.y > bounds.max) {\n warnOnce('Geometry exceeds allowed extent, reduce your vector tile buffer size');\n }\n }\n }\n return geometry;\n}\n","// @flow\n\nimport { CircleLayoutArray } from '../array_types';\n\nimport { members as layoutAttributes } from './circle_attributes';\nimport SegmentVector from '../segment';\nimport { ProgramConfigurationSet } from '../program_configuration';\nimport { TriangleIndexArray } from '../index_array_type';\nimport loadGeometry from '../load_geometry';\nimport EXTENT from '../extent';\nimport { register } from '../../util/web_worker_transfer';\nimport EvaluationParameters from '../../style/evaluation_parameters';\n\nimport type {\n Bucket,\n BucketParameters,\n IndexedFeature,\n PopulateParameters\n} from '../bucket';\nimport type CircleStyleLayer from '../../style/style_layer/circle_style_layer';\nimport type HeatmapStyleLayer from '../../style/style_layer/heatmap_style_layer';\nimport type Context from '../../gl/context';\nimport type IndexBuffer from '../../gl/index_buffer';\nimport type VertexBuffer from '../../gl/vertex_buffer';\nimport type Point from '@mapbox/point-geometry';\n\nfunction addCircleVertex(layoutVertexArray, x, y, extrudeX, extrudeY) {\n layoutVertexArray.emplaceBack(\n (x * 2) + ((extrudeX + 1) / 2),\n (y * 2) + ((extrudeY + 1) / 2));\n}\n\n\n/**\n * Circles are represented by two triangles.\n *\n * Each corner has a pos that is the center of the circle and an extrusion\n * vector that is where it points.\n * @private\n */\nclass CircleBucket implements Bucket {\n index: number;\n zoom: number;\n overscaling: number;\n layerIds: Array;\n layers: Array;\n\n layoutVertexArray: CircleLayoutArray;\n layoutVertexBuffer: VertexBuffer;\n\n indexArray: TriangleIndexArray;\n indexBuffer: IndexBuffer;\n\n programConfigurations: ProgramConfigurationSet;\n segments: SegmentVector;\n uploaded: boolean;\n\n constructor(options: BucketParameters) {\n this.zoom = options.zoom;\n this.overscaling = options.overscaling;\n this.layers = options.layers;\n this.layerIds = this.layers.map(layer => layer.id);\n this.index = options.index;\n\n this.layoutVertexArray = new CircleLayoutArray();\n this.indexArray = new TriangleIndexArray();\n this.segments = new SegmentVector();\n this.programConfigurations = new ProgramConfigurationSet(layoutAttributes, options.layers, options.zoom);\n }\n\n populate(features: Array, options: PopulateParameters) {\n for (const {feature, index, sourceLayerIndex} of features) {\n if (this.layers[0]._featureFilter(new EvaluationParameters(this.zoom), feature)) {\n const geometry = loadGeometry(feature);\n this.addFeature(feature, geometry);\n options.featureIndex.insert(feature, geometry, index, sourceLayerIndex, this.index);\n }\n }\n }\n\n isEmpty() {\n return this.layoutVertexArray.length === 0;\n }\n\n upload(context: Context) {\n this.layoutVertexBuffer = context.createVertexBuffer(this.layoutVertexArray, layoutAttributes);\n this.indexBuffer = context.createIndexBuffer(this.indexArray);\n this.programConfigurations.upload(context);\n }\n\n destroy() {\n if (!this.layoutVertexBuffer) return;\n this.layoutVertexBuffer.destroy();\n this.indexBuffer.destroy();\n this.programConfigurations.destroy();\n this.segments.destroy();\n }\n\n addFeature(feature: VectorTileFeature, geometry: Array>) {\n for (const ring of geometry) {\n for (const point of ring) {\n const x = point.x;\n const y = point.y;\n\n // Do not include points that are outside the tile boundaries.\n if (x < 0 || x >= EXTENT || y < 0 || y >= EXTENT) continue;\n\n // this geometry will be of the Point type, and we'll derive\n // two triangles from it.\n //\n // ┌─────────┐\n // │ 3 2 │\n // │ │\n // │ 0 1 │\n // └─────────┘\n\n const segment = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray);\n const index = segment.vertexLength;\n\n addCircleVertex(this.layoutVertexArray, x, y, -1, -1);\n addCircleVertex(this.layoutVertexArray, x, y, 1, -1);\n addCircleVertex(this.layoutVertexArray, x, y, 1, 1);\n addCircleVertex(this.layoutVertexArray, x, y, -1, 1);\n\n this.indexArray.emplaceBack(index, index + 1, index + 2);\n this.indexArray.emplaceBack(index, index + 3, index + 2);\n\n segment.vertexLength += 4;\n segment.primitiveLength += 2;\n }\n }\n\n this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, feature);\n }\n}\n\nregister('CircleBucket', CircleBucket, {omit: ['layers']});\n\nexport default CircleBucket;\n","// @flow\n\nimport { isCounterClockwise } from './util';\n\nimport type Point from '@mapbox/point-geometry';\n\nexport { multiPolygonIntersectsBufferedPoint, multiPolygonIntersectsBufferedMultiPoint, multiPolygonIntersectsMultiPolygon, multiPolygonIntersectsBufferedMultiLine, polygonIntersectsPolygon, distToSegmentSquared };\n\ntype Line = Array;\ntype MultiLine = Array;\ntype Ring = Array;\ntype Polygon = Array;\ntype MultiPolygon = Array;\n\nfunction polygonIntersectsPolygon(polygonA: Polygon, polygonB: Polygon) {\n for (let i = 0; i < polygonA.length; i++) {\n if (polygonContainsPoint(polygonB, polygonA[i])) return true;\n }\n\n for (let i = 0; i < polygonB.length; i++) {\n if (polygonContainsPoint(polygonA, polygonB[i])) return true;\n }\n\n if (lineIntersectsLine(polygonA, polygonB)) return true;\n\n return false;\n}\n\nfunction multiPolygonIntersectsBufferedPoint(multiPolygon: MultiPolygon, point: Point, radius: number) {\n for (let j = 0; j < multiPolygon.length; j++) {\n const polygon = multiPolygon[j];\n if (polygonContainsPoint(polygon, point)) return true;\n if (pointIntersectsBufferedLine(point, polygon, radius)) return true;\n }\n return false;\n}\n\nfunction multiPolygonIntersectsBufferedMultiPoint(multiPolygon: MultiPolygon, rings: Array, radius: number) {\n for (let i = 0; i < rings.length; i++) {\n const ring = rings[i];\n for (let k = 0; k < ring.length; k++) {\n if (multiPolygonIntersectsBufferedPoint(multiPolygon, ring[k], radius)) return true;\n }\n }\n return false;\n}\n\nfunction multiPolygonIntersectsMultiPolygon(multiPolygonA: MultiPolygon, multiPolygonB: MultiPolygon) {\n\n if (multiPolygonA.length === 1 && multiPolygonA[0].length === 1) {\n return multiPolygonContainsPoint(multiPolygonB, multiPolygonA[0][0]);\n }\n\n for (let m = 0; m < multiPolygonB.length; m++) {\n const ring = multiPolygonB[m];\n for (let n = 0; n < ring.length; n++) {\n if (multiPolygonContainsPoint(multiPolygonA, ring[n])) return true;\n }\n }\n\n for (let j = 0; j < multiPolygonA.length; j++) {\n const polygon = multiPolygonA[j];\n for (let i = 0; i < polygon.length; i++) {\n if (multiPolygonContainsPoint(multiPolygonB, polygon[i])) return true;\n }\n\n for (let k = 0; k < multiPolygonB.length; k++) {\n if (lineIntersectsLine(polygon, multiPolygonB[k])) return true;\n }\n }\n\n return false;\n}\n\nfunction multiPolygonIntersectsBufferedMultiLine(multiPolygon: MultiPolygon, multiLine: MultiLine, radius: number) {\n for (let i = 0; i < multiLine.length; i++) {\n const line = multiLine[i];\n\n for (let j = 0; j < multiPolygon.length; j++) {\n const polygon = multiPolygon[j];\n\n if (polygon.length >= 3) {\n for (let k = 0; k < line.length; k++) {\n if (polygonContainsPoint(polygon, line[k])) return true;\n }\n }\n\n if (lineIntersectsBufferedLine(polygon, line, radius)) return true;\n }\n }\n return false;\n}\n\nfunction lineIntersectsBufferedLine(lineA: Line, lineB: Line, radius: number) {\n\n if (lineA.length > 1) {\n if (lineIntersectsLine(lineA, lineB)) return true;\n\n // Check whether any point in either line is within radius of the other line\n for (let j = 0; j < lineB.length; j++) {\n if (pointIntersectsBufferedLine(lineB[j], lineA, radius)) return true;\n }\n }\n\n for (let k = 0; k < lineA.length; k++) {\n if (pointIntersectsBufferedLine(lineA[k], lineB, radius)) return true;\n }\n\n return false;\n}\n\nfunction lineIntersectsLine(lineA: Line, lineB: Line) {\n if (lineA.length === 0 || lineB.length === 0) return false;\n for (let i = 0; i < lineA.length - 1; i++) {\n const a0 = lineA[i];\n const a1 = lineA[i + 1];\n for (let j = 0; j < lineB.length - 1; j++) {\n const b0 = lineB[j];\n const b1 = lineB[j + 1];\n if (lineSegmentIntersectsLineSegment(a0, a1, b0, b1)) return true;\n }\n }\n return false;\n}\n\nfunction lineSegmentIntersectsLineSegment(a0: Point, a1: Point, b0: Point, b1: Point) {\n return isCounterClockwise(a0, b0, b1) !== isCounterClockwise(a1, b0, b1) &&\n isCounterClockwise(a0, a1, b0) !== isCounterClockwise(a0, a1, b1);\n}\n\nfunction pointIntersectsBufferedLine(p: Point, line: Line, radius: number) {\n const radiusSquared = radius * radius;\n\n if (line.length === 1) return p.distSqr(line[0]) < radiusSquared;\n\n for (let i = 1; i < line.length; i++) {\n // Find line segments that have a distance <= radius^2 to p\n // In that case, we treat the line as \"containing point p\".\n const v = line[i - 1], w = line[i];\n if (distToSegmentSquared(p, v, w) < radiusSquared) return true;\n }\n return false;\n}\n\n// Code from http://stackoverflow.com/a/1501725/331379.\nfunction distToSegmentSquared(p: Point, v: Point, w: Point) {\n const l2 = v.distSqr(w);\n if (l2 === 0) return p.distSqr(v);\n const t = ((p.x - v.x) * (w.x - v.x) + (p.y - v.y) * (w.y - v.y)) / l2;\n if (t < 0) return p.distSqr(v);\n if (t > 1) return p.distSqr(w);\n return p.distSqr(w.sub(v)._mult(t)._add(v));\n}\n\n// point in polygon ray casting algorithm\nfunction multiPolygonContainsPoint(rings: Array, p: Point) {\n let c = false,\n ring, p1, p2;\n\n for (let k = 0; k < rings.length; k++) {\n ring = rings[k];\n for (let i = 0, j = ring.length - 1; i < ring.length; j = i++) {\n p1 = ring[i];\n p2 = ring[j];\n if (((p1.y > p.y) !== (p2.y > p.y)) && (p.x < (p2.x - p1.x) * (p.y - p1.y) / (p2.y - p1.y) + p1.x)) {\n c = !c;\n }\n }\n }\n return c;\n}\n\nfunction polygonContainsPoint(ring: Ring, p: Point) {\n let c = false;\n for (let i = 0, j = ring.length - 1; i < ring.length; j = i++) {\n const p1 = ring[i];\n const p2 = ring[j];\n if (((p1.y > p.y) !== (p2.y > p.y)) && (p.x < (p2.x - p1.x) * (p.y - p1.y) / (p2.y - p1.y) + p1.x)) {\n c = !c;\n }\n }\n return c;\n}\n","// @flow\n\nimport Point from '@mapbox/point-geometry';\n\nimport type {PossiblyEvaluatedPropertyValue} from \"./properties\";\nimport type StyleLayer from '../style/style_layer';\nimport type CircleBucket from '../data/bucket/circle_bucket';\nimport type LineBucket from '../data/bucket/line_bucket';\n\nexport function getMaximumPaintValue(property: string, layer: StyleLayer, bucket: CircleBucket<*> | LineBucket): number {\n const value = ((layer.paint: any).get(property): PossiblyEvaluatedPropertyValue).value;\n if (value.kind === 'constant') {\n return value.value;\n } else {\n const binders = bucket.programConfigurations.get(layer.id).binders;\n return binders[property].statistics.max;\n }\n}\n\nexport function translateDistance(translate: [number, number]) {\n return Math.sqrt(translate[0] * translate[0] + translate[1] * translate[1]);\n}\n\nexport function translate(queryGeometry: Array>,\n translate: [number, number],\n translateAnchor: 'viewport' | 'map',\n bearing: number,\n pixelsToTileUnits: number) {\n if (!translate[0] && !translate[1]) {\n return queryGeometry;\n }\n\n const pt = Point.convert(translate);\n\n if (translateAnchor === \"viewport\") {\n pt._rotate(-bearing);\n }\n\n const translated = [];\n for (let i = 0; i < queryGeometry.length; i++) {\n const ring = queryGeometry[i];\n const translatedRing = [];\n for (let k = 0; k < ring.length; k++) {\n translatedRing.push(ring[k].sub(pt._mult(pixelsToTileUnits)));\n }\n translated.push(translatedRing);\n }\n return translated;\n}\n","// This file is generated. Edit build/generate-style-code.js, then run `yarn run codegen`.\n// @flow\n/* eslint-disable */\n\nimport styleSpec from '../../style-spec/reference/latest';\n\nimport {\n Properties,\n DataConstantProperty,\n DataDrivenProperty,\n CrossFadedProperty,\n ColorRampProperty\n} from '../properties';\n\nimport type Color from '../../style-spec/util/color';\n\n\nexport type PaintProps = {|\n \"circle-radius\": DataDrivenProperty,\n \"circle-color\": DataDrivenProperty,\n \"circle-blur\": DataDrivenProperty,\n \"circle-opacity\": DataDrivenProperty,\n \"circle-translate\": DataConstantProperty<[number, number]>,\n \"circle-translate-anchor\": DataConstantProperty<\"map\" | \"viewport\">,\n \"circle-pitch-scale\": DataConstantProperty<\"map\" | \"viewport\">,\n \"circle-pitch-alignment\": DataConstantProperty<\"map\" | \"viewport\">,\n \"circle-stroke-width\": DataDrivenProperty,\n \"circle-stroke-color\": DataDrivenProperty,\n \"circle-stroke-opacity\": DataDrivenProperty,\n|};\n\nconst paint: Properties = new Properties({\n \"circle-radius\": new DataDrivenProperty(styleSpec[\"paint_circle\"][\"circle-radius\"]),\n \"circle-color\": new DataDrivenProperty(styleSpec[\"paint_circle\"][\"circle-color\"]),\n \"circle-blur\": new DataDrivenProperty(styleSpec[\"paint_circle\"][\"circle-blur\"]),\n \"circle-opacity\": new DataDrivenProperty(styleSpec[\"paint_circle\"][\"circle-opacity\"]),\n \"circle-translate\": new DataConstantProperty(styleSpec[\"paint_circle\"][\"circle-translate\"]),\n \"circle-translate-anchor\": new DataConstantProperty(styleSpec[\"paint_circle\"][\"circle-translate-anchor\"]),\n \"circle-pitch-scale\": new DataConstantProperty(styleSpec[\"paint_circle\"][\"circle-pitch-scale\"]),\n \"circle-pitch-alignment\": new DataConstantProperty(styleSpec[\"paint_circle\"][\"circle-pitch-alignment\"]),\n \"circle-stroke-width\": new DataDrivenProperty(styleSpec[\"paint_circle\"][\"circle-stroke-width\"]),\n \"circle-stroke-color\": new DataDrivenProperty(styleSpec[\"paint_circle\"][\"circle-stroke-color\"]),\n \"circle-stroke-opacity\": new DataDrivenProperty(styleSpec[\"paint_circle\"][\"circle-stroke-opacity\"]),\n});\n\nexport default { paint };\n","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global.glMatrix = factory());\n}(this, (function () { 'use strict';\n\nfunction create() {\n var out = new Float32Array(3);\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n return out;\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfunction transformMat3(out, a, m) {\n var x = a[0], y = a[1], z = a[2];\n out[0] = x * m[0] + y * m[3] + z * m[6];\n out[1] = x * m[1] + y * m[4] + z * m[7];\n out[2] = x * m[2] + y * m[5] + z * m[8];\n return out;\n}\n\n\n\n\nvar vec = create();\n\nfunction create$1() {\n var out = new Float32Array(4);\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n return out;\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\nfunction scale$1(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n return out;\n}\n\n\n\n\n\n\n\nfunction normalize$1(out, a) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n var len = x * x + y * y + z * z + w * w;\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n out[0] = x * len;\n out[1] = y * len;\n out[2] = z * len;\n out[3] = w * len;\n }\n return out;\n}\n\n\n\nfunction transformMat4$1(out, a, m) {\n var x = a[0], y = a[1], z = a[2], w = a[3];\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n return out;\n}\n\nvar vec$1 = create$1();\n\nfunction create$2() {\n var out = new Float32Array(4);\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n}\n\n\n\n\n\n\n\n\n\n\nfunction rotate(out, a, rad) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3],\n s = Math.sin(rad),\n c = Math.cos(rad);\n out[0] = a0 * c + a2 * s;\n out[1] = a1 * c + a3 * s;\n out[2] = a0 * -s + a2 * c;\n out[3] = a1 * -s + a3 * c;\n return out;\n}\nfunction scale$2(out, a, v) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3],\n v0 = v[0], v1 = v[1];\n out[0] = a0 * v0;\n out[1] = a1 * v0;\n out[2] = a2 * v1;\n out[3] = a3 * v1;\n return out;\n}\n\nfunction create$3() {\n var out = new Float32Array(9);\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfunction fromRotation$1(out, rad) {\n var s = Math.sin(rad), c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n out[3] = -s;\n out[4] = c;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n\nfunction create$4() {\n var out = new Float32Array(16);\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n\n\n\n\nfunction identity$2(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n\nfunction invert$2(out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\n return out;\n}\n\n\nfunction multiply$4(out, a, b) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];\n var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3];\n out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[4]; b1 = b[5]; b2 = b[6]; b3 = b[7];\n out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[8]; b1 = b[9]; b2 = b[10]; b3 = b[11];\n out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[12]; b1 = b[13]; b2 = b[14]; b3 = b[15];\n out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n return out;\n}\nfunction translate$1(out, a, v) {\n var x = v[0], y = v[1], z = v[2],\n a00, a01, a02, a03,\n a10, a11, a12, a13,\n a20, a21, a22, a23;\n if (a === out) {\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n } else {\n a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3];\n a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7];\n a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11];\n out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a03;\n out[4] = a10; out[5] = a11; out[6] = a12; out[7] = a13;\n out[8] = a20; out[9] = a21; out[10] = a22; out[11] = a23;\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\n }\n return out;\n}\nfunction scale$4(out, a, v) {\n var x = v[0], y = v[1], z = v[2];\n out[0] = a[0] * x;\n out[1] = a[1] * x;\n out[2] = a[2] * x;\n out[3] = a[3] * x;\n out[4] = a[4] * y;\n out[5] = a[5] * y;\n out[6] = a[6] * y;\n out[7] = a[7] * y;\n out[8] = a[8] * z;\n out[9] = a[9] * z;\n out[10] = a[10] * z;\n out[11] = a[11] * z;\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n\nfunction rotateX$1(out, a, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad),\n a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7],\n a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n if (a !== out) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n out[4] = a10 * c + a20 * s;\n out[5] = a11 * c + a21 * s;\n out[6] = a12 * c + a22 * s;\n out[7] = a13 * c + a23 * s;\n out[8] = a20 * c - a10 * s;\n out[9] = a21 * c - a11 * s;\n out[10] = a22 * c - a12 * s;\n out[11] = a23 * c - a13 * s;\n return out;\n}\n\nfunction rotateZ$1(out, a, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad),\n a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3],\n a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n if (a !== out) {\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n out[0] = a00 * c + a10 * s;\n out[1] = a01 * c + a11 * s;\n out[2] = a02 * c + a12 * s;\n out[3] = a03 * c + a13 * s;\n out[4] = a10 * c - a00 * s;\n out[5] = a11 * c - a01 * s;\n out[6] = a12 * c - a02 * s;\n out[7] = a13 * c - a03 * s;\n return out;\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfunction perspective(out, fovy, aspect, near, far) {\n var f = 1.0 / Math.tan(fovy / 2),\n nf = 1 / (near - far);\n out[0] = f / aspect;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = f;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = (far + near) * nf;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[14] = (2 * far * near) * nf;\n out[15] = 0;\n return out;\n}\n\nfunction ortho(out, left, right, bottom, top, near, far) {\n var lr = 1 / (left - right),\n bt = 1 / (bottom - top),\n nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 2 * nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = (far + near) * nf;\n out[15] = 1;\n return out;\n}\n\nvar mapboxBuild = {\n vec3: {\n transformMat3: transformMat3\n },\n vec4: {\n transformMat4: transformMat4$1\n },\n mat2: {\n create: create$2,\n rotate: rotate,\n scale: scale$2\n },\n mat3: {\n create: create$3,\n fromRotation: fromRotation$1\n },\n mat4: {\n create: create$4,\n identity: identity$2,\n translate: translate$1,\n scale: scale$4,\n multiply: multiply$4,\n perspective: perspective,\n rotateX: rotateX$1,\n rotateZ: rotateZ$1,\n invert: invert$2,\n ortho: ortho\n }\n};\n\nreturn mapboxBuild;\n\n})));\n","// @flow\n\nimport StyleLayer from '../style_layer';\n\nimport CircleBucket from '../../data/bucket/circle_bucket';\nimport { multiPolygonIntersectsBufferedPoint } from '../../util/intersection_tests';\nimport { getMaximumPaintValue, translateDistance, translate } from '../query_utils';\nimport properties from './circle_style_layer_properties';\nimport { Transitionable, Transitioning, PossiblyEvaluated } from '../properties';\nimport {vec4} from '@mapbox/gl-matrix';\nimport Point from '@mapbox/point-geometry';\n\nimport type Transform from '../../geo/transform';\nimport type {Bucket, BucketParameters} from '../../data/bucket';\nimport type {PaintProps} from './circle_style_layer_properties';\n\nclass CircleStyleLayer extends StyleLayer {\n _transitionablePaint: Transitionable;\n _transitioningPaint: Transitioning;\n paint: PossiblyEvaluated;\n\n constructor(layer: LayerSpecification) {\n super(layer, properties);\n }\n\n createBucket(parameters: BucketParameters<*>) {\n return new CircleBucket(parameters);\n }\n\n queryRadius(bucket: Bucket): number {\n const circleBucket: CircleBucket = (bucket: any);\n return getMaximumPaintValue('circle-radius', this, circleBucket) +\n getMaximumPaintValue('circle-stroke-width', this, circleBucket) +\n translateDistance(this.paint.get('circle-translate'));\n }\n\n queryIntersectsFeature(queryGeometry: Array>,\n feature: VectorTileFeature,\n geometry: Array>,\n zoom: number,\n transform: Transform,\n pixelsToTileUnits: number,\n posMatrix: Float32Array): boolean {\n const translatedPolygon = translate(queryGeometry,\n this.paint.get('circle-translate'),\n this.paint.get('circle-translate-anchor'),\n transform.angle, pixelsToTileUnits);\n const radius = this.paint.get('circle-radius').evaluate(feature);\n const stroke = this.paint.get('circle-stroke-width').evaluate(feature);\n const size = radius + stroke;\n\n // For pitch-alignment: map, compare feature geometry to query geometry in the plane of the tile\n // // Otherwise, compare geometry in the plane of the viewport\n // // A circle with fixed scaling relative to the viewport gets larger in tile space as it moves into the distance\n // // A circle with fixed scaling relative to the map gets smaller in viewport space as it moves into the distance\n const alignWithMap = this.paint.get('circle-pitch-alignment') === 'map';\n const transformedPolygon = alignWithMap ? translatedPolygon : projectQueryGeometry(translatedPolygon, posMatrix, transform);\n const transformedSize = alignWithMap ? size * pixelsToTileUnits : size;\n\n for (const ring of geometry) {\n for (const point of ring) {\n\n const transformedPoint = alignWithMap ? point : projectPoint(point, posMatrix, transform);\n\n let adjustedSize = transformedSize;\n const projectedCenter = vec4.transformMat4([], [point.x, point.y, 0, 1], posMatrix);\n if (this.paint.get('circle-pitch-scale') === 'viewport' && this.paint.get('circle-pitch-alignment') === 'map') {\n adjustedSize *= projectedCenter[3] / transform.cameraToCenterDistance;\n } else if (this.paint.get('circle-pitch-scale') === 'map' && this.paint.get('circle-pitch-alignment') === 'viewport') {\n adjustedSize *= transform.cameraToCenterDistance / projectedCenter[3];\n }\n\n if (multiPolygonIntersectsBufferedPoint(transformedPolygon, transformedPoint, adjustedSize)) return true;\n }\n }\n\n return false;\n }\n}\n\nfunction projectPoint(p: Point, posMatrix: Float32Array, transform: Transform) {\n const point = vec4.transformMat4([], [p.x, p.y, 0, 1], posMatrix);\n return new Point(\n (point[0] / point[3] + 1) * transform.width * 0.5,\n (point[1] / point[3] + 1) * transform.height * 0.5);\n}\n\nfunction projectQueryGeometry(queryGeometry: Array>, posMatrix: Float32Array, transform: Transform) {\n return queryGeometry.map((r) => {\n return r.map((p) => {\n return projectPoint(p, posMatrix, transform);\n });\n });\n}\n\nexport default CircleStyleLayer;\n","// @flow\n\nimport CircleBucket from './circle_bucket';\n\nimport { register } from '../../util/web_worker_transfer';\n\nimport type HeatmapStyleLayer from '../../style/style_layer/heatmap_style_layer';\n\nclass HeatmapBucket extends CircleBucket {\n // Needed for flow to accept omit: ['layers'] below, due to\n // https://github.com/facebook/flow/issues/4262\n layers: Array;\n}\n\nregister('HeatmapBucket', HeatmapBucket, {omit: ['layers']});\n\nexport default HeatmapBucket;\n","// @flow\n\nimport assert from 'assert';\n\nimport { register } from './web_worker_transfer';\n\nexport type Size = {\n width: number,\n height: number\n};\n\ntype Point = {\n x: number,\n y: number\n};\n\nfunction createImage(image: *, {width, height}: Size, channels: number, data?: Uint8Array | Uint8ClampedArray) {\n if (!data) {\n data = new Uint8Array(width * height * channels);\n } else if (data.length !== width * height * channels) {\n throw new RangeError('mismatched image size');\n }\n image.width = width;\n image.height = height;\n image.data = data;\n return image;\n}\n\nfunction resizeImage(image: *, {width, height}: Size, channels: number) {\n if (width === image.width && height === image.height) {\n return;\n }\n\n const newImage = createImage({}, {width, height}, channels);\n\n copyImage(image, newImage, {x: 0, y: 0}, {x: 0, y: 0}, {\n width: Math.min(image.width, width),\n height: Math.min(image.height, height)\n }, channels);\n\n image.width = width;\n image.height = height;\n image.data = newImage.data;\n}\n\nfunction copyImage(srcImg: *, dstImg: *, srcPt: Point, dstPt: Point, size: Size, channels: number) {\n if (size.width === 0 || size.height === 0) {\n return dstImg;\n }\n\n if (size.width > srcImg.width ||\n size.height > srcImg.height ||\n srcPt.x > srcImg.width - size.width ||\n srcPt.y > srcImg.height - size.height) {\n throw new RangeError('out of range source coordinates for image copy');\n }\n\n if (size.width > dstImg.width ||\n size.height > dstImg.height ||\n dstPt.x > dstImg.width - size.width ||\n dstPt.y > dstImg.height - size.height) {\n throw new RangeError('out of range destination coordinates for image copy');\n }\n\n const srcData = srcImg.data;\n const dstData = dstImg.data;\n\n assert(srcData !== dstData);\n\n for (let y = 0; y < size.height; y++) {\n const srcOffset = ((srcPt.y + y) * srcImg.width + srcPt.x) * channels;\n const dstOffset = ((dstPt.y + y) * dstImg.width + dstPt.x) * channels;\n for (let i = 0; i < size.width * channels; i++) {\n dstData[dstOffset + i] = srcData[srcOffset + i];\n }\n }\n\n return dstImg;\n}\n\nexport class AlphaImage {\n width: number;\n height: number;\n data: Uint8Array | Uint8ClampedArray;\n\n constructor(size: Size, data?: Uint8Array | Uint8ClampedArray) {\n createImage(this, size, 1, data);\n }\n\n resize(size: Size) {\n resizeImage(this, size, 1);\n }\n\n clone() {\n return new AlphaImage({width: this.width, height: this.height}, new Uint8Array(this.data));\n }\n\n static copy(srcImg: AlphaImage, dstImg: AlphaImage, srcPt: Point, dstPt: Point, size: Size) {\n copyImage(srcImg, dstImg, srcPt, dstPt, size, 1);\n }\n}\n\n// Not premultiplied, because ImageData is not premultiplied.\n// UNPACK_PREMULTIPLY_ALPHA_WEBGL must be used when uploading to a texture.\nexport class RGBAImage {\n width: number;\n height: number;\n data: Uint8Array | Uint8ClampedArray;\n\n constructor(size: Size, data?: Uint8Array | Uint8ClampedArray) {\n createImage(this, size, 4, data);\n }\n\n resize(size: Size) {\n resizeImage(this, size, 4);\n }\n\n clone() {\n return new RGBAImage({width: this.width, height: this.height}, new Uint8Array(this.data));\n }\n\n static copy(srcImg: RGBAImage | ImageData, dstImg: RGBAImage, srcPt: Point, dstPt: Point, size: Size) {\n copyImage(srcImg, dstImg, srcPt, dstPt, size, 4);\n }\n}\n\nregister('AlphaImage', AlphaImage);\nregister('RGBAImage', RGBAImage);\n","// This file is generated. Edit build/generate-style-code.js, then run `yarn run codegen`.\n// @flow\n/* eslint-disable */\n\nimport styleSpec from '../../style-spec/reference/latest';\n\nimport {\n Properties,\n DataConstantProperty,\n DataDrivenProperty,\n CrossFadedProperty,\n ColorRampProperty\n} from '../properties';\n\nimport type Color from '../../style-spec/util/color';\n\n\nexport type PaintProps = {|\n \"heatmap-radius\": DataDrivenProperty,\n \"heatmap-weight\": DataDrivenProperty,\n \"heatmap-intensity\": DataConstantProperty,\n \"heatmap-color\": ColorRampProperty,\n \"heatmap-opacity\": DataConstantProperty,\n|};\n\nconst paint: Properties = new Properties({\n \"heatmap-radius\": new DataDrivenProperty(styleSpec[\"paint_heatmap\"][\"heatmap-radius\"]),\n \"heatmap-weight\": new DataDrivenProperty(styleSpec[\"paint_heatmap\"][\"heatmap-weight\"]),\n \"heatmap-intensity\": new DataConstantProperty(styleSpec[\"paint_heatmap\"][\"heatmap-intensity\"]),\n \"heatmap-color\": new ColorRampProperty(styleSpec[\"paint_heatmap\"][\"heatmap-color\"]),\n \"heatmap-opacity\": new DataConstantProperty(styleSpec[\"paint_heatmap\"][\"heatmap-opacity\"]),\n});\n\nexport default { paint };\n","// @flow\n\nimport { RGBAImage } from './image';\n\nimport type {StylePropertyExpression} from '../style-spec/expression/index';\n\n/**\n * Given an expression that should evaluate to a color ramp, return\n * a 256x1 px RGBA image representing that ramp expression.\n *\n * @private\n */\nexport default function renderColorRamp(expression: StylePropertyExpression, colorRampEvaluationParameter: string): RGBAImage {\n const colorRampData = new Uint8Array(256 * 4);\n const evaluationGlobals = {};\n for (let i = 0, j = 0; i < 256; i++, j += 4) {\n evaluationGlobals[colorRampEvaluationParameter] = i / 255;\n const pxColor = expression.evaluate((evaluationGlobals: any));\n // the colors are being unpremultiplied because Color uses\n // premultiplied values, and the Texture class expects unpremultiplied ones\n colorRampData[j + 0] = Math.floor(pxColor.r * 255 / pxColor.a);\n colorRampData[j + 1] = Math.floor(pxColor.g * 255 / pxColor.a);\n colorRampData[j + 2] = Math.floor(pxColor.b * 255 / pxColor.a);\n colorRampData[j + 3] = Math.floor(pxColor.a * 255);\n }\n\n return new RGBAImage({width: 256, height: 1}, colorRampData);\n}\n","// @flow\n\nimport StyleLayer from '../style_layer';\n\nimport HeatmapBucket from '../../data/bucket/heatmap_bucket';\nimport { RGBAImage } from '../../util/image';\nimport properties from './heatmap_style_layer_properties';\nimport renderColorRamp from '../../util/color_ramp';\nimport { Transitionable, Transitioning, PossiblyEvaluated } from '../properties';\n\nimport type Texture from '../../render/texture';\nimport type Framebuffer from '../../gl/framebuffer';\nimport type {PaintProps} from './heatmap_style_layer_properties';\n\nclass HeatmapStyleLayer extends StyleLayer {\n\n heatmapFbo: ?Framebuffer;\n colorRamp: RGBAImage;\n colorRampTexture: ?Texture;\n\n _transitionablePaint: Transitionable;\n _transitioningPaint: Transitioning;\n paint: PossiblyEvaluated;\n\n createBucket(options: any) {\n return new HeatmapBucket(options);\n }\n\n constructor(layer: LayerSpecification) {\n super(layer, properties);\n\n // make sure color ramp texture is generated for default heatmap color too\n this._updateColorRamp();\n }\n\n setPaintProperty(name: string, value: mixed, options: {validate: boolean}) {\n super.setPaintProperty(name, value, options);\n if (name === 'heatmap-color') {\n this._updateColorRamp();\n }\n }\n\n _updateColorRamp() {\n const expression = this._transitionablePaint._values['heatmap-color'].value.expression;\n this.colorRamp = renderColorRamp(expression, 'heatmapDensity');\n this.colorRampTexture = null;\n }\n\n resize() {\n if (this.heatmapFbo) {\n this.heatmapFbo.destroy();\n this.heatmapFbo = null;\n }\n }\n\n queryRadius(): number {\n return 0;\n }\n\n queryIntersectsFeature(): boolean {\n return false;\n }\n\n hasOffscreenPass() {\n return this.paint.get('heatmap-opacity') !== 0 && this.visibility !== 'none';\n }\n}\n\nexport default HeatmapStyleLayer;\n","// This file is generated. Edit build/generate-style-code.js, then run `yarn run codegen`.\n// @flow\n/* eslint-disable */\n\nimport styleSpec from '../../style-spec/reference/latest';\n\nimport {\n Properties,\n DataConstantProperty,\n DataDrivenProperty,\n CrossFadedProperty,\n ColorRampProperty\n} from '../properties';\n\nimport type Color from '../../style-spec/util/color';\n\n\nexport type PaintProps = {|\n \"hillshade-illumination-direction\": DataConstantProperty,\n \"hillshade-illumination-anchor\": DataConstantProperty<\"map\" | \"viewport\">,\n \"hillshade-exaggeration\": DataConstantProperty,\n \"hillshade-shadow-color\": DataConstantProperty,\n \"hillshade-highlight-color\": DataConstantProperty,\n \"hillshade-accent-color\": DataConstantProperty,\n|};\n\nconst paint: Properties = new Properties({\n \"hillshade-illumination-direction\": new DataConstantProperty(styleSpec[\"paint_hillshade\"][\"hillshade-illumination-direction\"]),\n \"hillshade-illumination-anchor\": new DataConstantProperty(styleSpec[\"paint_hillshade\"][\"hillshade-illumination-anchor\"]),\n \"hillshade-exaggeration\": new DataConstantProperty(styleSpec[\"paint_hillshade\"][\"hillshade-exaggeration\"]),\n \"hillshade-shadow-color\": new DataConstantProperty(styleSpec[\"paint_hillshade\"][\"hillshade-shadow-color\"]),\n \"hillshade-highlight-color\": new DataConstantProperty(styleSpec[\"paint_hillshade\"][\"hillshade-highlight-color\"]),\n \"hillshade-accent-color\": new DataConstantProperty(styleSpec[\"paint_hillshade\"][\"hillshade-accent-color\"]),\n});\n\nexport default { paint };\n","// @flow\n\nimport StyleLayer from '../style_layer';\n\nimport properties from './hillshade_style_layer_properties';\nimport { Transitionable, Transitioning, PossiblyEvaluated } from '../properties';\n\nimport type {PaintProps} from './hillshade_style_layer_properties';\n\nclass HillshadeStyleLayer extends StyleLayer {\n _transitionablePaint: Transitionable;\n _transitioningPaint: Transitioning;\n paint: PossiblyEvaluated;\n\n constructor(layer: LayerSpecification) {\n super(layer, properties);\n }\n\n hasOffscreenPass() {\n return this.paint.get('hillshade-exaggeration') !== 0 && this.visibility !== 'none';\n }\n}\n\nexport default HillshadeStyleLayer;\n","// @flow\nimport { createLayout } from '../../util/struct_array';\n\nconst layout = createLayout([\n {name: 'a_pos', components: 2, type: 'Int16'}\n], 4);\n\nexport default layout;\nexport const {members, size, alignment} = layout;\n","'use strict';\n\nmodule.exports = earcut;\nmodule.exports.default = earcut;\n\nfunction earcut(data, holeIndices, dim) {\n\n dim = dim || 2;\n\n var hasHoles = holeIndices && holeIndices.length,\n outerLen = hasHoles ? holeIndices[0] * dim : data.length,\n outerNode = linkedList(data, 0, outerLen, dim, true),\n triangles = [];\n\n if (!outerNode) return triangles;\n\n var minX, minY, maxX, maxY, x, y, invSize;\n\n if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);\n\n // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n if (data.length > 80 * dim) {\n minX = maxX = data[0];\n minY = maxY = data[1];\n\n for (var i = dim; i < outerLen; i += dim) {\n x = data[i];\n y = data[i + 1];\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n }\n\n // minX, minY and invSize are later used to transform coords into integers for z-order calculation\n invSize = Math.max(maxX - minX, maxY - minY);\n invSize = invSize !== 0 ? 1 / invSize : 0;\n }\n\n earcutLinked(outerNode, triangles, dim, minX, minY, invSize);\n\n return triangles;\n}\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList(data, start, end, dim, clockwise) {\n var i, last;\n\n if (clockwise === (signedArea(data, start, end, dim) > 0)) {\n for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);\n } else {\n for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);\n }\n\n if (last && equals(last, last.next)) {\n removeNode(last);\n last = last.next;\n }\n\n return last;\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) break;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {\n if (!ear) return;\n\n // interlink polygon nodes in z-order\n if (!pass && invSize) indexCurve(ear, minX, minY, invSize);\n\n var stop = ear,\n prev, next;\n\n // iterate through ears, slicing them one by one\n while (ear.prev !== ear.next) {\n prev = ear.prev;\n next = ear.next;\n\n if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {\n // cut off the triangle\n triangles.push(prev.i / dim);\n triangles.push(ear.i / dim);\n triangles.push(next.i / dim);\n\n removeNode(ear);\n\n // skipping the next vertice leads to less sliver triangles\n ear = next.next;\n stop = next.next;\n\n continue;\n }\n\n ear = next;\n\n // if we looped through the whole remaining polygon and can't find any more ears\n if (ear === stop) {\n // try filtering points and slicing again\n if (!pass) {\n earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);\n\n // if this didn't work, try curing all small self-intersections locally\n } else if (pass === 1) {\n ear = cureLocalIntersections(ear, triangles, dim);\n earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);\n\n // as a last resort, try splitting the remaining polygon into two\n } else if (pass === 2) {\n splitEarcut(ear, triangles, dim, minX, minY, invSize);\n }\n\n break;\n }\n }\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar(ear) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // now make sure we don't have other points inside the potential ear\n var p = ear.next.next;\n\n while (p !== ear.prev) {\n if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.next;\n }\n\n return true;\n}\n\nfunction isEarHashed(ear, minX, minY, invSize) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // triangle bbox; min & max are calculated like this for speed\n var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x),\n minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y),\n maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x),\n maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y);\n\n // z-order range for the current triangle bbox;\n var minZ = zOrder(minTX, minTY, minX, minY, invSize),\n maxZ = zOrder(maxTX, maxTY, minX, minY, invSize);\n\n var p = ear.prevZ,\n n = ear.nextZ;\n\n // look for points inside the triangle in both directions\n while (p && p.z >= minZ && n && n.z <= maxZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n\n if (n !== ear.prev && n !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&\n area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n // look for remaining points in decreasing z-order\n while (p && p.z >= minZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n }\n\n // look for remaining points in increasing z-order\n while (n && n.z <= maxZ) {\n if (n !== ear.prev && n !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&\n area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n return true;\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return p;\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut(start, triangles, dim, minX, minY, invSize) {\n // look for a valid diagonal that divides the polygon into two\n var a = start;\n do {\n var b = a.next.next;\n while (b !== a.prev) {\n if (a.i !== b.i && isValidDiagonal(a, b)) {\n // split the polygon in two by the diagonal\n var c = splitPolygon(a, b);\n\n // filter colinear points around the cuts\n a = filterPoints(a, a.next);\n c = filterPoints(c, c.next);\n\n // run earcut on each half\n earcutLinked(a, triangles, dim, minX, minY, invSize);\n earcutLinked(c, triangles, dim, minX, minY, invSize);\n return;\n }\n b = b.next;\n }\n a = a.next;\n } while (a !== start);\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles(data, holeIndices, outerNode, dim) {\n var queue = [],\n i, len, start, end, list;\n\n for (i = 0, len = holeIndices.length; i < len; i++) {\n start = holeIndices[i] * dim;\n end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n list = linkedList(data, start, end, dim, false);\n if (list === list.next) list.steiner = true;\n queue.push(getLeftmost(list));\n }\n\n queue.sort(compareX);\n\n // process holes from left to right\n for (i = 0; i < queue.length; i++) {\n eliminateHole(queue[i], outerNode);\n outerNode = filterPoints(outerNode, outerNode.next);\n }\n\n return outerNode;\n}\n\nfunction compareX(a, b) {\n return a.x - b.x;\n}\n\n// find a bridge between vertices that connects hole with an outer ring and and link it\nfunction eliminateHole(hole, outerNode) {\n outerNode = findHoleBridge(hole, outerNode);\n if (outerNode) {\n var b = splitPolygon(outerNode, hole);\n filterPoints(b, b.next);\n }\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge(hole, outerNode) {\n var p = outerNode,\n hx = hole.x,\n hy = hole.y,\n qx = -Infinity,\n m;\n\n // find a segment intersected by a ray from the hole's leftmost point to the left;\n // segment's endpoint with lesser x will be potential connection point\n do {\n if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {\n var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);\n if (x <= hx && x > qx) {\n qx = x;\n if (x === hx) {\n if (hy === p.y) return p;\n if (hy === p.next.y) return p.next;\n }\n m = p.x < p.next.x ? p : p.next;\n }\n }\n p = p.next;\n } while (p !== outerNode);\n\n if (!m) return null;\n\n if (hx === qx) return m.prev; // hole touches outer segment; pick lower endpoint\n\n // look for points inside the triangle of hole point, segment intersection and endpoint;\n // if there are no points found, we have a valid connection;\n // otherwise choose the point of the minimum angle with the ray as connection point\n\n var stop = m,\n mx = m.x,\n my = m.y,\n tanMin = Infinity,\n tan;\n\n p = m.next;\n\n while (p !== stop) {\n if (hx >= p.x && p.x >= mx && hx !== p.x &&\n pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {\n\n tan = Math.abs(hy - p.y) / (hx - p.x); // tangential\n\n if ((tan < tanMin || (tan === tanMin && p.x > m.x)) && locallyInside(p, hole)) {\n m = p;\n tanMin = tan;\n }\n }\n\n p = p.next;\n }\n\n return m;\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve(start, minX, minY, invSize) {\n var p = start;\n do {\n if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, invSize);\n p.prevZ = p.prev;\n p.nextZ = p.next;\n p = p.next;\n } while (p !== start);\n\n p.prevZ.nextZ = null;\n p.prevZ = null;\n\n sortLinked(p);\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked(list) {\n var i, p, q, e, tail, numMerges, pSize, qSize,\n inSize = 1;\n\n do {\n p = list;\n list = null;\n tail = null;\n numMerges = 0;\n\n while (p) {\n numMerges++;\n q = p;\n pSize = 0;\n for (i = 0; i < inSize; i++) {\n pSize++;\n q = q.nextZ;\n if (!q) break;\n }\n qSize = inSize;\n\n while (pSize > 0 || (qSize > 0 && q)) {\n\n if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {\n e = p;\n p = p.nextZ;\n pSize--;\n } else {\n e = q;\n q = q.nextZ;\n qSize--;\n }\n\n if (tail) tail.nextZ = e;\n else list = e;\n\n e.prevZ = tail;\n tail = e;\n }\n\n p = q;\n }\n\n tail.nextZ = null;\n inSize *= 2;\n\n } while (numMerges > 1);\n\n return list;\n}\n\n// z-order of a point given coords and inverse of the longer side of data bbox\nfunction zOrder(x, y, minX, minY, invSize) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) * invSize;\n y = 32767 * (y - minY) * invSize;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost(start) {\n var p = start,\n leftmost = start;\n do {\n if (p.x < leftmost.x) leftmost = p;\n p = p.next;\n } while (p !== start);\n\n return leftmost;\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal(a, b) {\n return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) &&\n locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b);\n}\n\n// signed area of a triangle\nfunction area(p, q, r) {\n return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n}\n\n// check if two points are equal\nfunction equals(p1, p2) {\n return p1.x === p2.x && p1.y === p2.y;\n}\n\n// check if two segments intersect\nfunction intersects(p1, q1, p2, q2) {\n if ((equals(p1, q1) && equals(p2, q2)) ||\n (equals(p1, q2) && equals(p2, q1))) return true;\n return area(p1, q1, p2) > 0 !== area(p1, q1, q2) > 0 &&\n area(p2, q2, p1) > 0 !== area(p2, q2, q1) > 0;\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon(a, b) {\n var p = a;\n do {\n if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n intersects(p, p.next, a, b)) return true;\n p = p.next;\n } while (p !== a);\n\n return false;\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside(a, b) {\n return area(a.prev, a, a.next) < 0 ?\n area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :\n area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&\n (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon(a, b) {\n var a2 = new Node(a.i, a.x, a.y),\n b2 = new Node(b.i, b.x, b.y),\n an = a.next,\n bp = b.prev;\n\n a.next = b;\n b.prev = a;\n\n a2.next = an;\n an.prev = a2;\n\n b2.next = a2;\n a2.prev = b2;\n\n bp.next = b2;\n b2.prev = bp;\n\n return b2;\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode(i, x, y, last) {\n var p = new Node(i, x, y);\n\n if (!last) {\n p.prev = p;\n p.next = p;\n\n } else {\n p.next = last.next;\n p.prev = last;\n last.next.prev = p;\n last.next = p;\n }\n return p;\n}\n\nfunction removeNode(p) {\n p.next.prev = p.prev;\n p.prev.next = p.next;\n\n if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n}\n\nfunction Node(i, x, y) {\n // vertice index in coordinates array\n this.i = i;\n\n // vertex coordinates\n this.x = x;\n this.y = y;\n\n // previous and next vertice nodes in a polygon ring\n this.prev = null;\n this.next = null;\n\n // z-order curve value\n this.z = null;\n\n // previous and next nodes in z-order\n this.prevZ = null;\n this.nextZ = null;\n\n // indicates whether this is a steiner point\n this.steiner = false;\n}\n\n// return a percentage difference between the polygon area and its triangulation area;\n// used to verify correctness of triangulation\nearcut.deviation = function (data, holeIndices, dim, triangles) {\n var hasHoles = holeIndices && holeIndices.length;\n var outerLen = hasHoles ? holeIndices[0] * dim : data.length;\n\n var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim));\n if (hasHoles) {\n for (var i = 0, len = holeIndices.length; i < len; i++) {\n var start = holeIndices[i] * dim;\n var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n polygonArea -= Math.abs(signedArea(data, start, end, dim));\n }\n }\n\n var trianglesArea = 0;\n for (i = 0; i < triangles.length; i += 3) {\n var a = triangles[i] * dim;\n var b = triangles[i + 1] * dim;\n var c = triangles[i + 2] * dim;\n trianglesArea += Math.abs(\n (data[a] - data[c]) * (data[b + 1] - data[a + 1]) -\n (data[a] - data[b]) * (data[c + 1] - data[a + 1]));\n }\n\n return polygonArea === 0 && trianglesArea === 0 ? 0 :\n Math.abs((trianglesArea - polygonArea) / polygonArea);\n};\n\nfunction signedArea(data, start, end, dim) {\n var sum = 0;\n for (var i = start, j = end - dim; i < end; i += dim) {\n sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);\n j = i;\n }\n return sum;\n}\n\n// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts\nearcut.flatten = function (data) {\n var dim = data[0][0].length,\n result = {vertices: [], holes: [], dimensions: dim},\n holeIndex = 0;\n\n for (var i = 0; i < data.length; i++) {\n for (var j = 0; j < data[i].length; j++) {\n for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]);\n }\n if (i > 0) {\n holeIndex += data[i - 1].length;\n result.holes.push(holeIndex);\n }\n }\n return result;\n};\n","'use strict';\n\nmodule.exports = quickselect;\nmodule.exports.default = quickselect;\n\nfunction quickselect(arr, k, left, right, compare) {\n quickselectStep(arr, k, left || 0, right || (arr.length - 1), compare || defaultCompare);\n};\n\nfunction quickselectStep(arr, k, left, right, compare) {\n\n while (right > left) {\n if (right - left > 600) {\n var n = right - left + 1;\n var m = k - left + 1;\n var z = Math.log(n);\n var s = 0.5 * Math.exp(2 * z / 3);\n var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);\n var newLeft = Math.max(left, Math.floor(k - m * s / n + sd));\n var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));\n quickselectStep(arr, k, newLeft, newRight, compare);\n }\n\n var t = arr[k];\n var i = left;\n var j = right;\n\n swap(arr, left, k);\n if (compare(arr[right], t) > 0) swap(arr, left, right);\n\n while (i < j) {\n swap(arr, i, j);\n i++;\n j--;\n while (compare(arr[i], t) < 0) i++;\n while (compare(arr[j], t) > 0) j--;\n }\n\n if (compare(arr[left], t) === 0) swap(arr, left, j);\n else {\n j++;\n swap(arr, j, right);\n }\n\n if (j <= k) left = j + 1;\n if (k <= j) right = j - 1;\n }\n}\n\nfunction swap(arr, i, j) {\n var tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n}\n\nfunction defaultCompare(a, b) {\n return a < b ? -1 : a > b ? 1 : 0;\n}\n","// @flow\n\nimport quickselect from 'quickselect';\n\nimport { calculateSignedArea } from './util';\n\nimport type Point from '@mapbox/point-geometry';\n\n// classifies an array of rings into polygons with outer rings and holes\nexport default function classifyRings(rings: Array>, maxRings: number) {\n const len = rings.length;\n\n if (len <= 1) return [rings];\n\n const polygons = [];\n let polygon,\n ccw;\n\n for (let i = 0; i < len; i++) {\n const area = calculateSignedArea(rings[i]);\n if (area === 0) continue;\n\n (rings[i]: any).area = Math.abs(area);\n\n if (ccw === undefined) ccw = area < 0;\n\n if (ccw === area < 0) {\n if (polygon) polygons.push(polygon);\n polygon = [rings[i]];\n\n } else {\n (polygon: any).push(rings[i]);\n }\n }\n if (polygon) polygons.push(polygon);\n\n // Earcut performance degrages with the # of rings in a polygon. For this\n // reason, we limit strip out all but the `maxRings` largest rings.\n if (maxRings > 1) {\n for (let j = 0; j < polygons.length; j++) {\n if (polygons[j].length <= maxRings) continue;\n quickselect(polygons[j], maxRings, 1, polygons[j].length - 1, compareAreas);\n polygons[j] = polygons[j].slice(0, maxRings);\n }\n }\n\n return polygons;\n}\n\nfunction compareAreas(a, b) {\n return b.area - a.area;\n}\n","// @flow\n\nimport { FillLayoutArray } from '../array_types';\n\nimport { members as layoutAttributes } from './fill_attributes';\nimport SegmentVector from '../segment';\nimport { ProgramConfigurationSet } from '../program_configuration';\nimport { LineIndexArray, TriangleIndexArray } from '../index_array_type';\nimport loadGeometry from '../load_geometry';\nimport earcut from 'earcut';\nimport classifyRings from '../../util/classify_rings';\nimport assert from 'assert';\nconst EARCUT_MAX_RINGS = 500;\nimport { register } from '../../util/web_worker_transfer';\nimport EvaluationParameters from '../../style/evaluation_parameters';\n\nimport type {\n Bucket,\n BucketParameters,\n IndexedFeature,\n PopulateParameters\n} from '../bucket';\nimport type FillStyleLayer from '../../style/style_layer/fill_style_layer';\nimport type Context from '../../gl/context';\nimport type IndexBuffer from '../../gl/index_buffer';\nimport type VertexBuffer from '../../gl/vertex_buffer';\nimport type Point from '@mapbox/point-geometry';\n\nclass FillBucket implements Bucket {\n index: number;\n zoom: number;\n overscaling: number;\n layers: Array;\n layerIds: Array;\n\n layoutVertexArray: FillLayoutArray;\n layoutVertexBuffer: VertexBuffer;\n\n indexArray: TriangleIndexArray;\n indexBuffer: IndexBuffer;\n\n indexArray2: LineIndexArray;\n indexBuffer2: IndexBuffer;\n\n programConfigurations: ProgramConfigurationSet;\n segments: SegmentVector;\n segments2: SegmentVector;\n uploaded: boolean;\n\n constructor(options: BucketParameters) {\n this.zoom = options.zoom;\n this.overscaling = options.overscaling;\n this.layers = options.layers;\n this.layerIds = this.layers.map(layer => layer.id);\n this.index = options.index;\n\n this.layoutVertexArray = new FillLayoutArray();\n this.indexArray = new TriangleIndexArray();\n this.indexArray2 = new LineIndexArray();\n this.programConfigurations = new ProgramConfigurationSet(layoutAttributes, options.layers, options.zoom);\n this.segments = new SegmentVector();\n this.segments2 = new SegmentVector();\n }\n\n populate(features: Array, options: PopulateParameters) {\n for (const {feature, index, sourceLayerIndex} of features) {\n if (this.layers[0]._featureFilter(new EvaluationParameters(this.zoom), feature)) {\n const geometry = loadGeometry(feature);\n this.addFeature(feature, geometry);\n options.featureIndex.insert(feature, geometry, index, sourceLayerIndex, this.index);\n }\n }\n }\n\n isEmpty() {\n return this.layoutVertexArray.length === 0;\n }\n\n upload(context: Context) {\n this.layoutVertexBuffer = context.createVertexBuffer(this.layoutVertexArray, layoutAttributes);\n this.indexBuffer = context.createIndexBuffer(this.indexArray);\n this.indexBuffer2 = context.createIndexBuffer(this.indexArray2);\n this.programConfigurations.upload(context);\n }\n\n destroy() {\n if (!this.layoutVertexBuffer) return;\n this.layoutVertexBuffer.destroy();\n this.indexBuffer.destroy();\n this.indexBuffer2.destroy();\n this.programConfigurations.destroy();\n this.segments.destroy();\n this.segments2.destroy();\n }\n\n addFeature(feature: VectorTileFeature, geometry: Array>) {\n for (const polygon of classifyRings(geometry, EARCUT_MAX_RINGS)) {\n let numVertices = 0;\n for (const ring of polygon) {\n numVertices += ring.length;\n }\n\n const triangleSegment = this.segments.prepareSegment(numVertices, this.layoutVertexArray, this.indexArray);\n const triangleIndex = triangleSegment.vertexLength;\n\n const flattened = [];\n const holeIndices = [];\n\n for (const ring of polygon) {\n if (ring.length === 0) {\n continue;\n }\n\n if (ring !== polygon[0]) {\n holeIndices.push(flattened.length / 2);\n }\n\n const lineSegment = this.segments2.prepareSegment(ring.length, this.layoutVertexArray, this.indexArray2);\n const lineIndex = lineSegment.vertexLength;\n\n this.layoutVertexArray.emplaceBack(ring[0].x, ring[0].y);\n this.indexArray2.emplaceBack(lineIndex + ring.length - 1, lineIndex);\n flattened.push(ring[0].x);\n flattened.push(ring[0].y);\n\n for (let i = 1; i < ring.length; i++) {\n this.layoutVertexArray.emplaceBack(ring[i].x, ring[i].y);\n this.indexArray2.emplaceBack(lineIndex + i - 1, lineIndex + i);\n flattened.push(ring[i].x);\n flattened.push(ring[i].y);\n }\n\n lineSegment.vertexLength += ring.length;\n lineSegment.primitiveLength += ring.length;\n }\n\n const indices = earcut(flattened, holeIndices);\n assert(indices.length % 3 === 0);\n\n for (let i = 0; i < indices.length; i += 3) {\n this.indexArray.emplaceBack(\n triangleIndex + indices[i],\n triangleIndex + indices[i + 1],\n triangleIndex + indices[i + 2]);\n }\n\n triangleSegment.vertexLength += numVertices;\n triangleSegment.primitiveLength += indices.length / 3;\n }\n\n this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, feature);\n }\n}\n\nregister('FillBucket', FillBucket, {omit: ['layers']});\n\nexport default FillBucket;\n","// This file is generated. Edit build/generate-style-code.js, then run `yarn run codegen`.\n// @flow\n/* eslint-disable */\n\nimport styleSpec from '../../style-spec/reference/latest';\n\nimport {\n Properties,\n DataConstantProperty,\n DataDrivenProperty,\n CrossFadedProperty,\n ColorRampProperty\n} from '../properties';\n\nimport type Color from '../../style-spec/util/color';\n\n\nexport type PaintProps = {|\n \"fill-antialias\": DataConstantProperty,\n \"fill-opacity\": DataDrivenProperty,\n \"fill-color\": DataDrivenProperty,\n \"fill-outline-color\": DataDrivenProperty,\n \"fill-translate\": DataConstantProperty<[number, number]>,\n \"fill-translate-anchor\": DataConstantProperty<\"map\" | \"viewport\">,\n \"fill-pattern\": CrossFadedProperty,\n|};\n\nconst paint: Properties = new Properties({\n \"fill-antialias\": new DataConstantProperty(styleSpec[\"paint_fill\"][\"fill-antialias\"]),\n \"fill-opacity\": new DataDrivenProperty(styleSpec[\"paint_fill\"][\"fill-opacity\"]),\n \"fill-color\": new DataDrivenProperty(styleSpec[\"paint_fill\"][\"fill-color\"]),\n \"fill-outline-color\": new DataDrivenProperty(styleSpec[\"paint_fill\"][\"fill-outline-color\"]),\n \"fill-translate\": new DataConstantProperty(styleSpec[\"paint_fill\"][\"fill-translate\"]),\n \"fill-translate-anchor\": new DataConstantProperty(styleSpec[\"paint_fill\"][\"fill-translate-anchor\"]),\n \"fill-pattern\": new CrossFadedProperty(styleSpec[\"paint_fill\"][\"fill-pattern\"]),\n});\n\nexport default { paint };\n","// @flow\n\nimport StyleLayer from '../style_layer';\n\nimport FillBucket from '../../data/bucket/fill_bucket';\nimport { multiPolygonIntersectsMultiPolygon } from '../../util/intersection_tests';\nimport { translateDistance, translate } from '../query_utils';\nimport properties from './fill_style_layer_properties';\nimport { Transitionable, Transitioning, PossiblyEvaluated } from '../properties';\n\nimport type {BucketParameters} from '../../data/bucket';\nimport type Point from '@mapbox/point-geometry';\nimport type {PaintProps} from './fill_style_layer_properties';\nimport type EvaluationParameters from '../evaluation_parameters';\nimport type Transform from '../../geo/transform';\n\nclass FillStyleLayer extends StyleLayer {\n _transitionablePaint: Transitionable;\n _transitioningPaint: Transitioning;\n paint: PossiblyEvaluated;\n\n constructor(layer: LayerSpecification) {\n super(layer, properties);\n }\n\n recalculate(parameters: EvaluationParameters) {\n this.paint = this._transitioningPaint.possiblyEvaluate(parameters);\n\n const outlineColor = this.paint._values['fill-outline-color'];\n if (outlineColor.value.kind === 'constant' && outlineColor.value.value === undefined) {\n this.paint._values['fill-outline-color'] = this.paint._values['fill-color'];\n }\n }\n\n createBucket(parameters: BucketParameters<*>) {\n return new FillBucket(parameters);\n }\n\n queryRadius(): number {\n return translateDistance(this.paint.get('fill-translate'));\n }\n\n queryIntersectsFeature(queryGeometry: Array>,\n feature: VectorTileFeature,\n geometry: Array>,\n zoom: number,\n transform: Transform,\n pixelsToTileUnits: number): boolean {\n const translatedPolygon = translate(queryGeometry,\n this.paint.get('fill-translate'),\n this.paint.get('fill-translate-anchor'),\n transform.angle, pixelsToTileUnits);\n return multiPolygonIntersectsMultiPolygon(translatedPolygon, geometry);\n }\n}\n\nexport default FillStyleLayer;\n","// @flow\nimport { createLayout } from '../../util/struct_array';\n\nconst layout = createLayout([\n {name: 'a_pos', components: 2, type: 'Int16'},\n {name: 'a_normal_ed', components: 4, type: 'Int16'},\n], 4);\n\nexport default layout;\nexport const {members, size, alignment} = layout;\n","// @flow\n\nimport { FillExtrusionLayoutArray } from '../array_types';\n\nimport { members as layoutAttributes } from './fill_extrusion_attributes';\nimport SegmentVector from '../segment';\nimport { ProgramConfigurationSet } from '../program_configuration';\nimport { TriangleIndexArray } from '../index_array_type';\nimport loadGeometry from '../load_geometry';\nimport EXTENT from '../extent';\nimport earcut from 'earcut';\nimport classifyRings from '../../util/classify_rings';\nimport assert from 'assert';\nconst EARCUT_MAX_RINGS = 500;\nimport { register } from '../../util/web_worker_transfer';\nimport EvaluationParameters from '../../style/evaluation_parameters';\n\nimport type {\n Bucket,\n BucketParameters,\n IndexedFeature,\n PopulateParameters\n} from '../bucket';\nimport type FillExtrusionStyleLayer from '../../style/style_layer/fill_extrusion_style_layer';\nimport type Context from '../../gl/context';\nimport type IndexBuffer from '../../gl/index_buffer';\nimport type VertexBuffer from '../../gl/vertex_buffer';\nimport type Point from '@mapbox/point-geometry';\n\nconst FACTOR = Math.pow(2, 13);\n\nfunction addVertex(vertexArray, x, y, nx, ny, nz, t, e) {\n vertexArray.emplaceBack(\n // a_pos\n x,\n y,\n // a_normal_ed: 3-component normal and 1-component edgedistance\n Math.floor(nx * FACTOR) * 2 + t,\n ny * FACTOR * 2,\n nz * FACTOR * 2,\n // edgedistance (used for wrapping patterns around extrusion sides)\n Math.round(e)\n );\n}\n\n\nclass FillExtrusionBucket implements Bucket {\n index: number;\n zoom: number;\n overscaling: number;\n layers: Array;\n layerIds: Array;\n\n layoutVertexArray: FillExtrusionLayoutArray;\n layoutVertexBuffer: VertexBuffer;\n\n indexArray: TriangleIndexArray;\n indexBuffer: IndexBuffer;\n\n programConfigurations: ProgramConfigurationSet;\n segments: SegmentVector;\n uploaded: boolean;\n\n constructor(options: BucketParameters) {\n this.zoom = options.zoom;\n this.overscaling = options.overscaling;\n this.layers = options.layers;\n this.layerIds = this.layers.map(layer => layer.id);\n this.index = options.index;\n\n this.layoutVertexArray = new FillExtrusionLayoutArray();\n this.indexArray = new TriangleIndexArray();\n this.programConfigurations = new ProgramConfigurationSet(layoutAttributes, options.layers, options.zoom);\n this.segments = new SegmentVector();\n }\n\n populate(features: Array, options: PopulateParameters) {\n for (const {feature, index, sourceLayerIndex} of features) {\n if (this.layers[0]._featureFilter(new EvaluationParameters(this.zoom), feature)) {\n const geometry = loadGeometry(feature);\n this.addFeature(feature, geometry);\n options.featureIndex.insert(feature, geometry, index, sourceLayerIndex, this.index);\n }\n }\n }\n\n isEmpty() {\n return this.layoutVertexArray.length === 0;\n }\n\n upload(context: Context) {\n this.layoutVertexBuffer = context.createVertexBuffer(this.layoutVertexArray, layoutAttributes);\n this.indexBuffer = context.createIndexBuffer(this.indexArray);\n this.programConfigurations.upload(context);\n }\n\n destroy() {\n if (!this.layoutVertexBuffer) return;\n this.layoutVertexBuffer.destroy();\n this.indexBuffer.destroy();\n this.programConfigurations.destroy();\n this.segments.destroy();\n }\n\n addFeature(feature: VectorTileFeature, geometry: Array>) {\n for (const polygon of classifyRings(geometry, EARCUT_MAX_RINGS)) {\n let numVertices = 0;\n for (const ring of polygon) {\n numVertices += ring.length;\n }\n let segment = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray);\n\n for (const ring of polygon) {\n if (ring.length === 0) {\n continue;\n }\n\n if (isEntirelyOutside(ring)) {\n continue;\n }\n\n let edgeDistance = 0;\n\n for (let p = 0; p < ring.length; p++) {\n const p1 = ring[p];\n\n if (p >= 1) {\n const p2 = ring[p - 1];\n\n if (!isBoundaryEdge(p1, p2)) {\n if (segment.vertexLength + 4 > SegmentVector.MAX_VERTEX_ARRAY_LENGTH) {\n segment = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray);\n }\n\n const perp = p1.sub(p2)._perp()._unit();\n const dist = p2.dist(p1);\n if (edgeDistance + dist > 32768) edgeDistance = 0;\n\n addVertex(this.layoutVertexArray, p1.x, p1.y, perp.x, perp.y, 0, 0, edgeDistance);\n addVertex(this.layoutVertexArray, p1.x, p1.y, perp.x, perp.y, 0, 1, edgeDistance);\n\n edgeDistance += dist;\n\n addVertex(this.layoutVertexArray, p2.x, p2.y, perp.x, perp.y, 0, 0, edgeDistance);\n addVertex(this.layoutVertexArray, p2.x, p2.y, perp.x, perp.y, 0, 1, edgeDistance);\n\n const bottomRight = segment.vertexLength;\n\n this.indexArray.emplaceBack(bottomRight, bottomRight + 1, bottomRight + 2);\n this.indexArray.emplaceBack(bottomRight + 1, bottomRight + 2, bottomRight + 3);\n\n segment.vertexLength += 4;\n segment.primitiveLength += 2;\n }\n }\n }\n }\n\n if (segment.vertexLength + numVertices > SegmentVector.MAX_VERTEX_ARRAY_LENGTH) {\n segment = this.segments.prepareSegment(numVertices, this.layoutVertexArray, this.indexArray);\n }\n\n const flattened = [];\n const holeIndices = [];\n const triangleIndex = segment.vertexLength;\n\n for (const ring of polygon) {\n if (ring.length === 0) {\n continue;\n }\n\n if (ring !== polygon[0]) {\n holeIndices.push(flattened.length / 2);\n }\n\n for (let i = 0; i < ring.length; i++) {\n const p = ring[i];\n\n addVertex(this.layoutVertexArray, p.x, p.y, 0, 0, 1, 1, 0);\n\n flattened.push(p.x);\n flattened.push(p.y);\n }\n }\n\n const indices = earcut(flattened, holeIndices);\n assert(indices.length % 3 === 0);\n\n for (let j = 0; j < indices.length; j += 3) {\n this.indexArray.emplaceBack(\n triangleIndex + indices[j],\n triangleIndex + indices[j + 1],\n triangleIndex + indices[j + 2]);\n }\n\n segment.primitiveLength += indices.length / 3;\n segment.vertexLength += numVertices;\n }\n\n this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, feature);\n }\n}\n\nregister('FillExtrusionBucket', FillExtrusionBucket, {omit: ['layers']});\n\nexport default FillExtrusionBucket;\n\nfunction isBoundaryEdge(p1, p2) {\n return (p1.x === p2.x && (p1.x < 0 || p1.x > EXTENT)) ||\n (p1.y === p2.y && (p1.y < 0 || p1.y > EXTENT));\n}\n\nfunction isEntirelyOutside(ring) {\n return ring.every(p => p.x < 0) ||\n ring.every(p => p.x > EXTENT) ||\n ring.every(p => p.y < 0) ||\n ring.every(p => p.y > EXTENT);\n}\n","// This file is generated. Edit build/generate-style-code.js, then run `yarn run codegen`.\n// @flow\n/* eslint-disable */\n\nimport styleSpec from '../../style-spec/reference/latest';\n\nimport {\n Properties,\n DataConstantProperty,\n DataDrivenProperty,\n CrossFadedProperty,\n ColorRampProperty\n} from '../properties';\n\nimport type Color from '../../style-spec/util/color';\n\n\nexport type PaintProps = {|\n \"fill-extrusion-opacity\": DataConstantProperty,\n \"fill-extrusion-color\": DataDrivenProperty,\n \"fill-extrusion-translate\": DataConstantProperty<[number, number]>,\n \"fill-extrusion-translate-anchor\": DataConstantProperty<\"map\" | \"viewport\">,\n \"fill-extrusion-pattern\": CrossFadedProperty,\n \"fill-extrusion-height\": DataDrivenProperty,\n \"fill-extrusion-base\": DataDrivenProperty,\n|};\n\nconst paint: Properties = new Properties({\n \"fill-extrusion-opacity\": new DataConstantProperty(styleSpec[\"paint_fill-extrusion\"][\"fill-extrusion-opacity\"]),\n \"fill-extrusion-color\": new DataDrivenProperty(styleSpec[\"paint_fill-extrusion\"][\"fill-extrusion-color\"]),\n \"fill-extrusion-translate\": new DataConstantProperty(styleSpec[\"paint_fill-extrusion\"][\"fill-extrusion-translate\"]),\n \"fill-extrusion-translate-anchor\": new DataConstantProperty(styleSpec[\"paint_fill-extrusion\"][\"fill-extrusion-translate-anchor\"]),\n \"fill-extrusion-pattern\": new CrossFadedProperty(styleSpec[\"paint_fill-extrusion\"][\"fill-extrusion-pattern\"]),\n \"fill-extrusion-height\": new DataDrivenProperty(styleSpec[\"paint_fill-extrusion\"][\"fill-extrusion-height\"]),\n \"fill-extrusion-base\": new DataDrivenProperty(styleSpec[\"paint_fill-extrusion\"][\"fill-extrusion-base\"]),\n});\n\nexport default { paint };\n","// @flow\n\nimport StyleLayer from '../style_layer';\n\nimport FillExtrusionBucket from '../../data/bucket/fill_extrusion_bucket';\nimport { multiPolygonIntersectsMultiPolygon } from '../../util/intersection_tests';\nimport { translateDistance, translate } from '../query_utils';\nimport properties from './fill_extrusion_style_layer_properties';\nimport { Transitionable, Transitioning, PossiblyEvaluated } from '../properties';\n\nimport type {BucketParameters} from '../../data/bucket';\nimport type Point from '@mapbox/point-geometry';\nimport type {PaintProps} from './fill_extrusion_style_layer_properties';\nimport type Framebuffer from '../../gl/framebuffer';\nimport type Transform from '../../geo/transform';\n\nclass FillExtrusionStyleLayer extends StyleLayer {\n _transitionablePaint: Transitionable;\n _transitioningPaint: Transitioning;\n paint: PossiblyEvaluated;\n viewportFrame: ?Framebuffer;\n\n constructor(layer: LayerSpecification) {\n super(layer, properties);\n }\n\n createBucket(parameters: BucketParameters) {\n return new FillExtrusionBucket(parameters);\n }\n\n queryRadius(): number {\n return translateDistance(this.paint.get('fill-extrusion-translate'));\n }\n\n queryIntersectsFeature(queryGeometry: Array>,\n feature: VectorTileFeature,\n geometry: Array>,\n zoom: number,\n transform: Transform,\n pixelsToTileUnits: number): boolean {\n const translatedPolygon = translate(queryGeometry,\n this.paint.get('fill-extrusion-translate'),\n this.paint.get('fill-extrusion-translate-anchor'),\n transform.angle, pixelsToTileUnits);\n return multiPolygonIntersectsMultiPolygon(translatedPolygon, geometry);\n }\n\n hasOffscreenPass() {\n return this.paint.get('fill-extrusion-opacity') !== 0 && this.visibility !== 'none';\n }\n\n resize() {\n if (this.viewportFrame) {\n this.viewportFrame.destroy();\n this.viewportFrame = null;\n }\n }\n}\n\nexport default FillExtrusionStyleLayer;\n","// @flow\nimport { createLayout } from '../../util/struct_array';\n\nconst layout = createLayout([\n {name: 'a_pos_normal', components: 4, type: 'Int16'},\n {name: 'a_data', components: 4, type: 'Uint8'}\n], 4);\n\nexport default layout;\nexport const {members, size, alignment} = layout;\n","'use strict';\n\nvar Point = require('@mapbox/point-geometry');\n\nmodule.exports = VectorTileFeature;\n\nfunction VectorTileFeature(pbf, end, extent, keys, values) {\n // Public\n this.properties = {};\n this.extent = extent;\n this.type = 0;\n\n // Private\n this._pbf = pbf;\n this._geometry = -1;\n this._keys = keys;\n this._values = values;\n\n pbf.readFields(readFeature, this, end);\n}\n\nfunction readFeature(tag, feature, pbf) {\n if (tag == 1) feature.id = pbf.readVarint();\n else if (tag == 2) readTag(pbf, feature);\n else if (tag == 3) feature.type = pbf.readVarint();\n else if (tag == 4) feature._geometry = pbf.pos;\n}\n\nfunction readTag(pbf, feature) {\n var end = pbf.readVarint() + pbf.pos;\n\n while (pbf.pos < end) {\n var key = feature._keys[pbf.readVarint()],\n value = feature._values[pbf.readVarint()];\n feature.properties[key] = value;\n }\n}\n\nVectorTileFeature.types = ['Unknown', 'Point', 'LineString', 'Polygon'];\n\nVectorTileFeature.prototype.loadGeometry = function() {\n var pbf = this._pbf;\n pbf.pos = this._geometry;\n\n var end = pbf.readVarint() + pbf.pos,\n cmd = 1,\n length = 0,\n x = 0,\n y = 0,\n lines = [],\n line;\n\n while (pbf.pos < end) {\n if (length <= 0) {\n var cmdLen = pbf.readVarint();\n cmd = cmdLen & 0x7;\n length = cmdLen >> 3;\n }\n\n length--;\n\n if (cmd === 1 || cmd === 2) {\n x += pbf.readSVarint();\n y += pbf.readSVarint();\n\n if (cmd === 1) { // moveTo\n if (line) lines.push(line);\n line = [];\n }\n\n line.push(new Point(x, y));\n\n } else if (cmd === 7) {\n\n // Workaround for https://github.com/mapbox/mapnik-vector-tile/issues/90\n if (line) {\n line.push(line[0].clone()); // closePolygon\n }\n\n } else {\n throw new Error('unknown command ' + cmd);\n }\n }\n\n if (line) lines.push(line);\n\n return lines;\n};\n\nVectorTileFeature.prototype.bbox = function() {\n var pbf = this._pbf;\n pbf.pos = this._geometry;\n\n var end = pbf.readVarint() + pbf.pos,\n cmd = 1,\n length = 0,\n x = 0,\n y = 0,\n x1 = Infinity,\n x2 = -Infinity,\n y1 = Infinity,\n y2 = -Infinity;\n\n while (pbf.pos < end) {\n if (length <= 0) {\n var cmdLen = pbf.readVarint();\n cmd = cmdLen & 0x7;\n length = cmdLen >> 3;\n }\n\n length--;\n\n if (cmd === 1 || cmd === 2) {\n x += pbf.readSVarint();\n y += pbf.readSVarint();\n if (x < x1) x1 = x;\n if (x > x2) x2 = x;\n if (y < y1) y1 = y;\n if (y > y2) y2 = y;\n\n } else if (cmd !== 7) {\n throw new Error('unknown command ' + cmd);\n }\n }\n\n return [x1, y1, x2, y2];\n};\n\nVectorTileFeature.prototype.toGeoJSON = function(x, y, z) {\n var size = this.extent * Math.pow(2, z),\n x0 = this.extent * x,\n y0 = this.extent * y,\n coords = this.loadGeometry(),\n type = VectorTileFeature.types[this.type],\n i, j;\n\n function project(line) {\n for (var j = 0; j < line.length; j++) {\n var p = line[j], y2 = 180 - (p.y + y0) * 360 / size;\n line[j] = [\n (p.x + x0) * 360 / size - 180,\n 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90\n ];\n }\n }\n\n switch (this.type) {\n case 1:\n var points = [];\n for (i = 0; i < coords.length; i++) {\n points[i] = coords[i][0];\n }\n coords = points;\n project(coords);\n break;\n\n case 2:\n for (i = 0; i < coords.length; i++) {\n project(coords[i]);\n }\n break;\n\n case 3:\n coords = classifyRings(coords);\n for (i = 0; i < coords.length; i++) {\n for (j = 0; j < coords[i].length; j++) {\n project(coords[i][j]);\n }\n }\n break;\n }\n\n if (coords.length === 1) {\n coords = coords[0];\n } else {\n type = 'Multi' + type;\n }\n\n var result = {\n type: \"Feature\",\n geometry: {\n type: type,\n coordinates: coords\n },\n properties: this.properties\n };\n\n if ('id' in this) {\n result.id = this.id;\n }\n\n return result;\n};\n\n// classifies an array of rings into polygons with outer rings and holes\n\nfunction classifyRings(rings) {\n var len = rings.length;\n\n if (len <= 1) return [rings];\n\n var polygons = [],\n polygon,\n ccw;\n\n for (var i = 0; i < len; i++) {\n var area = signedArea(rings[i]);\n if (area === 0) continue;\n\n if (ccw === undefined) ccw = area < 0;\n\n if (ccw === area < 0) {\n if (polygon) polygons.push(polygon);\n polygon = [rings[i]];\n\n } else {\n polygon.push(rings[i]);\n }\n }\n if (polygon) polygons.push(polygon);\n\n return polygons;\n}\n\nfunction signedArea(ring) {\n var sum = 0;\n for (var i = 0, len = ring.length, j = len - 1, p1, p2; i < len; j = i++) {\n p1 = ring[i];\n p2 = ring[j];\n sum += (p2.x - p1.x) * (p1.y + p2.y);\n }\n return sum;\n}\n","'use strict';\n\nvar VectorTileFeature = require('./vectortilefeature.js');\n\nmodule.exports = VectorTileLayer;\n\nfunction VectorTileLayer(pbf, end) {\n // Public\n this.version = 1;\n this.name = null;\n this.extent = 4096;\n this.length = 0;\n\n // Private\n this._pbf = pbf;\n this._keys = [];\n this._values = [];\n this._features = [];\n\n pbf.readFields(readLayer, this, end);\n\n this.length = this._features.length;\n}\n\nfunction readLayer(tag, layer, pbf) {\n if (tag === 15) layer.version = pbf.readVarint();\n else if (tag === 1) layer.name = pbf.readString();\n else if (tag === 5) layer.extent = pbf.readVarint();\n else if (tag === 2) layer._features.push(pbf.pos);\n else if (tag === 3) layer._keys.push(pbf.readString());\n else if (tag === 4) layer._values.push(readValueMessage(pbf));\n}\n\nfunction readValueMessage(pbf) {\n var value = null,\n end = pbf.readVarint() + pbf.pos;\n\n while (pbf.pos < end) {\n var tag = pbf.readVarint() >> 3;\n\n value = tag === 1 ? pbf.readString() :\n tag === 2 ? pbf.readFloat() :\n tag === 3 ? pbf.readDouble() :\n tag === 4 ? pbf.readVarint64() :\n tag === 5 ? pbf.readVarint() :\n tag === 6 ? pbf.readSVarint() :\n tag === 7 ? pbf.readBoolean() : null;\n }\n\n return value;\n}\n\n// return feature `i` from this layer as a `VectorTileFeature`\nVectorTileLayer.prototype.feature = function(i) {\n if (i < 0 || i >= this._features.length) throw new Error('feature index out of bounds');\n\n this._pbf.pos = this._features[i];\n\n var end = this._pbf.readVarint() + this._pbf.pos;\n return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values);\n};\n","'use strict';\n\nvar VectorTileLayer = require('./vectortilelayer');\n\nmodule.exports = VectorTile;\n\nfunction VectorTile(pbf, end) {\n this.layers = pbf.readFields(readTile, {}, end);\n}\n\nfunction readTile(tag, layers, pbf) {\n if (tag === 3) {\n var layer = new VectorTileLayer(pbf, pbf.readVarint() + pbf.pos);\n if (layer.length) layers[layer.name] = layer;\n }\n}\n\n","module.exports.VectorTile = require('./lib/vectortile.js');\nmodule.exports.VectorTileFeature = require('./lib/vectortilefeature.js');\nmodule.exports.VectorTileLayer = require('./lib/vectortilelayer.js');\n","// @flow\n\nimport { LineLayoutArray } from '../array_types';\n\nimport { members as layoutAttributes } from './line_attributes';\nimport SegmentVector from '../segment';\nimport { ProgramConfigurationSet } from '../program_configuration';\nimport { TriangleIndexArray } from '../index_array_type';\nimport loadGeometry from '../load_geometry';\nimport EXTENT from '../extent';\nimport mvt from '@mapbox/vector-tile';\nconst vectorTileFeatureTypes = mvt.VectorTileFeature.types;\nimport { register } from '../../util/web_worker_transfer';\nimport EvaluationParameters from '../../style/evaluation_parameters';\n\nimport type {\n Bucket,\n BucketParameters,\n IndexedFeature,\n PopulateParameters\n} from '../bucket';\nimport type LineStyleLayer from '../../style/style_layer/line_style_layer';\nimport type Point from '@mapbox/point-geometry';\nimport type {Segment} from '../segment';\nimport type Context from '../../gl/context';\nimport type IndexBuffer from '../../gl/index_buffer';\nimport type VertexBuffer from '../../gl/vertex_buffer';\n\n// NOTE ON EXTRUDE SCALE:\n// scale the extrusion vector so that the normal length is this value.\n// contains the \"texture\" normals (-1..1). this is distinct from the extrude\n// normals for line joins, because the x-value remains 0 for the texture\n// normal array, while the extrude normal actually moves the vertex to create\n// the acute/bevelled line join.\nconst EXTRUDE_SCALE = 63;\n\n/*\n * Sharp corners cause dashed lines to tilt because the distance along the line\n * is the same at both the inner and outer corners. To improve the appearance of\n * dashed lines we add extra points near sharp corners so that a smaller part\n * of the line is tilted.\n *\n * COS_HALF_SHARP_CORNER controls how sharp a corner has to be for us to add an\n * extra vertex. The default is 75 degrees.\n *\n * The newly created vertices are placed SHARP_CORNER_OFFSET pixels from the corner.\n */\nconst COS_HALF_SHARP_CORNER = Math.cos(75 / 2 * (Math.PI / 180));\nconst SHARP_CORNER_OFFSET = 15;\n\n// The number of bits that is used to store the line distance in the buffer.\nconst LINE_DISTANCE_BUFFER_BITS = 15;\n\n// We don't have enough bits for the line distance as we'd like to have, so\n// use this value to scale the line distance (in tile units) down to a smaller\n// value. This lets us store longer distances while sacrificing precision.\nconst LINE_DISTANCE_SCALE = 1 / 2;\n\n// The maximum line distance, in tile units, that fits in the buffer.\nconst MAX_LINE_DISTANCE = Math.pow(2, LINE_DISTANCE_BUFFER_BITS - 1) / LINE_DISTANCE_SCALE;\n\nfunction addLineVertex(layoutVertexBuffer, point: Point, extrude: Point, round: boolean, up: boolean, dir: number, linesofar: number) {\n layoutVertexBuffer.emplaceBack(\n // a_pos_normal\n point.x,\n point.y,\n round ? 1 : 0,\n up ? 1 : -1,\n // a_data\n // add 128 to store a byte in an unsigned byte\n Math.round(EXTRUDE_SCALE * extrude.x) + 128,\n Math.round(EXTRUDE_SCALE * extrude.y) + 128,\n // Encode the -1/0/1 direction value into the first two bits of .z of a_data.\n // Combine it with the lower 6 bits of `linesofar` (shifted by 2 bites to make\n // room for the direction value). The upper 8 bits of `linesofar` are placed in\n // the `w` component. `linesofar` is scaled down by `LINE_DISTANCE_SCALE` so that\n // we can store longer distances while sacrificing precision.\n ((dir === 0 ? 0 : (dir < 0 ? -1 : 1)) + 1) | (((linesofar * LINE_DISTANCE_SCALE) & 0x3F) << 2),\n (linesofar * LINE_DISTANCE_SCALE) >> 6);\n}\n\n\n/**\n * @private\n */\nclass LineBucket implements Bucket {\n distance: number;\n e1: number;\n e2: number;\n e3: number;\n\n index: number;\n zoom: number;\n overscaling: number;\n layers: Array;\n layerIds: Array;\n\n layoutVertexArray: LineLayoutArray;\n layoutVertexBuffer: VertexBuffer;\n\n indexArray: TriangleIndexArray;\n indexBuffer: IndexBuffer;\n\n programConfigurations: ProgramConfigurationSet;\n segments: SegmentVector;\n uploaded: boolean;\n\n constructor(options: BucketParameters) {\n this.zoom = options.zoom;\n this.overscaling = options.overscaling;\n this.layers = options.layers;\n this.layerIds = this.layers.map(layer => layer.id);\n this.index = options.index;\n\n this.layoutVertexArray = new LineLayoutArray();\n this.indexArray = new TriangleIndexArray();\n this.programConfigurations = new ProgramConfigurationSet(layoutAttributes, options.layers, options.zoom);\n this.segments = new SegmentVector();\n }\n\n populate(features: Array, options: PopulateParameters) {\n for (const {feature, index, sourceLayerIndex} of features) {\n if (this.layers[0]._featureFilter(new EvaluationParameters(this.zoom), feature)) {\n const geometry = loadGeometry(feature);\n this.addFeature(feature, geometry);\n options.featureIndex.insert(feature, geometry, index, sourceLayerIndex, this.index);\n }\n }\n }\n\n isEmpty() {\n return this.layoutVertexArray.length === 0;\n }\n\n upload(context: Context) {\n this.layoutVertexBuffer = context.createVertexBuffer(this.layoutVertexArray, layoutAttributes);\n this.indexBuffer = context.createIndexBuffer(this.indexArray);\n this.programConfigurations.upload(context);\n }\n\n destroy() {\n if (!this.layoutVertexBuffer) return;\n this.layoutVertexBuffer.destroy();\n this.indexBuffer.destroy();\n this.programConfigurations.destroy();\n this.segments.destroy();\n }\n\n addFeature(feature: VectorTileFeature, geometry: Array>) {\n const layout = this.layers[0].layout;\n const join = layout.get('line-join').evaluate(feature);\n const cap = layout.get('line-cap');\n const miterLimit = layout.get('line-miter-limit');\n const roundLimit = layout.get('line-round-limit');\n\n for (const line of geometry) {\n this.addLine(line, feature, join, cap, miterLimit, roundLimit);\n }\n }\n\n addLine(vertices: Array, feature: VectorTileFeature, join: string, cap: string, miterLimit: number, roundLimit: number) {\n let lineDistances = null;\n if (!!feature.properties &&\n feature.properties.hasOwnProperty('mapbox_clip_start') &&\n feature.properties.hasOwnProperty('mapbox_clip_end')) {\n lineDistances = {\n start: feature.properties.mapbox_clip_start,\n end: feature.properties.mapbox_clip_end,\n tileTotal: undefined\n };\n }\n\n const isPolygon = vectorTileFeatureTypes[feature.type] === 'Polygon';\n\n // If the line has duplicate vertices at the ends, adjust start/length to remove them.\n let len = vertices.length;\n while (len >= 2 && vertices[len - 1].equals(vertices[len - 2])) {\n len--;\n }\n let first = 0;\n while (first < len - 1 && vertices[first].equals(vertices[first + 1])) {\n first++;\n }\n\n // Ignore invalid geometry.\n if (len < (isPolygon ? 3 : 2)) return;\n\n if (lineDistances) {\n lineDistances.tileTotal = calculateFullDistance(vertices, first, len);\n }\n\n if (join === 'bevel') miterLimit = 1.05;\n\n const sharpCornerOffset = SHARP_CORNER_OFFSET * (EXTENT / (512 * this.overscaling));\n\n const firstVertex = vertices[first];\n\n // we could be more precise, but it would only save a negligible amount of space\n const segment = this.segments.prepareSegment(len * 10, this.layoutVertexArray, this.indexArray);\n\n this.distance = 0;\n\n const beginCap = cap,\n endCap = isPolygon ? 'butt' : cap;\n let startOfLine = true;\n let currentVertex;\n let prevVertex = ((undefined: any): Point);\n let nextVertex = ((undefined: any): Point);\n let prevNormal = ((undefined: any): Point);\n let nextNormal = ((undefined: any): Point);\n let offsetA;\n let offsetB;\n\n // the last three vertices added\n this.e1 = this.e2 = this.e3 = -1;\n\n if (isPolygon) {\n currentVertex = vertices[len - 2];\n nextNormal = firstVertex.sub(currentVertex)._unit()._perp();\n }\n\n for (let i = first; i < len; i++) {\n\n nextVertex = isPolygon && i === len - 1 ?\n vertices[first + 1] : // if the line is closed, we treat the last vertex like the first\n vertices[i + 1]; // just the next vertex\n\n // if two consecutive vertices exist, skip the current one\n if (nextVertex && vertices[i].equals(nextVertex)) continue;\n\n if (nextNormal) prevNormal = nextNormal;\n if (currentVertex) prevVertex = currentVertex;\n\n currentVertex = vertices[i];\n\n // Calculate the normal towards the next vertex in this line. In case\n // there is no next vertex, pretend that the line is continuing straight,\n // meaning that we are just using the previous normal.\n nextNormal = nextVertex ? nextVertex.sub(currentVertex)._unit()._perp() : prevNormal;\n\n // If we still don't have a previous normal, this is the beginning of a\n // non-closed line, so we're doing a straight \"join\".\n prevNormal = prevNormal || nextNormal;\n\n // Determine the normal of the join extrusion. It is the angle bisector\n // of the segments between the previous line and the next line.\n // In the case of 180° angles, the prev and next normals cancel each other out:\n // prevNormal + nextNormal = (0, 0), its magnitude is 0, so the unit vector would be\n // undefined. In that case, we're keeping the joinNormal at (0, 0), so that the cosHalfAngle\n // below will also become 0 and miterLength will become Infinity.\n let joinNormal = prevNormal.add(nextNormal);\n if (joinNormal.x !== 0 || joinNormal.y !== 0) {\n joinNormal._unit();\n }\n /* joinNormal prevNormal\n * ↖ ↑\n * .________. prevVertex\n * |\n * nextNormal ← | currentVertex\n * |\n * nextVertex !\n *\n */\n\n // Calculate the length of the miter (the ratio of the miter to the width).\n // Find the cosine of the angle between the next and join normals\n // using dot product. The inverse of that is the miter length.\n const cosHalfAngle = joinNormal.x * nextNormal.x + joinNormal.y * nextNormal.y;\n const miterLength = cosHalfAngle !== 0 ? 1 / cosHalfAngle : Infinity;\n\n const isSharpCorner = cosHalfAngle < COS_HALF_SHARP_CORNER && prevVertex && nextVertex;\n\n if (isSharpCorner && i > first) {\n const prevSegmentLength = currentVertex.dist(prevVertex);\n if (prevSegmentLength > 2 * sharpCornerOffset) {\n const newPrevVertex = currentVertex.sub(currentVertex.sub(prevVertex)._mult(sharpCornerOffset / prevSegmentLength)._round());\n this.distance += newPrevVertex.dist(prevVertex);\n this.addCurrentVertex(newPrevVertex, this.distance, prevNormal.mult(1), 0, 0, false, segment, lineDistances);\n prevVertex = newPrevVertex;\n }\n }\n\n // The join if a middle vertex, otherwise the cap.\n const middleVertex = prevVertex && nextVertex;\n let currentJoin = middleVertex ? join : nextVertex ? beginCap : endCap;\n\n if (middleVertex && currentJoin === 'round') {\n if (miterLength < roundLimit) {\n currentJoin = 'miter';\n } else if (miterLength <= 2) {\n currentJoin = 'fakeround';\n }\n }\n\n if (currentJoin === 'miter' && miterLength > miterLimit) {\n currentJoin = 'bevel';\n }\n\n if (currentJoin === 'bevel') {\n // The maximum extrude length is 128 / 63 = 2 times the width of the line\n // so if miterLength >= 2 we need to draw a different type of bevel here.\n if (miterLength > 2) currentJoin = 'flipbevel';\n\n // If the miterLength is really small and the line bevel wouldn't be visible,\n // just draw a miter join to save a triangle.\n if (miterLength < miterLimit) currentJoin = 'miter';\n }\n\n // Calculate how far along the line the currentVertex is\n if (prevVertex) this.distance += currentVertex.dist(prevVertex);\n\n if (currentJoin === 'miter') {\n\n joinNormal._mult(miterLength);\n this.addCurrentVertex(currentVertex, this.distance, joinNormal, 0, 0, false, segment, lineDistances);\n\n } else if (currentJoin === 'flipbevel') {\n // miter is too big, flip the direction to make a beveled join\n\n if (miterLength > 100) {\n // Almost parallel lines\n joinNormal = nextNormal.clone().mult(-1);\n\n } else {\n const direction = prevNormal.x * nextNormal.y - prevNormal.y * nextNormal.x > 0 ? -1 : 1;\n const bevelLength = miterLength * prevNormal.add(nextNormal).mag() / prevNormal.sub(nextNormal).mag();\n joinNormal._perp()._mult(bevelLength * direction);\n }\n this.addCurrentVertex(currentVertex, this.distance, joinNormal, 0, 0, false, segment, lineDistances);\n this.addCurrentVertex(currentVertex, this.distance, joinNormal.mult(-1), 0, 0, false, segment, lineDistances);\n\n } else if (currentJoin === 'bevel' || currentJoin === 'fakeround') {\n const lineTurnsLeft = (prevNormal.x * nextNormal.y - prevNormal.y * nextNormal.x) > 0;\n const offset = -Math.sqrt(miterLength * miterLength - 1);\n if (lineTurnsLeft) {\n offsetB = 0;\n offsetA = offset;\n } else {\n offsetA = 0;\n offsetB = offset;\n }\n\n // Close previous segment with a bevel\n if (!startOfLine) {\n this.addCurrentVertex(currentVertex, this.distance, prevNormal, offsetA, offsetB, false, segment, lineDistances);\n }\n\n if (currentJoin === 'fakeround') {\n // The join angle is sharp enough that a round join would be visible.\n // Bevel joins fill the gap between segments with a single pie slice triangle.\n // Create a round join by adding multiple pie slices. The join isn't actually round, but\n // it looks like it is at the sizes we render lines at.\n\n // Add more triangles for sharper angles.\n // This math is just a good enough approximation. It isn't \"correct\".\n const n = Math.floor((0.5 - (cosHalfAngle - 0.5)) * 8);\n let approxFractionalJoinNormal;\n\n for (let m = 0; m < n; m++) {\n approxFractionalJoinNormal = nextNormal.mult((m + 1) / (n + 1))._add(prevNormal)._unit();\n this.addPieSliceVertex(currentVertex, this.distance, approxFractionalJoinNormal, lineTurnsLeft, segment, lineDistances);\n }\n\n this.addPieSliceVertex(currentVertex, this.distance, joinNormal, lineTurnsLeft, segment, lineDistances);\n\n for (let k = n - 1; k >= 0; k--) {\n approxFractionalJoinNormal = prevNormal.mult((k + 1) / (n + 1))._add(nextNormal)._unit();\n this.addPieSliceVertex(currentVertex, this.distance, approxFractionalJoinNormal, lineTurnsLeft, segment, lineDistances);\n }\n }\n\n // Start next segment\n if (nextVertex) {\n this.addCurrentVertex(currentVertex, this.distance, nextNormal, -offsetA, -offsetB, false, segment, lineDistances);\n }\n\n } else if (currentJoin === 'butt') {\n if (!startOfLine) {\n // Close previous segment with a butt\n this.addCurrentVertex(currentVertex, this.distance, prevNormal, 0, 0, false, segment, lineDistances);\n }\n\n // Start next segment with a butt\n if (nextVertex) {\n this.addCurrentVertex(currentVertex, this.distance, nextNormal, 0, 0, false, segment, lineDistances);\n }\n\n } else if (currentJoin === 'square') {\n\n if (!startOfLine) {\n // Close previous segment with a square cap\n this.addCurrentVertex(currentVertex, this.distance, prevNormal, 1, 1, false, segment, lineDistances);\n\n // The segment is done. Unset vertices to disconnect segments.\n this.e1 = this.e2 = -1;\n }\n\n // Start next segment\n if (nextVertex) {\n this.addCurrentVertex(currentVertex, this.distance, nextNormal, -1, -1, false, segment, lineDistances);\n }\n\n } else if (currentJoin === 'round') {\n\n if (!startOfLine) {\n // Close previous segment with butt\n this.addCurrentVertex(currentVertex, this.distance, prevNormal, 0, 0, false, segment, lineDistances);\n\n // Add round cap or linejoin at end of segment\n this.addCurrentVertex(currentVertex, this.distance, prevNormal, 1, 1, true, segment, lineDistances);\n\n // The segment is done. Unset vertices to disconnect segments.\n this.e1 = this.e2 = -1;\n }\n\n\n // Start next segment with a butt\n if (nextVertex) {\n // Add round cap before first segment\n this.addCurrentVertex(currentVertex, this.distance, nextNormal, -1, -1, true, segment, lineDistances);\n\n this.addCurrentVertex(currentVertex, this.distance, nextNormal, 0, 0, false, segment, lineDistances);\n }\n }\n\n if (isSharpCorner && i < len - 1) {\n const nextSegmentLength = currentVertex.dist(nextVertex);\n if (nextSegmentLength > 2 * sharpCornerOffset) {\n const newCurrentVertex = currentVertex.add(nextVertex.sub(currentVertex)._mult(sharpCornerOffset / nextSegmentLength)._round());\n this.distance += newCurrentVertex.dist(currentVertex);\n this.addCurrentVertex(newCurrentVertex, this.distance, nextNormal.mult(1), 0, 0, false, segment, lineDistances);\n currentVertex = newCurrentVertex;\n }\n }\n\n startOfLine = false;\n }\n\n this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, feature);\n }\n\n /**\n * Add two vertices to the buffers.\n *\n * @param {Object} currentVertex the line vertex to add buffer vertices for\n * @param {number} distance the distance from the beginning of the line to the vertex\n * @param {number} endLeft extrude to shift the left vertex along the line\n * @param {number} endRight extrude to shift the left vertex along the line\n * @param {boolean} round whether this is a round cap\n * @private\n */\n addCurrentVertex(currentVertex: Point,\n distance: number,\n normal: Point,\n endLeft: number,\n endRight: number,\n round: boolean,\n segment: Segment,\n distancesForScaling: ?Object) {\n let extrude;\n const layoutVertexArray = this.layoutVertexArray;\n const indexArray = this.indexArray;\n\n if (distancesForScaling) {\n // For gradient lines, scale distance from tile units to [0, 2^15)\n distance = scaleDistance(distance, distancesForScaling);\n }\n\n extrude = normal.clone();\n if (endLeft) extrude._sub(normal.perp()._mult(endLeft));\n addLineVertex(layoutVertexArray, currentVertex, extrude, round, false, endLeft, distance);\n this.e3 = segment.vertexLength++;\n if (this.e1 >= 0 && this.e2 >= 0) {\n indexArray.emplaceBack(this.e1, this.e2, this.e3);\n segment.primitiveLength++;\n }\n this.e1 = this.e2;\n this.e2 = this.e3;\n\n extrude = normal.mult(-1);\n if (endRight) extrude._sub(normal.perp()._mult(endRight));\n addLineVertex(layoutVertexArray, currentVertex, extrude, round, true, -endRight, distance);\n this.e3 = segment.vertexLength++;\n if (this.e1 >= 0 && this.e2 >= 0) {\n indexArray.emplaceBack(this.e1, this.e2, this.e3);\n segment.primitiveLength++;\n }\n this.e1 = this.e2;\n this.e2 = this.e3;\n\n // There is a maximum \"distance along the line\" that we can store in the buffers.\n // When we get close to the distance, reset it to zero and add the vertex again with\n // a distance of zero. The max distance is determined by the number of bits we allocate\n // to `linesofar`.\n if (distance > MAX_LINE_DISTANCE / 2 && !distancesForScaling) {\n this.distance = 0;\n this.addCurrentVertex(currentVertex, this.distance, normal, endLeft, endRight, round, segment);\n }\n }\n\n /**\n * Add a single new vertex and a triangle using two previous vertices.\n * This adds a pie slice triangle near a join to simulate round joins\n *\n * @param currentVertex the line vertex to add buffer vertices for\n * @param distance the distance from the beginning of the line to the vertex\n * @param extrude the offset of the new vertex from the currentVertex\n * @param lineTurnsLeft whether the line is turning left or right at this angle\n * @private\n */\n addPieSliceVertex(currentVertex: Point,\n distance: number,\n extrude: Point,\n lineTurnsLeft: boolean,\n segment: Segment,\n distancesForScaling: ?Object) {\n extrude = extrude.mult(lineTurnsLeft ? -1 : 1);\n const layoutVertexArray = this.layoutVertexArray;\n const indexArray = this.indexArray;\n\n if (distancesForScaling) distance = scaleDistance(distance, distancesForScaling);\n\n addLineVertex(layoutVertexArray, currentVertex, extrude, false, lineTurnsLeft, 0, distance);\n this.e3 = segment.vertexLength++;\n if (this.e1 >= 0 && this.e2 >= 0) {\n indexArray.emplaceBack(this.e1, this.e2, this.e3);\n segment.primitiveLength++;\n }\n\n if (lineTurnsLeft) {\n this.e2 = this.e3;\n } else {\n this.e1 = this.e3;\n }\n }\n}\n\n/**\n * Knowing the ratio of the full linestring covered by this tiled feature, as well\n * as the total distance (in tile units) of this tiled feature, and the distance\n * (in tile units) of the current vertex, we can determine the relative distance\n * of this vertex along the full linestring feature and scale it to [0, 2^15)\n *\n * @param {number} tileDistance the distance from the beginning of the tiled line to this vertex\n * @param {Object} stats\n * @param {number} stats.start the ratio (0-1) along a full original linestring feature of the start of this tiled line feature\n * @param {number} stats.end the ratio (0-1) along a full original linestring feature of the end of this tiled line feature\n * @param {number} stats.tileTotal the total distance, in tile units, of this tiled line feature\n *\n * @private\n */\nfunction scaleDistance(tileDistance: number, stats: Object) {\n return ((tileDistance / stats.tileTotal) * (stats.end - stats.start) + stats.start) * (MAX_LINE_DISTANCE - 1);\n}\n\n/**\n * Calculate the total distance, in tile units, of this tiled line feature\n *\n * @param {Array} vertices the full geometry of this tiled line feature\n * @param {number} first the index in the vertices array representing the first vertex we should consider\n * @param {number} len the count of vertices we should consider from `first`\n *\n * @private\n */\nfunction calculateFullDistance(vertices: Array, first: number, len: number) {\n let currentVertex, nextVertex;\n let total = 0;\n for (let i = first; i < len - 1; i++) {\n currentVertex = vertices[i];\n nextVertex = vertices[i + 1];\n total += currentVertex.dist(nextVertex);\n }\n return total;\n}\n\nregister('LineBucket', LineBucket, {omit: ['layers']});\n\nexport default LineBucket;\n","// This file is generated. Edit build/generate-style-code.js, then run `yarn run codegen`.\n// @flow\n/* eslint-disable */\n\nimport styleSpec from '../../style-spec/reference/latest';\n\nimport {\n Properties,\n DataConstantProperty,\n DataDrivenProperty,\n CrossFadedProperty,\n ColorRampProperty\n} from '../properties';\n\nimport type Color from '../../style-spec/util/color';\n\nexport type LayoutProps = {|\n \"line-cap\": DataConstantProperty<\"butt\" | \"round\" | \"square\">,\n \"line-join\": DataDrivenProperty<\"bevel\" | \"round\" | \"miter\">,\n \"line-miter-limit\": DataConstantProperty,\n \"line-round-limit\": DataConstantProperty,\n|};\n\nconst layout: Properties = new Properties({\n \"line-cap\": new DataConstantProperty(styleSpec[\"layout_line\"][\"line-cap\"]),\n \"line-join\": new DataDrivenProperty(styleSpec[\"layout_line\"][\"line-join\"]),\n \"line-miter-limit\": new DataConstantProperty(styleSpec[\"layout_line\"][\"line-miter-limit\"]),\n \"line-round-limit\": new DataConstantProperty(styleSpec[\"layout_line\"][\"line-round-limit\"]),\n});\n\nexport type PaintProps = {|\n \"line-opacity\": DataDrivenProperty,\n \"line-color\": DataDrivenProperty,\n \"line-translate\": DataConstantProperty<[number, number]>,\n \"line-translate-anchor\": DataConstantProperty<\"map\" | \"viewport\">,\n \"line-width\": DataDrivenProperty,\n \"line-gap-width\": DataDrivenProperty,\n \"line-offset\": DataDrivenProperty,\n \"line-blur\": DataDrivenProperty,\n \"line-dasharray\": CrossFadedProperty>,\n \"line-pattern\": CrossFadedProperty,\n \"line-gradient\": ColorRampProperty,\n|};\n\nconst paint: Properties = new Properties({\n \"line-opacity\": new DataDrivenProperty(styleSpec[\"paint_line\"][\"line-opacity\"]),\n \"line-color\": new DataDrivenProperty(styleSpec[\"paint_line\"][\"line-color\"]),\n \"line-translate\": new DataConstantProperty(styleSpec[\"paint_line\"][\"line-translate\"]),\n \"line-translate-anchor\": new DataConstantProperty(styleSpec[\"paint_line\"][\"line-translate-anchor\"]),\n \"line-width\": new DataDrivenProperty(styleSpec[\"paint_line\"][\"line-width\"]),\n \"line-gap-width\": new DataDrivenProperty(styleSpec[\"paint_line\"][\"line-gap-width\"]),\n \"line-offset\": new DataDrivenProperty(styleSpec[\"paint_line\"][\"line-offset\"]),\n \"line-blur\": new DataDrivenProperty(styleSpec[\"paint_line\"][\"line-blur\"]),\n \"line-dasharray\": new CrossFadedProperty(styleSpec[\"paint_line\"][\"line-dasharray\"]),\n \"line-pattern\": new CrossFadedProperty(styleSpec[\"paint_line\"][\"line-pattern\"]),\n \"line-gradient\": new ColorRampProperty(styleSpec[\"paint_line\"][\"line-gradient\"]),\n});\n\nexport default { paint, layout };\n","// @flow\n\nimport Point from '@mapbox/point-geometry';\n\nimport StyleLayer from '../style_layer';\nimport LineBucket from '../../data/bucket/line_bucket';\nimport { RGBAImage } from '../../util/image';\nimport { multiPolygonIntersectsBufferedMultiLine } from '../../util/intersection_tests';\nimport { getMaximumPaintValue, translateDistance, translate } from '../query_utils';\nimport properties from './line_style_layer_properties';\nimport { extend } from '../../util/util';\nimport EvaluationParameters from '../evaluation_parameters';\nimport renderColorRamp from '../../util/color_ramp';\nimport { Transitionable, Transitioning, Layout, PossiblyEvaluated, DataDrivenProperty } from '../properties';\n\nimport type {Bucket, BucketParameters} from '../../data/bucket';\nimport type {LayoutProps, PaintProps} from './line_style_layer_properties';\nimport type Transform from '../../geo/transform';\nimport type Texture from '../../render/texture';\n\nclass LineFloorwidthProperty extends DataDrivenProperty {\n useIntegerZoom: true;\n\n possiblyEvaluate(value, parameters) {\n parameters = new EvaluationParameters(Math.floor(parameters.zoom), {\n now: parameters.now,\n fadeDuration: parameters.fadeDuration,\n zoomHistory: parameters.zoomHistory,\n transition: parameters.transition\n });\n return super.possiblyEvaluate(value, parameters);\n }\n\n evaluate(value, globals, feature) {\n globals = extend({}, globals, {zoom: Math.floor(globals.zoom)});\n return super.evaluate(value, globals, feature);\n }\n}\n\nconst lineFloorwidthProperty = new LineFloorwidthProperty(properties.paint.properties['line-width'].specification);\nlineFloorwidthProperty.useIntegerZoom = true;\n\nclass LineStyleLayer extends StyleLayer {\n _unevaluatedLayout: Layout;\n layout: PossiblyEvaluated;\n\n gradient: ?RGBAImage;\n gradientTexture: ?Texture;\n\n _transitionablePaint: Transitionable;\n _transitioningPaint: Transitioning;\n paint: PossiblyEvaluated;\n\n constructor(layer: LayerSpecification) {\n super(layer, properties);\n }\n\n setPaintProperty(name: string, value: mixed, options: {validate: boolean}) {\n super.setPaintProperty(name, value, options);\n if (name === 'line-gradient') {\n this._updateGradient();\n }\n }\n\n _updateGradient() {\n const expression = this._transitionablePaint._values['line-gradient'].value.expression;\n this.gradient = renderColorRamp(expression, 'lineProgress');\n this.gradientTexture = null;\n }\n\n recalculate(parameters: EvaluationParameters) {\n super.recalculate(parameters);\n\n (this.paint._values: any)['line-floorwidth'] =\n lineFloorwidthProperty.possiblyEvaluate(this._transitioningPaint._values['line-width'].value, parameters);\n }\n\n createBucket(parameters: BucketParameters<*>) {\n return new LineBucket(parameters);\n }\n\n queryRadius(bucket: Bucket): number {\n const lineBucket: LineBucket = (bucket: any);\n const width = getLineWidth(\n getMaximumPaintValue('line-width', this, lineBucket),\n getMaximumPaintValue('line-gap-width', this, lineBucket));\n const offset = getMaximumPaintValue('line-offset', this, lineBucket);\n return width / 2 + Math.abs(offset) + translateDistance(this.paint.get('line-translate'));\n }\n\n queryIntersectsFeature(queryGeometry: Array>,\n feature: VectorTileFeature,\n geometry: Array>,\n zoom: number,\n transform: Transform,\n pixelsToTileUnits: number): boolean {\n const translatedPolygon = translate(queryGeometry,\n this.paint.get('line-translate'),\n this.paint.get('line-translate-anchor'),\n transform.angle, pixelsToTileUnits);\n const halfWidth = pixelsToTileUnits / 2 * getLineWidth(\n this.paint.get('line-width').evaluate(feature),\n this.paint.get('line-gap-width').evaluate(feature));\n const lineOffset = this.paint.get('line-offset').evaluate(feature);\n if (lineOffset) {\n geometry = offsetLine(geometry, lineOffset * pixelsToTileUnits);\n }\n return multiPolygonIntersectsBufferedMultiLine(translatedPolygon, geometry, halfWidth);\n }\n}\n\nexport default LineStyleLayer;\n\nfunction getLineWidth(lineWidth, lineGapWidth) {\n if (lineGapWidth > 0) {\n return lineGapWidth + 2 * lineWidth;\n } else {\n return lineWidth;\n }\n}\n\nfunction offsetLine(rings, offset) {\n const newRings = [];\n const zero = new Point(0, 0);\n for (let k = 0; k < rings.length; k++) {\n const ring = rings[k];\n const newRing = [];\n for (let i = 0; i < ring.length; i++) {\n const a = ring[i - 1];\n const b = ring[i];\n const c = ring[i + 1];\n const aToB = i === 0 ? zero : b.sub(a)._unit()._perp();\n const bToC = i === ring.length - 1 ? zero : c.sub(b)._unit()._perp();\n const extrude = aToB._add(bToC)._unit();\n\n const cosHalfAngle = extrude.x * bToC.x + extrude.y * bToC.y;\n extrude._mult(1 / cosHalfAngle);\n\n newRing.push(extrude._mult(offset)._add(b));\n }\n newRings.push(newRing);\n }\n return newRings;\n}\n","// @flow\n\nimport { createLayout } from '../../util/struct_array';\n\nexport const symbolLayoutAttributes = createLayout([\n {name: 'a_pos_offset', components: 4, type: 'Int16'},\n {name: 'a_data', components: 4, type: 'Uint16'}\n]);\n\nexport const dynamicLayoutAttributes = createLayout([\n { name: 'a_projected_pos', components: 3, type: 'Float32' }\n], 4);\n\nexport const placementOpacityAttributes = createLayout([\n { name: 'a_fade_opacity', components: 1, type: 'Uint32' }\n], 4);\n\nexport const collisionVertexAttributes = createLayout([\n { name: 'a_placed', components: 2, type: 'Uint8' }\n], 4);\n\nexport const collisionBox = createLayout([\n // the box is centered around the anchor point\n { type: 'Int16', name: 'anchorPointX' },\n { type: 'Int16', name: 'anchorPointY' },\n\n // distances to the edges from the anchor\n { type: 'Int16', name: 'x1' },\n { type: 'Int16', name: 'y1' },\n { type: 'Int16', name: 'x2' },\n { type: 'Int16', name: 'y2' },\n\n // the index of the feature in the original vectortile\n { type: 'Uint32', name: 'featureIndex' },\n // the source layer the feature appears in\n { type: 'Uint16', name: 'sourceLayerIndex' },\n // the bucket the feature appears in\n { type: 'Uint16', name: 'bucketIndex' },\n\n // collision circles for lines store their distance to the anchor in tile units\n // so that they can be ignored if the projected label doesn't extend into\n // the box area\n { type: 'Int16', name: 'radius' },\n { type: 'Int16', name: 'signedDistanceFromAnchor' }\n]);\n\nexport const collisionBoxLayout = createLayout([ // used to render collision boxes for debugging purposes\n {name: 'a_pos', components: 2, type: 'Int16'},\n {name: 'a_anchor_pos', components: 2, type: 'Int16'},\n {name: 'a_extrude', components: 2, type: 'Int16'}\n], 4);\n\nexport const collisionCircleLayout = createLayout([ // used to render collision circles for debugging purposes\n {name: 'a_pos', components: 2, type: 'Int16'},\n {name: 'a_anchor_pos', components: 2, type: 'Int16'},\n {name: 'a_extrude', components: 2, type: 'Int16'}\n], 4);\n\nexport const placement = createLayout([\n { type: 'Int16', name: 'anchorX' },\n { type: 'Int16', name: 'anchorY' },\n { type: 'Uint16', name: 'glyphStartIndex' },\n { type: 'Uint16', name: 'numGlyphs' },\n { type: 'Uint32', name: 'vertexStartIndex' },\n { type: 'Uint32', name: 'lineStartIndex' },\n { type: 'Uint32', name: 'lineLength' },\n { type: 'Uint16', name: 'segment' },\n { type: 'Uint16', name: 'lowerSize' },\n { type: 'Uint16', name: 'upperSize' },\n { type: 'Float32', name: 'lineOffsetX' },\n { type: 'Float32', name: 'lineOffsetY' },\n { type: 'Uint8', name: 'writingMode' },\n { type: 'Uint8', name: 'hidden' }\n]);\n\nexport const glyphOffset = createLayout([\n { type: 'Float32', name: 'offsetX' }\n]);\n\nexport const lineVertex = createLayout([\n { type: 'Int16', name: 'x' },\n { type: 'Int16', name: 'y' },\n { type: 'Int16', name: 'tileUnitDistanceFromAnchor' }\n]);\n","// @flow\n\nimport {\n charHasRotatedVerticalOrientation,\n} from './script_detection';\n\nexport const verticalizedCharacterMap = {\n '!': '︕',\n '#': '#',\n '$': '$',\n '%': '%',\n '&': '&',\n '(': '︵',\n ')': '︶',\n '*': '*',\n '+': '+',\n ',': '︐',\n '-': '︲',\n '.': '・',\n '/': '/',\n ':': '︓',\n ';': '︔',\n '<': '︿',\n '=': '=',\n '>': '﹀',\n '?': '︖',\n '@': '@',\n '[': '﹇',\n '\\\\': '\',\n ']': '﹈',\n '^': '^',\n '_': '︳',\n '`': '`',\n '{': '︷',\n '|': '―',\n '}': '︸',\n '~': '~',\n '¢': '¢',\n '£': '£',\n '¥': '¥',\n '¦': '¦',\n '¬': '¬',\n '¯': ' ̄',\n '–': '︲',\n '—': '︱',\n '‘': '﹃',\n '’': '﹄',\n '“': '﹁',\n '”': '﹂',\n '…': '︙',\n '‧': '・',\n '₩': '₩',\n '、': '︑',\n '。': '︒',\n '〈': '︿',\n '〉': '﹀',\n '《': '︽',\n '》': '︾',\n '「': '﹁',\n '」': '﹂',\n '『': '﹃',\n '』': '﹄',\n '【': '︻',\n '】': '︼',\n '〔': '︹',\n '〕': '︺',\n '〖': '︗',\n '〗': '︘',\n '!': '︕',\n '(': '︵',\n ')': '︶',\n ',': '︐',\n '-': '︲',\n '.': '・',\n ':': '︓',\n ';': '︔',\n '<': '︿',\n '>': '﹀',\n '?': '︖',\n '[': '﹇',\n ']': '﹈',\n '_': '︳',\n '{': '︷',\n '|': '―',\n '}': '︸',\n '⦅': '︵',\n '⦆': '︶',\n '。': '︒',\n '「': '﹁',\n '」': '﹂'\n};\n\nexport default function verticalizePunctuation(input: string) {\n let output = '';\n\n for (let i = 0; i < input.length; i++) {\n const nextCharCode = input.charCodeAt(i + 1) || null;\n const prevCharCode = input.charCodeAt(i - 1) || null;\n\n const canReplacePunctuation = (\n (!nextCharCode || !charHasRotatedVerticalOrientation(nextCharCode) || verticalizedCharacterMap[input[i + 1]]) &&\n (!prevCharCode || !charHasRotatedVerticalOrientation(prevCharCode) || verticalizedCharacterMap[input[i - 1]])\n );\n\n if (canReplacePunctuation && verticalizedCharacterMap[input[i]]) {\n output += verticalizedCharacterMap[input[i]];\n } else {\n output += input[i];\n }\n }\n\n return output;\n}\n\n","// @flow\n\nimport Point from '@mapbox/point-geometry';\n\nimport { register } from '../util/web_worker_transfer';\n\nclass Anchor extends Point {\n angle: any;\n segment: number | void;\n\n constructor(x: number, y: number, angle: number, segment?: number) {\n super(x, y);\n this.angle = angle;\n if (segment !== undefined) {\n this.segment = segment;\n }\n }\n\n clone() {\n return new Anchor(this.x, this.y, this.angle, this.segment);\n }\n}\n\nregister('Anchor', Anchor);\n\nexport default Anchor;\n","// @flow\n\nimport { normalizePropertyExpression } from '../style-spec/expression';\n\nimport { number as interpolate } from '../style-spec/util/interpolate';\nimport { clamp } from '../util/util';\nimport EvaluationParameters from '../style/evaluation_parameters';\n\nimport type {Property, PropertyValue, PossiblyEvaluatedPropertyValue} from '../style/properties';\nimport type {CameraExpression, CompositeExpression} from '../style-spec/expression/index';\n\nexport { getSizeData, evaluateSizeForFeature, evaluateSizeForZoom };\n\nexport type SizeData = {\n functionType: 'constant',\n layoutSize: number\n} | {\n functionType: 'source'\n} | {\n functionType: 'camera',\n layoutSize: number,\n zoomRange: {min: number, max: number},\n sizeRange: {min: number, max: number},\n propertyValue: PropertyValueSpecification\n} | {\n functionType: 'composite',\n zoomRange: {min: number, max: number},\n propertyValue: PropertyValueSpecification\n};\n\n// For {text,icon}-size, get the bucket-level data that will be needed by\n// the painter to set symbol-size-related uniforms\nfunction getSizeData(tileZoom: number, value: PropertyValue>): SizeData {\n const {expression} = value;\n if (expression.kind === 'constant') {\n return {\n functionType: 'constant',\n layoutSize: expression.evaluate(new EvaluationParameters(tileZoom + 1))\n };\n } else if (expression.kind === 'source') {\n return {\n functionType: 'source'\n };\n } else {\n // calculate covering zoom stops for zoom-dependent values\n const levels = expression.zoomStops;\n\n let lower = 0;\n while (lower < levels.length && levels[lower] <= tileZoom) lower++;\n lower = Math.max(0, lower - 1);\n let upper = lower;\n while (upper < levels.length && levels[upper] < tileZoom + 1) upper++;\n upper = Math.min(levels.length - 1, upper);\n\n const zoomRange = {\n min: levels[lower],\n max: levels[upper]\n };\n\n // We'd like to be able to use CameraExpression or CompositeExpression in these\n // return types rather than ExpressionSpecification, but the former are not\n // transferrable across Web Worker boundaries.\n if (expression.kind === 'composite') {\n return {\n functionType: 'composite',\n zoomRange,\n propertyValue: (value.value: any)\n };\n } else {\n // for camera functions, also save off the function values\n // evaluated at the covering zoom levels\n return {\n functionType: 'camera',\n layoutSize: expression.evaluate(new EvaluationParameters(tileZoom + 1)),\n zoomRange,\n sizeRange: {\n min: expression.evaluate(new EvaluationParameters(zoomRange.min)),\n max: expression.evaluate(new EvaluationParameters(zoomRange.max))\n },\n propertyValue: (value.value: any)\n };\n }\n }\n}\n\nfunction evaluateSizeForFeature(sizeData: SizeData,\n partiallyEvaluatedSize: { uSize: number, uSizeT: number },\n symbol: { lowerSize: number, upperSize: number}) {\n const part = partiallyEvaluatedSize;\n if (sizeData.functionType === 'source') {\n return symbol.lowerSize / 10;\n } else if (sizeData.functionType === 'composite') {\n return interpolate(symbol.lowerSize / 10, symbol.upperSize / 10, part.uSizeT);\n } else {\n return part.uSize;\n }\n}\n\nfunction evaluateSizeForZoom(sizeData: SizeData, currentZoom: number, property: Property>) {\n if (sizeData.functionType === 'constant') {\n return {\n uSizeT: 0,\n uSize: sizeData.layoutSize\n };\n } else if (sizeData.functionType === 'source') {\n return {\n uSizeT: 0,\n uSize: 0\n };\n } else if (sizeData.functionType === 'camera') {\n const {propertyValue, zoomRange, sizeRange} = sizeData;\n const expression = ((normalizePropertyExpression(propertyValue, property.specification): any): CameraExpression);\n\n // Even though we could get the exact value of the camera function\n // at z = tr.zoom, we intentionally do not: instead, we interpolate\n // between the camera function values at a pair of zoom stops covering\n // [tileZoom, tileZoom + 1] in order to be consistent with this\n // restriction on composite functions\n const t = clamp(\n expression.interpolationFactor(currentZoom, zoomRange.min, zoomRange.max),\n 0,\n 1\n );\n\n return {\n uSizeT: 0,\n uSize: sizeRange.min + t * (sizeRange.max - sizeRange.min)\n };\n } else {\n const {propertyValue, zoomRange} = sizeData;\n const expression = ((normalizePropertyExpression(propertyValue, property.specification): any): CompositeExpression);\n\n return {\n uSizeT: clamp(\n expression.interpolationFactor(currentZoom, zoomRange.min, zoomRange.max),\n 0,\n 1\n ),\n uSize: 0\n };\n }\n}\n","// @flow\n\nimport { symbolLayoutAttributes, collisionVertexAttributes, collisionBoxLayout, collisionCircleLayout, dynamicLayoutAttributes } from './symbol_attributes';\n\nimport { SymbolLayoutArray, SymbolDynamicLayoutArray, SymbolOpacityArray, CollisionBoxLayoutArray, CollisionCircleLayoutArray, CollisionVertexArray, PlacedSymbolArray, GlyphOffsetArray, SymbolLineVertexArray } from '../array_types';\nimport Point from '@mapbox/point-geometry';\nimport SegmentVector from '../segment';\nimport { ProgramConfigurationSet } from '../program_configuration';\nimport { TriangleIndexArray, LineIndexArray } from '../index_array_type';\nimport transformText from '../../symbol/transform_text';\nimport mergeLines from '../../symbol/mergelines';\nimport {allowsVerticalWritingMode} from '../../util/script_detection';\nimport loadGeometry from '../load_geometry';\nimport mvt from '@mapbox/vector-tile';\nconst vectorTileFeatureTypes = mvt.VectorTileFeature.types;\nimport {verticalizedCharacterMap} from '../../util/verticalize_punctuation';\nimport Anchor from '../../symbol/anchor';\nimport { getSizeData } from '../../symbol/symbol_size';\nimport { register } from '../../util/web_worker_transfer';\nimport EvaluationParameters from '../../style/evaluation_parameters';\n\nimport type {Feature as ExpressionFeature} from '../../style-spec/expression';\nimport type {\n Bucket,\n BucketParameters,\n IndexedFeature,\n PopulateParameters\n} from '../bucket';\nimport type {CollisionBoxArray, CollisionBox} from '../array_types';\nimport type { StructArray, StructArrayMember } from '../../util/struct_array';\nimport type SymbolStyleLayer from '../../style/style_layer/symbol_style_layer';\nimport type Context from '../../gl/context';\nimport type IndexBuffer from '../../gl/index_buffer';\nimport type VertexBuffer from '../../gl/vertex_buffer';\nimport type {SymbolQuad} from '../../symbol/quads';\nimport type {SizeData} from '../../symbol/symbol_size';\n\nexport type SingleCollisionBox = {\n x1: number;\n y1: number;\n x2: number;\n y2: number;\n anchorPointX: number;\n anchorPointY: number;\n};\n\nexport type CollisionArrays = {\n textBox?: SingleCollisionBox;\n iconBox?: SingleCollisionBox;\n textCircles?: Array;\n textFeatureIndex?: number;\n iconFeatureIndex?: number;\n};\n\nexport type SymbolFeature = {|\n text: string | void,\n icon: string | void,\n index: number,\n sourceLayerIndex: number,\n geometry: Array>,\n properties: Object,\n type: 'Point' | 'LineString' | 'Polygon',\n id?: any\n|};\n\nexport type SymbolInstance = {\n key: string,\n textBoxStartIndex: number,\n textBoxEndIndex: number,\n iconBoxStartIndex: number,\n iconBoxEndIndex: number,\n textOffset: [number, number],\n iconOffset: [number, number],\n anchor: Anchor,\n line: Array,\n featureIndex: number,\n feature: SymbolFeature,\n textCollisionFeature?: {boxStartIndex: number, boxEndIndex: number},\n iconCollisionFeature?: {boxStartIndex: number, boxEndIndex: number},\n placedTextSymbolIndices: Array;\n numGlyphVertices: number;\n numVerticalGlyphVertices: number;\n numIconVertices: number;\n // Populated/modified on foreground during placement\n isDuplicate: boolean;\n crossTileID: number;\n collisionArrays?: CollisionArrays;\n placedText?: boolean;\n placedIcon?: boolean;\n hidden?: boolean;\n};\n\n// Opacity arrays are frequently updated but don't contain a lot of information, so we pack them\n// tight. Each Uint32 is actually four duplicate Uint8s for the four corners of a glyph\n// 7 bits are for the current opacity, and the lowest bit is the target opacity\n\n// actually defined in symbol_attributes.js\n// const placementOpacityAttributes = [\n// { name: 'a_fade_opacity', components: 1, type: 'Uint32' }\n// ];\nconst shaderOpacityAttributes = [\n { name: 'a_fade_opacity', components: 1, type: 'Uint8', offset: 0 }\n];\n\nfunction addVertex(array, anchorX, anchorY, ox, oy, tx, ty, sizeVertex) {\n array.emplaceBack(\n // a_pos_offset\n anchorX,\n anchorY,\n Math.round(ox * 32),\n Math.round(oy * 32),\n\n // a_data\n tx, // x coordinate of symbol on glyph atlas texture\n ty, // y coordinate of symbol on glyph atlas texture\n sizeVertex ? sizeVertex[0] : 0,\n sizeVertex ? sizeVertex[1] : 0\n );\n}\n\nfunction addDynamicAttributes(dynamicLayoutVertexArray: StructArray, p: Point, angle: number) {\n dynamicLayoutVertexArray.emplaceBack(p.x, p.y, angle);\n dynamicLayoutVertexArray.emplaceBack(p.x, p.y, angle);\n dynamicLayoutVertexArray.emplaceBack(p.x, p.y, angle);\n dynamicLayoutVertexArray.emplaceBack(p.x, p.y, angle);\n}\n\nclass SymbolBuffers {\n layoutVertexArray: SymbolLayoutArray;\n layoutVertexBuffer: VertexBuffer;\n\n indexArray: TriangleIndexArray;\n indexBuffer: IndexBuffer;\n\n programConfigurations: ProgramConfigurationSet;\n segments: SegmentVector;\n\n dynamicLayoutVertexArray: SymbolDynamicLayoutArray;\n dynamicLayoutVertexBuffer: VertexBuffer;\n\n opacityVertexArray: SymbolOpacityArray;\n opacityVertexBuffer: VertexBuffer;\n\n collisionVertexArray: CollisionVertexArray;\n collisionVertexBuffer: VertexBuffer;\n\n placedSymbolArray: PlacedSymbolArray;\n\n constructor(programConfigurations: ProgramConfigurationSet) {\n this.layoutVertexArray = new SymbolLayoutArray();\n this.indexArray = new TriangleIndexArray();\n this.programConfigurations = programConfigurations;\n this.segments = new SegmentVector();\n this.dynamicLayoutVertexArray = new SymbolDynamicLayoutArray();\n this.opacityVertexArray = new SymbolOpacityArray();\n this.placedSymbolArray = new PlacedSymbolArray();\n }\n\n upload(context: Context, dynamicIndexBuffer: boolean) {\n this.layoutVertexBuffer = context.createVertexBuffer(this.layoutVertexArray, symbolLayoutAttributes.members);\n this.indexBuffer = context.createIndexBuffer(this.indexArray, dynamicIndexBuffer);\n this.programConfigurations.upload(context);\n this.dynamicLayoutVertexBuffer = context.createVertexBuffer(this.dynamicLayoutVertexArray, dynamicLayoutAttributes.members, true);\n this.opacityVertexBuffer = context.createVertexBuffer(this.opacityVertexArray, shaderOpacityAttributes, true);\n // This is a performance hack so that we can write to opacityVertexArray with uint32s\n // even though the shaders read uint8s\n this.opacityVertexBuffer.itemSize = 1;\n }\n\n destroy() {\n if (!this.layoutVertexBuffer) return;\n this.layoutVertexBuffer.destroy();\n this.indexBuffer.destroy();\n this.programConfigurations.destroy();\n this.segments.destroy();\n this.dynamicLayoutVertexBuffer.destroy();\n this.opacityVertexBuffer.destroy();\n }\n}\n\nregister('SymbolBuffers', SymbolBuffers);\n\nclass CollisionBuffers {\n layoutVertexArray: StructArray;\n layoutAttributes: Array;\n layoutVertexBuffer: VertexBuffer;\n\n indexArray: TriangleIndexArray | LineIndexArray;\n indexBuffer: IndexBuffer;\n\n segments: SegmentVector;\n\n collisionVertexArray: CollisionVertexArray;\n collisionVertexBuffer: VertexBuffer;\n\n constructor(LayoutArray: Class,\n layoutAttributes: Array,\n IndexArray: Class) {\n this.layoutVertexArray = new LayoutArray();\n this.layoutAttributes = layoutAttributes;\n this.indexArray = new IndexArray();\n this.segments = new SegmentVector();\n this.collisionVertexArray = new CollisionVertexArray();\n }\n\n upload(context: Context) {\n this.layoutVertexBuffer = context.createVertexBuffer(this.layoutVertexArray, this.layoutAttributes);\n this.indexBuffer = context.createIndexBuffer(this.indexArray);\n this.collisionVertexBuffer = context.createVertexBuffer(this.collisionVertexArray, collisionVertexAttributes.members, true);\n }\n\n destroy() {\n if (!this.layoutVertexBuffer) return;\n this.layoutVertexBuffer.destroy();\n this.indexBuffer.destroy();\n this.segments.destroy();\n this.collisionVertexBuffer.destroy();\n }\n}\n\nregister('CollisionBuffers', CollisionBuffers);\n\n/**\n * Unlike other buckets, which simply implement #addFeature with type-specific\n * logic for (essentially) triangulating feature geometries, SymbolBucket\n * requires specialized behavior:\n *\n * 1. WorkerTile#parse(), the logical owner of the bucket creation process,\n * calls SymbolBucket#populate(), which resolves text and icon tokens on\n * each feature, adds each glyphs and symbols needed to the passed-in\n * collections options.glyphDependencies and options.iconDependencies, and\n * stores the feature data for use in subsequent step (this.features).\n *\n * 2. WorkerTile asynchronously requests from the main thread all of the glyphs\n * and icons needed (by this bucket and any others). When glyphs and icons\n * have been received, the WorkerTile creates a CollisionIndex and invokes:\n *\n * 3. performSymbolLayout(bucket, stacks, icons) perform texts shaping and\n * layout on a Symbol Bucket. This step populates:\n * `this.symbolInstances`: metadata on generated symbols\n * `this.collisionBoxArray`: collision data for use by foreground\n * `this.text`: SymbolBuffers for text symbols\n * `this.icons`: SymbolBuffers for icons\n * `this.collisionBox`: Debug SymbolBuffers for collision boxes\n * `this.collisionCircle`: Debug SymbolBuffers for collision circles\n * The results are sent to the foreground for rendering\n *\n * 4. performSymbolPlacement(bucket, collisionIndex) is run on the foreground,\n * and uses the CollisionIndex along with current camera settings to determine\n * which symbols can actually show on the map. Collided symbols are hidden\n * using a dynamic \"OpacityVertexArray\".\n *\n * @private\n */\nclass SymbolBucket implements Bucket {\n static MAX_GLYPHS: number;\n static addDynamicAttributes: typeof addDynamicAttributes;\n\n collisionBoxArray: CollisionBoxArray;\n zoom: number;\n overscaling: number;\n layers: Array;\n layerIds: Array;\n index: number;\n sdfIcons: boolean;\n iconsNeedLinear: boolean;\n bucketInstanceId: number;\n justReloaded: boolean;\n\n textSizeData: SizeData;\n iconSizeData: SizeData;\n\n glyphOffsetArray: GlyphOffsetArray;\n lineVertexArray: SymbolLineVertexArray;\n features: Array;\n symbolInstances: Array;\n pixelRatio: number;\n tilePixelRatio: number;\n compareText: {[string]: Array};\n fadeStartTime: number;\n sortFeaturesByY: boolean;\n sortedAngle: number;\n featureSortOrder: Array;\n\n text: SymbolBuffers;\n icon: SymbolBuffers;\n collisionBox: CollisionBuffers;\n collisionCircle: CollisionBuffers;\n uploaded: boolean;\n sourceLayerIndex: number;\n\n constructor(options: BucketParameters) {\n this.collisionBoxArray = options.collisionBoxArray;\n this.zoom = options.zoom;\n this.overscaling = options.overscaling;\n this.layers = options.layers;\n this.layerIds = this.layers.map(layer => layer.id);\n this.index = options.index;\n this.pixelRatio = options.pixelRatio;\n this.sourceLayerIndex = options.sourceLayerIndex;\n\n const layer = this.layers[0];\n const unevaluatedLayoutValues = layer._unevaluatedLayout._values;\n\n this.textSizeData = getSizeData(this.zoom, unevaluatedLayoutValues['text-size']);\n this.iconSizeData = getSizeData(this.zoom, unevaluatedLayoutValues['icon-size']);\n\n const layout = this.layers[0].layout;\n this.sortFeaturesByY = layout.get('text-allow-overlap') || layout.get('icon-allow-overlap') ||\n layout.get('text-ignore-placement') || layout.get('icon-ignore-placement');\n }\n\n createArrays() {\n this.text = new SymbolBuffers(new ProgramConfigurationSet(symbolLayoutAttributes.members, this.layers, this.zoom, property => /^text/.test(property)));\n this.icon = new SymbolBuffers(new ProgramConfigurationSet(symbolLayoutAttributes.members, this.layers, this.zoom, property => /^icon/.test(property)));\n this.collisionBox = new CollisionBuffers(CollisionBoxLayoutArray, collisionBoxLayout.members, LineIndexArray);\n this.collisionCircle = new CollisionBuffers(CollisionCircleLayoutArray, collisionCircleLayout.members, TriangleIndexArray);\n\n this.glyphOffsetArray = new GlyphOffsetArray();\n this.lineVertexArray = new SymbolLineVertexArray();\n }\n\n populate(features: Array, options: PopulateParameters) {\n const layer = this.layers[0];\n const layout = layer.layout;\n\n const textFont = layout.get('text-font');\n const textField = layout.get('text-field');\n const iconImage = layout.get('icon-image');\n const hasText =\n (textField.value.kind !== 'constant' || textField.value.value.length > 0) &&\n (textFont.value.kind !== 'constant' || textFont.value.value.length > 0);\n const hasIcon = iconImage.value.kind !== 'constant' || iconImage.value.value && iconImage.value.value.length > 0;\n\n this.features = [];\n\n if (!hasText && !hasIcon) {\n return;\n }\n\n const icons = options.iconDependencies;\n const stacks = options.glyphDependencies;\n const globalProperties = new EvaluationParameters(this.zoom);\n\n for (const {feature, index, sourceLayerIndex} of features) {\n if (!layer._featureFilter(globalProperties, feature)) {\n continue;\n }\n\n let text;\n if (hasText) {\n text = layer.getValueAndResolveTokens('text-field', feature);\n text = transformText(text, layer, feature);\n }\n\n let icon;\n if (hasIcon) {\n icon = layer.getValueAndResolveTokens('icon-image', feature);\n }\n\n if (!text && !icon) {\n continue;\n }\n\n const symbolFeature: SymbolFeature = {\n text,\n icon,\n index,\n sourceLayerIndex,\n geometry: loadGeometry(feature),\n properties: feature.properties,\n type: vectorTileFeatureTypes[feature.type]\n };\n if (typeof feature.id !== 'undefined') {\n symbolFeature.id = feature.id;\n }\n this.features.push(symbolFeature);\n\n if (icon) {\n icons[icon] = true;\n }\n\n if (text) {\n const fontStack = textFont.evaluate(feature).join(',');\n const stack = stacks[fontStack] = stacks[fontStack] || {};\n const textAlongLine = layout.get('text-rotation-alignment') === 'map' && layout.get('symbol-placement') === 'line';\n const doesAllowVerticalWritingMode = allowsVerticalWritingMode(text);\n for (let i = 0; i < text.length; i++) {\n stack[text.charCodeAt(i)] = true;\n if (textAlongLine && doesAllowVerticalWritingMode) {\n const verticalChar = verticalizedCharacterMap[text.charAt(i)];\n if (verticalChar) {\n stack[verticalChar.charCodeAt(0)] = true;\n }\n }\n }\n }\n }\n\n if (layout.get('symbol-placement') === 'line') {\n // Merge adjacent lines with the same text to improve labelling.\n // It's better to place labels on one long line than on many short segments.\n this.features = mergeLines(this.features);\n }\n }\n\n\n isEmpty() {\n return this.symbolInstances.length === 0;\n }\n\n upload(context: Context) {\n this.text.upload(context, this.sortFeaturesByY);\n this.icon.upload(context, this.sortFeaturesByY);\n this.collisionBox.upload(context);\n this.collisionCircle.upload(context);\n }\n\n destroy() {\n this.text.destroy();\n this.icon.destroy();\n this.collisionBox.destroy();\n this.collisionCircle.destroy();\n }\n\n addToLineVertexArray(anchor: Anchor, line: any) {\n const lineStartIndex = this.lineVertexArray.length;\n if (anchor.segment !== undefined) {\n let sumForwardLength = anchor.dist(line[anchor.segment + 1]);\n let sumBackwardLength = anchor.dist(line[anchor.segment]);\n const vertices = {};\n for (let i = anchor.segment + 1; i < line.length; i++) {\n vertices[i] = { x: line[i].x, y: line[i].y, tileUnitDistanceFromAnchor: sumForwardLength };\n if (i < line.length - 1) {\n sumForwardLength += line[i + 1].dist(line[i]);\n }\n }\n for (let i = anchor.segment || 0; i >= 0; i--) {\n vertices[i] = { x: line[i].x, y: line[i].y, tileUnitDistanceFromAnchor: sumBackwardLength };\n if (i > 0) {\n sumBackwardLength += line[i - 1].dist(line[i]);\n }\n }\n for (let i = 0; i < line.length; i++) {\n const vertex = vertices[i];\n this.lineVertexArray.emplaceBack(vertex.x, vertex.y, vertex.tileUnitDistanceFromAnchor);\n }\n }\n return {\n lineStartIndex: lineStartIndex,\n lineLength: this.lineVertexArray.length - lineStartIndex\n };\n }\n\n addSymbols(arrays: SymbolBuffers,\n quads: Array,\n sizeVertex: any,\n lineOffset: [number, number],\n alongLine: boolean,\n feature: ExpressionFeature,\n writingMode: any,\n labelAnchor: Anchor,\n lineStartIndex: number,\n lineLength: number) {\n const indexArray = arrays.indexArray;\n const layoutVertexArray = arrays.layoutVertexArray;\n const dynamicLayoutVertexArray = arrays.dynamicLayoutVertexArray;\n\n const segment = arrays.segments.prepareSegment(4 * quads.length, arrays.layoutVertexArray, arrays.indexArray);\n const glyphOffsetArrayStart = this.glyphOffsetArray.length;\n const vertexStartIndex = segment.vertexLength;\n\n for (const symbol of quads) {\n\n const tl = symbol.tl,\n tr = symbol.tr,\n bl = symbol.bl,\n br = symbol.br,\n tex = symbol.tex;\n\n const index = segment.vertexLength;\n\n const y = symbol.glyphOffset[1];\n addVertex(layoutVertexArray, labelAnchor.x, labelAnchor.y, tl.x, y + tl.y, tex.x, tex.y, sizeVertex);\n addVertex(layoutVertexArray, labelAnchor.x, labelAnchor.y, tr.x, y + tr.y, tex.x + tex.w, tex.y, sizeVertex);\n addVertex(layoutVertexArray, labelAnchor.x, labelAnchor.y, bl.x, y + bl.y, tex.x, tex.y + tex.h, sizeVertex);\n addVertex(layoutVertexArray, labelAnchor.x, labelAnchor.y, br.x, y + br.y, tex.x + tex.w, tex.y + tex.h, sizeVertex);\n\n addDynamicAttributes(dynamicLayoutVertexArray, labelAnchor, 0);\n\n indexArray.emplaceBack(index, index + 1, index + 2);\n indexArray.emplaceBack(index + 1, index + 2, index + 3);\n\n segment.vertexLength += 4;\n segment.primitiveLength += 2;\n\n this.glyphOffsetArray.emplaceBack(symbol.glyphOffset[0]);\n }\n\n arrays.placedSymbolArray.emplaceBack(labelAnchor.x, labelAnchor.y,\n glyphOffsetArrayStart, this.glyphOffsetArray.length - glyphOffsetArrayStart, vertexStartIndex,\n lineStartIndex, lineLength, (labelAnchor.segment: any),\n sizeVertex ? sizeVertex[0] : 0, sizeVertex ? sizeVertex[1] : 0,\n lineOffset[0], lineOffset[1],\n writingMode, (false: any));\n\n arrays.programConfigurations.populatePaintArrays(arrays.layoutVertexArray.length, feature);\n }\n\n _addCollisionDebugVertex(layoutVertexArray: StructArray, collisionVertexArray: StructArray, point: Point, anchor: Point, extrude: Point) {\n collisionVertexArray.emplaceBack(0, 0);\n return layoutVertexArray.emplaceBack(\n // pos\n point.x,\n point.y,\n // a_anchor_pos\n anchor.x,\n anchor.y,\n // extrude\n Math.round(extrude.x),\n Math.round(extrude.y));\n }\n\n\n addCollisionDebugVertices(x1: number, y1: number, x2: number, y2: number, arrays: CollisionBuffers, boxAnchorPoint: Point, symbolInstance: SymbolInstance, isCircle: boolean) {\n const segment = arrays.segments.prepareSegment(4, arrays.layoutVertexArray, arrays.indexArray);\n const index = segment.vertexLength;\n\n const layoutVertexArray = arrays.layoutVertexArray;\n const collisionVertexArray = arrays.collisionVertexArray;\n\n this._addCollisionDebugVertex(layoutVertexArray, collisionVertexArray, boxAnchorPoint, symbolInstance.anchor, new Point(x1, y1));\n this._addCollisionDebugVertex(layoutVertexArray, collisionVertexArray, boxAnchorPoint, symbolInstance.anchor, new Point(x2, y1));\n this._addCollisionDebugVertex(layoutVertexArray, collisionVertexArray, boxAnchorPoint, symbolInstance.anchor, new Point(x2, y2));\n this._addCollisionDebugVertex(layoutVertexArray, collisionVertexArray, boxAnchorPoint, symbolInstance.anchor, new Point(x1, y2));\n\n segment.vertexLength += 4;\n if (isCircle) {\n const indexArray: TriangleIndexArray = (arrays.indexArray: any);\n indexArray.emplaceBack(index, index + 1, index + 2);\n indexArray.emplaceBack(index, index + 2, index + 3);\n\n segment.primitiveLength += 2;\n } else {\n const indexArray: LineIndexArray = (arrays.indexArray: any);\n indexArray.emplaceBack(index, index + 1);\n indexArray.emplaceBack(index + 1, index + 2);\n indexArray.emplaceBack(index + 2, index + 3);\n indexArray.emplaceBack(index + 3, index);\n\n segment.primitiveLength += 4;\n }\n }\n\n generateCollisionDebugBuffers() {\n for (const symbolInstance of this.symbolInstances) {\n symbolInstance.textCollisionFeature = {boxStartIndex: symbolInstance.textBoxStartIndex, boxEndIndex: symbolInstance.textBoxEndIndex};\n symbolInstance.iconCollisionFeature = {boxStartIndex: symbolInstance.iconBoxStartIndex, boxEndIndex: symbolInstance.iconBoxEndIndex};\n\n for (let i = 0; i < 2; i++) {\n const feature = symbolInstance[i === 0 ? 'textCollisionFeature' : 'iconCollisionFeature'];\n if (!feature) continue;\n\n for (let b = feature.boxStartIndex; b < feature.boxEndIndex; b++) {\n const box: CollisionBox = (this.collisionBoxArray.get(b): any);\n const x1 = box.x1;\n const y1 = box.y1;\n const x2 = box.x2;\n const y2 = box.y2;\n\n // If the radius > 0, this collision box is actually a circle\n // The data we add to the buffers is exactly the same, but we'll render with a different shader.\n const isCircle = box.radius > 0;\n this.addCollisionDebugVertices(x1, y1, x2, y2, isCircle ? this.collisionCircle : this.collisionBox, box.anchorPoint, symbolInstance, isCircle);\n }\n }\n }\n }\n\n // These flat arrays are meant to be quicker to iterate over than the source\n // CollisionBoxArray\n deserializeCollisionBoxes(collisionBoxArray: CollisionBoxArray, textStartIndex: number, textEndIndex: number, iconStartIndex: number, iconEndIndex: number): CollisionArrays {\n const collisionArrays = {};\n for (let k = textStartIndex; k < textEndIndex; k++) {\n const box: CollisionBox = (collisionBoxArray.get(k): any);\n if (box.radius === 0) {\n collisionArrays.textBox = { x1: box.x1, y1: box.y1, x2: box.x2, y2: box.y2, anchorPointX: box.anchorPointX, anchorPointY: box.anchorPointY };\n collisionArrays.textFeatureIndex = box.featureIndex;\n break; // Only one box allowed per instance\n } else {\n if (!collisionArrays.textCircles) {\n collisionArrays.textCircles = [];\n collisionArrays.textFeatureIndex = box.featureIndex;\n }\n const used = 1; // May be updated at collision detection time\n collisionArrays.textCircles.push(box.anchorPointX, box.anchorPointY, box.radius, box.signedDistanceFromAnchor, used);\n }\n }\n for (let k = iconStartIndex; k < iconEndIndex; k++) {\n // An icon can only have one box now, so this indexing is a bit vestigial...\n const box: CollisionBox = (collisionBoxArray.get(k): any);\n if (box.radius === 0) {\n collisionArrays.iconBox = { x1: box.x1, y1: box.y1, x2: box.x2, y2: box.y2, anchorPointX: box.anchorPointX, anchorPointY: box.anchorPointY };\n collisionArrays.iconFeatureIndex = box.featureIndex;\n break; // Only one box allowed per instance\n }\n }\n return collisionArrays;\n }\n\n hasTextData() {\n return this.text.segments.get().length > 0;\n }\n\n hasIconData() {\n return this.icon.segments.get().length > 0;\n }\n\n hasCollisionBoxData() {\n return this.collisionBox.segments.get().length > 0;\n }\n\n hasCollisionCircleData() {\n return this.collisionCircle.segments.get().length > 0;\n }\n\n sortFeatures(angle: number) {\n if (!this.sortFeaturesByY) return;\n\n if (this.sortedAngle === angle) return;\n this.sortedAngle = angle;\n\n // The current approach to sorting doesn't sort across segments so don't try.\n // Sorting within segments separately seemed not to be worth the complexity.\n if (this.text.segments.get().length > 1 || this.icon.segments.get().length > 1) return;\n\n // If the symbols are allowed to overlap sort them by their vertical screen position.\n // The index array buffer is rewritten to reference the (unchanged) vertices in the\n // sorted order.\n\n // To avoid sorting the actual symbolInstance array we sort an array of indexes.\n const symbolInstanceIndexes = [];\n for (let i = 0; i < this.symbolInstances.length; i++) {\n symbolInstanceIndexes.push(i);\n }\n\n const sin = Math.sin(angle),\n cos = Math.cos(angle);\n\n symbolInstanceIndexes.sort((aIndex, bIndex) => {\n const a = this.symbolInstances[aIndex];\n const b = this.symbolInstances[bIndex];\n const aRotated = (sin * a.anchor.x + cos * a.anchor.y) | 0;\n const bRotated = (sin * b.anchor.x + cos * b.anchor.y) | 0;\n return (aRotated - bRotated) || (b.featureIndex - a.featureIndex);\n });\n\n this.text.indexArray.clear();\n this.icon.indexArray.clear();\n\n this.featureSortOrder = [];\n\n for (const i of symbolInstanceIndexes) {\n const symbolInstance = this.symbolInstances[i];\n this.featureSortOrder.push(symbolInstance.featureIndex);\n\n for (const placedTextSymbolIndex of symbolInstance.placedTextSymbolIndices) {\n const placedSymbol = this.text.placedSymbolArray.get(placedTextSymbolIndex);\n\n const endIndex = placedSymbol.vertexStartIndex + placedSymbol.numGlyphs * 4;\n for (let vertexIndex = placedSymbol.vertexStartIndex; vertexIndex < endIndex; vertexIndex += 4) {\n this.text.indexArray.emplaceBack(vertexIndex, vertexIndex + 1, vertexIndex + 2);\n this.text.indexArray.emplaceBack(vertexIndex + 1, vertexIndex + 2, vertexIndex + 3);\n }\n }\n\n const placedIcon = this.icon.placedSymbolArray.get(i);\n if (placedIcon.numGlyphs) {\n const vertexIndex = placedIcon.vertexStartIndex;\n this.icon.indexArray.emplaceBack(vertexIndex, vertexIndex + 1, vertexIndex + 2);\n this.icon.indexArray.emplaceBack(vertexIndex + 1, vertexIndex + 2, vertexIndex + 3);\n }\n }\n\n if (this.text.indexBuffer) this.text.indexBuffer.updateData(this.text.indexArray);\n if (this.icon.indexBuffer) this.icon.indexBuffer.updateData(this.icon.indexArray);\n }\n}\n\nregister('SymbolBucket', SymbolBucket, {\n omit: ['layers', 'collisionBoxArray', 'features', 'compareText'],\n shallow: ['symbolInstances']\n});\n\n// this constant is based on the size of StructArray indexes used in a symbol\n// bucket--namely, glyphOffsetArrayStart\n// eg the max valid UInt16 is 65,535\n// See https://github.com/mapbox/mapbox-gl-js/issues/2907 for motivation\n// lineStartIndex and textBoxStartIndex could potentially be concerns\n// but we expect there to be many fewer boxes/lines than glyphs\nSymbolBucket.MAX_GLYPHS = 65535;\n\nSymbolBucket.addDynamicAttributes = addDynamicAttributes;\n\nexport default SymbolBucket;\nexport { addDynamicAttributes };\n","// This file is generated. Edit build/generate-style-code.js, then run `yarn run codegen`.\n// @flow\n/* eslint-disable */\n\nimport styleSpec from '../../style-spec/reference/latest';\n\nimport {\n Properties,\n DataConstantProperty,\n DataDrivenProperty,\n CrossFadedProperty,\n ColorRampProperty\n} from '../properties';\n\nimport type Color from '../../style-spec/util/color';\n\nexport type LayoutProps = {|\n \"symbol-placement\": DataConstantProperty<\"point\" | \"line\">,\n \"symbol-spacing\": DataConstantProperty,\n \"symbol-avoid-edges\": DataConstantProperty,\n \"icon-allow-overlap\": DataConstantProperty,\n \"icon-ignore-placement\": DataConstantProperty,\n \"icon-optional\": DataConstantProperty,\n \"icon-rotation-alignment\": DataConstantProperty<\"map\" | \"viewport\" | \"auto\">,\n \"icon-size\": DataDrivenProperty,\n \"icon-text-fit\": DataConstantProperty<\"none\" | \"width\" | \"height\" | \"both\">,\n \"icon-text-fit-padding\": DataConstantProperty<[number, number, number, number]>,\n \"icon-image\": DataDrivenProperty,\n \"icon-rotate\": DataDrivenProperty,\n \"icon-padding\": DataConstantProperty,\n \"icon-keep-upright\": DataConstantProperty,\n \"icon-offset\": DataDrivenProperty<[number, number]>,\n \"icon-anchor\": DataDrivenProperty<\"center\" | \"left\" | \"right\" | \"top\" | \"bottom\" | \"top-left\" | \"top-right\" | \"bottom-left\" | \"bottom-right\">,\n \"icon-pitch-alignment\": DataConstantProperty<\"map\" | \"viewport\" | \"auto\">,\n \"text-pitch-alignment\": DataConstantProperty<\"map\" | \"viewport\" | \"auto\">,\n \"text-rotation-alignment\": DataConstantProperty<\"map\" | \"viewport\" | \"auto\">,\n \"text-field\": DataDrivenProperty,\n \"text-font\": DataDrivenProperty>,\n \"text-size\": DataDrivenProperty,\n \"text-max-width\": DataDrivenProperty,\n \"text-line-height\": DataConstantProperty,\n \"text-letter-spacing\": DataDrivenProperty,\n \"text-justify\": DataDrivenProperty<\"left\" | \"center\" | \"right\">,\n \"text-anchor\": DataDrivenProperty<\"center\" | \"left\" | \"right\" | \"top\" | \"bottom\" | \"top-left\" | \"top-right\" | \"bottom-left\" | \"bottom-right\">,\n \"text-max-angle\": DataConstantProperty,\n \"text-rotate\": DataDrivenProperty,\n \"text-padding\": DataConstantProperty,\n \"text-keep-upright\": DataConstantProperty,\n \"text-transform\": DataDrivenProperty<\"none\" | \"uppercase\" | \"lowercase\">,\n \"text-offset\": DataDrivenProperty<[number, number]>,\n \"text-allow-overlap\": DataConstantProperty,\n \"text-ignore-placement\": DataConstantProperty,\n \"text-optional\": DataConstantProperty,\n|};\n\nconst layout: Properties = new Properties({\n \"symbol-placement\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"symbol-placement\"]),\n \"symbol-spacing\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"symbol-spacing\"]),\n \"symbol-avoid-edges\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"symbol-avoid-edges\"]),\n \"icon-allow-overlap\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"icon-allow-overlap\"]),\n \"icon-ignore-placement\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"icon-ignore-placement\"]),\n \"icon-optional\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"icon-optional\"]),\n \"icon-rotation-alignment\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"icon-rotation-alignment\"]),\n \"icon-size\": new DataDrivenProperty(styleSpec[\"layout_symbol\"][\"icon-size\"]),\n \"icon-text-fit\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"icon-text-fit\"]),\n \"icon-text-fit-padding\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"icon-text-fit-padding\"]),\n \"icon-image\": new DataDrivenProperty(styleSpec[\"layout_symbol\"][\"icon-image\"]),\n \"icon-rotate\": new DataDrivenProperty(styleSpec[\"layout_symbol\"][\"icon-rotate\"]),\n \"icon-padding\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"icon-padding\"]),\n \"icon-keep-upright\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"icon-keep-upright\"]),\n \"icon-offset\": new DataDrivenProperty(styleSpec[\"layout_symbol\"][\"icon-offset\"]),\n \"icon-anchor\": new DataDrivenProperty(styleSpec[\"layout_symbol\"][\"icon-anchor\"]),\n \"icon-pitch-alignment\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"icon-pitch-alignment\"]),\n \"text-pitch-alignment\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"text-pitch-alignment\"]),\n \"text-rotation-alignment\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"text-rotation-alignment\"]),\n \"text-field\": new DataDrivenProperty(styleSpec[\"layout_symbol\"][\"text-field\"]),\n \"text-font\": new DataDrivenProperty(styleSpec[\"layout_symbol\"][\"text-font\"]),\n \"text-size\": new DataDrivenProperty(styleSpec[\"layout_symbol\"][\"text-size\"]),\n \"text-max-width\": new DataDrivenProperty(styleSpec[\"layout_symbol\"][\"text-max-width\"]),\n \"text-line-height\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"text-line-height\"]),\n \"text-letter-spacing\": new DataDrivenProperty(styleSpec[\"layout_symbol\"][\"text-letter-spacing\"]),\n \"text-justify\": new DataDrivenProperty(styleSpec[\"layout_symbol\"][\"text-justify\"]),\n \"text-anchor\": new DataDrivenProperty(styleSpec[\"layout_symbol\"][\"text-anchor\"]),\n \"text-max-angle\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"text-max-angle\"]),\n \"text-rotate\": new DataDrivenProperty(styleSpec[\"layout_symbol\"][\"text-rotate\"]),\n \"text-padding\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"text-padding\"]),\n \"text-keep-upright\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"text-keep-upright\"]),\n \"text-transform\": new DataDrivenProperty(styleSpec[\"layout_symbol\"][\"text-transform\"]),\n \"text-offset\": new DataDrivenProperty(styleSpec[\"layout_symbol\"][\"text-offset\"]),\n \"text-allow-overlap\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"text-allow-overlap\"]),\n \"text-ignore-placement\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"text-ignore-placement\"]),\n \"text-optional\": new DataConstantProperty(styleSpec[\"layout_symbol\"][\"text-optional\"]),\n});\n\nexport type PaintProps = {|\n \"icon-opacity\": DataDrivenProperty,\n \"icon-color\": DataDrivenProperty,\n \"icon-halo-color\": DataDrivenProperty,\n \"icon-halo-width\": DataDrivenProperty,\n \"icon-halo-blur\": DataDrivenProperty,\n \"icon-translate\": DataConstantProperty<[number, number]>,\n \"icon-translate-anchor\": DataConstantProperty<\"map\" | \"viewport\">,\n \"text-opacity\": DataDrivenProperty,\n \"text-color\": DataDrivenProperty,\n \"text-halo-color\": DataDrivenProperty,\n \"text-halo-width\": DataDrivenProperty,\n \"text-halo-blur\": DataDrivenProperty,\n \"text-translate\": DataConstantProperty<[number, number]>,\n \"text-translate-anchor\": DataConstantProperty<\"map\" | \"viewport\">,\n|};\n\nconst paint: Properties = new Properties({\n \"icon-opacity\": new DataDrivenProperty(styleSpec[\"paint_symbol\"][\"icon-opacity\"]),\n \"icon-color\": new DataDrivenProperty(styleSpec[\"paint_symbol\"][\"icon-color\"]),\n \"icon-halo-color\": new DataDrivenProperty(styleSpec[\"paint_symbol\"][\"icon-halo-color\"]),\n \"icon-halo-width\": new DataDrivenProperty(styleSpec[\"paint_symbol\"][\"icon-halo-width\"]),\n \"icon-halo-blur\": new DataDrivenProperty(styleSpec[\"paint_symbol\"][\"icon-halo-blur\"]),\n \"icon-translate\": new DataConstantProperty(styleSpec[\"paint_symbol\"][\"icon-translate\"]),\n \"icon-translate-anchor\": new DataConstantProperty(styleSpec[\"paint_symbol\"][\"icon-translate-anchor\"]),\n \"text-opacity\": new DataDrivenProperty(styleSpec[\"paint_symbol\"][\"text-opacity\"]),\n \"text-color\": new DataDrivenProperty(styleSpec[\"paint_symbol\"][\"text-color\"]),\n \"text-halo-color\": new DataDrivenProperty(styleSpec[\"paint_symbol\"][\"text-halo-color\"]),\n \"text-halo-width\": new DataDrivenProperty(styleSpec[\"paint_symbol\"][\"text-halo-width\"]),\n \"text-halo-blur\": new DataDrivenProperty(styleSpec[\"paint_symbol\"][\"text-halo-blur\"]),\n \"text-translate\": new DataConstantProperty(styleSpec[\"paint_symbol\"][\"text-translate\"]),\n \"text-translate-anchor\": new DataConstantProperty(styleSpec[\"paint_symbol\"][\"text-translate-anchor\"]),\n});\n\nexport default { paint, layout };\n","// @flow\n\nimport StyleLayer from '../style_layer';\n\nimport SymbolBucket from '../../data/bucket/symbol_bucket';\nimport resolveTokens from '../../util/token';\nimport { isExpression } from '../../style-spec/expression';\nimport assert from 'assert';\nimport properties from './symbol_style_layer_properties';\nimport { Transitionable, Transitioning, Layout, PossiblyEvaluated } from '../properties';\n\nimport type {BucketParameters} from '../../data/bucket';\nimport type {LayoutProps, PaintProps} from './symbol_style_layer_properties';\nimport type {Feature} from '../../style-spec/expression';\nimport type EvaluationParameters from '../evaluation_parameters';\n\nclass SymbolStyleLayer extends StyleLayer {\n _unevaluatedLayout: Layout;\n layout: PossiblyEvaluated;\n\n _transitionablePaint: Transitionable;\n _transitioningPaint: Transitioning;\n paint: PossiblyEvaluated;\n\n constructor(layer: LayerSpecification) {\n super(layer, properties);\n }\n\n recalculate(parameters: EvaluationParameters) {\n super.recalculate(parameters);\n\n if (this.layout.get('icon-rotation-alignment') === 'auto') {\n if (this.layout.get('symbol-placement') === 'line') {\n this.layout._values['icon-rotation-alignment'] = 'map';\n } else {\n this.layout._values['icon-rotation-alignment'] = 'viewport';\n }\n }\n\n if (this.layout.get('text-rotation-alignment') === 'auto') {\n if (this.layout.get('symbol-placement') === 'line') {\n this.layout._values['text-rotation-alignment'] = 'map';\n } else {\n this.layout._values['text-rotation-alignment'] = 'viewport';\n }\n }\n\n // If unspecified, `*-pitch-alignment` inherits `*-rotation-alignment`\n if (this.layout.get('text-pitch-alignment') === 'auto') {\n this.layout._values['text-pitch-alignment'] = this.layout.get('text-rotation-alignment');\n }\n if (this.layout.get('icon-pitch-alignment') === 'auto') {\n this.layout._values['icon-pitch-alignment'] = this.layout.get('icon-rotation-alignment');\n }\n }\n\n getValueAndResolveTokens(name: *, feature: Feature) {\n const value = this.layout.get(name).evaluate(feature);\n const unevaluated = this._unevaluatedLayout._values[name];\n if (!unevaluated.isDataDriven() && !isExpression(unevaluated.value)) {\n return resolveTokens(feature.properties, value);\n }\n\n return value;\n }\n\n createBucket(parameters: BucketParameters<*>) {\n return new SymbolBucket(parameters);\n }\n\n queryRadius(): number {\n return 0;\n }\n\n queryIntersectsFeature(): boolean {\n assert(false); // Should take a different path in FeatureIndex\n return false;\n }\n}\n\nexport default SymbolStyleLayer;\n","// @flow\nexport default resolveTokens;\n\n/**\n * Replace tokens in a string template with values in an object\n *\n * @param properties a key/value relationship between tokens and replacements\n * @param text the template string\n * @returns the template with tokens replaced\n * @private\n */\nfunction resolveTokens(properties: {+[string]: mixed}, text: string): string {\n return text.replace(/{([^{}]+)}/g, (match, key: string) => {\n return key in properties ? String(properties[key]) : '';\n });\n}\n","// This file is generated. Edit build/generate-style-code.js, then run `yarn run codegen`.\n// @flow\n/* eslint-disable */\n\nimport styleSpec from '../../style-spec/reference/latest';\n\nimport {\n Properties,\n DataConstantProperty,\n DataDrivenProperty,\n CrossFadedProperty,\n ColorRampProperty\n} from '../properties';\n\nimport type Color from '../../style-spec/util/color';\n\n\nexport type PaintProps = {|\n \"background-color\": DataConstantProperty,\n \"background-pattern\": CrossFadedProperty,\n \"background-opacity\": DataConstantProperty,\n|};\n\nconst paint: Properties = new Properties({\n \"background-color\": new DataConstantProperty(styleSpec[\"paint_background\"][\"background-color\"]),\n \"background-pattern\": new CrossFadedProperty(styleSpec[\"paint_background\"][\"background-pattern\"]),\n \"background-opacity\": new DataConstantProperty(styleSpec[\"paint_background\"][\"background-opacity\"]),\n});\n\nexport default { paint };\n","// @flow\n\nimport StyleLayer from '../style_layer';\n\nimport properties from './background_style_layer_properties';\nimport { Transitionable, Transitioning, PossiblyEvaluated } from '../properties';\n\nimport type {PaintProps} from './background_style_layer_properties';\n\nclass BackgroundStyleLayer extends StyleLayer {\n _transitionablePaint: Transitionable;\n _transitioningPaint: Transitioning;\n paint: PossiblyEvaluated;\n\n constructor(layer: LayerSpecification) {\n super(layer, properties);\n }\n}\n\nexport default BackgroundStyleLayer;\n","// This file is generated. Edit build/generate-style-code.js, then run `yarn run codegen`.\n// @flow\n/* eslint-disable */\n\nimport styleSpec from '../../style-spec/reference/latest';\n\nimport {\n Properties,\n DataConstantProperty,\n DataDrivenProperty,\n CrossFadedProperty,\n ColorRampProperty\n} from '../properties';\n\nimport type Color from '../../style-spec/util/color';\n\n\nexport type PaintProps = {|\n \"raster-opacity\": DataConstantProperty,\n \"raster-hue-rotate\": DataConstantProperty,\n \"raster-brightness-min\": DataConstantProperty,\n \"raster-brightness-max\": DataConstantProperty,\n \"raster-saturation\": DataConstantProperty,\n \"raster-contrast\": DataConstantProperty,\n \"raster-fade-duration\": DataConstantProperty,\n|};\n\nconst paint: Properties = new Properties({\n \"raster-opacity\": new DataConstantProperty(styleSpec[\"paint_raster\"][\"raster-opacity\"]),\n \"raster-hue-rotate\": new DataConstantProperty(styleSpec[\"paint_raster\"][\"raster-hue-rotate\"]),\n \"raster-brightness-min\": new DataConstantProperty(styleSpec[\"paint_raster\"][\"raster-brightness-min\"]),\n \"raster-brightness-max\": new DataConstantProperty(styleSpec[\"paint_raster\"][\"raster-brightness-max\"]),\n \"raster-saturation\": new DataConstantProperty(styleSpec[\"paint_raster\"][\"raster-saturation\"]),\n \"raster-contrast\": new DataConstantProperty(styleSpec[\"paint_raster\"][\"raster-contrast\"]),\n \"raster-fade-duration\": new DataConstantProperty(styleSpec[\"paint_raster\"][\"raster-fade-duration\"]),\n});\n\nexport default { paint };\n","// @flow\n\nimport circle from './style_layer/circle_style_layer';\nimport heatmap from './style_layer/heatmap_style_layer';\nimport hillshade from './style_layer/hillshade_style_layer';\nimport fill from './style_layer/fill_style_layer';\nimport fillExtrusion from './style_layer/fill_extrusion_style_layer';\nimport line from './style_layer/line_style_layer';\nimport symbol from './style_layer/symbol_style_layer';\nimport background from './style_layer/background_style_layer';\nimport raster from './style_layer/raster_style_layer';\n\nconst subclasses = {\n circle,\n heatmap,\n hillshade,\n fill,\n 'fill-extrusion': fillExtrusion,\n line,\n symbol,\n background,\n raster\n};\n\nexport default function createStyleLayer(layer: LayerSpecification) {\n return new subclasses[layer.type](layer);\n}\n\n","// @flow\n\nimport StyleLayer from '../style_layer';\n\nimport properties from './raster_style_layer_properties';\nimport { Transitionable, Transitioning, PossiblyEvaluated } from '../properties';\n\nimport type {PaintProps} from './raster_style_layer_properties';\n\nclass RasterStyleLayer extends StyleLayer {\n _transitionablePaint: Transitionable;\n _transitioningPaint: Transitioning;\n paint: PossiblyEvaluated;\n\n constructor(layer: LayerSpecification) {\n super(layer, properties);\n }\n}\n\nexport default RasterStyleLayer;\n","(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n\ttypeof define === 'function' && define.amd ? define(factory) :\n\t(global.ShelfPack = factory());\n}(this, (function () {\n\n/**\n * Create a new ShelfPack bin allocator.\n *\n * Uses the Shelf Best Height Fit algorithm from\n * http://clb.demon.fi/files/RectangleBinPack.pdf\n *\n * @class ShelfPack\n * @param {number} [w=64] Initial width of the sprite\n * @param {number} [h=64] Initial width of the sprite\n * @param {Object} [options]\n * @param {boolean} [options.autoResize=false] If `true`, the sprite will automatically grow\n * @example\n * var sprite = new ShelfPack(64, 64, { autoResize: false });\n */\nfunction ShelfPack$1(w, h, options) {\n options = options || {};\n this.w = w || 64;\n this.h = h || 64;\n this.autoResize = !!options.autoResize;\n this.shelves = [];\n this.freebins = [];\n this.stats = {};\n this.bins = {};\n this.maxId = 0;\n}\n\n\n/**\n * Batch pack multiple bins into the sprite.\n *\n * @param {Object[]} bins Array of requested bins - each object should have `width`, `height` (or `w`, `h`) properties\n * @param {number} bins[].w Requested bin width\n * @param {number} bins[].h Requested bin height\n * @param {Object} [options]\n * @param {boolean} [options.inPlace=false] If `true`, the supplied bin objects will be updated inplace with `x` and `y` properties\n * @returns {Bin[]} Array of allocated Bins - each Bin is an object with `id`, `x`, `y`, `w`, `h` properties\n * @example\n * var bins = [\n * { id: 1, w: 12, h: 12 },\n * { id: 2, w: 12, h: 16 },\n * { id: 3, w: 12, h: 24 }\n * ];\n * var results = sprite.pack(bins, { inPlace: false });\n */\nShelfPack$1.prototype.pack = function(bins, options) {\n bins = [].concat(bins);\n options = options || {};\n\n var results = [],\n w, h, id, allocation;\n\n for (var i = 0; i < bins.length; i++) {\n w = bins[i].w || bins[i].width;\n h = bins[i].h || bins[i].height;\n id = bins[i].id;\n\n if (w && h) {\n allocation = this.packOne(w, h, id);\n if (!allocation) {\n continue;\n }\n if (options.inPlace) {\n bins[i].x = allocation.x;\n bins[i].y = allocation.y;\n bins[i].id = allocation.id;\n }\n results.push(allocation);\n }\n }\n\n this.shrink();\n\n return results;\n};\n\n\n/**\n * Pack a single bin into the sprite.\n *\n * Each bin will have a unique identitifer.\n * If no identifier is supplied in the `id` parameter, one will be created.\n * Note: The supplied `id` is used as an object index, so numeric values are fastest!\n *\n * Bins are automatically refcounted (i.e. a newly packed Bin will have a refcount of 1).\n * When a bin is no longer needed, use the `ShelfPack.unref` function to mark it\n * as unused. When a Bin's refcount decrements to 0, the Bin will be marked\n * as free and its space may be reused by the packing code.\n *\n * @param {number} w Width of the bin to allocate\n * @param {number} h Height of the bin to allocate\n * @param {number|string} [id] Unique identifier for this bin, (if unsupplied, assume it's a new bin and create an id)\n * @returns {Bin} Bin object with `id`, `x`, `y`, `w`, `h` properties, or `null` if allocation failed\n * @example\n * var results = sprite.packOne(12, 16, 'a');\n */\nShelfPack$1.prototype.packOne = function(w, h, id) {\n var best = { freebin: -1, shelf: -1, waste: Infinity },\n y = 0,\n bin, shelf, waste, i;\n\n // if id was supplied, attempt a lookup..\n if (typeof id === 'string' || typeof id === 'number') {\n bin = this.getBin(id);\n if (bin) { // we packed this bin already\n this.ref(bin);\n return bin;\n }\n if (typeof id === 'number') {\n this.maxId = Math.max(id, this.maxId);\n }\n } else {\n id = ++this.maxId;\n }\n\n // First try to reuse a free bin..\n for (i = 0; i < this.freebins.length; i++) {\n bin = this.freebins[i];\n\n // exactly the right height and width, use it..\n if (h === bin.maxh && w === bin.maxw) {\n return this.allocFreebin(i, w, h, id);\n }\n // not enough height or width, skip it..\n if (h > bin.maxh || w > bin.maxw) {\n continue;\n }\n // extra height or width, minimize wasted area..\n if (h <= bin.maxh && w <= bin.maxw) {\n waste = (bin.maxw * bin.maxh) - (w * h);\n if (waste < best.waste) {\n best.waste = waste;\n best.freebin = i;\n }\n }\n }\n\n // Next find the best shelf..\n for (i = 0; i < this.shelves.length; i++) {\n shelf = this.shelves[i];\n y += shelf.h;\n\n // not enough width on this shelf, skip it..\n if (w > shelf.free) {\n continue;\n }\n // exactly the right height, pack it..\n if (h === shelf.h) {\n return this.allocShelf(i, w, h, id);\n }\n // not enough height, skip it..\n if (h > shelf.h) {\n continue;\n }\n // extra height, minimize wasted area..\n if (h < shelf.h) {\n waste = (shelf.h - h) * w;\n if (waste < best.waste) {\n best.freebin = -1;\n best.waste = waste;\n best.shelf = i;\n }\n }\n }\n\n if (best.freebin !== -1) {\n return this.allocFreebin(best.freebin, w, h, id);\n }\n\n if (best.shelf !== -1) {\n return this.allocShelf(best.shelf, w, h, id);\n }\n\n // No free bins or shelves.. add shelf..\n if (h <= (this.h - y) && w <= this.w) {\n shelf = new Shelf(y, this.w, h);\n return this.allocShelf(this.shelves.push(shelf) - 1, w, h, id);\n }\n\n // No room for more shelves..\n // If `autoResize` option is set, grow the sprite as follows:\n // * double whichever sprite dimension is smaller (`w1` or `h1`)\n // * if sprite dimensions are equal, grow width before height\n // * accomodate very large bin requests (big `w` or `h`)\n if (this.autoResize) {\n var h1, h2, w1, w2;\n\n h1 = h2 = this.h;\n w1 = w2 = this.w;\n\n if (w1 <= h1 || w > w1) { // grow width..\n w2 = Math.max(w, w1) * 2;\n }\n if (h1 < w1 || h > h1) { // grow height..\n h2 = Math.max(h, h1) * 2;\n }\n\n this.resize(w2, h2);\n return this.packOne(w, h, id); // retry\n }\n\n return null;\n};\n\n\n/**\n * Called by packOne() to allocate a bin by reusing an existing freebin\n *\n * @private\n * @param {number} index Index into the `this.freebins` array\n * @param {number} w Width of the bin to allocate\n * @param {number} h Height of the bin to allocate\n * @param {number|string} id Unique identifier for this bin\n * @returns {Bin} Bin object with `id`, `x`, `y`, `w`, `h` properties\n * @example\n * var bin = sprite.allocFreebin(0, 12, 16, 'a');\n */\nShelfPack$1.prototype.allocFreebin = function (index, w, h, id) {\n var bin = this.freebins.splice(index, 1)[0];\n bin.id = id;\n bin.w = w;\n bin.h = h;\n bin.refcount = 0;\n this.bins[id] = bin;\n this.ref(bin);\n return bin;\n};\n\n\n/**\n * Called by `packOne() to allocate bin on an existing shelf\n *\n * @private\n * @param {number} index Index into the `this.shelves` array\n * @param {number} w Width of the bin to allocate\n * @param {number} h Height of the bin to allocate\n * @param {number|string} id Unique identifier for this bin\n * @returns {Bin} Bin object with `id`, `x`, `y`, `w`, `h` properties\n * @example\n * var results = sprite.allocShelf(0, 12, 16, 'a');\n */\nShelfPack$1.prototype.allocShelf = function(index, w, h, id) {\n var shelf = this.shelves[index];\n var bin = shelf.alloc(w, h, id);\n this.bins[id] = bin;\n this.ref(bin);\n return bin;\n};\n\n\n/**\n * Shrink the width/height of the sprite to the bare minimum.\n * Since shelf-pack doubles first width, then height when running out of shelf space\n * this can result in fairly large unused space both in width and height if that happens\n * towards the end of bin packing.\n */\nShelfPack$1.prototype.shrink = function() {\n if (this.shelves.length > 0) {\n var w2 = 0;\n var h2 = 0;\n\n for (var j = 0; j < this.shelves.length; j++) {\n var shelf = this.shelves[j];\n h2 += shelf.h;\n w2 = Math.max(shelf.w - shelf.free, w2);\n }\n\n this.resize(w2, h2);\n }\n};\n\n\n/**\n * Return a packed bin given its id, or undefined if the id is not found\n *\n * @param {number|string} id Unique identifier for this bin,\n * @returns {Bin} The requested bin, or undefined if not yet packed\n * @example\n * var b = sprite.getBin('a');\n */\nShelfPack$1.prototype.getBin = function(id) {\n return this.bins[id];\n};\n\n\n/**\n * Increment the ref count of a bin and update statistics.\n *\n * @param {Bin} bin Bin instance\n * @returns {number} New refcount of the bin\n * @example\n * var bin = sprite.getBin('a');\n * sprite.ref(bin);\n */\nShelfPack$1.prototype.ref = function(bin) {\n if (++bin.refcount === 1) { // a new Bin.. record height in stats historgram..\n var h = bin.h;\n this.stats[h] = (this.stats[h] | 0) + 1;\n }\n\n return bin.refcount;\n};\n\n\n/**\n * Decrement the ref count of a bin and update statistics.\n * The bin will be automatically marked as free space once the refcount reaches 0.\n *\n * @param {Bin} bin Bin instance\n * @returns {number} New refcount of the bin\n * @example\n * var bin = sprite.getBin('a');\n * sprite.unref(bin);\n */\nShelfPack$1.prototype.unref = function(bin) {\n if (bin.refcount === 0) {\n return 0;\n }\n\n if (--bin.refcount === 0) {\n this.stats[bin.h]--;\n delete this.bins[bin.id];\n this.freebins.push(bin);\n }\n\n return bin.refcount;\n};\n\n\n/**\n * Clear the sprite. Resets everything and resets statistics.\n *\n * @example\n * sprite.clear();\n */\nShelfPack$1.prototype.clear = function() {\n this.shelves = [];\n this.freebins = [];\n this.stats = {};\n this.bins = {};\n this.maxId = 0;\n};\n\n\n/**\n * Resize the sprite.\n *\n * @param {number} w Requested new sprite width\n * @param {number} h Requested new sprite height\n * @returns {boolean} `true` if resize succeeded, `false` if failed\n * @example\n * sprite.resize(256, 256);\n */\nShelfPack$1.prototype.resize = function(w, h) {\n this.w = w;\n this.h = h;\n for (var i = 0; i < this.shelves.length; i++) {\n this.shelves[i].resize(w);\n }\n return true;\n};\n\n\n/**\n * Create a new Shelf.\n *\n * @private\n * @class Shelf\n * @param {number} y Top coordinate of the new shelf\n * @param {number} w Width of the new shelf\n * @param {number} h Height of the new shelf\n * @example\n * var shelf = new Shelf(64, 512, 24);\n */\nfunction Shelf(y, w, h) {\n this.x = 0;\n this.y = y;\n this.w = this.free = w;\n this.h = h;\n}\n\n\n/**\n * Allocate a single bin into the shelf.\n *\n * @private\n * @param {number} w Width of the bin to allocate\n * @param {number} h Height of the bin to allocate\n * @param {number|string} id Unique id of the bin to allocate\n * @returns {Bin} Bin object with `id`, `x`, `y`, `w`, `h` properties, or `null` if allocation failed\n * @example\n * shelf.alloc(12, 16, 'a');\n */\nShelf.prototype.alloc = function(w, h, id) {\n if (w > this.free || h > this.h) {\n return null;\n }\n var x = this.x;\n this.x += w;\n this.free -= w;\n return new Bin(id, x, this.y, w, h, w, this.h);\n};\n\n\n/**\n * Resize the shelf.\n *\n * @private\n * @param {number} w Requested new width of the shelf\n * @returns {boolean} true\n * @example\n * shelf.resize(512);\n */\nShelf.prototype.resize = function(w) {\n this.free += (w - this.w);\n this.w = w;\n return true;\n};\n\n\n/**\n * Create a new Bin object.\n *\n * @class Bin\n * @param {number|string} id Unique id of the bin\n * @param {number} x Left coordinate of the bin\n * @param {number} y Top coordinate of the bin\n * @param {number} w Width of the bin\n * @param {number} h Height of the bin\n * @param {number} [maxw] Max width of the bin (defaults to `w` if not provided)\n * @param {number} [maxh] Max height of the bin (defaults to `h` if not provided)\n * @example\n * var bin = new Bin('a', 0, 0, 12, 16);\n */\nfunction Bin(id, x, y, w, h, maxw, maxh) {\n this.id = id;\n this.x = x;\n this.y = y;\n this.w = w;\n this.h = h;\n this.maxw = maxw || w;\n this.maxh = maxh || h;\n this.refcount = 0;\n}\n\nreturn ShelfPack$1;\n\n})));\n","// @flow\n\nimport ShelfPack from '@mapbox/shelf-pack';\n\nimport { RGBAImage } from '../util/image';\nimport { register } from '../util/web_worker_transfer';\n\nimport type {StyleImage} from '../style/style_image';\n\nconst padding = 1;\n\ntype Rect = {\n x: number,\n y: number,\n w: number,\n h: number\n};\n\nexport class ImagePosition {\n paddedRect: Rect;\n pixelRatio: number;\n\n constructor(paddedRect: Rect, {pixelRatio}: StyleImage) {\n this.paddedRect = paddedRect;\n this.pixelRatio = pixelRatio;\n }\n\n get tl(): [number, number] {\n return [\n this.paddedRect.x + padding,\n this.paddedRect.y + padding\n ];\n }\n\n get br(): [number, number] {\n return [\n this.paddedRect.x + this.paddedRect.w - padding,\n this.paddedRect.y + this.paddedRect.h - padding\n ];\n }\n\n get displaySize(): [number, number] {\n return [\n (this.paddedRect.w - padding * 2) / this.pixelRatio,\n (this.paddedRect.h - padding * 2) / this.pixelRatio\n ];\n }\n}\n\nexport default class ImageAtlas {\n image: RGBAImage;\n positions: {[string]: ImagePosition};\n\n constructor(images: {[string]: StyleImage}) {\n const image = new RGBAImage({width: 0, height: 0});\n const positions = {};\n\n const pack = new ShelfPack(0, 0, {autoResize: true});\n\n for (const id in images) {\n const src = images[id];\n\n const bin = pack.packOne(\n src.data.width + 2 * padding,\n src.data.height + 2 * padding);\n\n image.resize({\n width: pack.w,\n height: pack.h\n });\n\n RGBAImage.copy(\n src.data,\n image,\n { x: 0, y: 0 },\n {\n x: bin.x + padding,\n y: bin.y + padding\n },\n src.data);\n\n positions[id] = new ImagePosition(bin, src);\n }\n\n pack.shrink();\n image.resize({\n width: pack.w,\n height: pack.h\n });\n\n this.image = image;\n this.positions = positions;\n }\n}\n\nregister('ImagePosition', ImagePosition);\nregister('ImageAtlas', ImageAtlas);\n\n","exports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = nBytes * 8 - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = nBytes * 8 - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = (value * c - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","'use strict';\n\nmodule.exports = Pbf;\n\nvar ieee754 = require('ieee754');\n\nfunction Pbf(buf) {\n this.buf = ArrayBuffer.isView && ArrayBuffer.isView(buf) ? buf : new Uint8Array(buf || 0);\n this.pos = 0;\n this.type = 0;\n this.length = this.buf.length;\n}\n\nPbf.Varint = 0; // varint: int32, int64, uint32, uint64, sint32, sint64, bool, enum\nPbf.Fixed64 = 1; // 64-bit: double, fixed64, sfixed64\nPbf.Bytes = 2; // length-delimited: string, bytes, embedded messages, packed repeated fields\nPbf.Fixed32 = 5; // 32-bit: float, fixed32, sfixed32\n\nvar SHIFT_LEFT_32 = (1 << 16) * (1 << 16),\n SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;\n\nPbf.prototype = {\n\n destroy: function() {\n this.buf = null;\n },\n\n // === READING =================================================================\n\n readFields: function(readField, result, end) {\n end = end || this.length;\n\n while (this.pos < end) {\n var val = this.readVarint(),\n tag = val >> 3,\n startPos = this.pos;\n\n this.type = val & 0x7;\n readField(tag, result, this);\n\n if (this.pos === startPos) this.skip(val);\n }\n return result;\n },\n\n readMessage: function(readField, result) {\n return this.readFields(readField, result, this.readVarint() + this.pos);\n },\n\n readFixed32: function() {\n var val = readUInt32(this.buf, this.pos);\n this.pos += 4;\n return val;\n },\n\n readSFixed32: function() {\n var val = readInt32(this.buf, this.pos);\n this.pos += 4;\n return val;\n },\n\n // 64-bit int handling is based on github.com/dpw/node-buffer-more-ints (MIT-licensed)\n\n readFixed64: function() {\n var val = readUInt32(this.buf, this.pos) + readUInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;\n this.pos += 8;\n return val;\n },\n\n readSFixed64: function() {\n var val = readUInt32(this.buf, this.pos) + readInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;\n this.pos += 8;\n return val;\n },\n\n readFloat: function() {\n var val = ieee754.read(this.buf, this.pos, true, 23, 4);\n this.pos += 4;\n return val;\n },\n\n readDouble: function() {\n var val = ieee754.read(this.buf, this.pos, true, 52, 8);\n this.pos += 8;\n return val;\n },\n\n readVarint: function(isSigned) {\n var buf = this.buf,\n val, b;\n\n b = buf[this.pos++]; val = b & 0x7f; if (b < 0x80) return val;\n b = buf[this.pos++]; val |= (b & 0x7f) << 7; if (b < 0x80) return val;\n b = buf[this.pos++]; val |= (b & 0x7f) << 14; if (b < 0x80) return val;\n b = buf[this.pos++]; val |= (b & 0x7f) << 21; if (b < 0x80) return val;\n b = buf[this.pos]; val |= (b & 0x0f) << 28;\n\n return readVarintRemainder(val, isSigned, this);\n },\n\n readVarint64: function() { // for compatibility with v2.0.1\n return this.readVarint(true);\n },\n\n readSVarint: function() {\n var num = this.readVarint();\n return num % 2 === 1 ? (num + 1) / -2 : num / 2; // zigzag encoding\n },\n\n readBoolean: function() {\n return Boolean(this.readVarint());\n },\n\n readString: function() {\n var end = this.readVarint() + this.pos,\n str = readUtf8(this.buf, this.pos, end);\n this.pos = end;\n return str;\n },\n\n readBytes: function() {\n var end = this.readVarint() + this.pos,\n buffer = this.buf.subarray(this.pos, end);\n this.pos = end;\n return buffer;\n },\n\n // verbose for performance reasons; doesn't affect gzipped size\n\n readPackedVarint: function(arr, isSigned) {\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readVarint(isSigned));\n return arr;\n },\n readPackedSVarint: function(arr) {\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readSVarint());\n return arr;\n },\n readPackedBoolean: function(arr) {\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readBoolean());\n return arr;\n },\n readPackedFloat: function(arr) {\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readFloat());\n return arr;\n },\n readPackedDouble: function(arr) {\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readDouble());\n return arr;\n },\n readPackedFixed32: function(arr) {\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readFixed32());\n return arr;\n },\n readPackedSFixed32: function(arr) {\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readSFixed32());\n return arr;\n },\n readPackedFixed64: function(arr) {\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readFixed64());\n return arr;\n },\n readPackedSFixed64: function(arr) {\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readSFixed64());\n return arr;\n },\n\n skip: function(val) {\n var type = val & 0x7;\n if (type === Pbf.Varint) while (this.buf[this.pos++] > 0x7f) {}\n else if (type === Pbf.Bytes) this.pos = this.readVarint() + this.pos;\n else if (type === Pbf.Fixed32) this.pos += 4;\n else if (type === Pbf.Fixed64) this.pos += 8;\n else throw new Error('Unimplemented type: ' + type);\n },\n\n // === WRITING =================================================================\n\n writeTag: function(tag, type) {\n this.writeVarint((tag << 3) | type);\n },\n\n realloc: function(min) {\n var length = this.length || 16;\n\n while (length < this.pos + min) length *= 2;\n\n if (length !== this.length) {\n var buf = new Uint8Array(length);\n buf.set(this.buf);\n this.buf = buf;\n this.length = length;\n }\n },\n\n finish: function() {\n this.length = this.pos;\n this.pos = 0;\n return this.buf.subarray(0, this.length);\n },\n\n writeFixed32: function(val) {\n this.realloc(4);\n writeInt32(this.buf, val, this.pos);\n this.pos += 4;\n },\n\n writeSFixed32: function(val) {\n this.realloc(4);\n writeInt32(this.buf, val, this.pos);\n this.pos += 4;\n },\n\n writeFixed64: function(val) {\n this.realloc(8);\n writeInt32(this.buf, val & -1, this.pos);\n writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);\n this.pos += 8;\n },\n\n writeSFixed64: function(val) {\n this.realloc(8);\n writeInt32(this.buf, val & -1, this.pos);\n writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);\n this.pos += 8;\n },\n\n writeVarint: function(val) {\n val = +val || 0;\n\n if (val > 0xfffffff || val < 0) {\n writeBigVarint(val, this);\n return;\n }\n\n this.realloc(4);\n\n this.buf[this.pos++] = val & 0x7f | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;\n this.buf[this.pos++] = ((val >>>= 7) & 0x7f) | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;\n this.buf[this.pos++] = ((val >>>= 7) & 0x7f) | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;\n this.buf[this.pos++] = (val >>> 7) & 0x7f;\n },\n\n writeSVarint: function(val) {\n this.writeVarint(val < 0 ? -val * 2 - 1 : val * 2);\n },\n\n writeBoolean: function(val) {\n this.writeVarint(Boolean(val));\n },\n\n writeString: function(str) {\n str = String(str);\n this.realloc(str.length * 4);\n\n this.pos++; // reserve 1 byte for short string length\n\n var startPos = this.pos;\n // write the string directly to the buffer and see how much was written\n this.pos = writeUtf8(this.buf, str, this.pos);\n var len = this.pos - startPos;\n\n if (len >= 0x80) makeRoomForExtraLength(startPos, len, this);\n\n // finally, write the message length in the reserved place and restore the position\n this.pos = startPos - 1;\n this.writeVarint(len);\n this.pos += len;\n },\n\n writeFloat: function(val) {\n this.realloc(4);\n ieee754.write(this.buf, val, this.pos, true, 23, 4);\n this.pos += 4;\n },\n\n writeDouble: function(val) {\n this.realloc(8);\n ieee754.write(this.buf, val, this.pos, true, 52, 8);\n this.pos += 8;\n },\n\n writeBytes: function(buffer) {\n var len = buffer.length;\n this.writeVarint(len);\n this.realloc(len);\n for (var i = 0; i < len; i++) this.buf[this.pos++] = buffer[i];\n },\n\n writeRawMessage: function(fn, obj) {\n this.pos++; // reserve 1 byte for short message length\n\n // write the message directly to the buffer and see how much was written\n var startPos = this.pos;\n fn(obj, this);\n var len = this.pos - startPos;\n\n if (len >= 0x80) makeRoomForExtraLength(startPos, len, this);\n\n // finally, write the message length in the reserved place and restore the position\n this.pos = startPos - 1;\n this.writeVarint(len);\n this.pos += len;\n },\n\n writeMessage: function(tag, fn, obj) {\n this.writeTag(tag, Pbf.Bytes);\n this.writeRawMessage(fn, obj);\n },\n\n writePackedVarint: function(tag, arr) { this.writeMessage(tag, writePackedVarint, arr); },\n writePackedSVarint: function(tag, arr) { this.writeMessage(tag, writePackedSVarint, arr); },\n writePackedBoolean: function(tag, arr) { this.writeMessage(tag, writePackedBoolean, arr); },\n writePackedFloat: function(tag, arr) { this.writeMessage(tag, writePackedFloat, arr); },\n writePackedDouble: function(tag, arr) { this.writeMessage(tag, writePackedDouble, arr); },\n writePackedFixed32: function(tag, arr) { this.writeMessage(tag, writePackedFixed32, arr); },\n writePackedSFixed32: function(tag, arr) { this.writeMessage(tag, writePackedSFixed32, arr); },\n writePackedFixed64: function(tag, arr) { this.writeMessage(tag, writePackedFixed64, arr); },\n writePackedSFixed64: function(tag, arr) { this.writeMessage(tag, writePackedSFixed64, arr); },\n\n writeBytesField: function(tag, buffer) {\n this.writeTag(tag, Pbf.Bytes);\n this.writeBytes(buffer);\n },\n writeFixed32Field: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed32);\n this.writeFixed32(val);\n },\n writeSFixed32Field: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed32);\n this.writeSFixed32(val);\n },\n writeFixed64Field: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed64);\n this.writeFixed64(val);\n },\n writeSFixed64Field: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed64);\n this.writeSFixed64(val);\n },\n writeVarintField: function(tag, val) {\n this.writeTag(tag, Pbf.Varint);\n this.writeVarint(val);\n },\n writeSVarintField: function(tag, val) {\n this.writeTag(tag, Pbf.Varint);\n this.writeSVarint(val);\n },\n writeStringField: function(tag, str) {\n this.writeTag(tag, Pbf.Bytes);\n this.writeString(str);\n },\n writeFloatField: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed32);\n this.writeFloat(val);\n },\n writeDoubleField: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed64);\n this.writeDouble(val);\n },\n writeBooleanField: function(tag, val) {\n this.writeVarintField(tag, Boolean(val));\n }\n};\n\nfunction readVarintRemainder(l, s, p) {\n var buf = p.buf,\n h, b;\n\n b = buf[p.pos++]; h = (b & 0x70) >> 4; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x7f) << 3; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x7f) << 10; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x7f) << 17; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x7f) << 24; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x01) << 31; if (b < 0x80) return toNum(l, h, s);\n\n throw new Error('Expected varint not more than 10 bytes');\n}\n\nfunction readPackedEnd(pbf) {\n return pbf.type === Pbf.Bytes ?\n pbf.readVarint() + pbf.pos : pbf.pos + 1;\n}\n\nfunction toNum(low, high, isSigned) {\n if (isSigned) {\n return high * 0x100000000 + (low >>> 0);\n }\n\n return ((high >>> 0) * 0x100000000) + (low >>> 0);\n}\n\nfunction writeBigVarint(val, pbf) {\n var low, high;\n\n if (val >= 0) {\n low = (val % 0x100000000) | 0;\n high = (val / 0x100000000) | 0;\n } else {\n low = ~(-val % 0x100000000);\n high = ~(-val / 0x100000000);\n\n if (low ^ 0xffffffff) {\n low = (low + 1) | 0;\n } else {\n low = 0;\n high = (high + 1) | 0;\n }\n }\n\n if (val >= 0x10000000000000000 || val < -0x10000000000000000) {\n throw new Error('Given varint doesn\\'t fit into 10 bytes');\n }\n\n pbf.realloc(10);\n\n writeBigVarintLow(low, high, pbf);\n writeBigVarintHigh(high, pbf);\n}\n\nfunction writeBigVarintLow(low, high, pbf) {\n pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;\n pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;\n pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;\n pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;\n pbf.buf[pbf.pos] = low & 0x7f;\n}\n\nfunction writeBigVarintHigh(high, pbf) {\n var lsb = (high & 0x07) << 4;\n\n pbf.buf[pbf.pos++] |= lsb | ((high >>>= 3) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f;\n}\n\nfunction makeRoomForExtraLength(startPos, len, pbf) {\n var extraLen =\n len <= 0x3fff ? 1 :\n len <= 0x1fffff ? 2 :\n len <= 0xfffffff ? 3 : Math.ceil(Math.log(len) / (Math.LN2 * 7));\n\n // if 1 byte isn't enough for encoding message length, shift the data to the right\n pbf.realloc(extraLen);\n for (var i = pbf.pos - 1; i >= startPos; i--) pbf.buf[i + extraLen] = pbf.buf[i];\n}\n\nfunction writePackedVarint(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeVarint(arr[i]); }\nfunction writePackedSVarint(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSVarint(arr[i]); }\nfunction writePackedFloat(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFloat(arr[i]); }\nfunction writePackedDouble(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeDouble(arr[i]); }\nfunction writePackedBoolean(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeBoolean(arr[i]); }\nfunction writePackedFixed32(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFixed32(arr[i]); }\nfunction writePackedSFixed32(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed32(arr[i]); }\nfunction writePackedFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFixed64(arr[i]); }\nfunction writePackedSFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed64(arr[i]); }\n\n// Buffer code below from https://github.com/feross/buffer, MIT-licensed\n\nfunction readUInt32(buf, pos) {\n return ((buf[pos]) |\n (buf[pos + 1] << 8) |\n (buf[pos + 2] << 16)) +\n (buf[pos + 3] * 0x1000000);\n}\n\nfunction writeInt32(buf, val, pos) {\n buf[pos] = val;\n buf[pos + 1] = (val >>> 8);\n buf[pos + 2] = (val >>> 16);\n buf[pos + 3] = (val >>> 24);\n}\n\nfunction readInt32(buf, pos) {\n return ((buf[pos]) |\n (buf[pos + 1] << 8) |\n (buf[pos + 2] << 16)) +\n (buf[pos + 3] << 24);\n}\n\nfunction readUtf8(buf, pos, end) {\n var str = '';\n var i = pos;\n\n while (i < end) {\n var b0 = buf[i];\n var c = null; // codepoint\n var bytesPerSequence =\n b0 > 0xEF ? 4 :\n b0 > 0xDF ? 3 :\n b0 > 0xBF ? 2 : 1;\n\n if (i + bytesPerSequence > end) break;\n\n var b1, b2, b3;\n\n if (bytesPerSequence === 1) {\n if (b0 < 0x80) {\n c = b0;\n }\n } else if (bytesPerSequence === 2) {\n b1 = buf[i + 1];\n if ((b1 & 0xC0) === 0x80) {\n c = (b0 & 0x1F) << 0x6 | (b1 & 0x3F);\n if (c <= 0x7F) {\n c = null;\n }\n }\n } else if (bytesPerSequence === 3) {\n b1 = buf[i + 1];\n b2 = buf[i + 2];\n if ((b1 & 0xC0) === 0x80 && (b2 & 0xC0) === 0x80) {\n c = (b0 & 0xF) << 0xC | (b1 & 0x3F) << 0x6 | (b2 & 0x3F);\n if (c <= 0x7FF || (c >= 0xD800 && c <= 0xDFFF)) {\n c = null;\n }\n }\n } else if (bytesPerSequence === 4) {\n b1 = buf[i + 1];\n b2 = buf[i + 2];\n b3 = buf[i + 3];\n if ((b1 & 0xC0) === 0x80 && (b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80) {\n c = (b0 & 0xF) << 0x12 | (b1 & 0x3F) << 0xC | (b2 & 0x3F) << 0x6 | (b3 & 0x3F);\n if (c <= 0xFFFF || c >= 0x110000) {\n c = null;\n }\n }\n }\n\n if (c === null) {\n c = 0xFFFD;\n bytesPerSequence = 1;\n\n } else if (c > 0xFFFF) {\n c -= 0x10000;\n str += String.fromCharCode(c >>> 10 & 0x3FF | 0xD800);\n c = 0xDC00 | c & 0x3FF;\n }\n\n str += String.fromCharCode(c);\n i += bytesPerSequence;\n }\n\n return str;\n}\n\nfunction writeUtf8(buf, str, pos) {\n for (var i = 0, c, lead; i < str.length; i++) {\n c = str.charCodeAt(i); // code point\n\n if (c > 0xD7FF && c < 0xE000) {\n if (lead) {\n if (c < 0xDC00) {\n buf[pos++] = 0xEF;\n buf[pos++] = 0xBF;\n buf[pos++] = 0xBD;\n lead = c;\n continue;\n } else {\n c = lead - 0xD800 << 10 | c - 0xDC00 | 0x10000;\n lead = null;\n }\n } else {\n if (c > 0xDBFF || (i + 1 === str.length)) {\n buf[pos++] = 0xEF;\n buf[pos++] = 0xBF;\n buf[pos++] = 0xBD;\n } else {\n lead = c;\n }\n continue;\n }\n } else if (lead) {\n buf[pos++] = 0xEF;\n buf[pos++] = 0xBF;\n buf[pos++] = 0xBD;\n lead = null;\n }\n\n if (c < 0x80) {\n buf[pos++] = c;\n } else {\n if (c < 0x800) {\n buf[pos++] = c >> 0x6 | 0xC0;\n } else {\n if (c < 0x10000) {\n buf[pos++] = c >> 0xC | 0xE0;\n } else {\n buf[pos++] = c >> 0x12 | 0xF0;\n buf[pos++] = c >> 0xC & 0x3F | 0x80;\n }\n buf[pos++] = c >> 0x6 & 0x3F | 0x80;\n }\n buf[pos++] = c & 0x3F | 0x80;\n }\n }\n return pos;\n}\n","// @flow\n\nimport { AlphaImage } from '../util/image';\n\nimport Protobuf from 'pbf';\nconst border = 3;\n\nimport type {StyleGlyph} from './style_glyph';\n\nfunction readFontstacks(tag: number, glyphs: Array, pbf: Protobuf) {\n if (tag === 1) {\n pbf.readMessage(readFontstack, glyphs);\n }\n}\n\nfunction readFontstack(tag: number, glyphs: Array, pbf: Protobuf) {\n if (tag === 3) {\n const {id, bitmap, width, height, left, top, advance} = pbf.readMessage(readGlyph, {});\n glyphs.push({\n id,\n bitmap: new AlphaImage({\n width: width + 2 * border,\n height: height + 2 * border\n }, bitmap),\n metrics: {width, height, left, top, advance}\n });\n }\n}\n\nfunction readGlyph(tag: number, glyph: Object, pbf: Protobuf) {\n if (tag === 1) glyph.id = pbf.readVarint();\n else if (tag === 2) glyph.bitmap = pbf.readBytes();\n else if (tag === 3) glyph.width = pbf.readVarint();\n else if (tag === 4) glyph.height = pbf.readVarint();\n else if (tag === 5) glyph.left = pbf.readSVarint();\n else if (tag === 6) glyph.top = pbf.readSVarint();\n else if (tag === 7) glyph.advance = pbf.readVarint();\n}\n\nexport default function (data: ArrayBuffer | Uint8Array): Array {\n return new Protobuf(data).readFields(readFontstacks, []);\n}\n\nexport const GLYPH_PBF_BORDER = border;\n","// @flow\n\nimport { bindAll } from './util';\nimport { serialize, deserialize } from './web_worker_transfer';\n\nimport type {Transferable} from '../types/transferable';\n\n/**\n * An implementation of the [Actor design pattern](http://en.wikipedia.org/wiki/Actor_model)\n * that maintains the relationship between asynchronous tasks and the objects\n * that spin them off - in this case, tasks like parsing parts of styles,\n * owned by the styles\n *\n * @param {WebWorker} target\n * @param {WebWorker} parent\n * @param {string|number} mapId A unique identifier for the Map instance using this Actor.\n * @private\n */\nclass Actor {\n target: any;\n parent: any;\n mapId: string;\n callbacks: any;\n callbackID: number;\n name: string;\n\n constructor(target: any, parent: any, mapId: any) {\n this.target = target;\n this.parent = parent;\n this.mapId = mapId;\n this.callbacks = {};\n this.callbackID = 0;\n bindAll(['receive'], this);\n this.target.addEventListener('message', this.receive, false);\n }\n\n /**\n * Sends a message from a main-thread map to a Worker or from a Worker back to\n * a main-thread map instance.\n *\n * @param type The name of the target method to invoke or '[source-type].[source-name].name' for a method on a WorkerSource.\n * @param targetMapId A particular mapId to which to send this message.\n * @private\n */\n send(type: string, data: mixed, callback: ?Function, targetMapId: ?string) {\n const id = callback ? `${this.mapId}:${this.callbackID++}` : null;\n if (callback) this.callbacks[id] = callback;\n const buffers: Array = [];\n this.target.postMessage({\n targetMapId: targetMapId,\n sourceMapId: this.mapId,\n type: type,\n id: String(id),\n data: serialize(data, buffers)\n }, buffers);\n }\n\n receive(message: Object) {\n const data = message.data,\n id = data.id;\n let callback;\n\n if (data.targetMapId && this.mapId !== data.targetMapId)\n return;\n\n const done = (err, data) => {\n const buffers: Array = [];\n this.target.postMessage({\n sourceMapId: this.mapId,\n type: '',\n id: String(id),\n error: err ? serialize(err) : null,\n data: serialize(data, buffers)\n }, buffers);\n };\n\n if (data.type === '') {\n callback = this.callbacks[data.id];\n delete this.callbacks[data.id];\n if (callback && data.error) {\n callback(deserialize(data.error));\n } else if (callback) {\n callback(null, deserialize(data.data));\n }\n } else if (typeof data.id !== 'undefined' && this.parent[data.type]) {\n // data.type == 'loadTile', 'removeTile', etc.\n this.parent[data.type](data.sourceMapId, deserialize(data.data), done);\n } else if (typeof data.id !== 'undefined' && this.parent.getWorkerSource) {\n // data.type == sourcetype.sourcename.method\n const keys = data.type.split('.');\n const workerSource = (this.parent: any).getWorkerSource(data.sourceMapId, keys[0], keys[1]);\n workerSource[keys[2]](deserialize(data.data), done);\n } else {\n this.parent[data.type](deserialize(data.data));\n }\n }\n\n remove() {\n this.target.removeEventListener('message', this.receive, false);\n }\n}\n\nexport default Actor;\n","(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n\ttypeof define === 'function' && define.amd ? define(['exports'], factory) :\n\t(factory((global.WhooTS = global.WhooTS || {})));\n}(this, (function (exports) {\n\n/**\n * getURL\n *\n * @param {String} baseUrl Base url of the WMS server\n * @param {String} layer Layer name\n * @param {Number} x Tile coordinate x\n * @param {Number} y Tile coordinate y\n * @param {Number} z Tile zoom\n * @param {Object} [options]\n * @param {String} [options.format='image/png']\n * @param {String} [options.service='WMS']\n * @param {String} [options.version='1.1.1']\n * @param {String} [options.request='GetMap']\n * @param {String} [options.srs='EPSG:3857']\n * @param {Number} [options.width='256']\n * @param {Number} [options.height='256']\n * @returns {String} url\n * @example\n * var baseUrl = 'http://geodata.state.nj.us/imagerywms/Natural2015';\n * var layer = 'Natural2015';\n * var url = whoots.getURL(baseUrl, layer, 154308, 197167, 19);\n */\nfunction getURL(baseUrl, layer, x, y, z, options) {\n options = options || {};\n\n var url = baseUrl + '?' + [\n 'bbox=' + getTileBBox(x, y, z),\n 'format=' + (options.format || 'image/png'),\n 'service=' + (options.service || 'WMS'),\n 'version=' + (options.version || '1.1.1'),\n 'request=' + (options.request || 'GetMap'),\n 'srs=' + (options.srs || 'EPSG:3857'),\n 'width=' + (options.width || 256),\n 'height=' + (options.height || 256),\n 'layers=' + layer\n ].join('&');\n\n return url;\n}\n\n\n/**\n * getTileBBox\n *\n * @param {Number} x Tile coordinate x\n * @param {Number} y Tile coordinate y\n * @param {Number} z Tile zoom\n * @returns {String} String of the bounding box\n */\nfunction getTileBBox(x, y, z) {\n // for Google/OSM tile scheme we need to alter the y\n y = (Math.pow(2, z) - y - 1);\n\n var min = getMercCoords(x * 256, y * 256, z),\n max = getMercCoords((x + 1) * 256, (y + 1) * 256, z);\n\n return min[0] + ',' + min[1] + ',' + max[0] + ',' + max[1];\n}\n\n\n/**\n * getMercCoords\n *\n * @param {Number} x Pixel coordinate x\n * @param {Number} y Pixel coordinate y\n * @param {Number} z Tile zoom\n * @returns {Array} [x, y]\n */\nfunction getMercCoords(x, y, z) {\n var resolution = (2 * Math.PI * 6378137 / 256) / Math.pow(2, z),\n merc_x = (x * resolution - 2 * Math.PI * 6378137 / 2.0),\n merc_y = (y * resolution - 2 * Math.PI * 6378137 / 2.0);\n\n return [merc_x, merc_y];\n}\n\nexports.getURL = getURL;\nexports.getTileBBox = getTileBBox;\nexports.getMercCoords = getMercCoords;\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\n})));\n","// @flow\n\nimport WhooTS from '@mapbox/whoots-js';\n\nimport assert from 'assert';\nimport { register } from '../util/web_worker_transfer';\nimport Coordinate from '../geo/coordinate';\n\nexport class CanonicalTileID {\n z: number;\n x: number;\n y: number;\n key: number;\n\n constructor(z: number, x: number, y: number) {\n assert(z >= 0 && z <= 25);\n assert(x >= 0 && x < Math.pow(2, z));\n assert(y >= 0 && y < Math.pow(2, z));\n this.z = z;\n this.x = x;\n this.y = y;\n this.key = calculateKey(0, z, x, y);\n }\n\n equals(id: CanonicalTileID) {\n return this.z === id.z && this.x === id.x && this.y === id.y;\n }\n\n // given a list of urls, choose a url template and return a tile URL\n url(urls: Array, scheme: ?string) {\n const bbox = WhooTS.getTileBBox(this.x, this.y, this.z);\n const quadkey = getQuadkey(this.z, this.x, this.y);\n\n return urls[(this.x + this.y) % urls.length]\n .replace('{prefix}', (this.x % 16).toString(16) + (this.y % 16).toString(16))\n .replace('{z}', String(this.z))\n .replace('{x}', String(this.x))\n .replace('{y}', String(scheme === 'tms' ? (Math.pow(2, this.z) - this.y - 1) : this.y))\n .replace('{quadkey}', quadkey)\n .replace('{bbox-epsg-3857}', bbox);\n }\n}\n\nexport class UnwrappedTileID {\n wrap: number;\n canonical: CanonicalTileID;\n key: number;\n\n constructor(wrap: number, canonical: CanonicalTileID) {\n this.wrap = wrap;\n this.canonical = canonical;\n this.key = calculateKey(wrap, canonical.z, canonical.x, canonical.y);\n }\n}\n\nexport class OverscaledTileID {\n overscaledZ: number;\n wrap: number;\n canonical: CanonicalTileID;\n key: number;\n posMatrix: Float32Array;\n\n constructor(overscaledZ: number, wrap: number, z: number, x: number, y: number) {\n assert(overscaledZ >= z);\n this.overscaledZ = overscaledZ;\n this.wrap = wrap;\n this.canonical = new CanonicalTileID(z, +x, +y);\n this.key = calculateKey(wrap, overscaledZ, x, y);\n }\n\n equals(id: OverscaledTileID) {\n return this.overscaledZ === id.overscaledZ && this.wrap === id.wrap && this.canonical.equals(id.canonical);\n }\n\n scaledTo(targetZ: number) {\n assert(targetZ <= this.overscaledZ);\n const zDifference = this.canonical.z - targetZ;\n if (targetZ > this.canonical.z) {\n return new OverscaledTileID(targetZ, this.wrap, this.canonical.z, this.canonical.x, this.canonical.y);\n } else {\n return new OverscaledTileID(targetZ, this.wrap, targetZ, this.canonical.x >> zDifference, this.canonical.y >> zDifference);\n }\n }\n\n isChildOf(parent: OverscaledTileID) {\n const zDifference = this.canonical.z - parent.canonical.z;\n // We're first testing for z == 0, to avoid a 32 bit shift, which is undefined.\n return parent.overscaledZ === 0 || (\n parent.overscaledZ < this.overscaledZ &&\n parent.canonical.x === (this.canonical.x >> zDifference) &&\n parent.canonical.y === (this.canonical.y >> zDifference));\n }\n\n children(sourceMaxZoom: number) {\n if (this.overscaledZ >= sourceMaxZoom) {\n // return a single tile coord representing a an overscaled tile\n return [new OverscaledTileID(this.overscaledZ + 1, this.wrap, this.canonical.z, this.canonical.x, this.canonical.y)];\n }\n\n const z = this.canonical.z + 1;\n const x = this.canonical.x * 2;\n const y = this.canonical.y * 2;\n return [\n new OverscaledTileID(z, this.wrap, z, x, y),\n new OverscaledTileID(z, this.wrap, z, x + 1, y),\n new OverscaledTileID(z, this.wrap, z, x, y + 1),\n new OverscaledTileID(z, this.wrap, z, x + 1, y + 1)\n ];\n }\n\n isLessThan(rhs: OverscaledTileID) {\n if (this.wrap < rhs.wrap) return true;\n if (this.wrap > rhs.wrap) return false;\n\n if (this.overscaledZ < rhs.overscaledZ) return true;\n if (this.overscaledZ > rhs.overscaledZ) return false;\n\n if (this.canonical.x < rhs.canonical.x) return true;\n if (this.canonical.x > rhs.canonical.x) return false;\n\n if (this.canonical.y < rhs.canonical.y) return true;\n return false;\n }\n\n wrapped() {\n return new OverscaledTileID(this.overscaledZ, 0, this.canonical.z, this.canonical.x, this.canonical.y);\n }\n\n unwrapTo(wrap: number) {\n return new OverscaledTileID(this.overscaledZ, wrap, this.canonical.z, this.canonical.x, this.canonical.y);\n }\n\n overscaleFactor() {\n return Math.pow(2, this.overscaledZ - this.canonical.z);\n }\n\n toUnwrapped() {\n return new UnwrappedTileID(this.wrap, this.canonical);\n }\n\n toString() {\n return `${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`;\n }\n\n toCoordinate() {\n return new Coordinate(this.canonical.x + Math.pow(2, this.wrap), this.canonical.y, this.canonical.z);\n }\n}\n\nfunction calculateKey(wrap: number, z: number, x: number, y: number) {\n wrap *= 2;\n if (wrap < 0) wrap = wrap * -1 - 1;\n const dim = 1 << z;\n return ((dim * dim * wrap + dim * y + x) * 32) + z;\n}\n\n\nfunction getQuadkey(z, x, y) {\n let quadkey = '', mask;\n for (let i = z; i > 0; i--) {\n mask = 1 << (i - 1);\n quadkey += ((x & mask ? 1 : 0) + (y & mask ? 2 : 0));\n }\n return quadkey;\n}\n\nregister('CanonicalTileID', CanonicalTileID);\nregister('OverscaledTileID', OverscaledTileID, {omit: ['posMatrix']});\n","// @flow\nimport { RGBAImage } from '../util/image';\n\nimport { warnOnce, clamp } from '../util/util';\nimport { register } from '../util/web_worker_transfer';\n\nexport class Level {\n dim: number;\n border: number;\n stride: number;\n data: Int32Array;\n\n constructor(dim: number, border: number, data: ?Int32Array) {\n if (dim <= 0) throw new RangeError('Level must have positive dimension');\n this.dim = dim;\n this.border = border;\n this.stride = this.dim + 2 * this.border;\n this.data = data || new Int32Array((this.dim + 2 * this.border) * (this.dim + 2 * this.border));\n }\n\n set(x: number, y: number, value: number) {\n this.data[this._idx(x, y)] = value + 65536;\n }\n\n get(x: number, y: number) {\n return this.data[this._idx(x, y)] - 65536;\n }\n\n _idx(x: number, y: number) {\n if (x < -this.border || x >= this.dim + this.border || y < -this.border || y >= this.dim + this.border) throw new RangeError('out of range source coordinates for DEM data');\n return (y + this.border) * this.stride + (x + this.border);\n }\n}\n\nregister('Level', Level);\n\n// DEMData is a data structure for decoding, backfilling, and storing elevation data for processing in the hillshade shaders\n// data can be populated either from a pngraw image tile or from serliazed data sent back from a worker. When data is initially\n// loaded from a image tile, we decode the pixel values using the mapbox terrain-rgb tileset decoding formula, but we store the\n// elevation data in a Level as an Int32 value. we add 65536 (2^16) to eliminate negative values and enable the use of\n// integer overflow when creating the texture used in the hillshadePrepare step.\n\n// DEMData also handles the backfilling of data from a tile's neighboring tiles. This is necessary because we use a pixel's 8\n// surrounding pixel values to compute the slope at that pixel, and we cannot accurately calculate the slope at pixels on a\n// tile's edge without backfilling from neighboring tiles.\n\nexport default class DEMData {\n uid: string;\n scale: number;\n level: Level;\n loaded: boolean;\n\n constructor(uid: string, scale: ?number, data: ?Level) {\n this.uid = uid;\n this.scale = scale || 1;\n // if no data is provided, use a temporary empty level to satisfy flow\n this.level = data || new Level(256, 512);\n this.loaded = !!data;\n }\n\n loadFromImage(data: RGBAImage, encoding: \"mapbox\" | \"terrarium\") {\n if (data.height !== data.width) throw new RangeError('DEM tiles must be square');\n if (encoding && encoding !== \"mapbox\" && encoding !== \"terrarium\") return warnOnce(\n `\"${encoding}\" is not a valid encoding type. Valid types include \"mapbox\" and \"terrarium\".`\n );\n // Build level 0\n const level = this.level = new Level(data.width, data.width / 2);\n const pixels = data.data;\n\n this._unpackData(level, pixels, encoding || \"mapbox\");\n\n // in order to avoid flashing seams between tiles, here we are initially populating a 1px border of pixels around the image\n // with the data of the nearest pixel from the image. this data is eventually replaced when the tile's neighboring\n // tiles are loaded and the accurate data can be backfilled using DEMData#backfillBorder\n for (let x = 0; x < level.dim; x++) {\n // left vertical border\n level.set(-1, x, level.get(0, x));\n // right vertical border\n level.set(level.dim, x, level.get(level.dim - 1, x));\n // left horizontal border\n level.set(x, -1, level.get(x, 0));\n // right horizontal border\n level.set(x, level.dim, level.get(x, level.dim - 1));\n }\n // corners\n level.set(-1, -1, level.get(0, 0));\n level.set(level.dim, -1, level.get(level.dim - 1, 0));\n level.set(-1, level.dim, level.get(0, level.dim - 1));\n level.set(level.dim, level.dim, level.get(level.dim - 1, level.dim - 1));\n this.loaded = true;\n }\n\n _unpackMapbox(r: number, g: number, b: number) {\n // unpacking formula for mapbox.terrain-rgb:\n // https://www.mapbox.com/help/access-elevation-data/#mapbox-terrain-rgb\n return ((r * 256 * 256 + g * 256.0 + b) / 10.0 - 10000.0);\n }\n\n _unpackTerrarium(r: number, g: number, b: number) {\n // unpacking formula for mapzen terrarium:\n // https://aws.amazon.com/public-datasets/terrain/\n return ((r * 256 + g + b / 256) - 32768.0);\n }\n\n _unpackData(level: Level, pixels: Uint8Array | Uint8ClampedArray, encoding: string) {\n const unpackFunctions = {\"mapbox\": this._unpackMapbox, \"terrarium\": this._unpackTerrarium};\n const unpack = unpackFunctions[encoding];\n for (let y = 0; y < level.dim; y++) {\n for (let x = 0; x < level.dim; x++) {\n const i = y * level.dim + x;\n const j = i * 4;\n level.set(x, y, this.scale * unpack(pixels[j], pixels[j + 1], pixels[j + 2]));\n }\n }\n }\n\n getPixels() {\n return new RGBAImage({width: this.level.dim + 2 * this.level.border, height: this.level.dim + 2 * this.level.border}, new Uint8Array(this.level.data.buffer));\n }\n\n backfillBorder(borderTile: DEMData, dx: number, dy: number) {\n const t = this.level;\n const o = borderTile.level;\n\n if (t.dim !== o.dim) throw new Error('level mismatch (dem dimension)');\n\n let _xMin = dx * t.dim,\n _xMax = dx * t.dim + t.dim,\n _yMin = dy * t.dim,\n _yMax = dy * t.dim + t.dim;\n\n switch (dx) {\n case -1:\n _xMin = _xMax - 1;\n break;\n case 1:\n _xMax = _xMin + 1;\n break;\n }\n\n switch (dy) {\n case -1:\n _yMin = _yMax - 1;\n break;\n case 1:\n _yMax = _yMin + 1;\n break;\n }\n\n const xMin = clamp(_xMin, -t.border, t.dim + t.border);\n const xMax = clamp(_xMax, -t.border, t.dim + t.border);\n const yMin = clamp(_yMin, -t.border, t.dim + t.border);\n const yMax = clamp(_yMax, -t.border, t.dim + t.border);\n\n const ox = -dx * t.dim;\n const oy = -dy * t.dim;\n for (let y = yMin; y < yMax; y++) {\n for (let x = xMin; x < xMax; x++) {\n t.set(x, y, o.get(x + ox, y + oy));\n }\n }\n }\n}\n\nregister('DEMData', DEMData);\n","// @flow\n\nimport assert from 'assert';\n\nclass DictionaryCoder {\n _stringToNumber: { [string]: number };\n _numberToString: Array;\n\n constructor(strings: Array) {\n this._stringToNumber = {};\n this._numberToString = [];\n for (let i = 0; i < strings.length; i++) {\n const string = strings[i];\n this._stringToNumber[string] = i;\n this._numberToString[i] = string;\n }\n }\n\n encode(string: string) {\n assert(string in this._stringToNumber);\n return this._stringToNumber[string];\n }\n\n decode(n: number) {\n assert(n < this._numberToString.length);\n return this._numberToString[n];\n }\n}\n\nexport default DictionaryCoder;\n","// @flow\n\nclass Feature {\n type: 'Feature';\n _geometry: ?GeoJSONGeometry;\n properties: {};\n id: number | string | void;\n\n _vectorTileFeature: VectorTileFeature;\n\n constructor(vectorTileFeature: VectorTileFeature, z: number, x: number, y: number) {\n this.type = 'Feature';\n\n this._vectorTileFeature = vectorTileFeature;\n (vectorTileFeature: any)._z = z;\n (vectorTileFeature: any)._x = x;\n (vectorTileFeature: any)._y = y;\n\n this.properties = vectorTileFeature.properties;\n\n if (vectorTileFeature.id != null) {\n this.id = vectorTileFeature.id;\n }\n }\n\n get geometry(): ?GeoJSONGeometry {\n if (this._geometry === undefined) {\n this._geometry = this._vectorTileFeature.toGeoJSON(\n (this._vectorTileFeature: any)._x,\n (this._vectorTileFeature: any)._y,\n (this._vectorTileFeature: any)._z).geometry;\n }\n return this._geometry;\n }\n\n set geometry(g: ?GeoJSONGeometry) {\n this._geometry = g;\n }\n\n toJSON() {\n const json = {\n geometry: this.geometry\n };\n for (const i in this) {\n if (i === '_geometry' || i === '_vectorTileFeature') continue;\n json[i] = (this: any)[i];\n }\n return json;\n }\n}\n\nexport default Feature;\n","// @flow\n\nimport Point from '@mapbox/point-geometry';\n\nimport loadGeometry from './load_geometry';\nimport EXTENT from './extent';\nimport featureFilter from '../style-spec/feature_filter';\nimport Grid from 'grid-index';\nimport DictionaryCoder from '../util/dictionary_coder';\nimport vt from '@mapbox/vector-tile';\nimport Protobuf from 'pbf';\nimport GeoJSONFeature from '../util/vectortile_to_geojson';\nimport { arraysIntersect } from '../util/util';\nimport { OverscaledTileID } from '../source/tile_id';\nimport { register } from '../util/web_worker_transfer';\nimport EvaluationParameters from '../style/evaluation_parameters';\n\nimport type StyleLayer from '../style/style_layer';\nimport type {FeatureFilter} from '../style-spec/feature_filter';\nimport type Transform from '../geo/transform';\n\nimport { FeatureIndexArray } from './array_types';\n\ntype QueryParameters = {\n scale: number,\n posMatrix: Float32Array,\n transform: Transform,\n tileSize: number,\n queryGeometry: Array>,\n queryPadding: number,\n params: {\n filter: FilterSpecification,\n layers: Array,\n }\n}\n\nclass FeatureIndex {\n tileID: OverscaledTileID;\n x: number;\n y: number;\n z: number;\n grid: Grid;\n featureIndexArray: FeatureIndexArray;\n\n rawTileData: ArrayBuffer;\n bucketLayerIDs: Array>;\n\n vtLayers: {[string]: VectorTileLayer};\n sourceLayerCoder: DictionaryCoder;\n\n constructor(tileID: OverscaledTileID,\n grid?: Grid,\n featureIndexArray?: FeatureIndexArray) {\n this.tileID = tileID;\n this.x = tileID.canonical.x;\n this.y = tileID.canonical.y;\n this.z = tileID.canonical.z;\n this.grid = grid || new Grid(EXTENT, 16, 0);\n this.featureIndexArray = featureIndexArray || new FeatureIndexArray();\n }\n\n insert(feature: VectorTileFeature, geometry: Array>, featureIndex: number, sourceLayerIndex: number, bucketIndex: number) {\n const key = this.featureIndexArray.length;\n this.featureIndexArray.emplaceBack(featureIndex, sourceLayerIndex, bucketIndex);\n\n for (let r = 0; r < geometry.length; r++) {\n const ring = geometry[r];\n\n const bbox = [Infinity, Infinity, -Infinity, -Infinity];\n for (let i = 0; i < ring.length; i++) {\n const p = ring[i];\n bbox[0] = Math.min(bbox[0], p.x);\n bbox[1] = Math.min(bbox[1], p.y);\n bbox[2] = Math.max(bbox[2], p.x);\n bbox[3] = Math.max(bbox[3], p.y);\n }\n\n if (bbox[0] < EXTENT &&\n bbox[1] < EXTENT &&\n bbox[2] >= 0 &&\n bbox[3] >= 0) {\n this.grid.insert(key, bbox[0], bbox[1], bbox[2], bbox[3]);\n }\n }\n }\n\n loadVTLayers(): {[string]: VectorTileLayer} {\n if (!this.vtLayers) {\n this.vtLayers = new vt.VectorTile(new Protobuf(this.rawTileData)).layers;\n this.sourceLayerCoder = new DictionaryCoder(this.vtLayers ? Object.keys(this.vtLayers).sort() : ['_geojsonTileLayer']);\n }\n return this.vtLayers;\n }\n\n // Finds non-symbol features in this tile at a particular position.\n query(args: QueryParameters, styleLayers: {[string]: StyleLayer}): {[string]: Array<{ featureIndex: number, feature: GeoJSONFeature }>} {\n this.loadVTLayers();\n\n const params = args.params || {},\n pixelsToTileUnits = EXTENT / args.tileSize / args.scale,\n filter = featureFilter(params.filter);\n\n const queryGeometry = args.queryGeometry;\n const queryPadding = args.queryPadding * pixelsToTileUnits;\n\n let minX = Infinity;\n let minY = Infinity;\n let maxX = -Infinity;\n let maxY = -Infinity;\n for (let i = 0; i < queryGeometry.length; i++) {\n const ring = queryGeometry[i];\n for (let k = 0; k < ring.length; k++) {\n const p = ring[k];\n minX = Math.min(minX, p.x);\n minY = Math.min(minY, p.y);\n maxX = Math.max(maxX, p.x);\n maxY = Math.max(maxY, p.y);\n }\n }\n\n const matching = this.grid.query(minX - queryPadding, minY - queryPadding, maxX + queryPadding, maxY + queryPadding);\n matching.sort(topDownFeatureComparator);\n const result = {};\n let previousIndex;\n for (let k = 0; k < matching.length; k++) {\n const index = matching[k];\n\n // don't check the same feature more than once\n if (index === previousIndex) continue;\n previousIndex = index;\n\n const match = this.featureIndexArray.get(index);\n let featureGeometry = null;\n this.loadMatchingFeature(\n result,\n match.bucketIndex,\n match.sourceLayerIndex,\n match.featureIndex,\n filter,\n params.layers,\n styleLayers,\n (feature: VectorTileFeature, styleLayer: StyleLayer) => {\n if (!featureGeometry) {\n featureGeometry = loadGeometry(feature);\n }\n return styleLayer.queryIntersectsFeature(queryGeometry, feature, featureGeometry, this.z, args.transform, pixelsToTileUnits, args.posMatrix);\n }\n );\n }\n\n return result;\n }\n\n loadMatchingFeature(\n result: {[string]: Array<{ featureIndex: number, feature: GeoJSONFeature }>},\n bucketIndex: number,\n sourceLayerIndex: number,\n featureIndex: number,\n filter: FeatureFilter,\n filterLayerIDs: Array,\n styleLayers: {[string]: StyleLayer},\n intersectionTest?: (feature: VectorTileFeature, styleLayer: StyleLayer) => boolean) {\n\n const layerIDs = this.bucketLayerIDs[bucketIndex];\n if (filterLayerIDs && !arraysIntersect(filterLayerIDs, layerIDs))\n return;\n\n const sourceLayerName = this.sourceLayerCoder.decode(sourceLayerIndex);\n const sourceLayer = this.vtLayers[sourceLayerName];\n const feature = sourceLayer.feature(featureIndex);\n\n if (!filter(new EvaluationParameters(this.tileID.overscaledZ), feature))\n return;\n\n for (let l = 0; l < layerIDs.length; l++) {\n const layerID = layerIDs[l];\n\n if (filterLayerIDs && filterLayerIDs.indexOf(layerID) < 0) {\n continue;\n }\n\n const styleLayer = styleLayers[layerID];\n if (!styleLayer) continue;\n\n if (intersectionTest && !intersectionTest(feature, styleLayer)) {\n // Only applied for non-symbol features\n continue;\n }\n\n const geojsonFeature = new GeoJSONFeature(feature, this.z, this.x, this.y);\n (geojsonFeature: any).layer = styleLayer.serialize();\n let layerResult = result[layerID];\n if (layerResult === undefined) {\n layerResult = result[layerID] = [];\n }\n layerResult.push({ featureIndex: featureIndex, feature: geojsonFeature });\n }\n }\n\n // Given a set of symbol indexes that have already been looked up,\n // return a matching set of GeoJSONFeatures\n lookupSymbolFeatures(symbolFeatureIndexes: Array,\n bucketIndex: number,\n sourceLayerIndex: number,\n filterSpec: FilterSpecification,\n filterLayerIDs: Array,\n styleLayers: {[string]: StyleLayer}) {\n const result = {};\n this.loadVTLayers();\n\n const filter = featureFilter(filterSpec);\n\n for (const symbolFeatureIndex of symbolFeatureIndexes) {\n this.loadMatchingFeature(\n result,\n bucketIndex,\n sourceLayerIndex,\n symbolFeatureIndex,\n filter,\n filterLayerIDs,\n styleLayers\n );\n\n }\n return result;\n }\n\n hasLayer(id: string) {\n for (const layerIDs of this.bucketLayerIDs) {\n for (const layerID of layerIDs) {\n if (id === layerID) return true;\n }\n }\n\n return false;\n }\n}\n\nregister(\n 'FeatureIndex',\n FeatureIndex,\n { omit: ['rawTileData', 'sourceLayerCoder'] }\n);\n\nexport default FeatureIndex;\n\nfunction topDownFeatureComparator(a, b) {\n return b - a;\n}\n","\nexport default ['type', 'source', 'source-layer', 'minzoom', 'maxzoom', 'filter', 'layout'];\n","// @flow\n\nimport {\n charHasUprightVerticalOrientation,\n charAllowsIdeographicBreaking\n} from '../util/script_detection';\nimport verticalizePunctuation from '../util/verticalize_punctuation';\nimport { plugin as rtlTextPlugin } from '../source/rtl_text_plugin';\n\nimport type {StyleGlyph} from '../style/style_glyph';\nimport type {ImagePosition} from '../render/image_atlas';\n\nconst WritingMode = {\n horizontal: 1,\n vertical: 2,\n horizontalOnly: 3\n};\n\nexport { shapeText, shapeIcon, WritingMode };\n\n// The position of a glyph relative to the text's anchor point.\nexport type PositionedGlyph = {\n glyph: number,\n x: number,\n y: number,\n vertical: boolean\n};\n\n// A collection of positioned glyphs and some metadata\nexport type Shaping = {\n positionedGlyphs: Array,\n top: number,\n bottom: number,\n left: number,\n right: number,\n writingMode: 1 | 2\n};\n\ntype SymbolAnchor = 'center' | 'left' | 'right' | 'top' | 'bottom' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';\ntype TextJustify = 'left' | 'center' | 'right';\n\nfunction breakLines(text: string, lineBreakPoints: Array) {\n const lines = [];\n let start = 0;\n for (const lineBreak of lineBreakPoints) {\n lines.push(text.substring(start, lineBreak));\n start = lineBreak;\n }\n\n if (start < text.length) {\n lines.push(text.substring(start, text.length));\n }\n return lines;\n}\n\nfunction shapeText(text: string,\n glyphs: {[number]: ?StyleGlyph},\n maxWidth: number,\n lineHeight: number,\n textAnchor: SymbolAnchor,\n textJustify: TextJustify,\n spacing: number,\n translate: [number, number],\n verticalHeight: number,\n writingMode: 1 | 2): Shaping | false {\n let logicalInput = text.trim();\n if (writingMode === WritingMode.vertical) {\n logicalInput = verticalizePunctuation(logicalInput);\n }\n\n const positionedGlyphs = [];\n const shaping = {\n positionedGlyphs,\n text: logicalInput,\n top: translate[1],\n bottom: translate[1],\n left: translate[0],\n right: translate[0],\n writingMode\n };\n\n let lines: Array;\n\n const {processBidirectionalText} = rtlTextPlugin;\n if (processBidirectionalText) {\n lines = processBidirectionalText(logicalInput, determineLineBreaks(logicalInput, spacing, maxWidth, glyphs));\n } else {\n lines = breakLines(logicalInput, determineLineBreaks(logicalInput, spacing, maxWidth, glyphs));\n }\n\n shapeLines(shaping, glyphs, lines, lineHeight, textAnchor, textJustify, writingMode, spacing, verticalHeight);\n\n if (!positionedGlyphs.length)\n return false;\n\n return shaping;\n}\n\nconst whitespace: {[number]: boolean} = {\n [0x09]: true, // tab\n [0x0a]: true, // newline\n [0x0b]: true, // vertical tab\n [0x0c]: true, // form feed\n [0x0d]: true, // carriage return\n [0x20]: true, // space\n};\n\nconst breakable: {[number]: boolean} = {\n [0x0a]: true, // newline\n [0x20]: true, // space\n [0x26]: true, // ampersand\n [0x28]: true, // left parenthesis\n [0x29]: true, // right parenthesis\n [0x2b]: true, // plus sign\n [0x2d]: true, // hyphen-minus\n [0x2f]: true, // solidus\n [0xad]: true, // soft hyphen\n [0xb7]: true, // middle dot\n [0x200b]: true, // zero-width space\n [0x2010]: true, // hyphen\n [0x2013]: true, // en dash\n [0x2027]: true // interpunct\n // Many other characters may be reasonable breakpoints\n // Consider \"neutral orientation\" characters at scriptDetection.charHasNeutralVerticalOrientation\n // See https://github.com/mapbox/mapbox-gl-js/issues/3658\n};\n\nfunction determineAverageLineWidth(logicalInput: string,\n spacing: number,\n maxWidth: number,\n glyphs: {[number]: ?StyleGlyph}) {\n let totalWidth = 0;\n\n for (let index = 0; index < logicalInput.length; index++) {\n const glyph = glyphs[logicalInput.charCodeAt(index)];\n if (!glyph)\n continue;\n totalWidth += glyph.metrics.advance + spacing;\n }\n\n const lineCount = Math.max(1, Math.ceil(totalWidth / maxWidth));\n return totalWidth / lineCount;\n}\n\nfunction calculateBadness(lineWidth: number,\n targetWidth: number,\n penalty: number,\n isLastBreak: boolean) {\n const raggedness = Math.pow(lineWidth - targetWidth, 2);\n if (isLastBreak) {\n // Favor finals lines shorter than average over longer than average\n if (lineWidth < targetWidth) {\n return raggedness / 2;\n } else {\n return raggedness * 2;\n }\n }\n\n return raggedness + Math.abs(penalty) * penalty;\n}\n\nfunction calculatePenalty(codePoint: number, nextCodePoint: number) {\n let penalty = 0;\n // Force break on newline\n if (codePoint === 0x0a) {\n penalty -= 10000;\n }\n // Penalize open parenthesis at end of line\n if (codePoint === 0x28 || codePoint === 0xff08) {\n penalty += 50;\n }\n\n // Penalize close parenthesis at beginning of line\n if (nextCodePoint === 0x29 || nextCodePoint === 0xff09) {\n penalty += 50;\n }\n return penalty;\n}\n\ntype Break = {\n index: number,\n x: number,\n priorBreak: ?Break,\n badness: number\n};\n\nfunction evaluateBreak(breakIndex: number,\n breakX: number,\n targetWidth: number,\n potentialBreaks: Array,\n penalty: number,\n isLastBreak: boolean): Break {\n // We could skip evaluating breaks where the line length (breakX - priorBreak.x) > maxWidth\n // ...but in fact we allow lines longer than maxWidth (if there's no break points)\n // ...and when targetWidth and maxWidth are close, strictly enforcing maxWidth can give\n // more lopsided results.\n\n let bestPriorBreak: ?Break = null;\n let bestBreakBadness = calculateBadness(breakX, targetWidth, penalty, isLastBreak);\n\n for (const potentialBreak of potentialBreaks) {\n const lineWidth = breakX - potentialBreak.x;\n const breakBadness =\n calculateBadness(lineWidth, targetWidth, penalty, isLastBreak) + potentialBreak.badness;\n if (breakBadness <= bestBreakBadness) {\n bestPriorBreak = potentialBreak;\n bestBreakBadness = breakBadness;\n }\n }\n\n return {\n index: breakIndex,\n x: breakX,\n priorBreak: bestPriorBreak,\n badness: bestBreakBadness\n };\n}\n\nfunction leastBadBreaks(lastLineBreak: ?Break): Array {\n if (!lastLineBreak) {\n return [];\n }\n return leastBadBreaks(lastLineBreak.priorBreak).concat(lastLineBreak.index);\n}\n\nfunction determineLineBreaks(logicalInput: string,\n spacing: number,\n maxWidth: number,\n glyphs: {[number]: ?StyleGlyph}): Array {\n if (!maxWidth)\n return [];\n\n if (!logicalInput)\n return [];\n\n const potentialLineBreaks = [];\n const targetWidth = determineAverageLineWidth(logicalInput, spacing, maxWidth, glyphs);\n\n let currentX = 0;\n\n for (let i = 0; i < logicalInput.length; i++) {\n const codePoint = logicalInput.charCodeAt(i);\n const glyph = glyphs[codePoint];\n\n if (glyph && !whitespace[codePoint])\n currentX += glyph.metrics.advance + spacing;\n\n // Ideographic characters, spaces, and word-breaking punctuation that often appear without\n // surrounding spaces.\n if ((i < logicalInput.length - 1) &&\n (breakable[codePoint] ||\n charAllowsIdeographicBreaking(codePoint))) {\n\n potentialLineBreaks.push(\n evaluateBreak(\n i + 1,\n currentX,\n targetWidth,\n potentialLineBreaks,\n calculatePenalty(codePoint, logicalInput.charCodeAt(i + 1)),\n false));\n }\n }\n\n return leastBadBreaks(\n evaluateBreak(\n logicalInput.length,\n currentX,\n targetWidth,\n potentialLineBreaks,\n 0,\n true));\n}\n\nfunction getAnchorAlignment(anchor: SymbolAnchor) {\n let horizontalAlign = 0.5, verticalAlign = 0.5;\n\n switch (anchor) {\n case 'right':\n case 'top-right':\n case 'bottom-right':\n horizontalAlign = 1;\n break;\n case 'left':\n case 'top-left':\n case 'bottom-left':\n horizontalAlign = 0;\n break;\n }\n\n switch (anchor) {\n case 'bottom':\n case 'bottom-right':\n case 'bottom-left':\n verticalAlign = 1;\n break;\n case 'top':\n case 'top-right':\n case 'top-left':\n verticalAlign = 0;\n break;\n }\n\n return { horizontalAlign, verticalAlign };\n}\n\nfunction shapeLines(shaping: Shaping,\n glyphs: {[number]: ?StyleGlyph},\n lines: Array,\n lineHeight: number,\n textAnchor: SymbolAnchor,\n textJustify: TextJustify,\n writingMode: 1 | 2,\n spacing: number,\n verticalHeight: number) {\n // the y offset *should* be part of the font metadata\n const yOffset = -17;\n\n let x = 0;\n let y = yOffset;\n\n let maxLineLength = 0;\n const positionedGlyphs = shaping.positionedGlyphs;\n\n const justify =\n textJustify === 'right' ? 1 :\n textJustify === 'left' ? 0 : 0.5;\n\n for (let line of lines) {\n line = line.trim();\n\n if (!line.length) {\n y += lineHeight; // Still need a line feed after empty line\n continue;\n }\n\n const lineStartIndex = positionedGlyphs.length;\n for (let i = 0; i < line.length; i++) {\n const codePoint = line.charCodeAt(i);\n const glyph = glyphs[codePoint];\n\n if (!glyph) continue;\n\n if (!charHasUprightVerticalOrientation(codePoint) || writingMode === WritingMode.horizontal) {\n positionedGlyphs.push({glyph: codePoint, x, y, vertical: false});\n x += glyph.metrics.advance + spacing;\n } else {\n positionedGlyphs.push({glyph: codePoint, x, y: 0, vertical: true});\n x += verticalHeight + spacing;\n }\n }\n\n // Only justify if we placed at least one glyph\n if (positionedGlyphs.length !== lineStartIndex) {\n const lineLength = x - spacing;\n maxLineLength = Math.max(lineLength, maxLineLength);\n\n justifyLine(positionedGlyphs, glyphs, lineStartIndex, positionedGlyphs.length - 1, justify);\n }\n\n x = 0;\n y += lineHeight;\n }\n\n const {horizontalAlign, verticalAlign} = getAnchorAlignment(textAnchor);\n align(positionedGlyphs, justify, horizontalAlign, verticalAlign, maxLineLength, lineHeight, lines.length);\n\n // Calculate the bounding box\n const height = lines.length * lineHeight;\n\n shaping.top += -verticalAlign * height;\n shaping.bottom = shaping.top + height;\n shaping.left += -horizontalAlign * maxLineLength;\n shaping.right = shaping.left + maxLineLength;\n}\n\n// justify right = 1, left = 0, center = 0.5\nfunction justifyLine(positionedGlyphs: Array,\n glyphs: {[number]: ?StyleGlyph},\n start: number,\n end: number,\n justify: 1 | 0 | 0.5) {\n if (!justify)\n return;\n\n const glyph = glyphs[positionedGlyphs[end].glyph];\n if (glyph) {\n const lastAdvance = glyph.metrics.advance;\n const lineIndent = (positionedGlyphs[end].x + lastAdvance) * justify;\n\n for (let j = start; j <= end; j++) {\n positionedGlyphs[j].x -= lineIndent;\n }\n }\n}\n\nfunction align(positionedGlyphs: Array,\n justify: number,\n horizontalAlign: number,\n verticalAlign: number,\n maxLineLength: number,\n lineHeight: number,\n lineCount: number) {\n const shiftX = (justify - horizontalAlign) * maxLineLength;\n const shiftY = (-verticalAlign * lineCount + 0.5) * lineHeight;\n\n for (let j = 0; j < positionedGlyphs.length; j++) {\n positionedGlyphs[j].x += shiftX;\n positionedGlyphs[j].y += shiftY;\n }\n}\n\nexport type PositionedIcon = {\n image: ImagePosition,\n top: number,\n bottom: number,\n left: number,\n right: number\n};\n\nfunction shapeIcon(image: ImagePosition, iconOffset: [number, number], iconAnchor: SymbolAnchor): PositionedIcon {\n const {horizontalAlign, verticalAlign} = getAnchorAlignment(iconAnchor);\n const dx = iconOffset[0];\n const dy = iconOffset[1];\n const x1 = dx - image.displaySize[0] * horizontalAlign;\n const x2 = x1 + image.displaySize[0];\n const y1 = dy - image.displaySize[1] * verticalAlign;\n const y2 = y1 + image.displaySize[1];\n return {image, top: y1, bottom: y2, left: x1, right: x2};\n}\n","// @flow\n\n/**\n * Deeply compares two object literals.\n *\n * @private\n */\nfunction deepEqual(a: ?mixed, b: ?mixed): boolean {\n if (Array.isArray(a)) {\n if (!Array.isArray(b) || a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (!deepEqual(a[i], b[i])) return false;\n }\n return true;\n }\n if (typeof a === 'object' && a !== null && b !== null) {\n if (!(typeof b === 'object')) return false;\n const keys = Object.keys(a);\n if (keys.length !== Object.keys(b).length) return false;\n for (const key in a) {\n if (!deepEqual(a[key], b[key])) return false;\n }\n return true;\n }\n return a === b;\n}\n\nexport default deepEqual;\n","\nimport refProperties from './util/ref_properties';\n\nfunction stringify(obj) {\n const type = typeof obj;\n if (type === 'number' || type === 'boolean' || type === 'string' || obj === undefined || obj === null)\n return JSON.stringify(obj);\n\n if (Array.isArray(obj)) {\n let str = '[';\n for (const val of obj) {\n str += `${stringify(val)},`;\n }\n return `${str}]`;\n }\n\n const keys = Object.keys(obj).sort();\n\n let str = '{';\n for (let i = 0; i < keys.length; i++) {\n str += `${JSON.stringify(keys[i])}:${stringify(obj[keys[i]])},`;\n }\n return `${str}}`;\n}\n\nfunction getKey(layer) {\n let key = '';\n for (const k of refProperties) {\n key += `/${stringify(layer[k])}`;\n }\n return key;\n}\n\nexport default groupByLayout;\n\n/**\n * Given an array of layers, return an array of arrays of layers where all\n * layers in each group have identical layout-affecting properties. These\n * are the properties that were formerly used by explicit `ref` mechanism\n * for layers: 'type', 'source', 'source-layer', 'minzoom', 'maxzoom',\n * 'filter', and 'layout'.\n *\n * The input is not modified. The output layers are references to the\n * input layers.\n *\n * @private\n * @param {Array} layers\n * @returns {Array>}\n */\nfunction groupByLayout(layers) {\n const groups = {};\n\n for (let i = 0; i < layers.length; i++) {\n const k = getKey(layers[i]);\n let group = groups[k];\n if (!group) {\n group = groups[k] = [];\n }\n group.push(layers[i]);\n }\n\n const result = [];\n\n for (const k in groups) {\n result.push(groups[k]);\n }\n\n return result;\n}\n","// @flow\n\nimport StyleLayer from './style_layer';\nimport createStyleLayer from './create_style_layer';\n\nimport { values } from '../util/util';\nimport featureFilter from '../style-spec/feature_filter';\nimport groupByLayout from '../style-spec/group_by_layout';\n\nimport type {TypedStyleLayer} from './style_layer/typed_style_layer';\n\nexport type LayerConfigs = { [string]: LayerSpecification };\nexport type Family = Array;\n\nclass StyleLayerIndex {\n familiesBySource: { [source: string]: { [sourceLayer: string]: Array> } };\n\n _layerConfigs: LayerConfigs;\n _layers: { [string]: StyleLayer };\n\n constructor(layerConfigs: ?Array) {\n if (layerConfigs) {\n this.replace(layerConfigs);\n }\n }\n\n replace(layerConfigs: Array) {\n this._layerConfigs = {};\n this._layers = {};\n this.update(layerConfigs, []);\n }\n\n update(layerConfigs: Array, removedIds: Array) {\n for (const layerConfig of layerConfigs) {\n this._layerConfigs[layerConfig.id] = layerConfig;\n\n const layer = this._layers[layerConfig.id] = createStyleLayer(layerConfig);\n layer._featureFilter = featureFilter(layer.filter);\n }\n for (const id of removedIds) {\n delete this._layerConfigs[id];\n delete this._layers[id];\n }\n\n this.familiesBySource = {};\n\n const groups = groupByLayout(values(this._layerConfigs));\n\n for (const layerConfigs of groups) {\n const layers = layerConfigs.map((layerConfig) => this._layers[layerConfig.id]);\n\n const layer = layers[0];\n if (layer.visibility === 'none') {\n continue;\n }\n\n const sourceId = layer.source || '';\n let sourceGroup = this.familiesBySource[sourceId];\n if (!sourceGroup) {\n sourceGroup = this.familiesBySource[sourceId] = {};\n }\n\n const sourceLayerId = layer.sourceLayer || '_geojsonTileLayer';\n let sourceLayerFamilies = sourceGroup[sourceLayerId];\n if (!sourceLayerFamilies) {\n sourceLayerFamilies = sourceGroup[sourceLayerId] = [];\n }\n\n sourceLayerFamilies.push(layers);\n }\n }\n}\n\nexport default StyleLayerIndex;\n","// @flow\n\nexport default checkMaxAngle;\n\nimport type Point from '@mapbox/point-geometry';\nimport type Anchor from './anchor';\n\n/**\n * Labels placed around really sharp angles aren't readable. Check if any\n * part of the potential label has a combined angle that is too big.\n *\n * @param line\n * @param anchor The point on the line around which the label is anchored.\n * @param labelLength The length of the label in geometry units.\n * @param windowSize The check fails if the combined angles within a part of the line that is `windowSize` long is too big.\n * @param maxAngle The maximum combined angle that any window along the label is allowed to have.\n *\n * @returns {boolean} whether the label should be placed\n * @private\n */\nfunction checkMaxAngle(line: Array, anchor: Anchor, labelLength: number, windowSize: number, maxAngle: number) {\n\n // horizontal labels always pass\n if (anchor.segment === undefined) return true;\n\n let p = anchor;\n let index = anchor.segment + 1;\n let anchorDistance = 0;\n\n // move backwards along the line to the first segment the label appears on\n while (anchorDistance > -labelLength / 2) {\n index--;\n\n // there isn't enough room for the label after the beginning of the line\n if (index < 0) return false;\n\n anchorDistance -= line[index].dist(p);\n p = line[index];\n }\n\n anchorDistance += line[index].dist(line[index + 1]);\n index++;\n\n // store recent corners and their total angle difference\n const recentCorners = [];\n let recentAngleDelta = 0;\n\n // move forwards by the length of the label and check angles along the way\n while (anchorDistance < labelLength / 2) {\n const prev = line[index - 1];\n const current = line[index];\n const next = line[index + 1];\n\n // there isn't enough room for the label before the end of the line\n if (!next) return false;\n\n let angleDelta = prev.angleTo(current) - current.angleTo(next);\n // restrict angle to -pi..pi range\n angleDelta = Math.abs(((angleDelta + 3 * Math.PI) % (Math.PI * 2)) - Math.PI);\n\n recentCorners.push({\n distance: anchorDistance,\n angleDelta: angleDelta\n });\n recentAngleDelta += angleDelta;\n\n // remove corners that are far enough away from the list of recent anchors\n while (anchorDistance - recentCorners[0].distance > windowSize) {\n recentAngleDelta -= recentCorners.shift().angleDelta;\n }\n\n // the sum of angles within the window area exceeds the maximum allowed value. check fails.\n if (recentAngleDelta > maxAngle) return false;\n\n index++;\n anchorDistance += current.dist(next);\n }\n\n // no part of the line had an angle greater than the maximum allowed. check passes.\n return true;\n}\n","// @flow\n\nimport { number as interpolate } from '../style-spec/util/interpolate';\n\nimport Anchor from '../symbol/anchor';\nimport checkMaxAngle from './check_max_angle';\n\nimport type Point from '@mapbox/point-geometry';\nimport type {Shaping, PositionedIcon} from './shaping';\n\nexport default getAnchors;\n\nfunction getAnchors(line: Array,\n spacing: number,\n maxAngle: number,\n shapedText: ?Shaping,\n shapedIcon: ?PositionedIcon,\n glyphSize: number,\n boxScale: number,\n overscaling: number,\n tileExtent: number) {\n\n // Resample a line to get anchor points for labels and check that each\n // potential label passes text-max-angle check and has enough froom to fit\n // on the line.\n\n const angleWindowSize = shapedText ?\n 3 / 5 * glyphSize * boxScale :\n 0;\n\n const labelLength = Math.max(\n shapedText ? shapedText.right - shapedText.left : 0,\n shapedIcon ? shapedIcon.right - shapedIcon.left : 0);\n\n // Is the line continued from outside the tile boundary?\n const isLineContinued = line[0].x === 0 || line[0].x === tileExtent || line[0].y === 0 || line[0].y === tileExtent;\n\n // Is the label long, relative to the spacing?\n // If so, adjust the spacing so there is always a minimum space of `spacing / 4` between label edges.\n if (spacing - labelLength * boxScale < spacing / 4) {\n spacing = labelLength * boxScale + spacing / 4;\n }\n\n // Offset the first anchor by:\n // Either half the label length plus a fixed extra offset if the line is not continued\n // Or half the spacing if the line is continued.\n\n // For non-continued lines, add a bit of fixed extra offset to avoid collisions at T intersections.\n const fixedExtraOffset = glyphSize * 2;\n\n const offset = !isLineContinued ?\n ((labelLength / 2 + fixedExtraOffset) * boxScale * overscaling) % spacing :\n (spacing / 2 * overscaling) % spacing;\n\n return resample(line, offset, spacing, angleWindowSize, maxAngle, labelLength * boxScale, isLineContinued, false, tileExtent);\n}\n\n\nfunction resample(line, offset, spacing, angleWindowSize, maxAngle, labelLength, isLineContinued, placeAtMiddle, tileExtent) {\n\n const halfLabelLength = labelLength / 2;\n let lineLength = 0;\n for (let k = 0; k < line.length - 1; k++) {\n lineLength += line[k].dist(line[k + 1]);\n }\n\n let distance = 0,\n markedDistance = offset - spacing;\n\n let anchors = [];\n\n for (let i = 0; i < line.length - 1; i++) {\n\n const a = line[i],\n b = line[i + 1];\n\n const segmentDist = a.dist(b),\n angle = b.angleTo(a);\n\n while (markedDistance + spacing < distance + segmentDist) {\n markedDistance += spacing;\n\n const t = (markedDistance - distance) / segmentDist,\n x = interpolate(a.x, b.x, t),\n y = interpolate(a.y, b.y, t);\n\n // Check that the point is within the tile boundaries and that\n // the label would fit before the beginning and end of the line\n // if placed at this point.\n if (x >= 0 && x < tileExtent && y >= 0 && y < tileExtent &&\n markedDistance - halfLabelLength >= 0 &&\n markedDistance + halfLabelLength <= lineLength) {\n const anchor = new Anchor(x, y, angle, i);\n anchor._round();\n\n if (!angleWindowSize || checkMaxAngle(line, anchor, labelLength, angleWindowSize, maxAngle)) {\n anchors.push(anchor);\n }\n }\n }\n\n distance += segmentDist;\n }\n\n if (!placeAtMiddle && !anchors.length && !isLineContinued) {\n // The first attempt at finding anchors at which labels can be placed failed.\n // Try again, but this time just try placing one anchor at the middle of the line.\n // This has the most effect for short lines in overscaled tiles, since the\n // initial offset used in overscaled tiles is calculated to align labels with positions in\n // parent tiles instead of placing the label as close to the beginning as possible.\n anchors = resample(line, distance / 2, spacing, angleWindowSize, maxAngle, labelLength, isLineContinued, true, tileExtent);\n }\n\n return anchors;\n}\n","// @flow\n\nimport { register } from '../util/web_worker_transfer';\n\nclass OpacityState {\n opacity: number;\n targetOpacity: number;\n time: number\n\n constructor() {\n this.opacity = 0;\n this.targetOpacity = 0;\n this.time = 0;\n }\n\n clone() {\n const clone = new OpacityState();\n clone.opacity = this.opacity;\n clone.targetOpacity = this.targetOpacity;\n clone.time = this.time;\n return clone;\n }\n}\n\nregister('OpacityState', OpacityState);\n\nexport default OpacityState;\n","// @flow\n\nimport type {CollisionBoxArray} from '../data/array_types';\nimport type Point from '@mapbox/point-geometry';\nimport type Anchor from './anchor';\n\n/**\n * A CollisionFeature represents the area of the tile covered by a single label.\n * It is used with CollisionIndex to check if the label overlaps with any\n * previous labels. A CollisionFeature is mostly just a set of CollisionBox\n * objects.\n *\n * @private\n */\nclass CollisionFeature {\n boxStartIndex: number;\n boxEndIndex: number;\n\n /**\n * Create a CollisionFeature, adding its collision box data to the given collisionBoxArray in the process.\n *\n * @param line The geometry the label is placed on.\n * @param anchor The point along the line around which the label is anchored.\n * @param shaped The text or icon shaping results.\n * @param boxScale A magic number used to convert from glyph metrics units to geometry units.\n * @param padding The amount of padding to add around the label edges.\n * @param alignLine Whether the label is aligned with the line or the viewport.\n */\n constructor(collisionBoxArray: CollisionBoxArray,\n line: Array,\n anchor: Anchor,\n featureIndex: number,\n sourceLayerIndex: number,\n bucketIndex: number,\n shaped: Object,\n boxScale: number,\n padding: number,\n alignLine: boolean,\n overscaling: number) {\n const y1 = shaped.top * boxScale - padding;\n const y2 = shaped.bottom * boxScale + padding;\n const x1 = shaped.left * boxScale - padding;\n const x2 = shaped.right * boxScale + padding;\n\n this.boxStartIndex = collisionBoxArray.length;\n\n if (alignLine) {\n\n let height = y2 - y1;\n const length = x2 - x1;\n\n if (height > 0) {\n // set minimum box height to avoid very many small labels\n height = Math.max(10 * boxScale, height);\n\n this._addLineCollisionCircles(collisionBoxArray, line, anchor, (anchor.segment: any), length, height, featureIndex, sourceLayerIndex, bucketIndex, overscaling);\n }\n\n } else {\n collisionBoxArray.emplaceBack(anchor.x, anchor.y, x1, y1, x2, y2, featureIndex, sourceLayerIndex, bucketIndex,\n 0, 0);\n }\n\n this.boxEndIndex = collisionBoxArray.length;\n }\n\n /**\n * Create a set of CollisionBox objects for a line.\n *\n * @param labelLength The length of the label in geometry units.\n * @param anchor The point along the line around which the label is anchored.\n * @param boxSize The size of the collision boxes that will be created.\n * @private\n */\n _addLineCollisionCircles(collisionBoxArray: CollisionBoxArray,\n line: Array,\n anchor: Anchor,\n segment: number,\n labelLength: number,\n boxSize: number,\n featureIndex: number,\n sourceLayerIndex: number,\n bucketIndex: number,\n overscaling: number) {\n const step = boxSize / 2;\n const nBoxes = Math.floor(labelLength / step);\n // We calculate line collision circles out to 300% of what would normally be our\n // max size, to allow collision detection to work on labels that expand as\n // they move into the distance\n // Vertically oriented labels in the distant field can extend past this padding\n // This is a noticeable problem in overscaled tiles where the pitch 0-based\n // symbol spacing will put labels very close together in a pitched map.\n // To reduce the cost of adding extra collision circles, we slowly increase\n // them for overscaled tiles.\n const overscalingPaddingFactor = 1 + .4 * Math.log(overscaling) / Math.LN2;\n const nPitchPaddingBoxes = Math.floor(nBoxes * overscalingPaddingFactor / 2);\n\n // offset the center of the first box by half a box so that the edge of the\n // box is at the edge of the label.\n const firstBoxOffset = -boxSize / 2;\n\n let p = anchor;\n let index = segment + 1;\n let anchorDistance = firstBoxOffset;\n const labelStartDistance = -labelLength / 2;\n const paddingStartDistance = labelStartDistance - labelLength / 4;\n // move backwards along the line to the first segment the label appears on\n do {\n index--;\n\n if (index < 0) {\n if (anchorDistance > labelStartDistance) {\n // there isn't enough room for the label after the beginning of the line\n // checkMaxAngle should have already caught this\n return;\n } else {\n // The line doesn't extend far enough back for all of our padding,\n // but we got far enough to show the label under most conditions.\n index = 0;\n break;\n }\n } else {\n anchorDistance -= line[index].dist(p);\n p = line[index];\n }\n } while (anchorDistance > paddingStartDistance);\n\n let segmentLength = line[index].dist(line[index + 1]);\n\n for (let i = -nPitchPaddingBoxes; i < nBoxes + nPitchPaddingBoxes; i++) {\n\n // the distance the box will be from the anchor\n const boxOffset = i * step;\n let boxDistanceToAnchor = labelStartDistance + boxOffset;\n\n // make the distance between pitch padding boxes bigger\n if (boxOffset < 0) boxDistanceToAnchor += boxOffset;\n if (boxOffset > labelLength) boxDistanceToAnchor += boxOffset - labelLength;\n\n if (boxDistanceToAnchor < anchorDistance) {\n // The line doesn't extend far enough back for this box, skip it\n // (This could allow for line collisions on distant tiles)\n continue;\n }\n\n // the box is not on the current segment. Move to the next segment.\n while (anchorDistance + segmentLength < boxDistanceToAnchor) {\n anchorDistance += segmentLength;\n index++;\n\n // There isn't enough room before the end of the line.\n if (index + 1 >= line.length) {\n return;\n }\n\n segmentLength = line[index].dist(line[index + 1]);\n }\n\n // the distance the box will be from the beginning of the segment\n const segmentBoxDistance = boxDistanceToAnchor - anchorDistance;\n\n const p0 = line[index];\n const p1 = line[index + 1];\n const boxAnchorPoint = p1.sub(p0)._unit()._mult(segmentBoxDistance)._add(p0)._round();\n\n // If the box is within boxSize of the anchor, force the box to be used\n // (so even 0-width labels use at least one box)\n // Otherwise, the .8 multiplication gives us a little bit of conservative\n // padding in choosing which boxes to use (see CollisionIndex#placedCollisionCircles)\n const paddedAnchorDistance = Math.abs(boxDistanceToAnchor - firstBoxOffset) < step ?\n 0 :\n (boxDistanceToAnchor - firstBoxOffset) * 0.8;\n\n collisionBoxArray.emplaceBack(boxAnchorPoint.x, boxAnchorPoint.y,\n -boxSize / 2, -boxSize / 2, boxSize / 2, boxSize / 2,\n featureIndex, sourceLayerIndex, bucketIndex,\n boxSize / 2, paddedAnchorDistance);\n }\n }\n}\n\nexport default CollisionFeature;\n","'use strict';\n\nmodule.exports = TinyQueue;\nmodule.exports.default = TinyQueue;\n\nfunction TinyQueue(data, compare) {\n if (!(this instanceof TinyQueue)) return new TinyQueue(data, compare);\n\n this.data = data || [];\n this.length = this.data.length;\n this.compare = compare || defaultCompare;\n\n if (this.length > 0) {\n for (var i = (this.length >> 1) - 1; i >= 0; i--) this._down(i);\n }\n}\n\nfunction defaultCompare(a, b) {\n return a < b ? -1 : a > b ? 1 : 0;\n}\n\nTinyQueue.prototype = {\n\n push: function (item) {\n this.data.push(item);\n this.length++;\n this._up(this.length - 1);\n },\n\n pop: function () {\n if (this.length === 0) return undefined;\n\n var top = this.data[0];\n this.length--;\n\n if (this.length > 0) {\n this.data[0] = this.data[this.length];\n this._down(0);\n }\n this.data.pop();\n\n return top;\n },\n\n peek: function () {\n return this.data[0];\n },\n\n _up: function (pos) {\n var data = this.data;\n var compare = this.compare;\n var item = data[pos];\n\n while (pos > 0) {\n var parent = (pos - 1) >> 1;\n var current = data[parent];\n if (compare(item, current) >= 0) break;\n data[pos] = current;\n pos = parent;\n }\n\n data[pos] = item;\n },\n\n _down: function (pos) {\n var data = this.data;\n var compare = this.compare;\n var halfLength = this.length >> 1;\n var item = data[pos];\n\n while (pos < halfLength) {\n var left = (pos << 1) + 1;\n var right = left + 1;\n var best = data[left];\n\n if (right < this.length && compare(data[right], best) < 0) {\n left = right;\n best = data[right];\n }\n if (compare(best, item) >= 0) break;\n\n data[pos] = best;\n pos = left;\n }\n\n data[pos] = item;\n }\n};\n","// @flow\n\nimport Queue from 'tinyqueue';\n\nimport Point from '@mapbox/point-geometry';\nimport { distToSegmentSquared } from './intersection_tests';\n\n/**\n * Finds an approximation of a polygon's Pole Of Inaccessibiliy https://en.wikipedia.org/wiki/Pole_of_inaccessibility\n * This is a copy of http://github.com/mapbox/polylabel adapted to use Points\n *\n * @param polygonRings first item in array is the outer ring followed optionally by the list of holes, should be an element of the result of util/classify_rings\n * @param precision Specified in input coordinate units. If 0 returns after first run, if > 0 repeatedly narrows the search space until the radius of the area searched for the best pole is less than precision\n * @param debug Print some statistics to the console during execution\n * @returns Pole of Inaccessibiliy.\n * @private\n */\nexport default function (polygonRings: Array>, precision?: number = 1, debug?: boolean = false): Point {\n // find the bounding box of the outer ring\n let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;\n const outerRing = polygonRings[0];\n for (let i = 0; i < outerRing.length; i++) {\n const p = outerRing[i];\n if (!i || p.x < minX) minX = p.x;\n if (!i || p.y < minY) minY = p.y;\n if (!i || p.x > maxX) maxX = p.x;\n if (!i || p.y > maxY) maxY = p.y;\n }\n\n const width = maxX - minX;\n const height = maxY - minY;\n const cellSize = Math.min(width, height);\n let h = cellSize / 2;\n\n // a priority queue of cells in order of their \"potential\" (max distance to polygon)\n const cellQueue = new Queue(null, compareMax);\n\n if (cellSize === 0) return new Point(minX, minY);\n\n // cover polygon with initial cells\n for (let x = minX; x < maxX; x += cellSize) {\n for (let y = minY; y < maxY; y += cellSize) {\n cellQueue.push(new Cell(x + h, y + h, h, polygonRings));\n }\n }\n\n // take centroid as the first best guess\n let bestCell = getCentroidCell(polygonRings);\n let numProbes = cellQueue.length;\n\n while (cellQueue.length) {\n // pick the most promising cell from the queue\n const cell = cellQueue.pop();\n\n // update the best cell if we found a better one\n if (cell.d > bestCell.d || !bestCell.d) {\n bestCell = cell;\n if (debug) console.log('found best %d after %d probes', Math.round(1e4 * cell.d) / 1e4, numProbes);\n }\n\n // do not drill down further if there's no chance of a better solution\n if (cell.max - bestCell.d <= precision) continue;\n\n // split the cell into four cells\n h = cell.h / 2;\n cellQueue.push(new Cell(cell.p.x - h, cell.p.y - h, h, polygonRings));\n cellQueue.push(new Cell(cell.p.x + h, cell.p.y - h, h, polygonRings));\n cellQueue.push(new Cell(cell.p.x - h, cell.p.y + h, h, polygonRings));\n cellQueue.push(new Cell(cell.p.x + h, cell.p.y + h, h, polygonRings));\n numProbes += 4;\n }\n\n if (debug) {\n console.log(`num probes: ${numProbes}`);\n console.log(`best distance: ${bestCell.d}`);\n }\n\n return bestCell.p;\n}\n\nfunction compareMax(a, b) {\n return b.max - a.max;\n}\n\nfunction Cell(x, y, h, polygon) {\n this.p = new Point(x, y);\n this.h = h; // half the cell size\n this.d = pointToPolygonDist(this.p, polygon); // distance from cell center to polygon\n this.max = this.d + this.h * Math.SQRT2; // max distance to polygon within a cell\n}\n\n// signed distance from point to polygon outline (negative if point is outside)\nfunction pointToPolygonDist(p, polygon) {\n let inside = false;\n let minDistSq = Infinity;\n\n for (let k = 0; k < polygon.length; k++) {\n const ring = polygon[k];\n\n for (let i = 0, len = ring.length, j = len - 1; i < len; j = i++) {\n const a = ring[i];\n const b = ring[j];\n\n if ((a.y > p.y !== b.y > p.y) &&\n (p.x < (b.x - a.x) * (p.y - a.y) / (b.y - a.y) + a.x)) inside = !inside;\n\n minDistSq = Math.min(minDistSq, distToSegmentSquared(p, a, b));\n }\n }\n\n return (inside ? 1 : -1) * Math.sqrt(minDistSq);\n}\n\n// get polygon centroid\nfunction getCentroidCell(polygon) {\n let area = 0;\n let x = 0;\n let y = 0;\n const points = polygon[0];\n for (let i = 0, len = points.length, j = len - 1; i < len; j = i++) {\n const a = points[i];\n const b = points[j];\n const f = a.x * b.y - b.x * a.y;\n x += (a.x + b.x) * f;\n y += (a.y + b.y) * f;\n area += f * 3;\n }\n return new Cell(x / area, y / area, 0, polygon);\n}\n","// @flow\n\nimport Anchor from './anchor';\n\nimport getAnchors from './get_anchors';\nimport clipLine from './clip_line';\nimport OpacityState from './opacity_state';\nimport { shapeText, shapeIcon, WritingMode } from './shaping';\nimport { getGlyphQuads, getIconQuads } from './quads';\nimport CollisionFeature from './collision_feature';\nimport { warnOnce } from '../util/util';\nimport {\n allowsVerticalWritingMode,\n allowsLetterSpacing\n} from '../util/script_detection';\nimport findPoleOfInaccessibility from '../util/find_pole_of_inaccessibility';\nimport classifyRings from '../util/classify_rings';\nimport EXTENT from '../data/extent';\nimport SymbolBucket from '../data/bucket/symbol_bucket';\nimport EvaluationParameters from '../style/evaluation_parameters';\n\nimport type {Shaping, PositionedIcon} from './shaping';\nimport type {CollisionBoxArray} from '../data/array_types';\nimport type {SymbolFeature} from '../data/bucket/symbol_bucket';\nimport type {StyleImage} from '../style/style_image';\nimport type {StyleGlyph} from '../style/style_glyph';\nimport type SymbolStyleLayer from '../style/style_layer/symbol_style_layer';\nimport type {ImagePosition} from '../render/image_atlas';\nimport type {GlyphPosition} from '../render/glyph_atlas';\nimport type {PossiblyEvaluatedPropertyValue} from '../style/properties';\n\nimport Point from '@mapbox/point-geometry';\n\n// The symbol layout process needs `text-size` evaluated at up to five different zoom levels, and\n// `icon-size` at up to three:\n//\n// 1. `text-size` at the zoom level of the bucket. Used to calculate a per-feature size for source `text-size`\n// expressions, and to calculate the box dimensions for icon-text-fit.\n// 2. `icon-size` at the zoom level of the bucket. Used to calculate a per-feature size for source `icon-size`\n// expressions.\n// 3. `text-size` and `icon-size` at the zoom level of the bucket, plus one. Used to calculate collision boxes.\n// 4. `text-size` at zoom level 18. Used for something line-symbol-placement-related.\n// 5. For composite `*-size` expressions: two zoom levels of curve stops that \"cover\" the zoom level of the\n// bucket. These go into a vertex buffer and are used by the shader to interpolate the size at render time.\n//\n// (1) and (2) are stored in `bucket.layers[0].layout`. The remainder are below.\n//\ntype Sizes = {\n layoutTextSize: PossiblyEvaluatedPropertyValue, // (3)\n layoutIconSize: PossiblyEvaluatedPropertyValue, // (3)\n textMaxSize: PossiblyEvaluatedPropertyValue, // (4)\n compositeTextSizes: [PossiblyEvaluatedPropertyValue, PossiblyEvaluatedPropertyValue], // (5)\n compositeIconSizes: [PossiblyEvaluatedPropertyValue, PossiblyEvaluatedPropertyValue], // (5)\n};\n\nexport function performSymbolLayout(bucket: SymbolBucket,\n glyphMap: {[string]: {[number]: ?StyleGlyph}},\n glyphPositions: {[string]: {[number]: GlyphPosition}},\n imageMap: {[string]: StyleImage},\n imagePositions: {[string]: ImagePosition},\n showCollisionBoxes: boolean) {\n bucket.createArrays();\n bucket.symbolInstances = [];\n\n const tileSize = 512 * bucket.overscaling;\n bucket.tilePixelRatio = EXTENT / tileSize;\n bucket.compareText = {};\n bucket.iconsNeedLinear = false;\n\n const layout = bucket.layers[0].layout;\n const unevaluatedLayoutValues = bucket.layers[0]._unevaluatedLayout._values;\n\n const sizes = {};\n\n if (bucket.textSizeData.functionType === 'composite') {\n const {min, max} = bucket.textSizeData.zoomRange;\n sizes.compositeTextSizes = [\n unevaluatedLayoutValues['text-size'].possiblyEvaluate(new EvaluationParameters(min)),\n unevaluatedLayoutValues['text-size'].possiblyEvaluate(new EvaluationParameters(max))\n ];\n }\n\n if (bucket.iconSizeData.functionType === 'composite') {\n const {min, max} = bucket.iconSizeData.zoomRange;\n sizes.compositeIconSizes = [\n unevaluatedLayoutValues['icon-size'].possiblyEvaluate(new EvaluationParameters(min)),\n unevaluatedLayoutValues['icon-size'].possiblyEvaluate(new EvaluationParameters(max))\n ];\n }\n\n sizes.layoutTextSize = unevaluatedLayoutValues['text-size'].possiblyEvaluate(new EvaluationParameters(bucket.zoom + 1));\n sizes.layoutIconSize = unevaluatedLayoutValues['icon-size'].possiblyEvaluate(new EvaluationParameters(bucket.zoom + 1));\n sizes.textMaxSize = unevaluatedLayoutValues['text-size'].possiblyEvaluate(new EvaluationParameters(18));\n\n const oneEm = 24;\n const lineHeight = layout.get('text-line-height') * oneEm;\n const textAlongLine = layout.get('text-rotation-alignment') === 'map' && layout.get('symbol-placement') === 'line';\n const keepUpright = layout.get('text-keep-upright');\n\n\n for (const feature of bucket.features) {\n const fontstack = layout.get('text-font').evaluate(feature).join(',');\n const glyphs = glyphMap[fontstack] || {};\n const glyphPositionMap = glyphPositions[fontstack] || {};\n\n const shapedTextOrientations = {};\n const text = feature.text;\n if (text) {\n const textOffset: [number, number] = (layout.get('text-offset').evaluate(feature).map((t)=> t * oneEm): any);\n const spacing = layout.get('text-letter-spacing').evaluate(feature) * oneEm;\n const spacingIfAllowed = allowsLetterSpacing(text) ? spacing : 0;\n const textAnchor = layout.get('text-anchor').evaluate(feature);\n const textJustify = layout.get('text-justify').evaluate(feature);\n const maxWidth = layout.get('symbol-placement') !== 'line' ?\n layout.get('text-max-width').evaluate(feature) * oneEm :\n 0;\n\n shapedTextOrientations.horizontal = shapeText(text, glyphs, maxWidth, lineHeight, textAnchor, textJustify, spacingIfAllowed, textOffset, oneEm, WritingMode.horizontal);\n if (allowsVerticalWritingMode(text) && textAlongLine && keepUpright) {\n shapedTextOrientations.vertical = shapeText(text, glyphs, maxWidth, lineHeight, textAnchor, textJustify, spacingIfAllowed, textOffset, oneEm, WritingMode.vertical);\n }\n }\n\n let shapedIcon;\n if (feature.icon) {\n const image = imageMap[feature.icon];\n if (image) {\n shapedIcon = shapeIcon(\n imagePositions[feature.icon],\n layout.get('icon-offset').evaluate(feature),\n layout.get('icon-anchor').evaluate(feature));\n if (bucket.sdfIcons === undefined) {\n bucket.sdfIcons = image.sdf;\n } else if (bucket.sdfIcons !== image.sdf) {\n warnOnce('Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer');\n }\n if (image.pixelRatio !== bucket.pixelRatio) {\n bucket.iconsNeedLinear = true;\n } else if (layout.get('icon-rotate').constantOr(1) !== 0) {\n bucket.iconsNeedLinear = true;\n }\n }\n }\n\n if (shapedTextOrientations.horizontal || shapedIcon) {\n addFeature(bucket, feature, shapedTextOrientations, shapedIcon, glyphPositionMap, sizes);\n }\n }\n\n if (showCollisionBoxes) {\n bucket.generateCollisionDebugBuffers();\n }\n}\n\n\n/**\n * Given a feature and its shaped text and icon data, add a 'symbol\n * instance' for each _possible_ placement of the symbol feature.\n * (At render timePlaceSymbols#place() selects which of these instances to\n * show or hide based on collisions with symbols in other layers.)\n * @private\n */\nfunction addFeature(bucket: SymbolBucket,\n feature: SymbolFeature,\n shapedTextOrientations: any,\n shapedIcon: PositionedIcon | void,\n glyphPositionMap: {[number]: GlyphPosition},\n sizes: Sizes) {\n const layoutTextSize = sizes.layoutTextSize.evaluate(feature);\n const layoutIconSize = sizes.layoutIconSize.evaluate(feature);\n\n // To reduce the number of labels that jump around when zooming we need\n // to use a text-size value that is the same for all zoom levels.\n // bucket calculates text-size at a high zoom level so that all tiles can\n // use the same value when calculating anchor positions.\n let textMaxSize = sizes.textMaxSize.evaluate(feature);\n if (textMaxSize === undefined) {\n textMaxSize = layoutTextSize;\n }\n\n const layout = bucket.layers[0].layout;\n const textOffset = layout.get('text-offset').evaluate(feature);\n const iconOffset = layout.get('icon-offset').evaluate(feature);\n\n const glyphSize = 24,\n fontScale = layoutTextSize / glyphSize,\n textBoxScale = bucket.tilePixelRatio * fontScale,\n textMaxBoxScale = bucket.tilePixelRatio * textMaxSize / glyphSize,\n iconBoxScale = bucket.tilePixelRatio * layoutIconSize,\n symbolMinDistance = bucket.tilePixelRatio * layout.get('symbol-spacing'),\n textPadding = layout.get('text-padding') * bucket.tilePixelRatio,\n iconPadding = layout.get('icon-padding') * bucket.tilePixelRatio,\n textMaxAngle = layout.get('text-max-angle') / 180 * Math.PI,\n textAlongLine = layout.get('text-rotation-alignment') === 'map' && layout.get('symbol-placement') === 'line',\n iconAlongLine = layout.get('icon-rotation-alignment') === 'map' && layout.get('symbol-placement') === 'line',\n symbolPlacement = layout.get('symbol-placement'),\n textRepeatDistance = symbolMinDistance / 2;\n\n const addSymbolAtAnchor = (line, anchor) => {\n if (anchor.x < 0 || anchor.x >= EXTENT || anchor.y < 0 || anchor.y >= EXTENT) {\n // Symbol layers are drawn across tile boundaries, We filter out symbols\n // outside our tile boundaries (which may be included in vector tile buffers)\n // to prevent double-drawing symbols.\n return;\n }\n\n bucket.symbolInstances.push(addSymbol(bucket, anchor, line, shapedTextOrientations, shapedIcon, bucket.layers[0],\n bucket.collisionBoxArray, feature.index, feature.sourceLayerIndex, bucket.index,\n textBoxScale, textPadding, textAlongLine, textOffset,\n iconBoxScale, iconPadding, iconAlongLine, iconOffset,\n feature, glyphPositionMap, sizes));\n };\n\n if (symbolPlacement === 'line') {\n for (const line of clipLine(feature.geometry, 0, 0, EXTENT, EXTENT)) {\n const anchors = getAnchors(\n line,\n symbolMinDistance,\n textMaxAngle,\n shapedTextOrientations.vertical || shapedTextOrientations.horizontal,\n shapedIcon,\n glyphSize,\n textMaxBoxScale,\n bucket.overscaling,\n EXTENT\n );\n for (const anchor of anchors) {\n const shapedText = shapedTextOrientations.horizontal;\n if (!shapedText || !anchorIsTooClose(bucket, shapedText.text, textRepeatDistance, anchor)) {\n addSymbolAtAnchor(line, anchor);\n }\n }\n }\n } else if (feature.type === 'Polygon') {\n for (const polygon of classifyRings(feature.geometry, 0)) {\n // 16 here represents 2 pixels\n const poi = findPoleOfInaccessibility(polygon, 16);\n addSymbolAtAnchor(polygon[0], new Anchor(poi.x, poi.y, 0));\n }\n } else if (feature.type === 'LineString') {\n // https://github.com/mapbox/mapbox-gl-js/issues/3808\n for (const line of feature.geometry) {\n addSymbolAtAnchor(line, new Anchor(line[0].x, line[0].y, 0));\n }\n } else if (feature.type === 'Point') {\n for (const points of feature.geometry) {\n for (const point of points) {\n addSymbolAtAnchor([point], new Anchor(point.x, point.y, 0));\n }\n }\n }\n}\n\nfunction addTextVertices(bucket: SymbolBucket,\n anchor: Point,\n shapedText: Shaping,\n layer: SymbolStyleLayer,\n textAlongLine: boolean,\n feature: SymbolFeature,\n textOffset: [number, number],\n lineArray: {lineStartIndex: number, lineLength: number},\n writingMode: number,\n placedTextSymbolIndices: Array,\n glyphPositionMap: {[number]: GlyphPosition},\n sizes: Sizes) {\n const glyphQuads = getGlyphQuads(anchor, shapedText,\n layer, textAlongLine, feature, glyphPositionMap);\n\n const sizeData = bucket.textSizeData;\n let textSizeData = null;\n\n if (sizeData.functionType === 'source') {\n textSizeData = [\n 10 * layer.layout.get('text-size').evaluate(feature)\n ];\n } else if (sizeData.functionType === 'composite') {\n textSizeData = [\n 10 * sizes.compositeTextSizes[0].evaluate(feature),\n 10 * sizes.compositeTextSizes[1].evaluate(feature)\n ];\n }\n\n bucket.addSymbols(\n bucket.text,\n glyphQuads,\n textSizeData,\n textOffset,\n textAlongLine,\n feature,\n writingMode,\n anchor,\n lineArray.lineStartIndex,\n lineArray.lineLength);\n\n // The placedSymbolArray is used at render time in drawTileSymbols\n // These indices allow access to the array at collision detection time\n placedTextSymbolIndices.push(bucket.text.placedSymbolArray.length - 1);\n\n return glyphQuads.length * 4;\n}\n\n\n/**\n * Add a single label & icon placement.\n *\n * @private\n */\nfunction addSymbol(bucket: SymbolBucket,\n anchor: Anchor,\n line: Array,\n shapedTextOrientations: any,\n shapedIcon: PositionedIcon | void,\n layer: SymbolStyleLayer,\n collisionBoxArray: CollisionBoxArray,\n featureIndex: number,\n sourceLayerIndex: number,\n bucketIndex: number,\n textBoxScale: number,\n textPadding: number,\n textAlongLine: boolean,\n textOffset: [number, number],\n iconBoxScale: number,\n iconPadding: number,\n iconAlongLine: boolean,\n iconOffset: [number, number],\n feature: SymbolFeature,\n glyphPositionMap: {[number]: GlyphPosition},\n sizes: Sizes) {\n const lineArray = bucket.addToLineVertexArray(anchor, line);\n\n let textCollisionFeature, iconCollisionFeature;\n\n let numIconVertices = 0;\n let numGlyphVertices = 0;\n let numVerticalGlyphVertices = 0;\n const key = shapedTextOrientations.horizontal ? shapedTextOrientations.horizontal.text : '';\n const placedTextSymbolIndices = [];\n if (shapedTextOrientations.horizontal) {\n // As a collision approximation, we can use either the vertical or the horizontal version of the feature\n // We're counting on the two versions having similar dimensions\n textCollisionFeature = new CollisionFeature(collisionBoxArray, line, anchor, featureIndex, sourceLayerIndex, bucketIndex, shapedTextOrientations.horizontal, textBoxScale, textPadding, textAlongLine, bucket.overscaling);\n numGlyphVertices += addTextVertices(bucket, anchor, shapedTextOrientations.horizontal, layer, textAlongLine, feature, textOffset, lineArray, shapedTextOrientations.vertical ? WritingMode.horizontal : WritingMode.horizontalOnly, placedTextSymbolIndices, glyphPositionMap, sizes);\n\n if (shapedTextOrientations.vertical) {\n numVerticalGlyphVertices += addTextVertices(bucket, anchor, shapedTextOrientations.vertical, layer, textAlongLine, feature, textOffset, lineArray, WritingMode.vertical, placedTextSymbolIndices, glyphPositionMap, sizes);\n }\n }\n\n const textBoxStartIndex = textCollisionFeature ? textCollisionFeature.boxStartIndex : bucket.collisionBoxArray.length;\n const textBoxEndIndex = textCollisionFeature ? textCollisionFeature.boxEndIndex : bucket.collisionBoxArray.length;\n\n if (shapedIcon) {\n const iconQuads = getIconQuads(anchor, shapedIcon, layer,\n iconAlongLine, shapedTextOrientations.horizontal,\n feature);\n iconCollisionFeature = new CollisionFeature(collisionBoxArray, line, anchor, featureIndex, sourceLayerIndex, bucketIndex, shapedIcon, iconBoxScale, iconPadding, /*align boxes to line*/false, bucket.overscaling);\n\n numIconVertices = iconQuads.length * 4;\n\n const sizeData = bucket.iconSizeData;\n let iconSizeData = null;\n\n if (sizeData.functionType === 'source') {\n iconSizeData = [\n 10 * layer.layout.get('icon-size').evaluate(feature)\n ];\n } else if (sizeData.functionType === 'composite') {\n iconSizeData = [\n 10 * sizes.compositeIconSizes[0].evaluate(feature),\n 10 * sizes.compositeIconSizes[1].evaluate(feature)\n ];\n }\n\n bucket.addSymbols(\n bucket.icon,\n iconQuads,\n iconSizeData,\n iconOffset,\n iconAlongLine,\n feature,\n false,\n anchor,\n lineArray.lineStartIndex,\n lineArray.lineLength);\n }\n\n const iconBoxStartIndex = iconCollisionFeature ? iconCollisionFeature.boxStartIndex : bucket.collisionBoxArray.length;\n const iconBoxEndIndex = iconCollisionFeature ? iconCollisionFeature.boxEndIndex : bucket.collisionBoxArray.length;\n\n if (bucket.glyphOffsetArray.length >= SymbolBucket.MAX_GLYPHS) warnOnce(\n \"Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907\"\n );\n\n const textOpacityState = new OpacityState();\n const iconOpacityState = new OpacityState();\n\n return {\n key,\n textBoxStartIndex,\n textBoxEndIndex,\n iconBoxStartIndex,\n iconBoxEndIndex,\n textOffset,\n iconOffset,\n anchor,\n line,\n featureIndex,\n feature,\n numGlyphVertices,\n numVerticalGlyphVertices,\n numIconVertices,\n textOpacityState,\n iconOpacityState,\n isDuplicate: false,\n placedTextSymbolIndices,\n crossTileID: 0\n };\n}\n\nfunction anchorIsTooClose(bucket: any, text: string, repeatDistance: number, anchor: Point) {\n const compareText = bucket.compareText;\n if (!(text in compareText)) {\n compareText[text] = [];\n } else {\n const otherAnchors = compareText[text];\n for (let k = otherAnchors.length - 1; k >= 0; k--) {\n if (anchor.dist(otherAnchors[k]) < repeatDistance) {\n // If it's within repeatDistance of one anchor, stop looking\n return true;\n }\n }\n }\n // If anchor is not within repeatDistance of any other anchor, add to array\n compareText[text].push(anchor);\n return false;\n}\n","// @flow\n\nimport Point from '@mapbox/point-geometry';\n\nimport { GLYPH_PBF_BORDER } from '../style/parse_glyph_pbf';\n\nimport type Anchor from './anchor';\nimport type {PositionedIcon, Shaping} from './shaping';\nimport type SymbolStyleLayer from '../style/style_layer/symbol_style_layer';\nimport type {Feature} from '../style-spec/expression';\nimport type {GlyphPosition} from '../render/glyph_atlas';\n\n/**\n * A textured quad for rendering a single icon or glyph.\n *\n * The zoom range the glyph can be shown is defined by minScale and maxScale.\n *\n * @param tl The offset of the top left corner from the anchor.\n * @param tr The offset of the top right corner from the anchor.\n * @param bl The offset of the bottom left corner from the anchor.\n * @param br The offset of the bottom right corner from the anchor.\n * @param tex The texture coordinates.\n *\n * @private\n */\nexport type SymbolQuad = {\n tl: Point,\n tr: Point,\n bl: Point,\n br: Point,\n tex: {\n x: number,\n y: number,\n w: number,\n h: number\n },\n writingMode: any | void,\n glyphOffset: [number, number]\n};\n\n/**\n * Create the quads used for rendering an icon.\n * @private\n */\nexport function getIconQuads(anchor: Anchor,\n shapedIcon: PositionedIcon,\n layer: SymbolStyleLayer,\n alongLine: boolean,\n shapedText: Shaping,\n feature: Feature): Array {\n const image = shapedIcon.image;\n const layout = layer.layout;\n\n // If you have a 10px icon that isn't perfectly aligned to the pixel grid it will cover 11 actual\n // pixels. The quad needs to be padded to account for this, otherwise they'll look slightly clipped\n // on one edge in some cases.\n const border = 1;\n\n const top = shapedIcon.top - border / image.pixelRatio;\n const left = shapedIcon.left - border / image.pixelRatio;\n const bottom = shapedIcon.bottom + border / image.pixelRatio;\n const right = shapedIcon.right + border / image.pixelRatio;\n let tl, tr, br, bl;\n\n // text-fit mode\n if (layout.get('icon-text-fit') !== 'none' && shapedText) {\n const iconWidth = (right - left),\n iconHeight = (bottom - top),\n size = layout.get('text-size').evaluate(feature) / 24,\n textLeft = shapedText.left * size,\n textRight = shapedText.right * size,\n textTop = shapedText.top * size,\n textBottom = shapedText.bottom * size,\n textWidth = textRight - textLeft,\n textHeight = textBottom - textTop,\n padT = layout.get('icon-text-fit-padding')[0],\n padR = layout.get('icon-text-fit-padding')[1],\n padB = layout.get('icon-text-fit-padding')[2],\n padL = layout.get('icon-text-fit-padding')[3],\n offsetY = layout.get('icon-text-fit') === 'width' ? (textHeight - iconHeight) * 0.5 : 0,\n offsetX = layout.get('icon-text-fit') === 'height' ? (textWidth - iconWidth) * 0.5 : 0,\n width = layout.get('icon-text-fit') === 'width' || layout.get('icon-text-fit') === 'both' ? textWidth : iconWidth,\n height = layout.get('icon-text-fit') === 'height' || layout.get('icon-text-fit') === 'both' ? textHeight : iconHeight;\n tl = new Point(textLeft + offsetX - padL, textTop + offsetY - padT);\n tr = new Point(textLeft + offsetX + padR + width, textTop + offsetY - padT);\n br = new Point(textLeft + offsetX + padR + width, textTop + offsetY + padB + height);\n bl = new Point(textLeft + offsetX - padL, textTop + offsetY + padB + height);\n // Normal icon size mode\n } else {\n tl = new Point(left, top);\n tr = new Point(right, top);\n br = new Point(right, bottom);\n bl = new Point(left, bottom);\n }\n\n const angle = layer.layout.get('icon-rotate').evaluate(feature) * Math.PI / 180;\n\n if (angle) {\n const sin = Math.sin(angle),\n cos = Math.cos(angle),\n matrix = [cos, -sin, sin, cos];\n\n tl._matMult(matrix);\n tr._matMult(matrix);\n bl._matMult(matrix);\n br._matMult(matrix);\n }\n\n // Icon quad is padded, so texture coordinates also need to be padded.\n return [{tl, tr, bl, br, tex: image.paddedRect, writingMode: undefined, glyphOffset: [0, 0]}];\n}\n\n/**\n * Create the quads used for rendering a text label.\n * @private\n */\nexport function getGlyphQuads(anchor: Anchor,\n shaping: Shaping,\n layer: SymbolStyleLayer,\n alongLine: boolean,\n feature: Feature,\n positions: {[number]: GlyphPosition}): Array {\n\n const oneEm = 24;\n const textRotate = layer.layout.get('text-rotate').evaluate(feature) * Math.PI / 180;\n const textOffset = layer.layout.get('text-offset').evaluate(feature).map((t)=> t * oneEm);\n\n const positionedGlyphs = shaping.positionedGlyphs;\n const quads = [];\n\n\n for (let k = 0; k < positionedGlyphs.length; k++) {\n const positionedGlyph = positionedGlyphs[k];\n const glyph = positions[positionedGlyph.glyph];\n if (!glyph) continue;\n\n const rect = glyph.rect;\n if (!rect) continue;\n\n // The rects have an addditional buffer that is not included in their size.\n const glyphPadding = 1.0;\n const rectBuffer = GLYPH_PBF_BORDER + glyphPadding;\n\n const halfAdvance = glyph.metrics.advance / 2;\n\n const glyphOffset = alongLine ?\n [positionedGlyph.x + halfAdvance, positionedGlyph.y] :\n [0, 0];\n\n const builtInOffset = alongLine ?\n [0, 0] :\n [positionedGlyph.x + halfAdvance + textOffset[0], positionedGlyph.y + textOffset[1]];\n\n\n const x1 = glyph.metrics.left - rectBuffer - halfAdvance + builtInOffset[0];\n const y1 = -glyph.metrics.top - rectBuffer + builtInOffset[1];\n const x2 = x1 + rect.w;\n const y2 = y1 + rect.h;\n\n const tl = new Point(x1, y1);\n const tr = new Point(x2, y1);\n const bl = new Point(x1, y2);\n const br = new Point(x2, y2);\n\n if (alongLine && positionedGlyph.vertical) {\n // Vertical-supporting glyphs are laid out in 24x24 point boxes (1 square em)\n // In horizontal orientation, the y values for glyphs are below the midline\n // and we use a \"yOffset\" of -17 to pull them up to the middle.\n // By rotating counter-clockwise around the point at the center of the left\n // edge of a 24x24 layout box centered below the midline, we align the center\n // of the glyphs with the horizontal midline, so the yOffset is no longer\n // necessary, but we also pull the glyph to the left along the x axis\n const center = new Point(-halfAdvance, halfAdvance);\n const verticalRotation = -Math.PI / 2;\n const xOffsetCorrection = new Point(5, 0);\n tl._rotateAround(verticalRotation, center)._add(xOffsetCorrection);\n tr._rotateAround(verticalRotation, center)._add(xOffsetCorrection);\n bl._rotateAround(verticalRotation, center)._add(xOffsetCorrection);\n br._rotateAround(verticalRotation, center)._add(xOffsetCorrection);\n }\n\n if (textRotate) {\n const sin = Math.sin(textRotate),\n cos = Math.cos(textRotate),\n matrix = [cos, -sin, sin, cos];\n\n tl._matMult(matrix);\n tr._matMult(matrix);\n bl._matMult(matrix);\n br._matMult(matrix);\n }\n\n quads.push({tl, tr, bl, br, tex: rect, writingMode: shaping.writingMode, glyphOffset});\n }\n\n return quads;\n}\n","// @flow\n\nimport Point from '@mapbox/point-geometry';\n\nexport default clipLine;\n\n/**\n * Returns the part of a multiline that intersects with the provided rectangular box.\n *\n * @param lines\n * @param x1 the left edge of the box\n * @param y1 the top edge of the box\n * @param x2 the right edge of the box\n * @param y2 the bottom edge of the box\n * @returns lines\n * @private\n */\nfunction clipLine(lines: Array>, x1: number, y1: number, x2: number, y2: number): Array> {\n const clippedLines = [];\n\n for (let l = 0; l < lines.length; l++) {\n const line = lines[l];\n let clippedLine;\n\n for (let i = 0; i < line.length - 1; i++) {\n let p0 = line[i];\n let p1 = line[i + 1];\n\n\n if (p0.x < x1 && p1.x < x1) {\n continue;\n } else if (p0.x < x1) {\n p0 = new Point(x1, p0.y + (p1.y - p0.y) * ((x1 - p0.x) / (p1.x - p0.x)))._round();\n } else if (p1.x < x1) {\n p1 = new Point(x1, p0.y + (p1.y - p0.y) * ((x1 - p0.x) / (p1.x - p0.x)))._round();\n }\n\n if (p0.y < y1 && p1.y < y1) {\n continue;\n } else if (p0.y < y1) {\n p0 = new Point(p0.x + (p1.x - p0.x) * ((y1 - p0.y) / (p1.y - p0.y)), y1)._round();\n } else if (p1.y < y1) {\n p1 = new Point(p0.x + (p1.x - p0.x) * ((y1 - p0.y) / (p1.y - p0.y)), y1)._round();\n }\n\n if (p0.x >= x2 && p1.x >= x2) {\n continue;\n } else if (p0.x >= x2) {\n p0 = new Point(x2, p0.y + (p1.y - p0.y) * ((x2 - p0.x) / (p1.x - p0.x)))._round();\n } else if (p1.x >= x2) {\n p1 = new Point(x2, p0.y + (p1.y - p0.y) * ((x2 - p0.x) / (p1.x - p0.x)))._round();\n }\n\n if (p0.y >= y2 && p1.y >= y2) {\n continue;\n } else if (p0.y >= y2) {\n p0 = new Point(p0.x + (p1.x - p0.x) * ((y2 - p0.y) / (p1.y - p0.y)), y2)._round();\n } else if (p1.y >= y2) {\n p1 = new Point(p0.x + (p1.x - p0.x) * ((y2 - p0.y) / (p1.y - p0.y)), y2)._round();\n }\n\n if (!clippedLine || !p0.equals(clippedLine[clippedLine.length - 1])) {\n clippedLine = [p0];\n clippedLines.push(clippedLine);\n }\n\n clippedLine.push(p1);\n }\n }\n\n return clippedLines;\n}\n","// @flow\n\nimport ShelfPack from '@mapbox/shelf-pack';\n\nimport { AlphaImage } from '../util/image';\nimport { register } from '../util/web_worker_transfer';\n\nimport type {GlyphMetrics, StyleGlyph} from '../style/style_glyph';\n\nconst padding = 1;\n\ntype Rect = {\n x: number,\n y: number,\n w: number,\n h: number\n};\n\nexport type GlyphPosition = {\n rect: Rect,\n metrics: GlyphMetrics\n};\n\nexport default class GlyphAtlas {\n image: AlphaImage;\n positions: { [string]: { [number]: GlyphPosition } };\n\n constructor(stacks: { [string]: { [number]: ?StyleGlyph } }) {\n const image = new AlphaImage({width: 0, height: 0});\n const positions = {};\n\n const pack = new ShelfPack(0, 0, {autoResize: true});\n\n for (const stack in stacks) {\n const glyphs = stacks[stack];\n const stackPositions = positions[stack] = {};\n\n for (const id in glyphs) {\n const src = glyphs[+id];\n if (src && src.bitmap.width !== 0 && src.bitmap.height !== 0) {\n const bin = pack.packOne(\n src.bitmap.width + 2 * padding,\n src.bitmap.height + 2 * padding);\n\n image.resize({\n width: pack.w,\n height: pack.h\n });\n\n AlphaImage.copy(\n src.bitmap,\n image,\n {x: 0, y: 0},\n {\n x: bin.x + padding,\n y: bin.y + padding\n },\n src.bitmap);\n\n stackPositions[id] = {rect: bin, metrics: src.metrics};\n }\n }\n }\n\n pack.shrink();\n image.resize({\n width: pack.w,\n height: pack.h\n });\n\n this.image = image;\n this.positions = positions;\n }\n}\n\nregister('GlyphAtlas', GlyphAtlas);\n","// @flow\n\nimport FeatureIndex from '../data/feature_index';\n\nimport { performSymbolLayout } from '../symbol/symbol_layout';\nimport { CollisionBoxArray } from '../data/array_types';\nimport DictionaryCoder from '../util/dictionary_coder';\nimport SymbolBucket from '../data/bucket/symbol_bucket';\nimport { warnOnce, mapObject, values } from '../util/util';\nimport assert from 'assert';\nimport ImageAtlas from '../render/image_atlas';\nimport GlyphAtlas from '../render/glyph_atlas';\nimport EvaluationParameters from '../style/evaluation_parameters';\nimport { OverscaledTileID } from './tile_id';\n\nimport type {Bucket} from '../data/bucket';\nimport type Actor from '../util/actor';\nimport type StyleLayer from '../style/style_layer';\nimport type StyleLayerIndex from '../style/style_layer_index';\nimport type {StyleImage} from '../style/style_image';\nimport type {StyleGlyph} from '../style/style_glyph';\nimport type {\n WorkerTileParameters,\n WorkerTileCallback,\n} from '../source/worker_source';\n\nclass WorkerTile {\n tileID: OverscaledTileID;\n uid: string;\n zoom: number;\n pixelRatio: number;\n tileSize: number;\n source: string;\n overscaling: number;\n showCollisionBoxes: boolean;\n collectResourceTiming: boolean;\n\n status: 'parsing' | 'done';\n data: VectorTile;\n collisionBoxArray: CollisionBoxArray;\n\n abort: ?() => void;\n reloadCallback: WorkerTileCallback;\n vectorTile: VectorTile;\n\n constructor(params: WorkerTileParameters) {\n this.tileID = new OverscaledTileID(params.tileID.overscaledZ, params.tileID.wrap, params.tileID.canonical.z, params.tileID.canonical.x, params.tileID.canonical.y);\n this.uid = params.uid;\n this.zoom = params.zoom;\n this.pixelRatio = params.pixelRatio;\n this.tileSize = params.tileSize;\n this.source = params.source;\n this.overscaling = this.tileID.overscaleFactor();\n this.showCollisionBoxes = params.showCollisionBoxes;\n this.collectResourceTiming = !!params.collectResourceTiming;\n }\n\n parse(data: VectorTile, layerIndex: StyleLayerIndex, actor: Actor, callback: WorkerTileCallback) {\n this.status = 'parsing';\n this.data = data;\n\n this.collisionBoxArray = new CollisionBoxArray();\n const sourceLayerCoder = new DictionaryCoder(Object.keys(data.layers).sort());\n\n const featureIndex = new FeatureIndex(this.tileID);\n featureIndex.bucketLayerIDs = [];\n\n const buckets: {[string]: Bucket} = {};\n\n const options = {\n featureIndex: featureIndex,\n iconDependencies: {},\n glyphDependencies: {}\n };\n\n const layerFamilies = layerIndex.familiesBySource[this.source];\n for (const sourceLayerId in layerFamilies) {\n const sourceLayer = data.layers[sourceLayerId];\n if (!sourceLayer) {\n continue;\n }\n\n if (sourceLayer.version === 1) {\n warnOnce(`Vector tile source \"${this.source}\" layer \"${sourceLayerId}\" ` +\n `does not use vector tile spec v2 and therefore may have some rendering errors.`);\n }\n\n const sourceLayerIndex = sourceLayerCoder.encode(sourceLayerId);\n const features = [];\n for (let index = 0; index < sourceLayer.length; index++) {\n const feature = sourceLayer.feature(index);\n features.push({ feature, index, sourceLayerIndex });\n }\n\n for (const family of layerFamilies[sourceLayerId]) {\n const layer = family[0];\n\n assert(layer.source === this.source);\n if (layer.minzoom && this.zoom < Math.floor(layer.minzoom)) continue;\n if (layer.maxzoom && this.zoom >= layer.maxzoom) continue;\n if (layer.visibility === 'none') continue;\n\n recalculateLayers(family, this.zoom);\n\n const bucket = buckets[layer.id] = layer.createBucket({\n index: featureIndex.bucketLayerIDs.length,\n layers: family,\n zoom: this.zoom,\n pixelRatio: this.pixelRatio,\n overscaling: this.overscaling,\n collisionBoxArray: this.collisionBoxArray,\n sourceLayerIndex: sourceLayerIndex\n });\n\n bucket.populate(features, options);\n featureIndex.bucketLayerIDs.push(family.map((l) => l.id));\n }\n }\n\n let error: ?Error;\n let glyphMap: ?{[string]: {[number]: ?StyleGlyph}};\n let imageMap: ?{[string]: StyleImage};\n\n const stacks = mapObject(options.glyphDependencies, (glyphs) => Object.keys(glyphs).map(Number));\n if (Object.keys(stacks).length) {\n actor.send('getGlyphs', {uid: this.uid, stacks}, (err, result) => {\n if (!error) {\n error = err;\n glyphMap = result;\n maybePrepare.call(this);\n }\n });\n } else {\n glyphMap = {};\n }\n\n const icons = Object.keys(options.iconDependencies);\n if (icons.length) {\n actor.send('getImages', {icons}, (err, result) => {\n if (!error) {\n error = err;\n imageMap = result;\n maybePrepare.call(this);\n }\n });\n } else {\n imageMap = {};\n }\n\n maybePrepare.call(this);\n\n function maybePrepare() {\n if (error) {\n return callback(error);\n } else if (glyphMap && imageMap) {\n const glyphAtlas = new GlyphAtlas(glyphMap);\n const imageAtlas = new ImageAtlas(imageMap);\n\n for (const key in buckets) {\n const bucket = buckets[key];\n if (bucket instanceof SymbolBucket) {\n recalculateLayers(bucket.layers, this.zoom);\n performSymbolLayout(bucket, glyphMap, glyphAtlas.positions, imageMap, imageAtlas.positions, this.showCollisionBoxes);\n }\n }\n\n this.status = 'done';\n\n callback(null, {\n buckets: values(buckets).filter(b => !b.isEmpty()),\n featureIndex,\n collisionBoxArray: this.collisionBoxArray,\n glyphAtlasImage: glyphAtlas.image,\n iconAtlasImage: imageAtlas.image\n });\n }\n }\n }\n}\n\nfunction recalculateLayers(layers: $ReadOnlyArray, zoom: number) {\n // Layers are shared and may have been used by a WorkerTile with a different zoom.\n const parameters = new EvaluationParameters(zoom);\n for (const layer of layers) {\n layer.recalculate(parameters);\n }\n}\n\nexport default WorkerTile;\n","// @flow\n\n// Wraps performance.getEntriesByName to facilitate testing\n// Not incorporated into browser.js because the latter is poisonous when used outside the main thread\nconst exported = {\n getEntriesByName: (url: string) => {\n if (performance && performance.getEntriesByName)\n return performance.getEntriesByName(url);\n else\n return false;\n }\n};\n\nexport default exported;\n","// @flow\n\nimport {getArrayBuffer} from '../util/ajax';\n\nimport vt from '@mapbox/vector-tile';\nimport Protobuf from 'pbf';\nimport WorkerTile from './worker_tile';\nimport { extend } from '../util/util';\nimport perf from '../util/performance';\n\nimport type {\n WorkerSource,\n WorkerTileParameters,\n WorkerTileCallback,\n TileParameters\n} from '../source/worker_source';\n\nimport type {PerformanceResourceTiming} from '../types/performance_resource_timing';\nimport type Actor from '../util/actor';\nimport type StyleLayerIndex from '../style/style_layer_index';\nimport type {Callback} from '../types/callback';\n\nexport type LoadVectorTileResult = {\n vectorTile: VectorTile;\n rawData: ArrayBuffer;\n expires?: any;\n cacheControl?: any;\n resourceTiming?: Array;\n};\n\n/**\n * @callback LoadVectorDataCallback\n * @param error\n * @param vectorTile\n * @private\n */\nexport type LoadVectorDataCallback = Callback;\n\nexport type AbortVectorData = () => void;\nexport type LoadVectorData = (params: WorkerTileParameters, callback: LoadVectorDataCallback) => ?AbortVectorData;\n\n/**\n * @private\n */\nfunction loadVectorTile(params: WorkerTileParameters, callback: LoadVectorDataCallback) {\n const xhr = getArrayBuffer(params.request, (err, response) => {\n if (err) {\n callback(err);\n } else if (response) {\n callback(null, {\n vectorTile: new vt.VectorTile(new Protobuf(response.data)),\n rawData: response.data,\n cacheControl: response.cacheControl,\n expires: response.expires\n });\n }\n });\n return () => {\n xhr.abort();\n callback();\n };\n}\n\n/**\n * The {@link WorkerSource} implementation that supports {@link VectorTileSource}.\n * This class is designed to be easily reused to support custom source types\n * for data formats that can be parsed/converted into an in-memory VectorTile\n * representation. To do so, create it with\n * `new VectorTileWorkerSource(actor, styleLayers, customLoadVectorDataFunction)`.\n *\n * @private\n */\nclass VectorTileWorkerSource implements WorkerSource {\n actor: Actor;\n layerIndex: StyleLayerIndex;\n loadVectorData: LoadVectorData;\n loading: { [string]: WorkerTile };\n loaded: { [string]: WorkerTile };\n\n /**\n * @param [loadVectorData] Optional method for custom loading of a VectorTile\n * object based on parameters passed from the main-thread Source. See\n * {@link VectorTileWorkerSource#loadTile}. The default implementation simply\n * loads the pbf at `params.url`.\n */\n constructor(actor: Actor, layerIndex: StyleLayerIndex, loadVectorData: ?LoadVectorData) {\n this.actor = actor;\n this.layerIndex = layerIndex;\n this.loadVectorData = loadVectorData || loadVectorTile;\n this.loading = {};\n this.loaded = {};\n }\n\n /**\n * Implements {@link WorkerSource#loadTile}. Delegates to\n * {@link VectorTileWorkerSource#loadVectorData} (which by default expects\n * a `params.url` property) for fetching and producing a VectorTile object.\n */\n loadTile(params: WorkerTileParameters, callback: WorkerTileCallback) {\n const uid = params.uid;\n\n if (!this.loading)\n this.loading = {};\n\n const workerTile = this.loading[uid] = new WorkerTile(params);\n workerTile.abort = this.loadVectorData(params, (err, response) => {\n delete this.loading[uid];\n\n if (err || !response) {\n return callback(err);\n }\n\n const rawTileData = response.rawData;\n const cacheControl = {};\n if (response.expires) cacheControl.expires = response.expires;\n if (response.cacheControl) cacheControl.cacheControl = response.cacheControl;\n const resourceTiming = {};\n if (params.request && params.request.collectResourceTiming) {\n const resourceTimingData = perf.getEntriesByName(params.request.url);\n // it's necessary to eval the result of getEntriesByName() here via parse/stringify\n // late evaluation in the main thread causes TypeError: illegal invocation\n if (resourceTimingData)\n resourceTiming.resourceTiming = JSON.parse(JSON.stringify(resourceTimingData));\n }\n\n workerTile.vectorTile = response.vectorTile;\n workerTile.parse(response.vectorTile, this.layerIndex, this.actor, (err, result) => {\n if (err || !result) return callback(err);\n\n // Transferring a copy of rawTileData because the worker needs to retain its copy.\n callback(null, extend({rawTileData: rawTileData.slice(0)}, result, cacheControl, resourceTiming));\n });\n\n this.loaded = this.loaded || {};\n this.loaded[uid] = workerTile;\n });\n }\n\n /**\n * Implements {@link WorkerSource#reloadTile}.\n */\n reloadTile(params: WorkerTileParameters, callback: WorkerTileCallback) {\n const loaded = this.loaded,\n uid = params.uid,\n vtSource = this;\n if (loaded && loaded[uid]) {\n const workerTile = loaded[uid];\n workerTile.showCollisionBoxes = params.showCollisionBoxes;\n\n const done = (err, data) => {\n const reloadCallback = workerTile.reloadCallback;\n if (reloadCallback) {\n delete workerTile.reloadCallback;\n workerTile.parse(workerTile.vectorTile, vtSource.layerIndex, vtSource.actor, reloadCallback);\n }\n callback(err, data);\n };\n\n if (workerTile.status === 'parsing') {\n workerTile.reloadCallback = done;\n } else if (workerTile.status === 'done') {\n workerTile.parse(workerTile.vectorTile, this.layerIndex, this.actor, done);\n }\n }\n }\n\n /**\n * Implements {@link WorkerSource#abortTile}.\n *\n * @param params\n * @param params.uid The UID for this tile.\n */\n abortTile(params: TileParameters, callback: WorkerTileCallback) {\n const loading = this.loading,\n uid = params.uid;\n if (loading && loading[uid] && loading[uid].abort) {\n loading[uid].abort();\n delete loading[uid];\n }\n callback();\n }\n\n /**\n * Implements {@link WorkerSource#removeTile}.\n *\n * @param params\n * @param params.uid The UID for this tile.\n */\n removeTile(params: TileParameters, callback: WorkerTileCallback) {\n const loaded = this.loaded,\n uid = params.uid;\n if (loaded && loaded[uid]) {\n delete loaded[uid];\n }\n callback();\n }\n}\n\nexport default VectorTileWorkerSource;\n","// @flow\n\nimport DEMData from '../data/dem_data';\n\nimport type Actor from '../util/actor';\nimport type {\n WorkerDEMTileParameters,\n WorkerDEMTileCallback,\n TileParameters\n} from './worker_source';\n\n\nclass RasterDEMTileWorkerSource {\n actor: Actor;\n loading: {[string]: DEMData};\n loaded: {[string]: DEMData};\n\n constructor() {\n this.loading = {};\n this.loaded = {};\n }\n\n loadTile(params: WorkerDEMTileParameters, callback: WorkerDEMTileCallback) {\n const uid = params.uid,\n encoding = params.encoding;\n\n const dem = new DEMData(uid);\n this.loading[uid] = dem;\n dem.loadFromImage(params.rawImageData, encoding);\n delete this.loading[uid];\n\n this.loaded = this.loaded || {};\n this.loaded[uid] = dem;\n callback(null, dem);\n }\n\n removeTile(params: TileParameters) {\n const loaded = this.loaded,\n uid = params.uid;\n if (loaded && loaded[uid]) {\n delete loaded[uid];\n }\n }\n}\n\nexport default RasterDEMTileWorkerSource;\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}","var geojsonArea = require('@mapbox/geojson-area');\n\nmodule.exports = rewind;\n\nfunction rewind(gj, outer) {\n switch ((gj && gj.type) || null) {\n case 'FeatureCollection':\n gj.features = gj.features.map(curryOuter(rewind, outer));\n return gj;\n case 'Feature':\n gj.geometry = rewind(gj.geometry, outer);\n return gj;\n case 'Polygon':\n case 'MultiPolygon':\n return correct(gj, outer);\n default:\n return gj;\n }\n}\n\nfunction curryOuter(a, b) {\n return function(_) { return a(_, b); };\n}\n\nfunction correct(_, outer) {\n if (_.type === 'Polygon') {\n _.coordinates = correctRings(_.coordinates, outer);\n } else if (_.type === 'MultiPolygon') {\n _.coordinates = _.coordinates.map(curryOuter(correctRings, outer));\n }\n return _;\n}\n\nfunction correctRings(_, outer) {\n outer = !!outer;\n _[0] = wind(_[0], outer);\n for (var i = 1; i < _.length; i++) {\n _[i] = wind(_[i], !outer);\n }\n return _;\n}\n\nfunction wind(_, dir) {\n return cw(_) === dir ? _ : _.reverse();\n}\n\nfunction cw(_) {\n return geojsonArea.ring(_) >= 0;\n}\n","// @flow\n\nimport Point from '@mapbox/point-geometry';\n\nimport mvt from '@mapbox/vector-tile';\nconst toGeoJSON = mvt.VectorTileFeature.prototype.toGeoJSON;\nimport EXTENT from '../data/extent';\n\n// The feature type used by geojson-vt and supercluster. Should be extracted to\n// global type and used in module definitions for those two modules.\ntype Feature = {\n type: 1,\n id: mixed,\n tags: {[string]: string | number | boolean},\n geometry: Array<[number, number]>,\n} | {\n type: 2 | 3,\n id: mixed,\n tags: {[string]: string | number | boolean},\n geometry: Array>,\n}\n\nclass FeatureWrapper implements VectorTileFeature {\n _feature: Feature;\n\n extent: number;\n type: 1 | 2 | 3;\n id: number;\n properties: {[string]: string | number | boolean};\n\n constructor(feature: Feature) {\n this._feature = feature;\n\n this.extent = EXTENT;\n this.type = feature.type;\n this.properties = feature.tags;\n\n // If the feature has a top-level `id` property, copy it over, but only\n // if it can be coerced to an integer, because this wrapper is used for\n // serializing geojson feature data into vector tile PBF data, and the\n // vector tile spec only supports integer values for feature ids --\n // allowing non-integer values here results in a non-compliant PBF\n // that causes an exception when it is parsed with vector-tile-js\n if ('id' in feature && !isNaN(feature.id)) {\n this.id = parseInt(feature.id, 10);\n }\n }\n\n loadGeometry() {\n if (this._feature.type === 1) {\n const geometry = [];\n for (const point of this._feature.geometry) {\n geometry.push([new Point(point[0], point[1])]);\n }\n return geometry;\n } else {\n const geometry = [];\n for (const ring of this._feature.geometry) {\n const newRing = [];\n for (const point of ring) {\n newRing.push(new Point(point[0], point[1]));\n }\n geometry.push(newRing);\n }\n return geometry;\n }\n }\n\n toGeoJSON(x: number, y: number, z: number) {\n return toGeoJSON.call(this, x, y, z);\n }\n}\n\nclass GeoJSONWrapper implements VectorTile, VectorTileLayer {\n layers: {[string]: VectorTileLayer};\n name: string;\n extent: number;\n length: number;\n _features: Array;\n\n constructor(features: Array) {\n this.layers = { '_geojsonTileLayer': this };\n this.name = '_geojsonTileLayer';\n this.extent = EXTENT;\n this.length = features.length;\n this._features = features;\n }\n\n feature(i: number): VectorTileFeature {\n return new FeatureWrapper(this._features[i]);\n }\n}\n\nexport default GeoJSONWrapper;\n","'use strict'\n\nvar Point = require('@mapbox/point-geometry')\nvar VectorTileFeature = require('@mapbox/vector-tile').VectorTileFeature\n\nmodule.exports = GeoJSONWrapper\n\n// conform to vectortile api\nfunction GeoJSONWrapper (features, options) {\n this.options = options || {}\n this.features = features\n this.length = features.length\n}\n\nGeoJSONWrapper.prototype.feature = function (i) {\n return new FeatureWrapper(this.features[i], this.options.extent)\n}\n\nfunction FeatureWrapper (feature, extent) {\n this.id = typeof feature.id === 'number' ? feature.id : undefined\n this.type = feature.type\n this.rawGeometry = feature.type === 1 ? [feature.geometry] : feature.geometry\n this.properties = feature.tags\n this.extent = extent || 4096\n}\n\nFeatureWrapper.prototype.loadGeometry = function () {\n var rings = this.rawGeometry\n this.geometry = []\n\n for (var i = 0; i < rings.length; i++) {\n var ring = rings[i]\n var newRing = []\n for (var j = 0; j < ring.length; j++) {\n newRing.push(new Point(ring[j][0], ring[j][1]))\n }\n this.geometry.push(newRing)\n }\n return this.geometry\n}\n\nFeatureWrapper.prototype.bbox = function () {\n if (!this.geometry) this.loadGeometry()\n\n var rings = this.geometry\n var x1 = Infinity\n var x2 = -Infinity\n var y1 = Infinity\n var y2 = -Infinity\n\n for (var i = 0; i < rings.length; i++) {\n var ring = rings[i]\n\n for (var j = 0; j < ring.length; j++) {\n var coord = ring[j]\n\n x1 = Math.min(x1, coord.x)\n x2 = Math.max(x2, coord.x)\n y1 = Math.min(y1, coord.y)\n y2 = Math.max(y2, coord.y)\n }\n }\n\n return [x1, y1, x2, y2]\n}\n\nFeatureWrapper.prototype.toGeoJSON = VectorTileFeature.prototype.toGeoJSON\n","var Pbf = require('pbf')\nvar GeoJSONWrapper = require('./lib/geojson_wrapper')\n\nmodule.exports = fromVectorTileJs\nmodule.exports.fromVectorTileJs = fromVectorTileJs\nmodule.exports.fromGeojsonVt = fromGeojsonVt\nmodule.exports.GeoJSONWrapper = GeoJSONWrapper\n\n/**\n * Serialize a vector-tile-js-created tile to pbf\n *\n * @param {Object} tile\n * @return {Buffer} uncompressed, pbf-serialized tile data\n */\nfunction fromVectorTileJs (tile) {\n var out = new Pbf()\n writeTile(tile, out)\n return out.finish()\n}\n\n/**\n * Serialized a geojson-vt-created tile to pbf.\n *\n * @param {Object} layers - An object mapping layer names to geojson-vt-created vector tile objects\n * @param {Object} [options] - An object specifying the vector-tile specification version and extent that were used to create `layers`.\n * @param {Number} [options.version=1] - Version of vector-tile spec used\n * @param {Number} [options.extent=4096] - Extent of the vector tile\n * @return {Buffer} uncompressed, pbf-serialized tile data\n */\nfunction fromGeojsonVt (layers, options) {\n options = options || {}\n var l = {}\n for (var k in layers) {\n l[k] = new GeoJSONWrapper(layers[k].features, options)\n l[k].name = k\n l[k].version = options.version\n l[k].extent = options.extent\n }\n return fromVectorTileJs({layers: l})\n}\n\nfunction writeTile (tile, pbf) {\n for (var key in tile.layers) {\n pbf.writeMessage(3, writeLayer, tile.layers[key])\n }\n}\n\nfunction writeLayer (layer, pbf) {\n pbf.writeVarintField(15, layer.version || 1)\n pbf.writeStringField(1, layer.name || '')\n pbf.writeVarintField(5, layer.extent || 4096)\n\n var i\n var context = {\n keys: [],\n values: [],\n keycache: {},\n valuecache: {}\n }\n\n for (i = 0; i < layer.length; i++) {\n context.feature = layer.feature(i)\n pbf.writeMessage(2, writeFeature, context)\n }\n\n var keys = context.keys\n for (i = 0; i < keys.length; i++) {\n pbf.writeStringField(3, keys[i])\n }\n\n var values = context.values\n for (i = 0; i < values.length; i++) {\n pbf.writeMessage(4, writeValue, values[i])\n }\n}\n\nfunction writeFeature (context, pbf) {\n var feature = context.feature\n\n if (feature.id !== undefined) {\n pbf.writeVarintField(1, feature.id)\n }\n\n pbf.writeMessage(2, writeProperties, context)\n pbf.writeVarintField(3, feature.type)\n pbf.writeMessage(4, writeGeometry, feature)\n}\n\nfunction writeProperties (context, pbf) {\n var feature = context.feature\n var keys = context.keys\n var values = context.values\n var keycache = context.keycache\n var valuecache = context.valuecache\n\n for (var key in feature.properties) {\n var keyIndex = keycache[key]\n if (typeof keyIndex === 'undefined') {\n keys.push(key)\n keyIndex = keys.length - 1\n keycache[key] = keyIndex\n }\n pbf.writeVarint(keyIndex)\n\n var value = feature.properties[key]\n var type = typeof value\n if (type !== 'string' && type !== 'boolean' && type !== 'number') {\n value = JSON.stringify(value)\n }\n var valueKey = type + ':' + value\n var valueIndex = valuecache[valueKey]\n if (typeof valueIndex === 'undefined') {\n values.push(value)\n valueIndex = values.length - 1\n valuecache[valueKey] = valueIndex\n }\n pbf.writeVarint(valueIndex)\n }\n}\n\nfunction command (cmd, length) {\n return (length << 3) + (cmd & 0x7)\n}\n\nfunction zigzag (num) {\n return (num << 1) ^ (num >> 31)\n}\n\nfunction writeGeometry (feature, pbf) {\n var geometry = feature.loadGeometry()\n var type = feature.type\n var x = 0\n var y = 0\n var rings = geometry.length\n for (var r = 0; r < rings; r++) {\n var ring = geometry[r]\n var count = 1\n if (type === 1) {\n count = ring.length\n }\n pbf.writeVarint(command(1, count)) // moveto\n // do not write polygon closing path as lineto\n var lineCount = type === 3 ? ring.length - 1 : ring.length\n for (var i = 0; i < lineCount; i++) {\n if (i === 1 && type !== 1) {\n pbf.writeVarint(command(2, lineCount - 1)) // lineto\n }\n var dx = ring[i].x - x\n var dy = ring[i].y - y\n pbf.writeVarint(zigzag(dx))\n pbf.writeVarint(zigzag(dy))\n x += dx\n y += dy\n }\n if (type === 3) {\n pbf.writeVarint(command(7, 0)) // closepath\n }\n }\n}\n\nfunction writeValue (value, pbf) {\n var type = typeof value\n if (type === 'string') {\n pbf.writeStringField(1, value)\n } else if (type === 'boolean') {\n pbf.writeBooleanField(7, value)\n } else if (type === 'number') {\n if (value % 1 !== 0) {\n pbf.writeDoubleField(3, value)\n } else if (value < 0) {\n pbf.writeSVarintField(6, value)\n } else {\n pbf.writeVarintField(5, value)\n }\n }\n}\n","'use strict';\n\nmodule.exports = sortKD;\n\nfunction sortKD(ids, coords, nodeSize, left, right, depth) {\n if (right - left <= nodeSize) return;\n\n var m = Math.floor((left + right) / 2);\n\n select(ids, coords, m, left, right, depth % 2);\n\n sortKD(ids, coords, nodeSize, left, m - 1, depth + 1);\n sortKD(ids, coords, nodeSize, m + 1, right, depth + 1);\n}\n\nfunction select(ids, coords, k, left, right, inc) {\n\n while (right > left) {\n if (right - left > 600) {\n var n = right - left + 1;\n var m = k - left + 1;\n var z = Math.log(n);\n var s = 0.5 * Math.exp(2 * z / 3);\n var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);\n var newLeft = Math.max(left, Math.floor(k - m * s / n + sd));\n var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));\n select(ids, coords, k, newLeft, newRight, inc);\n }\n\n var t = coords[2 * k + inc];\n var i = left;\n var j = right;\n\n swapItem(ids, coords, left, k);\n if (coords[2 * right + inc] > t) swapItem(ids, coords, left, right);\n\n while (i < j) {\n swapItem(ids, coords, i, j);\n i++;\n j--;\n while (coords[2 * i + inc] < t) i++;\n while (coords[2 * j + inc] > t) j--;\n }\n\n if (coords[2 * left + inc] === t) swapItem(ids, coords, left, j);\n else {\n j++;\n swapItem(ids, coords, j, right);\n }\n\n if (j <= k) left = j + 1;\n if (k <= j) right = j - 1;\n }\n}\n\nfunction swapItem(ids, coords, i, j) {\n swap(ids, i, j);\n swap(coords, 2 * i, 2 * j);\n swap(coords, 2 * i + 1, 2 * j + 1);\n}\n\nfunction swap(arr, i, j) {\n var tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n}\n","'use strict';\n\nmodule.exports = range;\n\nfunction range(ids, coords, minX, minY, maxX, maxY, nodeSize) {\n var stack = [0, ids.length - 1, 0];\n var result = [];\n var x, y;\n\n while (stack.length) {\n var axis = stack.pop();\n var right = stack.pop();\n var left = stack.pop();\n\n if (right - left <= nodeSize) {\n for (var i = left; i <= right; i++) {\n x = coords[2 * i];\n y = coords[2 * i + 1];\n if (x >= minX && x <= maxX && y >= minY && y <= maxY) result.push(ids[i]);\n }\n continue;\n }\n\n var m = Math.floor((left + right) / 2);\n\n x = coords[2 * m];\n y = coords[2 * m + 1];\n\n if (x >= minX && x <= maxX && y >= minY && y <= maxY) result.push(ids[m]);\n\n var nextAxis = (axis + 1) % 2;\n\n if (axis === 0 ? minX <= x : minY <= y) {\n stack.push(left);\n stack.push(m - 1);\n stack.push(nextAxis);\n }\n if (axis === 0 ? maxX >= x : maxY >= y) {\n stack.push(m + 1);\n stack.push(right);\n stack.push(nextAxis);\n }\n }\n\n return result;\n}\n","'use strict';\n\nmodule.exports = within;\n\nfunction within(ids, coords, qx, qy, r, nodeSize) {\n var stack = [0, ids.length - 1, 0];\n var result = [];\n var r2 = r * r;\n\n while (stack.length) {\n var axis = stack.pop();\n var right = stack.pop();\n var left = stack.pop();\n\n if (right - left <= nodeSize) {\n for (var i = left; i <= right; i++) {\n if (sqDist(coords[2 * i], coords[2 * i + 1], qx, qy) <= r2) result.push(ids[i]);\n }\n continue;\n }\n\n var m = Math.floor((left + right) / 2);\n\n var x = coords[2 * m];\n var y = coords[2 * m + 1];\n\n if (sqDist(x, y, qx, qy) <= r2) result.push(ids[m]);\n\n var nextAxis = (axis + 1) % 2;\n\n if (axis === 0 ? qx - r <= x : qy - r <= y) {\n stack.push(left);\n stack.push(m - 1);\n stack.push(nextAxis);\n }\n if (axis === 0 ? qx + r >= x : qy + r >= y) {\n stack.push(m + 1);\n stack.push(right);\n stack.push(nextAxis);\n }\n }\n\n return result;\n}\n\nfunction sqDist(ax, ay, bx, by) {\n var dx = ax - bx;\n var dy = ay - by;\n return dx * dx + dy * dy;\n}\n","'use strict';\n\nvar sort = require('./sort');\nvar range = require('./range');\nvar within = require('./within');\n\nmodule.exports = kdbush;\n\nfunction kdbush(points, getX, getY, nodeSize, ArrayType) {\n return new KDBush(points, getX, getY, nodeSize, ArrayType);\n}\n\nfunction KDBush(points, getX, getY, nodeSize, ArrayType) {\n getX = getX || defaultGetX;\n getY = getY || defaultGetY;\n ArrayType = ArrayType || Array;\n\n this.nodeSize = nodeSize || 64;\n this.points = points;\n\n this.ids = new ArrayType(points.length);\n this.coords = new ArrayType(points.length * 2);\n\n for (var i = 0; i < points.length; i++) {\n this.ids[i] = i;\n this.coords[2 * i] = getX(points[i]);\n this.coords[2 * i + 1] = getY(points[i]);\n }\n\n sort(this.ids, this.coords, this.nodeSize, 0, this.ids.length - 1, 0);\n}\n\nKDBush.prototype = {\n range: function (minX, minY, maxX, maxY) {\n return range(this.ids, this.coords, minX, minY, maxX, maxY, this.nodeSize);\n },\n\n within: function (x, y, r) {\n return within(this.ids, this.coords, x, y, r, this.nodeSize);\n }\n};\n\nfunction defaultGetX(p) { return p[0]; }\nfunction defaultGetY(p) { return p[1]; }\n","'use strict';\n\nvar kdbush = require('kdbush');\n\nmodule.exports = supercluster;\n\nfunction supercluster(options) {\n return new SuperCluster(options);\n}\n\nfunction SuperCluster(options) {\n this.options = extend(Object.create(this.options), options);\n this.trees = new Array(this.options.maxZoom + 1);\n}\n\nSuperCluster.prototype = {\n options: {\n minZoom: 0, // min zoom to generate clusters on\n maxZoom: 16, // max zoom level to cluster the points on\n radius: 40, // cluster radius in pixels\n extent: 512, // tile extent (radius is calculated relative to it)\n nodeSize: 64, // size of the KD-tree leaf node, affects performance\n log: false, // whether to log timing info\n\n // a reduce function for calculating custom cluster properties\n reduce: null, // function (accumulated, props) { accumulated.sum += props.sum; }\n\n // initial properties of a cluster (before running the reducer)\n initial: function () { return {}; }, // function () { return {sum: 0}; },\n\n // properties to use for individual points when running the reducer\n map: function (props) { return props; } // function (props) { return {sum: props.my_value}; },\n },\n\n load: function (points) {\n var log = this.options.log;\n\n if (log) console.time('total time');\n\n var timerId = 'prepare ' + points.length + ' points';\n if (log) console.time(timerId);\n\n this.points = points;\n\n // generate a cluster object for each point\n var clusters = points.map(createPointCluster);\n if (log) console.timeEnd(timerId);\n\n // cluster points on max zoom, then cluster the results on previous zoom, etc.;\n // results in a cluster hierarchy across zoom levels\n for (var z = this.options.maxZoom; z >= this.options.minZoom; z--) {\n var now = +Date.now();\n\n // index input points into a KD-tree\n this.trees[z + 1] = kdbush(clusters, getX, getY, this.options.nodeSize, Float32Array);\n\n clusters = this._cluster(clusters, z); // create a new set of clusters for the zoom\n\n if (log) console.log('z%d: %d clusters in %dms', z, clusters.length, +Date.now() - now);\n }\n\n // index top-level clusters\n this.trees[this.options.minZoom] = kdbush(clusters, getX, getY, this.options.nodeSize, Float32Array);\n\n if (log) console.timeEnd('total time');\n\n return this;\n },\n\n getClusters: function (bbox, zoom) {\n var tree = this.trees[this._limitZoom(zoom)];\n var ids = tree.range(lngX(bbox[0]), latY(bbox[3]), lngX(bbox[2]), latY(bbox[1]));\n var clusters = [];\n for (var i = 0; i < ids.length; i++) {\n var c = tree.points[ids[i]];\n clusters.push(c.numPoints ? getClusterJSON(c) : this.points[c.id]);\n }\n return clusters;\n },\n\n getChildren: function (clusterId, clusterZoom) {\n var origin = this.trees[clusterZoom + 1].points[clusterId];\n var r = this.options.radius / (this.options.extent * Math.pow(2, clusterZoom));\n var points = this.trees[clusterZoom + 1].within(origin.x, origin.y, r);\n var children = [];\n for (var i = 0; i < points.length; i++) {\n var c = this.trees[clusterZoom + 1].points[points[i]];\n if (c.parentId === clusterId) {\n children.push(c.numPoints ? getClusterJSON(c) : this.points[c.id]);\n }\n }\n return children;\n },\n\n getLeaves: function (clusterId, clusterZoom, limit, offset) {\n limit = limit || 10;\n offset = offset || 0;\n\n var leaves = [];\n this._appendLeaves(leaves, clusterId, clusterZoom, limit, offset, 0);\n\n return leaves;\n },\n\n getTile: function (z, x, y) {\n var tree = this.trees[this._limitZoom(z)];\n var z2 = Math.pow(2, z);\n var extent = this.options.extent;\n var r = this.options.radius;\n var p = r / extent;\n var top = (y - p) / z2;\n var bottom = (y + 1 + p) / z2;\n\n var tile = {\n features: []\n };\n\n this._addTileFeatures(\n tree.range((x - p) / z2, top, (x + 1 + p) / z2, bottom),\n tree.points, x, y, z2, tile);\n\n if (x === 0) {\n this._addTileFeatures(\n tree.range(1 - p / z2, top, 1, bottom),\n tree.points, z2, y, z2, tile);\n }\n if (x === z2 - 1) {\n this._addTileFeatures(\n tree.range(0, top, p / z2, bottom),\n tree.points, -1, y, z2, tile);\n }\n\n return tile.features.length ? tile : null;\n },\n\n getClusterExpansionZoom: function (clusterId, clusterZoom) {\n while (clusterZoom < this.options.maxZoom) {\n var children = this.getChildren(clusterId, clusterZoom);\n clusterZoom++;\n if (children.length !== 1) break;\n clusterId = children[0].properties.cluster_id;\n }\n return clusterZoom;\n },\n\n _appendLeaves: function (result, clusterId, clusterZoom, limit, offset, skipped) {\n var children = this.getChildren(clusterId, clusterZoom);\n\n for (var i = 0; i < children.length; i++) {\n var props = children[i].properties;\n\n if (props.cluster) {\n if (skipped + props.point_count <= offset) {\n // skip the whole cluster\n skipped += props.point_count;\n } else {\n // enter the cluster\n skipped = this._appendLeaves(\n result, props.cluster_id, clusterZoom + 1, limit, offset, skipped);\n // exit the cluster\n }\n } else if (skipped < offset) {\n // skip a single point\n skipped++;\n } else {\n // add a single point\n result.push(children[i]);\n }\n if (result.length === limit) break;\n }\n\n return skipped;\n },\n\n _addTileFeatures: function (ids, points, x, y, z2, tile) {\n for (var i = 0; i < ids.length; i++) {\n var c = points[ids[i]];\n tile.features.push({\n type: 1,\n geometry: [[\n Math.round(this.options.extent * (c.x * z2 - x)),\n Math.round(this.options.extent * (c.y * z2 - y))\n ]],\n tags: c.numPoints ? getClusterProperties(c) : this.points[c.id].properties\n });\n }\n },\n\n _limitZoom: function (z) {\n return Math.max(this.options.minZoom, Math.min(z, this.options.maxZoom + 1));\n },\n\n _cluster: function (points, zoom) {\n var clusters = [];\n var r = this.options.radius / (this.options.extent * Math.pow(2, zoom));\n\n // loop through each point\n for (var i = 0; i < points.length; i++) {\n var p = points[i];\n // if we've already visited the point at this zoom level, skip it\n if (p.zoom <= zoom) continue;\n p.zoom = zoom;\n\n // find all nearby points\n var tree = this.trees[zoom + 1];\n var neighborIds = tree.within(p.x, p.y, r);\n\n var numPoints = p.numPoints || 1;\n var wx = p.x * numPoints;\n var wy = p.y * numPoints;\n\n var clusterProperties = null;\n\n if (this.options.reduce) {\n clusterProperties = this.options.initial();\n this._accumulate(clusterProperties, p);\n }\n\n for (var j = 0; j < neighborIds.length; j++) {\n var b = tree.points[neighborIds[j]];\n // filter out neighbors that are too far or already processed\n if (zoom < b.zoom) {\n var numPoints2 = b.numPoints || 1;\n b.zoom = zoom; // save the zoom (so it doesn't get processed twice)\n wx += b.x * numPoints2; // accumulate coordinates for calculating weighted center\n wy += b.y * numPoints2;\n numPoints += numPoints2;\n b.parentId = i;\n\n if (this.options.reduce) {\n this._accumulate(clusterProperties, b);\n }\n }\n }\n\n if (numPoints === 1) {\n clusters.push(p);\n } else {\n p.parentId = i;\n clusters.push(createCluster(wx / numPoints, wy / numPoints, numPoints, i, clusterProperties));\n }\n }\n\n return clusters;\n },\n\n _accumulate: function (clusterProperties, point) {\n var properties = point.numPoints ?\n point.properties :\n this.options.map(this.points[point.id].properties);\n\n this.options.reduce(clusterProperties, properties);\n }\n};\n\nfunction createCluster(x, y, numPoints, id, properties) {\n return {\n x: x, // weighted cluster center\n y: y,\n zoom: Infinity, // the last zoom the cluster was processed at\n id: id, // index of the first child of the cluster in the zoom level tree\n properties: properties,\n parentId: -1, // parent cluster id\n numPoints: numPoints\n };\n}\n\nfunction createPointCluster(p, id) {\n var coords = p.geometry.coordinates;\n return {\n x: lngX(coords[0]), // projected point coordinates\n y: latY(coords[1]),\n zoom: Infinity, // the last zoom the point was processed at\n id: id, // index of the source feature in the original input array\n parentId: -1 // parent cluster id\n };\n}\n\nfunction getClusterJSON(cluster) {\n return {\n type: 'Feature',\n properties: getClusterProperties(cluster),\n geometry: {\n type: 'Point',\n coordinates: [xLng(cluster.x), yLat(cluster.y)]\n }\n };\n}\n\nfunction getClusterProperties(cluster) {\n var count = cluster.numPoints;\n var abbrev = count >= 10000 ? Math.round(count / 1000) + 'k' :\n count >= 1000 ? (Math.round(count / 100) / 10) + 'k' : count;\n return extend(extend({}, cluster.properties), {\n cluster: true,\n cluster_id: cluster.id,\n point_count: count,\n point_count_abbreviated: abbrev\n });\n}\n\n// longitude/latitude to spherical mercator in [0..1] range\nfunction lngX(lng) {\n return lng / 360 + 0.5;\n}\nfunction latY(lat) {\n var sin = Math.sin(lat * Math.PI / 180),\n y = (0.5 - 0.25 * Math.log((1 + sin) / (1 - sin)) / Math.PI);\n return y < 0 ? 0 :\n y > 1 ? 1 : y;\n}\n\n// spherical mercator to longitude/latitude\nfunction xLng(x) {\n return (x - 0.5) * 360;\n}\nfunction yLat(y) {\n var y2 = (180 - y * 360) * Math.PI / 180;\n return 360 * Math.atan(Math.exp(y2)) / Math.PI - 90;\n}\n\nfunction extend(dest, src) {\n for (var id in src) dest[id] = src[id];\n return dest;\n}\n\nfunction getX(p) {\n return p.x;\n}\nfunction getY(p) {\n return p.y;\n}\n","\n// calculate simplification data using optimized Douglas-Peucker algorithm\n\nexport default function simplify(coords, first, last, sqTolerance) {\n var maxSqDist = sqTolerance;\n var index;\n\n var ax = coords[first];\n var ay = coords[first + 1];\n var bx = coords[last];\n var by = coords[last + 1];\n\n for (var i = first + 3; i < last; i += 3) {\n var d = getSqSegDist(coords[i], coords[i + 1], ax, ay, bx, by);\n if (d > maxSqDist) {\n index = i;\n maxSqDist = d;\n }\n }\n\n if (maxSqDist > sqTolerance) {\n if (index - first > 3) simplify(coords, first, index, sqTolerance);\n coords[index + 2] = maxSqDist;\n if (last - index > 3) simplify(coords, index, last, sqTolerance);\n }\n}\n\n// square distance from a point to a segment\nfunction getSqSegDist(px, py, x, y, bx, by) {\n\n var dx = bx - x;\n var dy = by - y;\n\n if (dx !== 0 || dy !== 0) {\n\n var t = ((px - x) * dx + (py - y) * dy) / (dx * dx + dy * dy);\n\n if (t > 1) {\n x = bx;\n y = by;\n\n } else if (t > 0) {\n x += dx * t;\n y += dy * t;\n }\n }\n\n dx = px - x;\n dy = py - y;\n\n return dx * dx + dy * dy;\n}\n","\nexport default function createFeature(id, type, geom, tags) {\n var feature = {\n id: id || null,\n type: type,\n geometry: geom,\n tags: tags,\n minX: Infinity,\n minY: Infinity,\n maxX: -Infinity,\n maxY: -Infinity\n };\n calcBBox(feature);\n return feature;\n}\n\nfunction calcBBox(feature) {\n var geom = feature.geometry;\n var type = feature.type;\n\n if (type === 'Point' || type === 'MultiPoint' || type === 'LineString') {\n calcLineBBox(feature, geom);\n\n } else if (type === 'Polygon' || type === 'MultiLineString') {\n for (var i = 0; i < geom.length; i++) {\n calcLineBBox(feature, geom[i]);\n }\n\n } else if (type === 'MultiPolygon') {\n for (i = 0; i < geom.length; i++) {\n for (var j = 0; j < geom[i].length; j++) {\n calcLineBBox(feature, geom[i][j]);\n }\n }\n }\n}\n\nfunction calcLineBBox(feature, geom) {\n for (var i = 0; i < geom.length; i += 3) {\n feature.minX = Math.min(feature.minX, geom[i]);\n feature.minY = Math.min(feature.minY, geom[i + 1]);\n feature.maxX = Math.max(feature.maxX, geom[i]);\n feature.maxY = Math.max(feature.maxY, geom[i + 1]);\n }\n}\n","\nimport simplify from './simplify';\nimport createFeature from './feature';\n\n// converts GeoJSON feature into an intermediate projected JSON vector format with simplification data\n\nexport default function convert(data, options) {\n var features = [];\n\n if (data.type === 'FeatureCollection') {\n for (var i = 0; i < data.features.length; i++) {\n convertFeature(features, data.features[i], options);\n }\n\n } else if (data.type === 'Feature') {\n convertFeature(features, data, options);\n\n } else {\n // single geometry or a geometry collection\n convertFeature(features, {geometry: data}, options);\n }\n\n return features;\n}\n\nfunction convertFeature(features, geojson, options) {\n if (!geojson.geometry) return;\n\n var coords = geojson.geometry.coordinates;\n var type = geojson.geometry.type;\n var tolerance = Math.pow(options.tolerance / ((1 << options.maxZoom) * options.extent), 2);\n var geometry = [];\n\n if (type === 'Point') {\n convertPoint(coords, geometry);\n\n } else if (type === 'MultiPoint') {\n for (var i = 0; i < coords.length; i++) {\n convertPoint(coords[i], geometry);\n }\n\n } else if (type === 'LineString') {\n convertLine(coords, geometry, tolerance, false);\n\n } else if (type === 'MultiLineString') {\n if (options.lineMetrics) {\n // explode into linestrings to be able to track metrics\n for (i = 0; i < coords.length; i++) {\n geometry = [];\n convertLine(coords[i], geometry, tolerance, false);\n features.push(createFeature(geojson.id, 'LineString', geometry, geojson.properties));\n return;\n }\n } else {\n convertLines(coords, geometry, tolerance, false);\n }\n\n } else if (type === 'Polygon') {\n convertLines(coords, geometry, tolerance, true);\n\n } else if (type === 'MultiPolygon') {\n for (i = 0; i < coords.length; i++) {\n var polygon = [];\n convertLines(coords[i], polygon, tolerance, true);\n geometry.push(polygon);\n }\n } else if (type === 'GeometryCollection') {\n for (i = 0; i < geojson.geometry.geometries.length; i++) {\n convertFeature(features, {\n id: geojson.id,\n geometry: geojson.geometry.geometries[i],\n properties: geojson.properties\n }, options);\n }\n return;\n } else {\n throw new Error('Input data is not a valid GeoJSON object.');\n }\n\n features.push(createFeature(geojson.id, type, geometry, geojson.properties));\n}\n\nfunction convertPoint(coords, out) {\n out.push(projectX(coords[0]));\n out.push(projectY(coords[1]));\n out.push(0);\n}\n\nfunction convertLine(ring, out, tolerance, isPolygon) {\n var x0, y0;\n var size = 0;\n\n for (var j = 0; j < ring.length; j++) {\n var x = projectX(ring[j][0]);\n var y = projectY(ring[j][1]);\n\n out.push(x);\n out.push(y);\n out.push(0);\n\n if (j > 0) {\n if (isPolygon) {\n size += (x0 * y - x * y0) / 2; // area\n } else {\n size += Math.sqrt(Math.pow(x - x0, 2) + Math.pow(y - y0, 2)); // length\n }\n }\n x0 = x;\n y0 = y;\n }\n\n var last = out.length - 3;\n out[2] = 1;\n simplify(out, 0, last, tolerance);\n out[last + 2] = 1;\n\n out.size = Math.abs(size);\n out.start = 0;\n out.end = out.size;\n}\n\nfunction convertLines(rings, out, tolerance, isPolygon) {\n for (var i = 0; i < rings.length; i++) {\n var geom = [];\n convertLine(rings[i], geom, tolerance, isPolygon);\n out.push(geom);\n }\n}\n\nfunction projectX(x) {\n return x / 360 + 0.5;\n}\n\nfunction projectY(y) {\n var sin = Math.sin(y * Math.PI / 180);\n var y2 = 0.5 - 0.25 * Math.log((1 + sin) / (1 - sin)) / Math.PI;\n return y2 < 0 ? 0 : y2 > 1 ? 1 : y2;\n}\n","\nimport createFeature from './feature';\n\n/* clip features between two axis-parallel lines:\n * | |\n * ___|___ | /\n * / | \\____|____/\n * | |\n */\n\nexport default function clip(features, scale, k1, k2, axis, minAll, maxAll, options) {\n\n k1 /= scale;\n k2 /= scale;\n\n if (minAll >= k1 && maxAll <= k2) return features; // trivial accept\n else if (minAll > k2 || maxAll < k1) return null; // trivial reject\n\n var clipped = [];\n\n for (var i = 0; i < features.length; i++) {\n\n var feature = features[i];\n var geometry = feature.geometry;\n var type = feature.type;\n\n var min = axis === 0 ? feature.minX : feature.minY;\n var max = axis === 0 ? feature.maxX : feature.maxY;\n\n if (min >= k1 && max <= k2) { // trivial accept\n clipped.push(feature);\n continue;\n } else if (min > k2 || max < k1) { // trivial reject\n continue;\n }\n\n var newGeometry = [];\n\n if (type === 'Point' || type === 'MultiPoint') {\n clipPoints(geometry, newGeometry, k1, k2, axis);\n\n } else if (type === 'LineString') {\n clipLine(geometry, newGeometry, k1, k2, axis, false, options.lineMetrics);\n\n } else if (type === 'MultiLineString') {\n clipLines(geometry, newGeometry, k1, k2, axis, false);\n\n } else if (type === 'Polygon') {\n clipLines(geometry, newGeometry, k1, k2, axis, true);\n\n } else if (type === 'MultiPolygon') {\n for (var j = 0; j < geometry.length; j++) {\n var polygon = [];\n clipLines(geometry[j], polygon, k1, k2, axis, true);\n if (polygon.length) {\n newGeometry.push(polygon);\n }\n }\n }\n\n if (newGeometry.length) {\n if (options.lineMetrics && type === 'LineString') {\n for (j = 0; j < newGeometry.length; j++) {\n clipped.push(createFeature(feature.id, type, newGeometry[j], feature.tags));\n }\n continue;\n }\n\n if (type === 'LineString' || type === 'MultiLineString') {\n if (newGeometry.length === 1) {\n type = 'LineString';\n newGeometry = newGeometry[0];\n } else {\n type = 'MultiLineString';\n }\n }\n if (type === 'Point' || type === 'MultiPoint') {\n type = newGeometry.length === 3 ? 'Point' : 'MultiPoint';\n }\n\n clipped.push(createFeature(feature.id, type, newGeometry, feature.tags));\n }\n }\n\n return clipped.length ? clipped : null;\n}\n\nfunction clipPoints(geom, newGeom, k1, k2, axis) {\n for (var i = 0; i < geom.length; i += 3) {\n var a = geom[i + axis];\n\n if (a >= k1 && a <= k2) {\n newGeom.push(geom[i]);\n newGeom.push(geom[i + 1]);\n newGeom.push(geom[i + 2]);\n }\n }\n}\n\nfunction clipLine(geom, newGeom, k1, k2, axis, isPolygon, trackMetrics) {\n\n var slice = newSlice(geom);\n var intersect = axis === 0 ? intersectX : intersectY;\n var len = geom.start;\n var segLen, t;\n\n for (var i = 0; i < geom.length - 3; i += 3) {\n var ax = geom[i];\n var ay = geom[i + 1];\n var az = geom[i + 2];\n var bx = geom[i + 3];\n var by = geom[i + 4];\n var a = axis === 0 ? ax : ay;\n var b = axis === 0 ? bx : by;\n var exited = false;\n\n if (trackMetrics) segLen = Math.sqrt(Math.pow(ax - bx, 2) + Math.pow(ay - by, 2));\n\n if (a < k1) {\n // ---|--> | (line enters the clip region from the left)\n if (b >= k1) {\n t = intersect(slice, ax, ay, bx, by, k1);\n if (trackMetrics) slice.start = len + segLen * t;\n }\n } else if (a > k2) {\n // | <--|--- (line enters the clip region from the right)\n if (b <= k2) {\n t = intersect(slice, ax, ay, bx, by, k2);\n if (trackMetrics) slice.start = len + segLen * t;\n }\n } else {\n addPoint(slice, ax, ay, az);\n }\n if (b < k1 && a >= k1) {\n // <--|--- | or <--|-----|--- (line exits the clip region on the left)\n t = intersect(slice, ax, ay, bx, by, k1);\n exited = true;\n }\n if (b > k2 && a <= k2) {\n // | ---|--> or ---|-----|--> (line exits the clip region on the right)\n t = intersect(slice, ax, ay, bx, by, k2);\n exited = true;\n }\n\n if (!isPolygon && exited) {\n if (trackMetrics) slice.end = len + segLen * t;\n newGeom.push(slice);\n slice = newSlice(geom);\n }\n\n if (trackMetrics) len += segLen;\n }\n\n // add the last point\n var last = geom.length - 3;\n ax = geom[last];\n ay = geom[last + 1];\n az = geom[last + 2];\n a = axis === 0 ? ax : ay;\n if (a >= k1 && a <= k2) addPoint(slice, ax, ay, az);\n\n // close the polygon if its endpoints are not the same after clipping\n last = slice.length - 3;\n if (isPolygon && last >= 3 && (slice[last] !== slice[0] || slice[last + 1] !== slice[1])) {\n addPoint(slice, slice[0], slice[1], slice[2]);\n }\n\n // add the final slice\n if (slice.length) {\n newGeom.push(slice);\n }\n}\n\nfunction newSlice(line) {\n var slice = [];\n slice.size = line.size;\n slice.start = line.start;\n slice.end = line.end;\n return slice;\n}\n\nfunction clipLines(geom, newGeom, k1, k2, axis, isPolygon) {\n for (var i = 0; i < geom.length; i++) {\n clipLine(geom[i], newGeom, k1, k2, axis, isPolygon, false);\n }\n}\n\nfunction addPoint(out, x, y, z) {\n out.push(x);\n out.push(y);\n out.push(z);\n}\n\nfunction intersectX(out, ax, ay, bx, by, x) {\n var t = (x - ax) / (bx - ax);\n out.push(x);\n out.push(ay + (by - ay) * t);\n out.push(1);\n return t;\n}\n\nfunction intersectY(out, ax, ay, bx, by, y) {\n var t = (y - ay) / (by - ay);\n out.push(ax + (bx - ax) * t);\n out.push(y);\n out.push(1);\n return t;\n}\n","\nimport clip from './clip';\nimport createFeature from './feature';\n\nexport default function wrap(features, options) {\n var buffer = options.buffer / options.extent;\n var merged = features;\n var left = clip(features, 1, -1 - buffer, buffer, 0, -1, 2, options); // left world copy\n var right = clip(features, 1, 1 - buffer, 2 + buffer, 0, -1, 2, options); // right world copy\n\n if (left || right) {\n merged = clip(features, 1, -buffer, 1 + buffer, 0, -1, 2, options) || []; // center world copy\n\n if (left) merged = shiftFeatureCoords(left, 1).concat(merged); // merge left into center\n if (right) merged = merged.concat(shiftFeatureCoords(right, -1)); // merge right into center\n }\n\n return merged;\n}\n\nfunction shiftFeatureCoords(features, offset) {\n var newFeatures = [];\n\n for (var i = 0; i < features.length; i++) {\n var feature = features[i],\n type = feature.type;\n\n var newGeometry;\n\n if (type === 'Point' || type === 'MultiPoint' || type === 'LineString') {\n newGeometry = shiftCoords(feature.geometry, offset);\n\n } else if (type === 'MultiLineString' || type === 'Polygon') {\n newGeometry = [];\n for (var j = 0; j < feature.geometry.length; j++) {\n newGeometry.push(shiftCoords(feature.geometry[j], offset));\n }\n } else if (type === 'MultiPolygon') {\n newGeometry = [];\n for (j = 0; j < feature.geometry.length; j++) {\n var newPolygon = [];\n for (var k = 0; k < feature.geometry[j].length; k++) {\n newPolygon.push(shiftCoords(feature.geometry[j][k], offset));\n }\n newGeometry.push(newPolygon);\n }\n }\n\n newFeatures.push(createFeature(feature.id, type, newGeometry, feature.tags));\n }\n\n return newFeatures;\n}\n\nfunction shiftCoords(points, offset) {\n var newPoints = [];\n newPoints.size = points.size;\n\n if (points.start !== undefined) {\n newPoints.start = points.start;\n newPoints.end = points.end;\n }\n\n for (var i = 0; i < points.length; i += 3) {\n newPoints.push(points[i] + offset, points[i + 1], points[i + 2]);\n }\n return newPoints;\n}\n","\n// Transforms the coordinates of each feature in the given tile from\n// mercator-projected space into (extent x extent) tile space.\nexport default function transformTile(tile, extent) {\n if (tile.transformed) return tile;\n\n var z2 = 1 << tile.z,\n tx = tile.x,\n ty = tile.y,\n i, j, k;\n\n for (i = 0; i < tile.features.length; i++) {\n var feature = tile.features[i],\n geom = feature.geometry,\n type = feature.type;\n\n feature.geometry = [];\n\n if (type === 1) {\n for (j = 0; j < geom.length; j += 2) {\n feature.geometry.push(transformPoint(geom[j], geom[j + 1], extent, z2, tx, ty));\n }\n } else {\n for (j = 0; j < geom.length; j++) {\n var ring = [];\n for (k = 0; k < geom[j].length; k += 2) {\n ring.push(transformPoint(geom[j][k], geom[j][k + 1], extent, z2, tx, ty));\n }\n feature.geometry.push(ring);\n }\n }\n }\n\n tile.transformed = true;\n\n return tile;\n}\n\nfunction transformPoint(x, y, extent, z2, tx, ty) {\n return [\n Math.round(extent * (x * z2 - tx)),\n Math.round(extent * (y * z2 - ty))];\n}\n","\nexport default function createTile(features, z, tx, ty, options) {\n var tolerance = z === options.maxZoom ? 0 : options.tolerance / ((1 << z) * options.extent);\n var tile = {\n features: [],\n numPoints: 0,\n numSimplified: 0,\n numFeatures: 0,\n source: null,\n x: tx,\n y: ty,\n z: z,\n transformed: false,\n minX: 2,\n minY: 1,\n maxX: -1,\n maxY: 0\n };\n for (var i = 0; i < features.length; i++) {\n tile.numFeatures++;\n addFeature(tile, features[i], tolerance, options);\n\n var minX = features[i].minX;\n var minY = features[i].minY;\n var maxX = features[i].maxX;\n var maxY = features[i].maxY;\n\n if (minX < tile.minX) tile.minX = minX;\n if (minY < tile.minY) tile.minY = minY;\n if (maxX > tile.maxX) tile.maxX = maxX;\n if (maxY > tile.maxY) tile.maxY = maxY;\n }\n return tile;\n}\n\nfunction addFeature(tile, feature, tolerance, options) {\n\n var geom = feature.geometry,\n type = feature.type,\n simplified = [];\n\n if (type === 'Point' || type === 'MultiPoint') {\n for (var i = 0; i < geom.length; i += 3) {\n simplified.push(geom[i]);\n simplified.push(geom[i + 1]);\n tile.numPoints++;\n tile.numSimplified++;\n }\n\n } else if (type === 'LineString') {\n addLine(simplified, geom, tile, tolerance, false, false);\n\n } else if (type === 'MultiLineString' || type === 'Polygon') {\n for (i = 0; i < geom.length; i++) {\n addLine(simplified, geom[i], tile, tolerance, type === 'Polygon', i === 0);\n }\n\n } else if (type === 'MultiPolygon') {\n\n for (var k = 0; k < geom.length; k++) {\n var polygon = geom[k];\n for (i = 0; i < polygon.length; i++) {\n addLine(simplified, polygon[i], tile, tolerance, true, i === 0);\n }\n }\n }\n\n if (simplified.length) {\n var tags = feature.tags || null;\n if (type === 'LineString' && options.lineMetrics) {\n tags = {};\n for (var key in feature.tags) tags[key] = feature.tags[key];\n tags['mapbox_clip_start'] = geom.start / geom.size;\n tags['mapbox_clip_end'] = geom.end / geom.size;\n }\n var tileFeature = {\n geometry: simplified,\n type: type === 'Polygon' || type === 'MultiPolygon' ? 3 :\n type === 'LineString' || type === 'MultiLineString' ? 2 : 1,\n tags: tags\n };\n if (feature.id !== null) {\n tileFeature.id = feature.id;\n }\n tile.features.push(tileFeature);\n }\n}\n\nfunction addLine(result, geom, tile, tolerance, isPolygon, isOuter) {\n var sqTolerance = tolerance * tolerance;\n\n if (tolerance > 0 && (geom.size < (isPolygon ? sqTolerance : tolerance))) {\n tile.numPoints += geom.length / 3;\n return;\n }\n\n var ring = [];\n\n for (var i = 0; i < geom.length; i += 3) {\n if (tolerance === 0 || geom[i + 2] > sqTolerance) {\n tile.numSimplified++;\n ring.push(geom[i]);\n ring.push(geom[i + 1]);\n }\n tile.numPoints++;\n }\n\n if (isPolygon) rewind(ring, isOuter);\n\n result.push(ring);\n}\n\nfunction rewind(ring, clockwise) {\n var area = 0;\n for (var i = 0, len = ring.length, j = len - 2; i < len; j = i, i += 2) {\n area += (ring[i] - ring[j]) * (ring[i + 1] + ring[j + 1]);\n }\n if (area > 0 === clockwise) {\n for (i = 0, len = ring.length; i < len / 2; i += 2) {\n var x = ring[i];\n var y = ring[i + 1];\n ring[i] = ring[len - 2 - i];\n ring[i + 1] = ring[len - 1 - i];\n ring[len - 2 - i] = x;\n ring[len - 1 - i] = y;\n }\n }\n}\n","\nimport convert from './convert'; // GeoJSON conversion and preprocessing\nimport clip from './clip'; // stripe clipping algorithm\nimport wrap from './wrap'; // date line processing\nimport transform from './transform'; // coordinate transformation\nimport createTile from './tile'; // final simplified tile generation\n\nexport default function geojsonvt(data, options) {\n return new GeoJSONVT(data, options);\n}\n\nfunction GeoJSONVT(data, options) {\n options = this.options = extend(Object.create(this.options), options);\n\n var debug = options.debug;\n\n if (debug) console.time('preprocess data');\n\n if (options.maxZoom < 0 || options.maxZoom > 24) throw new Error('maxZoom should be in the 0-24 range');\n\n var features = convert(data, options);\n\n this.tiles = {};\n this.tileCoords = [];\n\n if (debug) {\n console.timeEnd('preprocess data');\n console.log('index: maxZoom: %d, maxPoints: %d', options.indexMaxZoom, options.indexMaxPoints);\n console.time('generate tiles');\n this.stats = {};\n this.total = 0;\n }\n\n features = wrap(features, options);\n\n // start slicing from the top tile down\n if (features.length) this.splitTile(features, 0, 0, 0);\n\n if (debug) {\n if (features.length) console.log('features: %d, points: %d', this.tiles[0].numFeatures, this.tiles[0].numPoints);\n console.timeEnd('generate tiles');\n console.log('tiles generated:', this.total, JSON.stringify(this.stats));\n }\n}\n\nGeoJSONVT.prototype.options = {\n maxZoom: 14, // max zoom to preserve detail on\n indexMaxZoom: 5, // max zoom in the tile index\n indexMaxPoints: 100000, // max number of points per tile in the tile index\n tolerance: 3, // simplification tolerance (higher means simpler)\n extent: 4096, // tile extent\n buffer: 64, // tile buffer on each side\n lineMetrics: false, // whether to calculate line metrics\n debug: 0 // logging level (0, 1 or 2)\n};\n\nGeoJSONVT.prototype.splitTile = function (features, z, x, y, cz, cx, cy) {\n\n var stack = [features, z, x, y],\n options = this.options,\n debug = options.debug;\n\n // avoid recursion by using a processing queue\n while (stack.length) {\n y = stack.pop();\n x = stack.pop();\n z = stack.pop();\n features = stack.pop();\n\n var z2 = 1 << z,\n id = toID(z, x, y),\n tile = this.tiles[id];\n\n if (!tile) {\n if (debug > 1) console.time('creation');\n\n tile = this.tiles[id] = createTile(features, z, x, y, options);\n this.tileCoords.push({z: z, x: x, y: y});\n\n if (debug) {\n if (debug > 1) {\n console.log('tile z%d-%d-%d (features: %d, points: %d, simplified: %d)',\n z, x, y, tile.numFeatures, tile.numPoints, tile.numSimplified);\n console.timeEnd('creation');\n }\n var key = 'z' + z;\n this.stats[key] = (this.stats[key] || 0) + 1;\n this.total++;\n }\n }\n\n // save reference to original geometry in tile so that we can drill down later if we stop now\n tile.source = features;\n\n // if it's the first-pass tiling\n if (!cz) {\n // stop tiling if we reached max zoom, or if the tile is too simple\n if (z === options.indexMaxZoom || tile.numPoints <= options.indexMaxPoints) continue;\n\n // if a drilldown to a specific tile\n } else {\n // stop tiling if we reached base zoom or our target tile zoom\n if (z === options.maxZoom || z === cz) continue;\n\n // stop tiling if it's not an ancestor of the target tile\n var m = 1 << (cz - z);\n if (x !== Math.floor(cx / m) || y !== Math.floor(cy / m)) continue;\n }\n\n // if we slice further down, no need to keep source geometry\n tile.source = null;\n\n if (features.length === 0) continue;\n\n if (debug > 1) console.time('clipping');\n\n // values we'll use for clipping\n var k1 = 0.5 * options.buffer / options.extent,\n k2 = 0.5 - k1,\n k3 = 0.5 + k1,\n k4 = 1 + k1,\n tl, bl, tr, br, left, right;\n\n tl = bl = tr = br = null;\n\n left = clip(features, z2, x - k1, x + k3, 0, tile.minX, tile.maxX, options);\n right = clip(features, z2, x + k2, x + k4, 0, tile.minX, tile.maxX, options);\n features = null;\n\n if (left) {\n tl = clip(left, z2, y - k1, y + k3, 1, tile.minY, tile.maxY, options);\n bl = clip(left, z2, y + k2, y + k4, 1, tile.minY, tile.maxY, options);\n left = null;\n }\n\n if (right) {\n tr = clip(right, z2, y - k1, y + k3, 1, tile.minY, tile.maxY, options);\n br = clip(right, z2, y + k2, y + k4, 1, tile.minY, tile.maxY, options);\n right = null;\n }\n\n if (debug > 1) console.timeEnd('clipping');\n\n stack.push(tl || [], z + 1, x * 2, y * 2);\n stack.push(bl || [], z + 1, x * 2, y * 2 + 1);\n stack.push(tr || [], z + 1, x * 2 + 1, y * 2);\n stack.push(br || [], z + 1, x * 2 + 1, y * 2 + 1);\n }\n};\n\nGeoJSONVT.prototype.getTile = function (z, x, y) {\n var options = this.options,\n extent = options.extent,\n debug = options.debug;\n\n if (z < 0 || z > 24) return null;\n\n var z2 = 1 << z;\n x = ((x % z2) + z2) % z2; // wrap tile x coordinate\n\n var id = toID(z, x, y);\n if (this.tiles[id]) return transform(this.tiles[id], extent);\n\n if (debug > 1) console.log('drilling down to z%d-%d-%d', z, x, y);\n\n var z0 = z,\n x0 = x,\n y0 = y,\n parent;\n\n while (!parent && z0 > 0) {\n z0--;\n x0 = Math.floor(x0 / 2);\n y0 = Math.floor(y0 / 2);\n parent = this.tiles[toID(z0, x0, y0)];\n }\n\n if (!parent || !parent.source) return null;\n\n // if we found a parent tile containing the original geometry, we can drill down from it\n if (debug > 1) console.log('found parent tile z%d-%d-%d', z0, x0, y0);\n\n if (debug > 1) console.time('drilling down');\n this.splitTile(parent.source, z0, x0, y0, z, x, y);\n if (debug > 1) console.timeEnd('drilling down');\n\n return this.tiles[id] ? transform(this.tiles[id], extent) : null;\n};\n\nfunction toID(z, x, y) {\n return (((1 << z) * y + x) * 32) + z;\n}\n\nfunction extend(dest, src) {\n for (var i in src) dest[i] = src[i];\n return dest;\n}\n","// @flow\n\nimport { getJSON } from '../util/ajax';\n\nimport perf from '../util/performance';\nimport rewind from 'geojson-rewind';\nimport GeoJSONWrapper from './geojson_wrapper';\nimport vtpbf from 'vt-pbf';\nimport supercluster from 'supercluster';\nimport geojsonvt from 'geojson-vt';\nimport assert from 'assert';\nimport VectorTileWorkerSource from './vector_tile_worker_source';\n\nimport type {\n WorkerTileParameters,\n WorkerTileCallback,\n} from '../source/worker_source';\n\nimport type Actor from '../util/actor';\nimport type StyleLayerIndex from '../style/style_layer_index';\n\nimport type {LoadVectorDataCallback} from './vector_tile_worker_source';\nimport type {RequestParameters} from '../util/ajax';\nimport type { Callback } from '../types/callback';\n\nexport type GeoJSON = Object;\n\nexport type LoadGeoJSONParameters = {\n request?: RequestParameters,\n data?: string,\n source: string,\n superclusterOptions?: Object,\n geojsonVtOptions?: Object\n};\n\nexport type LoadGeoJSON = (params: LoadGeoJSONParameters, callback: Callback) => void;\n\nexport interface GeoJSONIndex {\n}\n\nfunction loadGeoJSONTile(params: WorkerTileParameters, callback: LoadVectorDataCallback) {\n const canonical = params.tileID.canonical;\n\n if (!this._geoJSONIndex) {\n return callback(null, null); // we couldn't load the file\n }\n\n const geoJSONTile = this._geoJSONIndex.getTile(canonical.z, canonical.x, canonical.y);\n if (!geoJSONTile) {\n return callback(null, null); // nothing in the given tile\n }\n\n const geojsonWrapper = new GeoJSONWrapper(geoJSONTile.features);\n\n // Encode the geojson-vt tile into binary vector tile form form. This\n // is a convenience that allows `FeatureIndex` to operate the same way\n // across `VectorTileSource` and `GeoJSONSource` data.\n let pbf = vtpbf(geojsonWrapper);\n if (pbf.byteOffset !== 0 || pbf.byteLength !== pbf.buffer.byteLength) {\n // Compatibility with node Buffer (https://github.com/mapbox/pbf/issues/35)\n pbf = new Uint8Array(pbf);\n }\n\n callback(null, {\n vectorTile: geojsonWrapper,\n rawData: pbf.buffer\n });\n}\n\nexport type SourceState =\n | 'Idle' // Source empty or data loaded\n | 'Coalescing' // Data finished loading, but discard 'loadData' messages until receiving 'coalesced'\n | 'NeedsLoadData'; // 'loadData' received while coalescing, trigger one more 'loadData' on receiving 'coalesced'\n\n/**\n * The {@link WorkerSource} implementation that supports {@link GeoJSONSource}.\n * This class is designed to be easily reused to support custom source types\n * for data formats that can be parsed/converted into an in-memory GeoJSON\n * representation. To do so, create it with\n * `new GeoJSONWorkerSource(actor, layerIndex, customLoadGeoJSONFunction)`.\n * For a full example, see [mapbox-gl-topojson](https://github.com/developmentseed/mapbox-gl-topojson).\n *\n * @private\n */\nclass GeoJSONWorkerSource extends VectorTileWorkerSource {\n loadGeoJSON: LoadGeoJSON;\n _state: SourceState;\n _pendingCallback: Callback<{\n resourceTiming?: {[string]: Array},\n abandoned?: boolean }>;\n _pendingLoadDataParams: LoadGeoJSONParameters;\n _geoJSONIndex: GeoJSONIndex\n\n /**\n * @param [loadGeoJSON] Optional method for custom loading/parsing of\n * GeoJSON based on parameters passed from the main-thread Source.\n * See {@link GeoJSONWorkerSource#loadGeoJSON}.\n */\n constructor(actor: Actor, layerIndex: StyleLayerIndex, loadGeoJSON: ?LoadGeoJSON) {\n super(actor, layerIndex, loadGeoJSONTile);\n if (loadGeoJSON) {\n this.loadGeoJSON = loadGeoJSON;\n }\n }\n\n /**\n * Fetches (if appropriate), parses, and index geojson data into tiles. This\n * preparatory method must be called before {@link GeoJSONWorkerSource#loadTile}\n * can correctly serve up tiles.\n *\n * Defers to {@link GeoJSONWorkerSource#loadGeoJSON} for the fetching/parsing,\n * expecting `callback(error, data)` to be called with either an error or a\n * parsed GeoJSON object.\n *\n * When `loadData` requests come in faster than they can be processed,\n * they are coalesced into a single request using the latest data.\n * See {@link GeoJSONWorkerSource#coalesce}\n *\n * @param params\n * @param callback\n */\n loadData(params: LoadGeoJSONParameters, callback: Callback<{\n resourceTiming?: {[string]: Array},\n abandoned?: boolean }>) {\n if (this._pendingCallback) {\n // Tell the foreground the previous call has been abandoned\n this._pendingCallback(null, { abandoned: true });\n }\n this._pendingCallback = callback;\n this._pendingLoadDataParams = params;\n\n if (this._state &&\n this._state !== 'Idle') {\n this._state = 'NeedsLoadData';\n } else {\n this._state = 'Coalescing';\n this._loadData();\n }\n }\n\n /**\n * Internal implementation: called directly by `loadData`\n * or by `coalesce` using stored parameters.\n */\n _loadData() {\n if (!this._pendingCallback || !this._pendingLoadDataParams) {\n assert(false);\n return;\n }\n const callback = this._pendingCallback;\n const params = this._pendingLoadDataParams;\n delete this._pendingCallback;\n delete this._pendingLoadDataParams;\n this.loadGeoJSON(params, (err, data) => {\n if (err || !data) {\n return callback(err);\n } else if (typeof data !== 'object') {\n return callback(new Error(\"Input data is not a valid GeoJSON object.\"));\n } else {\n rewind(data, true);\n\n try {\n this._geoJSONIndex = params.cluster ?\n supercluster(params.superclusterOptions).load(data.features) :\n geojsonvt(data, params.geojsonVtOptions);\n } catch (err) {\n return callback(err);\n }\n\n this.loaded = {};\n\n const result = {};\n if (params.request && params.request.collectResourceTiming) {\n const resourceTimingData = perf.getEntriesByName(params.request.url);\n // it's necessary to eval the result of getEntriesByName() here via parse/stringify\n // late evaluation in the main thread causes TypeError: illegal invocation\n if (resourceTimingData) {\n result.resourceTiming = {};\n result.resourceTiming[params.source] = JSON.parse(JSON.stringify(resourceTimingData));\n }\n }\n callback(null, result);\n }\n });\n }\n\n /**\n * While processing `loadData`, we coalesce all further\n * `loadData` messages into a single call to _loadData\n * that will happen once we've finished processing the\n * first message. {@link GeoJSONSource#_updateWorkerData}\n * is responsible for sending us the `coalesce` message\n * at the time it receives a response from `loadData`\n *\n * State: Idle\n * ↑ |\n * 'coalesce' 'loadData'\n * | (triggers load)\n * | ↓\n * State: Coalescing\n * ↑ |\n * (triggers load) |\n * 'coalesce' 'loadData'\n * | ↓\n * State: NeedsLoadData\n */\n coalesce() {\n if (this._state === 'Coalescing') {\n this._state = 'Idle';\n } else if (this._state === 'NeedsLoadData') {\n this._state = 'Coalescing';\n this._loadData();\n }\n }\n\n /**\n * Implements {@link WorkerSource#reloadTile}.\n *\n * If the tile is loaded, uses the implementation in VectorTileWorkerSource.\n * Otherwise, such as after a setData() call, we load the tile fresh.\n *\n * @param params\n * @param params.uid The UID for this tile.\n */\n reloadTile(params: WorkerTileParameters, callback: WorkerTileCallback) {\n const loaded = this.loaded,\n uid = params.uid;\n\n if (loaded && loaded[uid]) {\n return super.reloadTile(params, callback);\n } else {\n return this.loadTile(params, callback);\n }\n }\n\n /**\n * Fetch and parse GeoJSON according to the given params. Calls `callback`\n * with `(err, data)`, where `data` is a parsed GeoJSON object.\n *\n * GeoJSON is loaded and parsed from `params.url` if it exists, or else\n * expected as a literal (string or object) `params.data`.\n *\n * @param params\n * @param [params.url] A URL to the remote GeoJSON data.\n * @param [params.data] Literal GeoJSON data. Must be provided if `params.url` is not.\n */\n loadGeoJSON(params: LoadGeoJSONParameters, callback: Callback) {\n // Because of same origin issues, urls must either include an explicit\n // origin or absolute path.\n // ie: /foo/bar.json or http://example.com/bar.json\n // but not ../foo/bar.json\n if (params.request) {\n getJSON(params.request, callback);\n } else if (typeof params.data === 'string') {\n try {\n return callback(null, JSON.parse(params.data));\n } catch (e) {\n return callback(new Error(\"Input data is not a valid GeoJSON object.\"));\n }\n } else {\n return callback(new Error(\"Input data is not a valid GeoJSON object.\"));\n }\n }\n\n removeSource(params: {source: string}, callback: Callback) {\n if (this._pendingCallback) {\n // Don't leak callbacks\n this._pendingCallback(null, { abandoned: true });\n }\n callback();\n }\n}\n\nexport default GeoJSONWorkerSource;\n","// @flow\n\nimport Actor from '../util/actor';\n\nimport StyleLayerIndex from '../style/style_layer_index';\nimport VectorTileWorkerSource from './vector_tile_worker_source';\nimport RasterDEMTileWorkerSource from './raster_dem_tile_worker_source';\nimport GeoJSONWorkerSource from './geojson_worker_source';\nimport assert from 'assert';\nimport { plugin as globalRTLTextPlugin } from './rtl_text_plugin';\n\nimport type {\n WorkerSource,\n WorkerTileParameters,\n WorkerDEMTileParameters,\n WorkerTileCallback,\n WorkerDEMTileCallback,\n TileParameters\n} from '../source/worker_source';\n\nimport type {WorkerGlobalScopeInterface} from '../util/web_worker';\nimport type {Callback} from '../types/callback';\n\n/**\n * @private\n */\nexport default class Worker {\n self: WorkerGlobalScopeInterface;\n actor: Actor;\n layerIndexes: { [string]: StyleLayerIndex };\n workerSourceTypes: { [string]: Class };\n workerSources: { [string]: { [string]: { [string]: WorkerSource } } };\n demWorkerSources: { [string]: { [string]: RasterDEMTileWorkerSource } };\n\n constructor(self: WorkerGlobalScopeInterface) {\n this.self = self;\n this.actor = new Actor(self, this);\n\n this.layerIndexes = {};\n\n this.workerSourceTypes = {\n vector: VectorTileWorkerSource,\n geojson: GeoJSONWorkerSource\n };\n\n // [mapId][sourceType][sourceName] => worker source instance\n this.workerSources = {};\n this.demWorkerSources = {};\n\n this.self.registerWorkerSource = (name: string, WorkerSource: Class) => {\n if (this.workerSourceTypes[name]) {\n throw new Error(`Worker source with name \"${name}\" already registered.`);\n }\n this.workerSourceTypes[name] = WorkerSource;\n };\n\n this.self.registerRTLTextPlugin = (rtlTextPlugin: {applyArabicShaping: Function, processBidirectionalText: Function}) => {\n if (globalRTLTextPlugin.isLoaded()) {\n throw new Error('RTL text plugin already registered.');\n }\n globalRTLTextPlugin['applyArabicShaping'] = rtlTextPlugin.applyArabicShaping;\n globalRTLTextPlugin['processBidirectionalText'] = rtlTextPlugin.processBidirectionalText;\n };\n }\n\n setLayers(mapId: string, layers: Array, callback: WorkerTileCallback) {\n this.getLayerIndex(mapId).replace(layers);\n callback();\n }\n\n updateLayers(mapId: string, params: {layers: Array, removedIds: Array}, callback: WorkerTileCallback) {\n this.getLayerIndex(mapId).update(params.layers, params.removedIds);\n callback();\n }\n\n loadTile(mapId: string, params: WorkerTileParameters & {type: string}, callback: WorkerTileCallback) {\n assert(params.type);\n this.getWorkerSource(mapId, params.type, params.source).loadTile(params, callback);\n }\n\n loadDEMTile(mapId: string, params: WorkerDEMTileParameters, callback: WorkerDEMTileCallback) {\n this.getDEMWorkerSource(mapId, params.source).loadTile(params, callback);\n }\n\n reloadTile(mapId: string, params: WorkerTileParameters & {type: string}, callback: WorkerTileCallback) {\n assert(params.type);\n this.getWorkerSource(mapId, params.type, params.source).reloadTile(params, callback);\n }\n\n abortTile(mapId: string, params: TileParameters & {type: string}, callback: WorkerTileCallback) {\n assert(params.type);\n this.getWorkerSource(mapId, params.type, params.source).abortTile(params, callback);\n }\n\n removeTile(mapId: string, params: TileParameters & {type: string}, callback: WorkerTileCallback) {\n assert(params.type);\n this.getWorkerSource(mapId, params.type, params.source).removeTile(params, callback);\n }\n\n removeDEMTile(mapId: string, params: TileParameters) {\n this.getDEMWorkerSource(mapId, params.source).removeTile(params);\n }\n\n removeSource(mapId: string, params: {source: string} & {type: string}, callback: WorkerTileCallback) {\n assert(params.type);\n assert(params.source);\n\n if (!this.workerSources[mapId] ||\n !this.workerSources[mapId][params.type] ||\n !this.workerSources[mapId][params.type][params.source]) {\n return;\n }\n\n const worker = this.workerSources[mapId][params.type][params.source];\n delete this.workerSources[mapId][params.type][params.source];\n\n if (worker.removeSource !== undefined) {\n worker.removeSource(params, callback);\n } else {\n callback();\n }\n }\n\n /**\n * Load a {@link WorkerSource} script at params.url. The script is run\n * (using importScripts) with `registerWorkerSource` in scope, which is a\n * function taking `(name, workerSourceObject)`.\n * @private\n */\n loadWorkerSource(map: string, params: { url: string }, callback: Callback) {\n try {\n this.self.importScripts(params.url);\n callback();\n } catch (e) {\n callback(e.toString());\n }\n }\n\n loadRTLTextPlugin(map: string, pluginURL: string, callback: Callback) {\n try {\n if (!globalRTLTextPlugin.isLoaded()) {\n this.self.importScripts(pluginURL);\n callback(globalRTLTextPlugin.isLoaded() ?\n null :\n new Error(`RTL Text Plugin failed to import scripts from ${pluginURL}`));\n }\n } catch (e) {\n callback(e.toString());\n }\n }\n\n getLayerIndex(mapId: string) {\n let layerIndexes = this.layerIndexes[mapId];\n if (!layerIndexes) {\n layerIndexes = this.layerIndexes[mapId] = new StyleLayerIndex();\n }\n return layerIndexes;\n }\n\n getWorkerSource(mapId: string, type: string, source: string) {\n if (!this.workerSources[mapId])\n this.workerSources[mapId] = {};\n if (!this.workerSources[mapId][type])\n this.workerSources[mapId][type] = {};\n\n if (!this.workerSources[mapId][type][source]) {\n // use a wrapped actor so that we can attach a target mapId param\n // to any messages invoked by the WorkerSource\n const actor = {\n send: (type, data, callback) => {\n this.actor.send(type, data, callback, mapId);\n }\n };\n\n this.workerSources[mapId][type][source] = new (this.workerSourceTypes[type]: any)((actor: any), this.getLayerIndex(mapId));\n }\n\n return this.workerSources[mapId][type][source];\n }\n\n getDEMWorkerSource(mapId: string, source: string) {\n if (!this.demWorkerSources[mapId])\n this.demWorkerSources[mapId] = {};\n\n if (!this.demWorkerSources[mapId][source]) {\n this.demWorkerSources[mapId][source] = new RasterDEMTileWorkerSource();\n }\n\n return this.demWorkerSources[mapId][source];\n }\n}\n\n/* global self, WorkerGlobalScope */\nif (typeof WorkerGlobalScope !== 'undefined' &&\n typeof self !== 'undefined' &&\n self instanceof WorkerGlobalScope) {\n new Worker(self);\n}\n\n","'use strict';\n\nif (typeof module !== 'undefined' && module.exports) {\n module.exports = isSupported;\n} else if (window) {\n window.mapboxgl = window.mapboxgl || {};\n window.mapboxgl.supported = isSupported;\n}\n\n/**\n * Test whether the current browser supports Mapbox GL JS\n * @param {Object} options\n * @param {boolean} [options.failIfMajorPerformanceCaveat=false] Return `false`\n * if the performance of Mapbox GL JS would be dramatically worse than\n * expected (i.e. a software renderer is would be used)\n * @return {boolean}\n */\nfunction isSupported(options) {\n return !!(\n isBrowser() &&\n isArraySupported() &&\n isFunctionSupported() &&\n isObjectSupported() &&\n isJSONSupported() &&\n isWorkerSupported() &&\n isUint8ClampedArraySupported() &&\n isWebGLSupportedCached(options && options.failIfMajorPerformanceCaveat)\n );\n}\n\nfunction isBrowser() {\n return typeof window !== 'undefined' && typeof document !== 'undefined';\n}\n\nfunction isArraySupported() {\n return (\n Array.prototype &&\n Array.prototype.every &&\n Array.prototype.filter &&\n Array.prototype.forEach &&\n Array.prototype.indexOf &&\n Array.prototype.lastIndexOf &&\n Array.prototype.map &&\n Array.prototype.some &&\n Array.prototype.reduce &&\n Array.prototype.reduceRight &&\n Array.isArray\n );\n}\n\nfunction isFunctionSupported() {\n return Function.prototype && Function.prototype.bind;\n}\n\nfunction isObjectSupported() {\n return (\n Object.keys &&\n Object.create &&\n Object.getPrototypeOf &&\n Object.getOwnPropertyNames &&\n Object.isSealed &&\n Object.isFrozen &&\n Object.isExtensible &&\n Object.getOwnPropertyDescriptor &&\n Object.defineProperty &&\n Object.defineProperties &&\n Object.seal &&\n Object.freeze &&\n Object.preventExtensions\n );\n}\n\nfunction isJSONSupported() {\n return 'JSON' in window && 'parse' in JSON && 'stringify' in JSON;\n}\n\nfunction isWorkerSupported() {\n if (!('Worker' in window && 'Blob' in window && 'URL' in window)) {\n return false;\n }\n\n var blob = new Blob([''], { type: 'text/javascript' });\n var workerURL = URL.createObjectURL(blob);\n var supported;\n var worker;\n\n try {\n worker = new Worker(workerURL);\n supported = true;\n } catch (e) {\n supported = false;\n }\n\n if (worker) {\n worker.terminate();\n }\n URL.revokeObjectURL(workerURL);\n\n return supported;\n}\n\n// IE11 only supports `Uint8ClampedArray` as of version\n// [KB2929437](https://support.microsoft.com/en-us/kb/2929437)\nfunction isUint8ClampedArraySupported() {\n return 'Uint8ClampedArray' in window;\n}\n\nvar isWebGLSupportedCache = {};\nfunction isWebGLSupportedCached(failIfMajorPerformanceCaveat) {\n\n if (isWebGLSupportedCache[failIfMajorPerformanceCaveat] === undefined) {\n isWebGLSupportedCache[failIfMajorPerformanceCaveat] = isWebGLSupported(failIfMajorPerformanceCaveat);\n }\n\n return isWebGLSupportedCache[failIfMajorPerformanceCaveat];\n}\n\nisSupported.webGLContextAttributes = {\n antialias: false,\n alpha: true,\n stencil: true,\n depth: true\n};\n\nfunction isWebGLSupported(failIfMajorPerformanceCaveat) {\n\n var canvas = document.createElement('canvas');\n\n var attributes = Object.create(isSupported.webGLContextAttributes);\n attributes.failIfMajorPerformanceCaveat = failIfMajorPerformanceCaveat;\n\n if (canvas.probablySupportsContext) {\n return (\n canvas.probablySupportsContext('webgl', attributes) ||\n canvas.probablySupportsContext('experimental-webgl', attributes)\n );\n\n } else if (canvas.supportsContext) {\n return (\n canvas.supportsContext('webgl', attributes) ||\n canvas.supportsContext('experimental-webgl', attributes)\n );\n\n } else {\n return (\n canvas.getContext('webgl', attributes) ||\n canvas.getContext('experimental-webgl', attributes)\n );\n }\n}\n","// @flow\n\nimport window from './window';\n\nconst now = window.performance && window.performance.now ?\n window.performance.now.bind(window.performance) :\n Date.now.bind(Date);\n\nconst raf = window.requestAnimationFrame ||\n window.mozRequestAnimationFrame ||\n window.webkitRequestAnimationFrame ||\n window.msRequestAnimationFrame;\n\nconst cancel = window.cancelAnimationFrame ||\n window.mozCancelAnimationFrame ||\n window.webkitCancelAnimationFrame ||\n window.msCancelAnimationFrame;\n\n/**\n * @private\n */\nconst exported = {\n /**\n * Provides a function that outputs milliseconds: either performance.now()\n * or a fallback to Date.now()\n */\n now,\n\n frame(fn: Function) {\n return raf(fn);\n },\n\n cancelFrame(id: number) {\n return cancel(id);\n },\n\n getImageData(img: CanvasImageSource): ImageData {\n const canvas = window.document.createElement('canvas');\n const context = canvas.getContext('2d');\n if (!context) {\n throw new Error('failed to create canvas 2d context');\n }\n canvas.width = img.width;\n canvas.height = img.height;\n context.drawImage(img, 0, 0, img.width, img.height);\n return context.getImageData(0, 0, img.width, img.height);\n },\n\n hardwareConcurrency: window.navigator.hardwareConcurrency || 4,\n get devicePixelRatio() { return window.devicePixelRatio; },\n supportsWebp: false\n};\n\nexport default exported;\n\nif (window.document) {\n const webpImgTest = window.document.createElement('img');\n webpImgTest.onload = function() {\n exported.supportsWebp = true;\n };\n webpImgTest.src = 'data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=';\n}\n","// @flow\n\nimport Point from '@mapbox/point-geometry';\n\nimport window from './window';\nimport assert from 'assert';\n\nconst DOM = {};\nexport default DOM;\n\nDOM.create = function (tagName: *, className?: string, container?: HTMLElement) {\n const el = window.document.createElement(tagName);\n if (className) el.className = className;\n if (container) container.appendChild(el);\n return el;\n};\n\nDOM.createNS = function (namespaceURI: string, tagName: string) {\n const el = window.document.createElementNS(namespaceURI, tagName);\n return el;\n};\n\nconst docStyle = window.document ?\n (window.document.documentElement: any).style :\n null;\n\nfunction testProp(props) {\n if (!docStyle) return null;\n for (let i = 0; i < props.length; i++) {\n if (props[i] in docStyle) {\n return props[i];\n }\n }\n return props[0];\n}\n\nconst selectProp = testProp(['userSelect', 'MozUserSelect', 'WebkitUserSelect', 'msUserSelect']);\nlet userSelect;\n\nDOM.disableDrag = function () {\n if (docStyle && selectProp) {\n userSelect = docStyle[selectProp];\n docStyle[selectProp] = 'none';\n }\n};\n\nDOM.enableDrag = function () {\n if (docStyle && selectProp) {\n docStyle[selectProp] = userSelect;\n }\n};\n\nconst transformProp = testProp(['transform', 'WebkitTransform']);\n\nDOM.setTransform = function(el: HTMLElement, value: string) {\n (el.style: any)[transformProp] = value;\n};\n\n// Feature detection for {passive: false} support in add/removeEventListener.\nlet passiveSupported = false;\n\ntry {\n const options = (Object.defineProperty: any)({}, \"passive\", {\n get: function() {\n passiveSupported = true;\n }\n });\n (window.addEventListener: any)(\"test\", options, options);\n (window.removeEventListener: any)(\"test\", options, options);\n} catch (err) {\n passiveSupported = false;\n}\n\nDOM.addEventListener = function(target: *, type: *, callback: *, options: {passive?: boolean, capture?: boolean} = {}) {\n if ('passive' in options && passiveSupported) {\n target.addEventListener(type, callback, (options: any));\n } else {\n target.addEventListener(type, callback, options.capture);\n }\n};\n\nDOM.removeEventListener = function(target: *, type: *, callback: *, options: {passive?: boolean, capture?: boolean} = {}) {\n if ('passive' in options && passiveSupported) {\n target.removeEventListener(type, callback, (options: any));\n } else {\n target.removeEventListener(type, callback, options.capture);\n }\n};\n\n// Suppress the next click, but only if it's immediate.\nconst suppressClick: MouseEventListener = function (e) {\n e.preventDefault();\n e.stopPropagation();\n window.removeEventListener('click', suppressClick, true);\n};\n\nDOM.suppressClick = function() {\n window.addEventListener('click', suppressClick, true);\n window.setTimeout(() => {\n window.removeEventListener('click', suppressClick, true);\n }, 0);\n};\n\nDOM.mousePos = function (el: HTMLElement, e: any) {\n const rect = el.getBoundingClientRect();\n e = e.touches ? e.touches[0] : e;\n return new Point(\n e.clientX - rect.left - el.clientLeft,\n e.clientY - rect.top - el.clientTop\n );\n};\n\nDOM.touchPos = function (el: HTMLElement, e: any) {\n const rect = el.getBoundingClientRect(),\n points = [];\n const touches = (e.type === 'touchend') ? e.changedTouches : e.touches;\n for (let i = 0; i < touches.length; i++) {\n points.push(new Point(\n touches[i].clientX - rect.left - el.clientLeft,\n touches[i].clientY - rect.top - el.clientTop\n ));\n }\n return points;\n};\n\nDOM.mouseButton = function (e: MouseEvent) {\n assert(e.type === 'mousedown' || e.type === 'mouseup');\n if (typeof window.InstallTrigger !== 'undefined' && e.button === 2 && e.ctrlKey &&\n window.navigator.platform.toUpperCase().indexOf('MAC') >= 0) {\n // Fix for https://github.com/mapbox/mapbox-gl-js/issues/3131:\n // Firefox (detected by InstallTrigger) on Mac determines e.button = 2 when\n // using Control + left click\n return 0;\n }\n return e.button;\n};\n\nDOM.remove = function(node: HTMLElement) {\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n};\n","// @flow\n\ntype Config = {|\n API_URL: string,\n REQUIRE_ACCESS_TOKEN: boolean,\n ACCESS_TOKEN: ?string\n|};\n\nconst config: Config = {\n API_URL: 'https://api.mapbox.com',\n REQUIRE_ACCESS_TOKEN: true,\n ACCESS_TOKEN: null\n};\n\nexport default config;\n","// @flow\n\nimport config from './config';\n\nimport browser from './browser';\n\nconst help = 'See https://www.mapbox.com/api-documentation/#access-tokens';\n\ntype UrlObject = {|\n protocol: string,\n authority: string,\n path: string,\n params: Array\n|};\n\nfunction makeAPIURL(urlObject: UrlObject, accessToken: string | null | void): string {\n const apiUrlObject = parseUrl(config.API_URL);\n urlObject.protocol = apiUrlObject.protocol;\n urlObject.authority = apiUrlObject.authority;\n\n if (apiUrlObject.path !== '/') {\n urlObject.path = `${apiUrlObject.path}${urlObject.path}`;\n }\n\n if (!config.REQUIRE_ACCESS_TOKEN) return formatUrl(urlObject);\n\n accessToken = accessToken || config.ACCESS_TOKEN;\n if (!accessToken)\n throw new Error(`An API access token is required to use Mapbox GL. ${help}`);\n if (accessToken[0] === 's')\n throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${help}`);\n\n urlObject.params.push(`access_token=${accessToken}`);\n return formatUrl(urlObject);\n}\n\nfunction isMapboxURL(url: string) {\n return url.indexOf('mapbox:') === 0;\n}\n\nexport { isMapboxURL };\n\nexport const normalizeStyleURL = function(url: string, accessToken?: string): string {\n if (!isMapboxURL(url)) return url;\n const urlObject = parseUrl(url);\n urlObject.path = `/styles/v1${urlObject.path}`;\n return makeAPIURL(urlObject, accessToken);\n};\n\nexport const normalizeGlyphsURL = function(url: string, accessToken?: string): string {\n if (!isMapboxURL(url)) return url;\n const urlObject = parseUrl(url);\n urlObject.path = `/fonts/v1${urlObject.path}`;\n return makeAPIURL(urlObject, accessToken);\n};\n\nexport const normalizeSourceURL = function(url: string, accessToken?: string): string {\n if (!isMapboxURL(url)) return url;\n const urlObject = parseUrl(url);\n urlObject.path = `/v4/${urlObject.authority}.json`;\n // TileJSON requests need a secure flag appended to their URLs so\n // that the server knows to send SSL-ified resource references.\n urlObject.params.push('secure');\n return makeAPIURL(urlObject, accessToken);\n};\n\nexport const normalizeSpriteURL = function(url: string, format: string, extension: string, accessToken?: string): string {\n const urlObject = parseUrl(url);\n if (!isMapboxURL(url)) {\n urlObject.path += `${format}${extension}`;\n return formatUrl(urlObject);\n }\n urlObject.path = `/styles/v1${urlObject.path}/sprite${format}${extension}`;\n return makeAPIURL(urlObject, accessToken);\n};\n\nconst imageExtensionRe = /(\\.(png|jpg)\\d*)(?=$)/;\n\nexport const normalizeTileURL = function(tileURL: string, sourceURL?: ?string, tileSize?: ?number): string {\n if (!sourceURL || !isMapboxURL(sourceURL)) return tileURL;\n\n const urlObject = parseUrl(tileURL);\n\n // The v4 mapbox tile API supports 512x512 image tiles only when @2x\n // is appended to the tile URL. If `tileSize: 512` is specified for\n // a Mapbox raster source force the @2x suffix even if a non hidpi device.\n const suffix = browser.devicePixelRatio >= 2 || tileSize === 512 ? '@2x' : '';\n const extension = browser.supportsWebp ? '.webp' : '$1';\n urlObject.path = urlObject.path.replace(imageExtensionRe, `${suffix}${extension}`);\n\n replaceTempAccessToken(urlObject.params);\n return formatUrl(urlObject);\n};\n\nfunction replaceTempAccessToken(params: Array) {\n for (let i = 0; i < params.length; i++) {\n if (params[i].indexOf('access_token=tk.') === 0) {\n params[i] = `access_token=${config.ACCESS_TOKEN || ''}`;\n }\n }\n}\n\nconst urlRe = /^(\\w+):\\/\\/([^/?]*)(\\/[^?]+)?\\??(.+)?/;\n\nfunction parseUrl(url: string): UrlObject {\n const parts = url.match(urlRe);\n if (!parts) {\n throw new Error('Unable to parse URL object');\n }\n return {\n protocol: parts[1],\n authority: parts[2],\n path: parts[3] || '/',\n params: parts[4] ? parts[4].split('&') : []\n };\n}\n\nfunction formatUrl(obj: UrlObject): string {\n const params = obj.params.length ? `?${obj.params.join('&')}` : '';\n return `${obj.protocol}://${obj.authority}${obj.path}${params}`;\n}\n","// @flow\n\nimport window from '../util/window';\nconst { HTMLImageElement, HTMLCanvasElement, HTMLVideoElement, ImageData } = window;\n\nimport type Context from '../gl/context';\nimport type {RGBAImage, AlphaImage} from '../util/image';\n\nexport type TextureFormat =\n | $PropertyType\n | $PropertyType;\nexport type TextureFilter =\n | $PropertyType\n | $PropertyType\n | $PropertyType;\nexport type TextureWrap =\n | $PropertyType\n | $PropertyType\n | $PropertyType;\n\ntype EmptyImage = {\n width: number,\n height: number,\n data: null\n}\n\nexport type TextureImage =\n | RGBAImage\n | AlphaImage\n | HTMLImageElement\n | HTMLCanvasElement\n | HTMLVideoElement\n | ImageData\n | EmptyImage;\n\nclass Texture {\n context: Context;\n size: Array;\n texture: WebGLTexture;\n format: TextureFormat;\n filter: ?TextureFilter;\n wrap: ?TextureWrap;\n useMipmap: boolean;\n\n constructor(context: Context, image: TextureImage, format: TextureFormat, options: ?{ premultiply?: boolean, useMipmap?: boolean }) {\n this.context = context;\n this.format = format;\n this.texture = context.gl.createTexture();\n this.update(image, options);\n }\n\n update(image: TextureImage, options: ?{premultiply?: boolean, useMipmap?: boolean}) {\n const {width, height} = image;\n const resize = !this.size || this.size[0] !== width || this.size[1] !== height;\n const {context} = this;\n const {gl} = context;\n\n this.useMipmap = Boolean(options && options.useMipmap);\n gl.bindTexture(gl.TEXTURE_2D, this.texture);\n\n if (resize) {\n this.size = [width, height];\n\n context.pixelStoreUnpack.set(1);\n\n if (this.format === gl.RGBA && (!options || options.premultiply !== false)) {\n context.pixelStoreUnpackPremultiplyAlpha.set(true);\n }\n\n if (image instanceof HTMLImageElement || image instanceof HTMLCanvasElement || image instanceof HTMLVideoElement || image instanceof ImageData) {\n gl.texImage2D(gl.TEXTURE_2D, 0, this.format, this.format, gl.UNSIGNED_BYTE, image);\n } else {\n gl.texImage2D(gl.TEXTURE_2D, 0, this.format, width, height, 0, this.format, gl.UNSIGNED_BYTE, image.data);\n }\n\n } else {\n if (image instanceof HTMLImageElement || image instanceof HTMLCanvasElement || image instanceof HTMLVideoElement || image instanceof ImageData) {\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, image);\n } else {\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, image.data);\n }\n }\n\n if (this.useMipmap && this.isSizePowerOfTwo()) {\n gl.generateMipmap(gl.TEXTURE_2D);\n }\n }\n\n bind(filter: TextureFilter, wrap: TextureWrap, minFilter: ?TextureFilter) {\n const {context} = this;\n const {gl} = context;\n gl.bindTexture(gl.TEXTURE_2D, this.texture);\n\n if (minFilter === gl.LINEAR_MIPMAP_NEAREST && !this.isSizePowerOfTwo()) {\n minFilter = gl.LINEAR;\n }\n\n if (filter !== this.filter) {\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, minFilter || filter);\n this.filter = filter;\n }\n\n if (wrap !== this.wrap) {\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, wrap);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, wrap);\n this.wrap = wrap;\n }\n }\n\n isSizePowerOfTwo() {\n return this.size[0] === this.size[1] && (Math.log(this.size[0]) / Math.LN2) % 1 === 0;\n }\n\n destroy() {\n const {gl} = this.context;\n gl.deleteTexture(this.texture);\n this.texture = (null: any);\n }\n}\n\nexport default Texture;\n","// @flow\n\nimport ShelfPack from '@mapbox/shelf-pack';\n\nimport { RGBAImage } from '../util/image';\nimport { ImagePosition } from './image_atlas';\nimport Texture from './texture';\nimport assert from 'assert';\n\nimport type {StyleImage} from '../style/style_image';\nimport type Context from '../gl/context';\nimport type {Bin} from '@mapbox/shelf-pack';\nimport type {Callback} from '../types/callback';\n\ntype Pattern = {\n bin: Bin,\n position: ImagePosition\n};\n\n// When copied into the atlas texture, image data is padded by one pixel on each side. Icon\n// images are padded with fully transparent pixels, while pattern images are padded with a\n// copy of the image data wrapped from the opposite side. In both cases, this ensures the\n// correct behavior of GL_LINEAR texture sampling mode.\nconst padding = 1;\n\n/*\n ImageManager does two things:\n\n 1. Tracks requests for icon images from tile workers and sends responses when the requests are fulfilled.\n 2. Builds a texture atlas for pattern images.\n\n These are disparate responsibilities and should eventually be handled by different classes. When we implement\n data-driven support for `*-pattern`, we'll likely use per-bucket pattern atlases, and that would be a good time\n to refactor this.\n*/\nclass ImageManager {\n images: {[string]: StyleImage};\n loaded: boolean;\n requestors: Array<{ids: Array, callback: Callback<{[string]: StyleImage}>}>;\n\n shelfPack: ShelfPack;\n patterns: {[string]: Pattern};\n atlasImage: RGBAImage;\n atlasTexture: ?Texture;\n dirty: boolean;\n\n constructor() {\n this.images = {};\n this.loaded = false;\n this.requestors = [];\n\n this.shelfPack = new ShelfPack(64, 64, {autoResize: true});\n this.patterns = {};\n this.atlasImage = new RGBAImage({width: 64, height: 64});\n this.dirty = true;\n }\n\n isLoaded() {\n return this.loaded;\n }\n\n setLoaded(loaded: boolean) {\n if (this.loaded === loaded) {\n return;\n }\n\n this.loaded = loaded;\n\n if (loaded) {\n for (const {ids, callback} of this.requestors) {\n this._notify(ids, callback);\n }\n this.requestors = [];\n }\n }\n\n getImage(id: string): ?StyleImage {\n return this.images[id];\n }\n\n addImage(id: string, image: StyleImage) {\n assert(!this.images[id]);\n this.images[id] = image;\n }\n\n removeImage(id: string) {\n assert(this.images[id]);\n delete this.images[id];\n\n const pattern = this.patterns[id];\n if (pattern) {\n this.shelfPack.unref(pattern.bin);\n delete this.patterns[id];\n }\n }\n\n getImages(ids: Array, callback: Callback<{[string]: StyleImage}>) {\n // If the sprite has been loaded, or if all the icon dependencies are already present\n // (i.e. if they've been addeded via runtime styling), then notify the requestor immediately.\n // Otherwise, delay notification until the sprite is loaded. At that point, if any of the\n // dependencies are still unavailable, we'll just assume they are permanently missing.\n let hasAllDependencies = true;\n if (!this.isLoaded()) {\n for (const id of ids) {\n if (!this.images[id]) {\n hasAllDependencies = false;\n }\n }\n }\n if (this.isLoaded() || hasAllDependencies) {\n this._notify(ids, callback);\n } else {\n this.requestors.push({ids, callback});\n }\n }\n\n _notify(ids: Array, callback: Callback<{[string]: StyleImage}>) {\n const response = {};\n\n for (const id of ids) {\n const image = this.images[id];\n if (image) {\n // Clone the image so that our own copy of its ArrayBuffer doesn't get transferred.\n response[id] = {\n data: image.data.clone(),\n pixelRatio: image.pixelRatio,\n sdf: image.sdf\n };\n }\n }\n\n callback(null, response);\n }\n\n // Pattern stuff\n\n getPixelSize() {\n return {\n width: this.shelfPack.w,\n height: this.shelfPack.h\n };\n }\n\n getPattern(id: string): ?ImagePosition {\n const pattern = this.patterns[id];\n if (pattern) {\n return pattern.position;\n }\n\n const image = this.getImage(id);\n if (!image) {\n return null;\n }\n\n const width = image.data.width + padding * 2;\n const height = image.data.height + padding * 2;\n\n const bin = this.shelfPack.packOne(width, height);\n if (!bin) {\n return null;\n }\n\n this.atlasImage.resize(this.getPixelSize());\n\n const src = image.data;\n const dst = this.atlasImage;\n\n const x = bin.x + padding;\n const y = bin.y + padding;\n const w = src.width;\n const h = src.height;\n\n RGBAImage.copy(src, dst, { x: 0, y: 0 }, { x, y }, { width: w, height: h });\n\n // Add 1 pixel wrapped padding on each side of the image.\n RGBAImage.copy(src, dst, { x: 0, y: h - 1 }, { x: x, y: y - 1 }, { width: w, height: 1 }); // T\n RGBAImage.copy(src, dst, { x: 0, y: 0 }, { x: x, y: y + h }, { width: w, height: 1 }); // B\n RGBAImage.copy(src, dst, { x: w - 1, y: 0 }, { x: x - 1, y: y }, { width: 1, height: h }); // L\n RGBAImage.copy(src, dst, { x: 0, y: 0 }, { x: x + w, y: y }, { width: 1, height: h }); // R\n\n this.dirty = true;\n\n const position = new ImagePosition(bin, image);\n this.patterns[id] = { bin, position };\n return position;\n }\n\n bind(context: Context) {\n const gl = context.gl;\n if (!this.atlasTexture) {\n this.atlasTexture = new Texture(context, this.atlasImage, gl.RGBA);\n } else if (this.dirty) {\n this.atlasTexture.update(this.atlasImage);\n this.dirty = false;\n }\n\n this.atlasTexture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n }\n}\n\nexport default ImageManager;\n","'use strict';\n\nmodule.exports = TinySDF;\n\nvar INF = 1e20;\n\nfunction TinySDF(fontSize, buffer, radius, cutoff, fontFamily, fontWeight) {\n this.fontSize = fontSize || 24;\n this.buffer = buffer === undefined ? 3 : buffer;\n this.cutoff = cutoff || 0.25;\n this.fontFamily = fontFamily || 'sans-serif';\n this.fontWeight = fontWeight || 'normal';\n this.radius = radius || 8;\n var size = this.size = this.fontSize + this.buffer * 2;\n\n this.canvas = document.createElement('canvas');\n this.canvas.width = this.canvas.height = size;\n\n this.ctx = this.canvas.getContext('2d');\n this.ctx.font = this.fontWeight + ' ' + this.fontSize + 'px ' + this.fontFamily;\n this.ctx.textBaseline = 'middle';\n this.ctx.fillStyle = 'black';\n\n // temporary arrays for the distance transform\n this.gridOuter = new Float64Array(size * size);\n this.gridInner = new Float64Array(size * size);\n this.f = new Float64Array(size);\n this.d = new Float64Array(size);\n this.z = new Float64Array(size + 1);\n this.v = new Int16Array(size);\n\n // hack around https://bugzilla.mozilla.org/show_bug.cgi?id=737852\n this.middle = Math.round((size / 2) * (navigator.userAgent.indexOf('Gecko/') >= 0 ? 1.2 : 1));\n}\n\nTinySDF.prototype.draw = function (char) {\n this.ctx.clearRect(0, 0, this.size, this.size);\n this.ctx.fillText(char, this.buffer, this.middle);\n\n var imgData = this.ctx.getImageData(0, 0, this.size, this.size);\n var alphaChannel = new Uint8ClampedArray(this.size * this.size);\n\n for (var i = 0; i < this.size * this.size; i++) {\n var a = imgData.data[i * 4 + 3] / 255; // alpha value\n this.gridOuter[i] = a === 1 ? 0 : a === 0 ? INF : Math.pow(Math.max(0, 0.5 - a), 2);\n this.gridInner[i] = a === 1 ? INF : a === 0 ? 0 : Math.pow(Math.max(0, a - 0.5), 2);\n }\n\n edt(this.gridOuter, this.size, this.size, this.f, this.d, this.v, this.z);\n edt(this.gridInner, this.size, this.size, this.f, this.d, this.v, this.z);\n\n for (i = 0; i < this.size * this.size; i++) {\n var d = this.gridOuter[i] - this.gridInner[i];\n alphaChannel[i] = Math.max(0, Math.min(255, Math.round(255 - 255 * (d / this.radius + this.cutoff))));\n }\n\n return alphaChannel;\n};\n\n// 2D Euclidean distance transform by Felzenszwalb & Huttenlocher https://cs.brown.edu/~pff/dt/\nfunction edt(data, width, height, f, d, v, z) {\n for (var x = 0; x < width; x++) {\n for (var y = 0; y < height; y++) {\n f[y] = data[y * width + x];\n }\n edt1d(f, d, v, z, height);\n for (y = 0; y < height; y++) {\n data[y * width + x] = d[y];\n }\n }\n for (y = 0; y < height; y++) {\n for (x = 0; x < width; x++) {\n f[x] = data[y * width + x];\n }\n edt1d(f, d, v, z, width);\n for (x = 0; x < width; x++) {\n data[y * width + x] = Math.sqrt(d[x]);\n }\n }\n}\n\n// 1D squared distance transform\nfunction edt1d(f, d, v, z, n) {\n v[0] = 0;\n z[0] = -INF;\n z[1] = +INF;\n\n for (var q = 1, k = 0; q < n; q++) {\n var s = ((f[q] + q * q) - (f[v[k]] + v[k] * v[k])) / (2 * q - 2 * v[k]);\n while (s <= z[k]) {\n k--;\n s = ((f[q] + q * q) - (f[v[k]] + v[k] * v[k])) / (2 * q - 2 * v[k]);\n }\n k++;\n v[k] = q;\n z[k] = s;\n z[k + 1] = +INF;\n }\n\n for (q = 0, k = 0; q < n; q++) {\n while (z[k + 1] < q) k++;\n d[q] = (q - v[k]) * (q - v[k]) + f[v[k]];\n }\n}\n","// @flow\n\nimport loadGlyphRange from '../style/load_glyph_range';\n\nimport TinySDF from '@mapbox/tiny-sdf';\nimport isChar from '../util/is_char_in_unicode_block';\nimport { asyncAll } from '../util/util';\nimport { AlphaImage } from '../util/image';\n\nimport type {StyleGlyph} from '../style/style_glyph';\nimport type {RequestTransformFunction} from '../ui/map';\nimport type {Callback} from '../types/callback';\n\ntype Entry = {\n // null means we've requested the range, but the glyph wasn't included in the result.\n glyphs: {[id: number]: StyleGlyph | null},\n requests: {[range: number]: Array>},\n tinySDF?: TinySDF\n};\n\nclass GlyphManager {\n requestTransform: RequestTransformFunction;\n localIdeographFontFamily: ?string;\n entries: {[string]: Entry};\n url: ?string;\n\n // exposed as statics to enable stubbing in unit tests\n static loadGlyphRange: typeof loadGlyphRange;\n static TinySDF: Class;\n\n constructor(requestTransform: RequestTransformFunction, localIdeographFontFamily: ?string) {\n this.requestTransform = requestTransform;\n this.localIdeographFontFamily = localIdeographFontFamily;\n this.entries = {};\n }\n\n setURL(url: ?string) {\n this.url = url;\n }\n\n getGlyphs(glyphs: {[stack: string]: Array}, callback: Callback<{[stack: string]: {[id: number]: ?StyleGlyph}}>) {\n const all = [];\n\n for (const stack in glyphs) {\n for (const id of glyphs[stack]) {\n all.push({stack, id});\n }\n }\n\n asyncAll(all, ({stack, id}, callback: Callback<{stack: string, id: number, glyph: ?StyleGlyph}>) => {\n let entry = this.entries[stack];\n if (!entry) {\n entry = this.entries[stack] = {\n glyphs: {},\n requests: {}\n };\n }\n\n let glyph = entry.glyphs[id];\n if (glyph !== undefined) {\n callback(null, {stack, id, glyph});\n return;\n }\n\n glyph = this._tinySDF(entry, stack, id);\n if (glyph) {\n callback(null, {stack, id, glyph});\n return;\n }\n\n const range = Math.floor(id / 256);\n if (range * 256 > 65535) {\n callback(new Error('glyphs > 65535 not supported'));\n return;\n }\n\n let requests = entry.requests[range];\n if (!requests) {\n requests = entry.requests[range] = [];\n GlyphManager.loadGlyphRange(stack, range, (this.url: any), this.requestTransform,\n (err, response: ?{[number]: StyleGlyph | null}) => {\n if (response) {\n for (const id in response) {\n entry.glyphs[+id] = response[+id];\n }\n }\n for (const cb of requests) {\n cb(err, response);\n }\n delete entry.requests[range];\n });\n }\n\n requests.push((err, result: ?{[number]: StyleGlyph | null}) => {\n if (err) {\n callback(err);\n } else if (result) {\n callback(null, {stack, id, glyph: result[id] || null});\n }\n });\n }, (err, glyphs: ?Array<{stack: string, id: number, glyph: ?StyleGlyph}>) => {\n if (err) {\n callback(err);\n } else if (glyphs) {\n const result = {};\n\n for (const {stack, id, glyph} of glyphs) {\n // Clone the glyph so that our own copy of its ArrayBuffer doesn't get transferred.\n (result[stack] || (result[stack] = {}))[id] = glyph && {\n id: glyph.id,\n bitmap: glyph.bitmap.clone(),\n metrics: glyph.metrics\n };\n }\n\n callback(null, result);\n }\n });\n }\n\n _tinySDF(entry: Entry, stack: string, id: number): ?StyleGlyph {\n const family = this.localIdeographFontFamily;\n if (!family) {\n return;\n }\n\n if (!isChar['CJK Unified Ideographs'](id) && !isChar['Hangul Syllables'](id)) { // eslint-disable-line new-cap\n return;\n }\n\n let tinySDF = entry.tinySDF;\n if (!tinySDF) {\n let fontWeight = '400';\n if (/bold/i.test(stack)) {\n fontWeight = '900';\n } else if (/medium/i.test(stack)) {\n fontWeight = '500';\n } else if (/light/i.test(stack)) {\n fontWeight = '200';\n }\n tinySDF = entry.tinySDF = new GlyphManager.TinySDF(24, 3, 8, .25, family, fontWeight);\n }\n\n return {\n id,\n bitmap: new AlphaImage({width: 30, height: 30}, tinySDF.draw(String.fromCharCode(id))),\n metrics: {\n width: 24,\n height: 24,\n left: 0,\n top: -8,\n advance: 24\n }\n };\n }\n}\n\nGlyphManager.loadGlyphRange = loadGlyphRange;\nGlyphManager.TinySDF = TinySDF;\n\nexport default GlyphManager;\n","// @flow\n\nimport styleSpec from '../style-spec/reference/latest';\n\nimport { endsWith, extend, sphericalToCartesian } from '../util/util';\nimport { Evented } from '../util/evented';\nimport {\n validateStyle,\n validateLight,\n emitValidationErrors\n} from './validate_style';\nimport Color from '../style-spec/util/color';\nimport { number as interpolate } from '../style-spec/util/interpolate';\n\nimport type {StylePropertySpecification} from '../style-spec/style-spec';\nimport type EvaluationParameters from './evaluation_parameters';\n\nimport { Properties, Transitionable, Transitioning, PossiblyEvaluated, DataConstantProperty } from './properties';\n\nimport type {\n Property,\n PropertyValue,\n TransitionParameters\n} from './properties';\n\ntype LightPosition = {\n x: number,\n y: number,\n z: number\n};\n\nclass LightPositionProperty implements Property<[number, number, number], LightPosition> {\n specification: StylePropertySpecification;\n\n constructor() {\n this.specification = styleSpec.light.position;\n }\n\n possiblyEvaluate(value: PropertyValue<[number, number, number], LightPosition>, parameters: EvaluationParameters): LightPosition {\n return sphericalToCartesian(value.expression.evaluate(parameters));\n }\n\n interpolate(a: LightPosition, b: LightPosition, t: number): LightPosition {\n return {\n x: interpolate(a.x, b.x, t),\n y: interpolate(a.y, b.y, t),\n z: interpolate(a.z, b.z, t),\n };\n }\n}\n\ntype Props = {|\n \"anchor\": DataConstantProperty<\"map\" | \"viewport\">,\n \"position\": LightPositionProperty,\n \"color\": DataConstantProperty,\n \"intensity\": DataConstantProperty,\n|};\n\nconst properties: Properties = new Properties({\n \"anchor\": new DataConstantProperty(styleSpec.light.anchor),\n \"position\": new LightPositionProperty(),\n \"color\": new DataConstantProperty(styleSpec.light.color),\n \"intensity\": new DataConstantProperty(styleSpec.light.intensity),\n});\n\nconst TRANSITION_SUFFIX = '-transition';\n\n/*\n * Represents the light used to light extruded features.\n */\nclass Light extends Evented {\n _transitionable: Transitionable;\n _transitioning: Transitioning;\n properties: PossiblyEvaluated;\n\n constructor(lightOptions?: LightSpecification) {\n super();\n this._transitionable = new Transitionable(properties);\n this.setLight(lightOptions);\n this._transitioning = this._transitionable.untransitioned();\n }\n\n getLight() {\n return this._transitionable.serialize();\n }\n\n setLight(options?: LightSpecification) {\n if (this._validate(validateLight, options)) {\n return;\n }\n\n for (const name in options) {\n const value = options[name];\n if (endsWith(name, TRANSITION_SUFFIX)) {\n this._transitionable.setTransition(name.slice(0, -TRANSITION_SUFFIX.length), value);\n } else {\n this._transitionable.setValue(name, value);\n }\n }\n }\n\n updateTransitions(parameters: TransitionParameters) {\n this._transitioning = this._transitionable.transitioned(parameters, this._transitioning);\n }\n\n hasTransition() {\n return this._transitioning.hasTransition();\n }\n\n recalculate(parameters: EvaluationParameters) {\n this.properties = this._transitioning.possiblyEvaluate(parameters);\n }\n\n _validate(validate: Function, value: mixed) {\n return emitValidationErrors(this, validate.call(validateStyle, extend({\n value: value,\n // Workaround for https://github.com/mapbox/mapbox-gl-js/issues/2407\n style: {glyphs: true, sprite: true},\n styleSpec: styleSpec\n })));\n }\n}\n\nexport default Light;\n","// @flow\n\nimport { warnOnce } from '../util/util';\n\nimport type Context from '../gl/context';\n\n/**\n * A LineAtlas lets us reuse rendered dashed lines\n * by writing many of them to a texture and then fetching their positions\n * using .getDash.\n *\n * @param {number} width\n * @param {number} height\n * @private\n */\nclass LineAtlas {\n width: number;\n height: number;\n nextRow: number;\n bytes: number;\n data: Uint8Array;\n positions: {[string]: any};\n dirty: boolean;\n texture: WebGLTexture;\n\n constructor(width: number, height: number) {\n this.width = width;\n this.height = height;\n this.nextRow = 0;\n\n this.bytes = 4;\n this.data = new Uint8Array(this.width * this.height * this.bytes);\n\n this.positions = {};\n }\n\n /**\n * Get or create a dash line pattern.\n *\n * @param {Array} dasharray\n * @param {boolean} round whether to add circle caps in between dash segments\n * @returns {Object} position of dash texture in { y, height, width }\n * @private\n */\n getDash(dasharray: Array, round: boolean) {\n const key = dasharray.join(\",\") + String(round);\n\n if (!this.positions[key]) {\n this.positions[key] = this.addDash(dasharray, round);\n }\n return this.positions[key];\n }\n\n addDash(dasharray: Array, round: boolean) {\n\n const n = round ? 7 : 0;\n const height = 2 * n + 1;\n const offset = 128;\n\n if (this.nextRow + height > this.height) {\n warnOnce('LineAtlas out of space');\n return null;\n }\n\n let length = 0;\n for (let i = 0; i < dasharray.length; i++) {\n length += dasharray[i];\n }\n\n const stretch = this.width / length;\n const halfWidth = stretch / 2;\n\n // If dasharray has an odd length, both the first and last parts\n // are dashes and should be joined seamlessly.\n const oddLength = dasharray.length % 2 === 1;\n\n for (let y = -n; y <= n; y++) {\n const row = this.nextRow + n + y;\n const index = this.width * row;\n\n let left = oddLength ? -dasharray[dasharray.length - 1] : 0;\n let right = dasharray[0];\n let partIndex = 1;\n\n for (let x = 0; x < this.width; x++) {\n\n while (right < x / stretch) {\n left = right;\n right = right + dasharray[partIndex];\n\n if (oddLength && partIndex === dasharray.length - 1) {\n right += dasharray[0];\n }\n\n partIndex++;\n }\n\n const distLeft = Math.abs(x - left * stretch);\n const distRight = Math.abs(x - right * stretch);\n const dist = Math.min(distLeft, distRight);\n const inside = (partIndex % 2) === 1;\n let signedDistance;\n\n if (round) {\n // Add circle caps\n const distMiddle = n ? y / n * (halfWidth + 1) : 0;\n if (inside) {\n const distEdge = halfWidth - Math.abs(distMiddle);\n signedDistance = Math.sqrt(dist * dist + distEdge * distEdge);\n } else {\n signedDistance = halfWidth - Math.sqrt(dist * dist + distMiddle * distMiddle);\n }\n } else {\n signedDistance = (inside ? 1 : -1) * dist;\n }\n\n this.data[3 + (index + x) * 4] = Math.max(0, Math.min(255, signedDistance + offset));\n }\n }\n\n const pos = {\n y: (this.nextRow + n + 0.5) / this.height,\n height: 2 * n / this.height,\n width: length\n };\n\n this.nextRow += height;\n this.dirty = true;\n\n return pos;\n }\n\n bind(context: Context) {\n const gl = context.gl;\n if (!this.texture) {\n this.texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, this.texture);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, this.width, this.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, this.data);\n\n } else {\n gl.bindTexture(gl.TEXTURE_2D, this.texture);\n\n if (this.dirty) {\n this.dirty = false;\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, this.width, this.height, gl.RGBA, gl.UNSIGNED_BYTE, this.data);\n }\n }\n }\n}\n\nexport default LineAtlas;\n","// @flow\n\nimport { uniqueId, asyncAll } from './util';\nimport Actor from './actor';\n\nimport type WorkerPool from './worker_pool';\n\n/**\n * Responsible for sending messages from a {@link Source} to an associated\n * {@link WorkerSource}.\n *\n * @private\n */\nclass Dispatcher {\n workerPool: WorkerPool;\n actors: Array;\n currentActor: number;\n id: number;\n\n // exposed to allow stubbing in unit tests\n static Actor: Class;\n\n constructor(workerPool: WorkerPool, parent: any) {\n this.workerPool = workerPool;\n this.actors = [];\n this.currentActor = 0;\n this.id = uniqueId();\n const workers = this.workerPool.acquire(this.id);\n for (let i = 0; i < workers.length; i++) {\n const worker = workers[i];\n const actor = new Dispatcher.Actor(worker, parent, this.id);\n actor.name = `Worker ${i}`;\n this.actors.push(actor);\n }\n }\n\n /**\n * Broadcast a message to all Workers.\n */\n broadcast(type: string, data: mixed, cb?: Function) {\n cb = cb || function () {};\n asyncAll(this.actors, (actor, done) => {\n actor.send(type, data, done);\n }, cb);\n }\n\n /**\n * Send a message to a Worker.\n * @param targetID The ID of the Worker to which to send this message. Omit to allow the dispatcher to choose.\n * @returns The ID of the worker to which the message was sent.\n */\n send(type: string, data: mixed, callback?: ?Function, targetID?: number): number {\n if (typeof targetID !== 'number' || isNaN(targetID)) {\n // Use round robin to send requests to web workers.\n targetID = this.currentActor = (this.currentActor + 1) % this.actors.length;\n }\n\n this.actors[targetID].send(type, data, callback);\n return targetID;\n }\n\n remove() {\n this.actors.forEach((actor) => { actor.remove(); });\n this.actors = [];\n this.workerPool.release(this.id);\n }\n}\n\nDispatcher.Actor = Actor;\n\nexport default Dispatcher;\n","// @flow\n\nimport { wrap } from '../util/util';\nimport LngLatBounds from './lng_lat_bounds';\n\n/**\n * A `LngLat` object represents a given longitude and latitude coordinate, measured in degrees.\n *\n * Mapbox GL uses longitude, latitude coordinate order (as opposed to latitude, longitude) to match GeoJSON.\n *\n * Note that any Mapbox GL method that accepts a `LngLat` object as an argument or option\n * can also accept an `Array` of two numbers and will perform an implicit conversion.\n * This flexible type is documented as {@link LngLatLike}.\n *\n * @param {number} lng Longitude, measured in degrees.\n * @param {number} lat Latitude, measured in degrees.\n * @example\n * var ll = new mapboxgl.LngLat(-73.9749, 40.7736);\n * @see [Get coordinates of the mouse pointer](https://www.mapbox.com/mapbox-gl-js/example/mouse-position/)\n * @see [Display a popup](https://www.mapbox.com/mapbox-gl-js/example/popup/)\n * @see [Highlight features within a bounding box](https://www.mapbox.com/mapbox-gl-js/example/using-box-queryrenderedfeatures/)\n * @see [Create a timeline animation](https://www.mapbox.com/mapbox-gl-js/example/timeline-animation/)\n */\nclass LngLat {\n lng: number;\n lat: number;\n\n constructor(lng: number, lat: number) {\n if (isNaN(lng) || isNaN(lat)) {\n throw new Error(`Invalid LngLat object: (${lng}, ${lat})`);\n }\n this.lng = +lng;\n this.lat = +lat;\n if (this.lat > 90 || this.lat < -90) {\n throw new Error('Invalid LngLat latitude value: must be between -90 and 90');\n }\n }\n\n /**\n * Returns a new `LngLat` object whose longitude is wrapped to the range (-180, 180).\n *\n * @returns {LngLat} The wrapped `LngLat` object.\n * @example\n * var ll = new mapboxgl.LngLat(286.0251, 40.7736);\n * var wrapped = ll.wrap();\n * wrapped.lng; // = -73.9749\n */\n wrap() {\n return new LngLat(wrap(this.lng, -180, 180), this.lat);\n }\n\n /**\n * Returns the coordinates represented as an array of two numbers.\n *\n * @returns {Array} The coordinates represeted as an array of longitude and latitude.\n * @example\n * var ll = new mapboxgl.LngLat(-73.9749, 40.7736);\n * ll.toArray(); // = [-73.9749, 40.7736]\n */\n toArray() {\n return [this.lng, this.lat];\n }\n\n /**\n * Returns the coordinates represent as a string.\n *\n * @returns {string} The coordinates represented as a string of the format `'LngLat(lng, lat)'`.\n * @example\n * var ll = new mapboxgl.LngLat(-73.9749, 40.7736);\n * ll.toString(); // = \"LngLat(-73.9749, 40.7736)\"\n */\n toString() {\n return `LngLat(${this.lng}, ${this.lat})`;\n }\n\n /**\n * Returns a `LngLatBounds` from the coordinates extended by a given `radius`.\n *\n * @param {number} radius Distance in meters from the coordinates to extend the bounds.\n * @returns {LngLatBounds} A new `LngLatBounds` object representing the coordinates extended by the `radius`.\n * @example\n * var ll = new mapboxgl.LngLat(-73.9749, 40.7736);\n * ll.toBounds(100).toArray(); // = [[-73.97501862141328, 40.77351016847229], [-73.97478137858673, 40.77368983152771]]\n */\n toBounds(radius: number) {\n const earthCircumferenceInMetersAtEquator = 40075017;\n const latAccuracy = 360 * radius / earthCircumferenceInMetersAtEquator,\n lngAccuracy = latAccuracy / Math.cos((Math.PI / 180) * this.lat);\n\n return new LngLatBounds(new LngLat(this.lng - lngAccuracy, this.lat - latAccuracy),\n new LngLat(this.lng + lngAccuracy, this.lat + latAccuracy));\n }\n\n /**\n * Converts an array of two numbers to a `LngLat` object.\n *\n * If a `LngLat` object is passed in, the function returns it unchanged.\n *\n * @param {LngLatLike} input An array of two numbers to convert, or a `LngLat` object to return.\n * @returns {LngLat} A new `LngLat` object, if a conversion occurred, or the original `LngLat` object.\n * @example\n * var arr = [-73.9749, 40.7736];\n * var ll = mapboxgl.LngLat.convert(arr);\n * ll; // = LngLat {lng: -73.9749, lat: 40.7736}\n */\n static convert(input: LngLatLike): LngLat {\n if (input instanceof LngLat) {\n return input;\n }\n if (Array.isArray(input) && (input.length === 2 || input.length === 3)) {\n return new LngLat(Number(input[0]), Number(input[1]));\n }\n if (!Array.isArray(input) && typeof input === 'object' && input !== null) {\n return new LngLat(Number(input.lng), Number(input.lat));\n }\n throw new Error(\"`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, or an array of [, ]\");\n }\n}\n\n/**\n * A {@link LngLat} object, an array of two numbers representing longitude and latitude,\n * or an object with `lng` and `lat` properties.\n *\n * @typedef {LngLat | {lng: number, lat: number} | [number, number]} LngLatLike\n * @example\n * var v1 = new mapboxgl.LngLat(-122.420679, 37.772537);\n * var v2 = [-122.420679, 37.772537];\n */\nexport type LngLatLike = LngLat | {lng: number, lat: number} | [number, number];\n\nexport default LngLat;\n","// @flow\n\nimport LngLat from './lng_lat';\n\nimport type {LngLatLike} from './lng_lat';\n\n/**\n * A `LngLatBounds` object represents a geographical bounding box,\n * defined by its southwest and northeast points in longitude and latitude.\n *\n * If no arguments are provided to the constructor, a `null` bounding box is created.\n *\n * Note that any Mapbox GL method that accepts a `LngLatBounds` object as an argument or option\n * can also accept an `Array` of two {@link LngLatLike} constructs and will perform an implicit conversion.\n * This flexible type is documented as {@link LngLatBoundsLike}.\n *\n * @param {LngLatLike} [sw] The southwest corner of the bounding box.\n * @param {LngLatLike} [ne] The northeast corner of the bounding box.\n * @example\n * var sw = new mapboxgl.LngLat(-73.9876, 40.7661);\n * var ne = new mapboxgl.LngLat(-73.9397, 40.8002);\n * var llb = new mapboxgl.LngLatBounds(sw, ne);\n */\nclass LngLatBounds {\n _ne: LngLat;\n _sw: LngLat;\n\n // This constructor is too flexible to type. It should not be so flexible.\n constructor(sw: any, ne: any) {\n if (!sw) {\n return;\n } else if (ne) {\n this.setSouthWest(sw).setNorthEast(ne);\n } else if (sw.length === 4) {\n this.setSouthWest([sw[0], sw[1]]).setNorthEast([sw[2], sw[3]]);\n } else {\n this.setSouthWest(sw[0]).setNorthEast(sw[1]);\n }\n }\n\n /**\n * Set the northeast corner of the bounding box\n *\n * @param {LngLatLike} ne\n * @returns {LngLatBounds} `this`\n */\n setNorthEast(ne: LngLatLike) {\n this._ne = ne instanceof LngLat ? new LngLat(ne.lng, ne.lat) : LngLat.convert(ne);\n return this;\n }\n\n /**\n * Set the southwest corner of the bounding box\n *\n * @param {LngLatLike} sw\n * @returns {LngLatBounds} `this`\n */\n setSouthWest(sw: LngLatLike) {\n this._sw = sw instanceof LngLat ? new LngLat(sw.lng, sw.lat) : LngLat.convert(sw);\n return this;\n }\n\n /**\n * Extend the bounds to include a given LngLat or LngLatBounds.\n *\n * @param {LngLat|LngLatBounds} obj object to extend to\n * @returns {LngLatBounds} `this`\n */\n extend(obj: LngLat | LngLatBounds) {\n const sw = this._sw,\n ne = this._ne;\n let sw2, ne2;\n\n if (obj instanceof LngLat) {\n sw2 = obj;\n ne2 = obj;\n\n } else if (obj instanceof LngLatBounds) {\n sw2 = obj._sw;\n ne2 = obj._ne;\n\n if (!sw2 || !ne2) return this;\n\n } else {\n if (Array.isArray(obj)) {\n if (obj.every(Array.isArray)) {\n return this.extend(LngLatBounds.convert(obj));\n } else {\n return this.extend(LngLat.convert(obj));\n }\n }\n return this;\n }\n\n if (!sw && !ne) {\n this._sw = new LngLat(sw2.lng, sw2.lat);\n this._ne = new LngLat(ne2.lng, ne2.lat);\n\n } else {\n sw.lng = Math.min(sw2.lng, sw.lng);\n sw.lat = Math.min(sw2.lat, sw.lat);\n ne.lng = Math.max(ne2.lng, ne.lng);\n ne.lat = Math.max(ne2.lat, ne.lat);\n }\n\n return this;\n }\n\n /**\n * Returns the geographical coordinate equidistant from the bounding box's corners.\n *\n * @returns {LngLat} The bounding box's center.\n * @example\n * var llb = new mapboxgl.LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]);\n * llb.getCenter(); // = LngLat {lng: -73.96365, lat: 40.78315}\n */\n getCenter(): LngLat {\n return new LngLat((this._sw.lng + this._ne.lng) / 2, (this._sw.lat + this._ne.lat) / 2);\n }\n\n /**\n * Returns the southwest corner of the bounding box.\n *\n * @returns {LngLat} The southwest corner of the bounding box.\n */\n getSouthWest(): LngLat { return this._sw; }\n\n /**\n * Returns the northeast corner of the bounding box.\n *\n * @returns {LngLat} The northeast corner of the bounding box.\n */\n getNorthEast(): LngLat { return this._ne; }\n\n /**\n * Returns the northwest corner of the bounding box.\n *\n * @returns {LngLat} The northwest corner of the bounding box.\n */\n getNorthWest(): LngLat { return new LngLat(this.getWest(), this.getNorth()); }\n\n /**\n * Returns the southeast corner of the bounding box.\n *\n * @returns {LngLat} The southeast corner of the bounding box.\n */\n getSouthEast(): LngLat { return new LngLat(this.getEast(), this.getSouth()); }\n\n /**\n * Returns the west edge of the bounding box.\n *\n * @returns {number} The west edge of the bounding box.\n */\n getWest(): number { return this._sw.lng; }\n\n /**\n * Returns the south edge of the bounding box.\n *\n * @returns {number} The south edge of the bounding box.\n */\n getSouth(): number { return this._sw.lat; }\n\n /**\n * Returns the east edge of the bounding box.\n *\n * @returns {number} The east edge of the bounding box.\n */\n getEast(): number { return this._ne.lng; }\n\n /**\n * Returns the north edge of the bounding box.\n *\n * @returns {number} The north edge of the bounding box.\n */\n getNorth(): number { return this._ne.lat; }\n\n /**\n * Returns the bounding box represented as an array.\n *\n * @returns {Array>} The bounding box represented as an array, consisting of the\n * southwest and northeast coordinates of the bounding represented as arrays of numbers.\n * @example\n * var llb = new mapboxgl.LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]);\n * llb.toArray(); // = [[-73.9876, 40.7661], [-73.9397, 40.8002]]\n */\n toArray() {\n return [this._sw.toArray(), this._ne.toArray()];\n }\n\n /**\n * Return the bounding box represented as a string.\n *\n * @returns {string} The bounding box represents as a string of the format\n * `'LngLatBounds(LngLat(lng, lat), LngLat(lng, lat))'`.\n * @example\n * var llb = new mapboxgl.LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]);\n * llb.toString(); // = \"LngLatBounds(LngLat(-73.9876, 40.7661), LngLat(-73.9397, 40.8002))\"\n */\n toString() {\n return `LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`;\n }\n\n /**\n * Check if the bounding box is an empty/`null`-type box.\n *\n * @returns {boolean} True if bounds have been defined, otherwise false.\n */\n isEmpty() {\n return !(this._sw && this._ne);\n }\n\n /**\n * Converts an array to a `LngLatBounds` object.\n *\n * If a `LngLatBounds` object is passed in, the function returns it unchanged.\n *\n * Internally, the function calls `LngLat#convert` to convert arrays to `LngLat` values.\n *\n * @param {LngLatBoundsLike} input An array of two coordinates to convert, or a `LngLatBounds` object to return.\n * @returns {LngLatBounds} A new `LngLatBounds` object, if a conversion occurred, or the original `LngLatBounds` object.\n * @example\n * var arr = [[-73.9876, 40.7661], [-73.9397, 40.8002]];\n * var llb = mapboxgl.LngLatBounds.convert(arr);\n * llb; // = LngLatBounds {_sw: LngLat {lng: -73.9876, lat: 40.7661}, _ne: LngLat {lng: -73.9397, lat: 40.8002}}\n */\n static convert(input: LngLatBoundsLike): LngLatBounds {\n if (!input || input instanceof LngLatBounds) return input;\n return new LngLatBounds(input);\n }\n}\n\n/**\n * A {@link LngLatBounds} object, an array of {@link LngLatLike} objects in [sw, ne] order,\n * or an array of numbers in [west, south, east, north] order.\n *\n * @typedef {LngLatBounds | [LngLatLike, LngLatLike] | [number, number, number, number]} LngLatBoundsLike\n * @example\n * var v1 = new mapboxgl.LngLatBounds(\n * new mapboxgl.LngLat(-73.9876, 40.7661),\n * new mapboxgl.LngLat(-73.9397, 40.8002)\n * );\n * var v2 = new mapboxgl.LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002])\n * var v3 = [[-73.9876, 40.7661], [-73.9397, 40.8002]];\n */\nexport type LngLatBoundsLike = LngLatBounds | [LngLatLike, LngLatLike] | [number, number, number, number];\n\nexport default LngLatBounds;\n","// @flow\n\nimport LngLatBounds from '../geo/lng_lat_bounds';\n\nimport { clamp } from '../util/util';\n\nimport type {CanonicalTileID} from './tile_id';\n\nclass TileBounds {\n bounds: LngLatBounds;\n minzoom: number;\n maxzoom: number;\n\n constructor(bounds: [number, number, number, number], minzoom: ?number, maxzoom: ?number) {\n this.bounds = LngLatBounds.convert(this.validateBounds(bounds));\n this.minzoom = minzoom || 0;\n this.maxzoom = maxzoom || 24;\n }\n\n validateBounds(bounds: [number, number, number, number]) {\n // make sure the bounds property contains valid longitude and latitudes\n if (!Array.isArray(bounds) || bounds.length !== 4) return [-180, -90, 180, 90];\n return [Math.max(-180, bounds[0]), Math.max(-90, bounds[1]), Math.min(180, bounds[2]), Math.min(90, bounds[3])];\n }\n\n contains(tileID: CanonicalTileID) {\n const level = {\n minX: Math.floor(this.lngX(this.bounds.getWest(), tileID.z)),\n minY: Math.floor(this.latY(this.bounds.getNorth(), tileID.z)),\n maxX: Math.ceil(this.lngX(this.bounds.getEast(), tileID.z)),\n maxY: Math.ceil(this.latY(this.bounds.getSouth(), tileID.z))\n };\n const hit = tileID.x >= level.minX && tileID.x < level.maxX && tileID.y >= level.minY && tileID.y < level.maxY;\n return hit;\n }\n\n lngX(lng: number, zoom: number) {\n return (lng + 180) * (Math.pow(2, zoom) / 360);\n }\n\n latY(lat: number, zoom: number) {\n const f = clamp(Math.sin(Math.PI / 180 * lat), -0.9999, 0.9999);\n const scale = Math.pow(2, zoom) / (2 * Math.PI);\n return Math.pow(2, zoom - 1) + 0.5 * Math.log((1 + f) / (1 - f)) * -scale;\n }\n}\n\nexport default TileBounds;\n","// @flow\n\nimport { Event, ErrorEvent, Evented } from '../util/evented';\n\nimport { extend, pick } from '../util/util';\nimport loadTileJSON from './load_tilejson';\nimport { normalizeTileURL as normalizeURL } from '../util/mapbox';\nimport TileBounds from './tile_bounds';\nimport { ResourceType } from '../util/ajax';\nimport browser from '../util/browser';\n\nimport type {Source} from './source';\nimport type {OverscaledTileID} from './tile_id';\nimport type Map from '../ui/map';\nimport type Dispatcher from '../util/dispatcher';\nimport type Tile from './tile';\nimport type {Callback} from '../types/callback';\n\nclass VectorTileSource extends Evented implements Source {\n type: 'vector';\n id: string;\n minzoom: number;\n maxzoom: number;\n url: string;\n scheme: string;\n tileSize: number;\n\n _options: VectorSourceSpecification;\n _collectResourceTiming: boolean;\n dispatcher: Dispatcher;\n map: Map;\n bounds: ?[number, number, number, number];\n tiles: Array;\n tileBounds: TileBounds;\n reparseOverscaled: boolean;\n isTileClipped: boolean;\n\n constructor(id: string, options: VectorSourceSpecification & {collectResourceTiming: boolean}, dispatcher: Dispatcher, eventedParent: Evented) {\n super();\n this.id = id;\n this.dispatcher = dispatcher;\n\n this.type = 'vector';\n this.minzoom = 0;\n this.maxzoom = 22;\n this.scheme = 'xyz';\n this.tileSize = 512;\n this.reparseOverscaled = true;\n this.isTileClipped = true;\n\n extend(this, pick(options, ['url', 'scheme', 'tileSize']));\n this._options = extend({ type: 'vector' }, options);\n\n this._collectResourceTiming = options.collectResourceTiming;\n\n if (this.tileSize !== 512) {\n throw new Error('vector tile sources must have a tileSize of 512');\n }\n\n this.setEventedParent(eventedParent);\n }\n\n load() {\n this.fire(new Event('dataloading', {dataType: 'source'}));\n\n loadTileJSON(this._options, this.map._transformRequest, (err, tileJSON) => {\n if (err) {\n this.fire(new ErrorEvent(err));\n } else if (tileJSON) {\n extend(this, tileJSON);\n if (tileJSON.bounds) this.tileBounds = new TileBounds(tileJSON.bounds, this.minzoom, this.maxzoom);\n\n // `content` is included here to prevent a race condition where `Style#_updateSources` is called\n // before the TileJSON arrives. this makes sure the tiles needed are loaded once TileJSON arrives\n // ref: https://github.com/mapbox/mapbox-gl-js/pull/4347#discussion_r104418088\n this.fire(new Event('data', {dataType: 'source', sourceDataType: 'metadata'}));\n this.fire(new Event('data', {dataType: 'source', sourceDataType: 'content'}));\n }\n });\n }\n\n hasTile(tileID: OverscaledTileID) {\n return !this.tileBounds || this.tileBounds.contains(tileID.canonical);\n }\n\n onAdd(map: Map) {\n this.map = map;\n this.load();\n }\n\n serialize() {\n return extend({}, this._options);\n }\n\n loadTile(tile: Tile, callback: Callback) {\n const url = normalizeURL(tile.tileID.canonical.url(this.tiles, this.scheme), this.url);\n const params = {\n request: this.map._transformRequest(url, ResourceType.Tile),\n uid: tile.uid,\n tileID: tile.tileID,\n zoom: tile.tileID.overscaledZ,\n tileSize: this.tileSize * tile.tileID.overscaleFactor(),\n type: this.type,\n source: this.id,\n pixelRatio: browser.devicePixelRatio,\n showCollisionBoxes: this.map.showCollisionBoxes,\n };\n params.request.collectResourceTiming = this._collectResourceTiming;\n\n if (tile.workerID === undefined || tile.state === 'expired') {\n tile.workerID = this.dispatcher.send('loadTile', params, done.bind(this));\n } else if (tile.state === 'loading') {\n // schedule tile reloading after it has been loaded\n tile.reloadCallback = callback;\n } else {\n this.dispatcher.send('reloadTile', params, done.bind(this), tile.workerID);\n }\n\n function done(err, data) {\n if (tile.aborted)\n return callback(null);\n\n if (err) {\n return callback(err);\n }\n\n if (data && data.resourceTiming)\n tile.resourceTiming = data.resourceTiming;\n\n if (this.map._refreshExpiredTiles) tile.setExpiryData(data);\n tile.loadVectorData(data, this.map.painter);\n\n callback(null);\n\n if (tile.reloadCallback) {\n this.loadTile(tile, tile.reloadCallback);\n tile.reloadCallback = null;\n }\n }\n }\n\n abortTile(tile: Tile) {\n this.dispatcher.send('abortTile', { uid: tile.uid, type: this.type, source: this.id }, undefined, tile.workerID);\n }\n\n unloadTile(tile: Tile) {\n tile.unloadVectorData();\n this.dispatcher.send('removeTile', { uid: tile.uid, type: this.type, source: this.id }, undefined, tile.workerID);\n }\n\n hasTransition() {\n return false;\n }\n}\n\nexport default VectorTileSource;\n","// @flow\n\nimport { extend, pick } from '../util/util';\n\nimport { getImage, ResourceType } from '../util/ajax';\nimport { Event, ErrorEvent, Evented } from '../util/evented';\nimport loadTileJSON from './load_tilejson';\nimport { normalizeTileURL as normalizeURL } from '../util/mapbox';\nimport TileBounds from './tile_bounds';\nimport Texture from '../render/texture';\n\nimport type {Source} from './source';\nimport type {OverscaledTileID} from './tile_id';\nimport type Map from '../ui/map';\nimport type Dispatcher from '../util/dispatcher';\nimport type Tile from './tile';\nimport type {Callback} from '../types/callback';\n\nclass RasterTileSource extends Evented implements Source {\n type: 'raster' | 'raster-dem';\n id: string;\n minzoom: number;\n maxzoom: number;\n url: string;\n scheme: string;\n tileSize: number;\n\n bounds: ?[number, number, number, number];\n tileBounds: TileBounds;\n roundZoom: boolean;\n dispatcher: Dispatcher;\n map: Map;\n tiles: Array;\n\n _loaded: boolean;\n _options: RasterSourceSpecification | RasterDEMSourceSpecification;\n\n constructor(id: string, options: RasterSourceSpecification | RasterDEMSourceSpecification, dispatcher: Dispatcher, eventedParent: Evented) {\n super();\n this.id = id;\n this.dispatcher = dispatcher;\n this.setEventedParent(eventedParent);\n\n this.type = 'raster';\n this.minzoom = 0;\n this.maxzoom = 22;\n this.roundZoom = true;\n this.scheme = 'xyz';\n this.tileSize = 512;\n this._loaded = false;\n\n this._options = extend({}, options);\n extend(this, pick(options, ['url', 'scheme', 'tileSize']));\n }\n\n load() {\n this.fire(new Event('dataloading', {dataType: 'source'}));\n loadTileJSON(this._options, this.map._transformRequest, (err, tileJSON) => {\n if (err) {\n this.fire(new ErrorEvent(err));\n } else if (tileJSON) {\n extend(this, tileJSON);\n if (tileJSON.bounds) this.tileBounds = new TileBounds(tileJSON.bounds, this.minzoom, this.maxzoom);\n\n // `content` is included here to prevent a race condition where `Style#_updateSources` is called\n // before the TileJSON arrives. this makes sure the tiles needed are loaded once TileJSON arrives\n // ref: https://github.com/mapbox/mapbox-gl-js/pull/4347#discussion_r104418088\n this.fire(new Event('data', {dataType: 'source', sourceDataType: 'metadata'}));\n this.fire(new Event('data', {dataType: 'source', sourceDataType: 'content'}));\n }\n });\n }\n\n onAdd(map: Map) {\n this.map = map;\n this.load();\n }\n\n serialize() {\n return extend({}, this._options);\n }\n\n hasTile(tileID: OverscaledTileID) {\n return !this.tileBounds || this.tileBounds.contains(tileID.canonical);\n }\n\n loadTile(tile: Tile, callback: Callback) {\n const url = normalizeURL(tile.tileID.canonical.url(this.tiles, this.scheme), this.url, this.tileSize);\n tile.request = getImage(this.map._transformRequest(url, ResourceType.Tile), (err, img) => {\n delete tile.request;\n\n if (tile.aborted) {\n tile.state = 'unloaded';\n callback(null);\n } else if (err) {\n tile.state = 'errored';\n callback(err);\n } else if (img) {\n if (this.map._refreshExpiredTiles) tile.setExpiryData(img);\n delete (img: any).cacheControl;\n delete (img: any).expires;\n\n const context = this.map.painter.context;\n const gl = context.gl;\n tile.texture = this.map.painter.getTileTexture(img.width);\n if (tile.texture) {\n tile.texture.update(img, { useMipmap: true });\n } else {\n tile.texture = new Texture(context, img, gl.RGBA, { useMipmap: true });\n tile.texture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE, gl.LINEAR_MIPMAP_NEAREST);\n\n if (context.extTextureFilterAnisotropic) {\n gl.texParameterf(gl.TEXTURE_2D, context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT, context.extTextureFilterAnisotropicMax);\n }\n }\n\n tile.state = 'loaded';\n\n callback(null);\n }\n });\n }\n\n abortTile(tile: Tile, callback: Callback) {\n if (tile.request) {\n tile.request.abort();\n delete tile.request;\n }\n callback();\n }\n\n unloadTile(tile: Tile, callback: Callback) {\n if (tile.texture) this.map.painter.saveTileTexture(tile.texture);\n callback();\n }\n\n hasTransition() {\n return false;\n }\n}\n\nexport default RasterTileSource;\n","// @flow\n\nimport { getImage, ResourceType } from '../util/ajax';\nimport { extend } from '../util/util';\nimport { Evented } from '../util/evented';\nimport { normalizeTileURL as normalizeURL } from '../util/mapbox';\nimport browser from '../util/browser';\nimport { OverscaledTileID } from './tile_id';\nimport RasterTileSource from './raster_tile_source';\n// ensure DEMData is registered for worker transfer on main thread:\nimport '../data/dem_data';\n\nimport type {Source} from './source';\nimport type Dispatcher from '../util/dispatcher';\nimport type Tile from './tile';\nimport type {Callback} from '../types/callback';\n\n\nclass RasterDEMTileSource extends RasterTileSource implements Source {\n encoding: \"mapbox\" | \"terrarium\";\n\n constructor(id: string, options: RasterDEMSourceSpecification, dispatcher: Dispatcher, eventedParent: Evented) {\n super(id, options, dispatcher, eventedParent);\n this.type = 'raster-dem';\n this.maxzoom = 22;\n this._options = extend({}, options);\n this.encoding = options.encoding || \"mapbox\";\n }\n\n serialize() {\n return {\n type: 'raster-dem',\n url: this.url,\n tileSize: this.tileSize,\n tiles: this.tiles,\n bounds: this.bounds,\n encoding: this.encoding\n };\n }\n\n loadTile(tile: Tile, callback: Callback) {\n const url = normalizeURL(tile.tileID.canonical.url(this.tiles, this.scheme), this.url, this.tileSize);\n tile.request = getImage(this.map._transformRequest(url, ResourceType.Tile), imageLoaded.bind(this));\n\n tile.neighboringTiles = this._getNeighboringTiles(tile.tileID);\n function imageLoaded(err, img) {\n delete tile.request;\n if (tile.aborted) {\n tile.state = 'unloaded';\n callback(null);\n } else if (err) {\n tile.state = 'errored';\n callback(err);\n } else if (img) {\n if (this.map._refreshExpiredTiles) tile.setExpiryData(img);\n delete (img: any).cacheControl;\n delete (img: any).expires;\n\n const rawImageData = browser.getImageData(img);\n const params = {\n uid: tile.uid,\n coord: tile.tileID,\n source: this.id,\n rawImageData: rawImageData,\n encoding: this.encoding\n };\n\n if (!tile.workerID || tile.state === 'expired') {\n tile.workerID = this.dispatcher.send('loadDEMTile', params, done.bind(this));\n }\n }\n }\n\n function done(err, dem) {\n if (err) {\n tile.state = 'errored';\n callback(err);\n }\n\n if (dem) {\n tile.dem = dem;\n tile.needsHillshadePrepare = true;\n tile.state = 'loaded';\n callback(null);\n }\n }\n }\n\n\n _getNeighboringTiles(tileID: OverscaledTileID) {\n const canonical = tileID.canonical;\n const dim = Math.pow(2, canonical.z);\n\n const px = (canonical.x - 1 + dim) % dim;\n const pxw = canonical.x === 0 ? tileID.wrap - 1 : tileID.wrap;\n const nx = (canonical.x + 1 + dim) % dim;\n const nxw = canonical.x + 1 === dim ? tileID.wrap + 1 : tileID.wrap;\n\n const neighboringTiles = {};\n // add adjacent tiles\n neighboringTiles[new OverscaledTileID(tileID.overscaledZ, pxw, canonical.z, px, canonical.y).key] = {backfilled: false};\n neighboringTiles[new OverscaledTileID(tileID.overscaledZ, nxw, canonical.z, nx, canonical.y).key] = {backfilled: false};\n\n // Add upper neighboringTiles\n if (canonical.y > 0) {\n neighboringTiles[new OverscaledTileID(tileID.overscaledZ, pxw, canonical.z, px, canonical.y - 1).key] = {backfilled: false};\n neighboringTiles[new OverscaledTileID(tileID.overscaledZ, tileID.wrap, canonical.z, canonical.x, canonical.y - 1).key] = {backfilled: false};\n neighboringTiles[new OverscaledTileID(tileID.overscaledZ, nxw, canonical.z, nx, canonical.y - 1).key] = {backfilled: false};\n }\n // Add lower neighboringTiles\n if (canonical.y + 1 < dim) {\n neighboringTiles[new OverscaledTileID(tileID.overscaledZ, pxw, canonical.z, px, canonical.y + 1).key] = {backfilled: false};\n neighboringTiles[new OverscaledTileID(tileID.overscaledZ, tileID.wrap, canonical.z, canonical.x, canonical.y + 1).key] = {backfilled: false};\n neighboringTiles[new OverscaledTileID(tileID.overscaledZ, nxw, canonical.z, nx, canonical.y + 1).key] = {backfilled: false};\n }\n\n return neighboringTiles;\n }\n\n\n unloadTile(tile: Tile) {\n if (tile.demTexture) this.map.painter.saveTileTexture(tile.demTexture);\n if (tile.fbo) {\n tile.fbo.destroy();\n delete tile.fbo;\n }\n if (tile.dem) delete tile.dem;\n delete tile.neighboringTiles;\n\n tile.state = 'unloaded';\n this.dispatcher.send('removeDEMTile', { uid: tile.uid, source: this.id }, undefined, tile.workerID);\n }\n\n}\n\nexport default RasterDEMTileSource;\n","// @flow\n\nimport { Event, ErrorEvent, Evented } from '../util/evented';\n\nimport { extend } from '../util/util';\nimport window from '../util/window';\nimport EXTENT from '../data/extent';\nimport { ResourceType } from '../util/ajax';\nimport browser from '../util/browser';\n\nimport type {Source} from './source';\nimport type Map from '../ui/map';\nimport type Dispatcher from '../util/dispatcher';\nimport type Tile from './tile';\nimport type {Callback} from '../types/callback';\nimport type {PerformanceResourceTiming} from '../types/performance_resource_timing';\n\n/**\n * A source containing GeoJSON.\n * (See the [Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/#sources-geojson) for detailed documentation of options.)\n *\n * @example\n * map.addSource('some id', {\n * type: 'geojson',\n * data: 'https://d2ad6b4ur7yvpq.cloudfront.net/naturalearth-3.3.0/ne_10m_ports.geojson'\n * });\n *\n * @example\n * map.addSource('some id', {\n * type: 'geojson',\n * data: {\n * \"type\": \"FeatureCollection\",\n * \"features\": [{\n * \"type\": \"Feature\",\n * \"properties\": {},\n * \"geometry\": {\n * \"type\": \"Point\",\n * \"coordinates\": [\n * -76.53063297271729,\n * 39.18174077994108\n * ]\n * }\n * }]\n * }\n * });\n *\n * @example\n * map.getSource('some id').setData({\n * \"type\": \"FeatureCollection\",\n * \"features\": [{\n * \"type\": \"Feature\",\n * \"properties\": { \"name\": \"Null Island\" },\n * \"geometry\": {\n * \"type\": \"Point\",\n * \"coordinates\": [ 0, 0 ]\n * }\n * }]\n * });\n * @see [Draw GeoJSON points](https://www.mapbox.com/mapbox-gl-js/example/geojson-markers/)\n * @see [Add a GeoJSON line](https://www.mapbox.com/mapbox-gl-js/example/geojson-line/)\n * @see [Create a heatmap from points](https://www.mapbox.com/mapbox-gl-js/example/heatmap/)\n */\nclass GeoJSONSource extends Evented implements Source {\n type: 'geojson';\n id: string;\n minzoom: number;\n maxzoom: number;\n tileSize: number;\n\n isTileClipped: boolean;\n reparseOverscaled: boolean;\n _data: GeoJSON | string;\n _options: any;\n workerOptions: any;\n dispatcher: Dispatcher;\n map: Map;\n workerID: number;\n _loaded: boolean;\n _collectResourceTiming: boolean;\n _resourceTiming: Array;\n _removed: boolean;\n\n /**\n * @private\n */\n constructor(id: string, options: GeojsonSourceSpecification & {workerOptions?: any, collectResourceTiming: boolean}, dispatcher: Dispatcher, eventedParent: Evented) {\n super();\n\n this.id = id;\n\n // `type` is a property rather than a constant to make it easy for 3rd\n // parties to use GeoJSONSource to build their own source types.\n this.type = 'geojson';\n\n this.minzoom = 0;\n this.maxzoom = 18;\n this.tileSize = 512;\n this.isTileClipped = true;\n this.reparseOverscaled = true;\n this._removed = false;\n\n this.dispatcher = dispatcher;\n this.setEventedParent(eventedParent);\n\n this._data = (options.data: any);\n this._options = extend({}, options);\n\n this._collectResourceTiming = options.collectResourceTiming;\n this._resourceTiming = [];\n\n if (options.maxzoom !== undefined) this.maxzoom = options.maxzoom;\n if (options.type) this.type = options.type;\n\n const scale = EXTENT / this.tileSize;\n\n // sent to the worker, along with `url: ...` or `data: literal geojson`,\n // so that it can load/parse/index the geojson data\n // extending with `options.workerOptions` helps to make it easy for\n // third-party sources to hack/reuse GeoJSONSource.\n this.workerOptions = extend({\n source: this.id,\n cluster: options.cluster || false,\n geojsonVtOptions: {\n buffer: (options.buffer !== undefined ? options.buffer : 128) * scale,\n tolerance: (options.tolerance !== undefined ? options.tolerance : 0.375) * scale,\n extent: EXTENT,\n maxZoom: this.maxzoom,\n lineMetrics: options.lineMetrics || false\n },\n superclusterOptions: {\n maxZoom: options.clusterMaxZoom !== undefined ?\n Math.min(options.clusterMaxZoom, this.maxzoom - 1) :\n (this.maxzoom - 1),\n extent: EXTENT,\n radius: (options.clusterRadius || 50) * scale,\n log: false\n }\n }, options.workerOptions);\n }\n\n load() {\n this.fire(new Event('dataloading', {dataType: 'source'}));\n this._updateWorkerData((err) => {\n if (err) {\n this.fire(new ErrorEvent(err));\n return;\n }\n\n const data: Object = { dataType: 'source', sourceDataType: 'metadata' };\n if (this._collectResourceTiming && this._resourceTiming && (this._resourceTiming.length > 0)) {\n data.resourceTiming = this._resourceTiming;\n this._resourceTiming = [];\n }\n\n // although GeoJSON sources contain no metadata, we fire this event to let the SourceCache\n // know its ok to start requesting tiles.\n this.fire(new Event('data', data));\n });\n }\n\n onAdd(map: Map) {\n this.map = map;\n this.load();\n }\n\n /**\n * Sets the GeoJSON data and re-renders the map.\n *\n * @param {Object|string} data A GeoJSON data object or a URL to one. The latter is preferable in the case of large GeoJSON files.\n * @returns {GeoJSONSource} this\n */\n setData(data: GeoJSON | string) {\n this._data = data;\n this.fire(new Event('dataloading', {dataType: 'source'}));\n this._updateWorkerData((err) => {\n if (err) {\n return this.fire(new ErrorEvent(err));\n }\n\n const data: Object = { dataType: 'source', sourceDataType: 'content' };\n if (this._collectResourceTiming && this._resourceTiming && (this._resourceTiming.length > 0)) {\n data.resourceTiming = this._resourceTiming;\n this._resourceTiming = [];\n }\n this.fire(new Event('data', data));\n });\n\n return this;\n }\n\n /*\n * Responsible for invoking WorkerSource's geojson.loadData target, which\n * handles loading the geojson data and preparing to serve it up as tiles,\n * using geojson-vt or supercluster as appropriate.\n */\n _updateWorkerData(callback: Function) {\n const options = extend({}, this.workerOptions);\n const data = this._data;\n if (typeof data === 'string') {\n options.request = this.map._transformRequest(resolveURL(data), ResourceType.Source);\n options.request.collectResourceTiming = this._collectResourceTiming;\n } else {\n options.data = JSON.stringify(data);\n }\n\n // target {this.type}.{options.source}.loadData rather than literally geojson.loadData,\n // so that other geojson-like source types can easily reuse this\n // implementation\n this.workerID = this.dispatcher.send(`${this.type}.${options.source}.loadData`, options, (err, result) => {\n if (this._removed || (result && result.abandoned)) {\n return;\n }\n\n this._loaded = true;\n\n if (result && result.resourceTiming && result.resourceTiming[this.id])\n this._resourceTiming = result.resourceTiming[this.id].slice(0);\n // Any `loadData` calls that piled up while we were processing\n // this one will get coalesced into a single call when this\n // 'coalesce' message is processed.\n // We would self-send from the worker if we had access to its\n // message queue. Waiting instead for the 'coalesce' to round-trip\n // through the foreground just means we're throttling the worker\n // to run at a little less than full-throttle.\n this.dispatcher.send(`${this.type}.${options.source}.coalesce`, null, null, this.workerID);\n callback(err);\n\n }, this.workerID);\n }\n\n loadTile(tile: Tile, callback: Callback) {\n const message = tile.workerID === undefined ? 'loadTile' : 'reloadTile';\n const params = {\n type: this.type,\n uid: tile.uid,\n tileID: tile.tileID,\n zoom: tile.tileID.overscaledZ,\n maxZoom: this.maxzoom,\n tileSize: this.tileSize,\n source: this.id,\n pixelRatio: browser.devicePixelRatio,\n showCollisionBoxes: this.map.showCollisionBoxes\n };\n\n tile.workerID = this.dispatcher.send(message, params, (err, data) => {\n tile.unloadVectorData();\n\n if (tile.aborted) {\n return callback(null);\n }\n\n if (err) {\n return callback(err);\n }\n\n tile.loadVectorData(data, this.map.painter, message === 'reloadTile');\n\n return callback(null);\n }, this.workerID);\n }\n\n abortTile(tile: Tile) {\n tile.aborted = true;\n }\n\n unloadTile(tile: Tile) {\n tile.unloadVectorData();\n this.dispatcher.send('removeTile', { uid: tile.uid, type: this.type, source: this.id }, null, tile.workerID);\n }\n\n onRemove() {\n this._removed = true;\n this.dispatcher.send('removeSource', { type: this.type, source: this.id }, null, this.workerID);\n }\n\n serialize() {\n return extend({}, this._options, {\n type: this.type,\n data: this._data\n });\n }\n\n hasTransition() {\n return false;\n }\n}\n\nfunction resolveURL(url) {\n const a = window.document.createElement('a');\n a.href = url;\n return a.href;\n}\n\nexport default GeoJSONSource;\n","// @flow\nimport { createLayout } from '../util/struct_array';\n\nexport default createLayout([\n { name: 'a_pos', type: 'Int16', components: 2 },\n { name: 'a_texture_pos', type: 'Int16', components: 2 }\n]);\n","// @flow\n\nimport assert from 'assert';\n\nimport type Program from './program';\nimport type VertexBuffer from '../gl/vertex_buffer';\nimport type IndexBuffer from '../gl/index_buffer';\nimport type Context from '../gl/context';\n\nclass VertexArrayObject {\n context: Context;\n boundProgram: ?Program;\n boundLayoutVertexBuffer: ?VertexBuffer;\n boundPaintVertexBuffers: Array;\n boundIndexBuffer: ?IndexBuffer;\n boundVertexOffset: ?number;\n boundDynamicVertexBuffer: ?VertexBuffer;\n boundDynamicVertexBuffer2: ?VertexBuffer;\n vao: any;\n\n constructor() {\n this.boundProgram = null;\n this.boundLayoutVertexBuffer = null;\n this.boundPaintVertexBuffers = [];\n this.boundIndexBuffer = null;\n this.boundVertexOffset = null;\n this.boundDynamicVertexBuffer = null;\n this.vao = null;\n }\n\n bind(context: Context,\n program: Program,\n layoutVertexBuffer: VertexBuffer,\n paintVertexBuffers: Array,\n indexBuffer: ?IndexBuffer,\n vertexOffset: ?number,\n dynamicVertexBuffer: ?VertexBuffer,\n dynamicVertexBuffer2: ?VertexBuffer) {\n\n this.context = context;\n\n let paintBuffersDiffer = this.boundPaintVertexBuffers.length !== paintVertexBuffers.length;\n for (let i = 0; !paintBuffersDiffer && i < paintVertexBuffers.length; i++) {\n if (this.boundPaintVertexBuffers[i] !== paintVertexBuffers[i]) {\n paintBuffersDiffer = true;\n }\n }\n\n const isFreshBindRequired = (\n !this.vao ||\n this.boundProgram !== program ||\n this.boundLayoutVertexBuffer !== layoutVertexBuffer ||\n paintBuffersDiffer ||\n this.boundIndexBuffer !== indexBuffer ||\n this.boundVertexOffset !== vertexOffset ||\n this.boundDynamicVertexBuffer !== dynamicVertexBuffer ||\n this.boundDynamicVertexBuffer2 !== dynamicVertexBuffer2\n );\n\n if (!context.extVertexArrayObject || isFreshBindRequired) {\n this.freshBind(program, layoutVertexBuffer, paintVertexBuffers, indexBuffer, vertexOffset, dynamicVertexBuffer, dynamicVertexBuffer2);\n } else {\n context.bindVertexArrayOES.set(this.vao);\n\n if (dynamicVertexBuffer) {\n // The buffer may have been updated. Rebind to upload data.\n dynamicVertexBuffer.bind();\n }\n\n if (indexBuffer && indexBuffer.dynamicDraw) {\n indexBuffer.bind();\n }\n\n if (dynamicVertexBuffer2) {\n dynamicVertexBuffer2.bind();\n }\n }\n }\n\n freshBind(program: Program,\n layoutVertexBuffer: VertexBuffer,\n paintVertexBuffers: Array,\n indexBuffer: ?IndexBuffer,\n vertexOffset: ?number,\n dynamicVertexBuffer: ?VertexBuffer,\n dynamicVertexBuffer2: ?VertexBuffer) {\n let numPrevAttributes;\n const numNextAttributes = program.numAttributes;\n\n const context = this.context;\n const gl = context.gl;\n\n if (context.extVertexArrayObject) {\n if (this.vao) this.destroy();\n this.vao = context.extVertexArrayObject.createVertexArrayOES();\n context.bindVertexArrayOES.set(this.vao);\n numPrevAttributes = 0;\n\n // store the arguments so that we can verify them when the vao is bound again\n this.boundProgram = program;\n this.boundLayoutVertexBuffer = layoutVertexBuffer;\n this.boundPaintVertexBuffers = paintVertexBuffers;\n this.boundIndexBuffer = indexBuffer;\n this.boundVertexOffset = vertexOffset;\n this.boundDynamicVertexBuffer = dynamicVertexBuffer;\n this.boundDynamicVertexBuffer2 = dynamicVertexBuffer2;\n\n } else {\n numPrevAttributes = context.currentNumAttributes || 0;\n\n // Disable all attributes from the previous program that aren't used in\n // the new program. Note: attribute indices are *not* program specific!\n for (let i = numNextAttributes; i < numPrevAttributes; i++) {\n // WebGL breaks if you disable attribute 0.\n // http://stackoverflow.com/questions/20305231\n assert(i !== 0);\n gl.disableVertexAttribArray(i);\n }\n }\n\n layoutVertexBuffer.enableAttributes(gl, program);\n for (const vertexBuffer of paintVertexBuffers) {\n vertexBuffer.enableAttributes(gl, program);\n }\n\n if (dynamicVertexBuffer) {\n dynamicVertexBuffer.enableAttributes(gl, program);\n }\n if (dynamicVertexBuffer2) {\n dynamicVertexBuffer2.enableAttributes(gl, program);\n }\n\n layoutVertexBuffer.bind();\n layoutVertexBuffer.setVertexAttribPointers(gl, program, vertexOffset);\n for (const vertexBuffer of paintVertexBuffers) {\n vertexBuffer.bind();\n vertexBuffer.setVertexAttribPointers(gl, program, vertexOffset);\n }\n\n if (dynamicVertexBuffer) {\n dynamicVertexBuffer.bind();\n dynamicVertexBuffer.setVertexAttribPointers(gl, program, vertexOffset);\n }\n if (indexBuffer) {\n indexBuffer.bind();\n }\n if (dynamicVertexBuffer2) {\n dynamicVertexBuffer2.bind();\n dynamicVertexBuffer2.setVertexAttribPointers(gl, program, vertexOffset);\n }\n\n context.currentNumAttributes = numNextAttributes;\n }\n\n destroy() {\n if (this.vao) {\n this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao);\n this.vao = null;\n }\n }\n}\n\nexport default VertexArrayObject;\n","// @flow\n\nimport { getCoordinatesCenter } from '../util/util';\n\nimport { CanonicalTileID } from './tile_id';\nimport LngLat from '../geo/lng_lat';\nimport Point from '@mapbox/point-geometry';\nimport { Event, ErrorEvent, Evented } from '../util/evented';\nimport { getImage, ResourceType } from '../util/ajax';\nimport browser from '../util/browser';\nimport EXTENT from '../data/extent';\nimport { RasterBoundsArray } from '../data/array_types';\nimport rasterBoundsAttributes from '../data/raster_bounds_attributes';\nimport VertexArrayObject from '../render/vertex_array_object';\nimport Texture from '../render/texture';\n\nimport type {Source} from './source';\nimport type {CanvasSourceSpecification} from './canvas_source';\nimport type Map from '../ui/map';\nimport type Dispatcher from '../util/dispatcher';\nimport type Tile from './tile';\nimport type Coordinate from '../geo/coordinate';\nimport type {Callback} from '../types/callback';\nimport type VertexBuffer from '../gl/vertex_buffer';\n\n/**\n * A data source containing an image.\n * (See the [Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/#sources-image) for detailed documentation of options.)\n *\n * @example\n * // add to map\n * map.addSource('some id', {\n * type: 'image',\n * url: 'https://www.mapbox.com/images/foo.png',\n * coordinates: [\n * [-76.54, 39.18],\n * [-76.52, 39.18],\n * [-76.52, 39.17],\n * [-76.54, 39.17]\n * ]\n * });\n *\n * // update\n * var mySource = map.getSource('some id');\n * mySource.setCoordinates([\n * [-76.54335737228394, 39.18579907229748],\n * [-76.52803659439087, 39.1838364847587],\n * [-76.5295386314392, 39.17683392507606],\n * [-76.54520273208618, 39.17876344106642]\n * ]);\n *\n * map.removeSource('some id'); // remove\n * @see [Add an image](https://www.mapbox.com/mapbox-gl-js/example/image-on-a-map/)\n */\nclass ImageSource extends Evented implements Source {\n type: string;\n id: string;\n minzoom: number;\n maxzoom: number;\n tileSize: number;\n url: string;\n\n coordinates: [[number, number], [number, number], [number, number], [number, number]];\n tiles: {[string]: Tile};\n options: any;\n dispatcher: Dispatcher;\n map: Map;\n texture: Texture;\n image: ImageData;\n centerCoord: Coordinate;\n tileID: CanonicalTileID;\n _boundsArray: RasterBoundsArray;\n boundsBuffer: VertexBuffer;\n boundsVAO: VertexArrayObject;\n\n /**\n * @private\n */\n constructor(id: string, options: ImageSourceSpecification | VideoSourceSpecification | CanvasSourceSpecification, dispatcher: Dispatcher, eventedParent: Evented) {\n super();\n this.id = id;\n this.dispatcher = dispatcher;\n this.coordinates = options.coordinates;\n\n this.type = 'image';\n this.minzoom = 0;\n this.maxzoom = 22;\n this.tileSize = 512;\n this.tiles = {};\n\n this.setEventedParent(eventedParent);\n\n this.options = options;\n }\n\n load() {\n this.fire(new Event('dataloading', {dataType: 'source'}));\n\n this.url = this.options.url;\n\n getImage(this.map._transformRequest(this.url, ResourceType.Image), (err, image) => {\n if (err) {\n this.fire(new ErrorEvent(err));\n } else if (image) {\n this.image = browser.getImageData(image);\n this._finishLoading();\n }\n });\n }\n\n _finishLoading() {\n if (this.map) {\n this.setCoordinates(this.coordinates);\n this.fire(new Event('data', {dataType: 'source', sourceDataType: 'metadata'}));\n }\n }\n\n onAdd(map: Map) {\n this.map = map;\n this.load();\n }\n\n /**\n * Sets the image's coordinates and re-renders the map.\n *\n * @param {Array>} coordinates Four geographical coordinates,\n * represented as arrays of longitude and latitude numbers, which define the corners of the image.\n * The coordinates start at the top left corner of the image and proceed in clockwise order.\n * They do not have to represent a rectangle.\n * @returns {ImageSource} this\n */\n setCoordinates(coordinates: [[number, number], [number, number], [number, number], [number, number]]) {\n this.coordinates = coordinates;\n\n // Calculate which mercator tile is suitable for rendering the video in\n // and create a buffer with the corner coordinates. These coordinates\n // may be outside the tile, because raster tiles aren't clipped when rendering.\n\n const map = this.map;\n\n // transform the geo coordinates into (zoom 0) tile space coordinates\n const cornerZ0Coords = coordinates.map((coord) => {\n return map.transform.locationCoordinate(LngLat.convert(coord)).zoomTo(0);\n });\n\n // Compute the coordinates of the tile we'll use to hold this image's\n // render data\n const centerCoord = this.centerCoord = getCoordinatesCenter(cornerZ0Coords);\n // `column` and `row` may be fractional; round them down so that they\n // represent integer tile coordinates\n centerCoord.column = Math.floor(centerCoord.column);\n centerCoord.row = Math.floor(centerCoord.row);\n this.tileID = new CanonicalTileID(centerCoord.zoom, centerCoord.column, centerCoord.row);\n\n // Constrain min/max zoom to our tile's zoom level in order to force\n // SourceCache to request this tile (no matter what the map's zoom\n // level)\n this.minzoom = this.maxzoom = centerCoord.zoom;\n\n // Transform the corner coordinates into the coordinate space of our\n // tile.\n const tileCoords = cornerZ0Coords.map((coord) => {\n const zoomedCoord = coord.zoomTo(centerCoord.zoom);\n return new Point(\n Math.round((zoomedCoord.column - centerCoord.column) * EXTENT),\n Math.round((zoomedCoord.row - centerCoord.row) * EXTENT));\n });\n\n this._boundsArray = new RasterBoundsArray();\n this._boundsArray.emplaceBack(tileCoords[0].x, tileCoords[0].y, 0, 0);\n this._boundsArray.emplaceBack(tileCoords[1].x, tileCoords[1].y, EXTENT, 0);\n this._boundsArray.emplaceBack(tileCoords[3].x, tileCoords[3].y, 0, EXTENT);\n this._boundsArray.emplaceBack(tileCoords[2].x, tileCoords[2].y, EXTENT, EXTENT);\n\n if (this.boundsBuffer) {\n this.boundsBuffer.destroy();\n delete this.boundsBuffer;\n }\n\n this.fire(new Event('data', {dataType:'source', sourceDataType: 'content'}));\n return this;\n }\n\n prepare() {\n if (Object.keys(this.tiles).length === 0 || !this.image) {\n return;\n }\n\n const context = this.map.painter.context;\n const gl = context.gl;\n\n if (!this.boundsBuffer) {\n this.boundsBuffer = context.createVertexBuffer(this._boundsArray, rasterBoundsAttributes.members);\n }\n\n if (!this.boundsVAO) {\n this.boundsVAO = new VertexArrayObject();\n }\n\n if (!this.texture) {\n this.texture = new Texture(context, this.image, gl.RGBA);\n this.texture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n }\n\n for (const w in this.tiles) {\n const tile = this.tiles[w];\n if (tile.state !== 'loaded') {\n tile.state = 'loaded';\n tile.texture = this.texture;\n }\n }\n }\n\n loadTile(tile: Tile, callback: Callback) {\n // We have a single tile -- whoose coordinates are this.tileID -- that\n // covers the image we want to render. If that's the one being\n // requested, set it up with the image; otherwise, mark the tile as\n // `errored` to indicate that we have no data for it.\n // If the world wraps, we may have multiple \"wrapped\" copies of the\n // single tile.\n if (this.tileID && this.tileID.equals(tile.tileID.canonical)) {\n this.tiles[String(tile.tileID.wrap)] = tile;\n tile.buckets = {};\n callback(null);\n } else {\n tile.state = 'errored';\n callback(null);\n }\n }\n\n serialize(): Object {\n return {\n type: 'image',\n url: this.options.url,\n coordinates: this.coordinates\n };\n }\n\n hasTransition() {\n return false;\n }\n}\n\nexport default ImageSource;\n","// @flow\n\nimport { getVideo, ResourceType } from '../util/ajax';\n\nimport ImageSource from './image_source';\nimport rasterBoundsAttributes from '../data/raster_bounds_attributes';\nimport VertexArrayObject from '../render/vertex_array_object';\nimport Texture from '../render/texture';\nimport { ErrorEvent } from '../util/evented';\n\nimport type Map from '../ui/map';\nimport type Dispatcher from '../util/dispatcher';\nimport type {Evented} from '../util/evented';\n\n/**\n * A data source containing video.\n * (See the [Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/#sources-video) for detailed documentation of options.)\n *\n * @example\n * // add to map\n * map.addSource('some id', {\n * type: 'video',\n * url: [\n * 'https://www.mapbox.com/blog/assets/baltimore-smoke.mp4',\n * 'https://www.mapbox.com/blog/assets/baltimore-smoke.webm'\n * ],\n * coordinates: [\n * [-76.54, 39.18],\n * [-76.52, 39.18],\n * [-76.52, 39.17],\n * [-76.54, 39.17]\n * ]\n * });\n *\n * // update\n * var mySource = map.getSource('some id');\n * mySource.setCoordinates([\n * [-76.54335737228394, 39.18579907229748],\n * [-76.52803659439087, 39.1838364847587],\n * [-76.5295386314392, 39.17683392507606],\n * [-76.54520273208618, 39.17876344106642]\n * ]);\n *\n * map.removeSource('some id'); // remove\n * @see [Add a video](https://www.mapbox.com/mapbox-gl-js/example/video-on-a-map/)\n */\nclass VideoSource extends ImageSource {\n options: VideoSourceSpecification;\n urls: Array;\n video: HTMLVideoElement;\n roundZoom: boolean;\n\n /**\n * @private\n */\n constructor(id: string, options: VideoSourceSpecification, dispatcher: Dispatcher, eventedParent: Evented) {\n super(id, options, dispatcher, eventedParent);\n this.roundZoom = true;\n this.type = 'video';\n this.options = options;\n }\n\n load() {\n const options = this.options;\n\n this.urls = [];\n for (const url of options.urls) {\n this.urls.push(this.map._transformRequest(url, ResourceType.Source).url);\n }\n\n getVideo(this.urls, (err, video) => {\n if (err) {\n this.fire(new ErrorEvent(err));\n } else if (video) {\n this.video = video;\n this.video.loop = true;\n\n // Start repainting when video starts playing. hasTransition() will then return\n // true to trigger additional frames as long as the videos continues playing.\n this.video.addEventListener('playing', () => {\n this.map._rerender();\n });\n\n if (this.map) {\n this.video.play();\n }\n\n this._finishLoading();\n }\n });\n }\n\n /**\n * Returns the HTML `video` element.\n *\n * @returns {HTMLVideoElement} The HTML `video` element.\n */\n getVideo() {\n return this.video;\n }\n\n onAdd(map: Map) {\n if (this.map) return;\n this.map = map;\n this.load();\n if (this.video) {\n this.video.play();\n this.setCoordinates(this.coordinates);\n }\n }\n\n /**\n * Sets the video's coordinates and re-renders the map.\n *\n * @method setCoordinates\n * @instance\n * @memberof VideoSource\n * @param {Array>} coordinates Four geographical coordinates,\n * represented as arrays of longitude and latitude numbers, which define the corners of the video.\n * The coordinates start at the top left corner of the video and proceed in clockwise order.\n * They do not have to represent a rectangle.\n * @returns {VideoSource} this\n */\n // setCoordinates inherited from ImageSource\n\n prepare() {\n if (Object.keys(this.tiles).length === 0 || this.video.readyState < 2) {\n return; // not enough data for current position\n }\n\n const context = this.map.painter.context;\n const gl = context.gl;\n\n if (!this.boundsBuffer) {\n this.boundsBuffer = context.createVertexBuffer(this._boundsArray, rasterBoundsAttributes.members);\n }\n\n if (!this.boundsVAO) {\n this.boundsVAO = new VertexArrayObject();\n }\n\n if (!this.texture) {\n this.texture = new Texture(context, this.video, gl.RGBA);\n this.texture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n } else if (!this.video.paused) {\n this.texture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, this.video);\n }\n\n for (const w in this.tiles) {\n const tile = this.tiles[w];\n if (tile.state !== 'loaded') {\n tile.state = 'loaded';\n tile.texture = this.texture;\n }\n }\n }\n\n serialize() {\n return {\n type: 'video',\n urls: this.urls,\n coordinates: this.coordinates\n };\n }\n\n hasTransition() {\n return this.video && !this.video.paused;\n }\n}\n\nexport default VideoSource;\n","// @flow\n\nimport ImageSource from './image_source';\n\nimport window from '../util/window';\nimport rasterBoundsAttributes from '../data/raster_bounds_attributes';\nimport VertexArrayObject from '../render/vertex_array_object';\nimport Texture from '../render/texture';\nimport { ErrorEvent } from '../util/evented';\nimport ValidationError from '../style-spec/error/validation_error';\n\nimport type Map from '../ui/map';\nimport type Dispatcher from '../util/dispatcher';\nimport type {Evented} from '../util/evented';\n\nexport type CanvasSourceSpecification = {|\n \"type\": \"canvas\",\n \"coordinates\": [[number, number], [number, number], [number, number], [number, number]],\n \"animate\"?: boolean,\n \"canvas\": string | HTMLCanvasElement\n|};\n\n/**\n * Options to add a canvas source type to the map.\n *\n * @typedef {Object} CanvasSourceOptions\n * @property {string} type Source type. Must be `\"canvas\"`.\n * @property {string|HTMLCanvasElement} canvas Canvas source from which to read pixels. Can be a string representing the ID of the canvas element, or the `HTMLCanvasElement` itself.\n * @property {Array>} coordinates Four geographical coordinates denoting where to place the corners of the canvas, specified in `[longitude, latitude]` pairs.\n * @property {boolean} [animate=true] Whether the canvas source is animated. If the canvas is static (i.e. pixels do not need to be re-read on every frame), `animate` should be set to `false` to improve performance.\n */\n\n/**\n * A data source containing the contents of an HTML canvas. See {@link CanvasSourceOptions} for detailed documentation of options.\n *\n * @example\n * // add to map\n * map.addSource('some id', {\n * type: 'canvas',\n * canvas: 'idOfMyHTMLCanvas',\n * animate: true,\n * coordinates: [\n * [-76.54, 39.18],\n * [-76.52, 39.18],\n * [-76.52, 39.17],\n * [-76.54, 39.17]\n * ]\n * });\n *\n * // update\n * var mySource = map.getSource('some id');\n * mySource.setCoordinates([\n * [-76.54335737228394, 39.18579907229748],\n * [-76.52803659439087, 39.1838364847587],\n * [-76.5295386314392, 39.17683392507606],\n * [-76.54520273208618, 39.17876344106642]\n * ]);\n *\n * map.removeSource('some id'); // remove\n */\nclass CanvasSource extends ImageSource {\n options: CanvasSourceSpecification;\n animate: boolean;\n canvas: HTMLCanvasElement;\n width: number;\n height: number;\n play: () => void;\n pause: () => void;\n _playing: boolean;\n\n /**\n * @private\n */\n constructor(id: string, options: CanvasSourceSpecification, dispatcher: Dispatcher, eventedParent: Evented) {\n super(id, options, dispatcher, eventedParent);\n\n // We build in some validation here, since canvas sources aren't included in the style spec:\n if (!options.coordinates) {\n this.fire(new ErrorEvent(new ValidationError(`sources.${id}`, null, 'missing required property \"coordinates\"')));\n } else if (!Array.isArray(options.coordinates) || options.coordinates.length !== 4 ||\n options.coordinates.some(c => !Array.isArray(c) || c.length !== 2 || c.some(l => typeof l !== 'number'))) {\n this.fire(new ErrorEvent(new ValidationError(`sources.${id}`, null, '\"coordinates\" property must be an array of 4 longitude/latitude array pairs')));\n }\n\n if (options.animate && typeof options.animate !== 'boolean') {\n this.fire(new ErrorEvent(new ValidationError(`sources.${id}`, null, 'optional \"animate\" property must be a boolean value')));\n }\n\n if (!options.canvas) {\n this.fire(new ErrorEvent(new ValidationError(`sources.${id}`, null, 'missing required property \"canvas\"')));\n } else if (typeof options.canvas !== 'string' && !(options.canvas instanceof window.HTMLCanvasElement)) {\n this.fire(new ErrorEvent(new ValidationError(`sources.${id}`, null, '\"canvas\" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance')));\n }\n\n this.options = options;\n this.animate = options.animate !== undefined ? options.animate : true;\n }\n\n /**\n * Enables animation. The image will be copied from the canvas to the map on each frame.\n * @method play\n * @instance\n * @memberof CanvasSource\n */\n\n /**\n * Disables animation. The map will display a static copy of the canvas image.\n * @method pause\n * @instance\n * @memberof CanvasSource\n */\n\n load() {\n if (!this.canvas) {\n this.canvas = (this.options.canvas instanceof window.HTMLCanvasElement) ?\n this.options.canvas :\n window.document.getElementById(this.options.canvas);\n }\n this.width = this.canvas.width;\n this.height = this.canvas.height;\n\n if (this._hasInvalidDimensions()) {\n this.fire(new ErrorEvent(new Error('Canvas dimensions cannot be less than or equal to zero.')));\n return;\n }\n\n this.play = function() {\n this._playing = true;\n this.map._rerender();\n };\n\n this.pause = function() {\n this._playing = false;\n };\n\n this._finishLoading();\n }\n\n /**\n * Returns the HTML `canvas` element.\n *\n * @returns {HTMLCanvasElement} The HTML `canvas` element.\n */\n getCanvas() {\n return this.canvas;\n }\n\n onAdd(map: Map) {\n this.map = map;\n this.load();\n if (this.canvas) {\n if (this.animate) this.play();\n }\n }\n\n onRemove() {\n this.pause();\n }\n\n /**\n * Sets the canvas's coordinates and re-renders the map.\n *\n * @method setCoordinates\n * @instance\n * @memberof CanvasSource\n * @param {Array>} coordinates Four geographical coordinates,\n * represented as arrays of longitude and latitude numbers, which define the corners of the canvas.\n * The coordinates start at the top left corner of the canvas and proceed in clockwise order.\n * They do not have to represent a rectangle.\n * @returns {CanvasSource} this\n */\n // setCoordinates inherited from ImageSource\n\n prepare() {\n let resize = false;\n if (this.canvas.width !== this.width) {\n this.width = this.canvas.width;\n resize = true;\n }\n if (this.canvas.height !== this.height) {\n this.height = this.canvas.height;\n resize = true;\n }\n\n if (this._hasInvalidDimensions()) return;\n\n if (Object.keys(this.tiles).length === 0) return; // not enough data for current position\n\n const context = this.map.painter.context;\n const gl = context.gl;\n\n if (!this.boundsBuffer) {\n this.boundsBuffer = context.createVertexBuffer(this._boundsArray, rasterBoundsAttributes.members);\n }\n\n if (!this.boundsVAO) {\n this.boundsVAO = new VertexArrayObject();\n }\n\n if (!this.texture) {\n this.texture = new Texture(context, this.canvas, gl.RGBA);\n this.texture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n } else if (resize) {\n this.texture.update(this.canvas);\n } else if (this._playing) {\n this.texture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, this.canvas);\n }\n\n for (const w in this.tiles) {\n const tile = this.tiles[w];\n if (tile.state !== 'loaded') {\n tile.state = 'loaded';\n tile.texture = this.texture;\n }\n }\n }\n\n serialize(): Object {\n return {\n type: 'canvas',\n coordinates: this.coordinates\n };\n }\n\n hasTransition() {\n return this._playing;\n }\n\n _hasInvalidDimensions() {\n for (const x of [this.canvas.width, this.canvas.height]) {\n if (isNaN(x) || x <= 0) return true;\n }\n return false;\n }\n}\n\nexport default CanvasSource;\n","// @flow\n\nimport { bindAll } from '../util/util';\n\nimport type Dispatcher from '../util/dispatcher';\nimport type {Event, Evented} from '../util/evented';\nimport type Map from '../ui/map';\nimport type Tile from './tile';\nimport type {OverscaledTileID} from './tile_id';\nimport type {Callback} from '../types/callback';\n\n/**\n * The `Source` interface must be implemented by each source type, including \"core\" types (`vector`, `raster`,\n * `video`, etc.) and all custom, third-party types.\n *\n * @private\n *\n * @param {string} id The id for the source. Must not be used by any existing source.\n * @param {Object} options Source options, specific to the source type (except for `options.type`, which is always\n * required).\n * @param {string} options.type The source type, matching the value of `name` used in {@link Style#addSourceType}.\n * @param {Dispatcher} dispatcher A {@link Dispatcher} instance, which can be used to send messages to the workers.\n *\n * @fires data with `{dataType: 'source', sourceDataType: 'metadata'}` to indicate that any necessary metadata\n * has been loaded so that it's okay to call `loadTile`; and with `{dataType: 'source', sourceDataType: 'content'}`\n * to indicate that the source data has changed, so that any current caches should be flushed.\n * @property {string} id The id for the source. Must match the id passed to the constructor.\n * @property {number} minzoom\n * @property {number} maxzoom\n * @property {boolean} isTileClipped `false` if tiles can be drawn outside their boundaries, `true` if they cannot.\n * @property {boolean} reparseOverscaled `true` if tiles should be sent back to the worker for each overzoomed zoom\n * level, `false` if not.\n * @property {boolean} roundZoom `true` if zoom levels are rounded to the nearest integer in the source data, `false`\n * if they are floor-ed to the nearest integer.\n */\nexport interface Source {\n /**\n * An optional URL to a script which, when run by a Worker, registers a {@link WorkerSource}\n * implementation for this Source type by calling `self.registerWorkerSource(workerSource: WorkerSource)`.\n * @private\n */\n // Static interface properties are not supported in flow as of 0.62.0.\n // https://github.com/facebook/flow/issues/5590\n // static workerSourceURL?: URL;\n\n +type: string;\n id: string;\n minzoom: number,\n maxzoom: number,\n tileSize: number,\n attribution?: string,\n\n roundZoom?: boolean,\n reparseOverscaled?: boolean,\n vectorLayerIds?: Array,\n\n hasTransition(): boolean;\n\n fire(event: Event): mixed;\n\n +onAdd?: (map: Map) => void;\n +onRemove?: (map: Map) => void;\n\n loadTile(tile: Tile, callback: Callback): void;\n +hasTile?: (tileID: OverscaledTileID) => boolean;\n +abortTile?: (tile: Tile, callback: Callback) => void;\n +unloadTile?: (tile: Tile, callback: Callback) => void;\n\n /**\n * @returns A plain (stringifiable) JS object representing the current state of the source.\n * Creating a source using the returned object as the `options` should result in a Source that is\n * equivalent to this one.\n * @private\n */\n serialize(): Object;\n\n +prepare?: () => void;\n}\n\nimport vector from '../source/vector_tile_source';\nimport raster from '../source/raster_tile_source';\nimport rasterDem from '../source/raster_dem_tile_source';\nimport geojson from '../source/geojson_source';\nimport video from '../source/video_source';\nimport image from '../source/image_source';\nimport canvas from '../source/canvas_source';\n\nconst sourceTypes = {\n vector,\n raster,\n 'raster-dem': rasterDem,\n geojson,\n video,\n image,\n canvas\n};\n\n/*\n * Creates a tiled data source instance given an options object.\n *\n * @param id\n * @param {Object} source A source definition object compliant with\n * [`mapbox-gl-style-spec`](https://www.mapbox.com/mapbox-gl-style-spec/#sources) or, for a third-party source type,\n * with that type's requirements.\n * @param {Dispatcher} dispatcher\n * @returns {Source}\n */\nexport const create = function(id: string, specification: SourceSpecification, dispatcher: Dispatcher, eventedParent: Evented) {\n const source = new sourceTypes[specification.type](id, (specification: any), dispatcher, eventedParent);\n\n if (source.id !== id) {\n throw new Error(`Expected Source id to be ${id} instead of ${source.id}`);\n }\n\n bindAll(['load', 'abort', 'unload', 'serialize', 'prepare'], source);\n return source;\n};\n\nexport const getType = function (name: string) {\n return sourceTypes[name];\n};\n\nexport const setType = function (name: string, type: Class) {\n sourceTypes[name] = type;\n};\n\nexport interface Actor {\n send(type: string, data: Object, callback: Callback): void;\n}\n","// @flow\n\nimport type SourceCache from './source_cache';\nimport type StyleLayer from '../style/style_layer';\nimport type Coordinate from '../geo/coordinate';\nimport type CollisionIndex from '../symbol/collision_index';\nimport type Transform from '../geo/transform';\nimport type { RetainedQueryData } from '../symbol/placement';\nimport assert from 'assert';\n\nexport function queryRenderedFeatures(sourceCache: SourceCache,\n styleLayers: {[string]: StyleLayer},\n queryGeometry: Array,\n params: { filter: FilterSpecification, layers: Array },\n transform: Transform) {\n const maxPitchScaleFactor = transform.maxPitchScaleFactor();\n const tilesIn = sourceCache.tilesIn(queryGeometry, maxPitchScaleFactor);\n\n tilesIn.sort(sortTilesIn);\n\n const renderedFeatureLayers = [];\n for (const tileIn of tilesIn) {\n renderedFeatureLayers.push({\n wrappedTileID: tileIn.tileID.wrapped().key,\n queryResults: tileIn.tile.queryRenderedFeatures(\n styleLayers,\n tileIn.queryGeometry,\n tileIn.scale,\n params,\n transform,\n maxPitchScaleFactor,\n sourceCache.transform.calculatePosMatrix(tileIn.tileID.toUnwrapped()))\n });\n }\n\n return mergeRenderedFeatureLayers(renderedFeatureLayers);\n}\n\nexport function queryRenderedSymbols(styleLayers: {[string]: StyleLayer},\n queryGeometry: Array,\n params: { filter: FilterSpecification, layers: Array },\n collisionIndex: CollisionIndex,\n retainedQueryData: {[number]: RetainedQueryData}) {\n const result = {};\n const renderedSymbols = collisionIndex.queryRenderedSymbols(queryGeometry);\n const bucketQueryData = [];\n for (const bucketInstanceId of Object.keys(renderedSymbols).map(Number)) {\n bucketQueryData.push(retainedQueryData[bucketInstanceId]);\n }\n bucketQueryData.sort(sortTilesIn);\n\n for (const queryData of bucketQueryData) {\n const bucketSymbols = queryData.featureIndex.lookupSymbolFeatures(\n renderedSymbols[queryData.bucketInstanceId],\n queryData.bucketIndex,\n queryData.sourceLayerIndex,\n params.filter,\n params.layers,\n styleLayers);\n\n for (const layerID in bucketSymbols) {\n const resultFeatures = result[layerID] = result[layerID] || [];\n const layerSymbols = bucketSymbols[layerID];\n layerSymbols.sort((a, b) => {\n // Match topDownFeatureComparator from FeatureIndex, but using\n // most recent sorting of features from bucket.sortFeatures\n const featureSortOrder = queryData.featureSortOrder;\n if (featureSortOrder) {\n // queryRenderedSymbols documentation says we'll return features in\n // \"top-to-bottom\" rendering order (aka last-to-first).\n // Actually there can be multiple symbol instances per feature, so\n // we sort each feature based on the first matching symbol instance.\n const sortedA = featureSortOrder.indexOf(a.featureIndex);\n const sortedB = featureSortOrder.indexOf(b.featureIndex);\n assert(sortedA >= 0);\n assert(sortedB >= 0);\n return sortedB - sortedA;\n } else {\n // Bucket hasn't been re-sorted based on angle, so use the\n // reverse of the order the features appeared in the data.\n return b.featureIndex - a.featureIndex;\n }\n });\n for (const symbolFeature of layerSymbols) {\n resultFeatures.push(symbolFeature.feature);\n }\n }\n }\n return result;\n}\n\nexport function querySourceFeatures(sourceCache: SourceCache, params: any) {\n const tiles = sourceCache.getRenderableIds().map((id) => {\n return sourceCache.getTileByID(id);\n });\n\n const result = [];\n\n const dataTiles = {};\n for (let i = 0; i < tiles.length; i++) {\n const tile = tiles[i];\n const dataID = tile.tileID.canonical.key;\n if (!dataTiles[dataID]) {\n dataTiles[dataID] = true;\n tile.querySourceFeatures(result, params);\n }\n }\n\n return result;\n}\n\nfunction sortTilesIn(a, b) {\n const idA = a.tileID;\n const idB = b.tileID;\n return (idA.overscaledZ - idB.overscaledZ) || (idA.canonical.y - idB.canonical.y) || (idA.wrap - idB.wrap) || (idA.canonical.x - idB.canonical.x);\n}\n\nfunction mergeRenderedFeatureLayers(tiles) {\n // Merge results from all tiles, but if two tiles share the same\n // wrapped ID, don't duplicate features between the two tiles\n const result = {};\n const wrappedIDLayerMap = {};\n for (const tile of tiles) {\n const queryResults = tile.queryResults;\n const wrappedID = tile.wrappedTileID;\n const wrappedIDLayers = wrappedIDLayerMap[wrappedID] = wrappedIDLayerMap[wrappedID] || {};\n for (const layerID in queryResults) {\n const tileFeatures = queryResults[layerID];\n const wrappedIDFeatures = wrappedIDLayers[layerID] = wrappedIDLayers[layerID] || {};\n const resultFeatures = result[layerID] = result[layerID] || [];\n for (const tileFeature of tileFeatures) {\n if (!wrappedIDFeatures[tileFeature.featureIndex]) {\n wrappedIDFeatures[tileFeature.featureIndex] = true;\n resultFeatures.push(tileFeature.feature);\n }\n }\n }\n }\n return result;\n}\n","// @flow\n\nimport { uniqueId, deepEqual, parseCacheControl } from '../util/util';\nimport { deserialize as deserializeBucket } from '../data/bucket';\nimport FeatureIndex from '../data/feature_index';\nimport GeoJSONFeature from '../util/vectortile_to_geojson';\nimport featureFilter from '../style-spec/feature_filter';\nimport SymbolBucket from '../data/bucket/symbol_bucket';\nimport { RasterBoundsArray, CollisionBoxArray } from '../data/array_types';\nimport rasterBoundsAttributes from '../data/raster_bounds_attributes';\nimport EXTENT from '../data/extent';\nimport Point from '@mapbox/point-geometry';\nimport Texture from '../render/texture';\nimport SegmentVector from '../data/segment';\nimport { TriangleIndexArray } from '../data/index_array_type';\nimport browser from '../util/browser';\nimport EvaluationParameters from '../style/evaluation_parameters';\n\nconst CLOCK_SKEW_RETRY_TIMEOUT = 30000;\n\nimport type {Bucket} from '../data/bucket';\nimport type StyleLayer from '../style/style_layer';\nimport type {WorkerTileResult} from './worker_source';\nimport type DEMData from '../data/dem_data';\nimport type {RGBAImage, AlphaImage} from '../util/image';\nimport type Mask from '../render/tile_mask';\nimport type Context from '../gl/context';\nimport type IndexBuffer from '../gl/index_buffer';\nimport type VertexBuffer from '../gl/vertex_buffer';\nimport type {OverscaledTileID} from './tile_id';\nimport type Framebuffer from '../gl/framebuffer';\nimport type {PerformanceResourceTiming} from '../types/performance_resource_timing';\nimport type Transform from '../geo/transform';\n\nexport type TileState =\n | 'loading' // Tile data is in the process of loading.\n | 'loaded' // Tile data has been loaded. Tile can be rendered.\n | 'reloading' // Tile data has been loaded and is being updated. Tile can be rendered.\n | 'unloaded' // Tile data has been deleted.\n | 'errored' // Tile data was not loaded because of an error.\n | 'expired'; /* Tile data was previously loaded, but has expired per its\n * HTTP headers and is in the process of refreshing. */\n\n/**\n * A tile object is the combination of a Coordinate, which defines\n * its place, as well as a unique ID and data tracking for its content\n *\n * @private\n */\nclass Tile {\n tileID: OverscaledTileID;\n uid: number;\n uses: number;\n tileSize: number;\n buckets: {[string]: Bucket};\n latestFeatureIndex: ?FeatureIndex;\n latestRawTileData: ?ArrayBuffer;\n iconAtlasImage: ?RGBAImage;\n iconAtlasTexture: Texture;\n glyphAtlasImage: ?AlphaImage;\n glyphAtlasTexture: Texture;\n expirationTime: any;\n expiredRequestCount: number;\n state: TileState;\n timeAdded: any;\n fadeEndTime: any;\n collisionBoxArray: ?CollisionBoxArray;\n redoWhenDone: boolean;\n showCollisionBoxes: boolean;\n placementSource: any;\n workerID: number | void;\n vtLayers: {[string]: VectorTileLayer};\n mask: Mask;\n\n neighboringTiles: ?Object;\n dem: ?DEMData;\n aborted: ?boolean;\n maskedBoundsBuffer: ?VertexBuffer;\n maskedIndexBuffer: ?IndexBuffer;\n segments: ?SegmentVector;\n needsHillshadePrepare: ?boolean\n request: any;\n texture: any;\n fbo: ?Framebuffer;\n demTexture: ?Texture;\n refreshedUponExpiration: boolean;\n reloadCallback: any;\n resourceTiming: ?Array;\n queryPadding: number;\n\n /**\n * @param {OverscaledTileID} tileID\n * @param size\n */\n constructor(tileID: OverscaledTileID, size: number) {\n this.tileID = tileID;\n this.uid = uniqueId();\n this.uses = 0;\n this.tileSize = size;\n this.buckets = {};\n this.expirationTime = null;\n this.queryPadding = 0;\n\n // Counts the number of times a response was already expired when\n // received. We're using this to add a delay when making a new request\n // so we don't have to keep retrying immediately in case of a server\n // serving expired tiles.\n this.expiredRequestCount = 0;\n\n this.state = 'loading';\n }\n\n registerFadeDuration(duration: number) {\n const fadeEndTime = duration + this.timeAdded;\n if (fadeEndTime < browser.now()) return;\n if (this.fadeEndTime && fadeEndTime < this.fadeEndTime) return;\n\n this.fadeEndTime = fadeEndTime;\n }\n\n wasRequested() {\n return this.state === 'errored' || this.state === 'loaded' || this.state === 'reloading';\n }\n\n /**\n * Given a data object with a 'buffers' property, load it into\n * this tile's elementGroups and buffers properties and set loaded\n * to true. If the data is null, like in the case of an empty\n * GeoJSON tile, no-op but still set loaded to true.\n * @param {Object} data\n * @param painter\n * @returns {undefined}\n * @private\n */\n loadVectorData(data: WorkerTileResult, painter: any, justReloaded: ?boolean) {\n if (this.hasData()) {\n this.unloadVectorData();\n }\n\n this.state = 'loaded';\n\n // empty GeoJSON tile\n if (!data) {\n this.collisionBoxArray = new CollisionBoxArray();\n return;\n }\n\n if (data.featureIndex) {\n this.latestFeatureIndex = data.featureIndex;\n if (data.rawTileData) {\n // Only vector tiles have rawTileData, and they won't update it for\n // 'reloadTile'\n this.latestRawTileData = data.rawTileData;\n this.latestFeatureIndex.rawTileData = data.rawTileData;\n } else if (this.latestRawTileData) {\n // If rawTileData hasn't updated, hold onto a pointer to the last\n // one we received\n this.latestFeatureIndex.rawTileData = this.latestRawTileData;\n }\n }\n this.collisionBoxArray = data.collisionBoxArray;\n this.buckets = deserializeBucket(data.buckets, painter.style);\n\n if (justReloaded) {\n for (const id in this.buckets) {\n const bucket = this.buckets[id];\n if (bucket instanceof SymbolBucket) {\n bucket.justReloaded = true;\n }\n }\n }\n\n this.queryPadding = 0;\n for (const id in this.buckets) {\n const bucket = this.buckets[id];\n this.queryPadding = Math.max(this.queryPadding, painter.style.getLayer(bucket.layerIds[0]).queryRadius(bucket));\n }\n\n if (data.iconAtlasImage) {\n this.iconAtlasImage = data.iconAtlasImage;\n }\n if (data.glyphAtlasImage) {\n this.glyphAtlasImage = data.glyphAtlasImage;\n }\n }\n\n /**\n * Release any data or WebGL resources referenced by this tile.\n * @returns {undefined}\n * @private\n */\n unloadVectorData() {\n for (const id in this.buckets) {\n this.buckets[id].destroy();\n }\n this.buckets = {};\n\n if (this.iconAtlasTexture) {\n this.iconAtlasTexture.destroy();\n }\n if (this.glyphAtlasTexture) {\n this.glyphAtlasTexture.destroy();\n }\n\n this.latestFeatureIndex = null;\n this.state = 'unloaded';\n }\n\n unloadDEMData() {\n this.dem = null;\n this.neighboringTiles = null;\n this.state = 'unloaded';\n }\n\n getBucket(layer: StyleLayer) {\n return this.buckets[layer.id];\n }\n\n upload(context: Context) {\n for (const id in this.buckets) {\n const bucket = this.buckets[id];\n if (!bucket.uploaded) {\n bucket.upload(context);\n bucket.uploaded = true;\n }\n }\n\n const gl = context.gl;\n\n if (this.iconAtlasImage) {\n this.iconAtlasTexture = new Texture(context, this.iconAtlasImage, gl.RGBA);\n this.iconAtlasImage = null;\n }\n\n if (this.glyphAtlasImage) {\n this.glyphAtlasTexture = new Texture(context, this.glyphAtlasImage, gl.ALPHA);\n this.glyphAtlasImage = null;\n }\n }\n\n // Queries non-symbol features rendered for this tile.\n // Symbol features are queried globally\n queryRenderedFeatures(layers: {[string]: StyleLayer},\n queryGeometry: Array>,\n scale: number,\n params: { filter: FilterSpecification, layers: Array },\n transform: Transform,\n maxPitchScaleFactor: number,\n posMatrix: Float32Array): {[string]: Array<{ featureIndex: number, feature: GeoJSONFeature }>} {\n if (!this.latestFeatureIndex || !this.latestFeatureIndex.rawTileData)\n return {};\n\n return this.latestFeatureIndex.query({\n queryGeometry: queryGeometry,\n scale: scale,\n tileSize: this.tileSize,\n posMatrix: posMatrix,\n transform: transform,\n params: params,\n queryPadding: this.queryPadding * maxPitchScaleFactor\n }, layers);\n }\n\n querySourceFeatures(result: Array, params: any) {\n if (!this.latestFeatureIndex || !this.latestFeatureIndex.rawTileData) return;\n\n const vtLayers = this.latestFeatureIndex.loadVTLayers();\n\n const sourceLayer = params ? params.sourceLayer : '';\n const layer = vtLayers._geojsonTileLayer || vtLayers[sourceLayer];\n\n if (!layer) return;\n\n const filter = featureFilter(params && params.filter);\n const coord = { z: this.tileID.overscaledZ, x: this.tileID.canonical.x, y: this.tileID.canonical.y };\n\n for (let i = 0; i < layer.length; i++) {\n const feature = layer.feature(i);\n if (filter(new EvaluationParameters(this.tileID.overscaledZ), feature)) {\n const geojsonFeature = new GeoJSONFeature(feature, coord.z, coord.x, coord.y);\n (geojsonFeature: any).tile = coord;\n result.push(geojsonFeature);\n }\n }\n }\n\n clearMask() {\n if (this.segments) {\n this.segments.destroy();\n delete this.segments;\n }\n if (this.maskedBoundsBuffer) {\n this.maskedBoundsBuffer.destroy();\n delete this.maskedBoundsBuffer;\n }\n if (this.maskedIndexBuffer) {\n this.maskedIndexBuffer.destroy();\n delete this.maskedIndexBuffer;\n }\n }\n\n setMask(mask: Mask, context: Context) {\n\n // don't redo buffer work if the mask is the same;\n if (deepEqual(this.mask, mask)) return;\n\n this.mask = mask;\n this.clearMask();\n\n // We want to render the full tile, and keeping the segments/vertices/indices empty means\n // using the global shared buffers for covering the entire tile.\n if (deepEqual(mask, {'0': true})) return;\n\n const maskedBoundsArray = new RasterBoundsArray();\n const indexArray = new TriangleIndexArray();\n\n this.segments = new SegmentVector();\n // Create a new segment so that we will upload (empty) buffers even when there is nothing to\n // draw for this tile.\n this.segments.prepareSegment(0, maskedBoundsArray, indexArray);\n\n const maskArray = Object.keys(mask);\n for (let i = 0; i < maskArray.length; i++) {\n const maskCoord = mask[maskArray[i]];\n const vertexExtent = EXTENT >> maskCoord.z;\n const tlVertex = new Point(maskCoord.x * vertexExtent, maskCoord.y * vertexExtent);\n const brVertex = new Point(tlVertex.x + vertexExtent, tlVertex.y + vertexExtent);\n\n // not sure why flow is complaining here because it doesn't complain at L401\n const segment = (this.segments: any).prepareSegment(4, maskedBoundsArray, indexArray);\n\n maskedBoundsArray.emplaceBack(tlVertex.x, tlVertex.y, tlVertex.x, tlVertex.y);\n maskedBoundsArray.emplaceBack(brVertex.x, tlVertex.y, brVertex.x, tlVertex.y);\n maskedBoundsArray.emplaceBack(tlVertex.x, brVertex.y, tlVertex.x, brVertex.y);\n maskedBoundsArray.emplaceBack(brVertex.x, brVertex.y, brVertex.x, brVertex.y);\n\n const offset = segment.vertexLength;\n // 0, 1, 2\n // 1, 2, 3\n indexArray.emplaceBack(offset, offset + 1, offset + 2);\n indexArray.emplaceBack(offset + 1, offset + 2, offset + 3);\n\n segment.vertexLength += 4;\n segment.primitiveLength += 2;\n }\n\n this.maskedBoundsBuffer = context.createVertexBuffer(maskedBoundsArray, rasterBoundsAttributes.members);\n this.maskedIndexBuffer = context.createIndexBuffer(indexArray);\n }\n\n hasData() {\n return this.state === 'loaded' || this.state === 'reloading' || this.state === 'expired';\n }\n\n setExpiryData(data: any) {\n const prior = this.expirationTime;\n\n if (data.cacheControl) {\n const parsedCC = parseCacheControl(data.cacheControl);\n if (parsedCC['max-age']) this.expirationTime = Date.now() + parsedCC['max-age'] * 1000;\n } else if (data.expires) {\n this.expirationTime = new Date(data.expires).getTime();\n }\n\n if (this.expirationTime) {\n const now = Date.now();\n let isExpired = false;\n\n if (this.expirationTime > now) {\n isExpired = false;\n } else if (!prior) {\n isExpired = true;\n } else if (this.expirationTime < prior) {\n // Expiring date is going backwards:\n // fall back to exponential backoff\n isExpired = true;\n\n } else {\n const delta = this.expirationTime - prior;\n\n if (!delta) {\n // Server is serving the same expired resource over and over: fall\n // back to exponential backoff.\n isExpired = true;\n\n } else {\n // Assume that either the client or the server clock is wrong and\n // try to interpolate a valid expiration date (from the client POV)\n // observing a minimum timeout.\n this.expirationTime = now + Math.max(delta, CLOCK_SKEW_RETRY_TIMEOUT);\n\n }\n }\n\n if (isExpired) {\n this.expiredRequestCount++;\n this.state = 'expired';\n } else {\n this.expiredRequestCount = 0;\n }\n }\n }\n\n getExpiryTimeout() {\n if (this.expirationTime) {\n if (this.expiredRequestCount) {\n return 1000 * (1 << Math.min(this.expiredRequestCount - 1, 31));\n } else {\n // Max value for `setTimeout` implementations is a 32 bit integer; cap this accordingly\n return Math.min(this.expirationTime - new Date().getTime(), Math.pow(2, 31) - 1);\n }\n }\n }\n\n}\n\nexport default Tile;\n","// @flow\n\nimport type {CollisionBoxArray} from './array_types';\nimport type Style from '../style/style';\nimport type {TypedStyleLayer} from '../style/style_layer/typed_style_layer';\nimport type FeatureIndex from './feature_index';\nimport type Context from '../gl/context';\n\nexport type BucketParameters = {\n index: number,\n layers: Array,\n zoom: number,\n pixelRatio: number,\n overscaling: number,\n collisionBoxArray: CollisionBoxArray,\n sourceLayerIndex: number\n}\n\nexport type PopulateParameters = {\n featureIndex: FeatureIndex,\n iconDependencies: {},\n glyphDependencies: {}\n}\n\nexport type IndexedFeature = {\n feature: VectorTileFeature,\n index: number,\n sourceLayerIndex: number,\n}\n\n/**\n * The `Bucket` interface is the single point of knowledge about turning vector\n * tiles into WebGL buffers.\n *\n * `Bucket` is an abstract interface. An implementation exists for each style layer type.\n * Create a bucket via the `StyleLayer#createBucket` method.\n *\n * The concrete bucket types, using layout options from the style layer,\n * transform feature geometries into vertex and index data for use by the\n * vertex shader. They also (via `ProgramConfiguration`) use feature\n * properties and the zoom level to populate the attributes needed for\n * data-driven styling.\n *\n * Buckets are designed to be built on a worker thread and then serialized and\n * transferred back to the main thread for rendering. On the worker side, a\n * bucket's vertex, index, and attribute data is stored in `bucket.arrays:\n * ArrayGroup`. When a bucket's data is serialized and sent back to the main\n * thread, is gets deserialized (using `new Bucket(serializedBucketData)`, with\n * the array data now stored in `bucket.buffers: BufferGroup`. BufferGroups\n * hold the same data as ArrayGroups, but are tuned for consumption by WebGL.\n *\n * @private\n */\nexport interface Bucket {\n layerIds: Array;\n\n populate(features: Array, options: PopulateParameters): void;\n isEmpty(): boolean;\n\n upload(context: Context): void;\n uploaded: boolean;\n\n /**\n * Release the WebGL resources associated with the buffers. Note that because\n * buckets are shared between layers having the same layout properties, they\n * must be destroyed in groups (all buckets for a tile, or all symbol buckets).\n *\n * @private\n */\n destroy(): void;\n}\n\nexport function deserialize(input: Array, style: Style): {[string]: Bucket} {\n const output = {};\n\n // Guard against the case where the map's style has been set to null while\n // this bucket has been parsing.\n if (!style) return output;\n\n for (const bucket of input) {\n const layers = bucket.layerIds\n .map((id) => style.getLayer(id))\n .filter(Boolean);\n\n if (layers.length === 0) {\n continue;\n }\n\n // look up StyleLayer objects from layer ids (since we don't\n // want to waste time serializing/copying them from the worker)\n (bucket: any).layers = layers;\n\n for (const layer of layers) {\n output[layer.id] = bucket;\n }\n }\n\n return output;\n}\n","// @flow\n\nimport { OverscaledTileID } from './tile_id';\nimport type Tile from './tile';\n\n/**\n * A [least-recently-used cache](http://en.wikipedia.org/wiki/Cache_algorithms)\n * with hash lookup made possible by keeping a list of keys in parallel to\n * an array of dictionary of values\n *\n * @private\n */\nclass TileCache {\n max: number;\n data: {[key: number | string]: Array<{ value: Tile, timeout: ?TimeoutID}>};\n order: Array;\n onRemove: (element: Tile) => void;\n /**\n * @param {number} max number of permitted values\n * @param {Function} onRemove callback called with items when they expire\n */\n constructor(max: number, onRemove: (element: Tile) => void) {\n this.max = max;\n this.onRemove = onRemove;\n this.reset();\n }\n\n /**\n * Clear the cache\n *\n * @returns {TileCache} this cache\n * @private\n */\n reset() {\n for (const key in this.data) {\n for (const removedData of this.data[key]) {\n if (removedData.timeout) clearTimeout(removedData.timeout);\n this.onRemove(removedData.value);\n }\n }\n\n this.data = {};\n this.order = [];\n\n return this;\n }\n\n /**\n * Add a key, value combination to the cache, trimming its size if this pushes\n * it over max length.\n *\n * @param {OverscaledTileID} tileID lookup key for the item\n * @param {*} data any value\n *\n * @returns {TileCache} this cache\n * @private\n */\n add(tileID: OverscaledTileID, data: Tile, expiryTimeout: number | void) {\n const key = tileID.wrapped().key;\n if (this.data[key] === undefined) {\n this.data[key] = [];\n }\n\n const dataWrapper = {\n value: data,\n timeout: undefined\n };\n\n if (expiryTimeout !== undefined) {\n dataWrapper.timeout = setTimeout(() => {\n this.remove(tileID, dataWrapper);\n }, expiryTimeout);\n }\n\n this.data[key].push(dataWrapper);\n this.order.push(key);\n\n if (this.order.length > this.max) {\n const removedData = this._getAndRemoveByKey(this.order[0]);\n if (removedData) this.onRemove(removedData);\n }\n\n return this;\n }\n\n /**\n * Determine whether the value attached to `key` is present\n *\n * @param {OverscaledTileID} tileID the key to be looked-up\n * @returns {boolean} whether the cache has this value\n * @private\n */\n has(tileID: OverscaledTileID): boolean {\n return tileID.wrapped().key in this.data;\n }\n\n /**\n * Get the value attached to a specific key and remove data from cache.\n * If the key is not found, returns `null`\n *\n * @param {OverscaledTileID} tileID the key to look up\n * @returns {*} the data, or null if it isn't found\n * @private\n */\n getAndRemove(tileID: OverscaledTileID): ?Tile {\n if (!this.has(tileID)) { return null; }\n return this._getAndRemoveByKey(tileID.wrapped().key);\n }\n\n /*\n * Get and remove the value with the specified key.\n */\n _getAndRemoveByKey(key: number): ?Tile {\n const data = this.data[key].shift();\n if (data.timeout) clearTimeout(data.timeout);\n\n if (this.data[key].length === 0) {\n delete this.data[key];\n }\n this.order.splice(this.order.indexOf(key), 1);\n\n return data.value;\n }\n\n /**\n * Get the value attached to a specific key without removing data\n * from the cache. If the key is not found, returns `null`\n *\n * @param {OverscaledTileID} tileID the key to look up\n * @returns {*} the data, or null if it isn't found\n * @private\n */\n get(tileID: OverscaledTileID): ?Tile {\n if (!this.has(tileID)) { return null; }\n\n const data = this.data[tileID.wrapped().key][0];\n return data.value;\n }\n\n /**\n * Remove a key/value combination from the cache.\n *\n * @param {OverscaledTileID} tileID the key for the pair to delete\n * @param {Tile} value If a value is provided, remove that exact version of the value.\n * @returns {TileCache} this cache\n * @private\n */\n remove(tileID: OverscaledTileID, value: ?{ value: Tile, timeout: ?TimeoutID}) {\n if (!this.has(tileID)) { return this; }\n const key = tileID.wrapped().key;\n\n const dataIndex = value === undefined ? 0 : this.data[key].indexOf(value);\n const data = this.data[key][dataIndex];\n this.data[key].splice(dataIndex, 1);\n if (data.timeout) clearTimeout(data.timeout);\n if (this.data[key].length === 0) {\n delete this.data[key];\n }\n this.onRemove(data.value);\n this.order.splice(this.order.indexOf(key), 1);\n\n return this;\n }\n\n /**\n * Change the max size of the cache.\n *\n * @param {number} max the max size of the cache\n * @returns {TileCache} this cache\n * @private\n */\n setMaxSize(max: number): TileCache {\n this.max = max;\n\n while (this.order.length > this.max) {\n const removedData = this._getAndRemoveByKey(this.order[0]);\n if (removedData) this.onRemove(removedData);\n }\n\n return this;\n }\n}\n\nexport default TileCache;\n","// @flow\nimport assert from 'assert';\n\nimport type {StructArray} from '../util/struct_array';\nimport type {TriangleIndexArray, LineIndexArray} from '../data/index_array_type';\nimport type Context from '../gl/context';\n\n\nclass IndexBuffer {\n context: Context;\n buffer: WebGLBuffer;\n dynamicDraw: boolean;\n\n constructor(context: Context, array: TriangleIndexArray | LineIndexArray, dynamicDraw?: boolean) {\n this.context = context;\n const gl = context.gl;\n this.buffer = gl.createBuffer();\n this.dynamicDraw = Boolean(dynamicDraw);\n\n this.unbindVAO();\n\n context.bindElementBuffer.set(this.buffer);\n gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, array.arrayBuffer, this.dynamicDraw ? gl.DYNAMIC_DRAW : gl.STATIC_DRAW);\n\n if (!this.dynamicDraw) {\n delete array.arrayBuffer;\n }\n }\n\n unbindVAO() {\n // The bound index buffer is part of vertex array object state. We don't want to\n // modify whatever VAO happens to be currently bound, so make sure the default\n // vertex array provided by the context is bound instead.\n if (this.context.extVertexArrayObject) {\n this.context.bindVertexArrayOES.set(null);\n }\n }\n\n bind() {\n this.context.bindElementBuffer.set(this.buffer);\n }\n\n updateData(array: StructArray) {\n const gl = this.context.gl;\n assert(this.dynamicDraw);\n // The right VAO will get this buffer re-bound later in VertexArrayObject#bind\n // See https://github.com/mapbox/mapbox-gl-js/issues/5620\n this.unbindVAO();\n this.bind();\n gl.bufferSubData(gl.ELEMENT_ARRAY_BUFFER, 0, array.arrayBuffer);\n }\n\n destroy() {\n const gl = this.context.gl;\n if (this.buffer) {\n gl.deleteBuffer(this.buffer);\n delete this.buffer;\n }\n }\n}\n\nexport default IndexBuffer;\n","// @flow\n\nimport assert from 'assert';\n\nimport type {\n StructArray,\n StructArrayMember\n} from '../util/struct_array';\n\nimport type Program from '../render/program';\nimport type Context from '../gl/context';\n\n/**\n * @enum {string} AttributeType\n * @private\n * @readonly\n */\nconst AttributeType = {\n Int8: 'BYTE',\n Uint8: 'UNSIGNED_BYTE',\n Int16: 'SHORT',\n Uint16: 'UNSIGNED_SHORT',\n Int32: 'INT',\n Uint32: 'UNSIGNED_INT',\n Float32: 'FLOAT'\n};\n\n/**\n * The `VertexBuffer` class turns a `StructArray` into a WebGL buffer. Each member of the StructArray's\n * Struct type is converted to a WebGL atribute.\n * @private\n */\nclass VertexBuffer {\n length: number;\n attributes: $ReadOnlyArray;\n itemSize: number;\n dynamicDraw: ?boolean;\n context: Context;\n buffer: WebGLBuffer;\n\n /**\n * @param dynamicDraw Whether this buffer will be repeatedly updated.\n */\n constructor(context: Context, array: StructArray, attributes: $ReadOnlyArray, dynamicDraw?: boolean) {\n this.length = array.length;\n this.attributes = attributes;\n this.itemSize = array.bytesPerElement;\n this.dynamicDraw = dynamicDraw;\n\n this.context = context;\n const gl = context.gl;\n this.buffer = gl.createBuffer();\n context.bindVertexBuffer.set(this.buffer);\n gl.bufferData(gl.ARRAY_BUFFER, array.arrayBuffer, this.dynamicDraw ? gl.DYNAMIC_DRAW : gl.STATIC_DRAW);\n\n if (!this.dynamicDraw) {\n delete array.arrayBuffer;\n }\n }\n\n bind() {\n this.context.bindVertexBuffer.set(this.buffer);\n }\n\n updateData(array: StructArray) {\n assert(array.length === this.length);\n const gl = this.context.gl;\n this.bind();\n gl.bufferSubData(gl.ARRAY_BUFFER, 0, array.arrayBuffer);\n }\n\n enableAttributes(gl: WebGLRenderingContext, program: Program) {\n for (let j = 0; j < this.attributes.length; j++) {\n const member = this.attributes[j];\n const attribIndex: number | void = program.attributes[member.name];\n if (attribIndex !== undefined) {\n gl.enableVertexAttribArray(attribIndex);\n }\n }\n }\n\n /**\n * Set the attribute pointers in a WebGL context\n * @param gl The WebGL context\n * @param program The active WebGL program\n * @param vertexOffset Index of the starting vertex of the segment\n */\n setVertexAttribPointers(gl: WebGLRenderingContext, program: Program, vertexOffset: ?number) {\n for (let j = 0; j < this.attributes.length; j++) {\n const member = this.attributes[j];\n const attribIndex: number | void = program.attributes[member.name];\n\n if (attribIndex !== undefined) {\n gl.vertexAttribPointer(\n attribIndex,\n member.components,\n (gl: any)[AttributeType[member.type]],\n false,\n this.itemSize,\n member.offset + (this.itemSize * (vertexOffset || 0))\n );\n }\n }\n }\n\n /**\n * Destroy the GL buffer bound to the given WebGL context\n */\n destroy() {\n const gl = this.context.gl;\n if (this.buffer) {\n gl.deleteBuffer(this.buffer);\n delete this.buffer;\n }\n }\n}\n\nexport default VertexBuffer;\n","// @flow\n\nimport Color from '../style-spec/util/color';\n\nimport { clamp } from '../util/util';\n\nimport type Context from './context';\nimport type {\n BlendFuncType,\n ColorMaskType,\n DepthRangeType,\n DepthMaskType,\n StencilFuncType,\n StencilOpType,\n DepthFuncType,\n TextureUnitType,\n ViewportType,\n} from './types';\n\nexport interface Value {\n context: Context;\n current: T;\n get(): T;\n set(value: T): void;\n}\n\nexport class ClearColor implements Value {\n context: Context;\n current: Color;\n\n constructor(context: Context) {\n this.context = context;\n this.current = Color.transparent;\n }\n\n get(): Color { return this.current; }\n\n set(v: Color): void {\n const c = this.current;\n if (v.r !== c.r || v.g !== c.g || v.b !== c.b || v.a !== c.a) {\n this.context.gl.clearColor(v.r, v.g, v.b, v.a);\n this.current = v;\n }\n }\n}\n\nexport class ClearDepth implements Value {\n context: Context;\n current: number;\n\n constructor(context: Context) {\n this.context = context;\n this.current = 1;\n }\n\n get(): number { return this.current; }\n\n set(v: number): void {\n if (this.current !== v) {\n this.context.gl.clearDepth(v);\n this.current = v;\n }\n }\n}\n\nexport class ClearStencil implements Value {\n context: Context;\n current: number;\n\n constructor(context: Context) {\n this.context = context;\n this.current = 0;\n }\n\n get(): number { return this.current; }\n\n set(v: number): void {\n if (this.current !== v) {\n this.context.gl.clearStencil(v);\n this.current = v;\n }\n }\n}\n\nexport class ColorMask implements Value {\n context: Context;\n current: ColorMaskType;\n\n constructor(context: Context) {\n this.context = context;\n this.current = [true, true, true, true];\n }\n\n get(): ColorMaskType { return this.current; }\n\n set(v: ColorMaskType): void {\n const c = this.current;\n if (v[0] !== c[0] || v[1] !== c[1] || v[2] !== c[2] || v[3] !== c[3]) {\n this.context.gl.colorMask(v[0], v[1], v[2], v[3]);\n this.current = v;\n }\n }\n}\n\nexport class DepthMask implements Value {\n context: Context;\n current: DepthMaskType;\n\n constructor(context: Context) {\n this.context = context;\n this.current = true;\n }\n\n get(): DepthMaskType { return this.current; }\n\n set(v: DepthMaskType): void {\n if (this.current !== v) {\n this.context.gl.depthMask(v);\n this.current = v;\n }\n }\n}\n\nexport class StencilMask implements Value {\n context: Context;\n current: number;\n\n constructor(context: Context) {\n this.context = context;\n this.current = 0xFF;\n }\n\n get(): number { return this.current; }\n\n set(v: number): void {\n if (this.current !== v) {\n this.context.gl.stencilMask(v);\n this.current = v;\n }\n }\n}\n\nexport class StencilFunc implements Value {\n context: Context;\n current: StencilFuncType;\n\n constructor(context: Context) {\n this.context = context;\n this.current = {\n func: context.gl.ALWAYS,\n ref: 0,\n mask: 0xFF\n };\n }\n\n get(): StencilFuncType { return this.current; }\n\n set(v: StencilFuncType): void {\n const c = this.current;\n if (v.func !== c.func || v.ref !== c.ref || v.mask !== c.mask) {\n this.context.gl.stencilFunc(v.func, v.ref, v.mask);\n this.current = v;\n }\n }\n}\n\nexport class StencilOp implements Value {\n context: Context;\n current: StencilOpType;\n\n constructor(context: Context) {\n this.context = context;\n const gl = this.context.gl;\n this.current = [gl.KEEP, gl.KEEP, gl.KEEP];\n }\n\n get(): StencilOpType { return this.current; }\n\n set(v: StencilOpType): void {\n const c = this.current;\n if (v[0] !== c[0] || v[1] !== c[1] || v[2] !== c[2]) {\n this.context.gl.stencilOp(v[0], v[1], v[2]);\n this.current = v;\n }\n }\n}\n\nexport class StencilTest implements Value {\n context: Context;\n current: boolean;\n\n constructor(context: Context) {\n this.context = context;\n this.current = false;\n }\n\n get(): boolean { return this.current; }\n\n set(v: boolean): void {\n if (this.current !== v) {\n const gl = this.context.gl;\n if (v) {\n gl.enable(gl.STENCIL_TEST);\n } else {\n gl.disable(gl.STENCIL_TEST);\n }\n this.current = v;\n }\n }\n}\n\nexport class DepthRange implements Value {\n context: Context;\n current: DepthRangeType;\n\n constructor(context: Context) {\n this.context = context;\n this.current = [0, 1];\n }\n\n get(): DepthRangeType { return this.current; }\n\n set(v: DepthRangeType): void {\n const c = this.current;\n if (v[0] !== c[0] || v[1] !== c[1]) {\n this.context.gl.depthRange(v[0], v[1]);\n this.current = v;\n }\n }\n}\n\nexport class DepthTest implements Value {\n context: Context;\n current: boolean;\n\n constructor(context: Context) {\n this.context = context;\n this.current = false;\n }\n\n get(): boolean { return this.current; }\n\n set(v: boolean): void {\n if (this.current !== v) {\n const gl = this.context.gl;\n if (v) {\n gl.enable(gl.DEPTH_TEST);\n } else {\n gl.disable(gl.DEPTH_TEST);\n }\n this.current = v;\n }\n }\n}\n\nexport class DepthFunc implements Value {\n context: Context;\n current: DepthFuncType;\n\n constructor(context: Context) {\n this.context = context;\n this.current = context.gl.LESS;\n }\n\n get(): DepthFuncType { return this.current; }\n\n set(v: DepthFuncType): void {\n if (this.current !== v) {\n this.context.gl.depthFunc(v);\n this.current = v;\n }\n }\n}\n\nexport class Blend implements Value {\n context: Context;\n current: boolean;\n\n constructor(context: Context) {\n this.context = context;\n this.current = false;\n }\n\n get(): boolean { return this.current; }\n\n set(v: boolean): void {\n if (this.current !== v) {\n const gl = this.context.gl;\n if (v) {\n gl.enable(gl.BLEND);\n } else {\n gl.disable(gl.BLEND);\n }\n this.current = v;\n }\n }\n}\n\nexport class BlendFunc implements Value {\n context: Context;\n current: BlendFuncType;\n\n constructor(context: Context) {\n this.context = context;\n const gl = this.context.gl;\n this.current = [gl.ONE, gl.ZERO];\n }\n\n get(): BlendFuncType { return this.current; }\n\n set(v: BlendFuncType): void {\n const c = this.current;\n if (v[0] !== c[0] || v[1] !== c[1]) {\n this.context.gl.blendFunc(v[0], v[1]);\n this.current = v;\n }\n }\n}\n\nexport class BlendColor implements Value {\n context: Context;\n current: Color;\n\n constructor(context: Context) {\n this.context = context;\n this.current = Color.transparent;\n }\n\n get(): Color { return this.current; }\n\n set(v: Color): void {\n const c = this.current;\n if (v.r !== c.r || v.g !== c.g || v.b !== c.b || v.a !== c.a) {\n this.context.gl.blendColor(v.r, v.g, v.b, v.a);\n this.current = v;\n }\n }\n}\n\nexport class Program implements Value {\n context: Context;\n current: ?WebGLProgram;\n\n constructor(context: Context) {\n this.context = context;\n this.current = null;\n }\n\n get(): ?WebGLProgram { return this.current; }\n\n set(v: ?WebGLProgram): void {\n if (this.current !== v) {\n this.context.gl.useProgram(v);\n this.current = v;\n }\n }\n}\n\nexport class LineWidth implements Value {\n context: Context;\n current: number;\n\n constructor(context: Context) {\n this.context = context;\n this.current = 1;\n }\n\n get(): number { return this.current; }\n\n set(v: number): void {\n const range = this.context.lineWidthRange;\n const clamped = clamp(v, range[0], range[1]);\n if (this.current !== clamped) {\n this.context.gl.lineWidth(clamped);\n this.current = v;\n }\n }\n}\n\nexport class ActiveTextureUnit implements Value {\n context: Context;\n current: TextureUnitType;\n\n constructor(context: Context) {\n this.context = context;\n this.current = context.gl.TEXTURE0;\n }\n\n get(): TextureUnitType { return this.current; }\n\n set(v: TextureUnitType): void {\n if (this.current !== v) {\n this.context.gl.activeTexture(v);\n this.current = v;\n }\n }\n}\n\nexport class Viewport implements Value {\n context: Context;\n current: ViewportType;\n\n constructor(context: Context) {\n this.context = context;\n const gl = this.context.gl;\n this.current = [0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight];\n }\n\n get(): ViewportType { return this.current; }\n\n set(v: ViewportType): void {\n const c = this.current;\n if (v[0] !== c[0] || v[1] !== c[1] || v[2] !== c[2] || v[3] !== c[3]) {\n this.context.gl.viewport(v[0], v[1], v[2], v[3]);\n this.current = v;\n }\n }\n}\n\nexport class BindFramebuffer implements Value {\n context: Context;\n current: ?WebGLFramebuffer;\n\n constructor(context: Context) {\n this.context = context;\n this.current = null;\n }\n\n get(): ?WebGLFramebuffer { return this.current; }\n\n set(v: ?WebGLFramebuffer): void {\n if (this.current !== v) {\n const gl = this.context.gl;\n gl.bindFramebuffer(gl.FRAMEBUFFER, v);\n this.current = v;\n }\n }\n}\n\nexport class BindRenderbuffer implements Value {\n context: Context;\n current: ?WebGLRenderbuffer;\n\n constructor(context: Context) {\n this.context = context;\n this.current = null;\n }\n\n get(): ?WebGLRenderbuffer { return this.current; }\n\n set(v: ?WebGLRenderbuffer): void {\n if (this.current !== v) {\n const gl = this.context.gl;\n gl.bindRenderbuffer(gl.RENDERBUFFER, v);\n this.current = v;\n }\n }\n}\n\nexport class BindTexture implements Value {\n context: Context;\n current: ?WebGLTexture;\n\n constructor(context: Context) {\n this.context = context;\n this.current = null;\n }\n\n get(): ?WebGLTexture { return this.current; }\n\n set(v: ?WebGLTexture): void {\n if (this.current !== v) {\n const gl = this.context.gl;\n gl.bindTexture(gl.TEXTURE_2D, v);\n this.current = v;\n }\n }\n}\n\nexport class BindVertexBuffer implements Value {\n context: Context;\n current: ?WebGLBuffer;\n\n constructor(context: Context) {\n this.context = context;\n this.current = null;\n }\n\n get(): ?WebGLBuffer { return this.current; }\n\n set(v: ?WebGLBuffer): void {\n if (this.current !== v) {\n const gl = this.context.gl;\n gl.bindBuffer(gl.ARRAY_BUFFER, v);\n this.current = v;\n }\n }\n}\n\nexport class BindElementBuffer implements Value {\n context: Context;\n current: ?WebGLBuffer;\n\n constructor(context: Context) {\n this.context = context;\n this.current = null;\n }\n\n get(): ?WebGLBuffer { return this.current; }\n\n set(v: ?WebGLBuffer): void {\n // Always rebind\n const gl = this.context.gl;\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, v);\n this.current = v;\n }\n}\n\nexport class BindVertexArrayOES implements Value {\n context: Context;\n current: any;\n\n constructor(context: Context) {\n this.context = context;\n this.current = null;\n }\n\n get(): any { return this.current; }\n\n set(v: any): void {\n if (this.current !== v && this.context.extVertexArrayObject) {\n this.context.extVertexArrayObject.bindVertexArrayOES(v);\n this.current = v;\n }\n }\n}\n\nexport class PixelStoreUnpack implements Value {\n context: Context;\n current: number;\n\n constructor(context: Context) {\n this.context = context;\n this.current = 4;\n }\n\n get(): number { return this.current; }\n\n set(v: number): void {\n if (this.current !== v) {\n const gl = this.context.gl;\n gl.pixelStorei(gl.UNPACK_ALIGNMENT, v);\n this.current = v;\n }\n }\n}\n\nexport class PixelStoreUnpackPremultiplyAlpha implements Value {\n context: Context;\n current: boolean;\n\n constructor(context: Context) {\n this.context = context;\n this.current = false;\n }\n\n get(): boolean { return this.current; }\n\n set(v: boolean): void {\n if (this.current !== v) {\n const gl = this.context.gl;\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, (v: any));\n this.current = v;\n }\n }\n}\n\n/**\n * Framebuffer values\n * @private\n */\nexport class FramebufferValue {\n context: Context;\n parent: WebGLFramebuffer;\n current: ?T;\n\n constructor(context: Context, parent: WebGLFramebuffer) {\n this.context = context;\n this.current = null;\n this.parent = parent;\n }\n\n get(): ?T { return this.current; }\n}\n\nexport class ColorAttachment extends FramebufferValue implements Value {\n dirty: boolean;\n\n constructor(context: Context, parent: WebGLFramebuffer) {\n super(context, parent);\n this.dirty = false;\n }\n\n set(v: ?WebGLTexture): void {\n if (this.dirty || this.current !== v) {\n const gl = this.context.gl;\n this.context.bindFramebuffer.set(this.parent);\n // note: it's possible to attach a renderbuffer to the color\n // attachment point, but thus far MBGL only uses textures for color\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, v, 0);\n this.current = v;\n this.dirty = false;\n }\n }\n\n setDirty() {\n this.dirty = true;\n }\n}\n\nexport class DepthAttachment extends FramebufferValue implements Value {\n set(v: ?WebGLRenderbuffer): void {\n if (this.current !== v) {\n const gl = this.context.gl;\n this.context.bindFramebuffer.set(this.parent);\n // note: it's possible to attach a texture to the depth attachment\n // point, but thus far MBGL only uses renderbuffers for depth\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, v);\n this.current = v;\n }\n }\n}\n","// @flow\nimport { ColorAttachment, DepthAttachment } from './value';\n\nimport type Context from './context';\n\nclass Framebuffer {\n context: Context;\n width: number;\n height: number;\n framebuffer: WebGLFramebuffer;\n colorAttachment: ColorAttachment;\n depthAttachment: DepthAttachment;\n\n constructor(context: Context, width: number, height: number) {\n this.context = context;\n this.width = width;\n this.height = height;\n const gl = context.gl;\n const fbo = this.framebuffer = gl.createFramebuffer();\n\n this.colorAttachment = new ColorAttachment(context, fbo);\n this.depthAttachment = new DepthAttachment(context, fbo);\n }\n\n destroy() {\n const gl = this.context.gl;\n\n const texture = this.colorAttachment.get();\n if (texture) gl.deleteTexture(texture);\n\n const renderbuffer = this.depthAttachment.get();\n if (renderbuffer) gl.deleteRenderbuffer(renderbuffer);\n\n gl.deleteFramebuffer(this.framebuffer);\n }\n}\n\nexport default Framebuffer;\n","// @flow\nimport type { DepthFuncType, DepthMaskType, DepthRangeType } from './types';\n\nconst ALWAYS = 0x0207;\n\nclass DepthMode {\n func: DepthFuncType;\n mask: DepthMaskType;\n range: DepthRangeType;\n\n // DepthMask enums\n static ReadOnly: boolean;\n static ReadWrite: boolean;\n\n constructor(depthFunc: DepthFuncType, depthMask: DepthMaskType, depthRange: DepthRangeType) {\n this.func = depthFunc;\n this.mask = depthMask;\n this.range = depthRange;\n }\n\n static disabled: $ReadOnly;\n}\n\nDepthMode.ReadOnly = false;\nDepthMode.ReadWrite = true;\n\nDepthMode.disabled = new DepthMode(ALWAYS, DepthMode.ReadOnly, [0, 1]);\n\nexport default DepthMode;\n","// @flow\nimport type { StencilOpConstant, StencilTest } from './types';\n\nconst ALWAYS = 0x0207;\nconst KEEP = 0x1E00;\n\nclass StencilMode {\n test: StencilTest;\n ref: number;\n mask: number;\n fail: StencilOpConstant;\n depthFail: StencilOpConstant;\n pass: StencilOpConstant;\n\n constructor(test: StencilTest, ref: number, mask: number, fail: StencilOpConstant,\n depthFail: StencilOpConstant, pass: StencilOpConstant) {\n this.test = test;\n this.ref = ref;\n this.mask = mask;\n this.fail = fail;\n this.depthFail = depthFail;\n this.pass = pass;\n }\n\n static disabled: $ReadOnly;\n}\n\nStencilMode.disabled = new StencilMode({ func: ALWAYS, mask: 0 }, 0, 0, KEEP, KEEP, KEEP);\n\nexport default StencilMode;\n","// @flow\nimport Color from '../style-spec/util/color';\n\nimport type {BlendFuncType, ColorMaskType} from './types';\n\nconst ZERO = 0x0000;\nconst ONE = 0x0001;\nconst ONE_MINUS_SRC_ALPHA = 0x0303;\n\nclass ColorMode {\n blendFunction: BlendFuncType;\n blendColor: Color;\n mask: ColorMaskType;\n\n constructor(blendFunction: BlendFuncType, blendColor: Color, mask: ColorMaskType) {\n this.blendFunction = blendFunction;\n this.blendColor = blendColor;\n this.mask = mask;\n }\n\n static Replace: BlendFuncType;\n\n static disabled: $ReadOnly;\n static unblended: $ReadOnly;\n static alphaBlended: $ReadOnly;\n}\n\nColorMode.Replace = [ONE, ZERO];\n\nColorMode.disabled = new ColorMode(ColorMode.Replace, Color.transparent, [false, false, false, false]);\nColorMode.unblended = new ColorMode(ColorMode.Replace, Color.transparent, [true, true, true, true]);\nColorMode.alphaBlended = new ColorMode([ONE, ONE_MINUS_SRC_ALPHA], Color.transparent, [true, true, true, true]);\n\nexport default ColorMode;\n","// @flow\nimport IndexBuffer from './index_buffer';\n\nimport VertexBuffer from './vertex_buffer';\nimport Framebuffer from './framebuffer';\nimport DepthMode from './depth_mode';\nimport StencilMode from './stencil_mode';\nimport ColorMode from './color_mode';\nimport { deepEqual } from '../util/util';\nimport { ClearColor, ClearDepth, ClearStencil, ColorMask, DepthMask, StencilMask, StencilFunc, StencilOp, StencilTest, DepthRange, DepthTest, DepthFunc, Blend, BlendFunc, BlendColor, Program, LineWidth, ActiveTextureUnit, Viewport, BindFramebuffer, BindRenderbuffer, BindTexture, BindVertexBuffer, BindElementBuffer, BindVertexArrayOES, PixelStoreUnpack, PixelStoreUnpackPremultiplyAlpha } from './value';\n\n\nimport type {TriangleIndexArray, LineIndexArray} from '../data/index_array_type';\nimport type {\n StructArray,\n StructArrayMember\n} from '../util/struct_array';\nimport type Color from '../style-spec/util/color';\n\ntype ClearArgs = {\n color?: Color,\n depth?: number,\n stencil?: number\n};\n\n\nclass Context {\n gl: WebGLRenderingContext;\n extVertexArrayObject: any;\n currentNumAttributes: ?number;\n lineWidthRange: [number, number];\n\n clearColor: ClearColor;\n clearDepth: ClearDepth;\n clearStencil: ClearStencil;\n colorMask: ColorMask;\n depthMask: DepthMask;\n stencilMask: StencilMask;\n stencilFunc: StencilFunc;\n stencilOp: StencilOp;\n stencilTest: StencilTest;\n depthRange: DepthRange;\n depthTest: DepthTest;\n depthFunc: DepthFunc;\n blend: Blend;\n blendFunc: BlendFunc;\n blendColor: BlendColor;\n program: Program;\n lineWidth: LineWidth;\n activeTexture: ActiveTextureUnit;\n viewport: Viewport;\n bindFramebuffer: BindFramebuffer;\n bindRenderbuffer: BindRenderbuffer;\n bindTexture: BindTexture;\n bindVertexBuffer: BindVertexBuffer;\n bindElementBuffer: BindElementBuffer;\n bindVertexArrayOES: BindVertexArrayOES;\n pixelStoreUnpack: PixelStoreUnpack;\n pixelStoreUnpackPremultiplyAlpha: PixelStoreUnpackPremultiplyAlpha;\n\n extTextureFilterAnisotropic: any;\n extTextureFilterAnisotropicMax: any;\n extTextureHalfFloat: any;\n\n constructor(gl: WebGLRenderingContext) {\n this.gl = gl;\n this.extVertexArrayObject = this.gl.getExtension('OES_vertex_array_object');\n this.lineWidthRange = gl.getParameter(gl.ALIASED_LINE_WIDTH_RANGE);\n\n this.clearColor = new ClearColor(this);\n this.clearDepth = new ClearDepth(this);\n this.clearStencil = new ClearStencil(this);\n this.colorMask = new ColorMask(this);\n this.depthMask = new DepthMask(this);\n this.stencilMask = new StencilMask(this);\n this.stencilFunc = new StencilFunc(this);\n this.stencilOp = new StencilOp(this);\n this.stencilTest = new StencilTest(this);\n this.depthRange = new DepthRange(this);\n this.depthTest = new DepthTest(this);\n this.depthFunc = new DepthFunc(this);\n this.blend = new Blend(this);\n this.blendFunc = new BlendFunc(this);\n this.blendColor = new BlendColor(this);\n this.program = new Program(this);\n this.lineWidth = new LineWidth(this);\n this.activeTexture = new ActiveTextureUnit(this);\n this.viewport = new Viewport(this);\n this.bindFramebuffer = new BindFramebuffer(this);\n this.bindRenderbuffer = new BindRenderbuffer(this);\n this.bindTexture = new BindTexture(this);\n this.bindVertexBuffer = new BindVertexBuffer(this);\n this.bindElementBuffer = new BindElementBuffer(this);\n this.bindVertexArrayOES = this.extVertexArrayObject && new BindVertexArrayOES(this);\n this.pixelStoreUnpack = new PixelStoreUnpack(this);\n this.pixelStoreUnpackPremultiplyAlpha = new PixelStoreUnpackPremultiplyAlpha(this);\n\n this.extTextureFilterAnisotropic = (\n gl.getExtension('EXT_texture_filter_anisotropic') ||\n gl.getExtension('MOZ_EXT_texture_filter_anisotropic') ||\n gl.getExtension('WEBKIT_EXT_texture_filter_anisotropic')\n );\n if (this.extTextureFilterAnisotropic) {\n this.extTextureFilterAnisotropicMax = gl.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT);\n }\n\n this.extTextureHalfFloat = gl.getExtension('OES_texture_half_float');\n if (this.extTextureHalfFloat) {\n gl.getExtension('OES_texture_half_float_linear');\n }\n\n }\n\n createIndexBuffer(array: TriangleIndexArray | LineIndexArray, dynamicDraw?: boolean) {\n return new IndexBuffer(this, array, dynamicDraw);\n }\n\n createVertexBuffer(array: StructArray, attributes: $ReadOnlyArray, dynamicDraw?: boolean) {\n return new VertexBuffer(this, array, attributes, dynamicDraw);\n }\n\n createRenderbuffer(storageFormat: number, width: number, height: number) {\n const gl = this.gl;\n\n const rbo = gl.createRenderbuffer();\n this.bindRenderbuffer.set(rbo);\n gl.renderbufferStorage(gl.RENDERBUFFER, storageFormat, width, height);\n this.bindRenderbuffer.set(null);\n\n return rbo;\n }\n\n createFramebuffer(width: number, height: number) {\n return new Framebuffer(this, width, height);\n }\n\n clear({color, depth}: ClearArgs) {\n const gl = this.gl;\n let mask = 0;\n\n if (color) {\n mask |= gl.COLOR_BUFFER_BIT;\n this.clearColor.set(color);\n this.colorMask.set([true, true, true, true]);\n }\n\n if (typeof depth !== 'undefined') {\n mask |= gl.DEPTH_BUFFER_BIT;\n this.clearDepth.set(depth);\n this.depthMask.set(true);\n }\n\n // See note in Painter#clearStencil: implement this the easy way once GPU bug/workaround is fixed upstream\n // if (typeof stencil !== 'undefined') {\n // mask |= gl.STENCIL_BUFFER_BIT;\n // this.clearStencil.set(stencil);\n // this.stencilMask.set(0xFF);\n // }\n\n gl.clear(mask);\n }\n\n setDepthMode(depthMode: $ReadOnly) {\n if (depthMode.func === this.gl.ALWAYS && !depthMode.mask) {\n this.depthTest.set(false);\n } else {\n this.depthTest.set(true);\n this.depthFunc.set(depthMode.func);\n this.depthMask.set(depthMode.mask);\n this.depthRange.set(depthMode.range);\n }\n }\n\n setStencilMode(stencilMode: $ReadOnly) {\n if (stencilMode.test.func === this.gl.ALWAYS && !stencilMode.mask) {\n this.stencilTest.set(false);\n } else {\n this.stencilTest.set(true);\n this.stencilMask.set(stencilMode.mask);\n this.stencilOp.set([stencilMode.fail, stencilMode.depthFail, stencilMode.pass]);\n this.stencilFunc.set({\n func: stencilMode.test.func,\n ref: stencilMode.ref,\n mask: stencilMode.test.mask\n });\n }\n }\n\n setColorMode(colorMode: $ReadOnly) {\n if (deepEqual(colorMode.blendFunction, ColorMode.Replace)) {\n this.blend.set(false);\n } else {\n this.blend.set(true);\n this.blendFunc.set(colorMode.blendFunction);\n this.blendColor.set(colorMode.blendColor);\n }\n\n this.colorMask.set(colorMode.mask);\n }\n}\n\nexport default Context;\n","// @flow\n\nimport { create as createSource } from './source';\n\nimport Tile from './tile';\nimport { Event, ErrorEvent, Evented } from '../util/evented';\nimport TileCache from './tile_cache';\nimport Coordinate from '../geo/coordinate';\nimport { keysDifference } from '../util/util';\nimport EXTENT from '../data/extent';\nimport Context from '../gl/context';\nimport Point from '@mapbox/point-geometry';\nimport browser from '../util/browser';\nimport { OverscaledTileID } from './tile_id';\nimport assert from 'assert';\n\nimport type {Source} from './source';\nimport type Map from '../ui/map';\nimport type Style from '../style/style';\nimport type Dispatcher from '../util/dispatcher';\nimport type Transform from '../geo/transform';\nimport type {TileState} from './tile';\nimport type {Callback} from '../types/callback';\n\n/**\n * `SourceCache` is responsible for\n *\n * - creating an instance of `Source`\n * - forwarding events from `Source`\n * - caching tiles loaded from an instance of `Source`\n * - loading the tiles needed to render a given viewport\n * - unloading the cached tiles not needed to render a given viewport\n *\n * @private\n */\nclass SourceCache extends Evented {\n id: string;\n dispatcher: Dispatcher;\n map: Map;\n style: Style;\n\n _source: Source;\n _sourceLoaded: boolean;\n _sourceErrored: boolean;\n _tiles: {[any]: Tile};\n _prevLng: number | void;\n _cache: TileCache;\n _timers: {[any]: TimeoutID};\n _cacheTimers: {[any]: TimeoutID};\n _maxTileCacheSize: ?number;\n _paused: boolean;\n _shouldReloadOnResume: boolean;\n _coveredTiles: {[any]: boolean};\n transform: Transform;\n _isIdRenderable: (id: number) => boolean;\n used: boolean;\n\n static maxUnderzooming: number;\n static maxOverzooming: number;\n\n constructor(id: string, options: SourceSpecification, dispatcher: Dispatcher) {\n super();\n this.id = id;\n this.dispatcher = dispatcher;\n\n this.on('data', (e) => {\n // this._sourceLoaded signifies that the TileJSON is loaded if applicable.\n // if the source type does not come with a TileJSON, the flag signifies the\n // source data has loaded (i.e geojson has been tiled on the worker and is ready)\n if (e.dataType === 'source' && e.sourceDataType === 'metadata') this._sourceLoaded = true;\n\n // for sources with mutable data, this event fires when the underlying data\n // to a source is changed. (i.e. GeoJSONSource#setData and ImageSource#serCoordinates)\n if (this._sourceLoaded && !this._paused && e.dataType === \"source\" && e.sourceDataType === 'content') {\n this.reload();\n if (this.transform) {\n this.update(this.transform);\n }\n }\n });\n\n this.on('error', () => {\n this._sourceErrored = true;\n });\n\n this._source = createSource(id, options, dispatcher, this);\n\n this._tiles = {};\n this._cache = new TileCache(0, this._unloadTile.bind(this));\n this._timers = {};\n this._cacheTimers = {};\n this._maxTileCacheSize = null;\n\n this._isIdRenderable = this._isIdRenderable.bind(this);\n\n this._coveredTiles = {};\n }\n\n onAdd(map: Map) {\n this.map = map;\n this._maxTileCacheSize = map ? map._maxTileCacheSize : null;\n if (this._source && this._source.onAdd) {\n this._source.onAdd(map);\n }\n }\n\n onRemove(map: Map) {\n if (this._source && this._source.onRemove) {\n this._source.onRemove(map);\n }\n }\n\n /**\n * Return true if no tile data is pending, tiles will not change unless\n * an additional API call is received.\n */\n loaded(): boolean {\n if (this._sourceErrored) { return true; }\n if (!this._sourceLoaded) { return false; }\n for (const t in this._tiles) {\n const tile = this._tiles[t];\n if (tile.state !== 'loaded' && tile.state !== 'errored')\n return false;\n }\n return true;\n }\n\n getSource(): Source {\n return this._source;\n }\n\n pause() {\n this._paused = true;\n }\n\n resume() {\n if (!this._paused) return;\n const shouldReload = this._shouldReloadOnResume;\n this._paused = false;\n this._shouldReloadOnResume = false;\n if (shouldReload) this.reload();\n if (this.transform) this.update(this.transform);\n }\n\n _loadTile(tile: Tile, callback: Callback) {\n return this._source.loadTile(tile, callback);\n }\n\n _unloadTile(tile: Tile) {\n if (this._source.unloadTile)\n return this._source.unloadTile(tile, () => {});\n }\n\n _abortTile(tile: Tile) {\n if (this._source.abortTile)\n return this._source.abortTile(tile, () => {});\n }\n\n serialize() {\n return this._source.serialize();\n }\n\n prepare(context: Context) {\n if (this._source.prepare) {\n this._source.prepare();\n }\n\n for (const i in this._tiles) {\n this._tiles[i].upload(context);\n }\n }\n\n /**\n * Return all tile ids ordered with z-order, and cast to numbers\n */\n getIds(): Array {\n\n const compareKeyZoom = (a_, b_) => {\n const a = this._tiles[a_].tileID;\n const b = this._tiles[b_].tileID;\n const rotatedA = (new Point(a.canonical.x, a.canonical.y)).rotate(this.transform.angle);\n const rotatedB = (new Point(b.canonical.x, b.canonical.y)).rotate(this.transform.angle);\n return a.overscaledZ - b.overscaledZ || rotatedB.y - rotatedA.y || rotatedB.x - rotatedA.x;\n };\n\n return Object.keys(this._tiles).map(Number).sort(compareKeyZoom);\n }\n\n getRenderableIds() {\n return this.getIds().filter(this._isIdRenderable);\n }\n\n hasRenderableParent(tileID: OverscaledTileID) {\n const parentTile = this.findLoadedParent(tileID, 0, {});\n if (parentTile) {\n return this._isIdRenderable(parentTile.tileID.key);\n }\n return false;\n }\n\n _isIdRenderable(id: number) {\n return this._tiles[id] && this._tiles[id].hasData() && !this._coveredTiles[id];\n }\n\n reload() {\n if (this._paused) {\n this._shouldReloadOnResume = true;\n return;\n }\n\n this._cache.reset();\n\n for (const i in this._tiles) {\n this._reloadTile(i, 'reloading');\n }\n }\n\n _reloadTile(id: string | number, state: TileState) {\n const tile = this._tiles[id];\n\n // this potentially does not address all underlying\n // issues https://github.com/mapbox/mapbox-gl-js/issues/4252\n // - hard to tell without repro steps\n if (!tile) return;\n\n // The difference between \"loading\" tiles and \"reloading\" or \"expired\"\n // tiles is that \"reloading\"/\"expired\" tiles are \"renderable\".\n // Therefore, a \"loading\" tile cannot become a \"reloading\" tile without\n // first becoming a \"loaded\" tile.\n if (tile.state !== 'loading') {\n tile.state = state;\n }\n\n this._loadTile(tile, this._tileLoaded.bind(this, tile, id, state));\n }\n\n _tileLoaded(tile: Tile, id: string | number, previousState: TileState, err: ?Error) {\n if (err) {\n tile.state = 'errored';\n if (err.status !== 404) this._source.fire(new ErrorEvent(err, {tile}));\n // continue to try loading parent/children tiles if a tile doesn't exist (404)\n else this.update(this.transform);\n return;\n }\n\n tile.timeAdded = browser.now();\n if (previousState === 'expired') tile.refreshedUponExpiration = true;\n this._setTileReloadTimer(id, tile);\n if (this.getSource().type === 'raster-dem' && tile.dem) this._backfillDEM(tile);\n this._source.fire(new Event('data', {dataType: 'source', tile: tile, coord: tile.tileID}));\n\n // HACK this is necessary to fix https://github.com/mapbox/mapbox-gl-js/issues/2986\n if (this.map) this.map.painter.tileExtentVAO.vao = null;\n }\n\n /**\n * For raster terrain source, backfill DEM to eliminate visible tile boundaries\n * @private\n */\n _backfillDEM(tile: Tile) {\n const renderables = this.getRenderableIds();\n for (let i = 0; i < renderables.length; i++) {\n const borderId = renderables[i];\n if (tile.neighboringTiles && tile.neighboringTiles[borderId]) {\n const borderTile = this.getTileByID(borderId);\n fillBorder(tile, borderTile);\n fillBorder(borderTile, tile);\n }\n }\n\n function fillBorder(tile, borderTile) {\n tile.needsHillshadePrepare = true;\n let dx = borderTile.tileID.canonical.x - tile.tileID.canonical.x;\n const dy = borderTile.tileID.canonical.y - tile.tileID.canonical.y;\n const dim = Math.pow(2, tile.tileID.canonical.z);\n const borderId = borderTile.tileID.key;\n if (dx === 0 && dy === 0) return;\n\n if (Math.abs(dy) > 1) {\n return;\n }\n if (Math.abs(dx) > 1) {\n // Adjust the delta coordinate for world wraparound.\n if (Math.abs(dx + dim) === 1) {\n dx += dim;\n } else if (Math.abs(dx - dim) === 1) {\n dx -= dim;\n }\n }\n if (!borderTile.dem || !tile.dem) return;\n tile.dem.backfillBorder(borderTile.dem, dx, dy);\n if (tile.neighboringTiles && tile.neighboringTiles[borderId])\n tile.neighboringTiles[borderId].backfilled = true;\n }\n }\n /**\n * Get a specific tile by TileID\n */\n getTile(tileID: OverscaledTileID): Tile {\n return this.getTileByID(tileID.key);\n }\n\n /**\n * Get a specific tile by id\n */\n getTileByID(id: string | number): Tile {\n return this._tiles[id];\n }\n\n /**\n * get the zoom level adjusted for the difference in map and source tilesizes\n */\n getZoom(transform: Transform): number {\n return transform.zoom + transform.scaleZoom(transform.tileSize / this._source.tileSize);\n }\n\n /**\n * Recursively find children of the given tile (up to maxCoveringZoom) that are already loaded;\n * adds found tiles to retain object; returns true if any child is found.\n */\n _findLoadedChildren(tileID: OverscaledTileID, maxCoveringZoom: number, retain: {[any]: OverscaledTileID}): boolean {\n let found = false;\n\n for (const id in this._tiles) {\n let tile = this._tiles[id];\n\n // only consider renderable tiles on higher zoom levels (up to maxCoveringZoom)\n if (retain[id] || !tile.hasData() || tile.tileID.overscaledZ <= tileID.overscaledZ || tile.tileID.overscaledZ > maxCoveringZoom) continue;\n\n // disregard tiles that are not descendants of the given tile coordinate\n const z2 = Math.pow(2, tile.tileID.canonical.z - tileID.canonical.z);\n if (Math.floor(tile.tileID.canonical.x / z2) !== tileID.canonical.x ||\n Math.floor(tile.tileID.canonical.y / z2) !== tileID.canonical.y)\n continue;\n\n // found loaded child\n retain[id] = tile.tileID;\n found = true;\n\n // loop through parents; retain the topmost loaded one if found\n while (tile && tile.tileID.overscaledZ - 1 > tileID.overscaledZ) {\n const parent = tile.tileID.scaledTo(tile.tileID.overscaledZ - 1);\n if (!parent) break;\n\n tile = this._tiles[parent.key];\n if (tile && tile.hasData()) {\n delete retain[id];\n retain[parent.key] = parent;\n }\n }\n }\n return found;\n }\n\n /**\n * Find a loaded parent of the given tile (up to minCoveringZoom);\n * adds the found tile to retain object and returns the tile if found\n */\n findLoadedParent(tileID: OverscaledTileID, minCoveringZoom: number, retain: {[any]: OverscaledTileID}): ?Tile {\n for (let z = tileID.overscaledZ - 1; z >= minCoveringZoom; z--) {\n const parent = tileID.scaledTo(z);\n if (!parent) return;\n const id = String(parent.key);\n const tile = this._tiles[id];\n if (tile && tile.hasData()) {\n retain[id] = parent;\n return tile;\n }\n if (this._cache.has(parent)) {\n retain[id] = parent;\n return this._cache.get(parent);\n }\n }\n }\n\n /**\n * Resizes the tile cache based on the current viewport's size\n * or the maxTileCacheSize option passed during map creation\n *\n * Larger viewports use more tiles and need larger caches. Larger viewports\n * are more likely to be found on devices with more memory and on pages where\n * the map is more important.\n */\n updateCacheSize(transform: Transform) {\n const widthInTiles = Math.ceil(transform.width / this._source.tileSize) + 1;\n const heightInTiles = Math.ceil(transform.height / this._source.tileSize) + 1;\n const approxTilesInView = widthInTiles * heightInTiles;\n const commonZoomRange = 5;\n\n const viewDependentMaxSize = Math.floor(approxTilesInView * commonZoomRange);\n const maxSize = typeof this._maxTileCacheSize === 'number' ? Math.min(this._maxTileCacheSize, viewDependentMaxSize) : viewDependentMaxSize;\n\n this._cache.setMaxSize(maxSize);\n }\n\n handleWrapJump(lng: number) {\n // On top of the regular z/x/y values, TileIDs have a `wrap` value that specify\n // which cppy of the world the tile belongs to. For example, at `lng: 10` you\n // might render z/x/y/0 while at `lng: 370` you would render z/x/y/1.\n //\n // When lng values get wrapped (going from `lng: 370` to `long: 10`) you expect\n // to see the same thing on the screen (370 degrees and 10 degrees is the same\n // place in the world) but all the TileIDs will have different wrap values.\n //\n // In order to make this transition seamless, we calculate the rounded difference of\n // \"worlds\" between the last frame and the current frame. If the map panned by\n // a world, then we can assign all the tiles new TileIDs with updated wrap values.\n // For example, assign z/x/y/1 a new id: z/x/y/0. It is the same tile, just rendered\n // in a different position.\n //\n // This enables us to reuse the tiles at more ideal locations and prevent flickering.\n const prevLng = this._prevLng === undefined ? lng : this._prevLng;\n const lngDifference = lng - prevLng;\n const worldDifference = lngDifference / 360;\n const wrapDelta = Math.round(worldDifference);\n this._prevLng = lng;\n\n if (wrapDelta) {\n const tiles = {};\n for (const key in this._tiles) {\n const tile = this._tiles[key];\n tile.tileID = tile.tileID.unwrapTo(tile.tileID.wrap + wrapDelta);\n tiles[tile.tileID.key] = tile;\n }\n this._tiles = tiles;\n\n // Reset tile reload timers\n for (const id in this._timers) {\n clearTimeout(this._timers[id]);\n delete this._timers[id];\n }\n for (const id in this._tiles) {\n const tile = this._tiles[id];\n this._setTileReloadTimer(id, tile);\n }\n }\n }\n\n /**\n * Removes tiles that are outside the viewport and adds new tiles that\n * are inside the viewport.\n */\n update(transform: Transform) {\n this.transform = transform;\n if (!this._sourceLoaded || this._paused) { return; }\n\n this.updateCacheSize(transform);\n this.handleWrapJump(this.transform.center.lng);\n\n // Covered is a list of retained tiles who's areas are fully covered by other,\n // better, retained tiles. They are not drawn separately.\n this._coveredTiles = {};\n\n let idealTileIDs;\n if (!this.used) {\n idealTileIDs = [];\n } else if (this._source.tileID) {\n idealTileIDs = transform.getVisibleUnwrappedCoordinates((this._source.tileID: any))\n .map((unwrapped) => new OverscaledTileID(unwrapped.canonical.z, unwrapped.wrap, unwrapped.canonical.z, unwrapped.canonical.x, unwrapped.canonical.y));\n } else {\n idealTileIDs = transform.coveringTiles({\n tileSize: this._source.tileSize,\n minzoom: this._source.minzoom,\n maxzoom: this._source.maxzoom,\n roundZoom: this._source.roundZoom,\n reparseOverscaled: this._source.reparseOverscaled\n });\n\n if (this._source.hasTile) {\n idealTileIDs = idealTileIDs.filter((coord) => (this._source.hasTile: any)(coord));\n }\n }\n\n // Determine the overzooming/underzooming amounts.\n const zoom = (this._source.roundZoom ? Math.round : Math.floor)(this.getZoom(transform));\n const minCoveringZoom = Math.max(zoom - SourceCache.maxOverzooming, this._source.minzoom);\n const maxCoveringZoom = Math.max(zoom + SourceCache.maxUnderzooming, this._source.minzoom);\n\n // Retain is a list of tiles that we shouldn't delete, even if they are not\n // the most ideal tile for the current viewport. This may include tiles like\n // parent or child tiles that are *already* loaded.\n const retain = this._updateRetainedTiles(idealTileIDs, zoom);\n\n const parentsForFading = {};\n\n if (isRasterType(this._source.type)) {\n const ids = Object.keys(retain);\n for (let k = 0; k < ids.length; k++) {\n const id = ids[k];\n const tileID = retain[id];\n assert(tileID.key === +id);\n const tile = this._tiles[id];\n if (!tile) continue;\n\n // If the drawRasterTile has never seen this tile, then\n // tile.fadeEndTime may be unset. In that case, or if\n // fadeEndTime is in the future, then this tile is still\n // fading in. Find tiles to cross-fade with it.\n if (typeof tile.fadeEndTime === 'undefined' || tile.fadeEndTime >= browser.now()) {\n if (this._findLoadedChildren(tileID, maxCoveringZoom, retain)) {\n retain[id] = tileID;\n }\n const parentTile = this.findLoadedParent(tileID, minCoveringZoom, parentsForFading);\n if (parentTile) {\n this._addTile(parentTile.tileID);\n }\n }\n }\n }\n\n let fadedParent;\n for (fadedParent in parentsForFading) {\n if (!retain[fadedParent]) {\n // If a tile is only needed for fading, mark it as covered so that it isn't rendered on it's own.\n this._coveredTiles[fadedParent] = true;\n }\n }\n for (fadedParent in parentsForFading) {\n retain[fadedParent] = parentsForFading[fadedParent];\n }\n // Remove the tiles we don't need anymore.\n const remove = keysDifference(this._tiles, retain);\n for (let i = 0; i < remove.length; i++) {\n this._removeTile(remove[i]);\n }\n }\n\n _updateRetainedTiles(idealTileIDs: Array, zoom: number): { [string]: OverscaledTileID} {\n const retain = {};\n const checked: {[number]: boolean } = {};\n const minCoveringZoom = Math.max(zoom - SourceCache.maxOverzooming, this._source.minzoom);\n const maxCoveringZoom = Math.max(zoom + SourceCache.maxUnderzooming, this._source.minzoom);\n\n for (let i = 0; i < idealTileIDs.length; i++) {\n const tileID = idealTileIDs[i];\n let tile = this._addTile(tileID);\n let parentWasRequested = false;\n if (tile.hasData()) {\n retain[tileID.key] = tileID;\n } else {\n // The tile we require is not yet loaded or does not exist.\n // We are now attempting to load child and parent tiles.\n\n // As we descend up and down the tile pyramid of the ideal tile, we check whether the parent\n // tile has been previously requested (and errored in this case due to the previous conditional)\n // in order to determine if we need to request its parent.\n parentWasRequested = tile.wasRequested();\n\n // The tile isn't loaded yet, but retain it anyway because it's an ideal tile.\n retain[tileID.key] = tileID;\n let covered = true;\n const overscaledZ = zoom + 1;\n if (overscaledZ > this._source.maxzoom) {\n // We're looking for an overzoomed child tile.\n const childCoord = tileID.children(this._source.maxzoom)[0];\n const childTile = this.getTile(childCoord);\n if (!!childTile && childTile.hasData()) {\n retain[childCoord.key] = childCoord;\n } else {\n covered = false;\n }\n } else {\n this._findLoadedChildren(tileID, maxCoveringZoom, retain);\n // check if all 4 immediate children are loaded (i.e. the missing ideal tile is covered)\n const children = tileID.children(this._source.maxzoom);\n for (let j = 0; j < children.length; j++) {\n if (!retain[children[j].key]) {\n covered = false;\n break;\n }\n }\n }\n\n if (!covered) {\n\n // We couldn't find child tiles that entirely cover the ideal tile.\n for (let overscaledZ = tileID.overscaledZ - 1; overscaledZ >= minCoveringZoom; --overscaledZ) {\n\n const parentId = tileID.scaledTo(overscaledZ);\n if (checked[parentId.key]) {\n // Break parent tile ascent, this route has been previously checked by another child.\n break;\n } else {\n checked[parentId.key] = true;\n }\n\n tile = this.getTile(parentId);\n if (!tile && parentWasRequested) {\n tile = this._addTile(parentId);\n }\n\n if (tile) {\n retain[parentId.key] = parentId;\n // Save the current values, since they're the parent of the next iteration\n // of the parent tile ascent loop.\n parentWasRequested = tile.wasRequested();\n if (tile.hasData()) {\n break;\n }\n }\n }\n }\n }\n }\n\n return retain;\n }\n\n /**\n * Add a tile, given its coordinate, to the pyramid.\n * @private\n */\n _addTile(tileID: OverscaledTileID): Tile {\n let tile = this._tiles[tileID.key];\n if (tile)\n return tile;\n\n\n tile = this._cache.getAndRemove(tileID);\n if (tile) {\n this._setTileReloadTimer(tileID.key, tile);\n // set the tileID because the cached tile could have had a different wrap value\n tile.tileID = tileID;\n }\n\n const cached = Boolean(tile);\n if (!cached) {\n tile = new Tile(tileID, this._source.tileSize * tileID.overscaleFactor());\n this._loadTile(tile, this._tileLoaded.bind(this, tile, tileID.key, tile.state));\n }\n\n // Impossible, but silence flow.\n if (!tile) return (null: any);\n\n tile.uses++;\n this._tiles[tileID.key] = tile;\n if (!cached) this._source.fire(new Event('dataloading', {tile: tile, coord: tile.tileID, dataType: 'source'}));\n\n return tile;\n }\n\n _setTileReloadTimer(id: string | number, tile: Tile) {\n if (id in this._timers) {\n clearTimeout(this._timers[id]);\n delete this._timers[id];\n }\n\n const expiryTimeout = tile.getExpiryTimeout();\n if (expiryTimeout) {\n this._timers[id] = setTimeout(() => {\n this._reloadTile(id, 'expired');\n delete this._timers[id];\n }, expiryTimeout);\n }\n }\n\n /**\n * Remove a tile, given its id, from the pyramid\n * @private\n */\n _removeTile(id: string | number) {\n const tile = this._tiles[id];\n if (!tile)\n return;\n\n tile.uses--;\n delete this._tiles[id];\n if (this._timers[id]) {\n clearTimeout(this._timers[id]);\n delete this._timers[id];\n }\n\n if (tile.uses > 0)\n return;\n\n if (tile.hasData()) {\n this._cache.add(tile.tileID, tile, tile.getExpiryTimeout());\n } else {\n tile.aborted = true;\n this._abortTile(tile);\n this._unloadTile(tile);\n }\n }\n\n /**\n * Remove all tiles from this pyramid\n */\n clearTiles() {\n this._shouldReloadOnResume = false;\n this._paused = false;\n\n for (const id in this._tiles)\n this._removeTile(id);\n\n this._cache.reset();\n }\n\n /**\n * Search through our current tiles and attempt to find the tiles that\n * cover the given bounds.\n * @param queryGeometry coordinates of the corners of bounding rectangle\n * @returns {Array} result items have {tile, minX, maxX, minY, maxY}, where min/max bounding values are the given bounds transformed in into the coordinate space of this tile.\n */\n tilesIn(queryGeometry: Array, maxPitchScaleFactor: number) {\n const tileResults = [];\n const ids = this.getIds();\n\n let minX = Infinity;\n let minY = Infinity;\n let maxX = -Infinity;\n let maxY = -Infinity;\n const z = queryGeometry[0].zoom;\n\n for (let k = 0; k < queryGeometry.length; k++) {\n const p = queryGeometry[k];\n minX = Math.min(minX, p.column);\n minY = Math.min(minY, p.row);\n maxX = Math.max(maxX, p.column);\n maxY = Math.max(maxY, p.row);\n }\n\n\n for (let i = 0; i < ids.length; i++) {\n const tile = this._tiles[ids[i]];\n const tileID = tile.tileID;\n const scale = Math.pow(2, this.transform.zoom - tile.tileID.overscaledZ);\n const queryPadding = maxPitchScaleFactor * tile.queryPadding * EXTENT / tile.tileSize / scale;\n\n const tileSpaceBounds = [\n coordinateToTilePoint(tileID, new Coordinate(minX, minY, z)),\n coordinateToTilePoint(tileID, new Coordinate(maxX, maxY, z))\n ];\n\n if (tileSpaceBounds[0].x - queryPadding < EXTENT && tileSpaceBounds[0].y - queryPadding < EXTENT &&\n tileSpaceBounds[1].x + queryPadding >= 0 && tileSpaceBounds[1].y + queryPadding >= 0) {\n\n const tileSpaceQueryGeometry = [];\n for (let j = 0; j < queryGeometry.length; j++) {\n tileSpaceQueryGeometry.push(coordinateToTilePoint(tileID, queryGeometry[j]));\n }\n\n tileResults.push({\n tile: tile,\n tileID: tileID,\n queryGeometry: [tileSpaceQueryGeometry],\n scale: scale\n });\n }\n }\n\n return tileResults;\n }\n\n getVisibleCoordinates() {\n const coords = this.getRenderableIds().map((id) => this._tiles[id].tileID);\n for (const coord of coords) {\n coord.posMatrix = this.transform.calculatePosMatrix(coord.toUnwrapped());\n }\n return coords;\n }\n\n hasTransition() {\n if (this._source.hasTransition()) {\n return true;\n }\n\n if (isRasterType(this._source.type)) {\n for (const id in this._tiles) {\n const tile = this._tiles[id];\n if (tile.fadeEndTime !== undefined && tile.fadeEndTime >= browser.now()) {\n return true;\n }\n }\n }\n\n return false;\n }\n}\n\nSourceCache.maxOverzooming = 10;\nSourceCache.maxUnderzooming = 3;\n\n/**\n * Convert a coordinate to a point in a tile's coordinate space.\n * @private\n */\nfunction coordinateToTilePoint(tileID: OverscaledTileID, coord: Coordinate): Point {\n const zoomedCoord = coord.zoomTo(tileID.canonical.z);\n return new Point(\n (zoomedCoord.column - (tileID.canonical.x + tileID.wrap * Math.pow(2, tileID.canonical.z))) * EXTENT,\n (zoomedCoord.row - tileID.canonical.y) * EXTENT\n );\n}\n\nfunction isRasterType(type) {\n return type === 'raster' || type === 'image' || type === 'video';\n}\n\nexport default SourceCache;\n\n","// @flow\n\nimport assert from 'assert';\n\nimport WebWorker from './web_worker';\n\nimport type {WorkerInterface} from './web_worker';\nimport mapboxgl from '../';\n\n/**\n * Constructs a worker pool.\n * @private\n */\nclass WorkerPool {\n active: {[number]: boolean};\n workers: Array;\n\n constructor() {\n this.active = {};\n }\n\n acquire(mapId: number) {\n if (!this.workers) {\n // Lazily look up the value of mapboxgl.workerCount so that\n // client code has had a chance to set it.\n const workerCount = mapboxgl.workerCount;\n assert(typeof workerCount === 'number' && workerCount < Infinity);\n\n this.workers = [];\n while (this.workers.length < workerCount) {\n this.workers.push(new WebWorker());\n }\n }\n\n this.active[mapId] = true;\n return this.workers.slice();\n }\n\n release(mapId: number) {\n delete this.active[mapId];\n if (Object.keys(this.active).length === 0) {\n this.workers.forEach((w) => {\n w.terminate();\n });\n this.workers = (null: any);\n }\n }\n}\n\nexport default WorkerPool;\n","// @flow\n\nimport WorkerPool from './worker_pool';\n\nlet globalWorkerPool;\n\n/**\n * Creates (if necessary) and returns the single, global WorkerPool instance\n * to be shared across each Map\n * @private\n */\nexport default function getGlobalWorkerPool () {\n if (!globalWorkerPool) {\n globalWorkerPool = new WorkerPool();\n }\n return globalWorkerPool;\n}\n","\nimport refProperties from './util/ref_properties';\n\nfunction deref(layer, parent) {\n const result = {};\n\n for (const k in layer) {\n if (k !== 'ref') {\n result[k] = layer[k];\n }\n }\n\n refProperties.forEach((k) => {\n if (k in parent) {\n result[k] = parent[k];\n }\n });\n\n return result;\n}\n\nexport default derefLayers;\n\n/**\n * Given an array of layers, some of which may contain `ref` properties\n * whose value is the `id` of another property, return a new array where\n * such layers have been augmented with the 'type', 'source', etc. properties\n * from the parent layer, and the `ref` property has been removed.\n *\n * The input is not modified. The output may contain references to portions\n * of the input.\n *\n * @private\n * @param {Array} layers\n * @returns {Array}\n */\nfunction derefLayers(layers) {\n layers = layers.slice();\n\n const map = Object.create(null);\n for (let i = 0; i < layers.length; i++) {\n map[layers[i].id] = layers[i];\n }\n\n for (let i = 0; i < layers.length; i++) {\n if ('ref' in layers[i]) {\n layers[i] = deref(layers[i], map[layers[i].ref]);\n }\n }\n\n return layers;\n}\n","\nimport isEqual from './util/deep_equal';\n\nconst operations = {\n\n /*\n * { command: 'setStyle', args: [stylesheet] }\n */\n setStyle: 'setStyle',\n\n /*\n * { command: 'addLayer', args: [layer, 'beforeLayerId'] }\n */\n addLayer: 'addLayer',\n\n /*\n * { command: 'removeLayer', args: ['layerId'] }\n */\n removeLayer: 'removeLayer',\n\n /*\n * { command: 'setPaintProperty', args: ['layerId', 'prop', value] }\n */\n setPaintProperty: 'setPaintProperty',\n\n /*\n * { command: 'setLayoutProperty', args: ['layerId', 'prop', value] }\n */\n setLayoutProperty: 'setLayoutProperty',\n\n /*\n * { command: 'setFilter', args: ['layerId', filter] }\n */\n setFilter: 'setFilter',\n\n /*\n * { command: 'addSource', args: ['sourceId', source] }\n */\n addSource: 'addSource',\n\n /*\n * { command: 'removeSource', args: ['sourceId'] }\n */\n removeSource: 'removeSource',\n\n /*\n * { command: 'setGeoJSONSourceData', args: ['sourceId', data] }\n */\n setGeoJSONSourceData: 'setGeoJSONSourceData',\n\n /*\n * { command: 'setLayerZoomRange', args: ['layerId', 0, 22] }\n */\n setLayerZoomRange: 'setLayerZoomRange',\n\n /*\n * { command: 'setLayerProperty', args: ['layerId', 'prop', value] }\n */\n setLayerProperty: 'setLayerProperty',\n\n /*\n * { command: 'setCenter', args: [[lon, lat]] }\n */\n setCenter: 'setCenter',\n\n /*\n * { command: 'setZoom', args: [zoom] }\n */\n setZoom: 'setZoom',\n\n /*\n * { command: 'setBearing', args: [bearing] }\n */\n setBearing: 'setBearing',\n\n /*\n * { command: 'setPitch', args: [pitch] }\n */\n setPitch: 'setPitch',\n\n /*\n * { command: 'setSprite', args: ['spriteUrl'] }\n */\n setSprite: 'setSprite',\n\n /*\n * { command: 'setGlyphs', args: ['glyphsUrl'] }\n */\n setGlyphs: 'setGlyphs',\n\n /*\n * { command: 'setTransition', args: [transition] }\n */\n setTransition: 'setTransition',\n\n /*\n * { command: 'setLighting', args: [lightProperties] }\n */\n setLight: 'setLight'\n\n};\n\nfunction addSource(sourceId, after, commands) {\n commands.push({ command: operations.addSource, args: [sourceId, after[sourceId]] });\n}\n\nfunction removeSource(sourceId, commands, sourcesRemoved) {\n commands.push({ command: operations.removeSource, args: [sourceId] });\n sourcesRemoved[sourceId] = true;\n}\n\nfunction updateSource(sourceId, after, commands, sourcesRemoved) {\n removeSource(sourceId, commands, sourcesRemoved);\n addSource(sourceId, after, commands);\n}\n\nfunction canUpdateGeoJSON(before, after, sourceId) {\n let prop;\n for (prop in before[sourceId]) {\n if (!before[sourceId].hasOwnProperty(prop)) continue;\n if (prop !== 'data' && !isEqual(before[sourceId][prop], after[sourceId][prop])) {\n return false;\n }\n }\n for (prop in after[sourceId]) {\n if (!after[sourceId].hasOwnProperty(prop)) continue;\n if (prop !== 'data' && !isEqual(before[sourceId][prop], after[sourceId][prop])) {\n return false;\n }\n }\n return true;\n}\n\nfunction diffSources(before, after, commands, sourcesRemoved) {\n before = before || {};\n after = after || {};\n\n let sourceId;\n\n // look for sources to remove\n for (sourceId in before) {\n if (!before.hasOwnProperty(sourceId)) continue;\n if (!after.hasOwnProperty(sourceId)) {\n removeSource(sourceId, commands, sourcesRemoved);\n }\n }\n\n // look for sources to add/update\n for (sourceId in after) {\n if (!after.hasOwnProperty(sourceId)) continue;\n if (!before.hasOwnProperty(sourceId)) {\n addSource(sourceId, after, commands);\n } else if (!isEqual(before[sourceId], after[sourceId])) {\n if (before[sourceId].type === 'geojson' && after[sourceId].type === 'geojson' && canUpdateGeoJSON(before, after, sourceId)) {\n commands.push({ command: operations.setGeoJSONSourceData, args: [sourceId, after[sourceId].data] });\n } else {\n // no update command, must remove then add\n updateSource(sourceId, after, commands, sourcesRemoved);\n }\n }\n }\n}\n\nfunction diffLayerPropertyChanges(before, after, commands, layerId, klass, command) {\n before = before || {};\n after = after || {};\n\n let prop;\n\n for (prop in before) {\n if (!before.hasOwnProperty(prop)) continue;\n if (!isEqual(before[prop], after[prop])) {\n commands.push({ command: command, args: [layerId, prop, after[prop], klass] });\n }\n }\n for (prop in after) {\n if (!after.hasOwnProperty(prop) || before.hasOwnProperty(prop)) continue;\n if (!isEqual(before[prop], after[prop])) {\n commands.push({ command: command, args: [layerId, prop, after[prop], klass] });\n }\n }\n}\n\nfunction pluckId(layer) {\n return layer.id;\n}\nfunction indexById(group, layer) {\n group[layer.id] = layer;\n return group;\n}\n\nfunction diffLayers(before, after, commands) {\n before = before || [];\n after = after || [];\n\n // order of layers by id\n const beforeOrder = before.map(pluckId);\n const afterOrder = after.map(pluckId);\n\n // index of layer by id\n const beforeIndex = before.reduce(indexById, {});\n const afterIndex = after.reduce(indexById, {});\n\n // track order of layers as if they have been mutated\n const tracker = beforeOrder.slice();\n\n // layers that have been added do not need to be diffed\n const clean = Object.create(null);\n\n let i, d, layerId, beforeLayer, afterLayer, insertBeforeLayerId, prop;\n\n // remove layers\n for (i = 0, d = 0; i < beforeOrder.length; i++) {\n layerId = beforeOrder[i];\n if (!afterIndex.hasOwnProperty(layerId)) {\n commands.push({ command: operations.removeLayer, args: [layerId] });\n tracker.splice(tracker.indexOf(layerId, d), 1);\n } else {\n // limit where in tracker we need to look for a match\n d++;\n }\n }\n\n // add/reorder layers\n for (i = 0, d = 0; i < afterOrder.length; i++) {\n // work backwards as insert is before an existing layer\n layerId = afterOrder[afterOrder.length - 1 - i];\n\n if (tracker[tracker.length - 1 - i] === layerId) continue;\n\n if (beforeIndex.hasOwnProperty(layerId)) {\n // remove the layer before we insert at the correct position\n commands.push({ command: operations.removeLayer, args: [layerId] });\n tracker.splice(tracker.lastIndexOf(layerId, tracker.length - d), 1);\n } else {\n // limit where in tracker we need to look for a match\n d++;\n }\n\n // add layer at correct position\n insertBeforeLayerId = tracker[tracker.length - i];\n commands.push({ command: operations.addLayer, args: [afterIndex[layerId], insertBeforeLayerId] });\n tracker.splice(tracker.length - i, 0, layerId);\n clean[layerId] = true;\n }\n\n // update layers\n for (i = 0; i < afterOrder.length; i++) {\n layerId = afterOrder[i];\n beforeLayer = beforeIndex[layerId];\n afterLayer = afterIndex[layerId];\n\n // no need to update if previously added (new or moved)\n if (clean[layerId] || isEqual(beforeLayer, afterLayer)) continue;\n\n // If source, source-layer, or type have changes, then remove the layer\n // and add it back 'from scratch'.\n if (!isEqual(beforeLayer.source, afterLayer.source) || !isEqual(beforeLayer['source-layer'], afterLayer['source-layer']) || !isEqual(beforeLayer.type, afterLayer.type)) {\n commands.push({ command: operations.removeLayer, args: [layerId] });\n // we add the layer back at the same position it was already in, so\n // there's no need to update the `tracker`\n insertBeforeLayerId = tracker[tracker.lastIndexOf(layerId) + 1];\n commands.push({ command: operations.addLayer, args: [afterLayer, insertBeforeLayerId] });\n continue;\n }\n\n // layout, paint, filter, minzoom, maxzoom\n diffLayerPropertyChanges(beforeLayer.layout, afterLayer.layout, commands, layerId, null, operations.setLayoutProperty);\n diffLayerPropertyChanges(beforeLayer.paint, afterLayer.paint, commands, layerId, null, operations.setPaintProperty);\n if (!isEqual(beforeLayer.filter, afterLayer.filter)) {\n commands.push({ command: operations.setFilter, args: [layerId, afterLayer.filter] });\n }\n if (!isEqual(beforeLayer.minzoom, afterLayer.minzoom) || !isEqual(beforeLayer.maxzoom, afterLayer.maxzoom)) {\n commands.push({ command: operations.setLayerZoomRange, args: [layerId, afterLayer.minzoom, afterLayer.maxzoom] });\n }\n\n // handle all other layer props, including paint.*\n for (prop in beforeLayer) {\n if (!beforeLayer.hasOwnProperty(prop)) continue;\n if (prop === 'layout' || prop === 'paint' || prop === 'filter' ||\n prop === 'metadata' || prop === 'minzoom' || prop === 'maxzoom') continue;\n if (prop.indexOf('paint.') === 0) {\n diffLayerPropertyChanges(beforeLayer[prop], afterLayer[prop], commands, layerId, prop.slice(6), operations.setPaintProperty);\n } else if (!isEqual(beforeLayer[prop], afterLayer[prop])) {\n commands.push({ command: operations.setLayerProperty, args: [layerId, prop, afterLayer[prop]] });\n }\n }\n for (prop in afterLayer) {\n if (!afterLayer.hasOwnProperty(prop) || beforeLayer.hasOwnProperty(prop)) continue;\n if (prop === 'layout' || prop === 'paint' || prop === 'filter' ||\n prop === 'metadata' || prop === 'minzoom' || prop === 'maxzoom') continue;\n if (prop.indexOf('paint.') === 0) {\n diffLayerPropertyChanges(beforeLayer[prop], afterLayer[prop], commands, layerId, prop.slice(6), operations.setPaintProperty);\n } else if (!isEqual(beforeLayer[prop], afterLayer[prop])) {\n commands.push({ command: operations.setLayerProperty, args: [layerId, prop, afterLayer[prop]] });\n }\n }\n }\n}\n\n/**\n * Diff two stylesheet\n *\n * Creates semanticly aware diffs that can easily be applied at runtime.\n * Operations produced by the diff closely resemble the mapbox-gl-js API. Any\n * error creating the diff will fall back to the 'setStyle' operation.\n *\n * Example diff:\n * [\n * { command: 'setConstant', args: ['@water', '#0000FF'] },\n * { command: 'setPaintProperty', args: ['background', 'background-color', 'black'] }\n * ]\n *\n * @private\n * @param {*} [before] stylesheet to compare from\n * @param {*} after stylesheet to compare to\n * @returns Array list of changes\n */\nfunction diffStyles(before, after) {\n if (!before) return [{ command: operations.setStyle, args: [after] }];\n\n let commands = [];\n\n try {\n // Handle changes to top-level properties\n if (!isEqual(before.version, after.version)) {\n return [{ command: operations.setStyle, args: [after] }];\n }\n if (!isEqual(before.center, after.center)) {\n commands.push({ command: operations.setCenter, args: [after.center] });\n }\n if (!isEqual(before.zoom, after.zoom)) {\n commands.push({ command: operations.setZoom, args: [after.zoom] });\n }\n if (!isEqual(before.bearing, after.bearing)) {\n commands.push({ command: operations.setBearing, args: [after.bearing] });\n }\n if (!isEqual(before.pitch, after.pitch)) {\n commands.push({ command: operations.setPitch, args: [after.pitch] });\n }\n if (!isEqual(before.sprite, after.sprite)) {\n commands.push({ command: operations.setSprite, args: [after.sprite] });\n }\n if (!isEqual(before.glyphs, after.glyphs)) {\n commands.push({ command: operations.setGlyphs, args: [after.glyphs] });\n }\n if (!isEqual(before.transition, after.transition)) {\n commands.push({ command: operations.setTransition, args: [after.transition] });\n }\n if (!isEqual(before.light, after.light)) {\n commands.push({ command: operations.setLight, args: [after.light] });\n }\n\n // Handle changes to `sources`\n // If a source is to be removed, we also--before the removeSource\n // command--need to remove all the style layers that depend on it.\n const sourcesRemoved = {};\n\n // First collect the {add,remove}Source commands\n const removeOrAddSourceCommands = [];\n diffSources(before.sources, after.sources, removeOrAddSourceCommands, sourcesRemoved);\n\n // Push a removeLayer command for each style layer that depends on a\n // source that's being removed.\n // Also, exclude any such layers them from the input to `diffLayers`\n // below, so that diffLayers produces the appropriate `addLayers`\n // command\n const beforeLayers = [];\n if (before.layers) {\n before.layers.forEach((layer) => {\n if (sourcesRemoved[layer.source]) {\n commands.push({ command: operations.removeLayer, args: [layer.id] });\n } else {\n beforeLayers.push(layer);\n }\n });\n }\n commands = commands.concat(removeOrAddSourceCommands);\n\n // Handle changes to `layers`\n diffLayers(beforeLayers, after.layers, commands);\n\n } catch (e) {\n // fall back to setStyle\n console.warn('Unable to compute style diff:', e);\n commands = [{ command: operations.setStyle, args: [after] }];\n }\n\n return commands;\n}\n\nexport default diffStyles;\nexport { operations };\n","// @flow\n\n/**\n * GridIndex is a data structure for testing the intersection of\n * circles and rectangles in a 2d plane.\n * It is optimized for rapid insertion and querying.\n * GridIndex splits the plane into a set of \"cells\" and keeps track\n * of which geometries intersect with each cell. At query time,\n * full geometry comparisons are only done for items that share\n * at least one cell. As long as the geometries are relatively\n * uniformly distributed across the plane, this greatly reduces\n * the number of comparisons necessary.\n *\n * @private\n */\nclass GridIndex {\n circleKeys: Array;\n boxKeys: Array;\n boxCells: Array>;\n circleCells: Array>;\n bboxes: Array;\n circles: Array;\n xCellCount: number;\n yCellCount: number;\n width: number;\n height: number;\n xScale: number;\n yScale: number;\n boxUid: number;\n circleUid: number;\n\n constructor (width: number, height: number, cellSize: number) {\n const boxCells = this.boxCells = [];\n const circleCells = this.circleCells = [];\n\n // More cells -> fewer geometries to check per cell, but items tend\n // to be split across more cells.\n // Sweet spot allows most small items to fit in one cell\n this.xCellCount = Math.ceil(width / cellSize);\n this.yCellCount = Math.ceil(height / cellSize);\n\n for (let i = 0; i < this.xCellCount * this.yCellCount; i++) {\n boxCells.push([]);\n circleCells.push([]);\n }\n this.circleKeys = [];\n this.boxKeys = [];\n this.bboxes = [];\n this.circles = [];\n\n this.width = width;\n this.height = height;\n this.xScale = this.xCellCount / width;\n this.yScale = this.yCellCount / height;\n this.boxUid = 0;\n this.circleUid = 0;\n }\n\n keysLength() {\n return this.boxKeys.length + this.circleKeys.length;\n }\n\n insert(key: any, x1: number, y1: number, x2: number, y2: number) {\n this._forEachCell(x1, y1, x2, y2, this._insertBoxCell, this.boxUid++);\n this.boxKeys.push(key);\n this.bboxes.push(x1);\n this.bboxes.push(y1);\n this.bboxes.push(x2);\n this.bboxes.push(y2);\n }\n\n insertCircle(key: any, x: number, y: number, radius: number) {\n // Insert circle into grid for all cells in the circumscribing square\n // It's more than necessary (by a factor of 4/PI), but fast to insert\n this._forEachCell(x - radius, y - radius, x + radius, y + radius, this._insertCircleCell, this.circleUid++);\n this.circleKeys.push(key);\n this.circles.push(x);\n this.circles.push(y);\n this.circles.push(radius);\n }\n\n _insertBoxCell(x1: number, y1: number, x2: number, y2: number, cellIndex: number, uid: number) {\n this.boxCells[cellIndex].push(uid);\n }\n\n _insertCircleCell(x1: number, y1: number, x2: number, y2: number, cellIndex: number, uid: number) {\n this.circleCells[cellIndex].push(uid);\n }\n\n _query(x1: number, y1: number, x2: number, y2: number, hitTest: boolean) {\n if (x2 < 0 || x1 > this.width || y2 < 0 || y1 > this.height) {\n return hitTest ? false : [];\n }\n const result = [];\n if (x1 <= 0 && y1 <= 0 && this.width <= x2 && this.height <= y2) {\n if (hitTest) {\n return true;\n }\n for (let boxUid = 0; boxUid < this.boxKeys.length; boxUid++) {\n result.push({\n key: this.boxKeys[boxUid],\n x1: this.bboxes[boxUid * 4],\n y1: this.bboxes[boxUid * 4 + 1],\n x2: this.bboxes[boxUid * 4 + 2],\n y2: this.bboxes[boxUid * 4 + 3]\n });\n }\n for (let circleUid = 0; circleUid < this.circleKeys.length; circleUid++) {\n const x = this.circles[circleUid * 3];\n const y = this.circles[circleUid * 3 + 1];\n const radius = this.circles[circleUid * 3 + 2];\n result.push({\n key: this.circleKeys[circleUid],\n x1: x - radius,\n y1: y - radius,\n x2: x + radius,\n y2: y + radius\n });\n }\n } else {\n const queryArgs = {\n hitTest,\n seenUids: { box: {}, circle: {} }\n };\n this._forEachCell(x1, y1, x2, y2, this._queryCell, result, queryArgs);\n }\n return hitTest ? result.length > 0 : result;\n }\n\n _queryCircle(x: number, y: number, radius: number, hitTest: boolean) {\n // Insert circle into grid for all cells in the circumscribing square\n // It's more than necessary (by a factor of 4/PI), but fast to insert\n const x1 = x - radius;\n const x2 = x + radius;\n const y1 = y - radius;\n const y2 = y + radius;\n if (x2 < 0 || x1 > this.width || y2 < 0 || y1 > this.height) {\n return hitTest ? false : [];\n }\n\n // Box query early exits if the bounding box is larger than the grid, but we don't do\n // the equivalent calculation for circle queries because early exit is less likely\n // and the calculation is more expensive\n const result = [];\n const queryArgs = {\n hitTest,\n circle: { x: x, y: y, radius: radius },\n seenUids: { box: {}, circle: {} }\n };\n this._forEachCell(x1, y1, x2, y2, this._queryCellCircle, result, queryArgs);\n return hitTest ? result.length > 0 : result;\n }\n\n query(x1: number, y1: number, x2: number, y2: number): Array {\n return (this._query(x1, y1, x2, y2, false): any);\n }\n\n hitTest(x1: number, y1: number, x2: number, y2: number): boolean {\n return (this._query(x1, y1, x2, y2, true): any);\n }\n\n hitTestCircle(x: number, y: number, radius: number): boolean {\n return (this._queryCircle(x, y, radius, true): any);\n }\n\n _queryCell(x1: number, y1: number, x2: number, y2: number, cellIndex: number, result: any, queryArgs: any) {\n const seenUids = queryArgs.seenUids;\n const boxCell = this.boxCells[cellIndex];\n if (boxCell !== null) {\n const bboxes = this.bboxes;\n for (const boxUid of boxCell) {\n if (!seenUids.box[boxUid]) {\n seenUids.box[boxUid] = true;\n const offset = boxUid * 4;\n if ((x1 <= bboxes[offset + 2]) &&\n (y1 <= bboxes[offset + 3]) &&\n (x2 >= bboxes[offset + 0]) &&\n (y2 >= bboxes[offset + 1])) {\n if (queryArgs.hitTest) {\n result.push(true);\n return true;\n } else {\n result.push({\n key: this.boxKeys[boxUid],\n x1: bboxes[offset],\n y1: bboxes[offset + 1],\n x2: bboxes[offset + 2],\n y2: bboxes[offset + 3]\n });\n }\n }\n }\n }\n }\n const circleCell = this.circleCells[cellIndex];\n if (circleCell !== null) {\n const circles = this.circles;\n for (const circleUid of circleCell) {\n if (!seenUids.circle[circleUid]) {\n seenUids.circle[circleUid] = true;\n const offset = circleUid * 3;\n if (this._circleAndRectCollide(\n circles[offset],\n circles[offset + 1],\n circles[offset + 2],\n x1,\n y1,\n x2,\n y2)) {\n if (queryArgs.hitTest) {\n result.push(true);\n return true;\n } else {\n const x = circles[offset];\n const y = circles[offset + 1];\n const radius = circles[offset + 2];\n result.push({\n key: this.circleKeys[circleUid],\n x1: x - radius,\n y1: y - radius,\n x2: x + radius,\n y2: y + radius\n });\n }\n }\n }\n }\n }\n }\n\n _queryCellCircle(x1: number, y1: number, x2: number, y2: number, cellIndex: number, result: any, queryArgs: any) {\n const circle = queryArgs.circle;\n const seenUids = queryArgs.seenUids;\n const boxCell = this.boxCells[cellIndex];\n if (boxCell !== null) {\n const bboxes = this.bboxes;\n for (const boxUid of boxCell) {\n if (!seenUids.box[boxUid]) {\n seenUids.box[boxUid] = true;\n const offset = boxUid * 4;\n if (this._circleAndRectCollide(\n circle.x,\n circle.y,\n circle.radius,\n bboxes[offset + 0],\n bboxes[offset + 1],\n bboxes[offset + 2],\n bboxes[offset + 3])) {\n result.push(true);\n return true;\n }\n }\n }\n }\n\n const circleCell = this.circleCells[cellIndex];\n if (circleCell !== null) {\n const circles = this.circles;\n for (const circleUid of circleCell) {\n if (!seenUids.circle[circleUid]) {\n seenUids.circle[circleUid] = true;\n const offset = circleUid * 3;\n if (this._circlesCollide(\n circles[offset],\n circles[offset + 1],\n circles[offset + 2],\n circle.x,\n circle.y,\n circle.radius)) {\n result.push(true);\n return true;\n }\n }\n }\n }\n }\n\n _forEachCell(x1: number, y1: number, x2: number, y2: number, fn: any, arg1: any, arg2?: any) {\n const cx1 = this._convertToXCellCoord(x1);\n const cy1 = this._convertToYCellCoord(y1);\n const cx2 = this._convertToXCellCoord(x2);\n const cy2 = this._convertToYCellCoord(y2);\n\n for (let x = cx1; x <= cx2; x++) {\n for (let y = cy1; y <= cy2; y++) {\n const cellIndex = this.xCellCount * y + x;\n if (fn.call(this, x1, y1, x2, y2, cellIndex, arg1, arg2)) return;\n }\n }\n }\n\n _convertToXCellCoord(x: number) {\n return Math.max(0, Math.min(this.xCellCount - 1, Math.floor(x * this.xScale)));\n }\n\n _convertToYCellCoord(y: number) {\n return Math.max(0, Math.min(this.yCellCount - 1, Math.floor(y * this.yScale)));\n }\n\n _circlesCollide(x1: number, y1: number, r1: number, x2: number, y2: number, r2: number): boolean {\n const dx = x2 - x1;\n const dy = y2 - y1;\n const bothRadii = r1 + r2;\n return (bothRadii * bothRadii) > (dx * dx + dy * dy);\n }\n\n _circleAndRectCollide(circleX: number, circleY: number, radius: number, x1: number, y1: number, x2: number, y2: number): boolean {\n const halfRectWidth = (x2 - x1) / 2;\n const distX = Math.abs(circleX - (x1 + halfRectWidth));\n if (distX > (halfRectWidth + radius)) {\n return false;\n }\n\n const halfRectHeight = (y2 - y1) / 2;\n const distY = Math.abs(circleY - (y1 + halfRectHeight));\n if (distY > (halfRectHeight + radius)) {\n return false;\n }\n\n if (distX <= halfRectWidth || distY <= halfRectHeight) {\n return true;\n }\n\n const dx = distX - halfRectWidth;\n const dy = distY - halfRectHeight;\n return (dx * dx + dy * dy <= (radius * radius));\n }\n}\n\nexport default GridIndex;\n","// @flow\n\nimport Point from '@mapbox/point-geometry';\n\nimport { mat4, vec4 } from '@mapbox/gl-matrix';\nimport * as symbolSize from './symbol_size';\nimport { addDynamicAttributes } from '../data/bucket/symbol_bucket';\nimport properties from '../style/style_layer/symbol_style_layer_properties';\nconst symbolLayoutProperties = properties.layout;\n\nimport type Painter from '../render/painter';\nimport type Transform from '../geo/transform';\nimport type SymbolBucket from '../data/bucket/symbol_bucket';\nimport type {\n GlyphOffsetArray,\n SymbolLineVertexArray,\n SymbolDynamicLayoutArray\n} from '../data/array_types';\nimport { WritingMode } from '../symbol/shaping';\n\nexport { updateLineLabels, getLabelPlaneMatrix, getGlCoordMatrix, project, placeFirstAndLastGlyph, xyTransformMat4 };\n\n/*\n * # Overview of coordinate spaces\n *\n * ## Tile coordinate spaces\n * Each label has an anchor. Some labels have corresponding line geometries.\n * The points for both anchors and lines are stored in tile units. Each tile has it's own\n * coordinate space going from (0, 0) at the top left to (EXTENT, EXTENT) at the bottom right.\n *\n * ## GL coordinate space\n * At the end of everything, the vertex shader needs to produce a position in GL coordinate space,\n * which is (-1, 1) at the top left and (1, -1) in the bottom right.\n *\n * ## Map pixel coordinate spaces\n * Each tile has a pixel coordinate space. It's just the tile units scaled so that one unit is\n * whatever counts as 1 pixel at the current zoom.\n * This space is used for pitch-alignment=map, rotation-alignment=map\n *\n * ## Rotated map pixel coordinate spaces\n * Like the above, but rotated so axis of the space are aligned with the viewport instead of the tile.\n * This space is used for pitch-alignment=map, rotation-alignment=viewport\n *\n * ## Viewport pixel coordinate space\n * (0, 0) is at the top left of the canvas and (pixelWidth, pixelHeight) is at the bottom right corner\n * of the canvas. This space is used for pitch-alignment=viewport\n *\n *\n * # Vertex projection\n * It goes roughly like this:\n * 1. project the anchor and line from tile units into the correct label coordinate space\n * - map pixel space pitch-alignment=map rotation-alignment=map\n * - rotated map pixel space pitch-alignment=map rotation-alignment=viewport\n * - viewport pixel space pitch-alignment=viewport rotation-alignment=*\n * 2. if the label follows a line, find the point along the line that is the correct distance from the anchor.\n * 3. add the glyph's corner offset to the point from step 3\n * 4. convert from the label coordinate space to gl coordinates\n *\n * For horizontal labels we want to do step 1 in the shader for performance reasons (no cpu work).\n * This is what `u_label_plane_matrix` is used for.\n * For labels aligned with lines we have to steps 1 and 2 on the cpu since we need access to the line geometry.\n * This is what `updateLineLabels(...)` does.\n * Since the conversion is handled on the cpu we just set `u_label_plane_matrix` to an identity matrix.\n *\n * Steps 3 and 4 are done in the shaders for all labels.\n */\n\n/*\n * Returns a matrix for converting from tile units to the correct label coordinate space.\n */\nfunction getLabelPlaneMatrix(posMatrix: mat4,\n pitchWithMap: boolean,\n rotateWithMap: boolean,\n transform: Transform,\n pixelsToTileUnits: number) {\n const m = mat4.identity(new Float32Array(16));\n if (pitchWithMap) {\n mat4.identity(m);\n mat4.scale(m, m, [1 / pixelsToTileUnits, 1 / pixelsToTileUnits, 1]);\n if (!rotateWithMap) {\n mat4.rotateZ(m, m, transform.angle);\n }\n } else {\n mat4.scale(m, m, [transform.width / 2, -transform.height / 2, 1]);\n mat4.translate(m, m, [1, -1, 0]);\n mat4.multiply(m, m, posMatrix);\n }\n return m;\n}\n\n/*\n * Returns a matrix for converting from the correct label coordinate space to gl coords.\n */\nfunction getGlCoordMatrix(posMatrix: mat4,\n pitchWithMap: boolean,\n rotateWithMap: boolean,\n transform: Transform,\n pixelsToTileUnits: number) {\n const m = mat4.identity(new Float32Array(16));\n if (pitchWithMap) {\n mat4.multiply(m, m, posMatrix);\n mat4.scale(m, m, [pixelsToTileUnits, pixelsToTileUnits, 1]);\n if (!rotateWithMap) {\n mat4.rotateZ(m, m, -transform.angle);\n }\n } else {\n mat4.scale(m, m, [1, -1, 1]);\n mat4.translate(m, m, [-1, -1, 0]);\n mat4.scale(m, m, [2 / transform.width, 2 / transform.height, 1]);\n }\n return m;\n}\n\nfunction project(point: Point, matrix: mat4) {\n const pos = [point.x, point.y, 0, 1];\n xyTransformMat4(pos, pos, matrix);\n const w = pos[3];\n return {\n point: new Point(pos[0] / w, pos[1] / w),\n signedDistanceFromCamera: w\n };\n}\n\nfunction isVisible(anchorPos: [number, number, number, number],\n clippingBuffer: [number, number]) {\n const x = anchorPos[0] / anchorPos[3];\n const y = anchorPos[1] / anchorPos[3];\n const inPaddedViewport = (\n x >= -clippingBuffer[0] &&\n x <= clippingBuffer[0] &&\n y >= -clippingBuffer[1] &&\n y <= clippingBuffer[1]);\n return inPaddedViewport;\n}\n\n/*\n * Update the `dynamicLayoutVertexBuffer` for the buffer with the correct glyph positions for the current map view.\n * This is only run on labels that are aligned with lines. Horizontal labels are handled entirely in the shader.\n */\nfunction updateLineLabels(bucket: SymbolBucket,\n posMatrix: mat4,\n painter: Painter,\n isText: boolean,\n labelPlaneMatrix: mat4,\n glCoordMatrix: mat4,\n pitchWithMap: boolean,\n keepUpright: boolean) {\n\n const sizeData = isText ? bucket.textSizeData : bucket.iconSizeData;\n const partiallyEvaluatedSize = symbolSize.evaluateSizeForZoom(sizeData, painter.transform.zoom,\n symbolLayoutProperties.properties[isText ? 'text-size' : 'icon-size']);\n\n const clippingBuffer = [256 / painter.width * 2 + 1, 256 / painter.height * 2 + 1];\n\n const dynamicLayoutVertexArray = isText ?\n bucket.text.dynamicLayoutVertexArray :\n bucket.icon.dynamicLayoutVertexArray;\n dynamicLayoutVertexArray.clear();\n\n const lineVertexArray = bucket.lineVertexArray;\n const placedSymbols = isText ? bucket.text.placedSymbolArray : bucket.icon.placedSymbolArray;\n\n const aspectRatio = painter.transform.width / painter.transform.height;\n\n let useVertical = false;\n\n for (let s = 0; s < placedSymbols.length; s++) {\n const symbol: any = placedSymbols.get(s);\n // Don't do calculations for vertical glyphs unless the previous symbol was horizontal\n // and we determined that vertical glyphs were necessary.\n // Also don't do calculations for symbols that are collided and fully faded out\n if (symbol.hidden || symbol.writingMode === WritingMode.vertical && !useVertical) {\n hideGlyphs(symbol.numGlyphs, dynamicLayoutVertexArray);\n continue;\n }\n // Awkward... but we're counting on the paired \"vertical\" symbol coming immediately after its horizontal counterpart\n useVertical = false;\n\n const anchorPos = [symbol.anchorX, symbol.anchorY, 0, 1];\n vec4.transformMat4(anchorPos, anchorPos, posMatrix);\n\n // Don't bother calculating the correct point for invisible labels.\n if (!isVisible(anchorPos, clippingBuffer)) {\n hideGlyphs(symbol.numGlyphs, dynamicLayoutVertexArray);\n continue;\n }\n\n const cameraToAnchorDistance = anchorPos[3];\n const perspectiveRatio = 0.5 + 0.5 * (cameraToAnchorDistance / painter.transform.cameraToCenterDistance);\n\n const fontSize = symbolSize.evaluateSizeForFeature(sizeData, partiallyEvaluatedSize, symbol);\n const pitchScaledFontSize = pitchWithMap ?\n fontSize * perspectiveRatio :\n fontSize / perspectiveRatio;\n\n const tileAnchorPoint = new Point(symbol.anchorX, symbol.anchorY);\n const anchorPoint = project(tileAnchorPoint, labelPlaneMatrix).point;\n const projectionCache = {};\n\n const placeUnflipped: any = placeGlyphsAlongLine(symbol, pitchScaledFontSize, false /*unflipped*/, keepUpright, posMatrix, labelPlaneMatrix, glCoordMatrix,\n bucket.glyphOffsetArray, lineVertexArray, dynamicLayoutVertexArray, anchorPoint, tileAnchorPoint, projectionCache, aspectRatio);\n\n useVertical = placeUnflipped.useVertical;\n\n if (placeUnflipped.notEnoughRoom || useVertical ||\n (placeUnflipped.needsFlipping &&\n placeGlyphsAlongLine(symbol, pitchScaledFontSize, true /*flipped*/, keepUpright, posMatrix, labelPlaneMatrix, glCoordMatrix,\n bucket.glyphOffsetArray, lineVertexArray, dynamicLayoutVertexArray, anchorPoint, tileAnchorPoint, projectionCache, aspectRatio).notEnoughRoom)) {\n hideGlyphs(symbol.numGlyphs, dynamicLayoutVertexArray);\n }\n }\n\n if (isText) {\n bucket.text.dynamicLayoutVertexBuffer.updateData(dynamicLayoutVertexArray);\n } else {\n bucket.icon.dynamicLayoutVertexBuffer.updateData(dynamicLayoutVertexArray);\n }\n}\n\nfunction placeFirstAndLastGlyph(fontScale: number, glyphOffsetArray: GlyphOffsetArray, lineOffsetX: number, lineOffsetY: number, flip: boolean, anchorPoint: Point, tileAnchorPoint: Point, symbol: any, lineVertexArray: SymbolLineVertexArray, labelPlaneMatrix: mat4, projectionCache: any, returnTileDistance: boolean) {\n const glyphEndIndex = symbol.glyphStartIndex + symbol.numGlyphs;\n const lineStartIndex = symbol.lineStartIndex;\n const lineEndIndex = symbol.lineStartIndex + symbol.lineLength;\n\n const firstGlyphOffset = glyphOffsetArray.getoffsetX(symbol.glyphStartIndex);\n const lastGlyphOffset = glyphOffsetArray.getoffsetX(glyphEndIndex - 1);\n\n const firstPlacedGlyph = placeGlyphAlongLine(fontScale * firstGlyphOffset, lineOffsetX, lineOffsetY, flip, anchorPoint, tileAnchorPoint, symbol.segment,\n lineStartIndex, lineEndIndex, lineVertexArray, labelPlaneMatrix, projectionCache, returnTileDistance);\n if (!firstPlacedGlyph)\n return null;\n\n const lastPlacedGlyph = placeGlyphAlongLine(fontScale * lastGlyphOffset, lineOffsetX, lineOffsetY, flip, anchorPoint, tileAnchorPoint, symbol.segment,\n lineStartIndex, lineEndIndex, lineVertexArray, labelPlaneMatrix, projectionCache, returnTileDistance);\n if (!lastPlacedGlyph)\n return null;\n\n return { first: firstPlacedGlyph, last: lastPlacedGlyph };\n}\n\nfunction requiresOrientationChange(writingMode, firstPoint, lastPoint, aspectRatio) {\n if (writingMode === WritingMode.horizontal) {\n // On top of choosing whether to flip, choose whether to render this version of the glyphs or the alternate\n // vertical glyphs. We can't just filter out vertical glyphs in the horizontal range because the horizontal\n // and vertical versions can have slightly different projections which could lead to angles where both or\n // neither showed.\n const rise = Math.abs(lastPoint.y - firstPoint.y);\n const run = Math.abs(lastPoint.x - firstPoint.x) * aspectRatio;\n if (rise > run) {\n return { useVertical: true };\n }\n }\n\n if (writingMode === WritingMode.vertical ? firstPoint.y < lastPoint.y : firstPoint.x > lastPoint.x) {\n // Includes \"horizontalOnly\" case for labels without vertical glyphs\n return { needsFlipping: true };\n }\n\n return null;\n}\n\nfunction placeGlyphsAlongLine(symbol, fontSize, flip, keepUpright, posMatrix, labelPlaneMatrix, glCoordMatrix, glyphOffsetArray, lineVertexArray, dynamicLayoutVertexArray, anchorPoint, tileAnchorPoint, projectionCache, aspectRatio) {\n const fontScale = fontSize / 24;\n const lineOffsetX = symbol.lineOffsetX * fontSize;\n const lineOffsetY = symbol.lineOffsetY * fontSize;\n\n let placedGlyphs;\n if (symbol.numGlyphs > 1) {\n const glyphEndIndex = symbol.glyphStartIndex + symbol.numGlyphs;\n const lineStartIndex = symbol.lineStartIndex;\n const lineEndIndex = symbol.lineStartIndex + symbol.lineLength;\n\n // Place the first and the last glyph in the label first, so we can figure out\n // the overall orientation of the label and determine whether it needs to be flipped in keepUpright mode\n const firstAndLastGlyph = placeFirstAndLastGlyph(fontScale, glyphOffsetArray, lineOffsetX, lineOffsetY, flip, anchorPoint, tileAnchorPoint, symbol, lineVertexArray, labelPlaneMatrix, projectionCache, false);\n if (!firstAndLastGlyph) {\n return { notEnoughRoom: true };\n }\n const firstPoint = project(firstAndLastGlyph.first.point, glCoordMatrix).point;\n const lastPoint = project(firstAndLastGlyph.last.point, glCoordMatrix).point;\n\n if (keepUpright && !flip) {\n const orientationChange = requiresOrientationChange(symbol.writingMode, firstPoint, lastPoint, aspectRatio);\n if (orientationChange) {\n return orientationChange;\n }\n }\n\n placedGlyphs = [firstAndLastGlyph.first];\n for (let glyphIndex = symbol.glyphStartIndex + 1; glyphIndex < glyphEndIndex - 1; glyphIndex++) {\n // Since first and last glyph fit on the line, we're sure that the rest of the glyphs can be placed\n // $FlowFixMe\n placedGlyphs.push(placeGlyphAlongLine(fontScale * glyphOffsetArray.getoffsetX(glyphIndex), lineOffsetX, lineOffsetY, flip, anchorPoint, tileAnchorPoint, symbol.segment,\n lineStartIndex, lineEndIndex, lineVertexArray, labelPlaneMatrix, projectionCache, false));\n }\n placedGlyphs.push(firstAndLastGlyph.last);\n } else {\n // Only a single glyph to place\n // So, determine whether to flip based on projected angle of the line segment it's on\n if (keepUpright && !flip) {\n const a = project(tileAnchorPoint, posMatrix).point;\n const tileVertexIndex = (symbol.lineStartIndex + symbol.segment + 1);\n // $FlowFixMe\n const tileSegmentEnd = new Point(lineVertexArray.getx(tileVertexIndex), lineVertexArray.gety(tileVertexIndex));\n const projectedVertex = project(tileSegmentEnd, posMatrix);\n // We know the anchor will be in the viewport, but the end of the line segment may be\n // behind the plane of the camera, in which case we can use a point at any arbitrary (closer)\n // point on the segment.\n const b = (projectedVertex.signedDistanceFromCamera > 0) ?\n projectedVertex.point :\n projectTruncatedLineSegment(tileAnchorPoint, tileSegmentEnd, a, 1, posMatrix);\n\n\n const orientationChange = requiresOrientationChange(symbol.writingMode, a, b, aspectRatio);\n if (orientationChange) {\n return orientationChange;\n }\n }\n // $FlowFixMe\n const singleGlyph = placeGlyphAlongLine(fontScale * glyphOffsetArray.getoffsetX(symbol.glyphStartIndex), lineOffsetX, lineOffsetY, flip, anchorPoint, tileAnchorPoint, symbol.segment,\n symbol.lineStartIndex, symbol.lineStartIndex + symbol.lineLength, lineVertexArray, labelPlaneMatrix, projectionCache, false);\n if (!singleGlyph)\n return { notEnoughRoom: true };\n\n placedGlyphs = [singleGlyph];\n }\n\n for (const glyph: any of placedGlyphs) {\n addDynamicAttributes(dynamicLayoutVertexArray, glyph.point, glyph.angle);\n }\n return {};\n}\n\nfunction projectTruncatedLineSegment(previousTilePoint: Point, currentTilePoint: Point, previousProjectedPoint: Point, minimumLength: number, projectionMatrix: mat4) {\n // We are assuming \"previousTilePoint\" won't project to a point within one unit of the camera plane\n // If it did, that would mean our label extended all the way out from within the viewport to a (very distant)\n // point near the plane of the camera. We wouldn't be able to render the label anyway once it crossed the\n // plane of the camera.\n const projectedUnitVertex = project(previousTilePoint.add(previousTilePoint.sub(currentTilePoint)._unit()), projectionMatrix).point;\n const projectedUnitSegment = previousProjectedPoint.sub(projectedUnitVertex);\n\n return previousProjectedPoint.add(projectedUnitSegment._mult(minimumLength / projectedUnitSegment.mag()));\n}\n\nfunction placeGlyphAlongLine(offsetX: number,\n lineOffsetX: number,\n lineOffsetY: number,\n flip: boolean,\n anchorPoint: Point,\n tileAnchorPoint: Point,\n anchorSegment: number,\n lineStartIndex: number,\n lineEndIndex: number,\n lineVertexArray: SymbolLineVertexArray,\n labelPlaneMatrix: mat4,\n projectionCache: {[number]: Point},\n returnTileDistance: boolean) {\n\n const combinedOffsetX = flip ?\n offsetX - lineOffsetX :\n offsetX + lineOffsetX;\n\n let dir = combinedOffsetX > 0 ? 1 : -1;\n\n let angle = 0;\n if (flip) {\n // The label needs to be flipped to keep text upright.\n // Iterate in the reverse direction.\n dir *= -1;\n angle = Math.PI;\n }\n\n if (dir < 0) angle += Math.PI;\n\n let currentIndex = dir > 0 ?\n lineStartIndex + anchorSegment :\n lineStartIndex + anchorSegment + 1;\n\n const initialIndex = currentIndex;\n let current = anchorPoint;\n let prev = anchorPoint;\n let distanceToPrev = 0;\n let currentSegmentDistance = 0;\n const absOffsetX = Math.abs(combinedOffsetX);\n\n while (distanceToPrev + currentSegmentDistance <= absOffsetX) {\n currentIndex += dir;\n\n // offset does not fit on the projected line\n if (currentIndex < lineStartIndex || currentIndex >= lineEndIndex)\n return null;\n\n prev = current;\n\n current = projectionCache[currentIndex];\n if (current === undefined) {\n const currentVertex = new Point(lineVertexArray.getx(currentIndex), lineVertexArray.gety(currentIndex));\n const projection = project(currentVertex, labelPlaneMatrix);\n if (projection.signedDistanceFromCamera > 0) {\n current = projectionCache[currentIndex] = projection.point;\n } else {\n // The vertex is behind the plane of the camera, so we can't project it\n // Instead, we'll create a vertex along the line that's far enough to include the glyph\n const previousLineVertexIndex = currentIndex - dir;\n const previousTilePoint = distanceToPrev === 0 ?\n tileAnchorPoint :\n new Point(lineVertexArray.getx(previousLineVertexIndex), lineVertexArray.gety(previousLineVertexIndex));\n // Don't cache because the new vertex might not be far enough out for future glyphs on the same segment\n current = projectTruncatedLineSegment(previousTilePoint, currentVertex, prev, absOffsetX - distanceToPrev + 1, labelPlaneMatrix);\n }\n }\n\n distanceToPrev += currentSegmentDistance;\n currentSegmentDistance = prev.dist(current);\n }\n\n // The point is on the current segment. Interpolate to find it.\n const segmentInterpolationT = (absOffsetX - distanceToPrev) / currentSegmentDistance;\n const prevToCurrent = current.sub(prev);\n const p = prevToCurrent.mult(segmentInterpolationT)._add(prev);\n\n // offset the point from the line to text-offset and icon-offset\n p._add(prevToCurrent._unit()._perp()._mult(lineOffsetY * dir));\n\n const segmentAngle = angle + Math.atan2(current.y - prev.y, current.x - prev.x);\n\n return {\n point: p,\n angle: segmentAngle,\n tileDistance: returnTileDistance ?\n {\n prevTileDistance: (currentIndex - dir) === initialIndex ? 0 : lineVertexArray.gettileUnitDistanceFromAnchor(currentIndex - dir),\n lastSegmentViewportDistance: absOffsetX - distanceToPrev\n } : null\n };\n}\n\nconst hiddenGlyphAttributes = new Float32Array([-Infinity, -Infinity, 0, -Infinity, -Infinity, 0, -Infinity, -Infinity, 0, -Infinity, -Infinity, 0]);\n\n// Hide them by moving them offscreen. We still need to add them to the buffer\n// because the dynamic buffer is paired with a static buffer that doesn't get updated.\nfunction hideGlyphs(num: number, dynamicLayoutVertexArray: SymbolDynamicLayoutArray) {\n for (let i = 0; i < num; i++) {\n const offset = dynamicLayoutVertexArray.length;\n dynamicLayoutVertexArray.resize(offset + 4);\n // Since all hidden glyphs have the same attributes, we can build up the array faster with a single call to Float32Array.set\n // for each set of four vertices, instead of calling addDynamicAttributes for each vertex.\n dynamicLayoutVertexArray.float32.set(hiddenGlyphAttributes, offset * 3);\n }\n}\n\n// For line label layout, we're not using z output and our w input is always 1\n// This custom matrix transformation ignores those components to make projection faster\nfunction xyTransformMat4(out: vec4, a: vec4, m: mat4) {\n const x = a[0], y = a[1];\n out[0] = m[0] * x + m[4] * y + m[12];\n out[1] = m[1] * x + m[5] * y + m[13];\n out[3] = m[3] * x + m[7] * y + m[15];\n return out;\n}\n","// @flow\n\nimport Point from '@mapbox/point-geometry';\n\nimport * as intersectionTests from '../util/intersection_tests';\nimport Grid from './grid_index';\nimport glmatrix from '@mapbox/gl-matrix';\n\nconst mat4 = glmatrix.mat4;\n\nimport * as projection from '../symbol/projection';\n\nimport type Transform from '../geo/transform';\nimport type {SingleCollisionBox} from '../data/bucket/symbol_bucket';\nimport type {\n GlyphOffsetArray,\n SymbolLineVertexArray\n} from '../data/array_types';\n\n// When a symbol crosses the edge that causes it to be included in\n// collision detection, it will cause changes in the symbols around\n// it. This constant specifies how many pixels to pad the edge of\n// the viewport for collision detection so that the bulk of the changes\n// occur offscreen. Making this constant greater increases label\n// stability, but it's expensive.\nconst viewportPadding = 100;\n\n/**\n * A collision index used to prevent symbols from overlapping. It keep tracks of\n * where previous symbols have been placed and is used to check if a new\n * symbol overlaps with any previously added symbols.\n *\n * There are two steps to insertion: first placeCollisionBox/Circles checks if\n * there's room for a symbol, then insertCollisionBox/Circles actually puts the\n * symbol in the index. The two step process allows paired symbols to be inserted\n * together even if they overlap.\n *\n * @private\n */\nclass CollisionIndex {\n grid: Grid;\n ignoredGrid: Grid;\n transform: Transform;\n pitchfactor: number;\n screenRightBoundary: number;\n screenBottomBoundary: number;\n\n constructor(\n transform: Transform,\n grid: Grid = new Grid(transform.width + 2 * viewportPadding, transform.height + 2 * viewportPadding, 25),\n ignoredGrid: Grid = new Grid(transform.width + 2 * viewportPadding, transform.height + 2 * viewportPadding, 25)\n ) {\n this.transform = transform;\n\n this.grid = grid;\n this.ignoredGrid = ignoredGrid;\n this.pitchfactor = Math.cos(transform._pitch) * transform.cameraToCenterDistance;\n\n this.screenRightBoundary = transform.width + viewportPadding;\n this.screenBottomBoundary = transform.height + viewportPadding;\n }\n\n placeCollisionBox(collisionBox: SingleCollisionBox, allowOverlap: boolean, textPixelRatio: number, posMatrix: mat4): { box: Array, offscreen: boolean } {\n const projectedPoint = this.projectAndGetPerspectiveRatio(posMatrix, collisionBox.anchorPointX, collisionBox.anchorPointY);\n const tileToViewport = textPixelRatio * projectedPoint.perspectiveRatio;\n const tlX = collisionBox.x1 * tileToViewport + projectedPoint.point.x;\n const tlY = collisionBox.y1 * tileToViewport + projectedPoint.point.y;\n const brX = collisionBox.x2 * tileToViewport + projectedPoint.point.x;\n const brY = collisionBox.y2 * tileToViewport + projectedPoint.point.y;\n\n if (!allowOverlap) {\n if (this.grid.hitTest(tlX, tlY, brX, brY)) {\n return {\n box: [],\n offscreen: false\n };\n }\n }\n return {\n box: [tlX, tlY, brX, brY],\n offscreen: this.isOffscreen(tlX, tlY, brX, brY)\n };\n }\n\n approximateTileDistance(tileDistance: any, lastSegmentAngle: number, pixelsToTileUnits: number, cameraToAnchorDistance: number, pitchWithMap: boolean): number {\n // This is a quick and dirty solution for chosing which collision circles to use (since collision circles are\n // laid out in tile units). Ideally, I think we should generate collision circles on the fly in viewport coordinates\n // at the time we do collision detection.\n // See https://github.com/mapbox/mapbox-gl-js/issues/5474\n\n // incidenceStretch is the ratio of how much y space a label takes up on a tile while drawn perpendicular to the viewport vs\n // how much space it would take up if it were drawn flat on the tile\n // Using law of sines, camera_to_anchor/sin(ground_angle) = camera_to_center/sin(incidence_angle)\n // Incidence angle 90 -> head on, sin(incidence_angle) = 1, no stretch\n // Incidence angle 1 -> very oblique, sin(incidence_angle) =~ 0, lots of stretch\n // ground_angle = u_pitch + PI/2 -> sin(ground_angle) = cos(u_pitch)\n // incidenceStretch = 1 / sin(incidenceAngle)\n\n const incidenceStretch = pitchWithMap ? 1 : cameraToAnchorDistance / this.pitchfactor;\n const lastSegmentTile = tileDistance.lastSegmentViewportDistance * pixelsToTileUnits;\n return tileDistance.prevTileDistance +\n lastSegmentTile +\n (incidenceStretch - 1) * lastSegmentTile * Math.abs(Math.sin(lastSegmentAngle));\n }\n\n placeCollisionCircles(collisionCircles: Array,\n allowOverlap: boolean,\n scale: number,\n textPixelRatio: number,\n key: string,\n symbol: any,\n lineVertexArray: SymbolLineVertexArray,\n glyphOffsetArray: GlyphOffsetArray,\n fontSize: number,\n posMatrix: mat4,\n labelPlaneMatrix: mat4,\n showCollisionCircles: boolean,\n pitchWithMap: boolean): { circles: Array, offscreen: boolean } {\n const placedCollisionCircles = [];\n\n const projectedAnchor = this.projectAnchor(posMatrix, symbol.anchorX, symbol.anchorY);\n\n const projectionCache = {};\n const fontScale = fontSize / 24;\n const lineOffsetX = symbol.lineOffsetX * fontSize;\n const lineOffsetY = symbol.lineOffsetY * fontSize;\n\n const tileUnitAnchorPoint = new Point(symbol.anchorX, symbol.anchorY);\n // projection.project generates NDC coordinates, as opposed to the\n // pixel-based grid coordinates generated by this.projectPoint\n const labelPlaneAnchorPoint =\n projection.project(tileUnitAnchorPoint, labelPlaneMatrix).point;\n const firstAndLastGlyph = projection.placeFirstAndLastGlyph(\n fontScale,\n glyphOffsetArray,\n lineOffsetX,\n lineOffsetY,\n /*flip*/ false,\n labelPlaneAnchorPoint,\n tileUnitAnchorPoint,\n symbol,\n lineVertexArray,\n labelPlaneMatrix,\n projectionCache,\n /*return tile distance*/ true);\n\n let collisionDetected = false;\n let entirelyOffscreen = true;\n\n const tileToViewport = projectedAnchor.perspectiveRatio * textPixelRatio;\n // pixelsToTileUnits is used for translating line geometry to tile units\n // ... so we care about 'scale' but not 'perspectiveRatio'\n // equivalent to pixel_to_tile_units\n const pixelsToTileUnits = 1 / (textPixelRatio * scale);\n\n let firstTileDistance = 0, lastTileDistance = 0;\n if (firstAndLastGlyph) {\n firstTileDistance = this.approximateTileDistance(firstAndLastGlyph.first.tileDistance, firstAndLastGlyph.first.angle, pixelsToTileUnits, projectedAnchor.cameraDistance, pitchWithMap);\n lastTileDistance = this.approximateTileDistance(firstAndLastGlyph.last.tileDistance, firstAndLastGlyph.last.angle, pixelsToTileUnits, projectedAnchor.cameraDistance, pitchWithMap);\n }\n\n for (let k = 0; k < collisionCircles.length; k += 5) {\n const anchorPointX = collisionCircles[k];\n const anchorPointY = collisionCircles[k + 1];\n const tileUnitRadius = collisionCircles[k + 2];\n const boxSignedDistanceFromAnchor = collisionCircles[k + 3];\n if (!firstAndLastGlyph ||\n (boxSignedDistanceFromAnchor < -firstTileDistance) ||\n (boxSignedDistanceFromAnchor > lastTileDistance)) {\n // The label either doesn't fit on its line or we\n // don't need to use this circle because the label\n // doesn't extend this far. Either way, mark the circle unused.\n markCollisionCircleUsed(collisionCircles, k, false);\n continue;\n }\n\n const projectedPoint = this.projectPoint(posMatrix, anchorPointX, anchorPointY);\n const radius = tileUnitRadius * tileToViewport;\n\n const atLeastOneCirclePlaced = placedCollisionCircles.length > 0;\n if (atLeastOneCirclePlaced) {\n const dx = projectedPoint.x - placedCollisionCircles[placedCollisionCircles.length - 4];\n const dy = projectedPoint.y - placedCollisionCircles[placedCollisionCircles.length - 3];\n // The circle edges touch when the distance between their centers is 2x the radius\n // When the distance is 1x the radius, they're doubled up, and we could remove\n // every other circle while keeping them all in touch.\n // We actually start removing circles when the distance is √2x the radius:\n // thinning the number of circles as much as possible is a major performance win,\n // and the small gaps introduced don't make a very noticeable difference.\n const placedTooDensely = radius * radius * 2 > dx * dx + dy * dy;\n if (placedTooDensely) {\n const atLeastOneMoreCircle = (k + 8) < collisionCircles.length;\n if (atLeastOneMoreCircle) {\n const nextBoxDistanceToAnchor = collisionCircles[k + 8];\n if ((nextBoxDistanceToAnchor > -firstTileDistance) &&\n (nextBoxDistanceToAnchor < lastTileDistance)) {\n // Hide significantly overlapping circles, unless this is the last one we can\n // use, in which case we want to keep it in place even if it's tightly packed\n // with the one before it.\n markCollisionCircleUsed(collisionCircles, k, false);\n continue;\n }\n }\n }\n }\n const collisionBoxArrayIndex = k / 5;\n placedCollisionCircles.push(projectedPoint.x, projectedPoint.y, radius, collisionBoxArrayIndex);\n markCollisionCircleUsed(collisionCircles, k, true);\n\n entirelyOffscreen = entirelyOffscreen && this.isOffscreen(projectedPoint.x - radius, projectedPoint.y - radius, projectedPoint.x + radius, projectedPoint.y + radius);\n\n if (!allowOverlap) {\n if (this.grid.hitTestCircle(projectedPoint.x, projectedPoint.y, radius)) {\n if (!showCollisionCircles) {\n return {\n circles: [],\n offscreen: false\n };\n } else {\n // Don't early exit if we're showing the debug circles because we still want to calculate\n // which circles are in use\n collisionDetected = true;\n }\n }\n }\n }\n\n return {\n circles: collisionDetected ? [] : placedCollisionCircles,\n offscreen: entirelyOffscreen\n };\n }\n\n /**\n * Because the geometries in the CollisionIndex are an approximation of the shape of\n * symbols on the map, we use the CollisionIndex to look up the symbol part of\n * `queryRenderedFeatures`.\n *\n * @private\n */\n queryRenderedSymbols(viewportQueryGeometry: Array) {\n if (viewportQueryGeometry.length === 0 || (this.grid.keysLength() === 0 && this.ignoredGrid.keysLength() === 0)) {\n return {};\n }\n\n const query = [];\n let minX = Infinity;\n let minY = Infinity;\n let maxX = -Infinity;\n let maxY = -Infinity;\n for (const point of viewportQueryGeometry) {\n const gridPoint = new Point(point.x + viewportPadding, point.y + viewportPadding);\n minX = Math.min(minX, gridPoint.x);\n minY = Math.min(minY, gridPoint.y);\n maxX = Math.max(maxX, gridPoint.x);\n maxY = Math.max(maxY, gridPoint.y);\n query.push(gridPoint);\n }\n\n const features = this.grid.query(minX, minY, maxX, maxY)\n .concat(this.ignoredGrid.query(minX, minY, maxX, maxY));\n\n const seenFeatures = {};\n const result = {};\n\n for (const feature of features) {\n const featureKey = feature.key;\n // Skip already seen features.\n if (seenFeatures[featureKey.bucketInstanceId] === undefined) {\n seenFeatures[featureKey.bucketInstanceId] = {};\n }\n if (seenFeatures[featureKey.bucketInstanceId][featureKey.featureIndex]) {\n continue;\n }\n\n // Check if query intersects with the feature box\n // \"Collision Circles\" for line labels are treated as boxes here\n // Since there's no actual collision taking place, the circle vs. square\n // distinction doesn't matter as much, and box geometry is easier\n // to work with.\n const bbox = [\n new Point(feature.x1, feature.y1),\n new Point(feature.x2, feature.y1),\n new Point(feature.x2, feature.y2),\n new Point(feature.x1, feature.y2)\n ];\n if (!intersectionTests.polygonIntersectsPolygon(query, bbox)) {\n continue;\n }\n\n seenFeatures[featureKey.bucketInstanceId][featureKey.featureIndex] = true;\n if (result[featureKey.bucketInstanceId] === undefined) {\n result[featureKey.bucketInstanceId] = [];\n }\n result[featureKey.bucketInstanceId].push(featureKey.featureIndex);\n }\n\n return result;\n }\n\n insertCollisionBox(collisionBox: Array, ignorePlacement: boolean, bucketInstanceId: number, featureIndex: number) {\n const grid = ignorePlacement ? this.ignoredGrid : this.grid;\n\n const key = { bucketInstanceId: bucketInstanceId, featureIndex: featureIndex };\n grid.insert(key, collisionBox[0], collisionBox[1], collisionBox[2], collisionBox[3]);\n }\n\n insertCollisionCircles(collisionCircles: Array, ignorePlacement: boolean, bucketInstanceId: number, featureIndex: number) {\n const grid = ignorePlacement ? this.ignoredGrid : this.grid;\n\n const key = { bucketInstanceId: bucketInstanceId, featureIndex: featureIndex };\n for (let k = 0; k < collisionCircles.length; k += 4) {\n grid.insertCircle(key, collisionCircles[k], collisionCircles[k + 1], collisionCircles[k + 2]);\n }\n }\n\n projectAnchor(posMatrix: mat4, x: number, y: number) {\n const p = [x, y, 0, 1];\n projection.xyTransformMat4(p, p, posMatrix);\n return {\n perspectiveRatio: 0.5 + 0.5 * (this.transform.cameraToCenterDistance / p[3]),\n cameraDistance: p[3]\n };\n }\n\n projectPoint(posMatrix: mat4, x: number, y: number) {\n const p = [x, y, 0, 1];\n projection.xyTransformMat4(p, p, posMatrix);\n return new Point(\n (((p[0] / p[3] + 1) / 2) * this.transform.width) + viewportPadding,\n (((-p[1] / p[3] + 1) / 2) * this.transform.height) + viewportPadding\n );\n }\n\n projectAndGetPerspectiveRatio(posMatrix: mat4, x: number, y: number) {\n const p = [x, y, 0, 1];\n projection.xyTransformMat4(p, p, posMatrix);\n const a = new Point(\n (((p[0] / p[3] + 1) / 2) * this.transform.width) + viewportPadding,\n (((-p[1] / p[3] + 1) / 2) * this.transform.height) + viewportPadding\n );\n return {\n point: a,\n // See perspective ratio comment in symbol_sdf.vertex\n // We're doing collision detection in viewport space so we need\n // to scale down boxes in the distance\n perspectiveRatio: 0.5 + 0.5 * (this.transform.cameraToCenterDistance / p[3])\n };\n }\n\n isOffscreen(x1: number, y1: number, x2: number, y2: number) {\n return x2 < viewportPadding || x1 >= this.screenRightBoundary || y2 < viewportPadding || y1 > this.screenBottomBoundary;\n }\n}\n\nfunction markCollisionCircleUsed(collisionCircles: Array, index: number, used: boolean) {\n collisionCircles[index + 4] = used ? 1 : 0;\n}\n\nexport default CollisionIndex;\n","// @flow\n\nimport CollisionIndex from './collision_index';\n\nimport EXTENT from '../data/extent';\nimport * as symbolSize from './symbol_size';\nimport * as projection from './projection';\nimport properties from '../style/style_layer/symbol_style_layer_properties';\nconst symbolLayoutProperties = properties.layout;\nimport assert from 'assert';\nimport pixelsToTileUnits from '../source/pixels_to_tile_units';\n\nimport type Transform from '../geo/transform';\nimport type StyleLayer from '../style/style_layer';\nimport type Tile from '../source/tile';\nimport type SymbolBucket from '../data/bucket/symbol_bucket';\nimport type mat4 from '@mapbox/gl-matrix';\nimport type {CollisionBoxArray, CollisionVertexArray} from '../data/array_types';\nimport type FeatureIndex from '../data/feature_index';\nimport type {OverscaledTileID} from '../source/tile_id';\n\nclass OpacityState {\n opacity: number;\n placed: boolean;\n constructor(prevState: ?OpacityState, increment: number, placed: boolean, skipFade: ?boolean) {\n if (prevState) {\n this.opacity = Math.max(0, Math.min(1, prevState.opacity + (prevState.placed ? increment : -increment)));\n } else {\n this.opacity = (skipFade && placed) ? 1 : 0;\n }\n this.placed = placed;\n }\n isHidden() {\n return this.opacity === 0 && !this.placed;\n }\n}\n\nclass JointOpacityState {\n text: OpacityState;\n icon: OpacityState;\n constructor(prevState: ?JointOpacityState, increment: number, placedText: boolean, placedIcon: boolean, skipFade: ?boolean) {\n this.text = new OpacityState(prevState ? prevState.text : null, increment, placedText, skipFade);\n this.icon = new OpacityState(prevState ? prevState.icon : null, increment, placedIcon, skipFade);\n }\n isHidden() {\n return this.text.isHidden() && this.icon.isHidden();\n }\n}\n\nclass JointPlacement {\n text: boolean;\n icon: boolean;\n // skipFade = outside viewport, but within CollisionIndex::viewportPadding px of the edge\n // Because these symbols aren't onscreen yet, we can skip the \"fade in\" animation,\n // and if a subsequent viewport change brings them into view, they'll be fully\n // visible right away.\n skipFade: boolean;\n constructor(text: boolean, icon: boolean, skipFade: boolean) {\n this.text = text;\n this.icon = icon;\n this.skipFade = skipFade;\n }\n}\n\nexport class RetainedQueryData {\n bucketInstanceId: number;\n featureIndex: FeatureIndex;\n sourceLayerIndex: number;\n bucketIndex: number;\n tileID: OverscaledTileID;\n featureSortOrder: ?Array\n\n constructor(bucketInstanceId: number,\n featureIndex: FeatureIndex,\n sourceLayerIndex: number,\n bucketIndex: number,\n tileID: OverscaledTileID) {\n this.bucketInstanceId = bucketInstanceId;\n this.featureIndex = featureIndex;\n this.sourceLayerIndex = sourceLayerIndex;\n this.bucketIndex = bucketIndex;\n this.tileID = tileID;\n }\n}\n\nexport class Placement {\n transform: Transform;\n collisionIndex: CollisionIndex;\n placements: { [string | number]: JointPlacement };\n opacities: { [string | number]: JointOpacityState };\n commitTime: number;\n lastPlacementChangeTime: number;\n stale: boolean;\n fadeDuration: number;\n retainedQueryData: {[number]: RetainedQueryData};\n\n constructor(transform: Transform, fadeDuration: number) {\n this.transform = transform.clone();\n this.collisionIndex = new CollisionIndex(this.transform);\n this.placements = {};\n this.opacities = {};\n this.stale = false;\n this.fadeDuration = fadeDuration;\n this.retainedQueryData = {};\n }\n\n placeLayerTile(styleLayer: StyleLayer, tile: Tile, showCollisionBoxes: boolean, seenCrossTileIDs: { [string | number]: boolean }) {\n const symbolBucket = ((tile.getBucket(styleLayer): any): SymbolBucket);\n const bucketFeatureIndex = tile.latestFeatureIndex;\n if (!symbolBucket || !bucketFeatureIndex || styleLayer.id !== symbolBucket.layerIds[0])\n return;\n\n const collisionBoxArray = tile.collisionBoxArray;\n\n const layout = symbolBucket.layers[0].layout;\n\n const scale = Math.pow(2, this.transform.zoom - tile.tileID.overscaledZ);\n const textPixelRatio = tile.tileSize / EXTENT;\n\n const posMatrix = this.transform.calculatePosMatrix(tile.tileID.toUnwrapped());\n\n const textLabelPlaneMatrix = projection.getLabelPlaneMatrix(posMatrix,\n layout.get('text-pitch-alignment') === 'map',\n layout.get('text-rotation-alignment') === 'map',\n this.transform,\n pixelsToTileUnits(tile, 1, this.transform.zoom));\n\n const iconLabelPlaneMatrix = projection.getLabelPlaneMatrix(posMatrix,\n layout.get('icon-pitch-alignment') === 'map',\n layout.get('icon-rotation-alignment') === 'map',\n this.transform,\n pixelsToTileUnits(tile, 1, this.transform.zoom));\n\n // As long as this placement lives, we have to hold onto this bucket's\n // matching FeatureIndex/data for querying purposes\n this.retainedQueryData[symbolBucket.bucketInstanceId] = new RetainedQueryData(\n symbolBucket.bucketInstanceId,\n bucketFeatureIndex,\n symbolBucket.sourceLayerIndex,\n symbolBucket.index,\n tile.tileID\n );\n\n this.placeLayerBucket(symbolBucket, posMatrix, textLabelPlaneMatrix, iconLabelPlaneMatrix, scale, textPixelRatio,\n showCollisionBoxes, seenCrossTileIDs, collisionBoxArray);\n }\n\n placeLayerBucket(bucket: SymbolBucket, posMatrix: mat4, textLabelPlaneMatrix: mat4, iconLabelPlaneMatrix: mat4,\n scale: number, textPixelRatio: number, showCollisionBoxes: boolean, seenCrossTileIDs: { [string | number]: boolean },\n collisionBoxArray: ?CollisionBoxArray) {\n const layout = bucket.layers[0].layout;\n\n const partiallyEvaluatedTextSize = symbolSize.evaluateSizeForZoom(bucket.textSizeData, this.transform.zoom, symbolLayoutProperties.properties['text-size']);\n\n const iconWithoutText = !bucket.hasTextData() || layout.get('text-optional');\n const textWithoutIcon = !bucket.hasIconData() || layout.get('icon-optional');\n\n for (const symbolInstance of bucket.symbolInstances) {\n if (!seenCrossTileIDs[symbolInstance.crossTileID]) {\n\n let placeText = symbolInstance.feature.text !== undefined;\n let placeIcon = symbolInstance.feature.icon !== undefined;\n let offscreen = true;\n\n let placedGlyphBoxes = null;\n let placedGlyphCircles = null;\n let placedIconBoxes = null;\n\n let textFeatureIndex = 0;\n let iconFeatureIndex = 0;\n\n if (!symbolInstance.collisionArrays) {\n symbolInstance.collisionArrays = bucket.deserializeCollisionBoxes(\n ((collisionBoxArray: any): CollisionBoxArray),\n symbolInstance.textBoxStartIndex, symbolInstance.textBoxEndIndex, symbolInstance.iconBoxStartIndex, symbolInstance.iconBoxEndIndex);\n }\n\n if (symbolInstance.collisionArrays.textFeatureIndex) {\n textFeatureIndex = symbolInstance.collisionArrays.textFeatureIndex;\n }\n if (symbolInstance.collisionArrays.textBox) {\n placedGlyphBoxes = this.collisionIndex.placeCollisionBox(symbolInstance.collisionArrays.textBox,\n layout.get('text-allow-overlap'), textPixelRatio, posMatrix);\n placeText = placedGlyphBoxes.box.length > 0;\n offscreen = offscreen && placedGlyphBoxes.offscreen;\n }\n const textCircles = symbolInstance.collisionArrays.textCircles;\n if (textCircles) {\n const placedSymbol = bucket.text.placedSymbolArray.get(symbolInstance.placedTextSymbolIndices[0]);\n const fontSize = symbolSize.evaluateSizeForFeature(bucket.textSizeData, partiallyEvaluatedTextSize, placedSymbol);\n placedGlyphCircles = this.collisionIndex.placeCollisionCircles(textCircles,\n layout.get('text-allow-overlap'),\n scale,\n textPixelRatio,\n symbolInstance.key,\n placedSymbol,\n bucket.lineVertexArray,\n bucket.glyphOffsetArray,\n fontSize,\n posMatrix,\n textLabelPlaneMatrix,\n showCollisionBoxes,\n layout.get('text-pitch-alignment') === 'map');\n // If text-allow-overlap is set, force \"placedCircles\" to true\n // In theory there should always be at least one circle placed\n // in this case, but for now quirks in text-anchor\n // and text-offset may prevent that from being true.\n placeText = layout.get('text-allow-overlap') || placedGlyphCircles.circles.length > 0;\n offscreen = offscreen && placedGlyphCircles.offscreen;\n }\n\n if (symbolInstance.collisionArrays.iconFeatureIndex) {\n iconFeatureIndex = symbolInstance.collisionArrays.iconFeatureIndex;\n }\n if (symbolInstance.collisionArrays.iconBox) {\n placedIconBoxes = this.collisionIndex.placeCollisionBox(symbolInstance.collisionArrays.iconBox,\n layout.get('icon-allow-overlap'), textPixelRatio, posMatrix);\n placeIcon = placedIconBoxes.box.length > 0;\n offscreen = offscreen && placedIconBoxes.offscreen;\n }\n\n // Combine the scales for icons and text.\n if (!iconWithoutText && !textWithoutIcon) {\n placeIcon = placeText = placeIcon && placeText;\n } else if (!textWithoutIcon) {\n placeText = placeIcon && placeText;\n } else if (!iconWithoutText) {\n placeIcon = placeIcon && placeText;\n }\n\n if (placeText && placedGlyphBoxes) {\n this.collisionIndex.insertCollisionBox(placedGlyphBoxes.box, layout.get('text-ignore-placement'),\n bucket.bucketInstanceId, textFeatureIndex);\n }\n if (placeIcon && placedIconBoxes) {\n this.collisionIndex.insertCollisionBox(placedIconBoxes.box, layout.get('icon-ignore-placement'),\n bucket.bucketInstanceId, iconFeatureIndex);\n }\n if (placeText && placedGlyphCircles) {\n this.collisionIndex.insertCollisionCircles(placedGlyphCircles.circles, layout.get('text-ignore-placement'),\n bucket.bucketInstanceId, textFeatureIndex);\n }\n\n assert(symbolInstance.crossTileID !== 0);\n assert(bucket.bucketInstanceId !== 0);\n\n this.placements[symbolInstance.crossTileID] = new JointPlacement(placeText, placeIcon, offscreen || bucket.justReloaded);\n seenCrossTileIDs[symbolInstance.crossTileID] = true;\n }\n }\n\n bucket.justReloaded = false;\n }\n\n commit(prevPlacement: ?Placement, now: number): void {\n this.commitTime = now;\n\n let placementChanged = false;\n\n const increment = (prevPlacement && this.fadeDuration !== 0) ?\n (this.commitTime - prevPlacement.commitTime) / this.fadeDuration :\n 1;\n\n const prevOpacities = prevPlacement ? prevPlacement.opacities : {};\n\n // add the opacities from the current placement, and copy their current values from the previous placement\n for (const crossTileID in this.placements) {\n const jointPlacement = this.placements[crossTileID];\n const prevOpacity = prevOpacities[crossTileID];\n if (prevOpacity) {\n this.opacities[crossTileID] = new JointOpacityState(prevOpacity, increment, jointPlacement.text, jointPlacement.icon);\n placementChanged = placementChanged ||\n jointPlacement.text !== prevOpacity.text.placed ||\n jointPlacement.icon !== prevOpacity.icon.placed;\n } else {\n this.opacities[crossTileID] = new JointOpacityState(null, increment, jointPlacement.text, jointPlacement.icon, jointPlacement.skipFade);\n placementChanged = placementChanged || jointPlacement.text || jointPlacement.icon;\n }\n }\n\n // copy and update values from the previous placement that aren't in the current placement but haven't finished fading\n for (const crossTileID in prevOpacities) {\n const prevOpacity = prevOpacities[crossTileID];\n if (!this.opacities[crossTileID]) {\n const jointOpacity = new JointOpacityState(prevOpacity, increment, false, false);\n if (!jointOpacity.isHidden()) {\n this.opacities[crossTileID] = jointOpacity;\n placementChanged = placementChanged || prevOpacity.text.placed || prevOpacity.icon.placed;\n }\n }\n }\n\n // this.lastPlacementChangeTime is the time of the last commit() that\n // resulted in a placement change -- in other words, the start time of\n // the last symbol fade animation\n assert(!prevPlacement || prevPlacement.lastPlacementChangeTime !== undefined);\n if (placementChanged) {\n this.lastPlacementChangeTime = now;\n } else if (typeof this.lastPlacementChangeTime !== 'number') {\n this.lastPlacementChangeTime = prevPlacement ? prevPlacement.lastPlacementChangeTime : now;\n }\n }\n\n updateLayerOpacities(styleLayer: StyleLayer, tiles: Array) {\n const seenCrossTileIDs = {};\n\n for (const tile of tiles) {\n const symbolBucket = ((tile.getBucket(styleLayer): any): SymbolBucket);\n if (symbolBucket && tile.latestFeatureIndex && styleLayer.id === symbolBucket.layerIds[0]) {\n this.updateBucketOpacities(symbolBucket, seenCrossTileIDs, tile.collisionBoxArray);\n }\n }\n }\n\n updateBucketOpacities(bucket: SymbolBucket, seenCrossTileIDs: { [string | number]: boolean }, collisionBoxArray: ?CollisionBoxArray) {\n if (bucket.hasTextData()) bucket.text.opacityVertexArray.clear();\n if (bucket.hasIconData()) bucket.icon.opacityVertexArray.clear();\n if (bucket.hasCollisionBoxData()) bucket.collisionBox.collisionVertexArray.clear();\n if (bucket.hasCollisionCircleData()) bucket.collisionCircle.collisionVertexArray.clear();\n\n const layout = bucket.layers[0].layout;\n const duplicateOpacityState = new JointOpacityState(null, 0, false, false, true);\n const defaultOpacityState = new JointOpacityState(null, 0,\n layout.get('text-allow-overlap'),\n layout.get('icon-allow-overlap'), true);\n\n for (let s = 0; s < bucket.symbolInstances.length; s++) {\n const symbolInstance = bucket.symbolInstances[s];\n const isDuplicate = seenCrossTileIDs[symbolInstance.crossTileID];\n\n let opacityState = this.opacities[symbolInstance.crossTileID];\n if (isDuplicate) {\n opacityState = duplicateOpacityState;\n } else if (!opacityState) {\n opacityState = defaultOpacityState;\n // store the state so that future placements use it as a starting point\n this.opacities[symbolInstance.crossTileID] = opacityState;\n }\n\n seenCrossTileIDs[symbolInstance.crossTileID] = true;\n\n const hasText = symbolInstance.numGlyphVertices > 0 || symbolInstance.numVerticalGlyphVertices > 0;\n const hasIcon = symbolInstance.numIconVertices > 0;\n\n if (hasText) {\n const packedOpacity = packOpacity(opacityState.text);\n // Vertical text fades in/out on collision the same way as corresponding\n // horizontal text. Switch between vertical/horizontal should be instantaneous\n const opacityEntryCount = (symbolInstance.numGlyphVertices + symbolInstance.numVerticalGlyphVertices) / 4;\n for (let i = 0; i < opacityEntryCount; i++) {\n bucket.text.opacityVertexArray.emplaceBack(packedOpacity);\n }\n for (const placedTextSymbolIndex of symbolInstance.placedTextSymbolIndices) {\n const placedSymbol = bucket.text.placedSymbolArray.get(placedTextSymbolIndex);\n // If this label is completely faded, mark it so that we don't have to calculate\n // its position at render time\n placedSymbol.hidden = (opacityState.text.isHidden(): any);\n }\n }\n\n if (hasIcon) {\n const packedOpacity = packOpacity(opacityState.icon);\n for (let i = 0; i < symbolInstance.numIconVertices / 4; i++) {\n bucket.icon.opacityVertexArray.emplaceBack(packedOpacity);\n }\n const placedSymbol = bucket.icon.placedSymbolArray.get(s);\n placedSymbol.hidden = (opacityState.icon.isHidden(): any);\n }\n\n if (!symbolInstance.collisionArrays) {\n symbolInstance.collisionArrays = bucket.deserializeCollisionBoxes(\n ((collisionBoxArray: any): CollisionBoxArray),\n symbolInstance.textBoxStartIndex, symbolInstance.textBoxEndIndex, symbolInstance.iconBoxStartIndex, symbolInstance.iconBoxEndIndex);\n }\n\n const collisionArrays = symbolInstance.collisionArrays;\n if (collisionArrays) {\n if (collisionArrays.textBox && bucket.hasCollisionBoxData()) {\n updateCollisionVertices(bucket.collisionBox.collisionVertexArray, opacityState.text.placed, false);\n }\n\n if (collisionArrays.iconBox && bucket.hasCollisionBoxData()) {\n updateCollisionVertices(bucket.collisionBox.collisionVertexArray, opacityState.icon.placed, false);\n }\n\n const textCircles = collisionArrays.textCircles;\n if (textCircles && bucket.hasCollisionCircleData()) {\n for (let k = 0; k < textCircles.length; k += 5) {\n const notUsed = isDuplicate || textCircles[k + 4] === 0;\n updateCollisionVertices(bucket.collisionCircle.collisionVertexArray, opacityState.text.placed, notUsed);\n }\n }\n }\n }\n\n bucket.sortFeatures(this.transform.angle);\n if (this.retainedQueryData[bucket.bucketInstanceId]) {\n this.retainedQueryData[bucket.bucketInstanceId].featureSortOrder = bucket.featureSortOrder;\n }\n\n if (bucket.hasTextData() && bucket.text.opacityVertexBuffer) {\n bucket.text.opacityVertexBuffer.updateData(bucket.text.opacityVertexArray);\n }\n if (bucket.hasIconData() && bucket.icon.opacityVertexBuffer) {\n bucket.icon.opacityVertexBuffer.updateData(bucket.icon.opacityVertexArray);\n }\n if (bucket.hasCollisionBoxData() && bucket.collisionBox.collisionVertexBuffer) {\n bucket.collisionBox.collisionVertexBuffer.updateData(bucket.collisionBox.collisionVertexArray);\n }\n if (bucket.hasCollisionCircleData() && bucket.collisionCircle.collisionVertexBuffer) {\n bucket.collisionCircle.collisionVertexBuffer.updateData(bucket.collisionCircle.collisionVertexArray);\n }\n\n assert(bucket.text.opacityVertexArray.length === bucket.text.layoutVertexArray.length / 4);\n assert(bucket.icon.opacityVertexArray.length === bucket.icon.layoutVertexArray.length / 4);\n }\n\n symbolFadeChange(now: number) {\n return this.fadeDuration === 0 ?\n 1 :\n (now - this.commitTime) / this.fadeDuration;\n }\n\n hasTransitions(now: number) {\n return this.stale ||\n now - this.lastPlacementChangeTime < this.fadeDuration;\n }\n\n stillRecent(now: number) {\n return this.commitTime !== 'undefined' &&\n this.commitTime + this.fadeDuration > now;\n }\n\n setStale() {\n this.stale = true;\n }\n}\n\nfunction updateCollisionVertices(collisionVertexArray: CollisionVertexArray, placed: boolean, notUsed: boolean) {\n collisionVertexArray.emplaceBack(placed ? 1 : 0, notUsed ? 1 : 0);\n collisionVertexArray.emplaceBack(placed ? 1 : 0, notUsed ? 1 : 0);\n collisionVertexArray.emplaceBack(placed ? 1 : 0, notUsed ? 1 : 0);\n collisionVertexArray.emplaceBack(placed ? 1 : 0, notUsed ? 1 : 0);\n}\n\n// All four vertices for a glyph will have the same opacity state\n// So we pack the opacity into a uint8, and then repeat it four times\n// to make a single uint32 that we can upload for each glyph in the\n// label.\nconst shift25 = Math.pow(2, 25);\nconst shift24 = Math.pow(2, 24);\nconst shift17 = Math.pow(2, 17);\nconst shift16 = Math.pow(2, 16);\nconst shift9 = Math.pow(2, 9);\nconst shift8 = Math.pow(2, 8);\nconst shift1 = Math.pow(2, 1);\nfunction packOpacity(opacityState: OpacityState): number {\n if (opacityState.opacity === 0 && !opacityState.placed) {\n return 0;\n } else if (opacityState.opacity === 1 && opacityState.placed) {\n return 4294967295;\n }\n const targetBit = opacityState.placed ? 1 : 0;\n const opacityBits = Math.floor(opacityState.opacity * 127);\n return opacityBits * shift25 + targetBit * shift24 +\n opacityBits * shift17 + targetBit * shift16 +\n opacityBits * shift9 + targetBit * shift8 +\n opacityBits * shift1 + targetBit;\n}\n","// @flow\n\nimport browser from '../util/browser';\n\nimport { Placement } from '../symbol/placement';\n\nimport type Transform from '../geo/transform';\nimport type StyleLayer from './style_layer';\nimport type Tile from '../source/tile';\n\nclass LayerPlacement {\n _currentTileIndex: number;\n _tiles: Array;\n _seenCrossTileIDs: { [string | number]: boolean };\n\n constructor() {\n this._currentTileIndex = 0;\n this._seenCrossTileIDs = {};\n }\n\n continuePlacement(tiles: Array, placement: Placement, showCollisionBoxes: boolean, styleLayer: StyleLayer, shouldPausePlacement) {\n while (this._currentTileIndex < tiles.length) {\n const tile = tiles[this._currentTileIndex];\n placement.placeLayerTile(styleLayer, tile, showCollisionBoxes, this._seenCrossTileIDs);\n\n this._currentTileIndex++;\n if (shouldPausePlacement()) {\n return true;\n }\n }\n }\n}\n\nclass PauseablePlacement {\n placement: Placement;\n _done: boolean;\n _currentPlacementIndex: number;\n _forceFullPlacement: boolean;\n _showCollisionBoxes: boolean;\n _inProgressLayer: ?LayerPlacement;\n\n constructor(transform: Transform, order: Array,\n forceFullPlacement: boolean, showCollisionBoxes: boolean, fadeDuration: number) {\n\n this.placement = new Placement(transform, fadeDuration);\n this._currentPlacementIndex = order.length - 1;\n this._forceFullPlacement = forceFullPlacement;\n this._showCollisionBoxes = showCollisionBoxes;\n this._done = false;\n }\n\n isDone(): boolean {\n return this._done;\n }\n\n continuePlacement(order: Array, layers: {[string]: StyleLayer}, layerTiles: {[string]: Array}) {\n const startTime = browser.now();\n\n const shouldPausePlacement = () => {\n const elapsedTime = browser.now() - startTime;\n return this._forceFullPlacement ? false : elapsedTime > 2;\n };\n\n while (this._currentPlacementIndex >= 0) {\n const layerId = order[this._currentPlacementIndex];\n const layer = layers[layerId];\n const placementZoom = this.placement.collisionIndex.transform.zoom;\n if (layer.type === 'symbol' &&\n (!layer.minzoom || layer.minzoom <= placementZoom) &&\n (!layer.maxzoom || layer.maxzoom > placementZoom)) {\n\n if (!this._inProgressLayer) {\n this._inProgressLayer = new LayerPlacement();\n }\n\n const pausePlacement = this._inProgressLayer.continuePlacement(layerTiles[layer.source], this.placement, this._showCollisionBoxes, layer, shouldPausePlacement);\n\n if (pausePlacement) {\n // We didn't finish placing all layers within 2ms,\n // but we can keep rendering with a partial placement\n // We'll resume here on the next frame\n return;\n }\n\n delete this._inProgressLayer;\n }\n\n this._currentPlacementIndex--;\n }\n\n this._done = true;\n }\n\n commit(previousPlacement: ?Placement, now: number) {\n this.placement.commit(previousPlacement, now);\n return this.placement;\n }\n}\n\nexport default PauseablePlacement;\n","// @flow\n\nimport EXTENT from '../data/extent';\n\nimport type {OverscaledTileID} from '../source/tile_id';\nimport type SymbolBucket, {SymbolInstance} from '../data/bucket/symbol_bucket';\nimport type StyleLayer from '../style/style_layer';\nimport type Tile from '../source/tile';\n\n/*\n The CrossTileSymbolIndex generally works on the assumption that\n a conceptual \"unique symbol\" can be identified by the text of\n the label combined with the anchor point. The goal is to assign\n these conceptual \"unique symbols\" a shared crossTileID that can be\n used by Placement to keep fading opacity states consistent and to\n deduplicate labels.\n\n The CrossTileSymbolIndex indexes all the current symbol instances and\n their crossTileIDs. When a symbol bucket gets added or updated, the\n index assigns a crossTileID to each of it's symbol instances by either\n matching it with an existing id or assigning a new one.\n*/\n\n// Round anchor positions to roughly 4 pixel grid\nconst roundingFactor = 512 / EXTENT / 2;\n\nclass TileLayerIndex {\n tileID: OverscaledTileID;\n indexedSymbolInstances: {[string]: Array<{\n crossTileID: number,\n coord: {\n x: number,\n y: number\n }\n }>};\n bucketInstanceId: number;\n\n constructor(tileID: OverscaledTileID, symbolInstances: Array, bucketInstanceId: number) {\n this.tileID = tileID;\n this.indexedSymbolInstances = {};\n this.bucketInstanceId = bucketInstanceId;\n\n for (const symbolInstance of symbolInstances) {\n const key = symbolInstance.key;\n if (!this.indexedSymbolInstances[key]) {\n this.indexedSymbolInstances[key] = [];\n }\n // This tile may have multiple symbol instances with the same key\n // Store each one along with its coordinates\n this.indexedSymbolInstances[key].push({\n crossTileID: symbolInstance.crossTileID,\n coord: this.getScaledCoordinates(symbolInstance, tileID)\n });\n }\n }\n\n // Converts the coordinates of the input symbol instance into coordinates that be can compared\n // against other symbols in this index. Coordinates are:\n // (1) world-based (so after conversion the source tile is irrelevant)\n // (2) converted to the z-scale of this TileLayerIndex\n // (3) down-sampled by \"roundingFactor\" from tile coordinate precision in order to be\n // more tolerant of small differences between tiles.\n getScaledCoordinates(symbolInstance: SymbolInstance, childTileID: OverscaledTileID) {\n const zDifference = childTileID.canonical.z - this.tileID.canonical.z;\n const scale = roundingFactor / Math.pow(2, zDifference);\n const anchor = symbolInstance.anchor;\n return {\n x: Math.floor((childTileID.canonical.x * EXTENT + anchor.x) * scale),\n y: Math.floor((childTileID.canonical.y * EXTENT + anchor.y) * scale)\n };\n }\n\n findMatches(symbolInstances: Array, newTileID: OverscaledTileID, zoomCrossTileIDs: {[crossTileID: number]: boolean}) {\n const tolerance = this.tileID.canonical.z < newTileID.canonical.z ? 1 : Math.pow(2, this.tileID.canonical.z - newTileID.canonical.z);\n\n for (const symbolInstance of symbolInstances) {\n if (symbolInstance.crossTileID) {\n // already has a match, skip\n continue;\n }\n\n const indexedInstances = this.indexedSymbolInstances[symbolInstance.key];\n if (!indexedInstances) {\n // No symbol with this key in this bucket\n continue;\n }\n\n const scaledSymbolCoord = this.getScaledCoordinates(symbolInstance, newTileID);\n\n for (const thisTileSymbol of indexedInstances) {\n // Return any symbol with the same keys whose coordinates are within 1\n // grid unit. (with a 4px grid, this covers a 12px by 12px area)\n if (Math.abs(thisTileSymbol.coord.x - scaledSymbolCoord.x) <= tolerance &&\n Math.abs(thisTileSymbol.coord.y - scaledSymbolCoord.y) <= tolerance &&\n !zoomCrossTileIDs[thisTileSymbol.crossTileID]) {\n // Once we've marked ourselves duplicate against this parent symbol,\n // don't let any other symbols at the same zoom level duplicate against\n // the same parent (see issue #5993)\n zoomCrossTileIDs[thisTileSymbol.crossTileID] = true;\n symbolInstance.crossTileID = thisTileSymbol.crossTileID;\n break;\n }\n }\n }\n }\n}\n\nclass CrossTileIDs {\n maxCrossTileID: number;\n constructor() {\n this.maxCrossTileID = 0;\n }\n generate() {\n return ++this.maxCrossTileID;\n }\n}\n\nclass CrossTileSymbolLayerIndex {\n indexes: {[zoom: string | number]: {[tileId: string | number]: TileLayerIndex}};\n usedCrossTileIDs: {[zoom: string | number]: {[crossTileID: number]: boolean}};\n lng: number;\n\n constructor() {\n this.indexes = {};\n this.usedCrossTileIDs = {};\n this.lng = 0;\n }\n\n /*\n * Sometimes when a user pans across the antimeridian the longitude value gets wrapped.\n * To prevent labels from flashing out and in we adjust the tileID values in the indexes\n * so that they match the new wrapped version of the map.\n */\n handleWrapJump(lng: number) {\n const wrapDelta = Math.round((lng - this.lng) / 360);\n if (wrapDelta !== 0) {\n for (const zoom in this.indexes) {\n const zoomIndexes = this.indexes[zoom];\n const newZoomIndex = {};\n for (const key in zoomIndexes) {\n // change the tileID's wrap and add it to a new index\n const index = zoomIndexes[key];\n index.tileID = index.tileID.unwrapTo(index.tileID.wrap + wrapDelta);\n newZoomIndex[index.tileID.key] = index;\n }\n this.indexes[zoom] = newZoomIndex;\n }\n }\n this.lng = lng;\n }\n\n addBucket(tileID: OverscaledTileID, bucket: SymbolBucket, crossTileIDs: CrossTileIDs) {\n if (this.indexes[tileID.overscaledZ] &&\n this.indexes[tileID.overscaledZ][tileID.key]) {\n if (this.indexes[tileID.overscaledZ][tileID.key].bucketInstanceId ===\n bucket.bucketInstanceId) {\n return false;\n } else {\n // We're replacing this bucket with an updated version\n // Remove the old bucket's \"used crossTileIDs\" now so that\n // the new bucket can claim them.\n // The old index entries themselves stick around until\n // 'removeStaleBuckets' is called.\n this.removeBucketCrossTileIDs(tileID.overscaledZ,\n this.indexes[tileID.overscaledZ][tileID.key]);\n }\n }\n\n for (const symbolInstance of bucket.symbolInstances) {\n symbolInstance.crossTileID = 0;\n }\n\n if (!this.usedCrossTileIDs[tileID.overscaledZ]) {\n this.usedCrossTileIDs[tileID.overscaledZ] = {};\n }\n const zoomCrossTileIDs = this.usedCrossTileIDs[tileID.overscaledZ];\n\n for (const zoom in this.indexes) {\n const zoomIndexes = this.indexes[zoom];\n if (Number(zoom) > tileID.overscaledZ) {\n for (const id in zoomIndexes) {\n const childIndex = zoomIndexes[id];\n if (childIndex.tileID.isChildOf(tileID)) {\n childIndex.findMatches(bucket.symbolInstances, tileID, zoomCrossTileIDs);\n }\n }\n } else {\n const parentCoord = tileID.scaledTo(Number(zoom));\n const parentIndex = zoomIndexes[parentCoord.key];\n if (parentIndex) {\n parentIndex.findMatches(bucket.symbolInstances, tileID, zoomCrossTileIDs);\n }\n }\n }\n\n for (const symbolInstance of bucket.symbolInstances) {\n if (!symbolInstance.crossTileID) {\n // symbol did not match any known symbol, assign a new id\n symbolInstance.crossTileID = crossTileIDs.generate();\n zoomCrossTileIDs[symbolInstance.crossTileID] = true;\n }\n }\n\n if (this.indexes[tileID.overscaledZ] === undefined) {\n this.indexes[tileID.overscaledZ] = {};\n }\n this.indexes[tileID.overscaledZ][tileID.key] = new TileLayerIndex(tileID, bucket.symbolInstances, bucket.bucketInstanceId);\n\n return true;\n }\n\n removeBucketCrossTileIDs(zoom: string | number, removedBucket: TileLayerIndex) {\n for (const key in removedBucket.indexedSymbolInstances) {\n for (const symbolInstance of removedBucket.indexedSymbolInstances[key]) {\n delete this.usedCrossTileIDs[zoom][symbolInstance.crossTileID];\n }\n }\n }\n\n removeStaleBuckets(currentIDs: { [string | number]: boolean }) {\n let tilesChanged = false;\n for (const z in this.indexes) {\n const zoomIndexes = this.indexes[z];\n for (const tileKey in zoomIndexes) {\n if (!currentIDs[zoomIndexes[tileKey].bucketInstanceId]) {\n this.removeBucketCrossTileIDs(z, zoomIndexes[tileKey]);\n delete zoomIndexes[tileKey];\n tilesChanged = true;\n }\n }\n }\n return tilesChanged;\n }\n}\n\nclass CrossTileSymbolIndex {\n layerIndexes: {[layerId: string]: CrossTileSymbolLayerIndex};\n crossTileIDs: CrossTileIDs;\n maxBucketInstanceId: number;\n bucketsInCurrentPlacement: {[number]: boolean};\n\n constructor() {\n this.layerIndexes = {};\n this.crossTileIDs = new CrossTileIDs();\n this.maxBucketInstanceId = 0;\n this.bucketsInCurrentPlacement = {};\n }\n\n addLayer(styleLayer: StyleLayer, tiles: Array, lng: number) {\n let layerIndex = this.layerIndexes[styleLayer.id];\n if (layerIndex === undefined) {\n layerIndex = this.layerIndexes[styleLayer.id] = new CrossTileSymbolLayerIndex();\n }\n\n let symbolBucketsChanged = false;\n const currentBucketIDs = {};\n\n layerIndex.handleWrapJump(lng);\n\n for (const tile of tiles) {\n const symbolBucket = ((tile.getBucket(styleLayer): any): SymbolBucket);\n if (!symbolBucket || styleLayer.id !== symbolBucket.layerIds[0])\n continue;\n\n if (!symbolBucket.bucketInstanceId) {\n symbolBucket.bucketInstanceId = ++this.maxBucketInstanceId;\n }\n\n if (layerIndex.addBucket(tile.tileID, symbolBucket, this.crossTileIDs)) {\n symbolBucketsChanged = true;\n }\n currentBucketIDs[symbolBucket.bucketInstanceId] = true;\n }\n\n if (layerIndex.removeStaleBuckets(currentBucketIDs)) {\n symbolBucketsChanged = true;\n }\n\n return symbolBucketsChanged;\n }\n\n pruneUnusedLayers(usedLayers: Array) {\n const usedLayerMap = {};\n usedLayers.forEach((usedLayer) => {\n usedLayerMap[usedLayer] = true;\n });\n for (const layerId in this.layerIndexes) {\n if (!usedLayerMap[layerId]) {\n delete this.layerIndexes[layerId];\n }\n }\n }\n}\n\nexport default CrossTileSymbolIndex;\n","// @flow\n\nimport assert from 'assert';\n\nimport { Event, ErrorEvent, Evented } from '../util/evented';\nimport StyleLayer from './style_layer';\nimport createStyleLayer from './create_style_layer';\nimport loadSprite from './load_sprite';\nimport ImageManager from '../render/image_manager';\nimport GlyphManager from '../render/glyph_manager';\nimport Light from './light';\nimport LineAtlas from '../render/line_atlas';\nimport { pick, clone, extend, deepEqual, filterObject, mapObject } from '../util/util';\nimport { getJSON, ResourceType } from '../util/ajax';\nimport { isMapboxURL, normalizeStyleURL } from '../util/mapbox';\nimport browser from '../util/browser';\nimport Dispatcher from '../util/dispatcher';\nimport { validateStyle, emitValidationErrors as _emitValidationErrors } from './validate_style';\nimport {\n getType as getSourceType,\n setType as setSourceType\n} from '../source/source';\nimport { queryRenderedFeatures, queryRenderedSymbols, querySourceFeatures } from '../source/query_features';\nimport SourceCache from '../source/source_cache';\nimport GeoJSONSource from '../source/geojson_source';\nimport styleSpec from '../style-spec/reference/latest';\nimport getWorkerPool from '../util/global_worker_pool';\nimport deref from '../style-spec/deref';\nimport diffStyles, {operations as diffOperations} from '../style-spec/diff';\nimport {\n registerForPluginAvailability,\n evented as rtlTextPluginEvented\n} from '../source/rtl_text_plugin';\nimport PauseablePlacement from './pauseable_placement';\nimport ZoomHistory from './zoom_history';\nimport CrossTileSymbolIndex from '../symbol/cross_tile_symbol_index';\n\n// We're skipping validation errors with the `source.canvas` identifier in order\n// to continue to allow canvas sources to be added at runtime/updated in\n// smart setStyle (see https://github.com/mapbox/mapbox-gl-js/pull/6424):\nconst emitValidationErrors = (evented: Evented, errors: ?$ReadOnlyArray<{message: string, identifier?: string}>) =>\n _emitValidationErrors(evented, errors && errors.filter(error => error.identifier !== 'source.canvas'));\n\nimport type Map from '../ui/map';\nimport type Transform from '../geo/transform';\nimport type {Source} from '../source/source';\nimport type {StyleImage} from './style_image';\nimport type {StyleGlyph} from './style_glyph';\nimport type {Callback} from '../types/callback';\nimport type EvaluationParameters from './evaluation_parameters';\nimport type { Placement } from '../symbol/placement';\n\nconst supportedDiffOperations = pick(diffOperations, [\n 'addLayer',\n 'removeLayer',\n 'setPaintProperty',\n 'setLayoutProperty',\n 'setFilter',\n 'addSource',\n 'removeSource',\n 'setLayerZoomRange',\n 'setLight',\n 'setTransition',\n 'setGeoJSONSourceData'\n // 'setGlyphs',\n // 'setSprite',\n]);\n\nconst ignoredDiffOperations = pick(diffOperations, [\n 'setCenter',\n 'setZoom',\n 'setBearing',\n 'setPitch'\n]);\n\nexport type StyleOptions = {\n validate?: boolean,\n localIdeographFontFamily?: string\n};\n\n/**\n * @private\n */\nclass Style extends Evented {\n map: Map;\n stylesheet: StyleSpecification;\n dispatcher: Dispatcher;\n imageManager: ImageManager;\n glyphManager: GlyphManager;\n lineAtlas: LineAtlas;\n light: Light;\n\n _layers: {[string]: StyleLayer};\n _order: Array;\n sourceCaches: {[string]: SourceCache};\n zoomHistory: ZoomHistory;\n _loaded: boolean;\n _rtlTextPluginCallback: Function;\n _changed: boolean;\n _updatedSources: {[string]: 'clear' | 'reload'};\n _updatedLayers: {[string]: true};\n _removedLayers: {[string]: StyleLayer};\n _updatedPaintProps: {[layer: string]: true};\n _layerOrderChanged: boolean;\n\n crossTileSymbolIndex: CrossTileSymbolIndex;\n pauseablePlacement: PauseablePlacement;\n placement: Placement;\n z: number;\n\n // exposed to allow stubbing by unit tests\n static getSourceType: typeof getSourceType;\n static setSourceType: typeof setSourceType;\n static registerForPluginAvailability: typeof registerForPluginAvailability;\n\n constructor(map: Map, options: StyleOptions = {}) {\n super();\n\n this.map = map;\n this.dispatcher = new Dispatcher(getWorkerPool(), this);\n this.imageManager = new ImageManager();\n this.glyphManager = new GlyphManager(map._transformRequest, options.localIdeographFontFamily);\n this.lineAtlas = new LineAtlas(256, 512);\n this.crossTileSymbolIndex = new CrossTileSymbolIndex();\n\n this._layers = {};\n this._order = [];\n this.sourceCaches = {};\n this.zoomHistory = new ZoomHistory();\n this._loaded = false;\n\n this._resetUpdates();\n\n const self = this;\n this._rtlTextPluginCallback = Style.registerForPluginAvailability((args) => {\n self.dispatcher.broadcast('loadRTLTextPlugin', args.pluginURL, args.completionCallback);\n for (const id in self.sourceCaches) {\n self.sourceCaches[id].reload(); // Should be a no-op if the plugin loads before any tiles load\n }\n });\n\n this.on('data', (event) => {\n if (event.dataType !== 'source' || event.sourceDataType !== 'metadata') {\n return;\n }\n\n const sourceCache = this.sourceCaches[event.sourceId];\n if (!sourceCache) {\n return;\n }\n\n const source = sourceCache.getSource();\n if (!source || !source.vectorLayerIds) {\n return;\n }\n\n for (const layerId in this._layers) {\n const layer = this._layers[layerId];\n if (layer.source === source.id) {\n this._validateLayer(layer);\n }\n }\n });\n }\n\n loadURL(url: string, options: {\n validate?: boolean,\n accessToken?: string\n } = {}) {\n this.fire(new Event('dataloading', {dataType: 'style'}));\n\n const validate = typeof options.validate === 'boolean' ?\n options.validate : !isMapboxURL(url);\n\n url = normalizeStyleURL(url, options.accessToken);\n const request = this.map._transformRequest(url, ResourceType.Style);\n\n getJSON(request, (error, json) => {\n if (error) {\n this.fire(new ErrorEvent(error));\n } else if (json) {\n this._load((json: any), validate);\n }\n });\n }\n\n loadJSON(json: StyleSpecification, options: {\n validate?: boolean\n } = {}) {\n this.fire(new Event('dataloading', {dataType: 'style'}));\n\n browser.frame(() => {\n this._load(json, options.validate !== false);\n });\n }\n\n _load(json: StyleSpecification, validate: boolean) {\n if (validate && emitValidationErrors(this, validateStyle(json))) {\n return;\n }\n\n this._loaded = true;\n this.stylesheet = json;\n\n for (const id in json.sources) {\n this.addSource(id, json.sources[id], {validate: false});\n }\n\n if (json.sprite) {\n loadSprite(json.sprite, this.map._transformRequest, (err, images) => {\n if (err) {\n this.fire(new ErrorEvent(err));\n } else if (images) {\n for (const id in images) {\n this.imageManager.addImage(id, images[id]);\n }\n }\n\n this.imageManager.setLoaded(true);\n this.fire(new Event('data', {dataType: 'style'}));\n });\n } else {\n this.imageManager.setLoaded(true);\n }\n\n this.glyphManager.setURL(json.glyphs);\n\n const layers = deref(this.stylesheet.layers);\n\n this._order = layers.map((layer) => layer.id);\n\n this._layers = {};\n for (let layer of layers) {\n layer = createStyleLayer(layer);\n layer.setEventedParent(this, {layer: {id: layer.id}});\n this._layers[layer.id] = layer;\n }\n\n this.dispatcher.broadcast('setLayers', this._serializeLayers(this._order));\n\n this.light = new Light(this.stylesheet.light);\n\n this.fire(new Event('data', {dataType: 'style'}));\n this.fire(new Event('style.load'));\n }\n\n _validateLayer(layer: StyleLayer) {\n const sourceCache = this.sourceCaches[layer.source];\n if (!sourceCache) {\n return;\n }\n\n const sourceLayer = layer.sourceLayer;\n if (!sourceLayer) {\n return;\n }\n\n const source = sourceCache.getSource();\n if (source.type === 'geojson' || (source.vectorLayerIds && source.vectorLayerIds.indexOf(sourceLayer) === -1)) {\n this.fire(new ErrorEvent(new Error(\n `Source layer \"${sourceLayer}\" ` +\n `does not exist on source \"${source.id}\" ` +\n `as specified by style layer \"${layer.id}\"`\n )));\n }\n }\n\n loaded() {\n if (!this._loaded)\n return false;\n\n if (Object.keys(this._updatedSources).length)\n return false;\n\n for (const id in this.sourceCaches)\n if (!this.sourceCaches[id].loaded())\n return false;\n\n if (!this.imageManager.isLoaded())\n return false;\n\n return true;\n }\n\n _serializeLayers(ids: Array) {\n return ids.map((id) => this._layers[id].serialize());\n }\n\n hasTransitions() {\n if (this.light && this.light.hasTransition()) {\n return true;\n }\n\n for (const id in this.sourceCaches) {\n if (this.sourceCaches[id].hasTransition()) {\n return true;\n }\n }\n\n for (const id in this._layers) {\n if (this._layers[id].hasTransition()) {\n return true;\n }\n }\n\n return false;\n }\n\n _checkLoaded() {\n if (!this._loaded) {\n throw new Error('Style is not done loading');\n }\n }\n\n /**\n * Apply queued style updates in a batch and recalculate zoom-dependent paint properties.\n */\n update(parameters: EvaluationParameters) {\n if (!this._loaded) {\n return;\n }\n\n if (this._changed) {\n const updatedIds = Object.keys(this._updatedLayers);\n const removedIds = Object.keys(this._removedLayers);\n\n if (updatedIds.length || removedIds.length) {\n this._updateWorkerLayers(updatedIds, removedIds);\n }\n for (const id in this._updatedSources) {\n const action = this._updatedSources[id];\n assert(action === 'reload' || action === 'clear');\n if (action === 'reload') {\n this._reloadSource(id);\n } else if (action === 'clear') {\n this._clearSource(id);\n }\n }\n\n for (const id in this._updatedPaintProps) {\n this._layers[id].updateTransitions(parameters);\n }\n\n this.light.updateTransitions(parameters);\n\n this._resetUpdates();\n\n this.fire(new Event('data', {dataType: 'style'}));\n }\n\n for (const sourceId in this.sourceCaches) {\n this.sourceCaches[sourceId].used = false;\n }\n\n for (const layerId of this._order) {\n const layer = this._layers[layerId];\n\n layer.recalculate(parameters);\n if (!layer.isHidden(parameters.zoom) && layer.source) {\n this.sourceCaches[layer.source].used = true;\n }\n }\n\n this.light.recalculate(parameters);\n this.z = parameters.zoom;\n }\n\n _updateWorkerLayers(updatedIds: Array, removedIds: Array) {\n this.dispatcher.broadcast('updateLayers', {\n layers: this._serializeLayers(updatedIds),\n removedIds: removedIds\n });\n }\n\n _resetUpdates() {\n this._changed = false;\n\n this._updatedLayers = {};\n this._removedLayers = {};\n\n this._updatedSources = {};\n this._updatedPaintProps = {};\n }\n\n /**\n * Update this style's state to match the given style JSON, performing only\n * the necessary mutations.\n *\n * May throw an Error ('Unimplemented: METHOD') if the mapbox-gl-style-spec\n * diff algorithm produces an operation that is not supported.\n *\n * @returns {boolean} true if any changes were made; false otherwise\n * @private\n */\n setState(nextState: StyleSpecification) {\n this._checkLoaded();\n\n if (emitValidationErrors(this, validateStyle(nextState))) return false;\n\n nextState = clone(nextState);\n nextState.layers = deref(nextState.layers);\n\n const changes = diffStyles(this.serialize(), nextState)\n .filter(op => !(op.command in ignoredDiffOperations));\n\n if (changes.length === 0) {\n return false;\n }\n\n const unimplementedOps = changes.filter(op => !(op.command in supportedDiffOperations));\n if (unimplementedOps.length > 0) {\n throw new Error(`Unimplemented: ${unimplementedOps.map(op => op.command).join(', ')}.`);\n }\n\n changes.forEach((op) => {\n if (op.command === 'setTransition') {\n // `transition` is always read directly off of\n // `this.stylesheet`, which we update below\n return;\n }\n (this: any)[op.command].apply(this, op.args);\n });\n\n this.stylesheet = nextState;\n\n return true;\n }\n\n addImage(id: string, image: StyleImage) {\n if (this.getImage(id)) {\n return this.fire(new ErrorEvent(new Error('An image with this name already exists.')));\n }\n this.imageManager.addImage(id, image);\n this.fire(new Event('data', {dataType: 'style'}));\n }\n\n getImage(id: string): ?StyleImage {\n return this.imageManager.getImage(id);\n }\n\n removeImage(id: string) {\n if (!this.getImage(id)) {\n return this.fire(new ErrorEvent(new Error('No image with this name exists.')));\n }\n this.imageManager.removeImage(id);\n this.fire(new Event('data', {dataType: 'style'}));\n }\n\n addSource(id: string, source: SourceSpecification, options?: {validate?: boolean}) {\n this._checkLoaded();\n\n if (this.sourceCaches[id] !== undefined) {\n throw new Error('There is already a source with this ID');\n }\n\n if (!source.type) {\n throw new Error(`The type property must be defined, but the only the following properties were given: ${Object.keys(source).join(', ')}.`);\n }\n\n const builtIns = ['vector', 'raster', 'geojson', 'video', 'image'];\n const shouldValidate = builtIns.indexOf(source.type) >= 0;\n if (shouldValidate && this._validate(validateStyle.source, `sources.${id}`, source, null, options)) return;\n\n if (this.map && this.map._collectResourceTiming) (source: any).collectResourceTiming = true;\n const sourceCache = this.sourceCaches[id] = new SourceCache(id, source, this.dispatcher);\n sourceCache.style = this;\n sourceCache.setEventedParent(this, () => ({\n isSourceLoaded: this.loaded(),\n source: sourceCache.serialize(),\n sourceId: id\n }));\n\n sourceCache.onAdd(this.map);\n this._changed = true;\n }\n\n /**\n * Remove a source from this stylesheet, given its id.\n * @param {string} id id of the source to remove\n * @throws {Error} if no source is found with the given ID\n */\n removeSource(id: string) {\n this._checkLoaded();\n\n if (this.sourceCaches[id] === undefined) {\n throw new Error('There is no source with this ID');\n }\n for (const layerId in this._layers) {\n if (this._layers[layerId].source === id) {\n return this.fire(new ErrorEvent(new Error(`Source \"${id}\" cannot be removed while layer \"${layerId}\" is using it.`)));\n }\n }\n\n const sourceCache = this.sourceCaches[id];\n delete this.sourceCaches[id];\n delete this._updatedSources[id];\n sourceCache.fire(new Event('data', {sourceDataType: 'metadata', dataType:'source', sourceId: id}));\n sourceCache.setEventedParent(null);\n sourceCache.clearTiles();\n\n if (sourceCache.onRemove) sourceCache.onRemove(this.map);\n this._changed = true;\n }\n\n /**\n * Set the data of a GeoJSON source, given its id.\n * @param {string} id id of the source\n * @param {GeoJSON|string} data GeoJSON source\n */\n setGeoJSONSourceData(id: string, data: GeoJSON | string) {\n this._checkLoaded();\n\n assert(this.sourceCaches[id] !== undefined, 'There is no source with this ID');\n const geojsonSource: GeoJSONSource = (this.sourceCaches[id].getSource(): any);\n assert(geojsonSource.type === 'geojson');\n\n geojsonSource.setData(data);\n this._changed = true;\n }\n\n /**\n * Get a source by id.\n * @param {string} id id of the desired source\n * @returns {Object} source\n */\n getSource(id: string): Object {\n return this.sourceCaches[id] && this.sourceCaches[id].getSource();\n }\n\n /**\n * Add a layer to the map style. The layer will be inserted before the layer with\n * ID `before`, or appended if `before` is omitted.\n * @param {string} [before] ID of an existing layer to insert before\n */\n addLayer(layerObject: LayerSpecification, before?: string, options?: {validate?: boolean}) {\n this._checkLoaded();\n\n const id = layerObject.id;\n\n if (this.getLayer(id)) {\n this.fire(new ErrorEvent(new Error(`Layer with id \"${id}\" already exists on this map`)));\n return;\n }\n\n if (typeof layerObject.source === 'object') {\n this.addSource(id, layerObject.source);\n layerObject = clone(layerObject);\n layerObject = (extend(layerObject, {source: id}): any);\n }\n\n // this layer is not in the style.layers array, so we pass an impossible array index\n if (this._validate(validateStyle.layer,\n `layers.${id}`, layerObject, {arrayIndex: -1}, options)) return;\n\n const layer = createStyleLayer(layerObject);\n this._validateLayer(layer);\n\n layer.setEventedParent(this, {layer: {id: id}});\n\n\n const index = before ? this._order.indexOf(before) : this._order.length;\n if (before && index === -1) {\n this.fire(new ErrorEvent(new Error(`Layer with id \"${before}\" does not exist on this map.`)));\n return;\n }\n\n this._order.splice(index, 0, id);\n this._layerOrderChanged = true;\n\n this._layers[id] = layer;\n\n if (this._removedLayers[id] && layer.source) {\n // If, in the current batch, we have already removed this layer\n // and we are now re-adding it with a different `type`, then we\n // need to clear (rather than just reload) the underyling source's\n // tiles. Otherwise, tiles marked 'reloading' will have buckets /\n // buffers that are set up for the _previous_ version of this\n // layer, causing, e.g.:\n // https://github.com/mapbox/mapbox-gl-js/issues/3633\n const removed = this._removedLayers[id];\n delete this._removedLayers[id];\n if (removed.type !== layer.type) {\n this._updatedSources[layer.source] = 'clear';\n } else {\n this._updatedSources[layer.source] = 'reload';\n this.sourceCaches[layer.source].pause();\n }\n }\n this._updateLayer(layer);\n }\n\n /**\n * Moves a layer to a different z-position. The layer will be inserted before the layer with\n * ID `before`, or appended if `before` is omitted.\n * @param {string} id ID of the layer to move\n * @param {string} [before] ID of an existing layer to insert before\n */\n moveLayer(id: string, before?: string) {\n this._checkLoaded();\n this._changed = true;\n\n const layer = this._layers[id];\n if (!layer) {\n this.fire(new ErrorEvent(new Error(`The layer '${id}' does not exist in the map's style and cannot be moved.`)));\n return;\n }\n\n if (id === before) {\n return;\n }\n\n const index = this._order.indexOf(id);\n this._order.splice(index, 1);\n\n const newIndex = before ? this._order.indexOf(before) : this._order.length;\n if (before && newIndex === -1) {\n this.fire(new ErrorEvent(new Error(`Layer with id \"${before}\" does not exist on this map.`)));\n return;\n }\n this._order.splice(newIndex, 0, id);\n\n this._layerOrderChanged = true;\n }\n\n /**\n * Remove the layer with the given id from the style.\n *\n * If no such layer exists, an `error` event is fired.\n *\n * @param {string} id id of the layer to remove\n * @fires error\n */\n removeLayer(id: string) {\n this._checkLoaded();\n\n const layer = this._layers[id];\n if (!layer) {\n this.fire(new ErrorEvent(new Error(`The layer '${id}' does not exist in the map's style and cannot be removed.`)));\n return;\n }\n\n layer.setEventedParent(null);\n\n const index = this._order.indexOf(id);\n this._order.splice(index, 1);\n\n this._layerOrderChanged = true;\n this._changed = true;\n this._removedLayers[id] = layer;\n delete this._layers[id];\n delete this._updatedLayers[id];\n delete this._updatedPaintProps[id];\n }\n\n /**\n * Return the style layer object with the given `id`.\n *\n * @param {string} id - id of the desired layer\n * @returns {?Object} a layer, if one with the given `id` exists\n */\n getLayer(id: string): Object {\n return this._layers[id];\n }\n\n setLayerZoomRange(layerId: string, minzoom: ?number, maxzoom: ?number) {\n this._checkLoaded();\n\n const layer = this.getLayer(layerId);\n if (!layer) {\n this.fire(new ErrorEvent(new Error(`The layer '${layerId}' does not exist in the map's style and cannot have zoom extent.`)));\n return;\n }\n\n if (layer.minzoom === minzoom && layer.maxzoom === maxzoom) return;\n\n if (minzoom != null) {\n layer.minzoom = minzoom;\n }\n if (maxzoom != null) {\n layer.maxzoom = maxzoom;\n }\n this._updateLayer(layer);\n }\n\n setFilter(layerId: string, filter: ?FilterSpecification) {\n this._checkLoaded();\n\n const layer = this.getLayer(layerId);\n if (!layer) {\n this.fire(new ErrorEvent(new Error(`The layer '${layerId}' does not exist in the map's style and cannot be filtered.`)));\n return;\n }\n\n if (deepEqual(layer.filter, filter)) {\n return;\n }\n\n if (filter === null || filter === undefined) {\n layer.filter = undefined;\n this._updateLayer(layer);\n return;\n }\n\n if (this._validate(validateStyle.filter, `layers.${layer.id}.filter`, filter)) {\n return;\n }\n\n layer.filter = clone(filter);\n this._updateLayer(layer);\n }\n\n /**\n * Get a layer's filter object\n * @param {string} layer the layer to inspect\n * @returns {*} the layer's filter, if any\n */\n getFilter(layer: string) {\n return clone(this.getLayer(layer).filter);\n }\n\n setLayoutProperty(layerId: string, name: string, value: any) {\n this._checkLoaded();\n\n const layer = this.getLayer(layerId);\n if (!layer) {\n this.fire(new ErrorEvent(new Error(`The layer '${layerId}' does not exist in the map's style and cannot be styled.`)));\n return;\n }\n\n if (deepEqual(layer.getLayoutProperty(name), value)) return;\n\n layer.setLayoutProperty(name, value);\n this._updateLayer(layer);\n }\n\n /**\n * Get a layout property's value from a given layer\n * @param {string} layer the layer to inspect\n * @param {string} name the name of the layout property\n * @returns {*} the property value\n */\n getLayoutProperty(layer: string, name: string) {\n return this.getLayer(layer).getLayoutProperty(name);\n }\n\n setPaintProperty(layerId: string, name: string, value: any) {\n this._checkLoaded();\n\n const layer = this.getLayer(layerId);\n if (!layer) {\n this.fire(new ErrorEvent(new Error(`The layer '${layerId}' does not exist in the map's style and cannot be styled.`)));\n return;\n }\n\n if (deepEqual(layer.getPaintProperty(name), value)) return;\n\n const wasDataDriven = layer._transitionablePaint._values[name].value.isDataDriven();\n layer.setPaintProperty(name, value);\n const isDataDriven = layer._transitionablePaint._values[name].value.isDataDriven();\n\n if (isDataDriven || wasDataDriven) {\n this._updateLayer(layer);\n }\n\n this._changed = true;\n this._updatedPaintProps[layerId] = true;\n }\n\n getPaintProperty(layer: string, name: string) {\n return this.getLayer(layer).getPaintProperty(name);\n }\n\n getTransition() {\n return extend({ duration: 300, delay: 0 }, this.stylesheet && this.stylesheet.transition);\n }\n\n serialize() {\n return filterObject({\n version: this.stylesheet.version,\n name: this.stylesheet.name,\n metadata: this.stylesheet.metadata,\n light: this.stylesheet.light,\n center: this.stylesheet.center,\n zoom: this.stylesheet.zoom,\n bearing: this.stylesheet.bearing,\n pitch: this.stylesheet.pitch,\n sprite: this.stylesheet.sprite,\n glyphs: this.stylesheet.glyphs,\n transition: this.stylesheet.transition,\n sources: mapObject(this.sourceCaches, (source) => source.serialize()),\n layers: this._order.map((id) => this._layers[id].serialize())\n }, (value) => { return value !== undefined; });\n }\n\n _updateLayer(layer: StyleLayer) {\n this._updatedLayers[layer.id] = true;\n if (layer.source && !this._updatedSources[layer.source]) {\n this._updatedSources[layer.source] = 'reload';\n this.sourceCaches[layer.source].pause();\n }\n this._changed = true;\n }\n\n _flattenRenderedFeatures(sourceResults: Array) {\n const features = [];\n for (let l = this._order.length - 1; l >= 0; l--) {\n const layerId = this._order[l];\n for (const sourceResult of sourceResults) {\n const layerFeatures = sourceResult[layerId];\n if (layerFeatures) {\n for (const feature of layerFeatures) {\n features.push(feature);\n }\n }\n }\n }\n return features;\n }\n\n queryRenderedFeatures(queryGeometry: any, params: any, transform: Transform) {\n if (params && params.filter) {\n this._validate(validateStyle.filter, 'queryRenderedFeatures.filter', params.filter);\n }\n\n const includedSources = {};\n if (params && params.layers) {\n if (!Array.isArray(params.layers)) {\n this.fire(new ErrorEvent(new Error('parameters.layers must be an Array.')));\n return [];\n }\n for (const layerId of params.layers) {\n const layer = this._layers[layerId];\n if (!layer) {\n // this layer is not in the style.layers array\n this.fire(new ErrorEvent(new Error(`The layer '${layerId}' does not exist in the map's style and cannot be queried for features.`)));\n return [];\n }\n includedSources[layer.source] = true;\n }\n }\n\n const sourceResults = [];\n for (const id in this.sourceCaches) {\n if (params.layers && !includedSources[id]) continue;\n sourceResults.push(\n queryRenderedFeatures(\n this.sourceCaches[id],\n this._layers,\n queryGeometry.worldCoordinate,\n params,\n transform)\n );\n }\n\n if (this.placement) {\n // If a placement has run, query against its CollisionIndex\n // for symbol results, and treat it as an extra source to merge\n sourceResults.push(\n queryRenderedSymbols(\n this._layers,\n queryGeometry.viewport,\n params,\n this.placement.collisionIndex,\n this.placement.retainedQueryData)\n );\n }\n return this._flattenRenderedFeatures(sourceResults);\n }\n\n querySourceFeatures(sourceID: string, params: ?{sourceLayer: ?string, filter: ?Array}) {\n if (params && params.filter) {\n this._validate(validateStyle.filter, 'querySourceFeatures.filter', params.filter);\n }\n const sourceCache = this.sourceCaches[sourceID];\n return sourceCache ? querySourceFeatures(sourceCache, params) : [];\n }\n\n addSourceType(name: string, SourceType: Class, callback: Callback) {\n if (Style.getSourceType(name)) {\n return callback(new Error(`A source type called \"${name}\" already exists.`));\n }\n\n Style.setSourceType(name, SourceType);\n\n if (!SourceType.workerSourceURL) {\n return callback(null, null);\n }\n\n this.dispatcher.broadcast('loadWorkerSource', {\n name: name,\n url: SourceType.workerSourceURL\n }, callback);\n }\n\n getLight() {\n return this.light.getLight();\n }\n\n setLight(lightOptions: LightSpecification) {\n this._checkLoaded();\n\n const light = this.light.getLight();\n let _update = false;\n for (const key in lightOptions) {\n if (!deepEqual(lightOptions[key], light[key])) {\n _update = true;\n break;\n }\n }\n if (!_update) return;\n\n const parameters = {\n now: browser.now(),\n transition: extend({\n duration: 300,\n delay: 0\n }, this.stylesheet.transition)\n };\n\n this.light.setLight(lightOptions);\n this.light.updateTransitions(parameters);\n }\n\n _validate(validate: ({}) => void, key: string, value: any, props: any, options?: {validate?: boolean}) {\n if (options && options.validate === false) {\n return false;\n }\n return emitValidationErrors(this, validate.call(validateStyle, extend({\n key: key,\n style: this.serialize(),\n value: value,\n styleSpec: styleSpec\n }, props)));\n }\n\n _remove() {\n rtlTextPluginEvented.off('pluginAvailable', this._rtlTextPluginCallback);\n for (const id in this.sourceCaches) {\n this.sourceCaches[id].clearTiles();\n }\n this.dispatcher.remove();\n }\n\n _clearSource(id: string) {\n this.sourceCaches[id].clearTiles();\n }\n\n _reloadSource(id: string) {\n this.sourceCaches[id].resume();\n this.sourceCaches[id].reload();\n }\n\n _updateSources(transform: Transform) {\n for (const id in this.sourceCaches) {\n this.sourceCaches[id].update(transform);\n }\n }\n\n _generateCollisionBoxes() {\n for (const id in this.sourceCaches) {\n this._reloadSource(id);\n }\n }\n\n _updatePlacement(transform: Transform, showCollisionBoxes: boolean, fadeDuration: number) {\n let symbolBucketsChanged = false;\n let placementCommitted = false;\n\n const layerTiles = {};\n\n for (const layerID of this._order) {\n const styleLayer = this._layers[layerID];\n if (styleLayer.type !== 'symbol') continue;\n\n if (!layerTiles[styleLayer.source]) {\n const sourceCache = this.sourceCaches[styleLayer.source];\n layerTiles[styleLayer.source] = sourceCache.getRenderableIds()\n .map((id) => sourceCache.getTileByID(id))\n .sort((a, b) => (b.tileID.overscaledZ - a.tileID.overscaledZ) || (a.tileID.isLessThan(b.tileID) ? -1 : 1));\n }\n\n const layerBucketsChanged = this.crossTileSymbolIndex.addLayer(styleLayer, layerTiles[styleLayer.source], transform.center.lng);\n symbolBucketsChanged = symbolBucketsChanged || layerBucketsChanged;\n }\n this.crossTileSymbolIndex.pruneUnusedLayers(this._order);\n\n // Anything that changes our \"in progress\" layer and tile indices requires us\n // to start over. When we start over, we do a full placement instead of incremental\n // to prevent starvation.\n // We need to restart placement to keep layer indices in sync.\n const forceFullPlacement = this._layerOrderChanged;\n\n if (forceFullPlacement || !this.pauseablePlacement || (this.pauseablePlacement.isDone() && !this.placement.stillRecent(browser.now()))) {\n this.pauseablePlacement = new PauseablePlacement(transform, this._order, forceFullPlacement, showCollisionBoxes, fadeDuration);\n this._layerOrderChanged = false;\n }\n\n if (this.pauseablePlacement.isDone()) {\n // the last placement finished running, but the next one hasn’t\n // started yet because of the `stillRecent` check immediately\n // above, so mark it stale to ensure that we request another\n // render frame\n this.placement.setStale();\n } else {\n this.pauseablePlacement.continuePlacement(this._order, this._layers, layerTiles);\n\n if (this.pauseablePlacement.isDone()) {\n this.placement = this.pauseablePlacement.commit(this.placement, browser.now());\n placementCommitted = true;\n }\n\n if (symbolBucketsChanged) {\n // since the placement gets split over multiple frames it is possible\n // these buckets were processed before they were changed and so the\n // placement is already stale while it is in progress\n this.pauseablePlacement.placement.setStale();\n }\n }\n\n if (placementCommitted || symbolBucketsChanged) {\n for (const layerID of this._order) {\n const styleLayer = this._layers[layerID];\n if (styleLayer.type !== 'symbol') continue;\n this.placement.updateLayerOpacities(styleLayer, layerTiles[styleLayer.source]);\n }\n }\n\n // needsRender is false when we have just finished a placement that didn't change the visibility of any symbols\n const needsRerender = !this.pauseablePlacement.isDone() || this.placement.hasTransitions(browser.now());\n return needsRerender;\n }\n\n // Callbacks from web workers\n\n getImages(mapId: string, params: {icons: Array}, callback: Callback<{[string]: StyleImage}>) {\n this.imageManager.getImages(params.icons, callback);\n }\n\n getGlyphs(mapId: string, params: {stacks: {[string]: Array}}, callback: Callback<{[string]: {[number]: ?StyleGlyph}}>) {\n this.glyphManager.getGlyphs(params.stacks, callback);\n }\n}\n\nStyle.getSourceType = getSourceType;\nStyle.setSourceType = setSourceType;\nStyle.registerForPluginAvailability = registerForPluginAvailability;\n\nexport default Style;\n","// @flow\nimport { createLayout } from '../util/struct_array';\n\nexport default createLayout([\n { name: 'a_pos', type: 'Int16', components: 2 }\n]);\n","// @flow\n\nimport browser from '../util/browser';\n\nimport shaders from '../shaders';\nimport assert from 'assert';\nimport ProgramConfiguration from '../data/program_configuration';\nimport VertexArrayObject from './vertex_array_object';\nimport Context from '../gl/context';\n\nimport type SegmentVector from '../data/segment';\nimport type VertexBuffer from '../gl/vertex_buffer';\nimport type IndexBuffer from '../gl/index_buffer';\n\nexport type DrawMode =\n | $PropertyType\n | $PropertyType;\n\nclass Program {\n program: WebGLProgram;\n uniforms: {[string]: WebGLUniformLocation};\n attributes: {[string]: number};\n numAttributes: number;\n\n constructor(context: Context,\n source: {fragmentSource: string, vertexSource: string},\n configuration: ProgramConfiguration,\n showOverdrawInspector: boolean) {\n const gl = context.gl;\n this.program = gl.createProgram();\n\n const defines = configuration.defines().concat(\n `#define DEVICE_PIXEL_RATIO ${browser.devicePixelRatio.toFixed(1)}`);\n if (showOverdrawInspector) {\n defines.push('#define OVERDRAW_INSPECTOR;');\n }\n\n const fragmentSource = defines.concat(shaders.prelude.fragmentSource, source.fragmentSource).join('\\n');\n const vertexSource = defines.concat(shaders.prelude.vertexSource, source.vertexSource).join('\\n');\n\n const fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);\n gl.shaderSource(fragmentShader, fragmentSource);\n gl.compileShader(fragmentShader);\n assert(gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS), (gl.getShaderInfoLog(fragmentShader): any));\n gl.attachShader(this.program, fragmentShader);\n\n const vertexShader = gl.createShader(gl.VERTEX_SHADER);\n gl.shaderSource(vertexShader, vertexSource);\n gl.compileShader(vertexShader);\n assert(gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS), (gl.getShaderInfoLog(vertexShader): any));\n gl.attachShader(this.program, vertexShader);\n\n // Manually bind layout attributes in the order defined by their\n // ProgramInterface so that we don't dynamically link an unused\n // attribute at position 0, which can cause rendering to fail for an\n // entire layer (see #4607, #4728)\n const layoutAttributes = configuration.layoutAttributes || [];\n for (let i = 0; i < layoutAttributes.length; i++) {\n gl.bindAttribLocation(this.program, i, layoutAttributes[i].name);\n }\n\n gl.linkProgram(this.program);\n assert(gl.getProgramParameter(this.program, gl.LINK_STATUS), (gl.getProgramInfoLog(this.program): any));\n\n this.numAttributes = gl.getProgramParameter(this.program, gl.ACTIVE_ATTRIBUTES);\n\n this.attributes = {};\n this.uniforms = {};\n\n for (let i = 0; i < this.numAttributes; i++) {\n const attribute = gl.getActiveAttrib(this.program, i);\n if (attribute) {\n this.attributes[attribute.name] = gl.getAttribLocation(this.program, attribute.name);\n }\n }\n\n const numUniforms = gl.getProgramParameter(this.program, gl.ACTIVE_UNIFORMS);\n for (let i = 0; i < numUniforms; i++) {\n const uniform = gl.getActiveUniform(this.program, i);\n if (uniform) {\n this.uniforms[uniform.name] = gl.getUniformLocation(this.program, uniform.name);\n }\n }\n }\n\n draw(context: Context,\n drawMode: DrawMode,\n layerID: string,\n layoutVertexBuffer: VertexBuffer,\n indexBuffer: IndexBuffer,\n segments: SegmentVector,\n configuration: ?ProgramConfiguration,\n dynamicLayoutBuffer: ?VertexBuffer,\n dynamicLayoutBuffer2: ?VertexBuffer) {\n\n const gl = context.gl;\n\n const primitiveSize = {\n [gl.LINES]: 2,\n [gl.TRIANGLES]: 3\n }[drawMode];\n\n for (const segment of segments.get()) {\n const vaos = segment.vaos || (segment.vaos = {});\n const vao: VertexArrayObject = vaos[layerID] || (vaos[layerID] = new VertexArrayObject());\n\n vao.bind(\n context,\n this,\n layoutVertexBuffer,\n configuration ? configuration.getPaintVertexBuffers() : [],\n indexBuffer,\n segment.vertexOffset,\n dynamicLayoutBuffer,\n dynamicLayoutBuffer2\n );\n\n gl.drawElements(\n drawMode,\n segment.primitiveLength * primitiveSize,\n gl.UNSIGNED_SHORT,\n segment.primitiveOffset * primitiveSize * 2);\n }\n }\n}\n\nexport default Program;\n","// @flow\n\nimport { OverscaledTileID, CanonicalTileID } from '../source/tile_id';\n\nimport type Tile from './../source/tile';\nimport type Context from '../gl/context';\n\ntype Mask = {\n [number]: CanonicalTileID\n};\n\n// Updates the TileMasks for all renderable tiles. A TileMask describes all regions\n// within that tile that are *not* covered by other renderable tiles.\n// Example: renderableTiles in our list are 2/1/3, 3/3/6, and 4/5/13. The schematic for creating the\n// TileMask for 2/1/3 looks like this:\n//\n// ┌────────┬────────┬─────────────────┐\n// │ │ │#################│\n// │ 4/4/12 │ 4/5/12 │#################│\n// │ │ │#################│\n// ├──────3/2/6──────┤#####3/3/6#######│\n// │ │########│#################│\n// │ 4/4/13 │#4/5/13#│#################│\n// │ │########│#################│\n// ├────────┴──────2/1/3───────────────┤\n// │ │ │\n// │ │ │\n// │ │ │\n// │ 3/2/7 │ 3/3/7 │\n// │ │ │\n// │ │ │\n// │ │ │\n// └─────────────────┴─────────────────┘\n//\n// The TileMask for 2/1/3 thus consists of the tiles 4/4/12, 4/5/12, 4/4/13, 3/2/7, and 3/3/7,\n// but it does *not* include 4/5/13, and 3/3/6, since these are other renderableTiles.\n// A TileMask always contains TileIDs *relative* to the tile it is generated for, so 2/1/3 is\n// \"subtracted\" from these TileIDs. The final TileMask for 2/1/3 will thus be:\n//\n// ┌────────┬────────┬─────────────────┐\n// │ │ │#################│\n// │ 2/0/0 │ 2/1/0 │#################│\n// │ │ │#################│\n// ├────────┼────────┤#################│\n// │ │########│#################│\n// │ 2/0/1 │########│#################│\n// │ │########│#################│\n// ├────────┴────────┼─────────────────┤\n// │ │ │\n// │ │ │\n// │ │ │\n// │ 1/0/1 │ 1/1/1 │\n// │ │ │\n// │ │ │\n// │ │ │\n// └─────────────────┴─────────────────┘\n//\n// Only other renderable tiles that are *children* of the tile we are generating the mask for will\n// be considered. For example, adding TileID 4/8/13 to renderableTiles won't affect the TileMask for\n// 2/1/3, since it is not a descendant of it.\n\n\nexport default function(renderableTiles: Array, context: Context) {\n const sortedRenderables = renderableTiles.sort((a, b) => { return a.tileID.isLessThan(b.tileID) ? -1 : b.tileID.isLessThan(a.tileID) ? 1 : 0; });\n\n for (let i = 0; i < sortedRenderables.length; i++) {\n const mask = {};\n const tile = sortedRenderables[i];\n const childArray = sortedRenderables.slice(i + 1);\n // Try to add all remaining ids as children. We sorted the tile list\n // by z earlier, so all preceding items cannot be children of the current\n // tile. We also compute the lower bound of the next wrap, because items of the next wrap\n // can never be children of the current wrap.\n\n computeTileMasks(tile.tileID.wrapped(), tile.tileID, childArray, new OverscaledTileID(0, tile.tileID.wrap + 1, 0, 0, 0), mask);\n tile.setMask(mask, context);\n }\n}\n\nfunction computeTileMasks(rootTile: OverscaledTileID, ref: OverscaledTileID, childArray: Array, lowerBound: OverscaledTileID, mask: Mask) {\n // If the reference or any of its children is found in the list, we need to recurse.\n for (let i = 0; i < childArray.length; i++) {\n const childTile = childArray[i];\n // childTile is from a larger wrap than the rootTile so it cannot be a child tile\n if (lowerBound.isLessThan(childTile.tileID)) break;\n // The current tile is masked out, so we don't need to add them to the mask set.\n if (ref.key === childTile.tileID.key) {\n return;\n } else if (childTile.tileID.isChildOf(ref)) {\n // There's at least one child tile that is masked out, so recursively descend\n const children = ref.children(Infinity);\n for (let j = 0; j < children.length; j++) {\n const child = children[j];\n computeTileMasks(rootTile, child, childArray.slice(i), lowerBound, mask);\n }\n return;\n }\n }\n // We couldn't find a child, so it's definitely a masked part.\n // Compute the difference between the root tile ID and the reference tile ID, since TileMask\n // elements are always relative (see below for explanation).\n const diffZ = ref.overscaledZ - rootTile.overscaledZ;\n const maskTileId = new CanonicalTileID(diffZ, ref.canonical.x - (rootTile.canonical.x << diffZ), ref.canonical.y - (rootTile.canonical.y << diffZ));\n mask[maskTileId.key] = mask[maskTileId.key] || maskTileId;\n}\n","// @flow\n\nimport type Painter from './painter';\nimport type SourceCache from '../source/source_cache';\nimport type StyleLayer from '../style/style_layer';\nimport type {OverscaledTileID} from '../source/tile_id';\nimport type SymbolBucket from '../data/bucket/symbol_bucket';\nimport pixelsToTileUnits from '../source/pixels_to_tile_units';\nimport DepthMode from '../gl/depth_mode';\nimport StencilMode from '../gl/stencil_mode';\n\nexport default drawCollisionDebug;\n\nfunction drawCollisionDebugGeometry(painter: Painter, sourceCache: SourceCache, layer: StyleLayer, coords: Array, drawCircles: boolean) {\n const context = painter.context;\n const gl = context.gl;\n const program = drawCircles ? painter.useProgram('collisionCircle') : painter.useProgram('collisionBox');\n\n context.setDepthMode(DepthMode.disabled);\n context.setStencilMode(StencilMode.disabled);\n context.setColorMode(painter.colorModeForRenderPass());\n\n for (let i = 0; i < coords.length; i++) {\n const coord = coords[i];\n const tile = sourceCache.getTile(coord);\n const bucket: ?SymbolBucket = (tile.getBucket(layer): any);\n if (!bucket) continue;\n const buffers = drawCircles ? bucket.collisionCircle : bucket.collisionBox;\n if (!buffers) continue;\n\n\n gl.uniformMatrix4fv(program.uniforms.u_matrix, false, coord.posMatrix);\n\n if (!drawCircles) {\n context.lineWidth.set(1);\n }\n\n gl.uniform1f(program.uniforms.u_camera_to_center_distance, painter.transform.cameraToCenterDistance);\n const pixelRatio = pixelsToTileUnits(tile, 1, painter.transform.zoom);\n const scale = Math.pow(2, painter.transform.zoom - tile.tileID.overscaledZ);\n gl.uniform1f(program.uniforms.u_pixels_to_tile_units, pixelRatio);\n gl.uniform2f(program.uniforms.u_extrude_scale,\n painter.transform.pixelsToGLUnits[0] / (pixelRatio * scale),\n painter.transform.pixelsToGLUnits[1] / (pixelRatio * scale));\n gl.uniform1f(program.uniforms.u_overscale_factor, tile.tileID.overscaleFactor());\n\n program.draw(\n context,\n drawCircles ? gl.TRIANGLES : gl.LINES,\n layer.id,\n buffers.layoutVertexBuffer,\n buffers.indexBuffer,\n buffers.segments,\n null,\n buffers.collisionVertexBuffer,\n null);\n }\n}\n\nfunction drawCollisionDebug(painter: Painter, sourceCache: SourceCache, layer: StyleLayer, coords: Array) {\n drawCollisionDebugGeometry(painter, sourceCache, layer, coords, false);\n drawCollisionDebugGeometry(painter, sourceCache, layer, coords, true);\n}\n","// @flow\n\nimport drawCollisionDebug from './draw_collision_debug';\n\nimport pixelsToTileUnits from '../source/pixels_to_tile_units';\nimport * as symbolProjection from '../symbol/projection';\nimport * as symbolSize from '../symbol/symbol_size';\nimport { mat4 } from '@mapbox/gl-matrix';\nconst identityMat4 = mat4.identity(new Float32Array(16));\nimport properties from '../style/style_layer/symbol_style_layer_properties';\nconst symbolLayoutProperties = properties.layout;\nimport StencilMode from '../gl/stencil_mode';\nimport DepthMode from '../gl/depth_mode';\n\nimport type Painter from './painter';\nimport type SourceCache from '../source/source_cache';\nimport type SymbolStyleLayer from '../style/style_layer/symbol_style_layer';\nimport type SymbolBucket from '../data/bucket/symbol_bucket';\nimport type {OverscaledTileID} from '../source/tile_id';\n\nexport default drawSymbols;\n\nfunction drawSymbols(painter: Painter, sourceCache: SourceCache, layer: SymbolStyleLayer, coords: Array) {\n if (painter.renderPass !== 'translucent') return;\n\n const context = painter.context;\n\n // Disable the stencil test so that labels aren't clipped to tile boundaries.\n context.setStencilMode(StencilMode.disabled);\n context.setColorMode(painter.colorModeForRenderPass());\n\n if (layer.paint.get('icon-opacity').constantOr(1) !== 0) {\n drawLayerSymbols(painter, sourceCache, layer, coords, false,\n layer.paint.get('icon-translate'),\n layer.paint.get('icon-translate-anchor'),\n layer.layout.get('icon-rotation-alignment'),\n layer.layout.get('icon-pitch-alignment'),\n layer.layout.get('icon-keep-upright')\n );\n }\n\n if (layer.paint.get('text-opacity').constantOr(1) !== 0) {\n drawLayerSymbols(painter, sourceCache, layer, coords, true,\n layer.paint.get('text-translate'),\n layer.paint.get('text-translate-anchor'),\n layer.layout.get('text-rotation-alignment'),\n layer.layout.get('text-pitch-alignment'),\n layer.layout.get('text-keep-upright')\n );\n }\n\n if (sourceCache.map.showCollisionBoxes) {\n drawCollisionDebug(painter, sourceCache, layer, coords);\n }\n}\n\nfunction drawLayerSymbols(painter, sourceCache, layer, coords, isText, translate, translateAnchor,\n rotationAlignment, pitchAlignment, keepUpright) {\n\n const context = painter.context;\n const gl = context.gl;\n const tr = painter.transform;\n\n const rotateWithMap = rotationAlignment === 'map';\n const pitchWithMap = pitchAlignment === 'map';\n const alongLine = rotateWithMap && layer.layout.get('symbol-placement') === 'line';\n // Line label rotation happens in `updateLineLabels`\n // Pitched point labels are automatically rotated by the labelPlaneMatrix projection\n // Unpitched point labels need to have their rotation applied after projection\n const rotateInShader = rotateWithMap && !pitchWithMap && !alongLine;\n\n const depthOn = pitchWithMap;\n\n context.setDepthMode(depthOn ? painter.depthModeForSublayer(0, DepthMode.ReadOnly) : DepthMode.disabled);\n\n let program;\n\n for (const coord of coords) {\n const tile = sourceCache.getTile(coord);\n const bucket: SymbolBucket = (tile.getBucket(layer): any);\n if (!bucket) continue;\n const buffers = isText ? bucket.text : bucket.icon;\n if (!buffers || !buffers.segments.get().length) continue;\n const programConfiguration = buffers.programConfigurations.get(layer.id);\n\n const isSDF = isText || bucket.sdfIcons;\n\n const sizeData = isText ? bucket.textSizeData : bucket.iconSizeData;\n\n if (!program) {\n program = painter.useProgram(isSDF ? 'symbolSDF' : 'symbolIcon', programConfiguration);\n programConfiguration.setUniforms(painter.context, program, layer.paint, {zoom: painter.transform.zoom});\n\n setSymbolDrawState(program, painter, layer, isText, rotateInShader, pitchWithMap, sizeData);\n }\n\n context.activeTexture.set(gl.TEXTURE0);\n gl.uniform1i(program.uniforms.u_texture, 0);\n\n if (isText) {\n tile.glyphAtlasTexture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n gl.uniform2fv(program.uniforms.u_texsize, tile.glyphAtlasTexture.size);\n } else {\n const iconScaled = layer.layout.get('icon-size').constantOr(0) !== 1 || bucket.iconsNeedLinear;\n const iconTransformed = pitchWithMap || tr.pitch !== 0;\n\n tile.iconAtlasTexture.bind(isSDF || painter.options.rotating || painter.options.zooming || iconScaled || iconTransformed ?\n gl.LINEAR : gl.NEAREST, gl.CLAMP_TO_EDGE);\n gl.uniform2fv(program.uniforms.u_texsize, tile.iconAtlasTexture.size);\n }\n\n gl.uniformMatrix4fv(program.uniforms.u_matrix, false, painter.translatePosMatrix(coord.posMatrix, tile, translate, translateAnchor));\n\n const s = pixelsToTileUnits(tile, 1, painter.transform.zoom);\n const labelPlaneMatrix = symbolProjection.getLabelPlaneMatrix(coord.posMatrix, pitchWithMap, rotateWithMap, painter.transform, s);\n const glCoordMatrix = symbolProjection.getGlCoordMatrix(coord.posMatrix, pitchWithMap, rotateWithMap, painter.transform, s);\n gl.uniformMatrix4fv(program.uniforms.u_gl_coord_matrix, false, painter.translatePosMatrix(glCoordMatrix, tile, translate, translateAnchor, true));\n\n if (alongLine) {\n gl.uniformMatrix4fv(program.uniforms.u_label_plane_matrix, false, identityMat4);\n symbolProjection.updateLineLabels(bucket, coord.posMatrix, painter, isText, labelPlaneMatrix, glCoordMatrix, pitchWithMap, keepUpright);\n } else {\n gl.uniformMatrix4fv(program.uniforms.u_label_plane_matrix, false, labelPlaneMatrix);\n }\n\n gl.uniform1f(program.uniforms.u_fade_change, painter.options.fadeDuration ? painter.symbolFadeChange : 1);\n\n drawTileSymbols(program, programConfiguration, painter, layer, tile, buffers, isText, isSDF, pitchWithMap);\n }\n}\n\nfunction setSymbolDrawState(program, painter, layer, isText, rotateInShader, pitchWithMap, sizeData) {\n\n const gl = painter.context.gl;\n const tr = painter.transform;\n\n gl.uniform1i(program.uniforms.u_pitch_with_map, pitchWithMap ? 1 : 0);\n\n gl.uniform1f(program.uniforms.u_is_text, isText ? 1 : 0);\n\n gl.uniform1f(program.uniforms.u_pitch, tr.pitch / 360 * 2 * Math.PI);\n\n const isZoomConstant = sizeData.functionType === 'constant' || sizeData.functionType === 'source';\n const isFeatureConstant = sizeData.functionType === 'constant' || sizeData.functionType === 'camera';\n gl.uniform1i(program.uniforms.u_is_size_zoom_constant, isZoomConstant ? 1 : 0);\n gl.uniform1i(program.uniforms.u_is_size_feature_constant, isFeatureConstant ? 1 : 0);\n\n gl.uniform1f(program.uniforms.u_camera_to_center_distance, tr.cameraToCenterDistance);\n\n const size = symbolSize.evaluateSizeForZoom(sizeData, tr.zoom, symbolLayoutProperties.properties[isText ? 'text-size' : 'icon-size']);\n if (size.uSizeT !== undefined) gl.uniform1f(program.uniforms.u_size_t, size.uSizeT);\n if (size.uSize !== undefined) gl.uniform1f(program.uniforms.u_size, size.uSize);\n\n gl.uniform1f(program.uniforms.u_aspect_ratio, tr.width / tr.height);\n gl.uniform1i(program.uniforms.u_rotate_symbol, rotateInShader ? 1 : 0);\n}\n\nfunction drawTileSymbols(program, programConfiguration, painter, layer, tile, buffers, isText, isSDF, pitchWithMap) {\n\n const context = painter.context;\n const gl = context.gl;\n const tr = painter.transform;\n\n if (isSDF) {\n const hasHalo = layer.paint.get(isText ? 'text-halo-width' : 'icon-halo-width').constantOr(1) !== 0;\n const gammaScale = (pitchWithMap ? Math.cos(tr._pitch) * tr.cameraToCenterDistance : 1);\n gl.uniform1f(program.uniforms.u_gamma_scale, gammaScale);\n\n if (hasHalo) { // Draw halo underneath the text.\n gl.uniform1f(program.uniforms.u_is_halo, 1);\n drawSymbolElements(buffers, layer, context, program);\n }\n\n gl.uniform1f(program.uniforms.u_is_halo, 0);\n }\n\n drawSymbolElements(buffers, layer, context, program);\n}\n\nfunction drawSymbolElements(buffers, layer, context, program) {\n program.draw(\n context,\n context.gl.TRIANGLES,\n layer.id,\n buffers.layoutVertexBuffer,\n buffers.indexBuffer,\n buffers.segments,\n buffers.programConfigurations.get(layer.id),\n buffers.dynamicLayoutVertexBuffer,\n buffers.opacityVertexBuffer);\n}\n","// @flow\n\nimport browser from '../util/browser';\n\nimport pixelsToTileUnits from '../source/pixels_to_tile_units';\nimport DepthMode from '../gl/depth_mode';\nimport Texture from './texture';\n\nimport type Painter from './painter';\nimport type SourceCache from '../source/source_cache';\nimport type LineStyleLayer from '../style/style_layer/line_style_layer';\nimport type LineBucket from '../data/bucket/line_bucket';\nimport type {OverscaledTileID} from '../source/tile_id';\n\nexport default function drawLine(painter: Painter, sourceCache: SourceCache, layer: LineStyleLayer, coords: Array) {\n if (painter.renderPass !== 'translucent') return;\n\n const opacity = layer.paint.get('line-opacity');\n if (opacity.constantOr(1) === 0) return;\n\n const context = painter.context;\n\n context.setDepthMode(painter.depthModeForSublayer(0, DepthMode.ReadOnly));\n context.setColorMode(painter.colorModeForRenderPass());\n\n const programId =\n layer.paint.get('line-dasharray') ? 'lineSDF' :\n layer.paint.get('line-pattern') ? 'linePattern' :\n layer.paint.get('line-gradient') ? 'lineGradient' : 'line';\n\n let prevTileZoom;\n let firstTile = true;\n\n for (const coord of coords) {\n const tile = sourceCache.getTile(coord);\n const bucket: ?LineBucket = (tile.getBucket(layer): any);\n if (!bucket) continue;\n\n const programConfiguration = bucket.programConfigurations.get(layer.id);\n const prevProgram = painter.context.program.get();\n const program = painter.useProgram(programId, programConfiguration);\n const programChanged = firstTile || program.program !== prevProgram;\n const tileRatioChanged = prevTileZoom !== tile.tileID.overscaledZ;\n\n if (programChanged) {\n programConfiguration.setUniforms(painter.context, program, layer.paint, {zoom: painter.transform.zoom});\n }\n drawLineTile(program, painter, tile, bucket, layer, coord, programConfiguration, programChanged, tileRatioChanged);\n prevTileZoom = tile.tileID.overscaledZ;\n firstTile = false;\n }\n}\n\nfunction drawLineTile(program, painter, tile, bucket, layer, coord, programConfiguration, programChanged, tileRatioChanged) {\n const context = painter.context;\n const gl = context.gl;\n const dasharray = layer.paint.get('line-dasharray');\n const image = layer.paint.get('line-pattern');\n\n let posA, posB, imagePosA, imagePosB;\n\n if (programChanged || tileRatioChanged) {\n const tileRatio = 1 / pixelsToTileUnits(tile, 1, painter.transform.tileZoom);\n\n if (dasharray) {\n posA = painter.lineAtlas.getDash(dasharray.from, layer.layout.get('line-cap') === 'round');\n posB = painter.lineAtlas.getDash(dasharray.to, layer.layout.get('line-cap') === 'round');\n\n const widthA = posA.width * dasharray.fromScale;\n const widthB = posB.width * dasharray.toScale;\n\n gl.uniform2f(program.uniforms.u_patternscale_a, tileRatio / widthA, -posA.height / 2);\n gl.uniform2f(program.uniforms.u_patternscale_b, tileRatio / widthB, -posB.height / 2);\n gl.uniform1f(program.uniforms.u_sdfgamma, painter.lineAtlas.width / (Math.min(widthA, widthB) * 256 * browser.devicePixelRatio) / 2);\n\n } else if (image) {\n imagePosA = painter.imageManager.getPattern(image.from);\n imagePosB = painter.imageManager.getPattern(image.to);\n if (!imagePosA || !imagePosB) return;\n\n gl.uniform2f(program.uniforms.u_pattern_size_a, imagePosA.displaySize[0] * image.fromScale / tileRatio, imagePosA.displaySize[1]);\n gl.uniform2f(program.uniforms.u_pattern_size_b, imagePosB.displaySize[0] * image.toScale / tileRatio, imagePosB.displaySize[1]);\n\n const {width, height} = painter.imageManager.getPixelSize();\n gl.uniform2fv(program.uniforms.u_texsize, [width, height]);\n }\n\n gl.uniform2f(program.uniforms.u_gl_units_to_pixels, 1 / painter.transform.pixelsToGLUnits[0], 1 / painter.transform.pixelsToGLUnits[1]);\n }\n\n if (programChanged) {\n\n if (dasharray) {\n gl.uniform1i(program.uniforms.u_image, 0);\n context.activeTexture.set(gl.TEXTURE0);\n painter.lineAtlas.bind(context);\n\n gl.uniform1f(program.uniforms.u_tex_y_a, (posA: any).y);\n gl.uniform1f(program.uniforms.u_tex_y_b, (posB: any).y);\n gl.uniform1f(program.uniforms.u_mix, dasharray.t);\n\n } else if (image) {\n gl.uniform1i(program.uniforms.u_image, 0);\n context.activeTexture.set(gl.TEXTURE0);\n painter.imageManager.bind(context);\n\n gl.uniform2fv(program.uniforms.u_pattern_tl_a, (imagePosA: any).tl);\n gl.uniform2fv(program.uniforms.u_pattern_br_a, (imagePosA: any).br);\n gl.uniform2fv(program.uniforms.u_pattern_tl_b, (imagePosB: any).tl);\n gl.uniform2fv(program.uniforms.u_pattern_br_b, (imagePosB: any).br);\n gl.uniform1f(program.uniforms.u_fade, image.t);\n }\n }\n\n context.setStencilMode(painter.stencilModeForClipping(coord));\n\n const posMatrix = painter.translatePosMatrix(coord.posMatrix, tile, layer.paint.get('line-translate'), layer.paint.get('line-translate-anchor'));\n gl.uniformMatrix4fv(program.uniforms.u_matrix, false, posMatrix);\n\n gl.uniform1f(program.uniforms.u_ratio, 1 / pixelsToTileUnits(tile, 1, painter.transform.zoom));\n\n if (layer.paint.get('line-gradient')) {\n context.activeTexture.set(gl.TEXTURE0);\n\n let gradientTexture = layer.gradientTexture;\n if (!layer.gradient) return;\n if (!gradientTexture) gradientTexture = layer.gradientTexture = new Texture(context, layer.gradient, gl.RGBA);\n gradientTexture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n\n gl.uniform1i(program.uniforms.u_image, 0);\n }\n\n program.draw(\n context,\n gl.TRIANGLES,\n layer.id,\n bucket.layoutVertexBuffer,\n bucket.indexBuffer,\n bucket.segments,\n programConfiguration);\n}\n","// @flow\n\nimport assert from 'assert';\n\nimport pixelsToTileUnits from '../source/pixels_to_tile_units';\n\nimport type Painter from './painter';\nimport type Program from './program';\nimport type {OverscaledTileID} from '../source/tile_id';\nimport type {CrossFaded} from '../style/cross_faded';\n\n/**\n * Checks whether a pattern image is needed, and if it is, whether it is not loaded.\n * @private\n * @returns true if a needed image is missing and rendering needs to be skipped.\n */\nexport const isPatternMissing = function(image: ?CrossFaded, painter: Painter): boolean {\n if (!image) return false;\n const imagePosA = painter.imageManager.getPattern(image.from);\n const imagePosB = painter.imageManager.getPattern(image.to);\n return !imagePosA || !imagePosB;\n};\n\nexport const prepare = function (image: CrossFaded, painter: Painter, program: Program) {\n const context = painter.context;\n const gl = context.gl;\n\n const imagePosA = painter.imageManager.getPattern(image.from);\n const imagePosB = painter.imageManager.getPattern(image.to);\n assert(imagePosA && imagePosB);\n\n gl.uniform1i(program.uniforms.u_image, 0);\n gl.uniform2fv(program.uniforms.u_pattern_tl_a, (imagePosA: any).tl);\n gl.uniform2fv(program.uniforms.u_pattern_br_a, (imagePosA: any).br);\n gl.uniform2fv(program.uniforms.u_pattern_tl_b, (imagePosB: any).tl);\n gl.uniform2fv(program.uniforms.u_pattern_br_b, (imagePosB: any).br);\n const {width, height} = painter.imageManager.getPixelSize();\n gl.uniform2fv(program.uniforms.u_texsize, [width, height]);\n gl.uniform1f(program.uniforms.u_mix, image.t);\n gl.uniform2fv(program.uniforms.u_pattern_size_a, (imagePosA: any).displaySize);\n gl.uniform2fv(program.uniforms.u_pattern_size_b, (imagePosB: any).displaySize);\n gl.uniform1f(program.uniforms.u_scale_a, image.fromScale);\n gl.uniform1f(program.uniforms.u_scale_b, image.toScale);\n\n context.activeTexture.set(gl.TEXTURE0);\n painter.imageManager.bind(painter.context);\n};\n\nexport const setPatternUniforms = function (tile: {tileID: OverscaledTileID, tileSize: number}, painter: Painter, program: Program) {\n const gl = painter.context.gl;\n\n gl.uniform1f(program.uniforms.u_tile_units_to_pixels, 1 / pixelsToTileUnits(tile, 1, painter.transform.tileZoom));\n\n const numTiles = Math.pow(2, tile.tileID.overscaledZ);\n const tileSizeAtNearestZoom = tile.tileSize * Math.pow(2, painter.transform.tileZoom) / numTiles;\n\n const pixelX = tileSizeAtNearestZoom * (tile.tileID.canonical.x + tile.tileID.wrap * numTiles);\n const pixelY = tileSizeAtNearestZoom * tile.tileID.canonical.y;\n\n // split the pixel coord into two pairs of 16 bit numbers. The glsl spec only guarantees 16 bits of precision.\n gl.uniform2f(program.uniforms.u_pixel_coord_upper, pixelX >> 16, pixelY >> 16);\n gl.uniform2f(program.uniforms.u_pixel_coord_lower, pixelX & 0xFFFF, pixelY & 0xFFFF);\n};\n","// @flow\n\nimport {\n isPatternMissing,\n setPatternUniforms,\n prepare as preparePattern\n} from './pattern';\n\nimport Color from '../style-spec/util/color';\nimport DepthMode from '../gl/depth_mode';\n\nimport type Painter from './painter';\nimport type SourceCache from '../source/source_cache';\nimport type FillStyleLayer from '../style/style_layer/fill_style_layer';\nimport type FillBucket from '../data/bucket/fill_bucket';\nimport type {OverscaledTileID} from '../source/tile_id';\nimport type {CrossFaded} from '../style/cross_faded';\n\nexport default drawFill;\n\nfunction drawFill(painter: Painter, sourceCache: SourceCache, layer: FillStyleLayer, coords: Array) {\n const color = layer.paint.get('fill-color');\n const opacity = layer.paint.get('fill-opacity');\n\n if (opacity.constantOr(1) === 0) {\n return;\n }\n\n const context = painter.context;\n context.setColorMode(painter.colorModeForRenderPass());\n\n const pass = (!layer.paint.get('fill-pattern') &&\n color.constantOr(Color.transparent).a === 1 &&\n opacity.constantOr(0) === 1) ? 'opaque' : 'translucent';\n\n // Draw fill\n if (painter.renderPass === pass) {\n // Once we switch to earcut drawing we can pull most of the WebGL setup\n // outside of this coords loop.\n context.setDepthMode(painter.depthModeForSublayer(1, painter.renderPass === 'opaque' ? DepthMode.ReadWrite : DepthMode.ReadOnly));\n drawFillTiles(painter, sourceCache, layer, coords, drawFillTile);\n }\n\n // Draw stroke\n if (painter.renderPass === 'translucent' && layer.paint.get('fill-antialias')) {\n context.lineWidth.set(2);\n\n // If we defined a different color for the fill outline, we are\n // going to ignore the bits in 0x07 and just care about the global\n // clipping mask.\n // Otherwise, we only want to drawFill the antialiased parts that are\n // *outside* the current shape. This is important in case the fill\n // or stroke color is translucent. If we wouldn't clip to outside\n // the current shape, some pixels from the outline stroke overlapped\n // the (non-antialiased) fill.\n context.setDepthMode(painter.depthModeForSublayer(\n layer.getPaintProperty('fill-outline-color') ? 2 : 0, DepthMode.ReadOnly));\n drawFillTiles(painter, sourceCache, layer, coords, drawStrokeTile);\n }\n}\n\nfunction drawFillTiles(painter, sourceCache, layer, coords, drawFn) {\n if (isPatternMissing(layer.paint.get('fill-pattern'), painter)) return;\n\n let firstTile = true;\n for (const coord of coords) {\n const tile = sourceCache.getTile(coord);\n const bucket: ?FillBucket = (tile.getBucket(layer): any);\n if (!bucket) continue;\n\n painter.context.setStencilMode(painter.stencilModeForClipping(coord));\n drawFn(painter, sourceCache, layer, tile, coord, bucket, firstTile);\n firstTile = false;\n }\n}\n\nfunction drawFillTile(painter, sourceCache, layer, tile, coord, bucket, firstTile) {\n const gl = painter.context.gl;\n const programConfiguration = bucket.programConfigurations.get(layer.id);\n\n const program = setFillProgram('fill', layer.paint.get('fill-pattern'), painter, programConfiguration, layer, tile, coord, firstTile);\n\n program.draw(\n painter.context,\n gl.TRIANGLES,\n layer.id,\n bucket.layoutVertexBuffer,\n bucket.indexBuffer,\n bucket.segments,\n programConfiguration);\n}\n\nfunction drawStrokeTile(painter, sourceCache, layer, tile, coord, bucket, firstTile) {\n const gl = painter.context.gl;\n const programConfiguration = bucket.programConfigurations.get(layer.id);\n const pattern = layer.getPaintProperty('fill-outline-color') ? null : layer.paint.get('fill-pattern');\n\n const program = setFillProgram('fillOutline', pattern, painter, programConfiguration, layer, tile, coord, firstTile);\n gl.uniform2f(program.uniforms.u_world, gl.drawingBufferWidth, gl.drawingBufferHeight);\n\n program.draw(\n painter.context,\n gl.LINES,\n layer.id,\n bucket.layoutVertexBuffer,\n bucket.indexBuffer2,\n bucket.segments2,\n programConfiguration);\n}\n\nfunction setFillProgram(programId, pat: ?CrossFaded, painter, programConfiguration, layer, tile, coord, firstTile) {\n let program;\n const prevProgram = painter.context.program.get();\n if (!pat) {\n program = painter.useProgram(programId, programConfiguration);\n if (firstTile || program.program !== prevProgram) {\n programConfiguration.setUniforms(painter.context, program, layer.paint, {zoom: painter.transform.zoom});\n }\n } else {\n program = painter.useProgram(`${programId}Pattern`, programConfiguration);\n if (firstTile || program.program !== prevProgram) {\n programConfiguration.setUniforms(painter.context, program, layer.paint, {zoom: painter.transform.zoom});\n preparePattern(pat, painter, program);\n }\n setPatternUniforms(tile, painter, program);\n }\n painter.context.gl.uniformMatrix4fv(program.uniforms.u_matrix, false, painter.translatePosMatrix(\n coord.posMatrix, tile,\n layer.paint.get('fill-translate'),\n layer.paint.get('fill-translate-anchor')\n ));\n return program;\n}\n","// @flow\n\nimport glMatrix from '@mapbox/gl-matrix';\n\nimport {\n isPatternMissing,\n setPatternUniforms,\n prepare as preparePattern\n} from './pattern';\nimport Texture from './texture';\nimport Color from '../style-spec/util/color';\nimport DepthMode from '../gl/depth_mode';\nconst mat3 = glMatrix.mat3;\nconst mat4 = glMatrix.mat4;\nconst vec3 = glMatrix.vec3;\nimport StencilMode from '../gl/stencil_mode';\n\nimport type Painter from './painter';\nimport type SourceCache from '../source/source_cache';\nimport type FillExtrusionStyleLayer from '../style/style_layer/fill_extrusion_style_layer';\nimport type FillExtrusionBucket from '../data/bucket/fill_extrusion_bucket';\nimport type {OverscaledTileID} from '../source/tile_id';\n\nexport default draw;\n\nfunction draw(painter: Painter, source: SourceCache, layer: FillExtrusionStyleLayer, coords: Array) {\n if (layer.paint.get('fill-extrusion-opacity') === 0) {\n return;\n }\n\n if (painter.renderPass === 'offscreen') {\n drawToExtrusionFramebuffer(painter, layer);\n\n let first = true;\n for (const coord of coords) {\n const tile = source.getTile(coord);\n const bucket: ?FillExtrusionBucket = (tile.getBucket(layer): any);\n if (!bucket) continue;\n\n drawExtrusion(painter, source, layer, tile, coord, bucket, first);\n first = false;\n }\n } else if (painter.renderPass === 'translucent') {\n drawExtrusionTexture(painter, layer);\n }\n}\n\nfunction drawToExtrusionFramebuffer(painter, layer) {\n const context = painter.context;\n const gl = context.gl;\n\n let renderTarget = layer.viewportFrame;\n\n if (painter.depthRboNeedsClear) {\n painter.setupOffscreenDepthRenderbuffer();\n }\n\n if (!renderTarget) {\n const texture = new Texture(context, {width: painter.width, height: painter.height, data: null}, gl.RGBA);\n texture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n\n renderTarget = layer.viewportFrame = context.createFramebuffer(painter.width, painter.height);\n renderTarget.colorAttachment.set(texture.texture);\n }\n\n context.bindFramebuffer.set(renderTarget.framebuffer);\n renderTarget.depthAttachment.set(painter.depthRbo);\n\n if (painter.depthRboNeedsClear) {\n context.clear({ depth: 1 });\n painter.depthRboNeedsClear = false;\n }\n\n context.clear({ color: Color.transparent });\n\n context.setStencilMode(StencilMode.disabled);\n context.setDepthMode(new DepthMode(gl.LEQUAL, DepthMode.ReadWrite, [0, 1]));\n context.setColorMode(painter.colorModeForRenderPass());\n}\n\nfunction drawExtrusionTexture(painter, layer) {\n const renderedTexture = layer.viewportFrame;\n if (!renderedTexture) return;\n\n const context = painter.context;\n const gl = context.gl;\n const program = painter.useProgram('extrusionTexture');\n\n context.setStencilMode(StencilMode.disabled);\n context.setDepthMode(DepthMode.disabled);\n context.setColorMode(painter.colorModeForRenderPass());\n\n context.activeTexture.set(gl.TEXTURE0);\n gl.bindTexture(gl.TEXTURE_2D, renderedTexture.colorAttachment.get());\n\n gl.uniform1f(program.uniforms.u_opacity, layer.paint.get('fill-extrusion-opacity'));\n gl.uniform1i(program.uniforms.u_image, 0);\n\n const matrix = mat4.create();\n mat4.ortho(matrix, 0, painter.width, painter.height, 0, 0, 1);\n gl.uniformMatrix4fv(program.uniforms.u_matrix, false, matrix);\n\n gl.uniform2f(program.uniforms.u_world, gl.drawingBufferWidth, gl.drawingBufferHeight);\n\n painter.viewportVAO.bind(context, program, painter.viewportBuffer, []);\n gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);\n}\n\nfunction drawExtrusion(painter, source, layer, tile, coord, bucket, first) {\n const context = painter.context;\n const gl = context.gl;\n\n const image = layer.paint.get('fill-extrusion-pattern');\n\n const prevProgram = painter.context.program.get();\n const programConfiguration = bucket.programConfigurations.get(layer.id);\n const program = painter.useProgram(image ? 'fillExtrusionPattern' : 'fillExtrusion', programConfiguration);\n if (first || program.program !== prevProgram) {\n programConfiguration.setUniforms(context, program, layer.paint, {zoom: painter.transform.zoom});\n }\n\n if (image) {\n if (isPatternMissing(image, painter)) return;\n preparePattern(image, painter, program);\n setPatternUniforms(tile, painter, program);\n gl.uniform1f(program.uniforms.u_height_factor, -Math.pow(2, coord.overscaledZ) / tile.tileSize / 8);\n }\n\n painter.context.gl.uniformMatrix4fv(program.uniforms.u_matrix, false, painter.translatePosMatrix(\n coord.posMatrix,\n tile,\n layer.paint.get('fill-extrusion-translate'),\n layer.paint.get('fill-extrusion-translate-anchor')\n ));\n\n setLight(program, painter);\n\n program.draw(\n context,\n gl.TRIANGLES,\n layer.id,\n bucket.layoutVertexBuffer,\n bucket.indexBuffer,\n bucket.segments,\n programConfiguration);\n}\n\nfunction setLight(program, painter) {\n const gl = painter.context.gl;\n const light = painter.style.light;\n\n const _lp = light.properties.get('position');\n const lightPos = [_lp.x, _lp.y, _lp.z];\n\n const lightMat = mat3.create();\n if (light.properties.get('anchor') === 'viewport') {\n mat3.fromRotation(lightMat, -painter.transform.angle);\n }\n vec3.transformMat3(lightPos, lightPos, lightMat);\n\n const color = light.properties.get('color');\n\n gl.uniform3fv(program.uniforms.u_lightpos, lightPos);\n gl.uniform1f(program.uniforms.u_lightintensity, light.properties.get('intensity'));\n gl.uniform3f(program.uniforms.u_lightcolor, color.r, color.g, color.b);\n}\n","// @flow\nimport Coordinate from '../geo/coordinate';\n\nimport Texture from './texture';\nimport EXTENT from '../data/extent';\nimport { mat4 } from '@mapbox/gl-matrix';\nimport StencilMode from '../gl/stencil_mode';\nimport DepthMode from '../gl/depth_mode';\n\nimport type Painter from './painter';\nimport type SourceCache from '../source/source_cache';\nimport type HillshadeStyleLayer from '../style/style_layer/hillshade_style_layer';\nimport type {OverscaledTileID} from '../source/tile_id';\n\nexport default drawHillshade;\n\nfunction drawHillshade(painter: Painter, sourceCache: SourceCache, layer: HillshadeStyleLayer, tileIDs: Array) {\n if (painter.renderPass !== 'offscreen' && painter.renderPass !== 'translucent') return;\n\n const context = painter.context;\n const sourceMaxZoom = sourceCache.getSource().maxzoom;\n\n context.setDepthMode(painter.depthModeForSublayer(0, DepthMode.ReadOnly));\n context.setStencilMode(StencilMode.disabled);\n context.setColorMode(painter.colorModeForRenderPass());\n\n for (const tileID of tileIDs) {\n const tile = sourceCache.getTile(tileID);\n if (tile.needsHillshadePrepare && painter.renderPass === 'offscreen') {\n prepareHillshade(painter, tile, sourceMaxZoom);\n continue;\n } else if (painter.renderPass === 'translucent') {\n renderHillshade(painter, tile, layer);\n }\n }\n\n context.viewport.set([0, 0, painter.width, painter.height]);\n}\n\nfunction setLight(program, painter, layer) {\n let azimuthal = layer.paint.get('hillshade-illumination-direction') * (Math.PI / 180);\n // modify azimuthal angle by map rotation if light is anchored at the viewport\n if (layer.paint.get('hillshade-illumination-anchor') === 'viewport') azimuthal -= painter.transform.angle;\n painter.context.gl.uniform2f(program.uniforms.u_light, layer.paint.get('hillshade-exaggeration'), azimuthal);\n\n}\n\nfunction getTileLatRange(painter, tileID: OverscaledTileID) {\n const coordinate0 = tileID.toCoordinate();\n const coordinate1 = new Coordinate(coordinate0.column, coordinate0.row + 1, coordinate0.zoom);\n return [painter.transform.coordinateLocation(coordinate0).lat, painter.transform.coordinateLocation(coordinate1).lat];\n}\n\nfunction renderHillshade(painter, tile, layer) {\n const context = painter.context;\n const gl = context.gl;\n const fbo = tile.fbo;\n if (!fbo) return;\n\n const program = painter.useProgram('hillshade');\n const posMatrix = painter.transform.calculatePosMatrix(tile.tileID.toUnwrapped(), true);\n setLight(program, painter, layer);\n // for scaling the magnitude of a points slope by its latitude\n const latRange = getTileLatRange(painter, tile.tileID);\n context.activeTexture.set(gl.TEXTURE0);\n\n gl.bindTexture(gl.TEXTURE_2D, fbo.colorAttachment.get());\n\n gl.uniformMatrix4fv(program.uniforms.u_matrix, false, posMatrix);\n gl.uniform2fv(program.uniforms.u_latrange, latRange);\n gl.uniform1i(program.uniforms.u_image, 0);\n\n const shadowColor = layer.paint.get(\"hillshade-shadow-color\");\n gl.uniform4f(program.uniforms.u_shadow, shadowColor.r, shadowColor.g, shadowColor.b, shadowColor.a);\n const highlightColor = layer.paint.get(\"hillshade-highlight-color\");\n gl.uniform4f(program.uniforms.u_highlight, highlightColor.r, highlightColor.g, highlightColor.b, highlightColor.a);\n const accentColor = layer.paint.get(\"hillshade-accent-color\");\n gl.uniform4f(program.uniforms.u_accent, accentColor.r, accentColor.g, accentColor.b, accentColor.a);\n\n if (tile.maskedBoundsBuffer && tile.maskedIndexBuffer && tile.segments) {\n program.draw(\n context,\n gl.TRIANGLES,\n layer.id,\n tile.maskedBoundsBuffer,\n tile.maskedIndexBuffer,\n tile.segments\n );\n } else {\n const buffer = painter.rasterBoundsBuffer;\n const vao = painter.rasterBoundsVAO;\n vao.bind(context, program, buffer, []);\n gl.drawArrays(gl.TRIANGLE_STRIP, 0, buffer.length);\n }\n}\n\n\n// hillshade rendering is done in two steps. the prepare step first calculates the slope of the terrain in the x and y\n// directions for each pixel, and saves those values to a framebuffer texture in the r and g channels.\nfunction prepareHillshade(painter, tile, sourceMaxZoom) {\n const context = painter.context;\n const gl = context.gl;\n // decode rgba levels by using integer overflow to convert each Uint32Array element -> 4 Uint8Array elements.\n // ex.\n // Uint32:\n // base 10 - 67308\n // base 2 - 0000 0000 0000 0001 0000 0110 1110 1100\n //\n // Uint8:\n // base 10 - 0, 1, 6, 236 (this order is reversed in the resulting array via the overflow.\n // first 8 bits represent 236, so the r component of the texture pixel will be 236 etc.)\n // base 2 - 0000 0000, 0000 0001, 0000 0110, 1110 1100\n if (tile.dem && tile.dem.level) {\n const tileSize = tile.dem.level.dim;\n\n const pixelData = tile.dem.getPixels();\n context.activeTexture.set(gl.TEXTURE1);\n\n // if UNPACK_PREMULTIPLY_ALPHA_WEBGL is set to true prior to drawHillshade being called\n // tiles will appear blank, because as you can see above the alpha value for these textures\n // is always 0\n context.pixelStoreUnpackPremultiplyAlpha.set(false);\n tile.demTexture = tile.demTexture || painter.getTileTexture(tile.tileSize);\n if (tile.demTexture) {\n const demTexture = tile.demTexture;\n demTexture.update(pixelData, { premultiply: false });\n demTexture.bind(gl.NEAREST, gl.CLAMP_TO_EDGE);\n } else {\n tile.demTexture = new Texture(context, pixelData, gl.RGBA, { premultiply: false });\n tile.demTexture.bind(gl.NEAREST, gl.CLAMP_TO_EDGE);\n }\n\n context.activeTexture.set(gl.TEXTURE0);\n\n let fbo = tile.fbo;\n\n if (!fbo) {\n const renderTexture = new Texture(context, {width: tileSize, height: tileSize, data: null}, gl.RGBA);\n renderTexture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n\n fbo = tile.fbo = context.createFramebuffer(tileSize, tileSize);\n fbo.colorAttachment.set(renderTexture.texture);\n }\n\n context.bindFramebuffer.set(fbo.framebuffer);\n context.viewport.set([0, 0, tileSize, tileSize]);\n\n const matrix = mat4.create();\n // Flip rendering at y axis.\n mat4.ortho(matrix, 0, EXTENT, -EXTENT, 0, 0, 1);\n mat4.translate(matrix, matrix, [0, -EXTENT, 0]);\n\n const program = painter.useProgram('hillshadePrepare');\n\n gl.uniformMatrix4fv(program.uniforms.u_matrix, false, matrix);\n gl.uniform1f(program.uniforms.u_zoom, tile.tileID.overscaledZ);\n gl.uniform2fv(program.uniforms.u_dimension, [tileSize * 2, tileSize * 2]);\n gl.uniform1i(program.uniforms.u_image, 1);\n gl.uniform1f(program.uniforms.u_maxzoom, sourceMaxZoom);\n\n const buffer = painter.rasterBoundsBuffer;\n const vao = painter.rasterBoundsVAO;\n\n vao.bind(context, program, buffer, []);\n gl.drawArrays(gl.TRIANGLE_STRIP, 0, buffer.length);\n\n tile.needsHillshadePrepare = false;\n }\n}\n","// @flow\n\nimport { clamp } from '../util/util';\n\nimport ImageSource from '../source/image_source';\nimport browser from '../util/browser';\nimport StencilMode from '../gl/stencil_mode';\nimport DepthMode from '../gl/depth_mode';\n\nimport type Painter from './painter';\nimport type SourceCache from '../source/source_cache';\nimport type RasterStyleLayer from '../style/style_layer/raster_style_layer';\nimport type {OverscaledTileID} from '../source/tile_id';\n\nexport default drawRaster;\n\nfunction drawRaster(painter: Painter, sourceCache: SourceCache, layer: RasterStyleLayer, coords: Array) {\n if (painter.renderPass !== 'translucent') return;\n if (layer.paint.get('raster-opacity') === 0) return;\n\n const context = painter.context;\n const gl = context.gl;\n const source = sourceCache.getSource();\n const program = painter.useProgram('raster');\n\n context.setStencilMode(StencilMode.disabled);\n context.setColorMode(painter.colorModeForRenderPass());\n\n // Constant parameters.\n gl.uniform1f(program.uniforms.u_brightness_low, layer.paint.get('raster-brightness-min'));\n gl.uniform1f(program.uniforms.u_brightness_high, layer.paint.get('raster-brightness-max'));\n gl.uniform1f(program.uniforms.u_saturation_factor, saturationFactor(layer.paint.get('raster-saturation')));\n gl.uniform1f(program.uniforms.u_contrast_factor, contrastFactor(layer.paint.get('raster-contrast')));\n gl.uniform3fv(program.uniforms.u_spin_weights, spinWeights(layer.paint.get('raster-hue-rotate')));\n gl.uniform1f(program.uniforms.u_buffer_scale, 1);\n gl.uniform1i(program.uniforms.u_image0, 0);\n gl.uniform1i(program.uniforms.u_image1, 1);\n\n const minTileZ = coords.length && coords[0].overscaledZ;\n\n for (const coord of coords) {\n // Set the lower zoom level to sublayer 0, and higher zoom levels to higher sublayers\n // Use gl.LESS to prevent double drawing in areas where tiles overlap.\n context.setDepthMode(painter.depthModeForSublayer(coord.overscaledZ - minTileZ,\n layer.paint.get('raster-opacity') === 1 ? DepthMode.ReadWrite : DepthMode.ReadOnly, gl.LESS));\n\n const tile = sourceCache.getTile(coord);\n const posMatrix = painter.transform.calculatePosMatrix(coord.toUnwrapped(), true);\n\n tile.registerFadeDuration(layer.paint.get('raster-fade-duration'));\n\n gl.uniformMatrix4fv(program.uniforms.u_matrix, false, posMatrix);\n\n const parentTile = sourceCache.findLoadedParent(coord, 0, {}),\n fade = getFadeValues(tile, parentTile, sourceCache, layer, painter.transform);\n\n let parentScaleBy, parentTL;\n\n context.activeTexture.set(gl.TEXTURE0);\n tile.texture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE, gl.LINEAR_MIPMAP_NEAREST);\n\n context.activeTexture.set(gl.TEXTURE1);\n\n if (parentTile) {\n parentTile.texture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE, gl.LINEAR_MIPMAP_NEAREST);\n parentScaleBy = Math.pow(2, parentTile.tileID.overscaledZ - tile.tileID.overscaledZ);\n parentTL = [tile.tileID.canonical.x * parentScaleBy % 1, tile.tileID.canonical.y * parentScaleBy % 1];\n\n } else {\n tile.texture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE, gl.LINEAR_MIPMAP_NEAREST);\n }\n\n // cross-fade parameters\n gl.uniform2fv(program.uniforms.u_tl_parent, parentTL || [0, 0]);\n gl.uniform1f(program.uniforms.u_scale_parent, parentScaleBy || 1);\n gl.uniform1f(program.uniforms.u_fade_t, fade.mix);\n gl.uniform1f(program.uniforms.u_opacity, fade.opacity * layer.paint.get('raster-opacity'));\n\n\n if (source instanceof ImageSource) {\n const buffer = source.boundsBuffer;\n const vao = source.boundsVAO;\n vao.bind(context, program, buffer, []);\n gl.drawArrays(gl.TRIANGLE_STRIP, 0, buffer.length);\n } else if (tile.maskedBoundsBuffer && tile.maskedIndexBuffer && tile.segments) {\n program.draw(\n context,\n gl.TRIANGLES,\n layer.id,\n tile.maskedBoundsBuffer,\n tile.maskedIndexBuffer,\n tile.segments\n );\n } else {\n const buffer = painter.rasterBoundsBuffer;\n const vao = painter.rasterBoundsVAO;\n vao.bind(context, program, buffer, []);\n gl.drawArrays(gl.TRIANGLE_STRIP, 0, buffer.length);\n }\n }\n}\n\nfunction spinWeights(angle) {\n angle *= Math.PI / 180;\n const s = Math.sin(angle);\n const c = Math.cos(angle);\n return [\n (2 * c + 1) / 3,\n (-Math.sqrt(3) * s - c + 1) / 3,\n (Math.sqrt(3) * s - c + 1) / 3\n ];\n}\n\nfunction contrastFactor(contrast) {\n return contrast > 0 ?\n 1 / (1 - contrast) :\n 1 + contrast;\n}\n\nfunction saturationFactor(saturation) {\n return saturation > 0 ?\n 1 - 1 / (1.001 - saturation) :\n -saturation;\n}\n\nfunction getFadeValues(tile, parentTile, sourceCache, layer, transform) {\n const fadeDuration = layer.paint.get('raster-fade-duration');\n\n if (fadeDuration > 0) {\n const now = browser.now();\n const sinceTile = (now - tile.timeAdded) / fadeDuration;\n const sinceParent = parentTile ? (now - parentTile.timeAdded) / fadeDuration : -1;\n\n const source = sourceCache.getSource();\n const idealZ = transform.coveringZoomLevel({\n tileSize: source.tileSize,\n roundZoom: source.roundZoom\n });\n\n // if no parent or parent is older, fade in; if parent is younger, fade out\n const fadeIn = !parentTile || Math.abs(parentTile.tileID.overscaledZ - idealZ) > Math.abs(tile.tileID.overscaledZ - idealZ);\n\n const childOpacity = (fadeIn && tile.refreshedUponExpiration) ? 1 : clamp(fadeIn ? sinceTile : 1 - sinceParent, 0, 1);\n\n // we don't crossfade tiles that were just refreshed upon expiring:\n // once they're old enough to pass the crossfading threshold\n // (fadeDuration), unset the `refreshedUponExpiration` flag so we don't\n // incorrectly fail to crossfade them when zooming\n if (tile.refreshedUponExpiration && sinceTile >= 1) tile.refreshedUponExpiration = false;\n\n if (parentTile) {\n return {\n opacity: 1,\n mix: 1 - childOpacity\n };\n } else {\n return {\n opacity: childOpacity,\n mix: 0\n };\n }\n } else {\n return {\n opacity: 1,\n mix: 0\n };\n }\n}\n","// @flow\n\nimport browser from '../util/browser';\n\nimport { mat4 } from '@mapbox/gl-matrix';\nimport EXTENT from '../data/extent';\nimport VertexArrayObject from './vertex_array_object';\nimport { PosArray } from '../data/array_types';\nimport posAttributes from '../data/pos_attributes';\nimport DepthMode from '../gl/depth_mode';\nimport StencilMode from '../gl/stencil_mode';\n\nimport type Painter from './painter';\nimport type SourceCache from '../source/source_cache';\nimport type {OverscaledTileID} from '../source/tile_id';\n\nexport default drawDebug;\n\nfunction drawDebug(painter: Painter, sourceCache: SourceCache, coords: Array) {\n for (let i = 0; i < coords.length; i++) {\n drawDebugTile(painter, sourceCache, coords[i]);\n }\n}\n\nfunction drawDebugTile(painter, sourceCache, coord) {\n const context = painter.context;\n const gl = context.gl;\n\n context.lineWidth.set(1 * browser.devicePixelRatio);\n\n const posMatrix = coord.posMatrix;\n const program = painter.useProgram('debug');\n\n context.setDepthMode(DepthMode.disabled);\n context.setStencilMode(StencilMode.disabled);\n context.setColorMode(painter.colorModeForRenderPass());\n\n gl.uniformMatrix4fv(program.uniforms.u_matrix, false, posMatrix);\n gl.uniform4f(program.uniforms.u_color, 1, 0, 0, 1);\n painter.debugVAO.bind(context, program, painter.debugBuffer, []);\n gl.drawArrays(gl.LINE_STRIP, 0, painter.debugBuffer.length);\n\n const vertices = createTextVerticies(coord.toString(), 50, 200, 5);\n const debugTextArray = new PosArray();\n for (let v = 0; v < vertices.length; v += 2) {\n debugTextArray.emplaceBack(vertices[v], vertices[v + 1]);\n }\n const debugTextBuffer = context.createVertexBuffer(debugTextArray, posAttributes.members);\n const debugTextVAO = new VertexArrayObject();\n debugTextVAO.bind(context, program, debugTextBuffer, []);\n gl.uniform4f(program.uniforms.u_color, 1, 1, 1, 1);\n\n // Draw the halo with multiple 1px lines instead of one wider line because\n // the gl spec doesn't guarantee support for lines with width > 1.\n const tileSize = sourceCache.getTile(coord).tileSize;\n const onePixel = EXTENT / (Math.pow(2, painter.transform.zoom - coord.overscaledZ) * tileSize);\n const translations = [[-1, -1], [-1, 1], [1, -1], [1, 1]];\n for (let i = 0; i < translations.length; i++) {\n const translation = translations[i];\n gl.uniformMatrix4fv(program.uniforms.u_matrix, false, mat4.translate([], posMatrix, [onePixel * translation[0], onePixel * translation[1], 0]));\n gl.drawArrays(gl.LINES, 0, debugTextBuffer.length);\n }\n\n gl.uniform4f(program.uniforms.u_color, 0, 0, 0, 1);\n gl.uniformMatrix4fv(program.uniforms.u_matrix, false, posMatrix);\n gl.drawArrays(gl.LINES, 0, debugTextBuffer.length);\n}\n\n// Font data From Hershey Simplex Font\n// http://paulbourke.net/dataformats/hershey/\nconst simplexFont = {\n \" \": [16, []],\n \"!\": [10, [5, 21, 5, 7, -1, -1, 5, 2, 4, 1, 5, 0, 6, 1, 5, 2]],\n \"\\\"\": [16, [4, 21, 4, 14, -1, -1, 12, 21, 12, 14]],\n \"#\": [21, [11, 25, 4, -7, -1, -1, 17, 25, 10, -7, -1, -1, 4, 12, 18, 12, -1, -1, 3, 6, 17, 6]],\n \"$\": [20, [8, 25, 8, -4, -1, -1, 12, 25, 12, -4, -1, -1, 17, 18, 15, 20, 12, 21, 8, 21, 5, 20, 3, 18, 3, 16, 4, 14, 5, 13, 7, 12, 13, 10, 15, 9, 16, 8, 17, 6, 17, 3, 15, 1, 12, 0, 8, 0, 5, 1, 3, 3]],\n \"%\": [24, [21, 21, 3, 0, -1, -1, 8, 21, 10, 19, 10, 17, 9, 15, 7, 14, 5, 14, 3, 16, 3, 18, 4, 20, 6, 21, 8, 21, 10, 20, 13, 19, 16, 19, 19, 20, 21, 21, -1, -1, 17, 7, 15, 6, 14, 4, 14, 2, 16, 0, 18, 0, 20, 1, 21, 3, 21, 5, 19, 7, 17, 7]],\n \"&\": [26, [23, 12, 23, 13, 22, 14, 21, 14, 20, 13, 19, 11, 17, 6, 15, 3, 13, 1, 11, 0, 7, 0, 5, 1, 4, 2, 3, 4, 3, 6, 4, 8, 5, 9, 12, 13, 13, 14, 14, 16, 14, 18, 13, 20, 11, 21, 9, 20, 8, 18, 8, 16, 9, 13, 11, 10, 16, 3, 18, 1, 20, 0, 22, 0, 23, 1, 23, 2]],\n \"'\": [10, [5, 19, 4, 20, 5, 21, 6, 20, 6, 18, 5, 16, 4, 15]],\n \"(\": [14, [11, 25, 9, 23, 7, 20, 5, 16, 4, 11, 4, 7, 5, 2, 7, -2, 9, -5, 11, -7]],\n \")\": [14, [3, 25, 5, 23, 7, 20, 9, 16, 10, 11, 10, 7, 9, 2, 7, -2, 5, -5, 3, -7]],\n \"*\": [16, [8, 21, 8, 9, -1, -1, 3, 18, 13, 12, -1, -1, 13, 18, 3, 12]],\n \"+\": [26, [13, 18, 13, 0, -1, -1, 4, 9, 22, 9]],\n \",\": [10, [6, 1, 5, 0, 4, 1, 5, 2, 6, 1, 6, -1, 5, -3, 4, -4]],\n \"-\": [26, [4, 9, 22, 9]],\n \".\": [10, [5, 2, 4, 1, 5, 0, 6, 1, 5, 2]],\n \"/\": [22, [20, 25, 2, -7]],\n \"0\": [20, [9, 21, 6, 20, 4, 17, 3, 12, 3, 9, 4, 4, 6, 1, 9, 0, 11, 0, 14, 1, 16, 4, 17, 9, 17, 12, 16, 17, 14, 20, 11, 21, 9, 21]],\n \"1\": [20, [6, 17, 8, 18, 11, 21, 11, 0]],\n \"2\": [20, [4, 16, 4, 17, 5, 19, 6, 20, 8, 21, 12, 21, 14, 20, 15, 19, 16, 17, 16, 15, 15, 13, 13, 10, 3, 0, 17, 0]],\n \"3\": [20, [5, 21, 16, 21, 10, 13, 13, 13, 15, 12, 16, 11, 17, 8, 17, 6, 16, 3, 14, 1, 11, 0, 8, 0, 5, 1, 4, 2, 3, 4]],\n \"4\": [20, [13, 21, 3, 7, 18, 7, -1, -1, 13, 21, 13, 0]],\n \"5\": [20, [15, 21, 5, 21, 4, 12, 5, 13, 8, 14, 11, 14, 14, 13, 16, 11, 17, 8, 17, 6, 16, 3, 14, 1, 11, 0, 8, 0, 5, 1, 4, 2, 3, 4]],\n \"6\": [20, [16, 18, 15, 20, 12, 21, 10, 21, 7, 20, 5, 17, 4, 12, 4, 7, 5, 3, 7, 1, 10, 0, 11, 0, 14, 1, 16, 3, 17, 6, 17, 7, 16, 10, 14, 12, 11, 13, 10, 13, 7, 12, 5, 10, 4, 7]],\n \"7\": [20, [17, 21, 7, 0, -1, -1, 3, 21, 17, 21]],\n \"8\": [20, [8, 21, 5, 20, 4, 18, 4, 16, 5, 14, 7, 13, 11, 12, 14, 11, 16, 9, 17, 7, 17, 4, 16, 2, 15, 1, 12, 0, 8, 0, 5, 1, 4, 2, 3, 4, 3, 7, 4, 9, 6, 11, 9, 12, 13, 13, 15, 14, 16, 16, 16, 18, 15, 20, 12, 21, 8, 21]],\n \"9\": [20, [16, 14, 15, 11, 13, 9, 10, 8, 9, 8, 6, 9, 4, 11, 3, 14, 3, 15, 4, 18, 6, 20, 9, 21, 10, 21, 13, 20, 15, 18, 16, 14, 16, 9, 15, 4, 13, 1, 10, 0, 8, 0, 5, 1, 4, 3]],\n \":\": [10, [5, 14, 4, 13, 5, 12, 6, 13, 5, 14, -1, -1, 5, 2, 4, 1, 5, 0, 6, 1, 5, 2]],\n \";\": [10, [5, 14, 4, 13, 5, 12, 6, 13, 5, 14, -1, -1, 6, 1, 5, 0, 4, 1, 5, 2, 6, 1, 6, -1, 5, -3, 4, -4]],\n \"<\": [24, [20, 18, 4, 9, 20, 0]],\n \"=\": [26, [4, 12, 22, 12, -1, -1, 4, 6, 22, 6]],\n \">\": [24, [4, 18, 20, 9, 4, 0]],\n \"?\": [18, [3, 16, 3, 17, 4, 19, 5, 20, 7, 21, 11, 21, 13, 20, 14, 19, 15, 17, 15, 15, 14, 13, 13, 12, 9, 10, 9, 7, -1, -1, 9, 2, 8, 1, 9, 0, 10, 1, 9, 2]],\n \"@\": [27, [18, 13, 17, 15, 15, 16, 12, 16, 10, 15, 9, 14, 8, 11, 8, 8, 9, 6, 11, 5, 14, 5, 16, 6, 17, 8, -1, -1, 12, 16, 10, 14, 9, 11, 9, 8, 10, 6, 11, 5, -1, -1, 18, 16, 17, 8, 17, 6, 19, 5, 21, 5, 23, 7, 24, 10, 24, 12, 23, 15, 22, 17, 20, 19, 18, 20, 15, 21, 12, 21, 9, 20, 7, 19, 5, 17, 4, 15, 3, 12, 3, 9, 4, 6, 5, 4, 7, 2, 9, 1, 12, 0, 15, 0, 18, 1, 20, 2, 21, 3, -1, -1, 19, 16, 18, 8, 18, 6, 19, 5]],\n \"A\": [18, [9, 21, 1, 0, -1, -1, 9, 21, 17, 0, -1, -1, 4, 7, 14, 7]],\n \"B\": [21, [4, 21, 4, 0, -1, -1, 4, 21, 13, 21, 16, 20, 17, 19, 18, 17, 18, 15, 17, 13, 16, 12, 13, 11, -1, -1, 4, 11, 13, 11, 16, 10, 17, 9, 18, 7, 18, 4, 17, 2, 16, 1, 13, 0, 4, 0]],\n \"C\": [21, [18, 16, 17, 18, 15, 20, 13, 21, 9, 21, 7, 20, 5, 18, 4, 16, 3, 13, 3, 8, 4, 5, 5, 3, 7, 1, 9, 0, 13, 0, 15, 1, 17, 3, 18, 5]],\n \"D\": [21, [4, 21, 4, 0, -1, -1, 4, 21, 11, 21, 14, 20, 16, 18, 17, 16, 18, 13, 18, 8, 17, 5, 16, 3, 14, 1, 11, 0, 4, 0]],\n \"E\": [19, [4, 21, 4, 0, -1, -1, 4, 21, 17, 21, -1, -1, 4, 11, 12, 11, -1, -1, 4, 0, 17, 0]],\n \"F\": [18, [4, 21, 4, 0, -1, -1, 4, 21, 17, 21, -1, -1, 4, 11, 12, 11]],\n \"G\": [21, [18, 16, 17, 18, 15, 20, 13, 21, 9, 21, 7, 20, 5, 18, 4, 16, 3, 13, 3, 8, 4, 5, 5, 3, 7, 1, 9, 0, 13, 0, 15, 1, 17, 3, 18, 5, 18, 8, -1, -1, 13, 8, 18, 8]],\n \"H\": [22, [4, 21, 4, 0, -1, -1, 18, 21, 18, 0, -1, -1, 4, 11, 18, 11]],\n \"I\": [8, [4, 21, 4, 0]],\n \"J\": [16, [12, 21, 12, 5, 11, 2, 10, 1, 8, 0, 6, 0, 4, 1, 3, 2, 2, 5, 2, 7]],\n \"K\": [21, [4, 21, 4, 0, -1, -1, 18, 21, 4, 7, -1, -1, 9, 12, 18, 0]],\n \"L\": [17, [4, 21, 4, 0, -1, -1, 4, 0, 16, 0]],\n \"M\": [24, [4, 21, 4, 0, -1, -1, 4, 21, 12, 0, -1, -1, 20, 21, 12, 0, -1, -1, 20, 21, 20, 0]],\n \"N\": [22, [4, 21, 4, 0, -1, -1, 4, 21, 18, 0, -1, -1, 18, 21, 18, 0]],\n \"O\": [22, [9, 21, 7, 20, 5, 18, 4, 16, 3, 13, 3, 8, 4, 5, 5, 3, 7, 1, 9, 0, 13, 0, 15, 1, 17, 3, 18, 5, 19, 8, 19, 13, 18, 16, 17, 18, 15, 20, 13, 21, 9, 21]],\n \"P\": [21, [4, 21, 4, 0, -1, -1, 4, 21, 13, 21, 16, 20, 17, 19, 18, 17, 18, 14, 17, 12, 16, 11, 13, 10, 4, 10]],\n \"Q\": [22, [9, 21, 7, 20, 5, 18, 4, 16, 3, 13, 3, 8, 4, 5, 5, 3, 7, 1, 9, 0, 13, 0, 15, 1, 17, 3, 18, 5, 19, 8, 19, 13, 18, 16, 17, 18, 15, 20, 13, 21, 9, 21, -1, -1, 12, 4, 18, -2]],\n \"R\": [21, [4, 21, 4, 0, -1, -1, 4, 21, 13, 21, 16, 20, 17, 19, 18, 17, 18, 15, 17, 13, 16, 12, 13, 11, 4, 11, -1, -1, 11, 11, 18, 0]],\n \"S\": [20, [17, 18, 15, 20, 12, 21, 8, 21, 5, 20, 3, 18, 3, 16, 4, 14, 5, 13, 7, 12, 13, 10, 15, 9, 16, 8, 17, 6, 17, 3, 15, 1, 12, 0, 8, 0, 5, 1, 3, 3]],\n \"T\": [16, [8, 21, 8, 0, -1, -1, 1, 21, 15, 21]],\n \"U\": [22, [4, 21, 4, 6, 5, 3, 7, 1, 10, 0, 12, 0, 15, 1, 17, 3, 18, 6, 18, 21]],\n \"V\": [18, [1, 21, 9, 0, -1, -1, 17, 21, 9, 0]],\n \"W\": [24, [2, 21, 7, 0, -1, -1, 12, 21, 7, 0, -1, -1, 12, 21, 17, 0, -1, -1, 22, 21, 17, 0]],\n \"X\": [20, [3, 21, 17, 0, -1, -1, 17, 21, 3, 0]],\n \"Y\": [18, [1, 21, 9, 11, 9, 0, -1, -1, 17, 21, 9, 11]],\n \"Z\": [20, [17, 21, 3, 0, -1, -1, 3, 21, 17, 21, -1, -1, 3, 0, 17, 0]],\n \"[\": [14, [4, 25, 4, -7, -1, -1, 5, 25, 5, -7, -1, -1, 4, 25, 11, 25, -1, -1, 4, -7, 11, -7]],\n \"\\\\\": [14, [0, 21, 14, -3]],\n \"]\": [14, [9, 25, 9, -7, -1, -1, 10, 25, 10, -7, -1, -1, 3, 25, 10, 25, -1, -1, 3, -7, 10, -7]],\n \"^\": [16, [6, 15, 8, 18, 10, 15, -1, -1, 3, 12, 8, 17, 13, 12, -1, -1, 8, 17, 8, 0]],\n \"_\": [16, [0, -2, 16, -2]],\n \"`\": [10, [6, 21, 5, 20, 4, 18, 4, 16, 5, 15, 6, 16, 5, 17]],\n \"a\": [19, [15, 14, 15, 0, -1, -1, 15, 11, 13, 13, 11, 14, 8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3]],\n \"b\": [19, [4, 21, 4, 0, -1, -1, 4, 11, 6, 13, 8, 14, 11, 14, 13, 13, 15, 11, 16, 8, 16, 6, 15, 3, 13, 1, 11, 0, 8, 0, 6, 1, 4, 3]],\n \"c\": [18, [15, 11, 13, 13, 11, 14, 8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3]],\n \"d\": [19, [15, 21, 15, 0, -1, -1, 15, 11, 13, 13, 11, 14, 8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3]],\n \"e\": [18, [3, 8, 15, 8, 15, 10, 14, 12, 13, 13, 11, 14, 8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3]],\n \"f\": [12, [10, 21, 8, 21, 6, 20, 5, 17, 5, 0, -1, -1, 2, 14, 9, 14]],\n \"g\": [19, [15, 14, 15, -2, 14, -5, 13, -6, 11, -7, 8, -7, 6, -6, -1, -1, 15, 11, 13, 13, 11, 14, 8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3]],\n \"h\": [19, [4, 21, 4, 0, -1, -1, 4, 10, 7, 13, 9, 14, 12, 14, 14, 13, 15, 10, 15, 0]],\n \"i\": [8, [3, 21, 4, 20, 5, 21, 4, 22, 3, 21, -1, -1, 4, 14, 4, 0]],\n \"j\": [10, [5, 21, 6, 20, 7, 21, 6, 22, 5, 21, -1, -1, 6, 14, 6, -3, 5, -6, 3, -7, 1, -7]],\n \"k\": [17, [4, 21, 4, 0, -1, -1, 14, 14, 4, 4, -1, -1, 8, 8, 15, 0]],\n \"l\": [8, [4, 21, 4, 0]],\n \"m\": [30, [4, 14, 4, 0, -1, -1, 4, 10, 7, 13, 9, 14, 12, 14, 14, 13, 15, 10, 15, 0, -1, -1, 15, 10, 18, 13, 20, 14, 23, 14, 25, 13, 26, 10, 26, 0]],\n \"n\": [19, [4, 14, 4, 0, -1, -1, 4, 10, 7, 13, 9, 14, 12, 14, 14, 13, 15, 10, 15, 0]],\n \"o\": [19, [8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3, 16, 6, 16, 8, 15, 11, 13, 13, 11, 14, 8, 14]],\n \"p\": [19, [4, 14, 4, -7, -1, -1, 4, 11, 6, 13, 8, 14, 11, 14, 13, 13, 15, 11, 16, 8, 16, 6, 15, 3, 13, 1, 11, 0, 8, 0, 6, 1, 4, 3]],\n \"q\": [19, [15, 14, 15, -7, -1, -1, 15, 11, 13, 13, 11, 14, 8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3]],\n \"r\": [13, [4, 14, 4, 0, -1, -1, 4, 8, 5, 11, 7, 13, 9, 14, 12, 14]],\n \"s\": [17, [14, 11, 13, 13, 10, 14, 7, 14, 4, 13, 3, 11, 4, 9, 6, 8, 11, 7, 13, 6, 14, 4, 14, 3, 13, 1, 10, 0, 7, 0, 4, 1, 3, 3]],\n \"t\": [12, [5, 21, 5, 4, 6, 1, 8, 0, 10, 0, -1, -1, 2, 14, 9, 14]],\n \"u\": [19, [4, 14, 4, 4, 5, 1, 7, 0, 10, 0, 12, 1, 15, 4, -1, -1, 15, 14, 15, 0]],\n \"v\": [16, [2, 14, 8, 0, -1, -1, 14, 14, 8, 0]],\n \"w\": [22, [3, 14, 7, 0, -1, -1, 11, 14, 7, 0, -1, -1, 11, 14, 15, 0, -1, -1, 19, 14, 15, 0]],\n \"x\": [17, [3, 14, 14, 0, -1, -1, 14, 14, 3, 0]],\n \"y\": [16, [2, 14, 8, 0, -1, -1, 14, 14, 8, 0, 6, -4, 4, -6, 2, -7, 1, -7]],\n \"z\": [17, [14, 14, 3, 0, -1, -1, 3, 14, 14, 14, -1, -1, 3, 0, 14, 0]],\n \"{\": [14, [9, 25, 7, 24, 6, 23, 5, 21, 5, 19, 6, 17, 7, 16, 8, 14, 8, 12, 6, 10, -1, -1, 7, 24, 6, 22, 6, 20, 7, 18, 8, 17, 9, 15, 9, 13, 8, 11, 4, 9, 8, 7, 9, 5, 9, 3, 8, 1, 7, 0, 6, -2, 6, -4, 7, -6, -1, -1, 6, 8, 8, 6, 8, 4, 7, 2, 6, 1, 5, -1, 5, -3, 6, -5, 7, -6, 9, -7]],\n \"|\": [8, [4, 25, 4, -7]],\n \"}\": [14, [5, 25, 7, 24, 8, 23, 9, 21, 9, 19, 8, 17, 7, 16, 6, 14, 6, 12, 8, 10, -1, -1, 7, 24, 8, 22, 8, 20, 7, 18, 6, 17, 5, 15, 5, 13, 6, 11, 10, 9, 6, 7, 5, 5, 5, 3, 6, 1, 7, 0, 8, -2, 8, -4, 7, -6, -1, -1, 8, 8, 6, 6, 6, 4, 7, 2, 8, 1, 9, -1, 9, -3, 8, -5, 7, -6, 5, -7]],\n \"~\": [24, [3, 6, 3, 8, 4, 11, 6, 12, 8, 12, 10, 11, 14, 8, 16, 7, 18, 7, 20, 8, 21, 10, -1, -1, 3, 8, 4, 10, 6, 11, 8, 11, 10, 10, 14, 7, 16, 6, 18, 6, 20, 7, 21, 10, 21, 12]]\n};\n\nfunction createTextVerticies(text, left, baseline, scale) {\n scale = scale || 1;\n\n const strokes = [];\n let i, len, j, len2, glyph, x, y, prev;\n\n for (i = 0, len = text.length; i < len; i++) {\n glyph = simplexFont[text[i]];\n if (!glyph) continue;\n prev = null;\n\n for (j = 0, len2 = glyph[1].length; j < len2; j += 2) {\n if (glyph[1][j] === -1 && glyph[1][j + 1] === -1) {\n prev = null;\n\n } else {\n x = left + glyph[1][j] * scale;\n y = baseline - glyph[1][j + 1] * scale;\n if (prev) {\n strokes.push(prev.x, prev.y, x, y);\n }\n prev = {x: x, y: y};\n }\n }\n left += glyph[0] * scale;\n }\n\n return strokes;\n}\n","// @flow\n\nimport browser from '../util/browser';\n\nimport { mat4 } from '@mapbox/gl-matrix';\nimport SourceCache from '../source/source_cache';\nimport EXTENT from '../data/extent';\nimport pixelsToTileUnits from '../source/pixels_to_tile_units';\nimport { filterObject } from '../util/util';\nimport VertexArrayObject from './vertex_array_object';\nimport { RasterBoundsArray, PosArray } from '../data/array_types';\nimport rasterBoundsAttributes from '../data/raster_bounds_attributes';\nimport posAttributes from '../data/pos_attributes';\nimport ProgramConfiguration from '../data/program_configuration';\nimport CrossTileSymbolIndex from '../symbol/cross_tile_symbol_index';\nimport shaders from '../shaders';\nimport Program from './program';\nimport Context from '../gl/context';\nimport DepthMode from '../gl/depth_mode';\nimport StencilMode from '../gl/stencil_mode';\nimport ColorMode from '../gl/color_mode';\nimport Texture from './texture';\nimport updateTileMasks from './tile_mask';\nimport Color from '../style-spec/util/color';\nimport symbol from './draw_symbol';\nimport circle from './draw_circle';\nimport heatmap from './draw_heatmap';\nimport line from './draw_line';\nimport fill from './draw_fill';\nimport fillExtrusion from './draw_fill_extrusion';\nimport hillshade from './draw_hillshade';\nimport raster from './draw_raster';\nimport background from './draw_background';\nimport debug from './draw_debug';\n\nconst draw = {\n symbol,\n circle,\n heatmap,\n line,\n fill,\n 'fill-extrusion': fillExtrusion,\n hillshade,\n raster,\n background,\n debug\n};\n\nimport type Transform from '../geo/transform';\nimport type Tile from '../source/tile';\nimport type {OverscaledTileID} from '../source/tile_id';\nimport type Style from '../style/style';\nimport type StyleLayer from '../style/style_layer';\nimport type LineAtlas from './line_atlas';\nimport type ImageManager from './image_manager';\nimport type GlyphManager from './glyph_manager';\nimport type VertexBuffer from '../gl/vertex_buffer';\nimport type {DepthMaskType, DepthFuncType} from '../gl/types';\n\nexport type RenderPass = 'offscreen' | 'opaque' | 'translucent';\n\ntype PainterOptions = {\n showOverdrawInspector: boolean,\n showTileBoundaries: boolean,\n rotating: boolean,\n zooming: boolean,\n fadeDuration: number\n}\n\n/**\n * Initialize a new painter object.\n *\n * @param {Canvas} gl an experimental-webgl drawing context\n * @private\n */\nclass Painter {\n context: Context;\n transform: Transform;\n _tileTextures: { [number]: Array };\n numSublayers: number;\n depthEpsilon: number;\n emptyProgramConfiguration: ProgramConfiguration;\n width: number;\n height: number;\n depthRbo: WebGLRenderbuffer;\n depthRboNeedsClear: boolean;\n tileExtentBuffer: VertexBuffer;\n tileExtentVAO: VertexArrayObject;\n tileExtentPatternVAO: VertexArrayObject;\n debugBuffer: VertexBuffer;\n debugVAO: VertexArrayObject;\n rasterBoundsBuffer: VertexBuffer;\n rasterBoundsVAO: VertexArrayObject;\n viewportBuffer: VertexBuffer;\n viewportVAO: VertexArrayObject;\n _tileClippingMaskIDs: { [number]: number };\n style: Style;\n options: PainterOptions;\n lineAtlas: LineAtlas;\n imageManager: ImageManager;\n glyphManager: GlyphManager;\n depthRange: number;\n renderPass: RenderPass;\n currentLayer: number;\n id: string;\n _showOverdrawInspector: boolean;\n cache: { [string]: Program };\n crossTileSymbolIndex: CrossTileSymbolIndex;\n symbolFadeChange: number;\n\n constructor(gl: WebGLRenderingContext, transform: Transform) {\n this.context = new Context(gl);\n this.transform = transform;\n this._tileTextures = {};\n\n this.setup();\n\n // Within each layer there are multiple distinct z-planes that can be drawn to.\n // This is implemented using the WebGL depth buffer.\n this.numSublayers = SourceCache.maxUnderzooming + SourceCache.maxOverzooming + 1;\n this.depthEpsilon = 1 / Math.pow(2, 16);\n\n this.depthRboNeedsClear = true;\n\n this.emptyProgramConfiguration = new ProgramConfiguration();\n\n this.crossTileSymbolIndex = new CrossTileSymbolIndex();\n }\n\n /*\n * Update the GL viewport, projection matrix, and transforms to compensate\n * for a new width and height value.\n */\n resize(width: number, height: number) {\n const gl = this.context.gl;\n\n this.width = width * browser.devicePixelRatio;\n this.height = height * browser.devicePixelRatio;\n this.context.viewport.set([0, 0, this.width, this.height]);\n\n if (this.style) {\n for (const layerId of this.style._order) {\n this.style._layers[layerId].resize();\n }\n }\n\n if (this.depthRbo) {\n gl.deleteRenderbuffer(this.depthRbo);\n this.depthRbo = null;\n }\n }\n\n setup() {\n const context = this.context;\n\n const tileExtentArray = new PosArray();\n tileExtentArray.emplaceBack(0, 0);\n tileExtentArray.emplaceBack(EXTENT, 0);\n tileExtentArray.emplaceBack(0, EXTENT);\n tileExtentArray.emplaceBack(EXTENT, EXTENT);\n this.tileExtentBuffer = context.createVertexBuffer(tileExtentArray, posAttributes.members);\n this.tileExtentVAO = new VertexArrayObject();\n this.tileExtentPatternVAO = new VertexArrayObject();\n\n const debugArray = new PosArray();\n debugArray.emplaceBack(0, 0);\n debugArray.emplaceBack(EXTENT, 0);\n debugArray.emplaceBack(EXTENT, EXTENT);\n debugArray.emplaceBack(0, EXTENT);\n debugArray.emplaceBack(0, 0);\n this.debugBuffer = context.createVertexBuffer(debugArray, posAttributes.members);\n this.debugVAO = new VertexArrayObject();\n\n const rasterBoundsArray = new RasterBoundsArray();\n rasterBoundsArray.emplaceBack(0, 0, 0, 0);\n rasterBoundsArray.emplaceBack(EXTENT, 0, EXTENT, 0);\n rasterBoundsArray.emplaceBack(0, EXTENT, 0, EXTENT);\n rasterBoundsArray.emplaceBack(EXTENT, EXTENT, EXTENT, EXTENT);\n this.rasterBoundsBuffer = context.createVertexBuffer(rasterBoundsArray, rasterBoundsAttributes.members);\n this.rasterBoundsVAO = new VertexArrayObject();\n\n const viewportArray = new PosArray();\n viewportArray.emplaceBack(0, 0);\n viewportArray.emplaceBack(1, 0);\n viewportArray.emplaceBack(0, 1);\n viewportArray.emplaceBack(1, 1);\n this.viewportBuffer = context.createVertexBuffer(viewportArray, posAttributes.members);\n this.viewportVAO = new VertexArrayObject();\n }\n\n /*\n * Reset the drawing canvas by clearing the stencil buffer so that we can draw\n * new tiles at the same location, while retaining previously drawn pixels.\n */\n clearStencil() {\n const context = this.context;\n const gl = context.gl;\n\n // As a temporary workaround for https://github.com/mapbox/mapbox-gl-js/issues/5490,\n // pending an upstream fix, we draw a fullscreen stencil=0 clipping mask here,\n // effectively clearing the stencil buffer: once an upstream patch lands, remove\n // this function in favor of context.clear({ stencil: 0x0 })\n\n context.setColorMode(ColorMode.disabled);\n context.setDepthMode(DepthMode.disabled);\n context.setStencilMode(new StencilMode({ func: gl.ALWAYS, mask: 0 }, 0x0, 0xFF, gl.ZERO, gl.ZERO, gl.ZERO));\n\n const matrix = mat4.create();\n mat4.ortho(matrix, 0, this.width, this.height, 0, 0, 1);\n mat4.scale(matrix, matrix, [gl.drawingBufferWidth, gl.drawingBufferHeight, 0]);\n\n const program = this.useProgram('clippingMask');\n gl.uniformMatrix4fv(program.uniforms.u_matrix, false, matrix);\n\n this.viewportVAO.bind(context, program, this.viewportBuffer, []);\n gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);\n }\n\n _renderTileClippingMasks(tileIDs: Array) {\n const context = this.context;\n const gl = context.gl;\n\n context.setColorMode(ColorMode.disabled);\n context.setDepthMode(DepthMode.disabled);\n\n let idNext = 1;\n this._tileClippingMaskIDs = {};\n\n for (const tileID of tileIDs) {\n const id = this._tileClippingMaskIDs[tileID.key] = idNext++;\n\n // Tests will always pass, and ref value will be written to stencil buffer.\n context.setStencilMode(new StencilMode({ func: gl.ALWAYS, mask: 0 }, id, 0xFF, gl.KEEP, gl.KEEP, gl.REPLACE));\n\n const program = this.useProgram('clippingMask');\n gl.uniformMatrix4fv(program.uniforms.u_matrix, false, tileID.posMatrix);\n\n // Draw the clipping mask\n this.tileExtentVAO.bind(this.context, program, this.tileExtentBuffer, []);\n gl.drawArrays(gl.TRIANGLE_STRIP, 0, this.tileExtentBuffer.length);\n }\n }\n\n stencilModeForClipping(tileID: OverscaledTileID): StencilMode {\n const gl = this.context.gl;\n return new StencilMode({ func: gl.EQUAL, mask: 0xFF }, this._tileClippingMaskIDs[tileID.key], 0x00, gl.KEEP, gl.KEEP, gl.REPLACE);\n }\n\n colorModeForRenderPass(): $ReadOnly {\n const gl = this.context.gl;\n if (this._showOverdrawInspector) {\n const numOverdrawSteps = 8;\n const a = 1 / numOverdrawSteps;\n\n return new ColorMode([gl.CONSTANT_COLOR, gl.ONE], new Color(a, a, a, 0), [true, true, true, true]);\n } else if (this.renderPass === 'opaque') {\n return ColorMode.unblended;\n } else {\n return ColorMode.alphaBlended;\n }\n }\n\n depthModeForSublayer(n: number, mask: DepthMaskType, func: ?DepthFuncType): DepthMode {\n const farDepth = 1 - ((1 + this.currentLayer) * this.numSublayers + n) * this.depthEpsilon;\n const nearDepth = farDepth - 1 + this.depthRange;\n return new DepthMode(func || this.context.gl.LEQUAL, mask, [nearDepth, farDepth]);\n }\n\n render(style: Style, options: PainterOptions) {\n this.style = style;\n this.options = options;\n\n this.lineAtlas = style.lineAtlas;\n this.imageManager = style.imageManager;\n this.glyphManager = style.glyphManager;\n\n this.symbolFadeChange = style.placement.symbolFadeChange(browser.now());\n\n for (const id in style.sourceCaches) {\n const sourceCache = this.style.sourceCaches[id];\n if (sourceCache.used) {\n sourceCache.prepare(this.context);\n }\n }\n\n const layerIds = this.style._order;\n\n const rasterSources = filterObject(\n this.style.sourceCaches,\n (sc) => { return sc.getSource().type === 'raster' || sc.getSource().type === 'raster-dem'; }\n );\n for (const key in rasterSources) {\n const sourceCache = rasterSources[key];\n const coords = sourceCache.getVisibleCoordinates();\n const visibleTiles = coords.map((c)=>{ return sourceCache.getTile(c); });\n updateTileMasks(visibleTiles, this.context);\n }\n\n // Offscreen pass\n // We first do all rendering that requires rendering to a separate\n // framebuffer, and then save those for rendering back to the map\n // later: in doing this we avoid doing expensive framebuffer restores.\n this.renderPass = 'offscreen';\n {\n let sourceCache;\n let coords = [];\n this.depthRboNeedsClear = true;\n\n for (let i = 0; i < layerIds.length; i++) {\n const layer = this.style._layers[layerIds[i]];\n\n if (!layer.hasOffscreenPass() || layer.isHidden(this.transform.zoom)) continue;\n\n if (layer.source !== (sourceCache && sourceCache.id)) {\n sourceCache = this.style.sourceCaches[layer.source];\n coords = [];\n\n if (sourceCache) {\n coords = sourceCache.getVisibleCoordinates();\n coords.reverse();\n }\n }\n\n if (!coords.length) continue;\n\n this.renderLayer(this, (sourceCache: any), layer, coords);\n }\n\n // Rebind the main framebuffer now that all offscreen layers\n // have been rendered:\n this.context.bindFramebuffer.set(null);\n }\n\n // Clear buffers in preparation for drawing to the main framebuffer\n this.context.clear({ color: options.showOverdrawInspector ? Color.black : Color.transparent, depth: 1 });\n\n this._showOverdrawInspector = options.showOverdrawInspector;\n\n this.depthRange = (style._order.length + 2) * this.numSublayers * this.depthEpsilon;\n\n // Opaque pass\n // Draw opaque layers top-to-bottom first.\n this.renderPass = 'opaque';\n {\n let sourceCache;\n let coords = [];\n\n this.currentLayer = layerIds.length - 1;\n\n for (this.currentLayer; this.currentLayer >= 0; this.currentLayer--) {\n const layer = this.style._layers[layerIds[this.currentLayer]];\n\n if (layer.source !== (sourceCache && sourceCache.id)) {\n sourceCache = this.style.sourceCaches[layer.source];\n coords = [];\n\n if (sourceCache) {\n this.clearStencil();\n coords = sourceCache.getVisibleCoordinates();\n if (sourceCache.getSource().isTileClipped) {\n this._renderTileClippingMasks(coords);\n }\n }\n }\n\n this.renderLayer(this, (sourceCache: any), layer, coords);\n }\n }\n\n // Translucent pass\n // Draw all other layers bottom-to-top.\n this.renderPass = 'translucent';\n {\n let sourceCache;\n let coords = [];\n\n this.currentLayer = 0;\n\n for (this.currentLayer; this.currentLayer < layerIds.length; this.currentLayer++) {\n const layer = this.style._layers[layerIds[this.currentLayer]];\n\n if (layer.source !== (sourceCache && sourceCache.id)) {\n sourceCache = this.style.sourceCaches[layer.source];\n coords = [];\n\n if (sourceCache) {\n this.clearStencil();\n coords = sourceCache.getVisibleCoordinates();\n if (sourceCache.getSource().isTileClipped) {\n this._renderTileClippingMasks(coords);\n }\n }\n\n coords.reverse();\n }\n\n this.renderLayer(this, (sourceCache: any), layer, coords);\n }\n }\n\n if (this.options.showTileBoundaries) {\n const sourceCache = this.style.sourceCaches[Object.keys(this.style.sourceCaches)[0]];\n if (sourceCache) {\n draw.debug(this, sourceCache, sourceCache.getVisibleCoordinates());\n }\n }\n }\n\n setupOffscreenDepthRenderbuffer(): void {\n const context = this.context;\n // All of the 3D textures will use the same depth renderbuffer.\n if (!this.depthRbo) {\n this.depthRbo = context.createRenderbuffer(context.gl.DEPTH_COMPONENT16, this.width, this.height);\n }\n }\n\n renderLayer(painter: Painter, sourceCache: SourceCache, layer: StyleLayer, coords: Array) {\n if (layer.isHidden(this.transform.zoom)) return;\n if (layer.type !== 'background' && !coords.length) return;\n this.id = layer.id;\n\n draw[layer.type](painter, sourceCache, layer, coords);\n }\n\n /**\n * Transform a matrix to incorporate the *-translate and *-translate-anchor properties into it.\n * @param inViewportPixelUnitsUnits True when the units accepted by the matrix are in viewport pixels instead of tile units.\n * @returns {Float32Array} matrix\n */\n translatePosMatrix(matrix: Float32Array, tile: Tile, translate: [number, number], translateAnchor: 'map' | 'viewport', inViewportPixelUnitsUnits?: boolean) {\n if (!translate[0] && !translate[1]) return matrix;\n\n const angle = inViewportPixelUnitsUnits ?\n (translateAnchor === 'map' ? this.transform.angle : 0) :\n (translateAnchor === 'viewport' ? -this.transform.angle : 0);\n\n if (angle) {\n const sinA = Math.sin(angle);\n const cosA = Math.cos(angle);\n translate = [\n translate[0] * cosA - translate[1] * sinA,\n translate[0] * sinA + translate[1] * cosA\n ];\n }\n\n const translation = [\n inViewportPixelUnitsUnits ? translate[0] : pixelsToTileUnits(tile, translate[0], this.transform.zoom),\n inViewportPixelUnitsUnits ? translate[1] : pixelsToTileUnits(tile, translate[1], this.transform.zoom),\n 0\n ];\n\n const translatedMatrix = new Float32Array(16);\n mat4.translate(translatedMatrix, matrix, translation);\n return translatedMatrix;\n }\n\n saveTileTexture(texture: Texture) {\n const textures = this._tileTextures[texture.size[0]];\n if (!textures) {\n this._tileTextures[texture.size[0]] = [texture];\n } else {\n textures.push(texture);\n }\n }\n\n getTileTexture(size: number) {\n const textures = this._tileTextures[size];\n return textures && textures.length > 0 ? textures.pop() : null;\n }\n\n _createProgramCached(name: string, programConfiguration: ProgramConfiguration): Program {\n this.cache = this.cache || {};\n const key = `${name}${programConfiguration.cacheKey || ''}${this._showOverdrawInspector ? '/overdraw' : ''}`;\n if (!this.cache[key]) {\n this.cache[key] = new Program(this.context, shaders[name], programConfiguration, this._showOverdrawInspector);\n }\n return this.cache[key];\n }\n\n useProgram(name: string, programConfiguration?: ProgramConfiguration): Program {\n const nextProgram = this._createProgramCached(name, programConfiguration || this.emptyProgramConfiguration);\n\n this.context.program.set(nextProgram.program);\n\n return nextProgram;\n }\n}\n\nexport default Painter;\n","// @flow\n\nimport pixelsToTileUnits from '../source/pixels_to_tile_units';\n\nimport StencilMode from '../gl/stencil_mode';\nimport DepthMode from '../gl/depth_mode';\n\nimport type Painter from './painter';\nimport type SourceCache from '../source/source_cache';\nimport type CircleStyleLayer from '../style/style_layer/circle_style_layer';\nimport type CircleBucket from '../data/bucket/circle_bucket';\nimport type {OverscaledTileID} from '../source/tile_id';\n\nexport default drawCircles;\n\nfunction drawCircles(painter: Painter, sourceCache: SourceCache, layer: CircleStyleLayer, coords: Array) {\n if (painter.renderPass !== 'translucent') return;\n\n const opacity = layer.paint.get('circle-opacity');\n const strokeWidth = layer.paint.get('circle-stroke-width');\n const strokeOpacity = layer.paint.get('circle-stroke-opacity');\n\n if (opacity.constantOr(1) === 0 && (strokeWidth.constantOr(1) === 0 || strokeOpacity.constantOr(1) === 0)) {\n return;\n }\n\n const context = painter.context;\n const gl = context.gl;\n\n context.setDepthMode(painter.depthModeForSublayer(0, DepthMode.ReadOnly));\n // Allow circles to be drawn across boundaries, so that\n // large circles are not clipped to tiles\n context.setStencilMode(StencilMode.disabled);\n context.setColorMode(painter.colorModeForRenderPass());\n\n let first = true;\n for (let i = 0; i < coords.length; i++) {\n const coord = coords[i];\n\n const tile = sourceCache.getTile(coord);\n const bucket: ?CircleBucket<*> = (tile.getBucket(layer): any);\n if (!bucket) continue;\n\n const prevProgram = painter.context.program.get();\n const programConfiguration = bucket.programConfigurations.get(layer.id);\n const program = painter.useProgram('circle', programConfiguration);\n if (first || program.program !== prevProgram) {\n programConfiguration.setUniforms(context, program, layer.paint, {zoom: painter.transform.zoom});\n first = false;\n }\n\n gl.uniform1f(program.uniforms.u_camera_to_center_distance, painter.transform.cameraToCenterDistance);\n gl.uniform1i(program.uniforms.u_scale_with_map, layer.paint.get('circle-pitch-scale') === 'map' ? 1 : 0);\n if (layer.paint.get('circle-pitch-alignment') === 'map') {\n gl.uniform1i(program.uniforms.u_pitch_with_map, 1);\n const pixelRatio = pixelsToTileUnits(tile, 1, painter.transform.zoom);\n gl.uniform2f(program.uniforms.u_extrude_scale, pixelRatio, pixelRatio);\n } else {\n gl.uniform1i(program.uniforms.u_pitch_with_map, 0);\n gl.uniform2fv(program.uniforms.u_extrude_scale, painter.transform.pixelsToGLUnits);\n }\n\n gl.uniformMatrix4fv(program.uniforms.u_matrix, false, painter.translatePosMatrix(\n coord.posMatrix,\n tile,\n layer.paint.get('circle-translate'),\n layer.paint.get('circle-translate-anchor')\n ));\n\n program.draw(\n context,\n gl.TRIANGLES,\n layer.id,\n bucket.layoutVertexBuffer,\n bucket.indexBuffer,\n bucket.segments,\n programConfiguration);\n }\n}\n","// @flow\n\nimport { mat4 } from '@mapbox/gl-matrix';\n\nimport Texture from './texture';\nimport pixelsToTileUnits from '../source/pixels_to_tile_units';\nimport Color from '../style-spec/util/color';\nimport DepthMode from '../gl/depth_mode';\nimport StencilMode from '../gl/stencil_mode';\nimport ColorMode from '../gl/color_mode';\n\nimport type Painter from './painter';\nimport type SourceCache from '../source/source_cache';\nimport type HeatmapStyleLayer from '../style/style_layer/heatmap_style_layer';\nimport type HeatmapBucket from '../data/bucket/heatmap_bucket';\nimport type {OverscaledTileID} from '../source/tile_id';\n\nexport default drawHeatmap;\n\nfunction drawHeatmap(painter: Painter, sourceCache: SourceCache, layer: HeatmapStyleLayer, coords: Array) {\n if (layer.paint.get('heatmap-opacity') === 0) {\n return;\n }\n\n if (painter.renderPass === 'offscreen') {\n const context = painter.context;\n const gl = context.gl;\n\n context.setDepthMode(painter.depthModeForSublayer(0, DepthMode.ReadOnly));\n\n // Allow kernels to be drawn across boundaries, so that\n // large kernels are not clipped to tiles\n context.setStencilMode(StencilMode.disabled);\n\n bindFramebuffer(context, painter, layer);\n\n context.clear({ color: Color.transparent });\n\n // Turn on additive blending for kernels, which is a key aspect of kernel density estimation formula\n context.setColorMode(new ColorMode([gl.ONE, gl.ONE], Color.transparent, [true, true, true, true]));\n\n let first = true;\n for (let i = 0; i < coords.length; i++) {\n const coord = coords[i];\n\n // Skip tiles that have uncovered parents to avoid flickering; we don't need\n // to use complex tile masking here because the change between zoom levels is subtle,\n // so it's fine to simply render the parent until all its 4 children are loaded\n if (sourceCache.hasRenderableParent(coord)) continue;\n\n const tile = sourceCache.getTile(coord);\n const bucket: ?HeatmapBucket = (tile.getBucket(layer): any);\n if (!bucket) continue;\n\n const prevProgram = painter.context.program.get();\n const programConfiguration = bucket.programConfigurations.get(layer.id);\n const program = painter.useProgram('heatmap', programConfiguration);\n const {zoom} = painter.transform;\n if (first || program.program !== prevProgram) {\n programConfiguration.setUniforms(painter.context, program, layer.paint, {zoom});\n first = false;\n }\n\n gl.uniform1f(program.uniforms.u_extrude_scale, pixelsToTileUnits(tile, 1, zoom));\n\n gl.uniform1f(program.uniforms.u_intensity, layer.paint.get('heatmap-intensity'));\n gl.uniformMatrix4fv(program.uniforms.u_matrix, false, coord.posMatrix);\n\n program.draw(\n context,\n gl.TRIANGLES,\n layer.id,\n bucket.layoutVertexBuffer,\n bucket.indexBuffer,\n bucket.segments,\n programConfiguration);\n }\n\n context.viewport.set([0, 0, painter.width, painter.height]);\n\n } else if (painter.renderPass === 'translucent') {\n painter.context.setColorMode(painter.colorModeForRenderPass());\n renderTextureToMap(painter, layer);\n }\n}\n\nfunction bindFramebuffer(context, painter, layer) {\n const gl = context.gl;\n context.activeTexture.set(gl.TEXTURE1);\n\n // Use a 4x downscaled screen texture for better performance\n context.viewport.set([0, 0, painter.width / 4, painter.height / 4]);\n\n let fbo = layer.heatmapFbo;\n\n if (!fbo) {\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n\n fbo = layer.heatmapFbo = context.createFramebuffer(painter.width / 4, painter.height / 4);\n\n bindTextureToFramebuffer(context, painter, texture, fbo);\n\n } else {\n gl.bindTexture(gl.TEXTURE_2D, fbo.colorAttachment.get());\n context.bindFramebuffer.set(fbo.framebuffer);\n }\n}\n\nfunction bindTextureToFramebuffer(context, painter, texture, fbo) {\n const gl = context.gl;\n // Use the higher precision half-float texture where available (producing much smoother looking heatmaps);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, painter.width / 4, painter.height / 4, 0, gl.RGBA,\n context.extTextureHalfFloat ? context.extTextureHalfFloat.HALF_FLOAT_OES : gl.UNSIGNED_BYTE, null);\n\n fbo.colorAttachment.set(texture);\n\n // If using half-float texture as a render target is not supported, fall back to a low precision texture\n if (context.extTextureHalfFloat && gl.checkFramebufferStatus(gl.FRAMEBUFFER) !== gl.FRAMEBUFFER_COMPLETE) {\n context.extTextureHalfFloat = null;\n fbo.colorAttachment.setDirty();\n bindTextureToFramebuffer(context, painter, texture, fbo);\n }\n}\n\nfunction renderTextureToMap(painter, layer) {\n const context = painter.context;\n const gl = context.gl;\n\n\n // Here we bind two different textures from which we'll sample in drawing\n // heatmaps: the kernel texture, prepared in the offscreen pass, and a\n // color ramp texture.\n const fbo = layer.heatmapFbo;\n if (!fbo) return;\n context.activeTexture.set(gl.TEXTURE0);\n gl.bindTexture(gl.TEXTURE_2D, fbo.colorAttachment.get());\n\n context.activeTexture.set(gl.TEXTURE1);\n let colorRampTexture = layer.colorRampTexture;\n if (!colorRampTexture) {\n colorRampTexture = layer.colorRampTexture = new Texture(context, layer.colorRamp, gl.RGBA);\n }\n colorRampTexture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);\n\n context.setDepthMode(DepthMode.disabled);\n\n const program = painter.useProgram('heatmapTexture');\n\n const opacity = layer.paint.get('heatmap-opacity');\n gl.uniform1f(program.uniforms.u_opacity, opacity);\n gl.uniform1i(program.uniforms.u_image, 0);\n gl.uniform1i(program.uniforms.u_color_ramp, 1);\n\n const matrix = mat4.create();\n mat4.ortho(matrix, 0, painter.width, painter.height, 0, 0, 1);\n gl.uniformMatrix4fv(program.uniforms.u_matrix, false, matrix);\n\n gl.uniform2f(program.uniforms.u_world, gl.drawingBufferWidth, gl.drawingBufferHeight);\n\n painter.viewportVAO.bind(painter.context, program, painter.viewportBuffer, []);\n\n gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);\n}\n","// @flow\n\nimport {\n isPatternMissing,\n setPatternUniforms,\n prepare as preparePattern\n} from './pattern';\n\nimport StencilMode from '../gl/stencil_mode';\nimport DepthMode from '../gl/depth_mode';\n\nimport type Painter from './painter';\nimport type SourceCache from '../source/source_cache';\nimport type BackgroundStyleLayer from '../style/style_layer/background_style_layer';\n\nexport default drawBackground;\n\nfunction drawBackground(painter: Painter, sourceCache: SourceCache, layer: BackgroundStyleLayer) {\n const color = layer.paint.get('background-color');\n const opacity = layer.paint.get('background-opacity');\n\n if (opacity === 0) return;\n\n const context = painter.context;\n const gl = context.gl;\n const transform = painter.transform;\n const tileSize = transform.tileSize;\n const image = layer.paint.get('background-pattern');\n\n const pass = (!image && color.a === 1 && opacity === 1) ? 'opaque' : 'translucent';\n if (painter.renderPass !== pass) return;\n\n context.setStencilMode(StencilMode.disabled);\n context.setDepthMode(painter.depthModeForSublayer(0, pass === 'opaque' ? DepthMode.ReadWrite : DepthMode.ReadOnly));\n context.setColorMode(painter.colorModeForRenderPass());\n\n let program;\n if (image) {\n if (isPatternMissing(image, painter)) return;\n program = painter.useProgram('backgroundPattern');\n preparePattern(image, painter, program);\n painter.tileExtentPatternVAO.bind(context, program, painter.tileExtentBuffer, []);\n } else {\n program = painter.useProgram('background');\n gl.uniform4fv(program.uniforms.u_color, [color.r, color.g, color.b, color.a]);\n painter.tileExtentVAO.bind(context, program, painter.tileExtentBuffer, []);\n }\n\n gl.uniform1f(program.uniforms.u_opacity, opacity);\n const tileIDs = transform.coveringTiles({tileSize});\n\n for (const tileID of tileIDs) {\n if (image) {\n setPatternUniforms({tileID, tileSize}, painter, program);\n }\n gl.uniformMatrix4fv(program.uniforms.u_matrix, false, painter.transform.calculatePosMatrix(tileID.toUnwrapped()));\n gl.drawArrays(gl.TRIANGLE_STRIP, 0, painter.tileExtentBuffer.length);\n }\n}\n","// @flow\n\nimport Coordinate from '../geo/coordinate';\n\nimport { OverscaledTileID } from '../source/tile_id';\n\nexport default tileCover;\n\nfunction tileCover(z: number, bounds: [Coordinate, Coordinate, Coordinate, Coordinate],\n actualZ: number, renderWorldCopies: boolean | void) {\n if (renderWorldCopies === undefined) {\n renderWorldCopies = true;\n }\n const tiles = 1 << z;\n const t = {};\n\n function scanLine(x0, x1, y) {\n let x, w, wx, coord;\n if (y >= 0 && y <= tiles) {\n for (x = x0; x < x1; x++) {\n w = Math.floor(x / tiles);\n wx = (x % tiles + tiles) % tiles;\n if (w === 0 || renderWorldCopies === true) {\n coord = new OverscaledTileID(actualZ, w, z, wx, y);\n t[coord.key] = coord;\n }\n }\n }\n }\n\n // Divide the screen up in two triangles and scan each of them:\n // +---/\n // | / |\n // /---+\n scanTriangle(bounds[0], bounds[1], bounds[2], 0, tiles, scanLine);\n scanTriangle(bounds[2], bounds[3], bounds[0], 0, tiles, scanLine);\n\n return Object.keys(t).map((id) => {\n return t[id];\n });\n}\n\n\n// Taken from polymaps src/Layer.js\n// https://github.com/simplegeo/polymaps/blob/master/src/Layer.js#L333-L383\n\nfunction edge(a: Coordinate, b: Coordinate) {\n if (a.row > b.row) { const t = a; a = b; b = t; }\n return {\n x0: a.column,\n y0: a.row,\n x1: b.column,\n y1: b.row,\n dx: b.column - a.column,\n dy: b.row - a.row\n };\n}\n\nfunction scanSpans(e0, e1, ymin, ymax, scanLine) {\n const y0 = Math.max(ymin, Math.floor(e1.y0));\n const y1 = Math.min(ymax, Math.ceil(e1.y1));\n\n // sort edges by x-coordinate\n if ((e0.x0 === e1.x0 && e0.y0 === e1.y0) ?\n (e0.x0 + e1.dy / e0.dy * e0.dx < e1.x1) :\n (e0.x1 - e1.dy / e0.dy * e0.dx < e1.x0)) {\n const t = e0; e0 = e1; e1 = t;\n }\n\n // scan lines!\n const m0 = e0.dx / e0.dy;\n const m1 = e1.dx / e1.dy;\n const d0 = e0.dx > 0; // use y + 1 to compute x0\n const d1 = e1.dx < 0; // use y + 1 to compute x1\n for (let y = y0; y < y1; y++) {\n const x0 = m0 * Math.max(0, Math.min(e0.dy, y + d0 - e0.y0)) + e0.x0;\n const x1 = m1 * Math.max(0, Math.min(e1.dy, y + d1 - e1.y0)) + e1.x0;\n scanLine(Math.floor(x1), Math.ceil(x0), y);\n }\n}\n\nfunction scanTriangle(a: Coordinate, b: Coordinate, c: Coordinate, ymin, ymax, scanLine) {\n let ab = edge(a, b),\n bc = edge(b, c),\n ca = edge(c, a);\n\n let t;\n\n // sort edges by y-length\n if (ab.dy > bc.dy) { t = ab; ab = bc; bc = t; }\n if (ab.dy > ca.dy) { t = ab; ab = ca; ca = t; }\n if (bc.dy > ca.dy) { t = bc; bc = ca; ca = t; }\n\n // scan span! scan span!\n if (ab.dy) scanSpans(ca, ab, ymin, ymax, scanLine);\n if (bc.dy) scanSpans(ca, bc, ymin, ymax, scanLine);\n}\n\n","// @flow\n\nimport LngLat from './lng_lat';\n\nimport Point from '@mapbox/point-geometry';\nimport Coordinate from './coordinate';\nimport { wrap, clamp } from '../util/util';\nimport {number as interpolate} from '../style-spec/util/interpolate';\nimport tileCover from '../util/tile_cover';\nimport { CanonicalTileID, UnwrappedTileID } from '../source/tile_id';\nimport EXTENT from '../data/extent';\nimport glmatrix from '@mapbox/gl-matrix';\n\nconst vec4 = glmatrix.vec4,\n mat4 = glmatrix.mat4,\n mat2 = glmatrix.mat2;\n\n/**\n * A single transform, generally used for a single tile to be\n * scaled, rotated, and zoomed.\n * @private\n */\nclass Transform {\n tileSize: number;\n tileZoom: number;\n lngRange: ?[number, number];\n latRange: ?[number, number];\n scale: number;\n width: number;\n height: number;\n angle: number;\n rotationMatrix: Float64Array;\n zoomFraction: number;\n pixelsToGLUnits: Array;\n cameraToCenterDistance: number;\n projMatrix: Float64Array;\n alignedProjMatrix: Float64Array;\n pixelMatrix: Float64Array;\n pixelMatrixInverse: Float64Array;\n _fov: number;\n _pitch: number;\n _zoom: number;\n _unmodified: boolean;\n _renderWorldCopies: boolean;\n _minZoom: number;\n _maxZoom: number;\n _center: LngLat;\n _constraining: boolean;\n _posMatrixCache: {[number]: Float32Array};\n _alignedPosMatrixCache: {[number]: Float32Array};\n\n constructor(minZoom: ?number, maxZoom: ?number, renderWorldCopies: boolean | void) {\n this.tileSize = 512; // constant\n\n this._renderWorldCopies = renderWorldCopies === undefined ? true : renderWorldCopies;\n this._minZoom = minZoom || 0;\n this._maxZoom = maxZoom || 22;\n\n this.latRange = [-85.05113, 85.05113];\n\n this.width = 0;\n this.height = 0;\n this._center = new LngLat(0, 0);\n this.zoom = 0;\n this.angle = 0;\n this._fov = 0.6435011087932844;\n this._pitch = 0;\n this._unmodified = true;\n this._posMatrixCache = {};\n this._alignedPosMatrixCache = {};\n }\n\n clone(): Transform {\n const clone = new Transform(this._minZoom, this._maxZoom, this._renderWorldCopies);\n clone.tileSize = this.tileSize;\n clone.latRange = this.latRange;\n clone.width = this.width;\n clone.height = this.height;\n clone._center = this._center;\n clone.zoom = this.zoom;\n clone.angle = this.angle;\n clone._fov = this._fov;\n clone._pitch = this._pitch;\n clone._unmodified = this._unmodified;\n clone._calcMatrices();\n return clone;\n }\n\n get minZoom(): number { return this._minZoom; }\n set minZoom(zoom: number) {\n if (this._minZoom === zoom) return;\n this._minZoom = zoom;\n this.zoom = Math.max(this.zoom, zoom);\n }\n\n get maxZoom(): number { return this._maxZoom; }\n set maxZoom(zoom: number) {\n if (this._maxZoom === zoom) return;\n this._maxZoom = zoom;\n this.zoom = Math.min(this.zoom, zoom);\n }\n\n get renderWorldCopies(): boolean { return this._renderWorldCopies; }\n set renderWorldCopies(renderWorldCopies?: ?boolean) {\n if (renderWorldCopies === undefined) {\n renderWorldCopies = true;\n } else if (renderWorldCopies === null) {\n renderWorldCopies = false;\n }\n\n this._renderWorldCopies = renderWorldCopies;\n }\n\n get worldSize(): number {\n return this.tileSize * this.scale;\n }\n\n get centerPoint(): Point {\n return this.size._div(2);\n }\n\n get size(): Point {\n return new Point(this.width, this.height);\n }\n\n get bearing(): number {\n return -this.angle / Math.PI * 180;\n }\n set bearing(bearing: number) {\n const b = -wrap(bearing, -180, 180) * Math.PI / 180;\n if (this.angle === b) return;\n this._unmodified = false;\n this.angle = b;\n this._calcMatrices();\n\n // 2x2 matrix for rotating points\n this.rotationMatrix = mat2.create();\n mat2.rotate(this.rotationMatrix, this.rotationMatrix, this.angle);\n }\n\n get pitch(): number {\n return this._pitch / Math.PI * 180;\n }\n set pitch(pitch: number) {\n const p = clamp(pitch, 0, 60) / 180 * Math.PI;\n if (this._pitch === p) return;\n this._unmodified = false;\n this._pitch = p;\n this._calcMatrices();\n }\n\n get fov(): number {\n return this._fov / Math.PI * 180;\n }\n set fov(fov: number) {\n fov = Math.max(0.01, Math.min(60, fov));\n if (this._fov === fov) return;\n this._unmodified = false;\n this._fov = fov / 180 * Math.PI;\n this._calcMatrices();\n }\n\n get zoom(): number { return this._zoom; }\n set zoom(zoom: number) {\n const z = Math.min(Math.max(zoom, this.minZoom), this.maxZoom);\n if (this._zoom === z) return;\n this._unmodified = false;\n this._zoom = z;\n this.scale = this.zoomScale(z);\n this.tileZoom = Math.floor(z);\n this.zoomFraction = z - this.tileZoom;\n this._constrain();\n this._calcMatrices();\n }\n\n get center(): LngLat { return this._center; }\n set center(center: LngLat) {\n if (center.lat === this._center.lat && center.lng === this._center.lng) return;\n this._unmodified = false;\n this._center = center;\n this._constrain();\n this._calcMatrices();\n }\n\n /**\n * Return a zoom level that will cover all tiles the transform\n * @param {Object} options\n * @param {number} options.tileSize\n * @param {boolean} options.roundZoom\n * @returns {number} zoom level\n */\n coveringZoomLevel(options: {roundZoom?: boolean, tileSize: number}) {\n return (options.roundZoom ? Math.round : Math.floor)(\n this.zoom + this.scaleZoom(this.tileSize / options.tileSize)\n );\n }\n\n /**\n * Return any \"wrapped\" copies of a given tile coordinate that are visible\n * in the current view.\n *\n * @private\n */\n getVisibleUnwrappedCoordinates(tileID: CanonicalTileID) {\n const ul = this.pointCoordinate(new Point(0, 0), 0);\n const ur = this.pointCoordinate(new Point(this.width, 0), 0);\n const w0 = Math.floor(ul.column);\n const w1 = Math.floor(ur.column);\n const result = [new UnwrappedTileID(0, tileID)];\n if (this._renderWorldCopies) {\n for (let w = w0; w <= w1; w++) {\n if (w === 0) continue;\n result.push(new UnwrappedTileID(w, tileID));\n }\n }\n return result;\n }\n\n /**\n * Return all coordinates that could cover this transform for a covering\n * zoom level.\n * @param {Object} options\n * @param {number} options.tileSize\n * @param {number} options.minzoom\n * @param {number} options.maxzoom\n * @param {boolean} options.roundZoom\n * @param {boolean} options.reparseOverscaled\n * @param {boolean} options.renderWorldCopies\n * @returns {Array} tiles\n */\n coveringTiles(\n options: {\n tileSize: number,\n minzoom?: number,\n maxzoom?: number,\n roundZoom?: boolean,\n reparseOverscaled?: boolean,\n renderWorldCopies?: boolean\n }\n ) {\n let z = this.coveringZoomLevel(options);\n const actualZ = z;\n\n if (options.minzoom !== undefined && z < options.minzoom) return [];\n if (options.maxzoom !== undefined && z > options.maxzoom) z = options.maxzoom;\n\n const centerCoord = this.pointCoordinate(this.centerPoint, z);\n const centerPoint = new Point(centerCoord.column - 0.5, centerCoord.row - 0.5);\n const cornerCoords = [\n this.pointCoordinate(new Point(0, 0), z),\n this.pointCoordinate(new Point(this.width, 0), z),\n this.pointCoordinate(new Point(this.width, this.height), z),\n this.pointCoordinate(new Point(0, this.height), z)\n ];\n return tileCover(z, cornerCoords, options.reparseOverscaled ? actualZ : z, this._renderWorldCopies)\n .sort((a, b) => centerPoint.dist(a.canonical) - centerPoint.dist(b.canonical));\n }\n\n resize(width: number, height: number) {\n this.width = width;\n this.height = height;\n\n this.pixelsToGLUnits = [2 / width, -2 / height];\n this._constrain();\n this._calcMatrices();\n }\n\n get unmodified(): boolean { return this._unmodified; }\n\n zoomScale(zoom: number) { return Math.pow(2, zoom); }\n scaleZoom(scale: number) { return Math.log(scale) / Math.LN2; }\n\n project(lnglat: LngLat) {\n return new Point(\n this.lngX(lnglat.lng),\n this.latY(lnglat.lat));\n }\n\n unproject(point: Point): LngLat {\n return new LngLat(\n this.xLng(point.x),\n this.yLat(point.y));\n }\n\n get x(): number { return this.lngX(this.center.lng); }\n get y(): number { return this.latY(this.center.lat); }\n\n get point(): Point { return new Point(this.x, this.y); }\n\n /**\n * latitude to absolute x coord\n * @returns {number} pixel coordinate\n */\n lngX(lng: number) {\n return (180 + lng) * this.worldSize / 360;\n }\n /**\n * latitude to absolute y coord\n * @returns {number} pixel coordinate\n */\n latY(lat: number) {\n const y = 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + lat * Math.PI / 360));\n return (180 - y) * this.worldSize / 360;\n }\n\n xLng(x: number) {\n return x * 360 / this.worldSize - 180;\n }\n yLat(y: number) {\n const y2 = 180 - y * 360 / this.worldSize;\n return 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90;\n }\n\n setLocationAtPoint(lnglat: LngLat, point: Point) {\n const translate = this.pointCoordinate(point)._sub(this.pointCoordinate(this.centerPoint));\n this.center = this.coordinateLocation(this.locationCoordinate(lnglat)._sub(translate));\n if (this._renderWorldCopies) {\n this.center = this.center.wrap();\n }\n }\n\n /**\n * Given a location, return the screen point that corresponds to it\n * @param {LngLat} lnglat location\n * @returns {Point} screen point\n */\n locationPoint(lnglat: LngLat) {\n return this.coordinatePoint(this.locationCoordinate(lnglat));\n }\n\n /**\n * Given a point on screen, return its lnglat\n * @param {Point} p screen point\n * @returns {LngLat} lnglat location\n */\n pointLocation(p: Point) {\n return this.coordinateLocation(this.pointCoordinate(p));\n }\n\n /**\n * Given a geographical lnglat, return an unrounded\n * coordinate that represents it at this transform's zoom level.\n * @param {LngLat} lnglat\n * @returns {Coordinate}\n */\n locationCoordinate(lnglat: LngLat) {\n return new Coordinate(\n this.lngX(lnglat.lng) / this.tileSize,\n this.latY(lnglat.lat) / this.tileSize,\n this.zoom).zoomTo(this.tileZoom);\n }\n\n /**\n * Given a Coordinate, return its geographical position.\n * @param {Coordinate} coord\n * @returns {LngLat} lnglat\n */\n coordinateLocation(coord: Coordinate) {\n const zoomedCoord = coord.zoomTo(this.zoom);\n return new LngLat(\n this.xLng(zoomedCoord.column * this.tileSize),\n this.yLat(zoomedCoord.row * this.tileSize));\n }\n\n pointCoordinate(p: Point, zoom?: number) {\n if (zoom === undefined) zoom = this.tileZoom;\n\n const targetZ = 0;\n // since we don't know the correct projected z value for the point,\n // unproject two points to get a line and then find the point on that\n // line with z=0\n\n const coord0 = [p.x, p.y, 0, 1];\n const coord1 = [p.x, p.y, 1, 1];\n\n vec4.transformMat4(coord0, coord0, this.pixelMatrixInverse);\n vec4.transformMat4(coord1, coord1, this.pixelMatrixInverse);\n\n const w0 = coord0[3];\n const w1 = coord1[3];\n const x0 = coord0[0] / w0;\n const x1 = coord1[0] / w1;\n const y0 = coord0[1] / w0;\n const y1 = coord1[1] / w1;\n const z0 = coord0[2] / w0;\n const z1 = coord1[2] / w1;\n\n const t = z0 === z1 ? 0 : (targetZ - z0) / (z1 - z0);\n\n return new Coordinate(\n interpolate(x0, x1, t) / this.tileSize,\n interpolate(y0, y1, t) / this.tileSize,\n this.zoom)._zoomTo(zoom);\n }\n\n /**\n * Given a coordinate, return the screen point that corresponds to it\n * @param {Coordinate} coord\n * @returns {Point} screen point\n */\n coordinatePoint(coord: Coordinate) {\n const zoomedCoord = coord.zoomTo(this.zoom);\n const p = [zoomedCoord.column * this.tileSize, zoomedCoord.row * this.tileSize, 0, 1];\n vec4.transformMat4(p, p, this.pixelMatrix);\n return new Point(p[0] / p[3], p[1] / p[3]);\n }\n\n /**\n * Calculate the posMatrix that, given a tile coordinate, would be used to display the tile on a map.\n * @param {UnwrappedTileID} unwrappedTileID;\n */\n calculatePosMatrix(unwrappedTileID: UnwrappedTileID, aligned: boolean = false): Float32Array {\n const posMatrixKey = unwrappedTileID.key;\n const cache = aligned ? this._alignedPosMatrixCache : this._posMatrixCache;\n if (cache[posMatrixKey]) {\n return cache[posMatrixKey];\n }\n\n const canonical = unwrappedTileID.canonical;\n const scale = this.worldSize / this.zoomScale(canonical.z);\n const unwrappedX = canonical.x + Math.pow(2, canonical.z) * unwrappedTileID.wrap;\n\n const posMatrix = mat4.identity(new Float64Array(16));\n mat4.translate(posMatrix, posMatrix, [unwrappedX * scale, canonical.y * scale, 0]);\n mat4.scale(posMatrix, posMatrix, [scale / EXTENT, scale / EXTENT, 1]);\n mat4.multiply(posMatrix, aligned ? this.alignedProjMatrix : this.projMatrix, posMatrix);\n\n cache[posMatrixKey] = new Float32Array(posMatrix);\n return cache[posMatrixKey];\n }\n\n _constrain() {\n if (!this.center || !this.width || !this.height || this._constraining) return;\n\n this._constraining = true;\n\n let minY = -90;\n let maxY = 90;\n let minX = -180;\n let maxX = 180;\n let sy, sx, x2, y2;\n const size = this.size,\n unmodified = this._unmodified;\n\n if (this.latRange) {\n const latRange = this.latRange;\n minY = this.latY(latRange[1]);\n maxY = this.latY(latRange[0]);\n sy = maxY - minY < size.y ? size.y / (maxY - minY) : 0;\n }\n\n if (this.lngRange) {\n const lngRange = this.lngRange;\n minX = this.lngX(lngRange[0]);\n maxX = this.lngX(lngRange[1]);\n sx = maxX - minX < size.x ? size.x / (maxX - minX) : 0;\n }\n\n // how much the map should scale to fit the screen into given latitude/longitude ranges\n const s = Math.max(sx || 0, sy || 0);\n\n if (s) {\n this.center = this.unproject(new Point(\n sx ? (maxX + minX) / 2 : this.x,\n sy ? (maxY + minY) / 2 : this.y));\n this.zoom += this.scaleZoom(s);\n this._unmodified = unmodified;\n this._constraining = false;\n return;\n }\n\n if (this.latRange) {\n const y = this.y,\n h2 = size.y / 2;\n\n if (y - h2 < minY) y2 = minY + h2;\n if (y + h2 > maxY) y2 = maxY - h2;\n }\n\n if (this.lngRange) {\n const x = this.x,\n w2 = size.x / 2;\n\n if (x - w2 < minX) x2 = minX + w2;\n if (x + w2 > maxX) x2 = maxX - w2;\n }\n\n // pan the map if the screen goes off the range\n if (x2 !== undefined || y2 !== undefined) {\n this.center = this.unproject(new Point(\n x2 !== undefined ? x2 : this.x,\n y2 !== undefined ? y2 : this.y));\n }\n\n this._unmodified = unmodified;\n this._constraining = false;\n }\n\n _calcMatrices() {\n if (!this.height) return;\n\n this.cameraToCenterDistance = 0.5 / Math.tan(this._fov / 2) * this.height;\n\n // Find the distance from the center point [width/2, height/2] to the\n // center top point [width/2, 0] in Z units, using the law of sines.\n // 1 Z unit is equivalent to 1 horizontal px at the center of the map\n // (the distance between[width/2, height/2] and [width/2 + 1, height/2])\n const halfFov = this._fov / 2;\n const groundAngle = Math.PI / 2 + this._pitch;\n const topHalfSurfaceDistance = Math.sin(halfFov) * this.cameraToCenterDistance / Math.sin(Math.PI - groundAngle - halfFov);\n const x = this.x, y = this.y;\n\n // Calculate z distance of the farthest fragment that should be rendered.\n const furthestDistance = Math.cos(Math.PI / 2 - this._pitch) * topHalfSurfaceDistance + this.cameraToCenterDistance;\n // Add a bit extra to avoid precision problems when a fragment's distance is exactly `furthestDistance`\n const farZ = furthestDistance * 1.01;\n\n // matrix for conversion from location to GL coordinates (-1 .. 1)\n let m = new Float64Array(16);\n mat4.perspective(m, this._fov, this.width / this.height, 1, farZ);\n\n mat4.scale(m, m, [1, -1, 1]);\n mat4.translate(m, m, [0, 0, -this.cameraToCenterDistance]);\n mat4.rotateX(m, m, this._pitch);\n mat4.rotateZ(m, m, this.angle);\n mat4.translate(m, m, [-x, -y, 0]);\n\n // scale vertically to meters per pixel (inverse of ground resolution):\n // worldSize / (circumferenceOfEarth * cos(lat * π / 180))\n const verticalScale = this.worldSize / (2 * Math.PI * 6378137 * Math.abs(Math.cos(this.center.lat * (Math.PI / 180))));\n mat4.scale(m, m, [1, 1, verticalScale, 1]);\n\n this.projMatrix = m;\n\n // Make a second projection matrix that is aligned to a pixel grid for rendering raster tiles.\n // We're rounding the (floating point) x/y values to achieve to avoid rendering raster images to fractional\n // coordinates. Additionally, we adjust by half a pixel in either direction in case that viewport dimension\n // is an odd integer to preserve rendering to the pixel grid. We're rotating this shift based on the angle\n // of the transformation so that 0°, 90°, 180°, and 270° rasters are crisp, and adjust the shift so that\n // it is always <= 0.5 pixels.\n const xShift = (this.width % 2) / 2, yShift = (this.height % 2) / 2,\n angleCos = Math.cos(this.angle), angleSin = Math.sin(this.angle),\n dx = x - Math.round(x) + angleCos * xShift + angleSin * yShift,\n dy = y - Math.round(y) + angleCos * yShift + angleSin * xShift;\n const alignedM = new Float64Array(m);\n mat4.translate(alignedM, alignedM, [ dx > 0.5 ? dx - 1 : dx, dy > 0.5 ? dy - 1 : dy, 0 ]);\n this.alignedProjMatrix = alignedM;\n\n // matrix for conversion from location to screen coordinates\n m = mat4.create();\n mat4.scale(m, m, [this.width / 2, -this.height / 2, 1]);\n mat4.translate(m, m, [1, -1, 0]);\n this.pixelMatrix = mat4.multiply(new Float64Array(16), m, this.projMatrix);\n\n // inverse matrix for conversion from screen coordinaes to location\n m = mat4.invert(new Float64Array(16), this.pixelMatrix);\n if (!m) throw new Error(\"failed to invert matrix\");\n this.pixelMatrixInverse = m;\n\n this._posMatrixCache = {};\n this._alignedPosMatrixCache = {};\n }\n\n maxPitchScaleFactor() {\n // calcMatrices hasn't run yet\n if (!this.pixelMatrixInverse) return 1;\n\n const coord = this.pointCoordinate(new Point(0, 0)).zoomTo(this.zoom);\n const p = [coord.column * this.tileSize, coord.row * this.tileSize, 0, 1];\n const topPoint = vec4.transformMat4(p, p, this.pixelMatrix);\n return topPoint[3] / this.cameraToCenterDistance;\n }\n}\n\nexport default Transform;\n","// @flow\n\nimport { bindAll } from '../util/util';\nimport window from '../util/window';\nimport throttle from '../util/throttle';\n\nimport type Map from './map';\n\n/*\n * Adds the map's position to its page's location hash.\n * Passed as an option to the map object.\n *\n * @returns {Hash} `this`\n */\nclass Hash {\n _map: Map;\n _updateHash: () => TimeoutID;\n\n constructor() {\n bindAll([\n '_onHashChange',\n '_updateHash'\n ], this);\n\n // Mobile Safari doesn't allow updating the hash more than 100 times per 30 seconds.\n this._updateHash = throttle(this._updateHashUnthrottled.bind(this), 30 * 1000 / 100);\n }\n\n /*\n * Map element to listen for coordinate changes\n *\n * @param {Object} map\n * @returns {Hash} `this`\n */\n addTo(map: Map) {\n this._map = map;\n window.addEventListener('hashchange', this._onHashChange, false);\n this._map.on('moveend', this._updateHash);\n return this;\n }\n\n /*\n * Removes hash\n *\n * @returns {Popup} `this`\n */\n remove() {\n window.removeEventListener('hashchange', this._onHashChange, false);\n this._map.off('moveend', this._updateHash);\n clearTimeout(this._updateHash());\n\n delete this._map;\n return this;\n }\n\n getHashString(mapFeedback?: boolean) {\n const center = this._map.getCenter(),\n zoom = Math.round(this._map.getZoom() * 100) / 100,\n // derived from equation: 512px * 2^z / 360 / 10^d < 0.5px\n precision = Math.ceil((zoom * Math.LN2 + Math.log(512 / 360 / 0.5)) / Math.LN10),\n m = Math.pow(10, precision),\n lng = Math.round(center.lng * m) / m,\n lat = Math.round(center.lat * m) / m,\n bearing = this._map.getBearing(),\n pitch = this._map.getPitch();\n let hash = '';\n if (mapFeedback) {\n // new map feedback site has some constraints that don't allow\n // us to use the same hash format as we do for the Map hash option.\n hash += `#/${lng}/${lat}/${zoom}`;\n } else {\n hash += `#${zoom}/${lat}/${lng}`;\n }\n\n if (bearing || pitch) hash += (`/${Math.round(bearing * 10) / 10}`);\n if (pitch) hash += (`/${Math.round(pitch)}`);\n return hash;\n }\n\n _onHashChange() {\n const loc = window.location.hash.replace('#', '').split('/');\n if (loc.length >= 3) {\n this._map.jumpTo({\n center: [+loc[2], +loc[1]],\n zoom: +loc[0],\n bearing: +(loc[3] || 0),\n pitch: +(loc[4] || 0)\n });\n return true;\n }\n return false;\n }\n\n _updateHashUnthrottled() {\n const hash = this.getHashString();\n window.history.replaceState(window.history.state, '', hash);\n }\n\n}\n\nexport default Hash;\n","// @flow\n\n/**\n * Throttle the given function to run at most every `period` milliseconds.\n Throttle the given function to run at most every period milliseconds.\n * @private\n */\nexport default function throttle(fn: () => void, time: number): () => TimeoutID {\n let pending = false;\n let timerId: TimeoutID = (0: any);\n\n const later = () => {\n timerId = (0: any);\n if (pending) {\n fn();\n timerId = setTimeout(later, time);\n pending = false;\n }\n };\n\n return () => {\n pending = true;\n if (!timerId) {\n later();\n }\n return timerId;\n };\n}\n","// @flow\n\nimport { Event } from '../util/evented';\n\nimport DOM from '../util/dom';\nimport Point from '@mapbox/point-geometry';\nimport { extend } from '../util/util';\n\nimport type Map from './map';\nimport type LngLat from '../geo/lng_lat';\nimport type LngLatBounds from '../geo/lng_lat_bounds';\n\n/**\n * `MapMouseEvent` is the event type for mouse-related map events.\n * @extends {Object}\n */\nexport class MapMouseEvent extends Event {\n /**\n * The event type.\n */\n type: 'mousedown'\n | 'mouseup'\n | 'click'\n | 'dblclick'\n | 'mousemove'\n | 'mouseover'\n | 'mouseenter'\n | 'mouseleave'\n | 'mouseover'\n | 'mouseout'\n | 'contextmenu';\n\n /**\n * The `Map` object that fired the event.\n */\n target: Map;\n\n /**\n * The DOM event which caused the map event.\n */\n originalEvent: MouseEvent;\n\n /**\n * The pixel coordinates of the mouse cursor, relative to the map and measured from the top left corner.\n */\n point: Point;\n\n /**\n * The geographic location on the map of the mouse cursor.\n */\n lngLat: LngLat;\n\n /**\n * Prevents subsequent default processing of the event by the map.\n *\n * Calling this method will prevent the following default map behaviors:\n *\n * * On `mousedown` events, the behavior of {@link DragPanHandler}\n * * On `mousedown` events, the behavior of {@link DragRotateHandler}\n * * On `mousedown` events, the behavior of {@link BoxZoomHandler}\n * * On `dblclick` events, the behavior of {@link DoubleClickZoomHandler}\n *\n */\n preventDefault() {\n this._defaultPrevented = true;\n }\n\n /**\n * `true` if `preventDefault` has been called.\n */\n get defaultPrevented(): boolean {\n return this._defaultPrevented;\n }\n\n _defaultPrevented: boolean;\n\n /**\n * @private\n */\n constructor(type: string, map: Map, originalEvent: MouseEvent, data: Object = {}) {\n const point = DOM.mousePos(map.getCanvasContainer(), originalEvent);\n const lngLat = map.unproject(point);\n super(type, extend({ point, lngLat, originalEvent }, data));\n this._defaultPrevented = false;\n this.target = map;\n }\n}\n\n/**\n * `MapTouchEvent` is the event type for touch-related map events.\n * @extends {Object}\n */\nexport class MapTouchEvent extends Event {\n /**\n * The event type.\n */\n type: 'touchstart'\n | 'touchend'\n | 'touchcancel';\n\n /**\n * The `Map` object that fired the event.\n */\n map: Map;\n\n /**\n * The DOM event which caused the map event.\n */\n originalEvent: TouchEvent;\n\n /**\n * The geographic location on the map of the center of the touch event points.\n */\n lngLat: LngLat;\n\n /**\n * The pixel coordinates of the center of the touch event points, relative to the map and measured from the top left\n * corner.\n */\n point: Point;\n\n /**\n * The array of pixel coordinates corresponding to a\n * [touch event's `touches`](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/touches) property.\n */\n points: Array;\n\n /**\n * The geographical locations on the map corresponding to a\n * [touch event's `touches`](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/touches) property.\n */\n lngLats: Array;\n\n /**\n * Prevents subsequent default processing of the event by the map.\n *\n * Calling this method will prevent the following default map behaviors:\n *\n * * On `touchstart` events, the behavior of {@link DragPanHandler}\n * * On `touchstart` events, the behavior of {@link TouchZoomRotateHandler}\n *\n */\n preventDefault() {\n this._defaultPrevented = true;\n }\n\n /**\n * `true` if `preventDefault` has been called.\n */\n get defaultPrevented(): boolean {\n return this._defaultPrevented;\n }\n\n _defaultPrevented: boolean;\n\n /**\n * @private\n */\n constructor(type: string, map: Map, originalEvent: TouchEvent) {\n const points = DOM.touchPos(map.getCanvasContainer(), originalEvent);\n const lngLats = points.map((t) => map.unproject(t));\n const point = points.reduce((prev, curr, i, arr) => {\n return prev.add(curr.div(arr.length));\n }, new Point(0, 0));\n const lngLat = map.unproject(point);\n super(type, { points, point, lngLats, lngLat, originalEvent });\n this._defaultPrevented = false;\n }\n}\n\n\n/**\n * `MapWheelEvent` is the event type for the `wheel` map event.\n * @extends {Object}\n */\nexport class MapWheelEvent extends Event {\n /**\n * The event type.\n */\n type: 'wheel';\n\n /**\n * The `Map` object that fired the event.\n */\n map: Map;\n\n /**\n * The DOM event which caused the map event.\n */\n originalEvent: WheelEvent;\n\n /**\n * Prevents subsequent default processing of the event by the map.\n *\n * Calling this method will prevent the the behavior of {@link ScrollZoomHandler}.\n */\n preventDefault() {\n this._defaultPrevented = true;\n }\n\n /**\n * `true` if `preventDefault` has been called.\n */\n get defaultPrevented(): boolean {\n return this._defaultPrevented;\n }\n\n _defaultPrevented: boolean;\n\n /**\n * @private\n */\n constructor(type: string, map: Map, originalEvent: WheelEvent) {\n super(type, { originalEvent });\n this._defaultPrevented = false;\n }\n}\n\n/**\n * @typedef {Object} MapBoxZoomEvent\n * @property {MouseEvent} originalEvent\n * @property {LngLatBounds} boxZoomBounds The bounding box of the \"box zoom\" interaction.\n * This property is only provided for `boxzoomend` events.\n */\nexport type MapBoxZoomEvent = {\n type: 'boxzoomstart'\n | 'boxzoomend'\n | 'boxzoomcancel',\n map: Map,\n originalEvent: MouseEvent,\n boxZoomBounds: LngLatBounds\n};\n\n/**\n * A `MapDataEvent` object is emitted with the {@link Map.event:data}\n * and {@link Map.event:dataloading} events. Possible values for\n * `dataType`s are:\n *\n * - `'source'`: The non-tile data associated with any source\n * - `'style'`: The [style](https://www.mapbox.com/mapbox-gl-style-spec/) used by the map\n *\n * @typedef {Object} MapDataEvent\n * @property {string} type The event type.\n * @property {string} dataType The type of data that has changed. One of `'source'`, `'style'`.\n * @property {boolean} [isSourceLoaded] True if the event has a `dataType` of `source` and the source has no outstanding network requests.\n * @property {Object} [source] The [style spec representation of the source](https://www.mapbox.com/mapbox-gl-style-spec/#sources) if the event has a `dataType` of `source`.\n * @property {string} [sourceDataType] Included if the event has a `dataType` of `source` and the event signals\n * that internal data has been received or changed. Possible values are `metadata` and `content`.\n * @property {Object} [tile] The tile being loaded or changed, if the event has a `dataType` of `source` and\n * the event is related to loading of a tile.\n * @property {Coordinate} [coord] The coordinate of the tile if the event has a `dataType` of `source` and\n * the event is related to loading of a tile.\n */\nexport type MapDataEvent = {\n type: string,\n dataType: string\n};\n\nexport type MapContextEvent = {\n type: 'webglcontextlost' | 'webglcontextrestored',\n originalEvent: WebGLContextEvent\n}\n\nexport type MapEvent =\n /**\n * Fired when a pointing device (usually a mouse) is pressed within the map.\n *\n * @event mousedown\n * @memberof Map\n * @instance\n * @property {MapMouseEvent} data\n * @see [Highlight features within a bounding box](https://www.mapbox.com/mapbox-gl-js/example/using-box-queryrenderedfeatures/)\n * @see [Create a draggable point](https://www.mapbox.com/mapbox-gl-js/example/drag-a-point/)\n */\n | 'mousedown'\n\n /**\n * Fired when a pointing device (usually a mouse) is released within the map.\n *\n * @event mouseup\n * @memberof Map\n * @instance\n * @property {MapMouseEvent} data\n * @see [Highlight features within a bounding box](https://www.mapbox.com/mapbox-gl-js/example/using-box-queryrenderedfeatures/)\n * @see [Create a draggable point](https://www.mapbox.com/mapbox-gl-js/example/drag-a-point/)\n */\n | 'mouseup'\n\n /**\n * Fired when a pointing device (usually a mouse) is moved within the map.\n *\n * @event mouseover\n * @memberof Map\n * @instance\n * @property {MapMouseEvent} data\n * @see [Get coordinates of the mouse pointer](https://www.mapbox.com/mapbox-gl-js/example/mouse-position/)\n * @see [Highlight features under the mouse pointer](https://www.mapbox.com/mapbox-gl-js/example/hover-styles/)\n * @see [Display a popup on hover](https://www.mapbox.com/mapbox-gl-js/example/popup-on-hover/)\n */\n | 'mouseover'\n\n /**\n * Fired when a pointing device (usually a mouse) is moved within the map.\n *\n * @event mousemove\n * @memberof Map\n * @instance\n * @property {MapMouseEvent} data\n * @see [Get coordinates of the mouse pointer](https://www.mapbox.com/mapbox-gl-js/example/mouse-position/)\n * @see [Highlight features under the mouse pointer](https://www.mapbox.com/mapbox-gl-js/example/hover-styles/)\n * @see [Display a popup on over](https://www.mapbox.com/mapbox-gl-js/example/popup-on-hover/)\n */\n | 'mousemove'\n\n /**\n * Fired when a pointing device (usually a mouse) is pressed and released at the same point on the map.\n *\n * @event click\n * @memberof Map\n * @instance\n * @property {MapMouseEvent} data\n * @see [Measure distances](https://www.mapbox.com/mapbox-gl-js/example/measure/)\n * @see [Center the map on a clicked symbol](https://www.mapbox.com/mapbox-gl-js/example/center-on-symbol/)\n */\n | 'click'\n\n /**\n * Fired when a pointing device (usually a mouse) is clicked twice at the same point on the map.\n *\n * @event dblclick\n * @memberof Map\n * @instance\n * @property {MapMouseEvent} data\n */\n | 'dblclick'\n\n /**\n * Fired when a pointing device (usually a mouse) enters a visible portion of a specified layer from\n * outside that layer or outside the map canvas. This event can only be listened for via the three-argument\n * version of {@link Map#on}, where the second argument specifies the desired layer.\n *\n * @event mouseenter\n * @memberof Map\n * @instance\n * @property {MapMouseEvent} data\n */\n | 'mouseenter'\n\n /**\n * Fired when a pointing device (usually a mouse) leaves a visible portion of a specified layer, or leaves\n * the map canvas. This event can only be listened for via the three-argument version of {@link Map#on},\n * where the second argument specifies the desired layer.\n *\n * @event mouseleave\n * @memberof Map\n * @instance\n * @property {MapMouseEvent} data\n * @see [Highlight features under the mouse pointer](https://www.mapbox.com/mapbox-gl-js/example/hover-styles/)\n */\n | 'mouseleave'\n\n /**\n * Synonym for `mouseenter`.\n *\n * @event mouseover\n * @memberof Map\n * @instance\n * @property {MapMouseEvent} data\n */\n | 'mouseover'\n\n /**\n * Fired when a point device (usually a mouse) leaves the map's canvas.\n *\n * @event mouseout\n * @memberof Map\n * @instance\n * @property {MapMouseEvent} data\n */\n | 'mouseout'\n\n /**\n * Fired when the right button of the mouse is clicked or the context menu key is pressed within the map.\n *\n * @event contextmenu\n * @memberof Map\n * @instance\n * @property {MapMouseEvent} data\n */\n | 'contextmenu'\n\n /**\n * Fired when a [`wheel`](https://developer.mozilla.org/en-US/docs/Web/Events/wheel) event occurs within the map.\n *\n * @event wheel\n * @memberof Map\n * @instance\n * @property {MapWheelEvent} data\n */\n | 'wheel'\n\n /**\n * Fired when a [`touchstart`](https://developer.mozilla.org/en-US/docs/Web/Events/touchstart) event occurs within the map.\n *\n * @event touchstart\n * @memberof Map\n * @instance\n * @property {MapTouchEvent} data\n */\n | 'touchstart'\n\n /**\n * Fired when a [`touchend`](https://developer.mozilla.org/en-US/docs/Web/Events/touchend) event occurs within the map.\n *\n * @event touchend\n * @memberof Map\n * @instance\n * @property {MapTouchEvent} data\n */\n | 'touchend'\n\n /**\n * Fired when a [`touchmove`](https://developer.mozilla.org/en-US/docs/Web/Events/touchmove) event occurs within the map.\n *\n * @event touchmove\n * @memberof Map\n * @instance\n * @property {MapTouchEvent} data\n */\n | 'touchmove'\n\n /**\n * Fired when a [`touchcancel`](https://developer.mozilla.org/en-US/docs/Web/Events/touchcancel) event occurs within the map.\n *\n * @event touchcancel\n * @memberof Map\n * @instance\n * @property {MapTouchEvent} data\n */\n | 'touchcancel'\n\n /**\n * Fired just before the map begins a transition from one\n * view to another, as the result of either user interaction or methods such as {@link Map#jumpTo}.\n *\n * @event movestart\n * @memberof Map\n * @instance\n * @property {{originalEvent: DragEvent}} data\n */\n | 'movestart'\n\n /**\n * Fired repeatedly during an animated transition from one view to\n * another, as the result of either user interaction or methods such as {@link Map#flyTo}.\n *\n * @event move\n * @memberof Map\n * @instance\n * @property {MapMouseEvent | MapTouchEvent} data\n */\n | 'move'\n\n /**\n * Fired just after the map completes a transition from one\n * view to another, as the result of either user interaction or methods such as {@link Map#jumpTo}.\n *\n * @event moveend\n * @memberof Map\n * @instance\n * @property {{originalEvent: DragEvent}} data\n * @see [Play map locations as a slideshow](https://www.mapbox.com/mapbox-gl-js/example/playback-locations/)\n * @see [Filter features within map view](https://www.mapbox.com/mapbox-gl-js/example/filter-features-within-map-view/)\n */\n | 'moveend'\n\n /**\n * Fired when a \"drag to pan\" interaction starts. See {@link DragPanHandler}.\n *\n * @event dragstart\n * @memberof Map\n * @instance\n * @property {{originalEvent: DragEvent}} data\n */\n | 'dragstart'\n\n /**\n * Fired repeatedly during a \"drag to pan\" interaction. See {@link DragPanHandler}.\n *\n * @event drag\n * @memberof Map\n * @instance\n * @property {MapMouseEvent | MapTouchEvent} data\n */\n | 'drag'\n\n /**\n * Fired when a \"drag to pan\" interaction ends. See {@link DragPanHandler}.\n *\n * @event dragend\n * @memberof Map\n * @instance\n * @property {{originalEvent: DragEvent}} data\n */\n | 'dragend'\n\n /**\n * Fired just before the map begins a transition from one zoom level to another,\n * as the result of either user interaction or methods such as {@link Map#flyTo}.\n *\n * @event zoomstart\n * @memberof Map\n * @instance\n * @property {MapMouseEvent | MapTouchEvent} data\n */\n | 'zoomstart'\n\n /**\n * Fired repeatedly during an animated transition from one zoom level to another,\n * as the result of either user interaction or methods such as {@link Map#flyTo}.\n *\n * @event zoom\n * @memberof Map\n * @instance\n * @property {MapMouseEvent | MapTouchEvent} data\n * @see [Update a choropleth layer by zoom level](https://www.mapbox.com/mapbox-gl-js/example/updating-choropleth/)\n */\n | 'zoom'\n\n /**\n * Fired just after the map completes a transition from one zoom level to another,\n * as the result of either user interaction or methods such as {@link Map#flyTo}.\n *\n * @event zoomend\n * @memberof Map\n * @instance\n * @property {MapMouseEvent | MapTouchEvent} data\n */\n | 'zoomend'\n\n /**\n * Fired when a \"drag to rotate\" interaction starts. See {@link DragRotateHandler}.\n *\n * @event rotatestart\n * @memberof Map\n * @instance\n * @property {MapMouseEvent | MapTouchEvent} data\n */\n | 'rotatestart'\n\n /**\n * Fired repeatedly during a \"drag to rotate\" interaction. See {@link DragRotateHandler}.\n *\n * @event rotate\n * @memberof Map\n * @instance\n * @property {MapMouseEvent | MapTouchEvent} data\n */\n | 'rotate'\n\n /**\n * Fired when a \"drag to rotate\" interaction ends. See {@link DragRotateHandler}.\n *\n * @event rotateend\n * @memberof Map\n * @instance\n * @property {MapMouseEvent | MapTouchEvent} data\n */\n | 'rotateend'\n\n /**\n * Fired whenever the map's pitch (tilt) begins a change as\n * the result of either user interaction or methods such as {@link Map#flyTo} .\n *\n * @event pitchstart\n * @memberof Map\n * @instance\n * @property {MapEventData} data\n */\n | 'pitchstart'\n\n /**\n * Fired whenever the map's pitch (tilt) changes as.\n * the result of either user interaction or methods such as {@link Map#flyTo}.\n *\n * @event pitch\n * @memberof Map\n * @instance\n * @property {MapEventData} data\n */\n | 'pitch'\n\n /**\n * Fired immediately after the map's pitch (tilt) finishes changing as\n * the result of either user interaction or methods such as {@link Map#flyTo}.\n *\n * @event pitchend\n * @memberof Map\n * @instance\n * @property {MapEventData} data\n */\n | 'pitchend'\n\n /**\n * Fired when a \"box zoom\" interaction starts. See {@link BoxZoomHandler}.\n *\n * @event boxzoomstart\n * @memberof Map\n * @instance\n * @property {MapBoxZoomEvent} data\n */\n | 'boxzoomstart'\n\n /**\n * Fired when a \"box zoom\" interaction ends. See {@link BoxZoomHandler}.\n *\n * @event boxzoomend\n * @memberof Map\n * @instance\n * @type {Object}\n * @property {MapBoxZoomEvent} data\n */\n | 'boxzoomend'\n\n /**\n * Fired when the user cancels a \"box zoom\" interaction, or when the bounding box does not meet the minimum size threshold.\n * See {@link BoxZoomHandler}.\n *\n * @event boxzoomcancel\n * @memberof Map\n * @instance\n * @property {MapBoxZoomEvent} data\n */\n | 'boxzoomcancel'\n\n /**\n * Fired immediately after the map has been resized.\n *\n * @event resize\n * @memberof Map\n * @instance\n */\n | 'resize'\n\n /**\n * Fired when the WebGL context is lost.\n *\n * @event webglcontextlost\n * @memberof Map\n * @instance\n */\n | 'webglcontextlost'\n\n /**\n * Fired when the WebGL context is restored.\n *\n * @event webglcontextrestored\n * @memberof Map\n * @instance\n */\n | 'webglcontextrestored'\n\n /**\n * Fired immediately after all necessary resources have been downloaded\n * and the first visually complete rendering of the map has occurred.\n *\n * @event load\n * @memberof Map\n * @instance\n * @type {Object}\n * @see [Draw GeoJSON points](https://www.mapbox.com/mapbox-gl-js/example/geojson-markers/)\n * @see [Add live realtime data](https://www.mapbox.com/mapbox-gl-js/example/live-geojson/)\n * @see [Animate a point](https://www.mapbox.com/mapbox-gl-js/example/animate-point-along-line/)\n */\n | 'load'\n\n /**\n * Fired whenever the map is drawn to the screen, as the result of\n *\n * - a change to the map's position, zoom, pitch, or bearing\n * - a change to the map's style\n * - a change to a GeoJSON source\n * - the loading of a vector tile, GeoJSON file, glyph, or sprite\n *\n * @event render\n * @memberof Map\n * @instance\n */\n | 'render'\n\n /**\n * Fired immediately after the map has been removed with {@link Map.event:remove}.\n *\n * @event remove\n * @memberof Map\n * @instance\n */\n | 'remove'\n\n /**\n * Fired when an error occurs. This is GL JS's primary error reporting\n * mechanism. We use an event instead of `throw` to better accommodate\n * asyncronous operations. If no listeners are bound to the `error` event, the\n * error will be printed to the console.\n *\n * @event error\n * @memberof Map\n * @instance\n * @property {{error: {message: string}}} data\n */\n | 'error'\n\n /**\n * Fired when any map data loads or changes. See {@link MapDataEvent}\n * for more information.\n *\n * @event data\n * @memberof Map\n * @instance\n * @property {MapDataEvent} data\n */\n | 'data'\n\n /**\n * Fired when the map's style loads or changes. See\n * {@link MapDataEvent} for more information.\n *\n * @event styledata\n * @memberof Map\n * @instance\n * @property {MapDataEvent} data\n */\n | 'styledata'\n\n /**\n * Fired when one of the map's sources loads or changes, including if a tile belonging\n * to a source loads or changes. See {@link MapDataEvent} for more information.\n *\n * @event sourcedata\n * @memberof Map\n * @instance\n * @property {MapDataEvent} data\n */\n | 'sourcedata'\n\n /**\n * Fired when any map data (style, source, tile, etc) begins loading or\n * changing asyncronously. All `dataloading` events are followed by a `data`\n * or `error` event. See {@link MapDataEvent} for more information.\n *\n * @event dataloading\n * @memberof Map\n * @instance\n * @property {MapDataEvent} data\n */\n | 'dataloading'\n\n /**\n * Fired when the map's style begins loading or changing asyncronously.\n * All `styledataloading` events are followed by a `styledata`\n * or `error` event. See {@link MapDataEvent} for more information.\n *\n * @event styledataloading\n * @memberof Map\n * @instance\n * @property {MapDataEvent} data\n */\n | 'styledataloading'\n\n /**\n * Fired when one of the map's sources begins loading or changing asyncronously.\n * All `sourcedataloading` events are followed by a `sourcedata` or `error` event.\n * See {@link MapDataEvent} for more information.\n *\n * @event sourcedataloading\n * @memberof Map\n * @instance\n * @property {MapDataEvent} data\n */\n | 'sourcedataloading'\n\n /**\n * @event style.load\n * @memberof Map\n * @instance\n * @private\n */\n | 'style.load';\n","// @flow\n\nimport DOM from '../../util/dom';\n\nimport { ease as _ease, bindAll, bezier } from '../../util/util';\nimport browser from '../../util/browser';\nimport window from '../../util/window';\nimport { number as interpolate } from '../../style-spec/util/interpolate';\nimport LngLat from '../../geo/lng_lat';\nimport { Event } from '../../util/evented';\n\nimport type Map from '../map';\nimport type Point from '@mapbox/point-geometry';\nimport type {TaskID} from '../../util/task_queue';\n\n// deltaY value for mouse scroll wheel identification\nconst wheelZoomDelta = 4.000244140625;\n// These magic numbers control the rate of zoom. Trackpad events fire at a greater\n// frequency than mouse scroll wheel, so reduce the zoom rate per wheel tick\nconst defaultZoomRate = 1 / 100;\nconst wheelZoomRate = 1 / 450;\n\n// upper bound on how much we scale the map in any single render frame; this\n// is used to limit zoom rate in the case of very fast scrolling\nconst maxScalePerFrame = 2;\n\n/**\n * The `ScrollZoomHandler` allows the user to zoom the map by scrolling.\n */\nclass ScrollZoomHandler {\n _map: Map;\n _el: HTMLElement;\n _enabled: boolean;\n _active: boolean;\n _aroundCenter: boolean;\n _around: Point;\n _aroundPoint: Point;\n _type: 'wheel' | 'trackpad' | null;\n _lastValue: number;\n _timeout: ?TimeoutID; // used for delayed-handling of a single wheel movement\n _finishTimeout: ?TimeoutID; // used to delay final '{move,zoom}end' events\n\n _lastWheelEvent: any;\n _lastWheelEventTime: number;\n\n _startZoom: number;\n _targetZoom: number;\n _delta: number;\n _easing: (number) => number;\n _prevEase: {start: number, duration: number, easing: (number) => number};\n\n _frameId: ?TaskID;\n\n /**\n * @private\n */\n constructor(map: Map) {\n this._map = map;\n this._el = map.getCanvasContainer();\n\n this._delta = 0;\n\n bindAll([\n '_onWheel',\n '_onTimeout',\n '_onScrollFrame',\n '_onScrollFinished'\n ], this);\n }\n\n /**\n * Returns a Boolean indicating whether the \"scroll to zoom\" interaction is enabled.\n *\n * @returns {boolean} `true` if the \"scroll to zoom\" interaction is enabled.\n */\n isEnabled() {\n return !!this._enabled;\n }\n\n isActive() {\n return !!this._active;\n }\n\n /**\n * Enables the \"scroll to zoom\" interaction.\n *\n * @param {Object} [options]\n * @param {string} [options.around] If \"center\" is passed, map will zoom around center of map\n *\n * @example\n * map.scrollZoom.enable();\n * @example\n * map.scrollZoom.enable({ around: 'center' })\n */\n enable(options: any) {\n if (this.isEnabled()) return;\n this._enabled = true;\n this._aroundCenter = options && options.around === 'center';\n }\n\n /**\n * Disables the \"scroll to zoom\" interaction.\n *\n * @example\n * map.scrollZoom.disable();\n */\n disable() {\n if (!this.isEnabled()) return;\n this._enabled = false;\n }\n\n onWheel(e: WheelEvent) {\n if (!this.isEnabled()) return;\n\n // Remove `any` cast when https://github.com/facebook/flow/issues/4879 is fixed.\n let value = e.deltaMode === (window.WheelEvent: any).DOM_DELTA_LINE ? e.deltaY * 40 : e.deltaY;\n const now = browser.now(),\n timeDelta = now - (this._lastWheelEventTime || 0);\n\n this._lastWheelEventTime = now;\n\n if (value !== 0 && (value % wheelZoomDelta) === 0) {\n // This one is definitely a mouse wheel event.\n this._type = 'wheel';\n\n } else if (value !== 0 && Math.abs(value) < 4) {\n // This one is definitely a trackpad event because it is so small.\n this._type = 'trackpad';\n\n } else if (timeDelta > 400) {\n // This is likely a new scroll action.\n this._type = null;\n this._lastValue = value;\n\n // Start a timeout in case this was a singular event, and dely it by up to 40ms.\n this._timeout = setTimeout(this._onTimeout, 40, e);\n\n } else if (!this._type) {\n // This is a repeating event, but we don't know the type of event just yet.\n // If the delta per time is small, we assume it's a fast trackpad; otherwise we switch into wheel mode.\n this._type = (Math.abs(timeDelta * value) < 200) ? 'trackpad' : 'wheel';\n\n // Make sure our delayed event isn't fired again, because we accumulate\n // the previous event (which was less than 40ms ago) into this event.\n if (this._timeout) {\n clearTimeout(this._timeout);\n this._timeout = null;\n value += this._lastValue;\n }\n }\n\n // Slow down zoom if shift key is held for more precise zooming\n if (e.shiftKey && value) value = value / 4;\n\n // Only fire the callback if we actually know what type of scrolling device the user uses.\n if (this._type) {\n this._lastWheelEvent = e;\n this._delta -= value;\n if (!this.isActive()) {\n this._start(e);\n }\n }\n\n e.preventDefault();\n }\n\n _onTimeout(initialEvent: any) {\n this._type = 'wheel';\n this._delta -= this._lastValue;\n if (!this.isActive()) {\n this._start(initialEvent);\n }\n }\n\n _start(e: any) {\n if (!this._delta) return;\n\n if (this._frameId) {\n this._map._cancelRenderFrame(this._frameId);\n this._frameId = null;\n }\n\n this._active = true;\n this._map.fire(new Event('movestart', {originalEvent: e}));\n this._map.fire(new Event('zoomstart', {originalEvent: e}));\n if (this._finishTimeout) {\n clearTimeout(this._finishTimeout);\n }\n\n const pos = DOM.mousePos(this._el, e);\n\n this._around = LngLat.convert(this._aroundCenter ? this._map.getCenter() : this._map.unproject(pos));\n this._aroundPoint = this._map.transform.locationPoint(this._around);\n if (!this._frameId) {\n this._frameId = this._map._requestRenderFrame(this._onScrollFrame);\n }\n }\n\n _onScrollFrame() {\n this._frameId = null;\n\n if (!this.isActive()) return;\n const tr = this._map.transform;\n\n // if we've had scroll events since the last render frame, consume the\n // accumulated delta, and update the target zoom level accordingly\n if (this._delta !== 0) {\n // For trackpad events and single mouse wheel ticks, use the default zoom rate\n const zoomRate = (this._type === 'wheel' && Math.abs(this._delta) > wheelZoomDelta) ? wheelZoomRate : defaultZoomRate;\n // Scale by sigmoid of scroll wheel delta.\n let scale = maxScalePerFrame / (1 + Math.exp(-Math.abs(this._delta * zoomRate)));\n\n if (this._delta < 0 && scale !== 0) {\n scale = 1 / scale;\n }\n\n const fromScale = typeof this._targetZoom === 'number' ? tr.zoomScale(this._targetZoom) : tr.scale;\n this._targetZoom = Math.min(tr.maxZoom, Math.max(tr.minZoom, tr.scaleZoom(fromScale * scale)));\n\n // if this is a mouse wheel, refresh the starting zoom and easing\n // function we're using to smooth out the zooming between wheel\n // events\n if (this._type === 'wheel') {\n this._startZoom = tr.zoom;\n this._easing = this._smoothOutEasing(200);\n }\n\n this._delta = 0;\n }\n\n let finished = false;\n if (this._type === 'wheel') {\n const t = Math.min((browser.now() - this._lastWheelEventTime) / 200, 1);\n const k = this._easing(t);\n tr.zoom = interpolate(this._startZoom, this._targetZoom, k);\n if (t < 1) {\n if (!this._frameId) {\n this._frameId = this._map._requestRenderFrame(this._onScrollFrame);\n }\n } else {\n finished = true;\n }\n } else {\n tr.zoom = this._targetZoom;\n finished = true;\n }\n\n tr.setLocationAtPoint(this._around, this._aroundPoint);\n\n this._map.fire(new Event('move', {originalEvent: this._lastWheelEvent}));\n this._map.fire(new Event('zoom', {originalEvent: this._lastWheelEvent}));\n\n if (finished) {\n this._active = false;\n this._finishTimeout = setTimeout(() => {\n this._map.fire(new Event('zoomend', {originalEvent: this._lastWheelEvent}));\n this._map.fire(new Event('moveend', {originalEvent: this._lastWheelEvent}));\n delete this._targetZoom;\n }, 200);\n }\n }\n\n _smoothOutEasing(duration: number) {\n let easing = _ease;\n\n if (this._prevEase) {\n const ease = this._prevEase,\n t = (browser.now() - ease.start) / ease.duration,\n speed = ease.easing(t + 0.01) - ease.easing(t),\n\n // Quick hack to make new bezier that is continuous with last\n x = 0.27 / Math.sqrt(speed * speed + 0.0001) * 0.01,\n y = Math.sqrt(0.27 * 0.27 - x * x);\n\n easing = bezier(x, y, 0.25, 1);\n }\n\n this._prevEase = {\n start: browser.now(),\n duration: duration,\n easing: easing\n };\n\n return easing;\n }\n}\n\nexport default ScrollZoomHandler;\n","// @flow\n\nimport DOM from '../../util/dom';\n\nimport LngLatBounds from '../../geo/lng_lat_bounds';\nimport { bindAll } from '../../util/util';\nimport window from '../../util/window';\nimport { Event } from '../../util/evented';\n\nimport type Map from '../map';\n\n/**\n * The `BoxZoomHandler` allows the user to zoom the map to fit within a bounding box.\n * The bounding box is defined by clicking and holding `shift` while dragging the cursor.\n */\nclass BoxZoomHandler {\n _map: Map;\n _el: HTMLElement;\n _container: HTMLElement;\n _enabled: boolean;\n _active: boolean;\n _startPos: any;\n _box: HTMLElement;\n\n /**\n * @private\n */\n constructor(map: Map) {\n this._map = map;\n this._el = map.getCanvasContainer();\n this._container = map.getContainer();\n\n bindAll([\n '_onMouseMove',\n '_onMouseUp',\n '_onKeyDown'\n ], this);\n }\n\n /**\n * Returns a Boolean indicating whether the \"box zoom\" interaction is enabled.\n *\n * @returns {boolean} `true` if the \"box zoom\" interaction is enabled.\n */\n isEnabled() {\n return !!this._enabled;\n }\n\n /**\n * Returns a Boolean indicating whether the \"box zoom\" interaction is active, i.e. currently being used.\n *\n * @returns {boolean} `true` if the \"box zoom\" interaction is active.\n */\n isActive() {\n return !!this._active;\n }\n\n /**\n * Enables the \"box zoom\" interaction.\n *\n * @example\n * map.boxZoom.enable();\n */\n enable() {\n if (this.isEnabled()) return;\n this._enabled = true;\n }\n\n /**\n * Disables the \"box zoom\" interaction.\n *\n * @example\n * map.boxZoom.disable();\n */\n disable() {\n if (!this.isEnabled()) return;\n this._enabled = false;\n }\n\n onMouseDown(e: MouseEvent) {\n if (!this.isEnabled()) return;\n if (!(e.shiftKey && e.button === 0)) return;\n\n window.document.addEventListener('mousemove', this._onMouseMove, false);\n window.document.addEventListener('keydown', this._onKeyDown, false);\n window.document.addEventListener('mouseup', this._onMouseUp, false);\n\n DOM.disableDrag();\n this._startPos = DOM.mousePos(this._el, e);\n this._active = true;\n }\n\n _onMouseMove(e: MouseEvent) {\n const p0 = this._startPos,\n p1 = DOM.mousePos(this._el, e);\n\n if (!this._box) {\n this._box = DOM.create('div', 'mapboxgl-boxzoom', this._container);\n this._container.classList.add('mapboxgl-crosshair');\n this._fireEvent('boxzoomstart', e);\n }\n\n const minX = Math.min(p0.x, p1.x),\n maxX = Math.max(p0.x, p1.x),\n minY = Math.min(p0.y, p1.y),\n maxY = Math.max(p0.y, p1.y);\n\n DOM.setTransform(this._box, `translate(${minX}px,${minY}px)`);\n\n this._box.style.width = `${maxX - minX}px`;\n this._box.style.height = `${maxY - minY}px`;\n }\n\n _onMouseUp(e: MouseEvent) {\n if (e.button !== 0) return;\n\n const p0 = this._startPos,\n p1 = DOM.mousePos(this._el, e),\n bounds = new LngLatBounds()\n .extend(this._map.unproject(p0))\n .extend(this._map.unproject(p1));\n\n this._finish();\n\n DOM.suppressClick();\n\n if (p0.x === p1.x && p0.y === p1.y) {\n this._fireEvent('boxzoomcancel', e);\n } else {\n this._map\n .fitBounds(bounds, {linear: true})\n .fire(new Event('boxzoomend', { originalEvent: e, boxZoomBounds: bounds }));\n }\n }\n\n _onKeyDown(e: KeyboardEvent) {\n if (e.keyCode === 27) {\n this._finish();\n this._fireEvent('boxzoomcancel', e);\n }\n }\n\n _finish() {\n this._active = false;\n\n window.document.removeEventListener('mousemove', this._onMouseMove, false);\n window.document.removeEventListener('keydown', this._onKeyDown, false);\n window.document.removeEventListener('mouseup', this._onMouseUp, false);\n\n this._container.classList.remove('mapboxgl-crosshair');\n\n if (this._box) {\n DOM.remove(this._box);\n this._box = (null: any);\n }\n\n DOM.enableDrag();\n }\n\n _fireEvent(type: string, e: *) {\n return this._map.fire(new Event(type, { originalEvent: e }));\n }\n}\n\nexport default BoxZoomHandler;\n","// @flow\n\nimport DOM from '../../util/dom';\n\nimport { bezier, bindAll } from '../../util/util';\nimport window from '../../util/window';\nimport browser from '../../util/browser';\nimport { Event } from '../../util/evented';\nimport assert from 'assert';\n\nimport type Map from '../map';\nimport type Point from '@mapbox/point-geometry';\nimport type {TaskID} from '../../util/task_queue';\n\nconst inertiaLinearity = 0.25,\n inertiaEasing = bezier(0, 0, inertiaLinearity, 1),\n inertiaMaxSpeed = 180, // deg/s\n inertiaDeceleration = 720; // deg/s^2\n\n/**\n * The `DragRotateHandler` allows the user to rotate the map by clicking and\n * dragging the cursor while holding the right mouse button or `ctrl` key.\n */\nclass DragRotateHandler {\n _map: Map;\n _el: HTMLElement;\n _state: 'disabled' | 'enabled' | 'pending' | 'active';\n _button: 'right' | 'left';\n _eventButton: number;\n _bearingSnap: number;\n _pitchWithRotate: boolean;\n\n _lastMoveEvent: MouseEvent;\n _pos: Point;\n _previousPos: Point;\n _inertia: Array<[number, number]>;\n _center: Point;\n _frameId: ?TaskID;\n\n /**\n * @param {Map} map The Mapbox GL JS map to add the handler to.\n * @param {Object} [options]\n * @param {number} [options.bearingSnap] The threshold, measured in degrees, that determines when the map's\n * bearing will snap to north.\n * @param {bool} [options.pitchWithRotate=true] Control the map pitch in addition to the bearing\n * @private\n */\n constructor(map: Map, options: {\n button?: 'right' | 'left',\n element?: HTMLElement,\n bearingSnap?: number,\n pitchWithRotate?: boolean\n }) {\n this._map = map;\n this._el = options.element || map.getCanvasContainer();\n this._state = 'disabled';\n this._button = options.button || 'right';\n this._bearingSnap = options.bearingSnap || 0;\n this._pitchWithRotate = options.pitchWithRotate !== false;\n\n bindAll([\n '_onMouseMove',\n '_onMouseUp',\n '_onBlur',\n '_onDragFrame'\n ], this);\n }\n\n /**\n * Returns a Boolean indicating whether the \"drag to rotate\" interaction is enabled.\n *\n * @returns {boolean} `true` if the \"drag to rotate\" interaction is enabled.\n */\n isEnabled() {\n return this._state !== 'disabled';\n }\n\n /**\n * Returns a Boolean indicating whether the \"drag to rotate\" interaction is active, i.e. currently being used.\n *\n * @returns {boolean} `true` if the \"drag to rotate\" interaction is active.\n */\n isActive() {\n return this._state === 'active';\n }\n\n /**\n * Enables the \"drag to rotate\" interaction.\n *\n * @example\n * map.dragRotate.enable();\n */\n enable() {\n if (this.isEnabled()) return;\n this._state = 'enabled';\n }\n\n /**\n * Disables the \"drag to rotate\" interaction.\n *\n * @example\n * map.dragRotate.disable();\n */\n disable() {\n if (!this.isEnabled()) return;\n switch (this._state) {\n case 'active':\n this._state = 'disabled';\n this._unbind();\n this._deactivate();\n this._fireEvent('rotateend');\n if (this._pitchWithRotate) {\n this._fireEvent('pitchend');\n }\n this._fireEvent('moveend');\n break;\n case 'pending':\n this._state = 'disabled';\n this._unbind();\n break;\n default:\n this._state = 'disabled';\n break;\n }\n }\n\n onMouseDown(e: MouseEvent) {\n if (this._state !== 'enabled') return;\n\n if (this._button === 'right') {\n this._eventButton = DOM.mouseButton(e);\n if (this._eventButton !== (e.ctrlKey ? 0 : 2)) return;\n } else {\n if (e.ctrlKey || DOM.mouseButton(e) !== 0) return;\n this._eventButton = 0;\n }\n\n DOM.disableDrag();\n\n // Bind window-level event listeners for move and up/end events. In the absence of\n // the pointer capture API, which is not supported by all necessary platforms,\n // window-level event listeners give us the best shot at capturing events that\n // fall outside the map canvas element. Use `{capture: true}` for the move event\n // to prevent map move events from being fired during a drag.\n window.document.addEventListener('mousemove', this._onMouseMove, {capture: true});\n window.document.addEventListener('mouseup', this._onMouseUp);\n\n // Deactivate when the window loses focus. Otherwise if a mouseup occurs when the window\n // isn't in focus, dragging will continue even though the mouse is no longer pressed.\n window.addEventListener('blur', this._onBlur);\n\n this._state = 'pending';\n this._inertia = [[browser.now(), this._map.getBearing()]];\n this._previousPos = DOM.mousePos(this._el, e);\n this._center = this._map.transform.centerPoint; // Center of rotation\n\n e.preventDefault();\n }\n\n _onMouseMove(e: MouseEvent) {\n this._lastMoveEvent = e;\n this._pos = DOM.mousePos(this._el, e);\n\n if (this._state === 'pending') {\n this._state = 'active';\n this._fireEvent('rotatestart', e);\n this._fireEvent('movestart', e);\n if (this._pitchWithRotate) {\n this._fireEvent('pitchstart', e);\n }\n }\n\n if (!this._frameId) {\n this._frameId = this._map._requestRenderFrame(this._onDragFrame);\n }\n }\n\n _onDragFrame() {\n this._frameId = null;\n\n const e = this._lastMoveEvent;\n if (!e) return;\n const tr = this._map.transform;\n\n const p1 = this._previousPos,\n p2 = this._pos,\n bearingDiff = (p1.x - p2.x) * 0.8,\n pitchDiff = (p1.y - p2.y) * -0.5,\n bearing = tr.bearing - bearingDiff,\n pitch = tr.pitch - pitchDiff,\n inertia = this._inertia,\n last = inertia[inertia.length - 1];\n\n this._drainInertiaBuffer();\n inertia.push([browser.now(), this._map._normalizeBearing(bearing, last[1])]);\n\n tr.bearing = bearing;\n if (this._pitchWithRotate) {\n this._fireEvent('pitch', e);\n tr.pitch = pitch;\n }\n\n this._fireEvent('rotate', e);\n this._fireEvent('move', e);\n\n delete this._lastMoveEvent;\n this._previousPos = this._pos;\n }\n\n _onMouseUp(e: MouseEvent) {\n if (DOM.mouseButton(e) !== this._eventButton) return;\n switch (this._state) {\n case 'active':\n this._state = 'enabled';\n DOM.suppressClick();\n this._unbind();\n this._deactivate();\n this._inertialRotate(e);\n break;\n case 'pending':\n this._state = 'enabled';\n this._unbind();\n break;\n default:\n assert(false);\n break;\n }\n }\n\n _onBlur(e: FocusEvent) {\n switch (this._state) {\n case 'active':\n this._state = 'enabled';\n this._unbind();\n this._deactivate();\n this._fireEvent('rotateend', e);\n if (this._pitchWithRotate) {\n this._fireEvent('pitchend', e);\n }\n this._fireEvent('moveend', e);\n break;\n case 'pending':\n this._state = 'enabled';\n this._unbind();\n break;\n default:\n assert(false);\n break;\n }\n }\n\n _unbind() {\n window.document.removeEventListener('mousemove', this._onMouseMove, {capture: true});\n window.document.removeEventListener('mouseup', this._onMouseUp);\n window.removeEventListener('blur', this._onBlur);\n DOM.enableDrag();\n }\n\n _deactivate() {\n if (this._frameId) {\n this._map._cancelRenderFrame(this._frameId);\n this._frameId = null;\n }\n delete this._lastMoveEvent;\n delete this._previousPos;\n }\n\n _inertialRotate(e: MouseEvent) {\n this._fireEvent('rotateend', e);\n this._drainInertiaBuffer();\n\n const map = this._map,\n mapBearing = map.getBearing(),\n inertia = this._inertia;\n\n const finish = () => {\n if (Math.abs(mapBearing) < this._bearingSnap) {\n map.resetNorth({noMoveStart: true}, { originalEvent: e });\n } else {\n this._fireEvent('moveend', e);\n }\n if (this._pitchWithRotate) this._fireEvent('pitchend', e);\n };\n\n if (inertia.length < 2) {\n finish();\n return;\n }\n\n const first = inertia[0],\n last = inertia[inertia.length - 1],\n previous = inertia[inertia.length - 2];\n let bearing = map._normalizeBearing(mapBearing, previous[1]);\n const flingDiff = last[1] - first[1],\n sign = flingDiff < 0 ? -1 : 1,\n flingDuration = (last[0] - first[0]) / 1000;\n\n if (flingDiff === 0 || flingDuration === 0) {\n finish();\n return;\n }\n\n let speed = Math.abs(flingDiff * (inertiaLinearity / flingDuration)); // deg/s\n if (speed > inertiaMaxSpeed) {\n speed = inertiaMaxSpeed;\n }\n\n const duration = speed / (inertiaDeceleration * inertiaLinearity),\n offset = sign * speed * (duration / 2);\n\n bearing += offset;\n\n if (Math.abs(map._normalizeBearing(bearing, 0)) < this._bearingSnap) {\n bearing = map._normalizeBearing(0, bearing);\n }\n\n map.rotateTo(bearing, {\n duration: duration * 1000,\n easing: inertiaEasing,\n noMoveStart: true\n }, { originalEvent: e });\n }\n\n _fireEvent(type: string, e: *) {\n return this._map.fire(new Event(type, e ? { originalEvent: e } : {}));\n }\n\n _drainInertiaBuffer() {\n const inertia = this._inertia,\n now = browser.now(),\n cutoff = 160; //msec\n\n while (inertia.length > 0 && now - inertia[0][0] > cutoff)\n inertia.shift();\n }\n}\n\nexport default DragRotateHandler;\n","// @flow\n\nimport DOM from '../../util/dom';\nimport { bezier, bindAll } from '../../util/util';\nimport window from '../../util/window';\nimport browser from '../../util/browser';\nimport { Event } from '../../util/evented';\nimport assert from 'assert';\n\nimport type Map from '../map';\nimport type Point from '@mapbox/point-geometry';\nimport type {TaskID} from '../../util/task_queue';\n\nconst inertiaLinearity = 0.3,\n inertiaEasing = bezier(0, 0, inertiaLinearity, 1),\n inertiaMaxSpeed = 1400, // px/s\n inertiaDeceleration = 2500; // px/s^2\n\n/**\n * The `DragPanHandler` allows the user to pan the map by clicking and dragging\n * the cursor.\n */\nclass DragPanHandler {\n _map: Map;\n _el: HTMLElement;\n _state: 'disabled' | 'enabled' | 'pending' | 'active';\n _pos: Point;\n _previousPos: Point;\n _inertia: Array<[number, Point]>;\n _lastMoveEvent: MouseEvent | TouchEvent | void;\n _frameId: ?TaskID;\n\n /**\n * @private\n */\n constructor(map: Map) {\n this._map = map;\n this._el = map.getCanvasContainer();\n this._state = 'disabled';\n\n bindAll([\n '_onMove',\n '_onMouseUp',\n '_onTouchEnd',\n '_onBlur',\n '_onDragFrame'\n ], this);\n }\n\n /**\n * Returns a Boolean indicating whether the \"drag to pan\" interaction is enabled.\n *\n * @returns {boolean} `true` if the \"drag to pan\" interaction is enabled.\n */\n isEnabled() {\n return this._state !== 'disabled';\n }\n\n /**\n * Returns a Boolean indicating whether the \"drag to pan\" interaction is active, i.e. currently being used.\n *\n * @returns {boolean} `true` if the \"drag to pan\" interaction is active.\n */\n isActive() {\n return this._state === 'active';\n }\n\n /**\n * Enables the \"drag to pan\" interaction.\n *\n * @example\n * map.dragPan.enable();\n */\n enable() {\n if (this.isEnabled()) return;\n this._el.classList.add('mapboxgl-touch-drag-pan');\n this._state = 'enabled';\n }\n\n /**\n * Disables the \"drag to pan\" interaction.\n *\n * @example\n * map.dragPan.disable();\n */\n disable() {\n if (!this.isEnabled()) return;\n this._el.classList.remove('mapboxgl-touch-drag-pan');\n switch (this._state) {\n case 'active':\n this._state = 'disabled';\n this._unbind();\n this._deactivate();\n this._fireEvent('dragend');\n this._fireEvent('moveend');\n break;\n case 'pending':\n this._state = 'disabled';\n this._unbind();\n break;\n default:\n this._state = 'disabled';\n break;\n }\n }\n\n onMouseDown(e: MouseEvent) {\n if (this._state !== 'enabled') return;\n if (e.ctrlKey || DOM.mouseButton(e) !== 0) return;\n\n // Bind window-level event listeners for mousemove/up events. In the absence of\n // the pointer capture API, which is not supported by all necessary platforms,\n // window-level event listeners give us the best shot at capturing events that\n // fall outside the map canvas element. Use `{capture: true}` for the move event\n // to prevent map move events from being fired during a drag.\n DOM.addEventListener(window.document, 'mousemove', this._onMove, {capture: true});\n DOM.addEventListener(window.document, 'mouseup', this._onMouseUp);\n\n this._start(e);\n }\n\n onTouchStart(e: TouchEvent) {\n if (this._state !== 'enabled') return;\n if (e.touches.length > 1) return;\n\n // Bind window-level event listeners for touchmove/end events. In the absence of\n // the pointer capture API, which is not supported by all necessary platforms,\n // window-level event listeners give us the best shot at capturing events that\n // fall outside the map canvas element. Use `{capture: true}` for the move event\n // to prevent map move events from being fired during a drag.\n DOM.addEventListener(window.document, 'touchmove', this._onMove, {capture: true, passive: false});\n DOM.addEventListener(window.document, 'touchend', this._onTouchEnd);\n\n this._start(e);\n }\n\n _start(e: MouseEvent | TouchEvent) {\n // Deactivate when the window loses focus. Otherwise if a mouseup occurs when the window\n // isn't in focus, dragging will continue even though the mouse is no longer pressed.\n window.addEventListener('blur', this._onBlur);\n\n this._state = 'pending';\n this._previousPos = DOM.mousePos(this._el, e);\n this._inertia = [[browser.now(), this._previousPos]];\n }\n\n _onMove(e: MouseEvent | TouchEvent) {\n this._lastMoveEvent = e;\n e.preventDefault();\n\n this._pos = DOM.mousePos(this._el, e);\n this._drainInertiaBuffer();\n this._inertia.push([browser.now(), this._pos]);\n\n if (this._state === 'pending') {\n // we treat the first move event (rather than the mousedown event)\n // as the start of the drag\n this._state = 'active';\n this._fireEvent('dragstart', e);\n this._fireEvent('movestart', e);\n }\n\n if (!this._frameId) {\n this._frameId = this._map._requestRenderFrame(this._onDragFrame);\n }\n }\n\n /**\n * Called in each render frame while dragging is happening.\n * @private\n */\n _onDragFrame() {\n this._frameId = null;\n\n const e = this._lastMoveEvent;\n if (!e) return;\n const tr = this._map.transform;\n tr.setLocationAtPoint(tr.pointLocation(this._previousPos), this._pos);\n this._fireEvent('drag', e);\n this._fireEvent('move', e);\n\n this._previousPos = this._pos;\n delete this._lastMoveEvent;\n }\n\n _onMouseUp(e: MouseEvent) {\n if (DOM.mouseButton(e) !== 0) return;\n switch (this._state) {\n case 'active':\n this._state = 'enabled';\n DOM.suppressClick();\n this._unbind();\n this._deactivate();\n this._inertialPan(e);\n break;\n case 'pending':\n this._state = 'enabled';\n this._unbind();\n break;\n default:\n assert(false);\n break;\n }\n }\n\n _onTouchEnd(e: TouchEvent) {\n switch (this._state) {\n case 'active':\n this._state = 'enabled';\n this._unbind();\n this._deactivate();\n this._inertialPan(e);\n break;\n case 'pending':\n this._state = 'enabled';\n this._unbind();\n break;\n default:\n assert(false);\n break;\n }\n }\n\n _onBlur(e: FocusEvent) {\n switch (this._state) {\n case 'active':\n this._state = 'enabled';\n this._unbind();\n this._deactivate();\n this._fireEvent('dragend', e);\n this._fireEvent('moveend', e);\n break;\n case 'pending':\n this._state = 'enabled';\n this._unbind();\n break;\n default:\n assert(false);\n break;\n }\n }\n\n _unbind() {\n DOM.removeEventListener(window.document, 'touchmove', this._onMove, {capture: true, passive: false});\n DOM.removeEventListener(window.document, 'touchend', this._onTouchEnd);\n DOM.removeEventListener(window.document, 'mousemove', this._onMove, {capture: true});\n DOM.removeEventListener(window.document, 'mouseup', this._onMouseUp);\n DOM.removeEventListener(window, 'blur', this._onBlur);\n }\n\n _deactivate() {\n if (this._frameId) {\n this._map._cancelRenderFrame(this._frameId);\n this._frameId = null;\n }\n delete this._lastMoveEvent;\n delete this._previousPos;\n delete this._pos;\n }\n\n _inertialPan(e: MouseEvent | TouchEvent) {\n this._fireEvent('dragend', e);\n\n this._drainInertiaBuffer();\n const inertia = this._inertia;\n if (inertia.length < 2) {\n this._fireEvent('moveend', e);\n return;\n }\n\n const last = inertia[inertia.length - 1],\n first = inertia[0],\n flingOffset = last[1].sub(first[1]),\n flingDuration = (last[0] - first[0]) / 1000;\n\n if (flingDuration === 0 || last[1].equals(first[1])) {\n this._fireEvent('moveend', e);\n return;\n }\n\n // calculate px/s velocity & adjust for increased initial animation speed when easing out\n const velocity = flingOffset.mult(inertiaLinearity / flingDuration);\n let speed = velocity.mag(); // px/s\n\n if (speed > inertiaMaxSpeed) {\n speed = inertiaMaxSpeed;\n velocity._unit()._mult(speed);\n }\n\n const duration = speed / (inertiaDeceleration * inertiaLinearity),\n offset = velocity.mult(-duration / 2);\n\n this._map.panBy(offset, {\n duration: duration * 1000,\n easing: inertiaEasing,\n noMoveStart: true\n }, { originalEvent: e });\n }\n\n _fireEvent(type: string, e: *) {\n return this._map.fire(new Event(type, e ? { originalEvent: e } : {}));\n }\n\n _drainInertiaBuffer() {\n const inertia = this._inertia,\n now = browser.now(),\n cutoff = 160; // msec\n\n while (inertia.length > 0 && now - inertia[0][0] > cutoff) inertia.shift();\n }\n}\n\nexport default DragPanHandler;\n","// @flow\n\nimport { bindAll } from '../../util/util';\n\nimport type Map from '../map';\n\nconst panStep = 100,\n bearingStep = 15,\n pitchStep = 10;\n\n/**\n * The `KeyboardHandler` allows the user to zoom, rotate, and pan the map using\n * the following keyboard shortcuts:\n *\n * - `=` / `+`: Increase the zoom level by 1.\n * - `Shift-=` / `Shift-+`: Increase the zoom level by 2.\n * - `-`: Decrease the zoom level by 1.\n * - `Shift--`: Decrease the zoom level by 2.\n * - Arrow keys: Pan by 100 pixels.\n * - `Shift+⇢`: Increase the rotation by 15 degrees.\n * - `Shift+⇠`: Decrease the rotation by 15 degrees.\n * - `Shift+⇡`: Increase the pitch by 10 degrees.\n * - `Shift+⇣`: Decrease the pitch by 10 degrees.\n */\nclass KeyboardHandler {\n _map: Map;\n _el: HTMLElement;\n _enabled: boolean;\n\n /**\n * @private\n */\n constructor(map: Map) {\n this._map = map;\n this._el = map.getCanvasContainer();\n\n bindAll([\n '_onKeyDown'\n ], this);\n }\n\n /**\n * Returns a Boolean indicating whether keyboard interaction is enabled.\n *\n * @returns {boolean} `true` if keyboard interaction is enabled.\n */\n isEnabled() {\n return !!this._enabled;\n }\n\n /**\n * Enables keyboard interaction.\n *\n * @example\n * map.keyboard.enable();\n */\n enable() {\n if (this.isEnabled()) return;\n this._el.addEventListener('keydown', this._onKeyDown, false);\n this._enabled = true;\n }\n\n /**\n * Disables keyboard interaction.\n *\n * @example\n * map.keyboard.disable();\n */\n disable() {\n if (!this.isEnabled()) return;\n this._el.removeEventListener('keydown', this._onKeyDown);\n this._enabled = false;\n }\n\n _onKeyDown(e: KeyboardEvent) {\n if (e.altKey || e.ctrlKey || e.metaKey) return;\n\n let zoomDir = 0;\n let bearingDir = 0;\n let pitchDir = 0;\n let xDir = 0;\n let yDir = 0;\n\n switch (e.keyCode) {\n case 61:\n case 107:\n case 171:\n case 187:\n zoomDir = 1;\n break;\n\n case 189:\n case 109:\n case 173:\n zoomDir = -1;\n break;\n\n case 37:\n if (e.shiftKey) {\n bearingDir = -1;\n } else {\n e.preventDefault();\n xDir = -1;\n }\n break;\n\n case 39:\n if (e.shiftKey) {\n bearingDir = 1;\n } else {\n e.preventDefault();\n xDir = 1;\n }\n break;\n\n case 38:\n if (e.shiftKey) {\n pitchDir = 1;\n } else {\n e.preventDefault();\n yDir = -1;\n }\n break;\n\n case 40:\n if (e.shiftKey) {\n pitchDir = -1;\n } else {\n yDir = 1;\n e.preventDefault();\n }\n break;\n\n default:\n return;\n }\n\n const map = this._map;\n const zoom = map.getZoom();\n\n const easeOptions = {\n duration: 300,\n delayEndEvents: 500,\n easing: easeOut,\n\n zoom: zoomDir ? Math.round(zoom) + zoomDir * (e.shiftKey ? 2 : 1) : zoom,\n bearing: map.getBearing() + bearingDir * bearingStep,\n pitch: map.getPitch() + pitchDir * pitchStep,\n offset: [-xDir * panStep, -yDir * panStep],\n center: map.getCenter()\n };\n\n map.easeTo(easeOptions, {originalEvent: e});\n }\n}\n\nfunction easeOut(t) {\n return t * (2 - t);\n}\n\nexport default KeyboardHandler;\n","// @flow\n\nimport { bindAll } from '../../util/util';\n\nimport type Map from '../map';\nimport type {MapMouseEvent, MapTouchEvent} from '../events';\n\n/**\n * The `DoubleClickZoomHandler` allows the user to zoom the map at a point by\n * double clicking or double tapping.\n */\nclass DoubleClickZoomHandler {\n _map: Map;\n _enabled: boolean;\n _active: boolean;\n _tapped: ?TimeoutID;\n\n /**\n * @private\n */\n constructor(map: Map) {\n this._map = map;\n\n bindAll([\n '_onDblClick',\n '_onZoomEnd'\n ], this);\n }\n\n /**\n * Returns a Boolean indicating whether the \"double click to zoom\" interaction is enabled.\n *\n * @returns {boolean} `true` if the \"double click to zoom\" interaction is enabled.\n */\n isEnabled() {\n return !!this._enabled;\n }\n\n /**\n * Returns a Boolean indicating whether the \"double click to zoom\" interaction is active, i.e. currently being used.\n *\n * @returns {boolean} `true` if the \"double click to zoom\" interaction is active.\n */\n isActive() {\n return !!this._active;\n }\n\n /**\n * Enables the \"double click to zoom\" interaction.\n *\n * @example\n * map.doubleClickZoom.enable();\n */\n enable() {\n if (this.isEnabled()) return;\n this._enabled = true;\n }\n\n /**\n * Disables the \"double click to zoom\" interaction.\n *\n * @example\n * map.doubleClickZoom.disable();\n */\n disable() {\n if (!this.isEnabled()) return;\n this._enabled = false;\n }\n\n onTouchStart(e: MapTouchEvent) {\n if (!this.isEnabled()) return;\n if (e.points.length > 1) return;\n\n if (!this._tapped) {\n this._tapped = setTimeout(() => { this._tapped = null; }, 300);\n } else {\n clearTimeout(this._tapped);\n this._tapped = null;\n this._zoom(e);\n }\n }\n\n onDblClick(e: MapMouseEvent) {\n if (!this.isEnabled()) return;\n e.originalEvent.preventDefault();\n this._zoom(e);\n }\n\n _zoom(e: MapMouseEvent | MapTouchEvent) {\n this._active = true;\n this._map.on('zoomend', this._onZoomEnd);\n this._map.zoomTo(\n this._map.getZoom() + (e.originalEvent.shiftKey ? -1 : 1),\n {around: e.lngLat},\n e\n );\n }\n\n _onZoomEnd() {\n this._active = false;\n this._map.off('zoomend', this._onZoomEnd);\n }\n}\n\nexport default DoubleClickZoomHandler;\n","// @flow\n\nimport DOM from '../../util/dom';\nimport { bezier, bindAll } from '../../util/util';\nimport window from '../../util/window';\nimport browser from '../../util/browser';\nimport { Event } from '../../util/evented';\n\nimport type Map from '../map';\nimport type Point from '@mapbox/point-geometry';\nimport type {TaskID} from '../../util/task_queue';\n\nconst inertiaLinearity = 0.15,\n inertiaEasing = bezier(0, 0, inertiaLinearity, 1),\n inertiaDeceleration = 12, // scale / s^2\n inertiaMaxSpeed = 2.5, // scale / s\n significantScaleThreshold = 0.15,\n significantRotateThreshold = 10;\n\n/**\n * The `TouchZoomRotateHandler` allows the user to zoom and rotate the map by\n * pinching on a touchscreen.\n */\nclass TouchZoomRotateHandler {\n _map: Map;\n _el: HTMLElement;\n _enabled: boolean;\n _aroundCenter: boolean;\n _rotationDisabled: boolean;\n _startVec: Point;\n _startScale: number;\n _startBearing: number;\n _gestureIntent: 'rotate' | 'zoom' | void;\n _inertia: Array<[number, number, Point]>;\n _lastTouchEvent: TouchEvent;\n _frameId: ?TaskID;\n\n /**\n * @private\n */\n constructor(map: Map) {\n this._map = map;\n this._el = map.getCanvasContainer();\n\n bindAll([\n '_onMove',\n '_onEnd',\n '_onTouchFrame'\n ], this);\n }\n\n /**\n * Returns a Boolean indicating whether the \"pinch to rotate and zoom\" interaction is enabled.\n *\n * @returns {boolean} `true` if the \"pinch to rotate and zoom\" interaction is enabled.\n */\n isEnabled() {\n return !!this._enabled;\n }\n\n /**\n * Enables the \"pinch to rotate and zoom\" interaction.\n *\n * @param {Object} [options]\n * @param {string} [options.around] If \"center\" is passed, map will zoom around the center\n *\n * @example\n * map.touchZoomRotate.enable();\n * @example\n * map.touchZoomRotate.enable({ around: 'center' });\n */\n enable(options: ?{around?: 'center'}) {\n if (this.isEnabled()) return;\n this._el.classList.add('mapboxgl-touch-zoom-rotate');\n this._enabled = true;\n this._aroundCenter = !!options && options.around === 'center';\n }\n\n /**\n * Disables the \"pinch to rotate and zoom\" interaction.\n *\n * @example\n * map.touchZoomRotate.disable();\n */\n disable() {\n if (!this.isEnabled()) return;\n this._el.classList.remove('mapboxgl-touch-zoom-rotate');\n this._enabled = false;\n }\n\n /**\n * Disables the \"pinch to rotate\" interaction, leaving the \"pinch to zoom\"\n * interaction enabled.\n *\n * @example\n * map.touchZoomRotate.disableRotation();\n */\n disableRotation() {\n this._rotationDisabled = true;\n }\n\n /**\n * Enables the \"pinch to rotate\" interaction.\n *\n * @example\n * map.touchZoomRotate.enable();\n * map.touchZoomRotate.enableRotation();\n */\n enableRotation() {\n this._rotationDisabled = false;\n }\n\n onStart(e: TouchEvent) {\n if (!this.isEnabled()) return;\n if (e.touches.length !== 2) return;\n\n const p0 = DOM.mousePos(this._el, e.touches[0]),\n p1 = DOM.mousePos(this._el, e.touches[1]);\n\n this._startVec = p0.sub(p1);\n this._gestureIntent = undefined;\n this._inertia = [];\n\n DOM.addEventListener(window.document, 'touchmove', this._onMove, {passive: false});\n DOM.addEventListener(window.document, 'touchend', this._onEnd);\n }\n\n _getTouchEventData(e: TouchEvent) {\n const p0 = DOM.mousePos(this._el, e.touches[0]),\n p1 = DOM.mousePos(this._el, e.touches[1]);\n\n const vec = p0.sub(p1);\n return {\n vec,\n center: p0.add(p1).div(2),\n scale: vec.mag() / this._startVec.mag(),\n bearing: this._rotationDisabled ? 0 : vec.angleWith(this._startVec) * 180 / Math.PI\n };\n }\n\n _onMove(e: TouchEvent) {\n if (e.touches.length !== 2) return;\n\n const {vec, scale, bearing} = this._getTouchEventData(e);\n\n // Determine 'intent' by whichever threshold is surpassed first,\n // then keep that state for the duration of this gesture.\n if (!this._gestureIntent) {\n const scalingSignificantly = (Math.abs(1 - scale) > significantScaleThreshold),\n rotatingSignificantly = (Math.abs(bearing) > significantRotateThreshold);\n\n if (rotatingSignificantly) {\n this._gestureIntent = 'rotate';\n } else if (scalingSignificantly) {\n this._gestureIntent = 'zoom';\n }\n\n if (this._gestureIntent) {\n this._map.fire(new Event(`${this._gestureIntent}start`, { originalEvent: e }));\n this._map.fire(new Event('movestart', { originalEvent: e }));\n this._startVec = vec;\n }\n }\n\n this._lastTouchEvent = e;\n if (!this._frameId) {\n this._frameId = this._map._requestRenderFrame(this._onTouchFrame);\n }\n\n e.preventDefault();\n }\n\n _onTouchFrame() {\n this._frameId = null;\n\n const gestureIntent = this._gestureIntent;\n if (!gestureIntent) return;\n\n const tr = this._map.transform;\n\n if (!this._startScale) {\n this._startScale = tr.scale;\n this._startBearing = tr.bearing;\n }\n\n const {center, bearing, scale} = this._getTouchEventData(this._lastTouchEvent);\n const around = tr.pointLocation(center);\n const aroundPoint = tr.locationPoint(around);\n\n if (gestureIntent === 'rotate') {\n tr.bearing = this._startBearing + bearing;\n }\n\n tr.zoom = tr.scaleZoom(this._startScale * scale);\n\n tr.setLocationAtPoint(around, aroundPoint);\n\n this._map.fire(new Event(gestureIntent, {originalEvent: this._lastTouchEvent}));\n this._map.fire(new Event('move', {originalEvent: this._lastTouchEvent}));\n\n this._drainInertiaBuffer();\n this._inertia.push([browser.now(), scale, center]);\n }\n\n _onEnd(e: TouchEvent) {\n DOM.removeEventListener(window.document, 'touchmove', this._onMove, {passive: false});\n DOM.removeEventListener(window.document, 'touchend', this._onEnd);\n\n const gestureIntent = this._gestureIntent;\n const startScale = this._startScale;\n\n if (this._frameId) {\n this._map._cancelRenderFrame(this._frameId);\n this._frameId = null;\n }\n delete this._gestureIntent;\n delete this._startScale;\n delete this._startBearing;\n delete this._lastTouchEvent;\n\n if (!gestureIntent) return;\n\n this._map.fire(new Event(`${gestureIntent}end`, { originalEvent: e }));\n\n this._drainInertiaBuffer();\n\n const inertia = this._inertia,\n map = this._map;\n\n if (inertia.length < 2) {\n map.snapToNorth({}, { originalEvent: e });\n return;\n }\n\n const last = inertia[inertia.length - 1],\n first = inertia[0],\n lastScale = map.transform.scaleZoom(startScale * last[1]),\n firstScale = map.transform.scaleZoom(startScale * first[1]),\n scaleOffset = lastScale - firstScale,\n scaleDuration = (last[0] - first[0]) / 1000,\n p = last[2];\n\n if (scaleDuration === 0 || lastScale === firstScale) {\n map.snapToNorth({}, { originalEvent: e });\n return;\n }\n\n // calculate scale/s speed and adjust for increased initial animation speed when easing\n let speed = scaleOffset * inertiaLinearity / scaleDuration; // scale/s\n\n if (Math.abs(speed) > inertiaMaxSpeed) {\n if (speed > 0) {\n speed = inertiaMaxSpeed;\n } else {\n speed = -inertiaMaxSpeed;\n }\n }\n\n const duration = Math.abs(speed / (inertiaDeceleration * inertiaLinearity)) * 1000;\n let targetScale = lastScale + speed * duration / 2000;\n\n if (targetScale < 0) {\n targetScale = 0;\n }\n\n map.easeTo({\n zoom: targetScale,\n duration: duration,\n easing: inertiaEasing,\n around: this._aroundCenter ? map.getCenter() : map.unproject(p),\n noMoveStart: true\n }, { originalEvent: e });\n }\n\n _drainInertiaBuffer() {\n const inertia = this._inertia,\n now = browser.now(),\n cutoff = 160; // msec\n\n while (inertia.length > 2 && now - inertia[0][0] > cutoff) inertia.shift();\n }\n}\n\nexport default TouchZoomRotateHandler;\n","// @flow\n\nimport { MapMouseEvent, MapTouchEvent, MapWheelEvent } from '../ui/events';\nimport DOM from '../util/dom';\nimport type Map from './map';\nimport scrollZoom from './handler/scroll_zoom';\nimport boxZoom from './handler/box_zoom';\nimport dragRotate from './handler/drag_rotate';\nimport dragPan from './handler/drag_pan';\nimport keyboard from './handler/keyboard';\nimport doubleClickZoom from './handler/dblclick_zoom';\nimport touchZoomRotate from './handler/touch_zoom_rotate';\n\nconst handlers = {\n scrollZoom,\n boxZoom,\n dragRotate,\n dragPan,\n keyboard,\n doubleClickZoom,\n touchZoomRotate\n};\n\nexport default function bindHandlers(map: Map, options: {}) {\n const el = map.getCanvasContainer();\n let contextMenuEvent = null;\n let mouseDown = false;\n\n for (const name in handlers) {\n (map: any)[name] = new handlers[name](map, options);\n if (options.interactive && options[name]) {\n (map: any)[name].enable(options[name]);\n }\n }\n\n DOM.addEventListener(el, 'mouseout', onMouseOut);\n DOM.addEventListener(el, 'mousedown', onMouseDown);\n DOM.addEventListener(el, 'mouseup', onMouseUp);\n DOM.addEventListener(el, 'mousemove', onMouseMove);\n DOM.addEventListener(el, 'mouseover', onMouseOver);\n\n // Bind touchstart and touchmove with passive: false because, even though\n // they only fire a map events and therefore could theoretically be\n // passive, binding with passive: true causes iOS not to respect\n // e.preventDefault() in _other_ handlers, even if they are non-passive\n // (see https://bugs.webkit.org/show_bug.cgi?id=184251)\n DOM.addEventListener(el, 'touchstart', onTouchStart, {passive: false});\n DOM.addEventListener(el, 'touchmove', onTouchMove, {passive: false});\n\n DOM.addEventListener(el, 'touchend', onTouchEnd);\n DOM.addEventListener(el, 'touchcancel', onTouchCancel);\n DOM.addEventListener(el, 'click', onClick);\n DOM.addEventListener(el, 'dblclick', onDblClick);\n DOM.addEventListener(el, 'contextmenu', onContextMenu);\n DOM.addEventListener(el, 'wheel', onWheel, {passive: false});\n\n function onMouseDown(e: MouseEvent) {\n mouseDown = true;\n\n const mapEvent = new MapMouseEvent('mousedown', map, e);\n map.fire(mapEvent);\n\n if (mapEvent.defaultPrevented) {\n return;\n }\n\n if (options.interactive && !map.doubleClickZoom.isActive()) {\n map.stop();\n }\n\n map.boxZoom.onMouseDown(e);\n\n if (!map.boxZoom.isActive() && !map.dragPan.isActive()) {\n map.dragRotate.onMouseDown(e);\n }\n\n if (!map.boxZoom.isActive() && !map.dragRotate.isActive()) {\n map.dragPan.onMouseDown(e);\n }\n }\n\n function onMouseUp(e: MouseEvent) {\n const rotating = map.dragRotate.isActive();\n\n if (contextMenuEvent && !rotating) {\n // This will be the case for Mac\n map.fire(new MapMouseEvent('contextmenu', map, contextMenuEvent));\n }\n\n contextMenuEvent = null;\n mouseDown = false;\n\n map.fire(new MapMouseEvent('mouseup', map, e));\n }\n\n function onMouseMove(e: MouseEvent) {\n if (map.dragPan.isActive()) return;\n if (map.dragRotate.isActive()) return;\n\n let target: any = e.toElement || e.target;\n while (target && target !== el) target = target.parentNode;\n if (target !== el) return;\n\n map.fire(new MapMouseEvent('mousemove', map, e));\n }\n\n function onMouseOver(e: MouseEvent) {\n let target: any = e.toElement || e.target;\n while (target && target !== el) target = target.parentNode;\n if (target !== el) return;\n\n map.fire(new MapMouseEvent('mouseover', map, e));\n }\n\n function onMouseOut(e: MouseEvent) {\n map.fire(new MapMouseEvent('mouseout', map, e));\n }\n\n function onTouchStart(e: TouchEvent) {\n const mapEvent = new MapTouchEvent('touchstart', map, e);\n map.fire(mapEvent);\n\n if (mapEvent.defaultPrevented) {\n return;\n }\n\n if (options.interactive) {\n map.stop();\n }\n\n if (!map.boxZoom.isActive() && !map.dragRotate.isActive()) {\n map.dragPan.onTouchStart(e);\n }\n\n map.touchZoomRotate.onStart(e);\n map.doubleClickZoom.onTouchStart(mapEvent);\n }\n\n function onTouchMove(e: TouchEvent) {\n map.fire(new MapTouchEvent('touchmove', map, e));\n }\n\n function onTouchEnd(e: TouchEvent) {\n map.fire(new MapTouchEvent('touchend', map, e));\n }\n\n function onTouchCancel(e: TouchEvent) {\n map.fire(new MapTouchEvent('touchcancel', map, e));\n }\n\n function onClick(e: MouseEvent) {\n map.fire(new MapMouseEvent('click', map, e));\n }\n\n function onDblClick(e: MouseEvent) {\n const mapEvent = new MapMouseEvent('dblclick', map, e);\n map.fire(mapEvent);\n\n if (mapEvent.defaultPrevented) {\n return;\n }\n\n map.doubleClickZoom.onDblClick(mapEvent);\n }\n\n function onContextMenu(e: MouseEvent) {\n const rotating = map.dragRotate.isActive();\n if (!mouseDown && !rotating) {\n // Windows: contextmenu fired on mouseup, so fire event now\n map.fire(new MapMouseEvent('contextmenu', map, e));\n } else if (mouseDown) {\n // Mac: contextmenu fired on mousedown; we save it until mouseup for consistency's sake\n contextMenuEvent = e;\n }\n\n e.preventDefault();\n }\n\n function onWheel(e: WheelEvent) {\n const mapEvent = new MapWheelEvent('wheel', map, e);\n map.fire(mapEvent);\n\n if (mapEvent.defaultPrevented) {\n return;\n }\n\n map.scrollZoom.onWheel(e);\n }\n}\n","// @flow\n\nimport {\n bindAll,\n extend,\n deepEqual,\n warnOnce,\n clamp,\n wrap,\n ease as defaultEasing\n} from '../util/util';\nimport { number as interpolate } from '../style-spec/util/interpolate';\nimport browser from '../util/browser';\nimport LngLat from '../geo/lng_lat';\nimport LngLatBounds from '../geo/lng_lat_bounds';\nimport Point from '@mapbox/point-geometry';\nimport { Event, Evented } from '../util/evented';\n\nimport type Transform from '../geo/transform';\nimport type {LngLatLike} from '../geo/lng_lat';\nimport type {LngLatBoundsLike} from '../geo/lng_lat_bounds';\nimport type {TaskID} from '../util/task_queue';\n\n/**\n * Options common to {@link Map#jumpTo}, {@link Map#easeTo}, and {@link Map#flyTo}, controlling the desired location,\n * zoom, bearing, and pitch of the camera. All properties are optional, and when a property is omitted, the current\n * camera value for that property will remain unchanged.\n *\n * @typedef {Object} CameraOptions\n * @property {LngLatLike} center The desired center.\n * @property {number} zoom The desired zoom level.\n * @property {number} bearing The desired bearing, in degrees. The bearing is the compass direction that\n * is \"up\"; for example, a bearing of 90° orients the map so that east is up.\n * @property {number} pitch The desired pitch, in degrees.\n * @property {LngLatLike} around If `zoom` is specified, `around` determines the point around which the zoom is centered.\n */\nexport type CameraOptions = {\n center?: LngLatLike,\n zoom?: number,\n bearing?: number,\n pitch?: number,\n around?: LngLatLike\n};\n\n/**\n * Options common to map movement methods that involve animation, such as {@link Map#panBy} and\n * {@link Map#easeTo}, controlling the duration and easing function of the animation. All properties\n * are optional.\n *\n * @typedef {Object} AnimationOptions\n * @property {number} duration The animation's duration, measured in milliseconds.\n * @property {Function} easing A function taking a time in the range 0..1 and returning a number where 0 is\n * the initial state and 1 is the final state.\n * @property {PointLike} offset of the target center relative to real map container center at the end of animation.\n * @property {boolean} animate If `false`, no animation will occur.\n */\nexport type AnimationOptions = {\n duration?: number,\n easing?: (number) => number,\n offset?: PointLike,\n animate?: boolean\n};\n\n/**\n * Options for setting padding on a call to {@link Map#fitBounds}. All properties of this object must be\n * non-negative integers.\n *\n * @typedef {Object} PaddingOptions\n * @property {number} top Padding in pixels from the top of the map canvas.\n * @property {number} bottom Padding in pixels from the bottom of the map canvas.\n * @property {number} left Padding in pixels from the left of the map canvas.\n * @property {number} right Padding in pixels from the right of the map canvas.\n */\n\nclass Camera extends Evented {\n transform: Transform;\n _moving: boolean;\n _zooming: boolean;\n _rotating: boolean;\n _pitching: boolean;\n\n _bearingSnap: number;\n _easeEndTimeoutID: TimeoutID;\n _easeStart: number;\n _easeOptions: {duration: number, easing: (number) => number};\n\n _onEaseFrame: (number) => void;\n _onEaseEnd: () => void;\n _easeFrameId: ?TaskID;\n\n +_requestRenderFrame: (() => void) => TaskID;\n +_cancelRenderFrame: (TaskID) => void;\n\n constructor(transform: Transform, options: {bearingSnap: number}) {\n super();\n this._moving = false;\n this._zooming = false;\n this.transform = transform;\n this._bearingSnap = options.bearingSnap;\n\n bindAll(['_renderFrameCallback'], this);\n }\n\n /**\n * Returns the map's geographical centerpoint.\n *\n * @memberof Map#\n * @returns The map's geographical centerpoint.\n */\n getCenter(): LngLat { return this.transform.center; }\n\n /**\n * Sets the map's geographical centerpoint. Equivalent to `jumpTo({center: center})`.\n *\n * @memberof Map#\n * @param center The centerpoint to set.\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @fires movestart\n * @fires moveend\n * @returns {Map} `this`\n * @example\n * map.setCenter([-74, 38]);\n * @see [Move symbol with the keyboard](https://www.mapbox.com/mapbox-gl-js/example/rotating-controllable-marker/)\n */\n setCenter(center: LngLatLike, eventData?: Object) {\n return this.jumpTo({center: center}, eventData);\n }\n\n /**\n * Pans the map by the specified offest.\n *\n * @memberof Map#\n * @param offset `x` and `y` coordinates by which to pan the map.\n * @param options\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @fires movestart\n * @fires moveend\n * @returns {Map} `this`\n * @see [Navigate the map with game-like controls](https://www.mapbox.com/mapbox-gl-js/example/game-controls/)\n */\n panBy(offset: PointLike, options?: AnimationOptions, eventData?: Object) {\n offset = Point.convert(offset).mult(-1);\n return this.panTo(this.transform.center, extend({offset}, options), eventData);\n }\n\n /**\n * Pans the map to the specified location, with an animated transition.\n *\n * @memberof Map#\n * @param lnglat The location to pan the map to.\n * @param options\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @fires movestart\n * @fires moveend\n * @returns {Map} `this`\n */\n panTo(lnglat: LngLatLike, options?: AnimationOptions, eventData?: Object) {\n return this.easeTo(extend({\n center: lnglat\n }, options), eventData);\n }\n\n /**\n * Returns the map's current zoom level.\n *\n * @memberof Map#\n * @returns The map's current zoom level.\n */\n getZoom(): number { return this.transform.zoom; }\n\n /**\n * Sets the map's zoom level. Equivalent to `jumpTo({zoom: zoom})`.\n *\n * @memberof Map#\n * @param zoom The zoom level to set (0-20).\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @fires movestart\n * @fires zoomstart\n * @fires move\n * @fires zoom\n * @fires moveend\n * @fires zoomend\n * @returns {Map} `this`\n * @example\n * // zoom the map to 5\n * map.setZoom(5);\n */\n setZoom(zoom: number, eventData?: Object) {\n this.jumpTo({zoom: zoom}, eventData);\n return this;\n }\n\n /**\n * Zooms the map to the specified zoom level, with an animated transition.\n *\n * @memberof Map#\n * @param zoom The zoom level to transition to.\n * @param options\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @fires movestart\n * @fires zoomstart\n * @fires move\n * @fires zoom\n * @fires moveend\n * @fires zoomend\n * @returns {Map} `this`\n */\n zoomTo(zoom: number, options: ? AnimationOptions, eventData?: Object) {\n return this.easeTo(extend({\n zoom: zoom\n }, options), eventData);\n }\n\n /**\n * Increases the map's zoom level by 1.\n *\n * @memberof Map#\n * @param options\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @fires movestart\n * @fires zoomstart\n * @fires move\n * @fires zoom\n * @fires moveend\n * @fires zoomend\n * @returns {Map} `this`\n */\n zoomIn(options?: AnimationOptions, eventData?: Object) {\n this.zoomTo(this.getZoom() + 1, options, eventData);\n return this;\n }\n\n /**\n * Decreases the map's zoom level by 1.\n *\n * @memberof Map#\n * @param options\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @fires movestart\n * @fires zoomstart\n * @fires move\n * @fires zoom\n * @fires moveend\n * @fires zoomend\n * @returns {Map} `this`\n */\n zoomOut(options?: AnimationOptions, eventData?: Object) {\n this.zoomTo(this.getZoom() - 1, options, eventData);\n return this;\n }\n\n /**\n * Returns the map's current bearing. The bearing is the compass direction that is \\\"up\\\"; for example, a bearing\n * of 90° orients the map so that east is up.\n *\n * @memberof Map#\n * @returns The map's current bearing.\n * @see [Navigate the map with game-like controls](https://www.mapbox.com/mapbox-gl-js/example/game-controls/)\n */\n getBearing(): number { return this.transform.bearing; }\n\n /**\n * Sets the map's bearing (rotation). The bearing is the compass direction that is \\\"up\\\"; for example, a bearing\n * of 90° orients the map so that east is up.\n *\n * Equivalent to `jumpTo({bearing: bearing})`.\n *\n * @memberof Map#\n * @param bearing The desired bearing.\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @fires movestart\n * @fires moveend\n * @returns {Map} `this`\n * @example\n * // rotate the map to 90 degrees\n * map.setBearing(90);\n */\n setBearing(bearing: number, eventData?: Object) {\n this.jumpTo({bearing: bearing}, eventData);\n return this;\n }\n\n /**\n * Rotates the map to the specified bearing, with an animated transition. The bearing is the compass direction\n * that is \\\"up\\\"; for example, a bearing of 90° orients the map so that east is up.\n *\n * @memberof Map#\n * @param bearing The desired bearing.\n * @param options\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @fires movestart\n * @fires moveend\n * @returns {Map} `this`\n */\n rotateTo(bearing: number, options?: AnimationOptions, eventData?: Object) {\n return this.easeTo(extend({\n bearing: bearing\n }, options), eventData);\n }\n\n /**\n * Rotates the map so that north is up (0° bearing), with an animated transition.\n *\n * @memberof Map#\n * @param options\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @fires movestart\n * @fires moveend\n * @returns {Map} `this`\n */\n resetNorth(options?: AnimationOptions, eventData?: Object) {\n this.rotateTo(0, extend({duration: 1000}, options), eventData);\n return this;\n }\n\n /**\n * Snaps the map so that north is up (0° bearing), if the current bearing is close enough to it (i.e. within the\n * `bearingSnap` threshold).\n *\n * @memberof Map#\n * @param options\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @fires movestart\n * @fires moveend\n * @returns {Map} `this`\n */\n snapToNorth(options?: AnimationOptions, eventData?: Object) {\n if (Math.abs(this.getBearing()) < this._bearingSnap) {\n return this.resetNorth(options, eventData);\n }\n return this;\n }\n\n /**\n * Returns the map's current pitch (tilt).\n *\n * @memberof Map#\n * @returns The map's current pitch, measured in degrees away from the plane of the screen.\n */\n getPitch(): number { return this.transform.pitch; }\n\n /**\n * Sets the map's pitch (tilt). Equivalent to `jumpTo({pitch: pitch})`.\n *\n * @memberof Map#\n * @param pitch The pitch to set, measured in degrees away from the plane of the screen (0-60).\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @fires pitchstart\n * @fires movestart\n * @fires moveend\n * @returns {Map} `this`\n */\n setPitch(pitch: number, eventData?: Object) {\n this.jumpTo({pitch: pitch}, eventData);\n return this;\n }\n\n\n /**\n * Pans and zooms the map to contain its visible area within the specified geographical bounds.\n * This function will also reset the map's bearing to 0 if bearing is nonzero.\n *\n * @memberof Map#\n * @param bounds Center these bounds in the viewport and use the highest\n * zoom level up to and including `Map#getMaxZoom()` that fits them in the viewport.\n * @param options\n * @param {number | PaddingOptions} [options.padding] The amount of padding in pixels to add to the given bounds.\n * @param {boolean} [options.linear=false] If `true`, the map transitions using\n * {@link Map#easeTo}. If `false`, the map transitions using {@link Map#flyTo}. See\n * those functions and {@link AnimationOptions} for information about options available.\n * @param {Function} [options.easing] An easing function for the animated transition. See {@link AnimationOptions}.\n * @param {PointLike} [options.offset=[0, 0]] The center of the given bounds relative to the map's center, measured in pixels.\n * @param {number} [options.maxZoom] The maximum zoom level to allow when the map view transitions to the specified bounds.\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @fires movestart\n * @fires moveend\n * @returns {Map} `this`\n\t * @example\n * var bbox = [[-79, 43], [-73, 45]];\n * map.fitBounds(bbox, {\n * padding: {top: 10, bottom:25, left: 15, right: 5}\n * });\n * @see [Fit a map to a bounding box](https://www.mapbox.com/mapbox-gl-js/example/fitbounds/)\n */\n fitBounds(bounds: LngLatBoundsLike, options?: AnimationOptions & CameraOptions, eventData?: Object) {\n\n options = extend({\n padding: {\n top: 0,\n bottom: 0,\n right: 0,\n left: 0\n },\n offset: [0, 0],\n maxZoom: this.transform.maxZoom\n }, options);\n\n if (typeof options.padding === 'number') {\n const p = options.padding;\n options.padding = {\n top: p,\n bottom: p,\n right: p,\n left: p\n };\n }\n if (!deepEqual(Object.keys(options.padding).sort((a, b) => {\n if (a < b) return -1;\n if (a > b) return 1;\n return 0;\n }), [\"bottom\", \"left\", \"right\", \"top\"])) {\n warnOnce(\n \"options.padding must be a positive number, or an Object with keys 'bottom', 'left', 'right', 'top'\"\n );\n return this;\n }\n\n bounds = LngLatBounds.convert(bounds);\n\n // we separate the passed padding option into two parts, the part that does not affect the map's center\n // (lateral and vertical padding), and the part that does (paddingOffset). We add the padding offset\n // to the options `offset` object where it can alter the map's center in the subsequent calls to\n // `easeTo` and `flyTo`.\n const paddingOffset = [(options.padding.left - options.padding.right) / 2, (options.padding.top - options.padding.bottom) / 2],\n lateralPadding = Math.min(options.padding.right, options.padding.left),\n verticalPadding = Math.min(options.padding.top, options.padding.bottom);\n options.offset = [options.offset[0] + paddingOffset[0], options.offset[1] + paddingOffset[1]];\n\n const offset = Point.convert(options.offset),\n tr = this.transform,\n nw = tr.project(bounds.getNorthWest()),\n se = tr.project(bounds.getSouthEast()),\n size = se.sub(nw),\n scaleX = (tr.width - lateralPadding * 2 - Math.abs(offset.x) * 2) / size.x,\n scaleY = (tr.height - verticalPadding * 2 - Math.abs(offset.y) * 2) / size.y;\n\n if (scaleY < 0 || scaleX < 0) {\n warnOnce(\n 'Map cannot fit within canvas with the given bounds, padding, and/or offset.'\n );\n return this;\n }\n\n options.center = tr.unproject(nw.add(se).div(2));\n options.zoom = Math.min(tr.scaleZoom(tr.scale * Math.min(scaleX, scaleY)), options.maxZoom);\n options.bearing = 0;\n\n return options.linear ?\n this.easeTo(options, eventData) :\n this.flyTo(options, eventData);\n }\n\n /**\n * Changes any combination of center, zoom, bearing, and pitch, without\n * an animated transition. The map will retain its current values for any\n * details not specified in `options`.\n *\n * @memberof Map#\n * @param options\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @fires movestart\n * @fires zoomstart\n * @fires pitchstart\n * @fires rotate\n * @fires move\n * @fires zoom\n * @fires pitch\n * @fires moveend\n * @fires zoomend\n * @fires pitchend\n * @returns {Map} `this`\n */\n jumpTo(options: CameraOptions, eventData?: Object) {\n this.stop();\n\n const tr = this.transform;\n let zoomChanged = false,\n bearingChanged = false,\n pitchChanged = false;\n\n if ('zoom' in options && tr.zoom !== +options.zoom) {\n zoomChanged = true;\n tr.zoom = +options.zoom;\n }\n\n if (options.center !== undefined) {\n tr.center = LngLat.convert(options.center);\n }\n\n if ('bearing' in options && tr.bearing !== +options.bearing) {\n bearingChanged = true;\n tr.bearing = +options.bearing;\n }\n\n if ('pitch' in options && tr.pitch !== +options.pitch) {\n pitchChanged = true;\n tr.pitch = +options.pitch;\n }\n\n this.fire(new Event('movestart', eventData))\n .fire(new Event('move', eventData));\n\n if (zoomChanged) {\n this.fire(new Event('zoomstart', eventData))\n .fire(new Event('zoom', eventData))\n .fire(new Event('zoomend', eventData));\n }\n\n if (bearingChanged) {\n this.fire(new Event('rotatestart', eventData))\n .fire(new Event('rotate', eventData))\n .fire(new Event('rotateend', eventData));\n }\n\n if (pitchChanged) {\n this.fire(new Event('pitchstart', eventData))\n .fire(new Event('pitch', eventData))\n .fire(new Event('pitchend', eventData));\n }\n\n return this.fire(new Event('moveend', eventData));\n }\n\n /**\n * Changes any combination of center, zoom, bearing, and pitch, with an animated transition\n * between old and new values. The map will retain its current values for any\n * details not specified in `options`.\n *\n * @memberof Map#\n * @param options Options describing the destination and animation of the transition.\n * Accepts {@link CameraOptions} and {@link AnimationOptions}.\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @fires movestart\n * @fires zoomstart\n * @fires pitchstart\n * @fires rotate\n * @fires move\n * @fires zoom\n * @fires pitch\n * @fires moveend\n * @fires zoomend\n * @fires pitchend\n * @returns {Map} `this`\n * @see [Navigate the map with game-like controls](https://www.mapbox.com/mapbox-gl-js/example/game-controls/)\n */\n easeTo(options: CameraOptions & AnimationOptions & {delayEndEvents?: number}, eventData?: Object) {\n this.stop();\n\n options = extend({\n offset: [0, 0],\n duration: 500,\n easing: defaultEasing\n }, options);\n\n if (options.animate === false) options.duration = 0;\n\n const tr = this.transform,\n startZoom = this.getZoom(),\n startBearing = this.getBearing(),\n startPitch = this.getPitch(),\n\n zoom = 'zoom' in options ? +options.zoom : startZoom,\n bearing = 'bearing' in options ? this._normalizeBearing(options.bearing, startBearing) : startBearing,\n pitch = 'pitch' in options ? +options.pitch : startPitch;\n\n const pointAtOffset = tr.centerPoint.add(Point.convert(options.offset));\n const locationAtOffset = tr.pointLocation(pointAtOffset);\n const center = LngLat.convert(options.center || locationAtOffset);\n this._normalizeCenter(center);\n\n const from = tr.project(locationAtOffset);\n const delta = tr.project(center).sub(from);\n const finalScale = tr.zoomScale(zoom - startZoom);\n\n let around, aroundPoint;\n\n if (options.around) {\n around = LngLat.convert(options.around);\n aroundPoint = tr.locationPoint(around);\n }\n\n this._zooming = (zoom !== startZoom);\n this._rotating = (startBearing !== bearing);\n this._pitching = (pitch !== startPitch);\n\n this._prepareEase(eventData, options.noMoveStart);\n\n clearTimeout(this._easeEndTimeoutID);\n\n this._ease((k) => {\n if (this._zooming) {\n tr.zoom = interpolate(startZoom, zoom, k);\n }\n if (this._rotating) {\n tr.bearing = interpolate(startBearing, bearing, k);\n }\n if (this._pitching) {\n tr.pitch = interpolate(startPitch, pitch, k);\n }\n\n if (around) {\n tr.setLocationAtPoint(around, aroundPoint);\n } else {\n const scale = tr.zoomScale(tr.zoom - startZoom);\n const base = zoom > startZoom ?\n Math.min(2, finalScale) :\n Math.max(0.5, finalScale);\n const speedup = Math.pow(base, 1 - k);\n const newCenter = tr.unproject(from.add(delta.mult(k * speedup)).mult(scale));\n tr.setLocationAtPoint(tr.renderWorldCopies ? newCenter.wrap() : newCenter, pointAtOffset);\n }\n\n this._fireMoveEvents(eventData);\n\n }, () => {\n if (options.delayEndEvents) {\n this._easeEndTimeoutID = setTimeout(() => this._afterEase(eventData), options.delayEndEvents);\n } else {\n this._afterEase(eventData);\n }\n }, options);\n\n return this;\n }\n\n _prepareEase(eventData?: Object, noMoveStart: boolean) {\n this._moving = true;\n\n if (!noMoveStart) {\n this.fire(new Event('movestart', eventData));\n }\n if (this._zooming) {\n this.fire(new Event('zoomstart', eventData));\n }\n if (this._rotating) {\n this.fire(new Event('rotatestart', eventData));\n }\n if (this._pitching) {\n this.fire(new Event('pitchstart', eventData));\n }\n }\n\n _fireMoveEvents(eventData?: Object) {\n this.fire(new Event('move', eventData));\n if (this._zooming) {\n this.fire(new Event('zoom', eventData));\n }\n if (this._rotating) {\n this.fire(new Event('rotate', eventData));\n }\n if (this._pitching) {\n this.fire(new Event('pitch', eventData));\n }\n }\n\n _afterEase(eventData?: Object) {\n const wasZooming = this._zooming;\n const wasRotating = this._rotating;\n const wasPitching = this._pitching;\n this._moving = false;\n this._zooming = false;\n this._rotating = false;\n this._pitching = false;\n\n if (wasZooming) {\n this.fire(new Event('zoomend', eventData));\n }\n if (wasRotating) {\n this.fire(new Event('rotateend', eventData));\n }\n if (wasPitching) {\n this.fire(new Event('pitchend', eventData));\n }\n this.fire(new Event('moveend', eventData));\n }\n\n /**\n * Changes any combination of center, zoom, bearing, and pitch, animating the transition along a curve that\n * evokes flight. The animation seamlessly incorporates zooming and panning to help\n * the user maintain her bearings even after traversing a great distance.\n *\n * @memberof Map#\n * @param {Object} options Options describing the destination and animation of the transition.\n * Accepts {@link CameraOptions}, {@link AnimationOptions},\n * and the following additional options.\n * @param {number} [options.curve=1.42] The zooming \"curve\" that will occur along the\n * flight path. A high value maximizes zooming for an exaggerated animation, while a low\n * value minimizes zooming for an effect closer to {@link Map#easeTo}. 1.42 is the average\n * value selected by participants in the user study discussed in\n * [van Wijk (2003)](https://www.win.tue.nl/~vanwijk/zoompan.pdf). A value of\n * `Math.pow(6, 0.25)` would be equivalent to the root mean squared average velocity. A\n * value of 1 would produce a circular motion.\n * @param {number} [options.minZoom] The zero-based zoom level at the peak of the flight path. If\n * `options.curve` is specified, this option is ignored.\n * @param {number} [options.speed=1.2] The average speed of the animation defined in relation to\n * `options.curve`. A speed of 1.2 means that the map appears to move along the flight path\n * by 1.2 times `options.curve` screenfuls every second. A _screenful_ is the map's visible span.\n * It does not correspond to a fixed physical distance, but varies by zoom level.\n * @param {number} [options.screenSpeed] The average speed of the animation measured in screenfuls\n * per second, assuming a linear timing curve. If `options.speed` is specified, this option is ignored.\n * @param {number} [options.maxDuration] The animation's maximum duration, measured in milliseconds.\n * If duration exceeds maximum duration, it resets to 0.\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @fires movestart\n * @fires zoomstart\n * @fires pitchstart\n * @fires move\n * @fires zoom\n * @fires rotate\n * @fires pitch\n * @fires moveend\n * @fires zoomend\n * @fires pitchend\n * @returns {Map} `this`\n * @example\n * // fly with default options to null island\n * map.flyTo({center: [0, 0], zoom: 9});\n * // using flyTo options\n * map.flyTo({\n * center: [0, 0],\n * zoom: 9,\n * speed: 0.2,\n * curve: 1,\n * easing(t) {\n * return t;\n * }\n * });\n * @see [Fly to a location](https://www.mapbox.com/mapbox-gl-js/example/flyto/)\n * @see [Slowly fly to a location](https://www.mapbox.com/mapbox-gl-js/example/flyto-options/)\n * @see [Fly to a location based on scroll position](https://www.mapbox.com/mapbox-gl-js/example/scroll-fly-to/)\n */\n flyTo(options: Object, eventData?: Object) {\n // This method implements an “optimal path” animation, as detailed in:\n //\n // Van Wijk, Jarke J.; Nuij, Wim A. A. “Smooth and efficient zooming and panning.” INFOVIS\n // ’03. pp. 15–22. .\n //\n // Where applicable, local variable documentation begins with the associated variable or\n // function in van Wijk (2003).\n\n this.stop();\n\n options = extend({\n offset: [0, 0],\n speed: 1.2,\n curve: 1.42,\n easing: defaultEasing\n }, options);\n\n const tr = this.transform,\n startZoom = this.getZoom(),\n startBearing = this.getBearing(),\n startPitch = this.getPitch();\n\n const zoom = 'zoom' in options ? clamp(+options.zoom, tr.minZoom, tr.maxZoom) : startZoom;\n const bearing = 'bearing' in options ? this._normalizeBearing(options.bearing, startBearing) : startBearing;\n const pitch = 'pitch' in options ? +options.pitch : startPitch;\n\n const scale = tr.zoomScale(zoom - startZoom);\n const pointAtOffset = tr.centerPoint.add(Point.convert(options.offset));\n const locationAtOffset = tr.pointLocation(pointAtOffset);\n const center = LngLat.convert(options.center || locationAtOffset);\n this._normalizeCenter(center);\n\n const from = tr.project(locationAtOffset);\n const delta = tr.project(center).sub(from);\n\n let rho = options.curve;\n\n // w₀: Initial visible span, measured in pixels at the initial scale.\n const w0 = Math.max(tr.width, tr.height),\n // w₁: Final visible span, measured in pixels with respect to the initial scale.\n w1 = w0 / scale,\n // Length of the flight path as projected onto the ground plane, measured in pixels from\n // the world image origin at the initial scale.\n u1 = delta.mag();\n\n if ('minZoom' in options) {\n const minZoom = clamp(Math.min(options.minZoom, startZoom, zoom), tr.minZoom, tr.maxZoom);\n // wm: Maximum visible span, measured in pixels with respect to the initial\n // scale.\n const wMax = w0 / tr.zoomScale(minZoom - startZoom);\n rho = Math.sqrt(wMax / u1 * 2);\n }\n\n // ρ²\n const rho2 = rho * rho;\n\n /**\n * rᵢ: Returns the zoom-out factor at one end of the animation.\n *\n * @param i 0 for the ascent or 1 for the descent.\n * @private\n */\n function r(i) {\n const b = (w1 * w1 - w0 * w0 + (i ? -1 : 1) * rho2 * rho2 * u1 * u1) / (2 * (i ? w1 : w0) * rho2 * u1);\n return Math.log(Math.sqrt(b * b + 1) - b);\n }\n\n function sinh(n) { return (Math.exp(n) - Math.exp(-n)) / 2; }\n function cosh(n) { return (Math.exp(n) + Math.exp(-n)) / 2; }\n function tanh(n) { return sinh(n) / cosh(n); }\n\n // r₀: Zoom-out factor during ascent.\n const r0 = r(0);\n\n // w(s): Returns the visible span on the ground, measured in pixels with respect to the\n // initial scale. Assumes an angular field of view of 2 arctan ½ ≈ 53°.\n let w: (number) => number = function (s) {\n return (cosh(r0) / cosh(r0 + rho * s));\n };\n\n // u(s): Returns the distance along the flight path as projected onto the ground plane,\n // measured in pixels from the world image origin at the initial scale.\n let u: (number) => number = function (s) {\n return w0 * ((cosh(r0) * tanh(r0 + rho * s) - sinh(r0)) / rho2) / u1;\n };\n\n // S: Total length of the flight path, measured in ρ-screenfuls.\n let S = (r(1) - r0) / rho;\n\n // When u₀ = u₁, the optimal path doesn’t require both ascent and descent.\n if (Math.abs(u1) < 0.000001 || !isFinite(S)) {\n // Perform a more or less instantaneous transition if the path is too short.\n if (Math.abs(w0 - w1) < 0.000001) return this.easeTo(options, eventData);\n\n const k = w1 < w0 ? -1 : 1;\n S = Math.abs(Math.log(w1 / w0)) / rho;\n\n u = function() { return 0; };\n w = function(s) { return Math.exp(k * rho * s); };\n }\n\n if ('duration' in options) {\n options.duration = +options.duration;\n } else {\n const V = 'screenSpeed' in options ? +options.screenSpeed / rho : +options.speed;\n options.duration = 1000 * S / V;\n }\n\n if (options.maxDuration && options.duration > options.maxDuration) {\n options.duration = 0;\n }\n\n this._zooming = true;\n this._rotating = (startBearing !== bearing);\n this._pitching = (pitch !== startPitch);\n\n this._prepareEase(eventData, false);\n\n this._ease((k) => {\n // s: The distance traveled along the flight path, measured in ρ-screenfuls.\n const s = k * S;\n const scale = 1 / w(s);\n tr.zoom = startZoom + tr.scaleZoom(scale);\n\n if (this._rotating) {\n tr.bearing = interpolate(startBearing, bearing, k);\n }\n if (this._pitching) {\n tr.pitch = interpolate(startPitch, pitch, k);\n }\n\n const newCenter = tr.unproject(from.add(delta.mult(u(s))).mult(scale));\n tr.setLocationAtPoint(tr.renderWorldCopies ? newCenter.wrap() : newCenter, pointAtOffset);\n\n this._fireMoveEvents(eventData);\n\n }, () => this._afterEase(eventData), options);\n\n return this;\n }\n\n isEasing() {\n return !!this._easeFrameId;\n }\n\n /**\n * Stops any animated transition underway.\n *\n * @memberof Map#\n * @returns {Map} `this`\n */\n stop(): this {\n if (this._easeFrameId) {\n this._cancelRenderFrame(this._easeFrameId);\n delete this._easeFrameId;\n delete this._onEaseFrame;\n }\n\n if (this._onEaseEnd) {\n // The _onEaseEnd function might emit events which trigger new\n // animation, which sets a new _onEaseEnd. Ensure we don't delete\n // it unintentionally.\n const onEaseEnd = this._onEaseEnd;\n delete this._onEaseEnd;\n onEaseEnd.call(this);\n }\n return this;\n }\n\n _ease(frame: (number) => void,\n finish: () => void,\n options: {animate: boolean, duration: number, easing: (number) => number}) {\n if (options.animate === false || options.duration === 0) {\n frame(1);\n finish();\n } else {\n this._easeStart = browser.now();\n this._easeOptions = options;\n this._onEaseFrame = frame;\n this._onEaseEnd = finish;\n this._easeFrameId = this._requestRenderFrame(this._renderFrameCallback);\n }\n }\n\n // Callback for map._requestRenderFrame\n _renderFrameCallback() {\n const t = Math.min((browser.now() - this._easeStart) / this._easeOptions.duration, 1);\n this._onEaseFrame(this._easeOptions.easing(t));\n if (t < 1) {\n this._easeFrameId = this._requestRenderFrame(this._renderFrameCallback);\n } else {\n this.stop();\n }\n }\n\n // convert bearing so that it's numerically close to the current one so that it interpolates properly\n _normalizeBearing(bearing: number, currentBearing: number) {\n bearing = wrap(bearing, -180, 180);\n const diff = Math.abs(bearing - currentBearing);\n if (Math.abs(bearing - 360 - currentBearing) < diff) bearing -= 360;\n if (Math.abs(bearing + 360 - currentBearing) < diff) bearing += 360;\n return bearing;\n }\n\n // If a path crossing the antimeridian would be shorter, extend the final coordinate so that\n // interpolating between the two endpoints will cross it.\n _normalizeCenter(center: LngLat) {\n const tr = this.transform;\n if (!tr.renderWorldCopies || tr.lngRange) return;\n\n const delta = center.lng - tr.center.lng;\n center.lng +=\n delta > 180 ? -360 :\n delta < -180 ? 360 : 0;\n }\n}\n\nexport default Camera;\n","// @flow\n\nimport DOM from '../../util/dom';\nimport { bindAll } from '../../util/util';\nimport config from '../../util/config';\n\nimport type Map from '../map';\n\ntype Options = {\n compact?: boolean\n};\n\n/**\n * An `AttributionControl` control presents the map's [attribution information](https://www.mapbox.com/help/attribution/).\n *\n * @implements {IControl}\n * @param {Object} [options]\n * @param {boolean} [options.compact] If `true` force a compact attribution that shows the full attribution on mouse hover, or if `false` force the full attribution control. The default is a responsive attribution that collapses when the map is less than 640 pixels wide.\n * @example\n * var map = new mapboxgl.Map({attributionControl: false})\n * .addControl(new mapboxgl.AttributionControl({\n * compact: true\n * }));\n */\nclass AttributionControl {\n options: Options;\n _map: Map;\n _container: HTMLElement;\n _editLink: ?HTMLAnchorElement;\n styleId: string;\n styleOwner: string;\n\n constructor(options: Options = {}) {\n this.options = options;\n\n bindAll([\n '_updateEditLink',\n '_updateData',\n '_updateCompact'\n ], this);\n }\n\n getDefaultPosition() {\n return 'bottom-right';\n }\n\n onAdd(map: Map) {\n const compact = this.options && this.options.compact;\n\n this._map = map;\n this._container = DOM.create('div', 'mapboxgl-ctrl mapboxgl-ctrl-attrib');\n\n if (compact) {\n this._container.classList.add('mapboxgl-compact');\n }\n\n this._updateAttributions();\n this._updateEditLink();\n\n this._map.on('sourcedata', this._updateData);\n this._map.on('moveend', this._updateEditLink);\n\n if (compact === undefined) {\n this._map.on('resize', this._updateCompact);\n this._updateCompact();\n }\n\n return this._container;\n }\n\n onRemove() {\n DOM.remove(this._container);\n\n this._map.off('sourcedata', this._updateData);\n this._map.off('moveend', this._updateEditLink);\n this._map.off('resize', this._updateCompact);\n\n this._map = (undefined: any);\n }\n\n _updateEditLink() {\n let editLink = this._editLink;\n if (!editLink) {\n editLink = this._editLink = (this._container.querySelector('.mapbox-improve-map'): any);\n }\n\n const params = [\n {key: \"owner\", value: this.styleOwner},\n {key: \"id\", value: this.styleId},\n {key: \"access_token\", value: config.ACCESS_TOKEN}\n ];\n\n if (editLink) {\n const paramString = params.reduce((acc, next, i) => {\n if (next.value) {\n acc += `${next.key}=${next.value}${i < params.length - 1 ? '&' : ''}`;\n }\n return acc;\n }, `?`);\n editLink.href = `https://www.mapbox.com/feedback/${paramString}${this._map._hash ? this._map._hash.getHashString(true) : ''}`;\n }\n }\n\n _updateData(e: any) {\n if (e && e.sourceDataType === 'metadata') {\n this._updateAttributions();\n this._updateEditLink();\n }\n }\n\n _updateAttributions() {\n if (!this._map.style) return;\n let attributions: Array = [];\n\n if (this._map.style.stylesheet) {\n const stylesheet: any = this._map.style.stylesheet;\n this.styleOwner = stylesheet.owner;\n this.styleId = stylesheet.id;\n }\n\n const sourceCaches = this._map.style.sourceCaches;\n for (const id in sourceCaches) {\n const source = sourceCaches[id].getSource();\n if (source.attribution && attributions.indexOf(source.attribution) < 0) {\n attributions.push(source.attribution);\n }\n }\n\n // remove any entries that are substrings of another entry.\n // first sort by length so that substrings come first\n attributions.sort((a, b) => a.length - b.length);\n attributions = attributions.filter((attrib, i) => {\n for (let j = i + 1; j < attributions.length; j++) {\n if (attributions[j].indexOf(attrib) >= 0) { return false; }\n }\n return true;\n });\n if (attributions.length) {\n this._container.innerHTML = attributions.join(' | ');\n this._container.classList.remove('mapboxgl-attrib-empty');\n } else {\n this._container.classList.add('mapboxgl-attrib-empty');\n }\n // remove old DOM node from _editLink\n this._editLink = null;\n }\n\n _updateCompact() {\n if (this._map.getCanvasContainer().offsetWidth <= 640) {\n this._container.classList.add('mapboxgl-compact');\n } else {\n this._container.classList.remove('mapboxgl-compact');\n }\n }\n\n}\n\nexport default AttributionControl;\n","// @flow\n\nimport DOM from '../../util/dom';\n\nimport { bindAll } from '../../util/util';\n\nimport type Map from '../map';\n\n/**\n * A `LogoControl` is a control that adds the Mapbox watermark\n * to the map as required by the [terms of service](https://www.mapbox.com/tos/) for Mapbox\n * vector tiles and core styles.\n *\n * @implements {IControl}\n * @private\n**/\n\nclass LogoControl {\n _map: Map;\n _container: HTMLElement;\n\n constructor() {\n bindAll(['_updateLogo'], this);\n }\n\n onAdd(map: Map) {\n this._map = map;\n this._container = DOM.create('div', 'mapboxgl-ctrl');\n const anchor = DOM.create('a', 'mapboxgl-ctrl-logo');\n anchor.target = \"_blank\";\n anchor.href = \"https://www.mapbox.com/\";\n anchor.setAttribute(\"aria-label\", \"Mapbox logo\");\n this._container.appendChild(anchor);\n this._container.style.display = 'none';\n\n this._map.on('sourcedata', this._updateLogo);\n this._updateLogo();\n return this._container;\n }\n\n onRemove() {\n DOM.remove(this._container);\n this._map.off('sourcedata', this._updateLogo);\n }\n\n getDefaultPosition() {\n return 'bottom-left';\n }\n\n _updateLogo(e: any) {\n if (!e || e.sourceDataType === 'metadata') {\n this._container.style.display = this._logoRequired() ? 'block' : 'none';\n }\n }\n\n _logoRequired() {\n if (!this._map.style) return;\n\n const sourceCaches = this._map.style.sourceCaches;\n for (const id in sourceCaches) {\n const source = sourceCaches[id].getSource();\n if (source.mapbox_logo) {\n return true;\n }\n }\n\n return false;\n }\n\n}\n\n\nexport default LogoControl;\n","// @flow\nimport assert from 'assert';\n\nexport type TaskID = number; // can't mark opaque due to https://github.com/flowtype/flow-remove-types/pull/61\ntype Task = {\n callback: () => void;\n id: TaskID;\n cancelled: boolean;\n};\n\nclass TaskQueue {\n _queue: Array;\n _id: TaskID;\n _cleared: boolean;\n _currentlyRunning: Array | false;\n\n constructor() {\n this._queue = [];\n this._id = 0;\n this._cleared = false;\n this._currentlyRunning = false;\n }\n\n add(callback: () => void): TaskID {\n const id = ++this._id;\n const queue = this._queue;\n queue.push({callback, id, cancelled: false});\n return id;\n }\n\n remove(id: TaskID) {\n const running = this._currentlyRunning;\n const queue = running ? this._queue.concat(running) : this._queue;\n for (const task of queue) {\n if (task.id === id) {\n task.cancelled = true;\n return;\n }\n }\n }\n\n run() {\n assert(!this._currentlyRunning);\n const queue = this._currentlyRunning = this._queue;\n\n // Tasks queued by callbacks in the current queue should be executed\n // on the next run, not the current run.\n this._queue = [];\n\n for (const task of queue) {\n if (task.cancelled) continue;\n task.callback();\n if (this._cleared) break;\n }\n\n this._cleared = false;\n this._currentlyRunning = false;\n }\n\n clear() {\n if (this._currentlyRunning) {\n this._cleared = true;\n }\n this._queue = [];\n }\n}\n\nexport default TaskQueue;\n","// @flow\n\nimport { extend, bindAll, warnOnce } from '../util/util';\n\nimport browser from '../util/browser';\nimport window from '../util/window';\nconst { HTMLImageElement, HTMLElement } = window;\nimport DOM from '../util/dom';\nimport { getImage, ResourceType } from '../util/ajax';\nimport Style from '../style/style';\nimport EvaluationParameters from '../style/evaluation_parameters';\nimport Painter from '../render/painter';\nimport Transform from '../geo/transform';\nimport Hash from './hash';\nimport bindHandlers from './bind_handlers';\nimport Camera from './camera';\nimport LngLat from '../geo/lng_lat';\nimport LngLatBounds from '../geo/lng_lat_bounds';\nimport Point from '@mapbox/point-geometry';\nimport AttributionControl from './control/attribution_control';\nimport LogoControl from './control/logo_control';\nimport isSupported from '@mapbox/mapbox-gl-supported';\nimport { RGBAImage } from '../util/image';\nimport { Event, ErrorEvent } from '../util/evented';\nimport { MapMouseEvent } from './events';\nimport TaskQueue from '../util/task_queue';\n\nimport type {LngLatLike} from '../geo/lng_lat';\nimport type {LngLatBoundsLike} from '../geo/lng_lat_bounds';\nimport type {RequestParameters} from '../util/ajax';\nimport type {StyleOptions} from '../style/style';\nimport type {MapEvent, MapDataEvent} from './events';\n\nimport type ScrollZoomHandler from './handler/scroll_zoom';\nimport type BoxZoomHandler from './handler/box_zoom';\nimport type DragRotateHandler from './handler/drag_rotate';\nimport type DragPanHandler from './handler/drag_pan';\nimport type KeyboardHandler from './handler/keyboard';\nimport type DoubleClickZoomHandler from './handler/dblclick_zoom';\nimport type TouchZoomRotateHandler from './handler/touch_zoom_rotate';\nimport type {TaskID} from '../util/task_queue';\n\ntype ControlPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';\n\n/* eslint-disable no-use-before-define */\ntype IControl = {\n onAdd(map: Map): HTMLElement;\n onRemove(map: Map): void;\n\n +getDefaultPosition?: () => ControlPosition;\n}\n/* eslint-enable no-use-before-define */\n\ntype ResourceTypeEnum = $Keys;\nexport type RequestTransformFunction = (url: string, resourceType?: ResourceTypeEnum) => RequestParameters;\n\ntype MapOptions = {\n hash?: boolean,\n interactive?: boolean,\n container: HTMLElement | string,\n bearingSnap?: number,\n classes?: Array,\n attributionControl?: boolean,\n logoPosition?: ControlPosition,\n failIfMajorPerformanceCaveat?: boolean,\n preserveDrawingBuffer?: boolean,\n refreshExpiredTiles?: boolean,\n maxBounds?: LngLatBoundsLike,\n scrollZoom?: boolean,\n minZoom?: ?number,\n maxZoom?: ?number,\n boxZoom?: boolean,\n dragRotate?: boolean,\n dragPan?: boolean,\n keyboard?: boolean,\n doubleClickZoom?: boolean,\n touchZoomRotate?: boolean,\n trackResize?: boolean,\n center?: LngLatLike,\n zoom?: number,\n bearing?: number,\n pitch?: number,\n renderWorldCopies?: boolean,\n maxTileCacheSize?: number,\n transformRequest?: RequestTransformFunction\n};\n\nconst defaultMinZoom = 0;\nconst defaultMaxZoom = 22;\nconst defaultOptions = {\n center: [0, 0],\n zoom: 0,\n bearing: 0,\n pitch: 0,\n\n minZoom: defaultMinZoom,\n maxZoom: defaultMaxZoom,\n\n interactive: true,\n\n scrollZoom: true,\n boxZoom: true,\n dragRotate: true,\n dragPan: true,\n keyboard: true,\n doubleClickZoom: true,\n touchZoomRotate: true,\n\n bearingSnap: 7,\n\n hash: false,\n\n attributionControl: true,\n\n failIfMajorPerformanceCaveat: false,\n preserveDrawingBuffer: false,\n\n trackResize: true,\n\n renderWorldCopies: true,\n\n refreshExpiredTiles: true,\n\n maxTileCacheSize: null,\n\n transformRequest: null,\n fadeDuration: 300\n};\n\n/**\n * The `Map` object represents the map on your page. It exposes methods\n * and properties that enable you to programmatically change the map,\n * and fires events as users interact with it.\n *\n * You create a `Map` by specifying a `container` and other options.\n * Then Mapbox GL JS initializes the map on the page and returns your `Map`\n * object.\n *\n * @extends Evented\n * @param {Object} options\n * @param {HTMLElement|string} options.container The HTML element in which Mapbox GL JS will render the map, or the element's string `id`. The specified element must have no children.\n * @param {number} [options.minZoom=0] The minimum zoom level of the map (0-24).\n * @param {number} [options.maxZoom=22] The maximum zoom level of the map (0-24).\n * @param {Object|string} [options.style] The map's Mapbox style. This must be an a JSON object conforming to\n * the schema described in the [Mapbox Style Specification](https://mapbox.com/mapbox-gl-style-spec/), or a URL to\n * such JSON.\n *\n * To load a style from the Mapbox API, you can use a URL of the form `mapbox://styles/:owner/:style`,\n * where `:owner` is your Mapbox account name and `:style` is the style ID. Or you can use one of the following\n * [the predefined Mapbox styles](https://www.mapbox.com/maps/):\n *\n * * `mapbox://styles/mapbox/streets-v10`\n * * `mapbox://styles/mapbox/outdoors-v10`\n * * `mapbox://styles/mapbox/light-v9`\n * * `mapbox://styles/mapbox/dark-v9`\n * * `mapbox://styles/mapbox/satellite-v9`\n * * `mapbox://styles/mapbox/satellite-streets-v10`\n * * `mapbox://styles/mapbox/navigation-preview-day-v2`\n * * `mapbox://styles/mapbox/navigation-preview-night-v2`\n * * `mapbox://styles/mapbox/navigation-guidance-day-v2`\n * * `mapbox://styles/mapbox/navigation-guidance-night-v2`\n *\n * Tilesets hosted with Mapbox can be style-optimized if you append `?optimize=true` to the end of your style URL, like `mapbox://styles/mapbox/streets-v9?optimize=true`.\n * Learn more about style-optimized vector tiles in our [API documentation](https://www.mapbox.com/api-documentation/#retrieve-tiles).\n *\n * @param {boolean} [options.hash=false] If `true`, the map's position (zoom, center latitude, center longitude, bearing, and pitch) will be synced with the hash fragment of the page's URL.\n * For example, `http://path/to/my/page.html#2.59/39.26/53.07/-24.1/60`.\n * @param {boolean} [options.interactive=true] If `false`, no mouse, touch, or keyboard listeners will be attached to the map, so it will not respond to interaction.\n * @param {number} [options.bearingSnap=7] The threshold, measured in degrees, that determines when the map's\n * bearing will snap to north. For example, with a `bearingSnap` of 7, if the user rotates\n * the map within 7 degrees of north, the map will automatically snap to exact north.\n * @param {boolean} [options.pitchWithRotate=true] If `false`, the map's pitch (tilt) control with \"drag to rotate\" interaction will be disabled.\n * @param {boolean} [options.attributionControl=true] If `true`, an {@link AttributionControl} will be added to the map.\n * @param {string} [options.logoPosition='bottom-left'] A string representing the position of the Mapbox wordmark on the map. Valid options are `top-left`,`top-right`, `bottom-left`, `bottom-right`.\n * @param {boolean} [options.failIfMajorPerformanceCaveat=false] If `true`, map creation will fail if the performance of Mapbox\n * GL JS would be dramatically worse than expected (i.e. a software renderer would be used).\n * @param {boolean} [options.preserveDrawingBuffer=false] If `true`, the map's canvas can be exported to a PNG using `map.getCanvas().toDataURL()`. This is `false` by default as a performance optimization.\n * @param {boolean} [options.refreshExpiredTiles=true] If `false`, the map won't attempt to re-request tiles once they expire per their HTTP `cacheControl`/`expires` headers.\n * @param {LngLatBoundsLike} [options.maxBounds] If set, the map will be constrained to the given bounds.\n * @param {boolean|Object} [options.scrollZoom=true] If `true`, the \"scroll to zoom\" interaction is enabled. An `Object` value is passed as options to {@link ScrollZoomHandler#enable}.\n * @param {boolean} [options.boxZoom=true] If `true`, the \"box zoom\" interaction is enabled (see {@link BoxZoomHandler}).\n * @param {boolean} [options.dragRotate=true] If `true`, the \"drag to rotate\" interaction is enabled (see {@link DragRotateHandler}).\n * @param {boolean} [options.dragPan=true] If `true`, the \"drag to pan\" interaction is enabled (see {@link DragPanHandler}).\n * @param {boolean} [options.keyboard=true] If `true`, keyboard shortcuts are enabled (see {@link KeyboardHandler}).\n * @param {boolean} [options.doubleClickZoom=true] If `true`, the \"double click to zoom\" interaction is enabled (see {@link DoubleClickZoomHandler}).\n * @param {boolean|Object} [options.touchZoomRotate=true] If `true`, the \"pinch to rotate and zoom\" interaction is enabled. An `Object` value is passed as options to {@link TouchZoomRotateHandler#enable}.\n * @param {boolean} [options.trackResize=true] If `true`, the map will automatically resize when the browser window resizes.\n * @param {LngLatLike} [options.center=[0, 0]] The inital geographical centerpoint of the map. If `center` is not specified in the constructor options, Mapbox GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to `[0, 0]` Note: Mapbox GL uses longitude, latitude coordinate order (as opposed to latitude, longitude) to match GeoJSON.\n * @param {number} [options.zoom=0] The initial zoom level of the map. If `zoom` is not specified in the constructor options, Mapbox GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to `0`.\n * @param {number} [options.bearing=0] The initial bearing (rotation) of the map, measured in degrees counter-clockwise from north. If `bearing` is not specified in the constructor options, Mapbox GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to `0`.\n * @param {number} [options.pitch=0] The initial pitch (tilt) of the map, measured in degrees away from the plane of the screen (0-60). If `pitch` is not specified in the constructor options, Mapbox GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to `0`.\n * @param {boolean} [options.renderWorldCopies=true] If `true`, multiple copies of the world will be rendered, when zoomed out.\n * @param {number} [options.maxTileCacheSize=null] The maximum number of tiles stored in the tile cache for a given source. If omitted, the cache will be dynamically sized based on the current viewport.\n * @param {string} [options.localIdeographFontFamily=null] If specified, defines a CSS font-family\n * for locally overriding generation of glyphs in the 'CJK Unified Ideographs' and 'Hangul Syllables' ranges.\n * In these ranges, font settings from the map's style will be ignored, except for font-weight keywords (light/regular/medium/bold).\n * The purpose of this option is to avoid bandwidth-intensive glyph server requests. (see [Use locally generated ideographs](https://www.mapbox.com/mapbox-gl-js/example/local-ideographs))\n * @param {RequestTransformFunction} [options.transformRequest=null] A callback run before the Map makes a request for an external URL. The callback can be used to modify the url, set headers, or set the credentials property for cross-origin requests.\n * Expected to return an object with a `url` property and optionally `headers` and `credentials` properties.\n * @param {boolean} [options.collectResourceTiming=false] If `true`, Resource Timing API information will be collected for requests made by GeoJSON and Vector Tile web workers (this information is normally inaccessible from the main Javascript thread). Information will be returned in a `resourceTiming` property of relevant `data` events.\n * @example\n * var map = new mapboxgl.Map({\n * container: 'map',\n * center: [-122.420679, 37.772537],\n * zoom: 13,\n * style: style_object,\n * hash: true,\n * transformRequest: (url, resourceType)=> {\n * if(resourceType == 'Source' && url.startsWith('http://myHost')) {\n * return {\n * url: url.replace('http', 'https'),\n * headers: { 'my-custom-header': true},\n * credentials: 'include' // Include cookies for cross-origin requests\n * }\n * }\n * }\n * });\n * @see [Display a map](https://www.mapbox.com/mapbox-gl-js/examples/)\n */\nclass Map extends Camera {\n style: Style;\n painter: Painter;\n\n _container: HTMLElement;\n _missingCSSContainer: HTMLElement;\n _canvasContainer: HTMLElement;\n _controlContainer: HTMLElement;\n _controlPositions: {[string]: HTMLElement};\n _interactive: ?boolean;\n _showTileBoundaries: ?boolean;\n _showCollisionBoxes: ?boolean;\n _showOverdrawInspector: boolean;\n _repaint: ?boolean;\n _vertices: ?boolean;\n _canvas: HTMLCanvasElement;\n _transformRequest: RequestTransformFunction;\n _maxTileCacheSize: number;\n _frameId: any;\n _styleDirty: ?boolean;\n _sourcesDirty: ?boolean;\n _placementDirty: ?boolean;\n _loaded: boolean;\n _trackResize: boolean;\n _preserveDrawingBuffer: boolean;\n _failIfMajorPerformanceCaveat: boolean;\n _refreshExpiredTiles: boolean;\n _hash: Hash;\n _delegatedListeners: any;\n _fadeDuration: number;\n _crossFadingFactor: number;\n _collectResourceTiming: boolean;\n _renderTaskQueue: TaskQueue;\n\n /**\n * The map's {@link ScrollZoomHandler}, which implements zooming in and out with a scroll wheel or trackpad.\n */\n scrollZoom: ScrollZoomHandler;\n\n /**\n * The map's {@link BoxZoomHandler}, which implements zooming using a drag gesture with the Shift key pressed.\n */\n boxZoom: BoxZoomHandler;\n\n /**\n * The map's {@link DragRotateHandler}, which implements rotating the map while dragging with the right\n * mouse button or with the Control key pressed.\n */\n dragRotate: DragRotateHandler;\n\n /**\n * The map's {@link DragPanHandler}, which implements dragging the map with a mouse or touch gesture.\n */\n dragPan: DragPanHandler;\n\n /**\n * The map's {@link KeyboardHandler}, which allows the user to zoom, rotate, and pan the map using keyboard\n * shortcuts.\n */\n keyboard: KeyboardHandler;\n\n /**\n * The map's {@link DoubleClickZoomHandler}, which allows the user to zoom by double clicking.\n */\n doubleClickZoom: DoubleClickZoomHandler;\n\n /**\n * The map's {@link TouchZoomRotateHandler}, which allows the user to zoom or rotate the map with touch gestures.\n */\n touchZoomRotate: TouchZoomRotateHandler;\n\n constructor(options: MapOptions) {\n options = extend({}, defaultOptions, options);\n\n if (options.minZoom != null && options.maxZoom != null && options.minZoom > options.maxZoom) {\n throw new Error(`maxZoom must be greater than minZoom`);\n }\n\n const transform = new Transform(options.minZoom, options.maxZoom, options.renderWorldCopies);\n super(transform, options);\n\n this._interactive = options.interactive;\n this._maxTileCacheSize = options.maxTileCacheSize;\n this._failIfMajorPerformanceCaveat = options.failIfMajorPerformanceCaveat;\n this._preserveDrawingBuffer = options.preserveDrawingBuffer;\n this._trackResize = options.trackResize;\n this._bearingSnap = options.bearingSnap;\n this._refreshExpiredTiles = options.refreshExpiredTiles;\n this._fadeDuration = options.fadeDuration;\n this._crossFadingFactor = 1;\n this._collectResourceTiming = options.collectResourceTiming;\n this._renderTaskQueue = new TaskQueue();\n\n const transformRequestFn = options.transformRequest;\n this._transformRequest = transformRequestFn ? (url, type) => transformRequestFn(url, type) || ({ url }) : (url) => ({ url });\n\n if (typeof options.container === 'string') {\n const container = window.document.getElementById(options.container);\n if (!container) {\n throw new Error(`Container '${options.container}' not found.`);\n } else {\n this._container = container;\n }\n } else if (options.container instanceof HTMLElement) {\n this._container = options.container;\n } else {\n throw new Error(`Invalid type: 'container' must be a String or HTMLElement.`);\n }\n\n if (options.maxBounds) {\n this.setMaxBounds(options.maxBounds);\n }\n\n bindAll([\n '_onWindowOnline',\n '_onWindowResize',\n '_contextLost',\n '_contextRestored',\n '_update',\n '_render',\n '_onData',\n '_onDataLoading'\n ], this);\n\n this._setupContainer();\n this._setupPainter();\n\n this.on('move', this._update.bind(this, false));\n this.on('zoom', this._update.bind(this, true));\n\n if (typeof window !== 'undefined') {\n window.addEventListener('online', this._onWindowOnline, false);\n window.addEventListener('resize', this._onWindowResize, false);\n }\n\n bindHandlers(this, options);\n\n this._hash = options.hash && (new Hash()).addTo(this);\n // don't set position from options if set through hash\n if (!this._hash || !this._hash._onHashChange()) {\n this.jumpTo({\n center: options.center,\n zoom: options.zoom,\n bearing: options.bearing,\n pitch: options.pitch\n });\n }\n\n this.resize();\n\n if (options.style) this.setStyle(options.style, { localIdeographFontFamily: options.localIdeographFontFamily });\n\n if (options.attributionControl) this.addControl(new AttributionControl());\n this.addControl(new LogoControl(), options.logoPosition);\n\n this.on('style.load', function() {\n if (this.transform.unmodified) {\n this.jumpTo(this.style.stylesheet);\n }\n });\n\n this.on('data', this._onData);\n this.on('dataloading', this._onDataLoading);\n }\n\n /**\n * Adds a {@link IControl} to the map, calling `control.onAdd(this)`.\n *\n * @param {IControl} control The {@link IControl} to add.\n * @param {string} [position] position on the map to which the control will be added.\n * Valid values are `'top-left'`, `'top-right'`, `'bottom-left'`, and `'bottom-right'`. Defaults to `'top-right'`.\n * @returns {Map} `this`\n * @see [Display map navigation controls](https://www.mapbox.com/mapbox-gl-js/example/navigation/)\n */\n addControl(control: IControl, position?: ControlPosition) {\n if (position === undefined && control.getDefaultPosition) {\n position = control.getDefaultPosition();\n }\n if (position === undefined) {\n position = 'top-right';\n }\n const controlElement = control.onAdd(this);\n const positionContainer = this._controlPositions[position];\n if (position.indexOf('bottom') !== -1) {\n positionContainer.insertBefore(controlElement, positionContainer.firstChild);\n } else {\n positionContainer.appendChild(controlElement);\n }\n return this;\n }\n\n /**\n * Removes the control from the map.\n *\n * @param {IControl} control The {@link IControl} to remove.\n * @returns {Map} `this`\n */\n removeControl(control: IControl) {\n control.onRemove(this);\n return this;\n }\n\n /**\n * Resizes the map according to the dimensions of its\n * `container` element.\n *\n * This method must be called after the map's `container` is resized by another script,\n * or when the map is shown after being initially hidden with CSS.\n *\n * @param eventData Additional properties to be added to event objects of events triggered by this method.\n * @returns {Map} `this`\n */\n resize(eventData?: Object) {\n const dimensions = this._containerDimensions();\n const width = dimensions[0];\n const height = dimensions[1];\n\n this._resizeCanvas(width, height);\n this.transform.resize(width, height);\n this.painter.resize(width, height);\n\n return this\n .fire(new Event('movestart', eventData))\n .fire(new Event('move', eventData))\n .fire(new Event('resize', eventData))\n .fire(new Event('moveend', eventData));\n }\n\n /**\n * Returns the map's geographical bounds.\n *\n * @returns {LngLatBounds} The map's geographical bounds.\n */\n getBounds() {\n const bounds = new LngLatBounds(\n this.transform.pointLocation(new Point(0, this.transform.height)),\n this.transform.pointLocation(new Point(this.transform.width, 0)));\n\n if (this.transform.angle || this.transform.pitch) {\n bounds.extend(this.transform.pointLocation(new Point(this.transform.size.x, 0)));\n bounds.extend(this.transform.pointLocation(new Point(0, this.transform.size.y)));\n }\n\n return bounds;\n }\n\n /**\n * Gets the map's geographical bounds.\n *\n * Returns the LngLatBounds by which pan and zoom operations on the map are constrained.\n *\n * @returns {LngLatBounds | null} The maximum bounds the map is constrained to, or `null` if none set.\n */\n getMaxBounds () {\n if (this.transform.latRange && this.transform.latRange.length === 2 &&\n this.transform.lngRange && this.transform.lngRange.length === 2) {\n return new LngLatBounds([this.transform.lngRange[0], this.transform.latRange[0]],\n [this.transform.lngRange[1], this.transform.latRange[1]]);\n } else {\n return null;\n }\n }\n\n /**\n * Sets or clears the map's geographical bounds.\n *\n * Pan and zoom operations are constrained within these bounds.\n * If a pan or zoom is performed that would\n * display regions outside these bounds, the map will\n * instead display a position and zoom level\n * as close as possible to the operation's request while still\n * remaining within the bounds.\n *\n * @param {LngLatBoundsLike | null | undefined} lnglatbounds The maximum bounds to set. If `null` or `undefined` is provided, the function removes the map's maximum bounds.\n * @returns {Map} `this`\n */\n setMaxBounds(lnglatbounds: LngLatBoundsLike) {\n if (lnglatbounds) {\n const b = LngLatBounds.convert(lnglatbounds);\n this.transform.lngRange = [b.getWest(), b.getEast()];\n this.transform.latRange = [b.getSouth(), b.getNorth()];\n this.transform._constrain();\n this._update();\n } else if (lnglatbounds === null || lnglatbounds === undefined) {\n this.transform.lngRange = null;\n this.transform.latRange = null;\n this._update();\n }\n return this;\n\n }\n\n /**\n * Sets or clears the map's minimum zoom level.\n * If the map's current zoom level is lower than the new minimum,\n * the map will zoom to the new minimum.\n *\n * @param {number | null | undefined} minZoom The minimum zoom level to set (0-24).\n * If `null` or `undefined` is provided, the function removes the current minimum zoom (i.e. sets it to 0).\n * @returns {Map} `this`\n */\n setMinZoom(minZoom?: ?number) {\n\n minZoom = minZoom === null || minZoom === undefined ? defaultMinZoom : minZoom;\n\n if (minZoom >= defaultMinZoom && minZoom <= this.transform.maxZoom) {\n this.transform.minZoom = minZoom;\n this._update();\n\n if (this.getZoom() < minZoom) this.setZoom(minZoom);\n\n return this;\n\n } else throw new Error(`minZoom must be between ${defaultMinZoom} and the current maxZoom, inclusive`);\n }\n\n /**\n * Returns the map's minimum allowable zoom level.\n *\n * @returns {number} minZoom\n */\n getMinZoom() { return this.transform.minZoom; }\n\n /**\n * Sets or clears the map's maximum zoom level.\n * If the map's current zoom level is higher than the new maximum,\n * the map will zoom to the new maximum.\n *\n * @param {number | null | undefined} maxZoom The maximum zoom level to set.\n * If `null` or `undefined` is provided, the function removes the current maximum zoom (sets it to 22).\n * @returns {Map} `this`\n */\n setMaxZoom(maxZoom?: ?number) {\n\n maxZoom = maxZoom === null || maxZoom === undefined ? defaultMaxZoom : maxZoom;\n\n if (maxZoom >= this.transform.minZoom) {\n this.transform.maxZoom = maxZoom;\n this._update();\n\n if (this.getZoom() > maxZoom) this.setZoom(maxZoom);\n\n return this;\n\n } else throw new Error(`maxZoom must be greater than the current minZoom`);\n }\n\n /**\n * Returns the state of renderWorldCopies.\n *\n * @returns {boolean} renderWorldCopies\n */\n getRenderWorldCopies() { return this.transform.renderWorldCopies; }\n\n /**\n * Sets the state of renderWorldCopies.\n *\n * @param {boolean} renderWorldCopies If `true`, multiple copies of the world will be rendered, when zoomed out. `undefined` is treated as `true`, `null` is treated as `false`.\n * @returns {Map} `this`\n */\n setRenderWorldCopies(renderWorldCopies?: ?boolean) {\n\n this.transform.renderWorldCopies = renderWorldCopies;\n this._update();\n\n return this;\n }\n\n /**\n * Returns the map's maximum allowable zoom level.\n *\n * @returns {number} maxZoom\n */\n getMaxZoom() { return this.transform.maxZoom; }\n\n /**\n * Returns a {@link Point} representing pixel coordinates, relative to the map's `container`,\n * that correspond to the specified geographical location.\n *\n * @param {LngLatLike} lnglat The geographical location to project.\n * @returns {Point} The {@link Point} corresponding to `lnglat`, relative to the map's `container`.\n */\n project(lnglat: LngLatLike) {\n return this.transform.locationPoint(LngLat.convert(lnglat));\n }\n\n /**\n * Returns a {@link LngLat} representing geographical coordinates that correspond\n * to the specified pixel coordinates.\n *\n * @param {PointLike} point The pixel coordinates to unproject.\n * @returns {LngLat} The {@link LngLat} corresponding to `point`.\n * @see [Show polygon information on click](https://www.mapbox.com/mapbox-gl-js/example/polygon-popup-on-click/)\n */\n unproject(point: PointLike) {\n return this.transform.pointLocation(Point.convert(point));\n }\n\n /**\n * Returns true if the map is panning, zooming, rotating, or pitching due to a camera animation or user gesture.\n */\n isMoving(): boolean {\n return this._moving ||\n this.dragPan.isActive() ||\n this.dragRotate.isActive() ||\n this.scrollZoom.isActive();\n }\n\n /**\n * Returns true if the map is zooming due to a camera animation or user gesture.\n */\n isZooming(): boolean {\n return this._zooming ||\n this.scrollZoom.isActive();\n }\n\n /**\n * Returns true if the map is rotating due to a camera animation or user gesture.\n */\n isRotating(): boolean {\n return this._rotating ||\n this.dragRotate.isActive();\n }\n\n /**\n * Adds a listener for events of a specified type.\n *\n * @method\n * @name on\n * @memberof Map\n * @instance\n * @param {string} type The event type to add a listen for.\n * @param {Function} listener The function to be called when the event is fired.\n * The listener function is called with the data object passed to `fire`,\n * extended with `target` and `type` properties.\n * @returns {Map} `this`\n */\n\n /**\n * Adds a listener for events of a specified type occurring on features in a specified style layer.\n *\n * @param {string} type The event type to listen for; one of `'mousedown'`, `'mouseup'`, `'click'`, `'dblclick'`,\n * `'mousemove'`, `'mouseenter'`, `'mouseleave'`, `'mouseover'`, `'mouseout'`, `'contextmenu'`, `'touchstart'`,\n * `'touchend'`, or `'touchcancel'`. `mouseenter` and `mouseover` events are triggered when the cursor enters\n * a visible portion of the specified layer from outside that layer or outside the map canvas. `mouseleave`\n * and `mouseout` events are triggered when the cursor leaves a visible portion of the specified layer, or leaves\n * the map canvas.\n * @param {string} layer The ID of a style layer. Only events whose location is within a visible\n * feature in this layer will trigger the listener. The event will have a `features` property containing\n * an array of the matching features.\n * @param {Function} listener The function to be called when the event is fired.\n * @returns {Map} `this`\n */\n on(type: MapEvent, layer: any, listener: any) {\n if (listener === undefined) {\n return super.on(type, layer);\n }\n\n const delegatedListener = (() => {\n if (type === 'mouseenter' || type === 'mouseover') {\n let mousein = false;\n const mousemove = (e) => {\n const features = this.getLayer(layer) ? this.queryRenderedFeatures(e.point, {layers: [layer]}) : [];\n if (!features.length) {\n mousein = false;\n } else if (!mousein) {\n mousein = true;\n listener.call(this, new MapMouseEvent(type, this, e.originalEvent, {features}));\n }\n };\n const mouseout = () => {\n mousein = false;\n };\n return {layer, listener, delegates: {mousemove, mouseout}};\n } else if (type === 'mouseleave' || type === 'mouseout') {\n let mousein = false;\n const mousemove = (e) => {\n const features = this.getLayer(layer) ? this.queryRenderedFeatures(e.point, {layers: [layer]}) : [];\n if (features.length) {\n mousein = true;\n } else if (mousein) {\n mousein = false;\n listener.call(this, new MapMouseEvent(type, this, e.originalEvent));\n }\n };\n const mouseout = (e) => {\n if (mousein) {\n mousein = false;\n listener.call(this, new MapMouseEvent(type, this, e.originalEvent));\n }\n };\n return {layer, listener, delegates: {mousemove, mouseout}};\n } else {\n const delegate = (e) => {\n const features = this.getLayer(layer) ? this.queryRenderedFeatures(e.point, {layers: [layer]}) : [];\n if (features.length) {\n // Here we need to mutate the original event, so that preventDefault works as expected.\n e.features = features;\n listener.call(this, e);\n delete e.features;\n }\n };\n return {layer, listener, delegates: {[type]: delegate}};\n }\n })();\n\n this._delegatedListeners = this._delegatedListeners || {};\n this._delegatedListeners[type] = this._delegatedListeners[type] || [];\n this._delegatedListeners[type].push(delegatedListener);\n\n for (const event in delegatedListener.delegates) {\n this.on((event: any), delegatedListener.delegates[event]);\n }\n\n return this;\n }\n\n /**\n * Removes an event listener previously added with `Map#on`.\n *\n * @method\n * @name off\n * @memberof Map\n * @instance\n * @param {string} type The event type previously used to install the listener.\n * @param {Function} listener The function previously installed as a listener.\n * @returns {Map} `this`\n */\n\n /**\n * Removes an event listener for layer-specific events previously added with `Map#on`.\n *\n * @param {string} type The event type previously used to install the listener.\n * @param {string} layer The layer ID previously used to install the listener.\n * @param {Function} listener The function previously installed as a listener.\n * @returns {Map} `this`\n */\n off(type: MapEvent, layer: any, listener: any) {\n if (listener === undefined) {\n return super.off(type, layer);\n }\n\n if (this._delegatedListeners && this._delegatedListeners[type]) {\n const listeners = this._delegatedListeners[type];\n for (let i = 0; i < listeners.length; i++) {\n const delegatedListener = listeners[i];\n if (delegatedListener.layer === layer && delegatedListener.listener === listener) {\n for (const event in delegatedListener.delegates) {\n this.off((event: any), delegatedListener.delegates[event]);\n }\n listeners.splice(i, 1);\n return this;\n }\n }\n }\n\n return this;\n }\n\n /**\n * Returns an array of [GeoJSON](http://geojson.org/)\n * [Feature objects](https://tools.ietf.org/html/rfc7946#section-3.2)\n * representing visible features that satisfy the query parameters.\n *\n * @param {PointLike|Array} [geometry] - The geometry of the query region:\n * either a single point or southwest and northeast points describing a bounding box.\n * Omitting this parameter (i.e. calling {@link Map#queryRenderedFeatures} with zero arguments,\n * or with only a `options` argument) is equivalent to passing a bounding box encompassing the entire\n * map viewport.\n * @param {Object} [options]\n * @param {Array} [options.layers] An array of style layer IDs for the query to inspect.\n * Only features within these layers will be returned. If this parameter is undefined, all layers will be checked.\n * @param {Array} [options.filter] A [filter](https://www.mapbox.com/mapbox-gl-js/style-spec/#other-filter)\n * to limit query results.\n *\n * @returns {Array} An array of [GeoJSON](http://geojson.org/)\n * [feature objects](https://tools.ietf.org/html/rfc7946#section-3.2).\n *\n * The `properties` value of each returned feature object contains the properties of its source feature. For GeoJSON sources, only\n * string and numeric property values are supported (i.e. `null`, `Array`, and `Object` values are not supported).\n *\n * Each feature includes a top-level `layer` property whose value is an object representing the style layer to\n * which the feature belongs. Layout and paint properties in this object contain values which are fully evaluated\n * for the given zoom level and feature.\n *\n * Features from layers whose `visibility` property is `\"none\"`, or from layers whose zoom range excludes the\n * current zoom level are not included. Symbol features that have been hidden due to text or icon collision are\n * not included. Features from all other layers are included, including features that may have no visible\n * contribution to the rendered result; for example, because the layer's opacity or color alpha component is set to\n * 0.\n *\n * The topmost rendered feature appears first in the returned array, and subsequent features are sorted by\n * descending z-order. Features that are rendered multiple times (due to wrapping across the antimeridian at low\n * zoom levels) are returned only once (though subject to the following caveat).\n *\n * Because features come from tiled vector data or GeoJSON data that is converted to tiles internally, feature\n * geometries may be split or duplicated across tile boundaries and, as a result, features may appear multiple\n * times in query results. For example, suppose there is a highway running through the bounding rectangle of a query.\n * The results of the query will be those parts of the highway that lie within the map tiles covering the bounding\n * rectangle, even if the highway extends into other tiles, and the portion of the highway within each map tile\n * will be returned as a separate feature. Similarly, a point feature near a tile boundary may appear in multiple\n * tiles due to tile buffering.\n *\n * @example\n * // Find all features at a point\n * var features = map.queryRenderedFeatures(\n * [20, 35],\n * { layers: ['my-layer-name'] }\n * );\n *\n * @example\n * // Find all features within a static bounding box\n * var features = map.queryRenderedFeatures(\n * [[10, 20], [30, 50]],\n * { layers: ['my-layer-name'] }\n * );\n *\n * @example\n * // Find all features within a bounding box around a point\n * var width = 10;\n * var height = 20;\n * var features = map.queryRenderedFeatures([\n * [point.x - width / 2, point.y - height / 2],\n * [point.x + width / 2, point.y + height / 2]\n * ], { layers: ['my-layer-name'] });\n *\n * @example\n * // Query all rendered features from a single layer\n * var features = map.queryRenderedFeatures({ layers: ['my-layer-name'] });\n * @see [Get features under the mouse pointer](https://www.mapbox.com/mapbox-gl-js/example/queryrenderedfeatures/)\n * @see [Highlight features within a bounding box](https://www.mapbox.com/mapbox-gl-js/example/using-box-queryrenderedfeatures/)\n * @see [Center the map on a clicked symbol](https://www.mapbox.com/mapbox-gl-js/example/center-on-symbol/)\n */\n queryRenderedFeatures(geometry?: PointLike | [PointLike, PointLike], options?: Object) {\n // The first parameter can be omitted entirely, making this effectively an overloaded method\n // with two signatures:\n //\n // queryRenderedFeatures(geometry: PointLike | [PointLike, PointLike], options?: Object)\n // queryRenderedFeatures(options?: Object)\n //\n // There no way to express that in a way that's compatible with both flow and documentation.js.\n // Related: https://github.com/facebook/flow/issues/1556\n if (arguments.length === 2) {\n geometry = arguments[0];\n options = arguments[1];\n } else if (arguments.length === 1 && isPointLike(arguments[0])) {\n geometry = arguments[0];\n options = {};\n } else if (arguments.length === 1) {\n geometry = undefined;\n options = arguments[0];\n } else {\n geometry = undefined;\n options = {};\n }\n\n if (!this.style) {\n return [];\n }\n\n return this.style.queryRenderedFeatures(\n this._makeQueryGeometry(geometry),\n options,\n this.transform\n );\n\n function isPointLike(input) {\n return input instanceof Point || Array.isArray(input);\n }\n }\n\n _makeQueryGeometry(pointOrBox?: PointLike | [PointLike, PointLike]) {\n if (pointOrBox === undefined) {\n // bounds was omitted: use full viewport\n pointOrBox = [\n Point.convert([0, 0]),\n Point.convert([this.transform.width, this.transform.height])\n ];\n }\n\n let queryGeometry;\n\n if (pointOrBox instanceof Point || typeof pointOrBox[0] === 'number') {\n const point = Point.convert(pointOrBox);\n queryGeometry = [point];\n } else {\n const box = [Point.convert(pointOrBox[0]), Point.convert(pointOrBox[1])];\n queryGeometry = [\n box[0],\n new Point(box[1].x, box[0].y),\n box[1],\n new Point(box[0].x, box[1].y),\n box[0]\n ];\n }\n\n return {\n viewport: queryGeometry,\n worldCoordinate: queryGeometry.map((p) => {\n return this.transform.pointCoordinate(p);\n })\n };\n }\n\n /**\n * Returns an array of [GeoJSON](http://geojson.org/)\n * [Feature objects](https://tools.ietf.org/html/rfc7946#section-3.2)\n * representing features within the specified vector tile or GeoJSON source that satisfy the query parameters.\n *\n * @param {string} sourceID The ID of the vector tile or GeoJSON source to query.\n * @param {Object} [parameters]\n * @param {string} [parameters.sourceLayer] The name of the vector tile layer to query. *For vector tile\n * sources, this parameter is required.* For GeoJSON sources, it is ignored.\n * @param {Array} [parameters.filter] A [filter](https://www.mapbox.com/mapbox-gl-js/style-spec/#other-filter)\n * to limit query results.\n *\n * @returns {Array} An array of [GeoJSON](http://geojson.org/)\n * [Feature objects](https://tools.ietf.org/html/rfc7946#section-3.2).\n *\n * In contrast to {@link Map#queryRenderedFeatures}, this function\n * returns all features matching the query parameters,\n * whether or not they are rendered by the current style (i.e. visible). The domain of the query includes all currently-loaded\n * vector tiles and GeoJSON source tiles: this function does not check tiles outside the currently\n * visible viewport.\n *\n * Because features come from tiled vector data or GeoJSON data that is converted to tiles internally, feature\n * geometries may be split or duplicated across tile boundaries and, as a result, features may appear multiple\n * times in query results. For example, suppose there is a highway running through the bounding rectangle of a query.\n * The results of the query will be those parts of the highway that lie within the map tiles covering the bounding\n * rectangle, even if the highway extends into other tiles, and the portion of the highway within each map tile\n * will be returned as a separate feature. Similarly, a point feature near a tile boundary may appear in multiple\n * tiles due to tile buffering.\n * @see [Filter features within map view](https://www.mapbox.com/mapbox-gl-js/example/filter-features-within-map-view/)\n * @see [Highlight features containing similar data](https://www.mapbox.com/mapbox-gl-js/example/query-similar-features/)\n */\n querySourceFeatures(sourceID: string, parameters: ?{sourceLayer: ?string, filter: ?Array}) {\n return this.style.querySourceFeatures(sourceID, parameters);\n }\n\n /**\n * Updates the map's Mapbox style object with a new value. If the given\n * value is style JSON object, compares it against the the map's current\n * state and perform only the changes necessary to make the map style match\n * the desired state.\n *\n * @param style A JSON object conforming to the schema described in the\n * [Mapbox Style Specification](https://mapbox.com/mapbox-gl-style-spec/), or a URL to such JSON.\n * @param {Object} [options]\n * @param {boolean} [options.diff=true] If false, force a 'full' update, removing the current style\n * and adding building the given one instead of attempting a diff-based update.\n * @param {string} [options.localIdeographFontFamily=null] If non-null, defines a css font-family\n * for locally overriding generation of glyphs in the 'CJK Unified Ideographs' and 'Hangul Syllables'\n * ranges. Forces a full update.\n * @returns {Map} `this`\n * @see [Change a map's style](https://www.mapbox.com/mapbox-gl-js/example/setstyle/)\n */\n setStyle(style: StyleSpecification | string | null, options?: {diff?: boolean} & StyleOptions) {\n const shouldTryDiff = (!options || (options.diff !== false && !options.localIdeographFontFamily)) && this.style;\n if (shouldTryDiff && style && typeof style === 'object') {\n try {\n if (this.style.setState(style)) {\n this._update(true);\n }\n return this;\n } catch (e) {\n warnOnce(\n `Unable to perform style diff: ${e.message || e.error || e}. Rebuilding the style from scratch.`\n );\n }\n }\n\n if (this.style) {\n this.style.setEventedParent(null);\n this.style._remove();\n }\n\n if (!style) {\n delete this.style;\n return this;\n } else {\n this.style = new Style(this, options || {});\n }\n\n this.style.setEventedParent(this, {style: this.style});\n\n if (typeof style === 'string') {\n this.style.loadURL(style);\n } else {\n this.style.loadJSON(style);\n }\n\n return this;\n }\n\n /**\n * Returns the map's Mapbox style object, which can be used to recreate the map's style.\n *\n * @returns {Object} The map's style object.\n */\n getStyle() {\n if (this.style) {\n return this.style.serialize();\n }\n }\n\n /**\n * Returns a Boolean indicating whether the map's style is fully loaded.\n *\n * @returns {boolean} A Boolean indicating whether the style is fully loaded.\n */\n isStyleLoaded() {\n if (!this.style) return warnOnce('There is no style added to the map.');\n return this.style.loaded();\n }\n\n /**\n * Adds a source to the map's style.\n *\n * @param {string} id The ID of the source to add. Must not conflict with existing sources.\n * @param {Object} source The source object, conforming to the\n * Mapbox Style Specification's [source definition](https://www.mapbox.com/mapbox-gl-style-spec/#sources) or\n * {@link CanvasSourceOptions}.\n * @fires source.add\n * @returns {Map} `this`\n * @see [Draw GeoJSON points](https://www.mapbox.com/mapbox-gl-js/example/geojson-markers/)\n * @see [Style circles using data-driven styling](https://www.mapbox.com/mapbox-gl-js/example/data-driven-circle-colors/)\n * @see [Set a point after Geocoder result](https://www.mapbox.com/mapbox-gl-js/example/point-from-geocoder-result/)\n */\n addSource(id: string, source: SourceSpecification) {\n this.style.addSource(id, source);\n this._update(true);\n return this;\n }\n\n /**\n * Returns a Boolean indicating whether the source is loaded.\n *\n * @param {string} id The ID of the source to be checked.\n * @returns {boolean} A Boolean indicating whether the source is loaded.\n */\n isSourceLoaded(id: string) {\n const source = this.style && this.style.sourceCaches[id];\n if (source === undefined) {\n this.fire(new ErrorEvent(new Error(`There is no source with ID '${id}'`)));\n return;\n }\n return source.loaded();\n }\n\n /**\n * Returns a Boolean indicating whether all tiles in the viewport from all sources on\n * the style are loaded.\n *\n * @returns {boolean} A Boolean indicating whether all tiles are loaded.\n */\n\n areTilesLoaded() {\n const sources = this.style && this.style.sourceCaches;\n for (const id in sources) {\n const source = sources[id];\n const tiles = source._tiles;\n for (const t in tiles) {\n const tile = tiles[t];\n if (!(tile.state === 'loaded' || tile.state === 'errored')) return false;\n }\n }\n return true;\n }\n\n /**\n * Adds a [custom source type](#Custom Sources), making it available for use with\n * {@link Map#addSource}.\n * @private\n * @param {string} name The name of the source type; source definition objects use this name in the `{type: ...}` field.\n * @param {Function} SourceType A {@link Source} constructor.\n * @param {Function} callback Called when the source type is ready or with an error argument if there is an error.\n */\n addSourceType(name: string, SourceType: any, callback: Function) {\n return this.style.addSourceType(name, SourceType, callback);\n }\n\n /**\n * Removes a source from the map's style.\n *\n * @param {string} id The ID of the source to remove.\n * @returns {Map} `this`\n */\n removeSource(id: string) {\n this.style.removeSource(id);\n this._update(true);\n return this;\n }\n\n /**\n * Returns the source with the specified ID in the map's style.\n *\n * @param {string} id The ID of the source to get.\n * @returns {?Object} The style source with the specified ID, or `undefined`\n * if the ID corresponds to no existing sources.\n * @see [Create a draggable point](https://www.mapbox.com/mapbox-gl-js/example/drag-a-point/)\n * @see [Animate a point](https://www.mapbox.com/mapbox-gl-js/example/animate-point-along-line/)\n * @see [Add live realtime data](https://www.mapbox.com/mapbox-gl-js/example/live-geojson/)\n */\n getSource(id: string) {\n return this.style.getSource(id);\n }\n\n /**\n * Add an image to the style. This image can be used in `icon-image`,\n * `background-pattern`, `fill-pattern`, and `line-pattern`. An\n * {@link Map#error} event will be fired if there is not enough space in the\n * sprite to add this image.\n *\n * @see [Add an icon to the map](https://www.mapbox.com/mapbox-gl-js/example/add-image/)\n * @see [Add a generated icon to the map](https://www.mapbox.com/mapbox-gl-js/example/add-image-generated/)\n * @param id The ID of the image.\n * @param image The image as an `HTMLImageElement`, `ImageData`, or object with `width`, `height`, and `data`\n * properties with the same format as `ImageData`.\n * @param options\n * @param options.pixelRatio The ratio of pixels in the image to physical pixels on the screen\n * @param options.sdf Whether the image should be interpreted as an SDF image\n */\n addImage(id: string,\n image: HTMLImageElement | ImageData | {width: number, height: number, data: Uint8Array | Uint8ClampedArray},\n {pixelRatio = 1, sdf = false}: {pixelRatio?: number, sdf?: boolean} = {}) {\n if (image instanceof HTMLImageElement) {\n const {width, height, data} = browser.getImageData(image);\n this.style.addImage(id, { data: new RGBAImage({width, height}, data), pixelRatio, sdf });\n } else if (image.width === undefined || image.height === undefined) {\n return this.fire(new ErrorEvent(new Error(\n 'Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, ' +\n 'or object with `width`, `height`, and `data` properties with the same format as `ImageData`')));\n } else {\n const {width, height, data} = image;\n this.style.addImage(id, { data: new RGBAImage({width, height}, data.slice(0)), pixelRatio, sdf });\n }\n }\n\n /**\n * Define wether the image has been added or not\n *\n * @param id The ID of the image.\n */\n hasImage(id: string): boolean {\n if (!id) {\n this.fire(new ErrorEvent(new Error('Missing required image id')));\n return false;\n }\n\n return !!this.style.getImage(id);\n }\n\n /**\n * Remove an image from the style (such as one used by `icon-image` or `background-pattern`).\n *\n * @param id The ID of the image.\n */\n removeImage(id: string) {\n this.style.removeImage(id);\n }\n\n /**\n * Load an image from an external URL for use with `Map#addImage`. External\n * domains must support [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS).\n *\n * @param {string} url The URL of the image file. Image file must be in png, webp, or jpg format.\n * @param {Function} callback Expecting `callback(error, data)`. Called when the image has loaded or with an error argument if there is an error.\n * @see [Add an icon to the map](https://www.mapbox.com/mapbox-gl-js/example/add-image/)\n */\n loadImage(url: string, callback: Function) {\n getImage(this._transformRequest(url, ResourceType.Image), callback);\n }\n\n /**\n * Adds a [Mapbox style layer](https://www.mapbox.com/mapbox-gl-style-spec/#layers)\n * to the map's style.\n *\n * A layer defines styling for data from a specified source.\n *\n * @param {Object} layer The style layer to add, conforming to the Mapbox Style Specification's\n * [layer definition](https://www.mapbox.com/mapbox-gl-style-spec/#layers).\n * @param {string} [before] The ID of an existing layer to insert the new layer before.\n * If this argument is omitted, the layer will be appended to the end of the layers array.\n * @returns {Map} `this`\n * @see [Create and style clusters](https://www.mapbox.com/mapbox-gl-js/example/cluster/)\n * @see [Add a vector tile source](https://www.mapbox.com/mapbox-gl-js/example/vector-source/)\n * @see [Add a WMS source](https://www.mapbox.com/mapbox-gl-js/example/wms/)\n */\n addLayer(layer: LayerSpecification, before?: string) {\n this.style.addLayer(layer, before);\n this._update(true);\n return this;\n }\n\n /**\n * Moves a layer to a different z-position.\n *\n * @param {string} id The ID of the layer to move.\n * @param {string} [beforeId] The ID of an existing layer to insert the new layer before.\n * If this argument is omitted, the layer will be appended to the end of the layers array.\n * @returns {Map} `this`\n */\n moveLayer(id: string, beforeId?: string) {\n this.style.moveLayer(id, beforeId);\n this._update(true);\n return this;\n }\n\n /**\n * Removes the layer with the given id from the map's style.\n *\n * If no such layer exists, an `error` event is fired.\n *\n * @param {string} id id of the layer to remove\n * @fires error\n */\n removeLayer(id: string) {\n this.style.removeLayer(id);\n this._update(true);\n return this;\n }\n\n /**\n * Returns the layer with the specified ID in the map's style.\n *\n * @param {string} id The ID of the layer to get.\n * @returns {?Object} The layer with the specified ID, or `undefined`\n * if the ID corresponds to no existing layers.\n * @see [Filter symbols by toggling a list](https://www.mapbox.com/mapbox-gl-js/example/filter-markers/)\n * @see [Filter symbols by text input](https://www.mapbox.com/mapbox-gl-js/example/filter-markers-by-input/)\n */\n getLayer(id: string) {\n return this.style.getLayer(id);\n }\n\n /**\n * Sets the filter for the specified style layer.\n *\n * @param {string} layer The ID of the layer to which the filter will be applied.\n * @param {Array | null | undefined} filter The filter, conforming to the Mapbox Style Specification's\n * [filter definition](https://www.mapbox.com/mapbox-gl-js/style-spec/#other-filter). If `null` or `undefined` is provided, the function removes any existing filter from the layer.\n * @returns {Map} `this`\n * @example\n * map.setFilter('my-layer', ['==', 'name', 'USA']);\n * @see [Filter features within map view](https://www.mapbox.com/mapbox-gl-js/example/filter-features-within-map-view/)\n * @see [Highlight features containing similar data](https://www.mapbox.com/mapbox-gl-js/example/query-similar-features/)\n * @see [Create a timeline animation](https://www.mapbox.com/mapbox-gl-js/example/timeline-animation/)\n */\n setFilter(layer: string, filter: ?FilterSpecification) {\n this.style.setFilter(layer, filter);\n this._update(true);\n return this;\n }\n\n /**\n * Sets the zoom extent for the specified style layer.\n *\n * @param {string} layerId The ID of the layer to which the zoom extent will be applied.\n * @param {number} minzoom The minimum zoom to set (0-24).\n * @param {number} maxzoom The maximum zoom to set (0-24).\n * @returns {Map} `this`\n * @example\n * map.setLayerZoomRange('my-layer', 2, 5);\n */\n setLayerZoomRange(layerId: string, minzoom: number, maxzoom: number) {\n this.style.setLayerZoomRange(layerId, minzoom, maxzoom);\n this._update(true);\n return this;\n }\n\n /**\n * Returns the filter applied to the specified style layer.\n *\n * @param {string} layer The ID of the style layer whose filter to get.\n * @returns {Array} The layer's filter.\n */\n getFilter(layer: string) {\n return this.style.getFilter(layer);\n }\n\n /**\n * Sets the value of a paint property in the specified style layer.\n *\n * @param {string} layer The ID of the layer to set the paint property in.\n * @param {string} name The name of the paint property to set.\n * @param {*} value The value of the paint propery to set.\n * Must be of a type appropriate for the property, as defined in the [Mapbox Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/).\n * @returns {Map} `this`\n * @example\n * map.setPaintProperty('my-layer', 'fill-color', '#faafee');\n * @see [Change a layer's color with buttons](https://www.mapbox.com/mapbox-gl-js/example/color-switcher/)\n * @see [Adjust a layer's opacity](https://www.mapbox.com/mapbox-gl-js/example/adjust-layer-opacity/)\n * @see [Create a draggable point](https://www.mapbox.com/mapbox-gl-js/example/drag-a-point/)\n */\n setPaintProperty(layer: string, name: string, value: any) {\n this.style.setPaintProperty(layer, name, value);\n this._update(true);\n return this;\n }\n\n /**\n * Returns the value of a paint property in the specified style layer.\n *\n * @param {string} layer The ID of the layer to get the paint property from.\n * @param {string} name The name of a paint property to get.\n * @returns {*} The value of the specified paint property.\n */\n getPaintProperty(layer: string, name: string) {\n return this.style.getPaintProperty(layer, name);\n }\n\n /**\n * Sets the value of a layout property in the specified style layer.\n *\n * @param {string} layer The ID of the layer to set the layout property in.\n * @param {string} name The name of the layout property to set.\n * @param {*} value The value of the layout propery. Must be of a type appropriate for the property, as defined in the [Mapbox Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/).\n * @returns {Map} `this`\n * @example\n * map.setLayoutProperty('my-layer', 'visibility', 'none');\n */\n setLayoutProperty(layer: string, name: string, value: any) {\n this.style.setLayoutProperty(layer, name, value);\n this._update(true);\n return this;\n }\n\n /**\n * Returns the value of a layout property in the specified style layer.\n *\n * @param {string} layer The ID of the layer to get the layout property from.\n * @param {string} name The name of the layout property to get.\n * @returns {*} The value of the specified layout property.\n */\n getLayoutProperty(layer: string, name: string) {\n return this.style.getLayoutProperty(layer, name);\n }\n\n /**\n * Sets the any combination of light values.\n *\n * @param light Light properties to set. Must conform to the [Mapbox Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/#light).\n * @returns {Map} `this`\n */\n setLight(light: LightSpecification) {\n this.style.setLight(light);\n this._update(true);\n return this;\n }\n\n /**\n * Returns the value of the light object.\n *\n * @returns {Object} light Light properties of the style.\n */\n getLight() {\n return this.style.getLight();\n }\n\n /**\n * Returns the map's containing HTML element.\n *\n * @returns {HTMLElement} The map's container.\n */\n getContainer() {\n return this._container;\n }\n\n /**\n * Returns the HTML element containing the map's `` element.\n *\n * If you want to add non-GL overlays to the map, you should append them to this element.\n *\n * This is the element to which event bindings for map interactivity (such as panning and zooming) are\n * attached. It will receive bubbled events from child elements such as the ``, but not from\n * map controls.\n *\n * @returns {HTMLElement} The container of the map's ``.\n * @see [Create a draggable point](https://www.mapbox.com/mapbox-gl-js/example/drag-a-point/)\n * @see [Highlight features within a bounding box](https://www.mapbox.com/mapbox-gl-js/example/using-box-queryrenderedfeatures/)\n */\n getCanvasContainer() {\n return this._canvasContainer;\n }\n\n /**\n * Returns the map's `` element.\n *\n * @returns {HTMLCanvasElement} The map's `` element.\n * @see [Measure distances](https://www.mapbox.com/mapbox-gl-js/example/measure/)\n * @see [Display a popup on hover](https://www.mapbox.com/mapbox-gl-js/example/popup-on-hover/)\n * @see [Center the map on a clicked symbol](https://www.mapbox.com/mapbox-gl-js/example/center-on-symbol/)\n */\n getCanvas() {\n return this._canvas;\n }\n\n _containerDimensions() {\n let width = 0;\n let height = 0;\n\n if (this._container) {\n width = this._container.offsetWidth || 400;\n height = this._container.offsetHeight || 300;\n }\n\n return [width, height];\n }\n\n _setupContainer() {\n const container = this._container;\n container.classList.add('mapboxgl-map');\n\n const missingCSSContainer = this._missingCSSContainer = DOM.create('div', 'mapboxgl-missing-css', container);\n missingCSSContainer.innerHTML = 'Missing Mapbox GL JS CSS';\n\n const canvasContainer = this._canvasContainer = DOM.create('div', 'mapboxgl-canvas-container', container);\n if (this._interactive) {\n canvasContainer.classList.add('mapboxgl-interactive');\n }\n\n this._canvas = DOM.create('canvas', 'mapboxgl-canvas', canvasContainer);\n this._canvas.style.position = 'absolute';\n this._canvas.addEventListener('webglcontextlost', this._contextLost, false);\n this._canvas.addEventListener('webglcontextrestored', this._contextRestored, false);\n this._canvas.setAttribute('tabindex', '0');\n this._canvas.setAttribute('aria-label', 'Map');\n\n const dimensions = this._containerDimensions();\n this._resizeCanvas(dimensions[0], dimensions[1]);\n\n const controlContainer = this._controlContainer = DOM.create('div', 'mapboxgl-control-container', container);\n const positions = this._controlPositions = {};\n ['top-left', 'top-right', 'bottom-left', 'bottom-right'].forEach((positionName) => {\n positions[positionName] = DOM.create('div', `mapboxgl-ctrl-${positionName}`, controlContainer);\n });\n }\n\n _resizeCanvas(width: number, height: number) {\n const pixelRatio = window.devicePixelRatio || 1;\n\n // Request the required canvas size taking the pixelratio into account.\n this._canvas.width = pixelRatio * width;\n this._canvas.height = pixelRatio * height;\n\n // Maintain the same canvas size, potentially downscaling it for HiDPI displays\n this._canvas.style.width = `${width}px`;\n this._canvas.style.height = `${height}px`;\n }\n\n _setupPainter() {\n const attributes = extend({\n failIfMajorPerformanceCaveat: this._failIfMajorPerformanceCaveat,\n preserveDrawingBuffer: this._preserveDrawingBuffer\n }, isSupported.webGLContextAttributes);\n\n const gl = this._canvas.getContext('webgl', attributes) ||\n this._canvas.getContext('experimental-webgl', attributes);\n\n if (!gl) {\n this.fire(new ErrorEvent(new Error('Failed to initialize WebGL')));\n return;\n }\n\n this.painter = new Painter(gl, this.transform);\n }\n\n _contextLost(event: *) {\n event.preventDefault();\n if (this._frameId) {\n browser.cancelFrame(this._frameId);\n this._frameId = null;\n }\n this.fire(new Event('webglcontextlost', {originalEvent: event}));\n }\n\n _contextRestored(event: *) {\n this._setupPainter();\n this.resize();\n this._update();\n this.fire(new Event('webglcontextrestored', {originalEvent: event}));\n }\n\n /**\n * Returns a Boolean indicating whether the map is fully loaded.\n *\n * Returns `false` if the style is not yet fully loaded,\n * or if there has been a change to the sources or style that\n * has not yet fully loaded.\n *\n * @returns {boolean} A Boolean indicating whether the map is fully loaded.\n */\n loaded() {\n if (this._styleDirty || this._sourcesDirty)\n return false;\n if (!this.style || !this.style.loaded())\n return false;\n return true;\n }\n\n /**\n * Update this map's style and sources, and re-render the map.\n *\n * @param {boolean} updateStyle mark the map's style for reprocessing as\n * well as its sources\n * @returns {Map} this\n * @private\n */\n _update(updateStyle?: boolean) {\n if (!this.style) return;\n\n this._styleDirty = this._styleDirty || updateStyle;\n this._sourcesDirty = true;\n\n this._rerender();\n }\n\n /**\n * Request that the given callback be executed during the next render\n * frame. Schedule a render frame if one is not already scheduled.\n * @returns An id that can be used to cancel the callback\n * @private\n */\n _requestRenderFrame(callback: () => void): TaskID {\n this._update();\n return this._renderTaskQueue.add(callback);\n }\n\n _cancelRenderFrame(id: TaskID) {\n this._renderTaskQueue.remove(id);\n }\n\n /**\n * Call when a (re-)render of the map is required:\n * - The style has changed (`setPaintProperty()`, etc.)\n * - Source data has changed (e.g. tiles have finished loading)\n * - The map has is moving (or just finished moving)\n * - A transition is in progress\n *\n * @returns {Map} this\n * @private\n */\n _render() {\n this._renderTaskQueue.run();\n\n let crossFading = false;\n\n // If the style has changed, the map is being zoomed, or a transition or fade is in progress:\n // - Apply style changes (in a batch)\n // - Recalculate paint properties.\n if (this.style && this._styleDirty) {\n this._styleDirty = false;\n\n const zoom = this.transform.zoom;\n const now = browser.now();\n this.style.zoomHistory.update(zoom, now);\n\n const parameters = new EvaluationParameters(zoom, {\n now,\n fadeDuration: this._fadeDuration,\n zoomHistory: this.style.zoomHistory,\n transition: this.style.getTransition()\n });\n\n const factor = parameters.crossFadingFactor();\n if (factor !== 1 || factor !== this._crossFadingFactor) {\n crossFading = true;\n this._crossFadingFactor = factor;\n }\n\n this.style.update(parameters);\n }\n\n // If we are in _render for any reason other than an in-progress paint\n // transition, update source caches to check for and load any tiles we\n // need for the current transform\n if (this.style && this._sourcesDirty) {\n this._sourcesDirty = false;\n this.style._updateSources(this.transform);\n }\n\n this._placementDirty = this.style && this.style._updatePlacement(this.painter.transform, this.showCollisionBoxes, this._fadeDuration);\n\n // Actually draw\n this.painter.render(this.style, {\n showTileBoundaries: this.showTileBoundaries,\n showOverdrawInspector: this._showOverdrawInspector,\n rotating: this.isRotating(),\n zooming: this.isZooming(),\n fadeDuration: this._fadeDuration\n });\n\n this.fire(new Event('render'));\n\n if (this.loaded() && !this._loaded) {\n this._loaded = true;\n this.fire(new Event('load'));\n }\n\n if (this.style && (this.style.hasTransitions() || crossFading)) {\n this._styleDirty = true;\n }\n\n // Schedule another render frame if it's needed.\n //\n // Even though `_styleDirty` and `_sourcesDirty` are reset in this\n // method, synchronous events fired during Style#update or\n // Style#_updateSources could have caused them to be set again.\n if (this._sourcesDirty || this._repaint || this._styleDirty || this._placementDirty) {\n this._rerender();\n }\n\n return this;\n }\n\n /**\n * Clean up and release all internal resources associated with this map.\n *\n * This includes DOM elements, event bindings, web workers, and WebGL resources.\n *\n * Use this method when you are done using the map and wish to ensure that it no\n * longer consumes browser resources. Afterwards, you must not call any other\n * methods on the map.\n */\n remove() {\n if (this._hash) this._hash.remove();\n browser.cancelFrame(this._frameId);\n this._renderTaskQueue.clear();\n this._frameId = null;\n this.setStyle(null);\n if (typeof window !== 'undefined') {\n window.removeEventListener('resize', this._onWindowResize, false);\n window.removeEventListener('online', this._onWindowOnline, false);\n }\n const extension = this.painter.context.gl.getExtension('WEBGL_lose_context');\n if (extension) extension.loseContext();\n removeNode(this._canvasContainer);\n removeNode(this._controlContainer);\n removeNode(this._missingCSSContainer);\n this._container.classList.remove('mapboxgl-map');\n this.fire(new Event('remove'));\n }\n\n _rerender() {\n if (this.style && !this._frameId) {\n this._frameId = browser.frame(() => {\n this._frameId = null;\n this._render();\n });\n }\n }\n\n _onWindowOnline() {\n this._update();\n }\n\n _onWindowResize() {\n if (this._trackResize) {\n this.stop().resize()._update();\n }\n }\n\n /**\n * Gets and sets a Boolean indicating whether the map will render an outline\n * around each tile. These tile boundaries are useful for debugging.\n *\n * @name showTileBoundaries\n * @type {boolean}\n * @instance\n * @memberof Map\n */\n get showTileBoundaries(): boolean { return !!this._showTileBoundaries; }\n set showTileBoundaries(value: boolean) {\n if (this._showTileBoundaries === value) return;\n this._showTileBoundaries = value;\n this._update();\n }\n\n /**\n * Gets and sets a Boolean indicating whether the map will render boxes\n * around all symbols in the data source, revealing which symbols\n * were rendered or which were hidden due to collisions.\n * This information is useful for debugging.\n *\n * @name showCollisionBoxes\n * @type {boolean}\n * @instance\n * @memberof Map\n */\n get showCollisionBoxes(): boolean { return !!this._showCollisionBoxes; }\n set showCollisionBoxes(value: boolean) {\n if (this._showCollisionBoxes === value) return;\n this._showCollisionBoxes = value;\n if (value) {\n // When we turn collision boxes on we have to generate them for existing tiles\n // When we turn them off, there's no cost to leaving existing boxes in place\n this.style._generateCollisionBoxes();\n } else {\n // Otherwise, call an update to remove collision boxes\n this._update();\n }\n }\n\n /*\n * Gets and sets a Boolean indicating whether the map should color-code\n * each fragment to show how many times it has been shaded.\n * White fragments have been shaded 8 or more times.\n * Black fragments have been shaded 0 times.\n * This information is useful for debugging.\n *\n * @name showOverdraw\n * @type {boolean}\n * @instance\n * @memberof Map\n */\n get showOverdrawInspector(): boolean { return !!this._showOverdrawInspector; }\n set showOverdrawInspector(value: boolean) {\n if (this._showOverdrawInspector === value) return;\n this._showOverdrawInspector = value;\n this._update();\n }\n\n /**\n * Gets and sets a Boolean indicating whether the map will\n * continuously repaint. This information is useful for analyzing performance.\n *\n * @name repaint\n * @type {boolean}\n * @instance\n * @memberof Map\n */\n get repaint(): boolean { return !!this._repaint; }\n set repaint(value: boolean) { this._repaint = value; this._update(); }\n\n // show vertices\n get vertices(): boolean { return !!this._vertices; }\n set vertices(value: boolean) { this._vertices = value; this._update(); }\n\n _onData(event: MapDataEvent) {\n this._update(event.dataType === 'style');\n this.fire(new Event(`${event.dataType}data`, event));\n }\n\n _onDataLoading(event: MapDataEvent) {\n this.fire(new Event(`${event.dataType}dataloading`, event));\n }\n}\n\nexport default Map;\n\nfunction removeNode(node) {\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n}\n\n/**\n * Interface for interactive controls added to the map. This is an\n * specification for implementers to model: it is not\n * an exported method or class.\n *\n * Controls must implement `onAdd` and `onRemove`, and must own an\n * element, which is often a `div` element. To use Mapbox GL JS's\n * default control styling, add the `mapboxgl-ctrl` class to your control's\n * node.\n *\n * @interface IControl\n * @example\n * // Control implemented as ES6 class\n * class HelloWorldControl {\n * onAdd(map) {\n * this._map = map;\n * this._container = document.createElement('div');\n * this._container.className = 'mapboxgl-ctrl';\n * this._container.textContent = 'Hello, world';\n * return this._container;\n * }\n *\n * onRemove() {\n * this._container.parentNode.removeChild(this._container);\n * this._map = undefined;\n * }\n * }\n *\n * // Control implemented as ES5 prototypical class\n * function HelloWorldControl() { }\n *\n * HelloWorldControl.prototype.onAdd = function(map) {\n * this._map = map;\n * this._container = document.createElement('div');\n * this._container.className = 'mapboxgl-ctrl';\n * this._container.textContent = 'Hello, world';\n * return this._container;\n * };\n *\n * HelloWorldControl.prototype.onRemove = function () {\n * this._container.parentNode.removeChild(this._container);\n * this._map = undefined;\n * };\n */\n\n/**\n * Register a control on the map and give it a chance to register event listeners\n * and resources. This method is called by {@link Map#addControl}\n * internally.\n *\n * @function\n * @memberof IControl\n * @instance\n * @name onAdd\n * @param {Map} map the Map this control will be added to\n * @returns {HTMLElement} The control's container element. This should\n * be created by the control and returned by onAdd without being attached\n * to the DOM: the map will insert the control's element into the DOM\n * as necessary.\n */\n\n/**\n * Unregister a control on the map and give it a chance to detach event listeners\n * and resources. This method is called by {@link Map#removeControl}\n * internally.\n *\n * @function\n * @memberof IControl\n * @instance\n * @name onRemove\n * @param {Map} map the Map this control will be removed from\n * @returns {undefined} there is no required return value for this method\n */\n\n/**\n * Optionally provide a default position for this control. If this method\n * is implemented and {@link Map#addControl} is called without the `position`\n * parameter, the value returned by getDefaultPosition will be used as the\n * control's position.\n *\n * @function\n * @memberof IControl\n * @instance\n * @name getDefaultPosition\n * @returns {string} a control position, one of the values valid in addControl.\n */\n\n/**\n * A [`Point` geometry](https://github.com/mapbox/point-geometry) object, which has\n * `x` and `y` properties representing screen coordinates in pixels.\n *\n * @typedef {Object} Point\n */\n\n/**\n * A {@link Point} or an array of two numbers representing `x` and `y` screen coordinates in pixels.\n *\n * @typedef {(Point | Array)} PointLike\n */\n","// @flow\n\nimport DOM from '../../util/dom';\nimport { extend, bindAll } from '../../util/util';\nimport DragRotateHandler from '../handler/drag_rotate';\n\nimport type Map from '../map';\n\ntype Options = {\n showCompass?: boolean,\n showZoom?: boolean\n};\n\nconst defaultOptions: Options = {\n showCompass: true,\n showZoom: true\n};\n\n/**\n * A `NavigationControl` control contains zoom buttons and a compass.\n *\n * @implements {IControl}\n * @param {Object} [options]\n * @param {Boolean} [options.showCompass=true] If `true` the compass button is included.\n * @param {Boolean} [options.showZoom=true] If `true` the zoom-in and zoom-out buttons are included.\n * @example\n * var nav = new mapboxgl.NavigationControl();\n * map.addControl(nav, 'top-left');\n * @see [Display map navigation controls](https://www.mapbox.com/mapbox-gl-js/example/navigation/)\n * @see [Add a third party vector tile source](https://www.mapbox.com/mapbox-gl-js/example/third-party/)\n */\nclass NavigationControl {\n _map: Map;\n options: Options;\n _container: HTMLElement;\n _zoomInButton: HTMLElement;\n _zoomOutButton: HTMLElement;\n _compass: HTMLElement;\n _compassArrow: HTMLElement;\n _handler: DragRotateHandler;\n\n constructor(options: Options) {\n this.options = extend({}, defaultOptions, options);\n\n this._container = DOM.create('div', 'mapboxgl-ctrl mapboxgl-ctrl-group');\n this._container.addEventListener('contextmenu', (e) => e.preventDefault());\n\n if (this.options.showZoom) {\n this._zoomInButton = this._createButton('mapboxgl-ctrl-icon mapboxgl-ctrl-zoom-in', 'Zoom In', () => this._map.zoomIn());\n this._zoomOutButton = this._createButton('mapboxgl-ctrl-icon mapboxgl-ctrl-zoom-out', 'Zoom Out', () => this._map.zoomOut());\n }\n if (this.options.showCompass) {\n bindAll([\n '_rotateCompassArrow'\n ], this);\n this._compass = this._createButton('mapboxgl-ctrl-icon mapboxgl-ctrl-compass', 'Reset North', () => this._map.resetNorth());\n this._compassArrow = DOM.create('span', 'mapboxgl-ctrl-compass-arrow', this._compass);\n }\n }\n\n _rotateCompassArrow() {\n const rotate = `rotate(${this._map.transform.angle * (180 / Math.PI)}deg)`;\n this._compassArrow.style.transform = rotate;\n }\n\n onAdd(map: Map) {\n this._map = map;\n if (this.options.showCompass) {\n this._map.on('rotate', this._rotateCompassArrow);\n this._rotateCompassArrow();\n this._handler = new DragRotateHandler(map, {button: 'left', element: this._compass});\n this._handler.enable();\n }\n return this._container;\n }\n\n onRemove() {\n DOM.remove(this._container);\n if (this.options.showCompass) {\n this._map.off('rotate', this._rotateCompassArrow);\n this._handler.disable();\n delete this._handler;\n }\n\n delete this._map;\n }\n\n _createButton(className: string, ariaLabel: string, fn: () => mixed) {\n const a = DOM.create('button', className, this._container);\n a.type = 'button';\n a.setAttribute('aria-label', ariaLabel);\n a.addEventListener('click', fn);\n return a;\n }\n}\n\nexport default NavigationControl;\n","// @flow\n\nexport type Anchor =\n | 'center'\n | 'top'\n | 'bottom'\n | 'left'\n | 'right'\n | 'top-left'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-right';\n\nexport const anchorTranslate: {[Anchor]: string} = {\n 'center': 'translate(-50%,-50%)',\n 'top': 'translate(-50%,0)',\n 'top-left': 'translate(0,0)',\n 'top-right': 'translate(-100%,0)',\n 'bottom': 'translate(-50%,-100%)',\n 'bottom-left': 'translate(0,-100%)',\n 'bottom-right': 'translate(-100%,-100%)',\n 'left': 'translate(0,-50%)',\n 'right': 'translate(-100%,-50%)'\n};\n\nexport function applyAnchorClass(element: HTMLElement, anchor: Anchor, prefix: string) {\n const classList = element.classList;\n for (const key in anchorTranslate) {\n classList.remove(`mapboxgl-${prefix}-anchor-${key}`);\n }\n classList.add(`mapboxgl-${prefix}-anchor-${anchor}`);\n}\n","// @flow\n\nimport DOM from '../util/dom';\nimport window from '../util/window';\nimport LngLat from '../geo/lng_lat';\nimport Point from '@mapbox/point-geometry';\nimport smartWrap from '../util/smart_wrap';\nimport { bindAll, extend } from '../util/util';\nimport { type Anchor, anchorTranslate, applyAnchorClass } from './anchor';\n\nimport type Map from './map';\nimport type Popup from './popup';\nimport type {LngLatLike} from \"../geo/lng_lat\";\nimport type {MapMouseEvent} from './events';\n\ntype Options = {\n element?: HTMLElement,\n offset?: PointLike,\n anchor?: Anchor,\n color?: string\n};\n\n/**\n * Creates a marker component\n * @param options\n * @param options.element DOM element to use as a marker. The default is a light blue, droplet-shaped SVG marker.\n * @param options.anchor A string indicating the part of the Marker that should be positioned closest to the coordinate set via {@link Marker#setLngLat}.\n * Options are `'center'`, `'top'`, `'bottom'`, `'left'`, `'right'`, `'top-left'`, `'top-right'`, `'bottom-left'`, and `'bottom-right'`.\n * The default is `'center'`.\n * @param options.offset The offset in pixels as a {@link PointLike} object to apply relative to the element's center. Negatives indicate left and up.\n * @param options.color The color to use for the default marker if options.element is not provided. The default is light blue.\n * @example\n * var marker = new mapboxgl.Marker()\n * .setLngLat([30.5, 50.5])\n * .addTo(map);\n * @see [Add custom icons with Markers](https://www.mapbox.com/mapbox-gl-js/example/custom-marker-icons/)\n */\nexport default class Marker {\n _map: Map;\n _anchor: Anchor;\n _offset: Point;\n _element: HTMLElement;\n _popup: ?Popup;\n _lngLat: LngLat;\n _pos: ?Point;\n _color: ?string;\n _defaultMarker: boolean;\n\n constructor(options?: Options) {\n // For backward compatibility -- the constructor used to accept the element as a\n // required first argument, before it was made optional.\n if (arguments[0] instanceof window.HTMLElement || arguments.length === 2) {\n options = extend({element: options}, arguments[1]);\n }\n\n bindAll(['_update', '_onMapClick'], this);\n\n this._anchor = options && options.anchor || 'center';\n this._color = options && options.color || '#3FB1CE';\n\n if (!options || !options.element) {\n this._defaultMarker = true;\n this._element = DOM.create('div');\n\n // create default map marker SVG\n const svg = DOM.createNS('http://www.w3.org/2000/svg', 'svg');\n svg.setAttributeNS(null, 'height', '41px');\n svg.setAttributeNS(null, 'width', '27px');\n svg.setAttributeNS(null, 'viewBox', '0 0 27 41');\n\n const markerLarge = DOM.createNS('http://www.w3.org/2000/svg', 'g');\n markerLarge.setAttributeNS(null, 'stroke', 'none');\n markerLarge.setAttributeNS(null, 'stroke-width', '1');\n markerLarge.setAttributeNS(null, 'fill', 'none');\n markerLarge.setAttributeNS(null, 'fill-rule', 'evenodd');\n\n const page1 = DOM.createNS('http://www.w3.org/2000/svg', 'g');\n page1.setAttributeNS(null, 'fill-rule', 'nonzero');\n\n const shadow = DOM.createNS('http://www.w3.org/2000/svg', 'g');\n shadow.setAttributeNS(null, 'transform', 'translate(3.0, 29.0)');\n shadow.setAttributeNS(null, 'fill', '#000000');\n\n const ellipses = [\n {'rx': '10.5', 'ry': '5.25002273'},\n {'rx': '10.5', 'ry': '5.25002273'},\n {'rx': '9.5', 'ry': '4.77275007'},\n {'rx': '8.5', 'ry': '4.29549936'},\n {'rx': '7.5', 'ry': '3.81822308'},\n {'rx': '6.5', 'ry': '3.34094679'},\n {'rx': '5.5', 'ry': '2.86367051'},\n {'rx': '4.5', 'ry': '2.38636864'}\n ];\n\n for (const data of ellipses) {\n const ellipse = DOM.createNS('http://www.w3.org/2000/svg', 'ellipse');\n ellipse.setAttributeNS(null, 'opacity', '0.04');\n ellipse.setAttributeNS(null, 'cx', '10.5');\n ellipse.setAttributeNS(null, 'cy', '5.80029008');\n ellipse.setAttributeNS(null, 'rx', data['rx']);\n ellipse.setAttributeNS(null, 'ry', data['ry']);\n shadow.appendChild(ellipse);\n }\n\n const background = DOM.createNS('http://www.w3.org/2000/svg', 'g');\n background.setAttributeNS(null, 'fill', this._color);\n\n const bgPath = DOM.createNS('http://www.w3.org/2000/svg', 'path');\n bgPath.setAttributeNS(null, 'd', 'M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z');\n\n background.appendChild(bgPath);\n\n const border = DOM.createNS('http://www.w3.org/2000/svg', 'g');\n border.setAttributeNS(null, 'opacity', '0.25');\n border.setAttributeNS(null, 'fill', '#000000');\n\n const borderPath = DOM.createNS('http://www.w3.org/2000/svg', 'path');\n borderPath.setAttributeNS(null, 'd', 'M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z');\n\n border.appendChild(borderPath);\n\n const maki = DOM.createNS('http://www.w3.org/2000/svg', 'g');\n maki.setAttributeNS(null, 'transform', 'translate(6.0, 7.0)');\n maki.setAttributeNS(null, 'fill', '#FFFFFF');\n\n const circleContainer = DOM.createNS('http://www.w3.org/2000/svg', 'g');\n circleContainer.setAttributeNS(null, 'transform', 'translate(8.0, 8.0)');\n\n const circle1 = DOM.createNS('http://www.w3.org/2000/svg', 'circle');\n circle1.setAttributeNS(null, 'fill', '#000000');\n circle1.setAttributeNS(null, 'opacity', '0.25');\n circle1.setAttributeNS(null, 'cx', '5.5');\n circle1.setAttributeNS(null, 'cy', '5.5');\n circle1.setAttributeNS(null, 'r', '5.4999962');\n\n const circle2 = DOM.createNS('http://www.w3.org/2000/svg', 'circle');\n circle2.setAttributeNS(null, 'fill', '#FFFFFF');\n circle2.setAttributeNS(null, 'cx', '5.5');\n circle2.setAttributeNS(null, 'cy', '5.5');\n circle2.setAttributeNS(null, 'r', '5.4999962');\n\n circleContainer.appendChild(circle1);\n circleContainer.appendChild(circle2);\n\n page1.appendChild(shadow);\n page1.appendChild(background);\n page1.appendChild(border);\n page1.appendChild(maki);\n page1.appendChild(circleContainer);\n\n svg.appendChild(page1);\n\n this._element.appendChild(svg);\n\n // if no element and no offset option given apply an offset for the default marker\n // the -14 as the y value of the default marker offset was determined as follows\n //\n // the marker tip is at the center of the shadow ellipse from the default svg\n // the y value of the center of the shadow ellipse relative to the svg top left is \"shadow transform translate-y (29.0) + ellipse cy (5.80029008)\"\n // offset to the svg center \"height (41 / 2)\" gives (29.0 + 5.80029008) - (41 / 2) and rounded for an integer pixel offset gives 14\n // negative is used to move the marker up from the center so the tip is at the Marker lngLat\n this._offset = Point.convert(options && options.offset || [0, -14]);\n } else {\n this._element = options.element;\n this._offset = Point.convert(options && options.offset || [0, 0]);\n }\n\n this._element.classList.add('mapboxgl-marker');\n\n this._popup = null;\n }\n\n /**\n * Attaches the marker to a map\n * @param {Map} map\n * @returns {Marker} `this`\n */\n addTo(map: Map) {\n this.remove();\n this._map = map;\n map.getCanvasContainer().appendChild(this._element);\n map.on('move', this._update);\n map.on('moveend', this._update);\n this._update();\n\n // If we attached the `click` listener to the marker element, the popup\n // would close once the event propogated to `map` due to the\n // `Popup#_onClickClose` listener.\n this._map.on('click', this._onMapClick);\n\n return this;\n }\n\n /**\n * Removes the marker from a map\n * @example\n * var marker = new mapboxgl.Marker().addTo(map);\n * marker.remove();\n * @returns {Marker} `this`\n */\n remove() {\n if (this._map) {\n this._map.off('click', this._onMapClick);\n this._map.off('move', this._update);\n this._map.off('moveend', this._update);\n delete this._map;\n }\n DOM.remove(this._element);\n if (this._popup) this._popup.remove();\n return this;\n }\n\n /**\n * Get the marker's geographical location.\n *\n * The longitude of the result may differ by a multiple of 360 degrees from the longitude previously\n * set by `setLngLat` because `Marker` wraps the anchor longitude across copies of the world to keep\n * the marker on screen.\n *\n * @returns {LngLat}\n */\n getLngLat() {\n return this._lngLat;\n }\n\n /**\n * Set the marker's geographical position and move it.\n * @returns {Marker} `this`\n */\n setLngLat(lnglat: LngLatLike) {\n this._lngLat = LngLat.convert(lnglat);\n this._pos = null;\n if (this._popup) this._popup.setLngLat(this._lngLat);\n this._update();\n return this;\n }\n\n /**\n * Returns the `Marker`'s HTML element.\n * @returns {HTMLElement} element\n */\n getElement() {\n return this._element;\n }\n\n /**\n * Binds a Popup to the Marker\n * @param popup an instance of the `Popup` class. If undefined or null, any popup\n * set on this `Marker` instance is unset\n * @returns {Marker} `this`\n */\n setPopup(popup: ?Popup) {\n if (this._popup) {\n this._popup.remove();\n this._popup = null;\n }\n\n if (popup) {\n if (!('offset' in popup.options)) {\n const markerHeight = 41 - (5.8 / 2);\n const markerRadius = 13.5;\n const linearOffset = Math.sqrt(Math.pow(markerRadius, 2) / 2);\n popup.options.offset = this._defaultMarker ? {\n 'top': [0, 0],\n 'top-left': [0, 0],\n 'top-right': [0, 0],\n 'bottom': [0, -markerHeight],\n 'bottom-left': [linearOffset, (markerHeight - markerRadius + linearOffset) * -1],\n 'bottom-right': [-linearOffset, (markerHeight - markerRadius + linearOffset) * -1],\n 'left': [markerRadius, (markerHeight - markerRadius) * -1],\n 'right': [-markerRadius, (markerHeight - markerRadius) * -1]\n } : this._offset;\n }\n this._popup = popup;\n if (this._lngLat) this._popup.setLngLat(this._lngLat);\n }\n\n return this;\n }\n\n _onMapClick(event: MapMouseEvent) {\n const targetElement = event.originalEvent.target;\n const element = this._element;\n\n if (this._popup && (targetElement === element || element.contains((targetElement: any)))) {\n this.togglePopup();\n }\n }\n\n /**\n * Returns the Popup instance that is bound to the Marker\n * @returns {Popup} popup\n */\n getPopup() {\n return this._popup;\n }\n\n /**\n * Opens or closes the bound popup, depending on the current state\n * @returns {Marker} `this`\n */\n togglePopup() {\n const popup = this._popup;\n\n if (!popup) return this;\n else if (popup.isOpen()) popup.remove();\n else popup.addTo(this._map);\n return this;\n }\n\n _update(e?: {type: 'move' | 'moveend'}) {\n if (!this._map) return;\n\n if (this._map.transform.renderWorldCopies) {\n this._lngLat = smartWrap(this._lngLat, this._pos, this._map.transform);\n }\n\n this._pos = this._map.project(this._lngLat)._add(this._offset);\n\n // because rounding the coordinates at every `move` event causes stuttered zooming\n // we only round them when _update is called with `moveend` or when its called with\n // no arguments (when the Marker is initialized or Marker#setLngLat is invoked).\n if (!e || e.type === \"moveend\") {\n this._pos = this._pos.round();\n }\n\n DOM.setTransform(this._element, `${anchorTranslate[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px)`);\n applyAnchorClass(this._element, this._anchor, 'marker');\n }\n\n /**\n * Get the marker's offset.\n * @returns {Point}\n */\n getOffset() {\n return this._offset;\n }\n\n /**\n * Sets the offset of the marker\n * @param {PointLike} offset The offset in pixels as a {@link PointLike} object to apply relative to the element's center. Negatives indicate left and up.\n * @returns {Marker} `this`\n */\n setOffset(offset: PointLike) {\n this._offset = Point.convert(offset);\n this._update();\n return this;\n }\n}\n","// @flow\n\nimport { Event, Evented } from '../../util/evented';\nimport DOM from '../../util/dom';\nimport window from '../../util/window';\nimport { extend, bindAll, warnOnce } from '../../util/util';\nimport assert from 'assert';\nimport LngLat from '../../geo/lng_lat';\nimport Marker from '../marker';\n\nimport type Map from '../map';\nimport type { AnimationOptions, CameraOptions } from '../camera';\n\ntype Options = {\n positionOptions?: PositionOptions,\n fitBoundsOptions?: AnimationOptions & CameraOptions,\n trackUserLocation?: boolean,\n showUserLocation?: boolean\n};\n\nconst defaultOptions: Options = {\n positionOptions: {\n enableHighAccuracy: false,\n maximumAge: 0,\n timeout: 6000 /* 6 sec */\n },\n fitBoundsOptions: {\n maxZoom: 15\n },\n trackUserLocation: false,\n showUserLocation: true\n};\nconst className = 'mapboxgl-ctrl';\n\nlet supportsGeolocation;\n\nfunction checkGeolocationSupport(callback) {\n if (supportsGeolocation !== undefined) {\n callback(supportsGeolocation);\n\n } else if (window.navigator.permissions !== undefined) {\n // navigator.permissions has incomplete browser support\n // http://caniuse.com/#feat=permissions-api\n // Test for the case where a browser disables Geolocation because of an\n // insecure origin\n window.navigator.permissions.query({ name: 'geolocation' }).then((p) => {\n supportsGeolocation = p.state !== 'denied';\n callback(supportsGeolocation);\n });\n\n } else {\n supportsGeolocation = !!window.navigator.geolocation;\n callback(supportsGeolocation);\n }\n}\n\n/**\n * A `GeolocateControl` control provides a button that uses the browser's geolocation\n * API to locate the user on the map.\n *\n * Not all browsers support geolocation,\n * and some users may disable the feature. Geolocation support for modern\n * browsers including Chrome requires sites to be served over HTTPS. If\n * geolocation support is not available, the GeolocateControl will not\n * be visible.\n *\n * The zoom level applied will depend on the accuracy of the geolocation provided by the device.\n *\n * The GeolocateControl has two modes. If `trackUserLocation` is `false` (default) the control acts as a button, which when pressed will set the map's camera to target the user location. If the user moves, the map won't update. This is most suited for the desktop. If `trackUserLocation` is `true` the control acts as a toggle button that when active the user's location is actively monitored for changes. In this mode the GeolocateControl has three states:\n * * active - the map's camera automatically updates as the user's location changes, keeping the location dot in the center.\n * * passive - the user's location dot automatically updates, but the map's camera does not.\n * * disabled\n *\n * @implements {IControl}\n * @param {Object} [options]\n * @param {Object} [options.positionOptions={enableHighAccuracy: false, timeout: 6000}] A Geolocation API [PositionOptions](https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions) object.\n * @param {Object} [options.fitBoundsOptions={maxZoom: 15}] A [`fitBounds`](#Map#fitBounds) options object to use when the map is panned and zoomed to the user's location. The default is to use a `maxZoom` of 15 to limit how far the map will zoom in for very accurate locations.\n * @param {Object} [options.trackUserLocation=false] If `true` the Geolocate Control becomes a toggle button and when active the map will receive updates to the user's location as it changes.\n * @param {Object} [options.showUserLocation=true] By default a dot will be shown on the map at the user's location. Set to `false` to disable.\n *\n * @example\n * map.addControl(new mapboxgl.GeolocateControl({\n * positionOptions: {\n * enableHighAccuracy: true\n * },\n * trackUserLocation: true\n * }));\n * @see [Locate the user](https://www.mapbox.com/mapbox-gl-js/example/locate-user/)\n */\nclass GeolocateControl extends Evented {\n _map: Map;\n options: Options;\n _container: HTMLElement;\n _dotElement: HTMLElement;\n _geolocateButton: HTMLElement;\n _geolocationWatchID: number;\n _timeoutId: ?TimeoutID;\n _watchState: string;\n _lastKnownPosition: any;\n _userLocationDotMarker: Marker;\n _setup: boolean; // set to true once the control has been setup\n\n constructor(options: Options) {\n super();\n this.options = extend({}, defaultOptions, options);\n\n bindAll([\n '_onSuccess',\n '_onError',\n '_finish',\n '_setupUI',\n '_updateCamera',\n '_updateMarker'\n ], this);\n }\n\n onAdd(map: Map) {\n this._map = map;\n this._container = DOM.create('div', `${className} ${className}-group`);\n checkGeolocationSupport(this._setupUI);\n return this._container;\n }\n\n onRemove() {\n // clear the geolocation watch if exists\n if (this._geolocationWatchID !== undefined) {\n window.navigator.geolocation.clearWatch(this._geolocationWatchID);\n this._geolocationWatchID = (undefined: any);\n }\n\n // clear the marker from the map\n if (this.options.showUserLocation) {\n this._userLocationDotMarker.remove();\n }\n\n DOM.remove(this._container);\n this._map = (undefined: any);\n }\n\n _onSuccess(position: Position) {\n if (this.options.trackUserLocation) {\n // keep a record of the position so that if the state is BACKGROUND and the user\n // clicks the button, we can move to ACTIVE_LOCK immediately without waiting for\n // watchPosition to trigger _onSuccess\n this._lastKnownPosition = position;\n\n switch (this._watchState) {\n case 'WAITING_ACTIVE':\n case 'ACTIVE_LOCK':\n case 'ACTIVE_ERROR':\n this._watchState = 'ACTIVE_LOCK';\n this._geolocateButton.classList.remove('mapboxgl-ctrl-geolocate-waiting');\n this._geolocateButton.classList.remove('mapboxgl-ctrl-geolocate-active-error');\n this._geolocateButton.classList.add('mapboxgl-ctrl-geolocate-active');\n break;\n case 'BACKGROUND':\n case 'BACKGROUND_ERROR':\n this._watchState = 'BACKGROUND';\n this._geolocateButton.classList.remove('mapboxgl-ctrl-geolocate-waiting');\n this._geolocateButton.classList.remove('mapboxgl-ctrl-geolocate-background-error');\n this._geolocateButton.classList.add('mapboxgl-ctrl-geolocate-background');\n break;\n default:\n assert(false, `Unexpected watchState ${this._watchState}`);\n }\n }\n\n // if showUserLocation and the watch state isn't off then update the marker location\n if (this.options.showUserLocation && this._watchState !== 'OFF') {\n this._updateMarker(position);\n }\n\n // if in normal mode (not watch mode), or if in watch mode and the state is active watch\n // then update the camera\n if (!this.options.trackUserLocation || this._watchState === 'ACTIVE_LOCK') {\n this._updateCamera(position);\n }\n\n if (this.options.showUserLocation) {\n this._dotElement.classList.remove('mapboxgl-user-location-dot-stale');\n }\n\n this.fire(new Event('geolocate', position));\n this._finish();\n }\n\n _updateCamera(position: Position) {\n const center = new LngLat(position.coords.longitude, position.coords.latitude);\n const radius = position.coords.accuracy;\n\n this._map.fitBounds(center.toBounds(radius), this.options.fitBoundsOptions, {\n geolocateSource: true // tag this camera change so it won't cause the control to change to background state\n });\n }\n\n _updateMarker(position: ?Position) {\n if (position) {\n this._userLocationDotMarker.setLngLat([position.coords.longitude, position.coords.latitude]).addTo(this._map);\n } else {\n this._userLocationDotMarker.remove();\n }\n }\n\n _onError(error: PositionError) {\n if (this.options.trackUserLocation) {\n if (error.code === 1) {\n // PERMISSION_DENIED\n this._watchState = 'OFF';\n this._geolocateButton.classList.remove('mapboxgl-ctrl-geolocate-waiting');\n this._geolocateButton.classList.remove('mapboxgl-ctrl-geolocate-active');\n this._geolocateButton.classList.remove('mapboxgl-ctrl-geolocate-active-error');\n this._geolocateButton.classList.remove('mapboxgl-ctrl-geolocate-background');\n this._geolocateButton.classList.remove('mapboxgl-ctrl-geolocate-background-error');\n\n if (this._geolocationWatchID !== undefined) {\n this._clearWatch();\n }\n } else {\n switch (this._watchState) {\n case 'WAITING_ACTIVE':\n this._watchState = 'ACTIVE_ERROR';\n this._geolocateButton.classList.remove('mapboxgl-ctrl-geolocate-active');\n this._geolocateButton.classList.add('mapboxgl-ctrl-geolocate-active-error');\n break;\n case 'ACTIVE_LOCK':\n this._watchState = 'ACTIVE_ERROR';\n this._geolocateButton.classList.remove('mapboxgl-ctrl-geolocate-active');\n this._geolocateButton.classList.add('mapboxgl-ctrl-geolocate-active-error');\n this._geolocateButton.classList.add('mapboxgl-ctrl-geolocate-waiting');\n // turn marker grey\n break;\n case 'BACKGROUND':\n this._watchState = 'BACKGROUND_ERROR';\n this._geolocateButton.classList.remove('mapboxgl-ctrl-geolocate-background');\n this._geolocateButton.classList.add('mapboxgl-ctrl-geolocate-background-error');\n this._geolocateButton.classList.add('mapboxgl-ctrl-geolocate-waiting');\n // turn marker grey\n break;\n case 'ACTIVE_ERROR':\n break;\n default:\n assert(false, `Unexpected watchState ${this._watchState}`);\n }\n }\n }\n\n if (this._watchState !== 'OFF' && this.options.showUserLocation) {\n this._dotElement.classList.add('mapboxgl-user-location-dot-stale');\n }\n\n this.fire(new Event('error', error));\n\n this._finish();\n }\n\n _finish() {\n if (this._timeoutId) { clearTimeout(this._timeoutId); }\n this._timeoutId = undefined;\n }\n\n _setupUI(supported: boolean) {\n if (supported === false) return;\n this._container.addEventListener('contextmenu', (e: MouseEvent) => e.preventDefault());\n this._geolocateButton = DOM.create('button',\n `${className}-icon ${className}-geolocate`,\n this._container);\n this._geolocateButton.type = 'button';\n this._geolocateButton.setAttribute('aria-label', 'Geolocate');\n\n if (this.options.trackUserLocation) {\n this._geolocateButton.setAttribute('aria-pressed', 'false');\n this._watchState = 'OFF';\n }\n\n // when showUserLocation is enabled, keep the Geolocate button disabled until the device location marker is setup on the map\n if (this.options.showUserLocation) {\n this._dotElement = DOM.create('div', 'mapboxgl-user-location-dot');\n\n this._userLocationDotMarker = new Marker(this._dotElement);\n\n if (this.options.trackUserLocation) this._watchState = 'OFF';\n }\n\n this._geolocateButton.addEventListener('click',\n this.trigger.bind(this));\n\n this._setup = true;\n\n // when the camera is changed (and it's not as a result of the Geolocation Control) change\n // the watch mode to background watch, so that the marker is updated but not the camera.\n if (this.options.trackUserLocation) {\n this._map.on('movestart', (event) => {\n if (!event.geolocateSource && this._watchState === 'ACTIVE_LOCK') {\n this._watchState = 'BACKGROUND';\n this._geolocateButton.classList.add('mapboxgl-ctrl-geolocate-background');\n this._geolocateButton.classList.remove('mapboxgl-ctrl-geolocate-active');\n\n this.fire(new Event('trackuserlocationend'));\n }\n });\n }\n }\n\n /**\n * Trigger a geolocation\n *\n * @returns {boolean} Returns `false` if called before control was added to a map, otherwise returns `true`.\n */\n trigger() {\n if (!this._setup) {\n warnOnce('Geolocate control triggered before added to a map');\n return false;\n }\n if (this.options.trackUserLocation) {\n // update watchState and do any outgoing state cleanup\n switch (this._watchState) {\n case 'OFF':\n // turn on the Geolocate Control\n this._watchState = 'WAITING_ACTIVE';\n\n this.fire(new Event('trackuserlocationstart'));\n break;\n case 'WAITING_ACTIVE':\n case 'ACTIVE_LOCK':\n case 'ACTIVE_ERROR':\n case 'BACKGROUND_ERROR':\n // turn off the Geolocate Control\n this._watchState = 'OFF';\n this._geolocateButton.classList.remove('mapboxgl-ctrl-geolocate-waiting');\n this._geolocateButton.classList.remove('mapboxgl-ctrl-geolocate-active');\n this._geolocateButton.classList.remove('mapboxgl-ctrl-geolocate-active-error');\n this._geolocateButton.classList.remove('mapboxgl-ctrl-geolocate-background');\n this._geolocateButton.classList.remove('mapboxgl-ctrl-geolocate-background-error');\n\n this.fire(new Event('trackuserlocationend'));\n break;\n case 'BACKGROUND':\n this._watchState = 'ACTIVE_LOCK';\n this._geolocateButton.classList.remove('mapboxgl-ctrl-geolocate-background');\n // set camera to last known location\n if (this._lastKnownPosition) this._updateCamera(this._lastKnownPosition);\n\n this.fire(new Event('trackuserlocationstart'));\n break;\n default:\n assert(false, `Unexpected watchState ${this._watchState}`);\n }\n\n // incoming state setup\n switch (this._watchState) {\n case 'WAITING_ACTIVE':\n this._geolocateButton.classList.add('mapboxgl-ctrl-geolocate-waiting');\n this._geolocateButton.classList.add('mapboxgl-ctrl-geolocate-active');\n break;\n case 'ACTIVE_LOCK':\n this._geolocateButton.classList.add('mapboxgl-ctrl-geolocate-active');\n break;\n case 'ACTIVE_ERROR':\n this._geolocateButton.classList.add('mapboxgl-ctrl-geolocate-waiting');\n this._geolocateButton.classList.add('mapboxgl-ctrl-geolocate-active-error');\n break;\n case 'BACKGROUND':\n this._geolocateButton.classList.add('mapboxgl-ctrl-geolocate-background');\n break;\n case 'BACKGROUND_ERROR':\n this._geolocateButton.classList.add('mapboxgl-ctrl-geolocate-waiting');\n this._geolocateButton.classList.add('mapboxgl-ctrl-geolocate-background-error');\n break;\n case 'OFF':\n break;\n default:\n assert(false, `Unexpected watchState ${this._watchState}`);\n }\n\n // manage geolocation.watchPosition / geolocation.clearWatch\n if (this._watchState === 'OFF' && this._geolocationWatchID !== undefined) {\n // clear watchPosition as we've changed to an OFF state\n this._clearWatch();\n } else if (this._geolocationWatchID === undefined) {\n // enable watchPosition since watchState is not OFF and there is no watchPosition already running\n\n this._geolocateButton.classList.add('mapboxgl-ctrl-geolocate-waiting');\n this._geolocateButton.setAttribute('aria-pressed', 'true');\n\n this._geolocationWatchID = window.navigator.geolocation.watchPosition(\n this._onSuccess, this._onError, this.options.positionOptions);\n }\n } else {\n window.navigator.geolocation.getCurrentPosition(\n this._onSuccess, this._onError, this.options.positionOptions);\n\n // This timeout ensures that we still call finish() even if\n // the user declines to share their location in Firefox\n this._timeoutId = setTimeout(this._finish, 10000 /* 10sec */);\n }\n\n return true;\n }\n\n _clearWatch() {\n window.navigator.geolocation.clearWatch(this._geolocationWatchID);\n\n this._geolocationWatchID = (undefined: any);\n this._geolocateButton.classList.remove('mapboxgl-ctrl-geolocate-waiting');\n this._geolocateButton.setAttribute('aria-pressed', 'false');\n\n if (this.options.showUserLocation) {\n this._updateMarker(null);\n }\n }\n}\n\nexport default GeolocateControl;\n\n/* Geolocate Control Watch States\n * This is the private state of the control.\n *\n * OFF\n * off/inactive\n * WAITING_ACTIVE\n * Geolocate Control was clicked but still waiting for Geolocation API response with user location\n * ACTIVE_LOCK\n * Showing the user location as a dot AND tracking the camera to be fixed to their location. If their location changes the map moves to follow.\n * ACTIVE_ERROR\n * There was en error from the Geolocation API while trying to show and track the user location.\n * BACKGROUND\n * Showing the user location as a dot but the camera doesn't follow their location as it changes.\n * BACKGROUND_ERROR\n * There was an error from the Geolocation API while trying to show (but not track) the user location.\n */\n\n\n/**\n * Fired on each Geolocation API position update which returned as success.\n *\n * @event geolocate\n * @memberof GeolocateControl\n * @instance\n * @property {Position} data The returned [Position](https://developer.mozilla.org/en-US/docs/Web/API/Position) object from the callback in [Geolocation.getCurrentPosition()](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/getCurrentPosition) or [Geolocation.watchPosition()](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/watchPosition).\n *\n */\n\n/**\n * Fired on each Geolocation API position update which returned as an error.\n *\n * @event error\n * @memberof GeolocateControl\n * @instance\n * @property {PositionError} data The returned [PositionError](https://developer.mozilla.org/en-US/docs/Web/API/PositionError) object from the callback in [Geolocation.getCurrentPosition()](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/getCurrentPosition) or [Geolocation.watchPosition()](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/watchPosition).\n *\n */\n\n/**\n * Fired when the Geolocate Control changes to the active lock state, which happens either upon first obtaining a successful Geolocation API position for the user (a geolocate event will follow), or the user clicks the geolocate button when in the background state which uses the last known position to recenter the map and enter active lock state (no geolocate event will follow unless the users's location changes).\n *\n * @event trackuserlocationstart\n * @memberof GeolocateControl\n * @instance\n *\n */\n\n/**\n * Fired when the Geolocate Control changes to the background state, which happens when a user changes the camera during an active position lock. This only applies when trackUserLocation is true. In the background state, the dot on the map will update with location updates but the camera will not.\n *\n * @event trackuserlocationend\n * @memberof GeolocateControl\n * @instance\n *\n */\n","// @flow\n\nimport DOM from '../../util/dom';\nimport { extend, bindAll } from '../../util/util';\n\nimport type Map from '../map';\n\ntype Unit = 'imperial' | 'metric' | 'nautical';\n\ntype Options = {\n maxWidth?: number,\n unit?: Unit;\n};\n\nconst defaultOptions: Options = {\n maxWidth: 100,\n unit: 'metric'\n};\n\n/**\n * A `ScaleControl` control displays the ratio of a distance on the map to the corresponding distance on the ground.\n *\n * @implements {IControl}\n * @param {Object} [options]\n * @param {number} [options.maxWidth='100'] The maximum length of the scale control in pixels.\n * @param {string} [options.unit='metric'] Unit of the distance (`'imperial'`, `'metric'` or `'nautical'`).\n * @example\n * var scale = new mapboxgl.ScaleControl({\n * maxWidth: 80,\n * unit: 'imperial'\n * });\n * map.addControl(scale);\n *\n * scale.setUnit('metric');\n */\nclass ScaleControl {\n _map: Map;\n _container: HTMLElement;\n options: Options;\n\n constructor(options: Options) {\n this.options = extend({}, defaultOptions, options);\n\n bindAll([\n '_onMove',\n 'setUnit'\n ], this);\n }\n\n getDefaultPosition() {\n return 'bottom-left';\n }\n\n _onMove() {\n updateScale(this._map, this._container, this.options);\n }\n\n onAdd(map: Map) {\n this._map = map;\n this._container = DOM.create('div', 'mapboxgl-ctrl mapboxgl-ctrl-scale', map.getContainer());\n\n this._map.on('move', this._onMove);\n this._onMove();\n\n return this._container;\n }\n\n onRemove() {\n DOM.remove(this._container);\n this._map.off('move', this._onMove);\n this._map = (undefined: any);\n }\n\n /**\n * Set the scale's unit of the distance\n *\n * @param unit Unit of the distance (`'imperial'`, `'metric'` or `'nautical'`).\n */\n setUnit(unit: Unit) {\n this.options.unit = unit;\n updateScale(this._map, this._container, this.options);\n }\n}\n\nexport default ScaleControl;\n\nfunction updateScale(map, container, options) {\n // A horizontal scale is imagined to be present at center of the map\n // container with maximum length (Default) as 100px.\n // Using spherical law of cosines approximation, the real distance is\n // found between the two coordinates.\n const maxWidth = options && options.maxWidth || 100;\n\n const y = map._container.clientHeight / 2;\n const maxMeters = getDistance(map.unproject([0, y]), map.unproject([maxWidth, y]));\n // The real distance corresponding to 100px scale length is rounded off to\n // near pretty number and the scale length for the same is found out.\n // Default unit of the scale is based on User's locale.\n if (options && options.unit === 'imperial') {\n const maxFeet = 3.2808 * maxMeters;\n if (maxFeet > 5280) {\n const maxMiles = maxFeet / 5280;\n setScale(container, maxWidth, maxMiles, 'mi');\n } else {\n setScale(container, maxWidth, maxFeet, 'ft');\n }\n } else if (options && options.unit === 'nautical') {\n const maxNauticals = maxMeters / 1852;\n setScale(container, maxWidth, maxNauticals, 'nm');\n } else {\n setScale(container, maxWidth, maxMeters, 'm');\n }\n}\n\nfunction setScale(container, maxWidth, maxDistance, unit) {\n let distance = getRoundNum(maxDistance);\n const ratio = distance / maxDistance;\n\n if (unit === 'm' && distance >= 1000) {\n distance = distance / 1000;\n unit = 'km';\n }\n\n container.style.width = `${maxWidth * ratio}px`;\n container.innerHTML = distance + unit;\n}\n\nfunction getDistance(latlng1, latlng2) {\n // Uses spherical law of cosines approximation.\n const R = 6371000;\n\n const rad = Math.PI / 180,\n lat1 = latlng1.lat * rad,\n lat2 = latlng2.lat * rad,\n a = Math.sin(lat1) * Math.sin(lat2) +\n Math.cos(lat1) * Math.cos(lat2) * Math.cos((latlng2.lng - latlng1.lng) * rad);\n\n const maxMeters = R * Math.acos(Math.min(a, 1));\n return maxMeters;\n\n}\n\nfunction getRoundNum(num) {\n const pow10 = Math.pow(10, (`${Math.floor(num)}`).length - 1);\n let d = num / pow10;\n\n d = d >= 10 ? 10 :\n d >= 5 ? 5 :\n d >= 3 ? 3 :\n d >= 2 ? 2 : 1;\n\n return pow10 * d;\n}\n","// @flow\n\nimport DOM from '../../util/dom';\n\nimport { bindAll, warnOnce } from '../../util/util';\nimport window from '../../util/window';\n\nimport type Map from '../map';\n\n/**\n * A `FullscreenControl` control contains a button for toggling the map in and out of fullscreen mode.\n *\n * @implements {IControl}\n * @example\n * map.addControl(new mapboxgl.FullscreenControl());\n * @see [View a fullscreen map](https://www.mapbox.com/mapbox-gl-js/example/fullscreen/)\n */\n\nclass FullscreenControl {\n _map: Map;\n _mapContainer: HTMLElement;\n _container: HTMLElement;\n _fullscreen: boolean;\n _fullscreenchange: string;\n _fullscreenButton: HTMLElement;\n _className: string;\n\n constructor() {\n this._fullscreen = false;\n bindAll([\n '_onClickFullscreen',\n '_changeIcon'\n ], this);\n if ('onfullscreenchange' in window.document) {\n this._fullscreenchange = 'fullscreenchange';\n } else if ('onmozfullscreenchange' in window.document) {\n this._fullscreenchange = 'mozfullscreenchange';\n } else if ('onwebkitfullscreenchange' in window.document) {\n this._fullscreenchange = 'webkitfullscreenchange';\n } else if ('onmsfullscreenchange' in window.document) {\n this._fullscreenchange = 'MSFullscreenChange';\n }\n this._className = 'mapboxgl-ctrl';\n }\n\n onAdd(map: Map) {\n this._map = map;\n this._mapContainer = this._map.getContainer();\n this._container = DOM.create('div', `${this._className} mapboxgl-ctrl-group`);\n if (this._checkFullscreenSupport()) {\n this._setupUI();\n } else {\n this._container.style.display = 'none';\n warnOnce('This device does not support fullscreen mode.');\n }\n return this._container;\n }\n\n onRemove() {\n DOM.remove(this._container);\n this._map = (null: any);\n window.document.removeEventListener(this._fullscreenchange, this._changeIcon);\n }\n\n _checkFullscreenSupport() {\n return !!(\n window.document.fullscreenEnabled ||\n (window.document: any).mozFullScreenEnabled ||\n (window.document: any).msFullscreenEnabled ||\n (window.document: any).webkitFullscreenEnabled\n );\n }\n\n _setupUI() {\n const button = this._fullscreenButton = DOM.create('button', (`${this._className}-icon ${this._className}-fullscreen`), this._container);\n button.setAttribute(\"aria-label\", \"Toggle fullscreen\");\n button.type = 'button';\n this._fullscreenButton.addEventListener('click', this._onClickFullscreen);\n window.document.addEventListener(this._fullscreenchange, this._changeIcon);\n }\n\n _isFullscreen() {\n return this._fullscreen;\n }\n\n _changeIcon() {\n const fullscreenElement =\n window.document.fullscreenElement ||\n (window.document: any).mozFullScreenElement ||\n (window.document: any).webkitFullscreenElement ||\n (window.document: any).msFullscreenElement;\n\n if ((fullscreenElement === this._mapContainer) !== this._fullscreen) {\n this._fullscreen = !this._fullscreen;\n this._fullscreenButton.classList.toggle(`${this._className}-shrink`);\n this._fullscreenButton.classList.toggle(`${this._className}-fullscreen`);\n }\n }\n\n _onClickFullscreen() {\n if (this._isFullscreen()) {\n if (window.document.exitFullscreen) {\n (window.document: any).exitFullscreen();\n } else if (window.document.mozCancelFullScreen) {\n (window.document: any).mozCancelFullScreen();\n } else if (window.document.msExitFullscreen) {\n (window.document: any).msExitFullscreen();\n } else if (window.document.webkitCancelFullScreen) {\n (window.document: any).webkitCancelFullScreen();\n }\n } else if (this._mapContainer.requestFullscreen) {\n this._mapContainer.requestFullscreen();\n } else if (this._mapContainer.mozRequestFullScreen) {\n (this._mapContainer: any).mozRequestFullScreen();\n } else if (this._mapContainer.msRequestFullscreen) {\n (this._mapContainer: any).msRequestFullscreen();\n } else if (this._mapContainer.webkitRequestFullscreen) {\n (this._mapContainer: any).webkitRequestFullscreen();\n }\n }\n}\n\nexport default FullscreenControl;\n","// @flow\n\nimport { extend, bindAll } from '../util/util';\nimport { Event, Evented } from '../util/evented';\nimport DOM from '../util/dom';\nimport LngLat from '../geo/lng_lat';\nimport Point from '@mapbox/point-geometry';\nimport window from '../util/window';\nimport smartWrap from '../util/smart_wrap';\nimport { type Anchor, anchorTranslate, applyAnchorClass } from './anchor';\n\nimport type Map from './map';\nimport type {LngLatLike} from '../geo/lng_lat';\n\nconst defaultOptions = {\n closeButton: true,\n closeOnClick: true\n};\n\nexport type Offset = number | PointLike | {[Anchor]: PointLike};\n\nexport type PopupOptions = {\n closeButton: boolean,\n closeOnClick: boolean,\n anchor: Anchor,\n offset: Offset\n};\n\n/**\n * A popup component.\n *\n * @param {Object} [options]\n * @param {boolean} [options.closeButton=true] If `true`, a close button will appear in the\n * top right corner of the popup.\n * @param {boolean} [options.closeOnClick=true] If `true`, the popup will closed when the\n * map is clicked.\n * @param {string} [options.anchor] - A string indicating the part of the Popup that should\n * be positioned closest to the coordinate set via {@link Popup#setLngLat}.\n * Options are `'top'`, `'bottom'`, `'left'`, `'right'`, `'top-left'`,\n * `'top-right'`, `'bottom-left'`, and `'bottom-right'`. If unset the anchor will be\n * dynamically set to ensure the popup falls within the map container with a preference\n * for `'bottom'`.\n * @param {number|PointLike|Object} [options.offset] -\n * A pixel offset applied to the popup's location specified as:\n * - a single number specifying a distance from the popup's location\n * - a {@link PointLike} specifying a constant offset\n * - an object of {@link Point}s specifing an offset for each anchor position\n * Negative offsets indicate left and up.\n * @example\n * var markerHeight = 50, markerRadius = 10, linearOffset = 25;\n * var popupOffsets = {\n * 'top': [0, 0],\n * 'top-left': [0,0],\n * 'top-right': [0,0],\n * 'bottom': [0, -markerHeight],\n * 'bottom-left': [linearOffset, (markerHeight - markerRadius + linearOffset) * -1],\n * 'bottom-right': [-linearOffset, (markerHeight - markerRadius + linearOffset) * -1],\n * 'left': [markerRadius, (markerHeight - markerRadius) * -1],\n * 'right': [-markerRadius, (markerHeight - markerRadius) * -1]\n * };\n * var popup = new mapboxgl.Popup({offset:popupOffsets})\n * .setLngLat(e.lngLat)\n * .setHTML(\"

Hello World!

\")\n * .addTo(map);\n * @see [Display a popup](https://www.mapbox.com/mapbox-gl-js/example/popup/)\n * @see [Display a popup on hover](https://www.mapbox.com/mapbox-gl-js/example/popup-on-hover/)\n * @see [Display a popup on click](https://www.mapbox.com/mapbox-gl-js/example/popup-on-click/)\n * @see [Attach a popup to a marker instance](https://www.mapbox.com/mapbox-gl-js/example/set-popup/)\n */\nexport default class Popup extends Evented {\n _map: Map;\n options: PopupOptions;\n _content: HTMLElement;\n _container: HTMLElement;\n _closeButton: HTMLElement;\n _tip: HTMLElement;\n _lngLat: LngLat;\n _pos: ?Point;\n\n constructor(options: PopupOptions) {\n super();\n this.options = extend(Object.create(defaultOptions), options);\n bindAll(['_update', '_onClickClose'], this);\n }\n\n /**\n * Adds the popup to a map.\n *\n * @param {Map} map The Mapbox GL JS map to add the popup to.\n * @returns {Popup} `this`\n */\n addTo(map: Map) {\n this._map = map;\n this._map.on('move', this._update);\n if (this.options.closeOnClick) {\n this._map.on('click', this._onClickClose);\n }\n this._update();\n\n /**\n * Fired when the popup is opened manually or programatically.\n *\n * @event open\n * @memberof Popup\n * @instance\n * @type {Object}\n * @property {Popup} popup object that was opened\n */\n this.fire(new Event('open'));\n\n return this;\n }\n\n /**\n * @returns {boolean} `true` if the popup is open, `false` if it is closed.\n */\n isOpen() {\n return !!this._map;\n }\n\n /**\n * Removes the popup from the map it has been added to.\n *\n * @example\n * var popup = new mapboxgl.Popup().addTo(map);\n * popup.remove();\n * @returns {Popup} `this`\n */\n remove() {\n if (this._content) {\n DOM.remove(this._content);\n }\n\n if (this._container) {\n DOM.remove(this._container);\n delete this._container;\n }\n\n if (this._map) {\n this._map.off('move', this._update);\n this._map.off('click', this._onClickClose);\n delete this._map;\n }\n\n /**\n * Fired when the popup is closed manually or programatically.\n *\n * @event close\n * @memberof Popup\n * @instance\n * @type {Object}\n * @property {Popup} popup object that was closed\n */\n this.fire(new Event('close'));\n\n return this;\n }\n\n /**\n * Returns the geographical location of the popup's anchor.\n *\n * The longitude of the result may differ by a multiple of 360 degrees from the longitude previously\n * set by `setLngLat` because `Popup` wraps the anchor longitude across copies of the world to keep\n * the popup on screen.\n *\n * @returns {LngLat} The geographical location of the popup's anchor.\n */\n getLngLat() {\n return this._lngLat;\n }\n\n /**\n * Sets the geographical location of the popup's anchor, and moves the popup to it.\n *\n * @param lnglat The geographical location to set as the popup's anchor.\n * @returns {Popup} `this`\n */\n setLngLat(lnglat: LngLatLike) {\n this._lngLat = LngLat.convert(lnglat);\n this._pos = null;\n this._update();\n return this;\n }\n\n /**\n * Sets the popup's content to a string of text.\n *\n * This function creates a [Text](https://developer.mozilla.org/en-US/docs/Web/API/Text) node in the DOM,\n * so it cannot insert raw HTML. Use this method for security against XSS\n * if the popup content is user-provided.\n *\n * @param text Textual content for the popup.\n * @returns {Popup} `this`\n * @example\n * var popup = new mapboxgl.Popup()\n * .setLngLat(e.lngLat)\n * .setText('Hello, world!')\n * .addTo(map);\n */\n setText(text: string) {\n return this.setDOMContent(window.document.createTextNode(text));\n }\n\n /**\n * Sets the popup's content to the HTML provided as a string.\n *\n * This method does not perform HTML filtering or sanitization, and must be\n * used only with trusted content. Consider {@link Popup#setText} if\n * the content is an untrusted text string.\n *\n * @param html A string representing HTML content for the popup.\n * @returns {Popup} `this`\n */\n setHTML(html: string) {\n const frag = window.document.createDocumentFragment();\n const temp = window.document.createElement('body');\n let child;\n temp.innerHTML = html;\n while (true) {\n child = temp.firstChild;\n if (!child) break;\n frag.appendChild(child);\n }\n\n return this.setDOMContent(frag);\n }\n\n /**\n * Sets the popup's content to the element provided as a DOM node.\n *\n * @param htmlNode A DOM node to be used as content for the popup.\n * @returns {Popup} `this`\n * @example\n * // create an element with the popup content\n * var div = window.document.createElement('div');\n * div.innerHTML = 'Hello, world!';\n * var popup = new mapboxgl.Popup()\n * .setLngLat(e.lngLat)\n * .setDOMContent(div)\n * .addTo(map);\n */\n setDOMContent(htmlNode: Node) {\n this._createContent();\n this._content.appendChild(htmlNode);\n this._update();\n return this;\n }\n\n _createContent() {\n if (this._content) {\n DOM.remove(this._content);\n }\n\n this._content = DOM.create('div', 'mapboxgl-popup-content', this._container);\n\n if (this.options.closeButton) {\n this._closeButton = DOM.create('button', 'mapboxgl-popup-close-button', this._content);\n this._closeButton.type = 'button';\n this._closeButton.setAttribute('aria-label', 'Close popup');\n this._closeButton.innerHTML = '×';\n this._closeButton.addEventListener('click', this._onClickClose);\n }\n }\n\n _update() {\n if (!this._map || !this._lngLat || !this._content) { return; }\n\n if (!this._container) {\n this._container = DOM.create('div', 'mapboxgl-popup', this._map.getContainer());\n this._tip = DOM.create('div', 'mapboxgl-popup-tip', this._container);\n this._container.appendChild(this._content);\n }\n\n if (this._map.transform.renderWorldCopies) {\n this._lngLat = smartWrap(this._lngLat, this._pos, this._map.transform);\n }\n\n const pos = this._pos = this._map.project(this._lngLat);\n\n let anchor: Anchor = this.options.anchor;\n const offset = normalizeOffset(this.options.offset);\n\n if (!anchor) {\n const width = this._container.offsetWidth;\n const height = this._container.offsetHeight;\n let anchorComponents;\n\n if (pos.y + offset.bottom.y < height) {\n anchorComponents = ['top'];\n } else if (pos.y > this._map.transform.height - height) {\n anchorComponents = ['bottom'];\n } else {\n anchorComponents = [];\n }\n\n if (pos.x < width / 2) {\n anchorComponents.push('left');\n } else if (pos.x > this._map.transform.width - width / 2) {\n anchorComponents.push('right');\n }\n\n if (anchorComponents.length === 0) {\n anchor = 'bottom';\n } else {\n anchor = (anchorComponents.join('-'): any);\n }\n }\n\n const offsetedPos = pos.add(offset[anchor]).round();\n\n DOM.setTransform(this._container, `${anchorTranslate[anchor]} translate(${offsetedPos.x}px,${offsetedPos.y}px)`);\n applyAnchorClass(this._container, anchor, 'popup');\n }\n\n _onClickClose() {\n this.remove();\n }\n}\n\nfunction normalizeOffset(offset: ?Offset) {\n if (!offset) {\n return normalizeOffset(new Point(0, 0));\n\n } else if (typeof offset === 'number') {\n // input specifies a radius from which to calculate offsets at all positions\n const cornerOffset = Math.round(Math.sqrt(0.5 * Math.pow(offset, 2)));\n return {\n 'center': new Point(0, 0),\n 'top': new Point(0, offset),\n 'top-left': new Point(cornerOffset, cornerOffset),\n 'top-right': new Point(-cornerOffset, cornerOffset),\n 'bottom': new Point(0, -offset),\n 'bottom-left': new Point(cornerOffset, -cornerOffset),\n 'bottom-right': new Point(-cornerOffset, -cornerOffset),\n 'left': new Point(offset, 0),\n 'right': new Point(-offset, 0)\n };\n\n } else if (offset instanceof Point || Array.isArray(offset)) {\n // input specifies a single offset to be applied to all positions\n const convertedOffset = Point.convert(offset);\n return {\n 'center': convertedOffset,\n 'top': convertedOffset,\n 'top-left': convertedOffset,\n 'top-right': convertedOffset,\n 'bottom': convertedOffset,\n 'bottom-left': convertedOffset,\n 'bottom-right': convertedOffset,\n 'left': convertedOffset,\n 'right': convertedOffset\n };\n\n } else {\n // input specifies an offset per position\n return {\n 'center': Point.convert(offset['center'] || [0, 0]),\n 'top': Point.convert(offset['top'] || [0, 0]),\n 'top-left': Point.convert(offset['top-left'] || [0, 0]),\n 'top-right': Point.convert(offset['top-right'] || [0, 0]),\n 'bottom': Point.convert(offset['bottom'] || [0, 0]),\n 'bottom-left': Point.convert(offset['bottom-left'] || [0, 0]),\n 'bottom-right': Point.convert(offset['bottom-right'] || [0, 0]),\n 'left': Point.convert(offset['left'] || [0, 0]),\n 'right': Point.convert(offset['right'] || [0, 0])\n };\n }\n}\n","// @flow\n\nimport assert from 'assert';\nimport supported from '@mapbox/mapbox-gl-supported';\n\nimport browser from './util/browser';\nimport { version } from '../package.json';\nimport Map from './ui/map';\nimport NavigationControl from './ui/control/navigation_control';\nimport GeolocateControl from './ui/control/geolocate_control';\nimport AttributionControl from './ui/control/attribution_control';\nimport ScaleControl from './ui/control/scale_control';\nimport FullscreenControl from './ui/control/fullscreen_control';\nimport Popup from './ui/popup';\nimport Marker from './ui/marker';\nimport Style from './style/style';\nimport LngLat from './geo/lng_lat';\nimport LngLatBounds from './geo/lng_lat_bounds';\nimport Point from '@mapbox/point-geometry';\nimport {Evented} from './util/evented';\nimport config from './util/config';\nimport {setRTLTextPlugin} from './source/rtl_text_plugin';\n\nconst exported = {\n version,\n supported,\n workerCount: Math.max(Math.floor(browser.hardwareConcurrency / 2), 1),\n setRTLTextPlugin: setRTLTextPlugin,\n Map,\n NavigationControl,\n GeolocateControl,\n AttributionControl,\n ScaleControl,\n FullscreenControl,\n Popup,\n Marker,\n Style,\n LngLat,\n LngLatBounds,\n Point,\n Evented,\n config,\n\n /**\n * Gets and sets the map's [access token](https://www.mapbox.com/help/define-access-token/).\n *\n * @var {string} accessToken\n * @example\n * mapboxgl.accessToken = myAccessToken;\n * @see [Display a map](https://www.mapbox.com/mapbox-gl-js/examples/)\n */\n get accessToken() {\n return config.ACCESS_TOKEN;\n },\n\n set accessToken(token: string) {\n config.ACCESS_TOKEN = token;\n },\n\n workerUrl: ''\n};\n\n/**\n * The version of Mapbox GL JS in use as specified in `package.json`,\n * `CHANGELOG.md`, and the GitHub release.\n *\n * @var {string} version\n */\n\n/**\n * Test whether the browser [supports Mapbox GL JS](https://www.mapbox.com/help/mapbox-browser-support/#mapbox-gl-js).\n *\n * @function supported\n * @param {Object} [options]\n * @param {boolean} [options.failIfMajorPerformanceCaveat=false] If `true`,\n * the function will return `false` if the performance of Mapbox GL JS would\n * be dramatically worse than expected (e.g. a software WebGL renderer would be used).\n * @return {boolean}\n * @example\n * mapboxgl.supported() // = true\n * @see [Check for browser support](https://www.mapbox.com/mapbox-gl-js/example/check-for-support/)\n */\n\n/**\n * Sets the map's [RTL text plugin](https://www.mapbox.com/mapbox-gl-js/plugins/#mapbox-gl-rtl-text).\n * Necessary for supporting languages like Arabic and Hebrew that are written right-to-left.\n *\n * @function setRTLTextPlugin\n * @param {string} pluginURL URL pointing to the Mapbox RTL text plugin source.\n * @param {Function} callback Called with an error argument if there is an error.\n * @example\n * mapboxgl.setRTLTextPlugin('https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.1.2/mapbox-gl-rtl-text.js');\n * @see [Add support for right-to-left scripts](https://www.mapbox.com/mapbox-gl-js/example/mapbox-gl-rtl-text/)\n */\n\nexport default exported;\n\n// canary assert: used to confirm that asserts have been removed from production build\nassert(true, 'canary assert');\n","//\n// Our custom intro provides a specialized \"define()\" function, called by the\n// AMD modules below, that sets up the worker blob URL and then executes the\n// main module, storing its exported value as 'mapboxgl'\n\n// The three \"chunks\" imported here are produced by a first Rollup pass,\n// which outputs them as AMD modules.\n\n// Shared dependencies, i.e.:\n/*\ndefine(['exports'], function (exports) {\n // Code for all common dependencies\n // Each module's exports are attached attached to 'exports' (with\n // names rewritten to avoid collisions, etc.)\n})\n*/\nimport './build/mapboxgl/chunk1';\n\n// Worker and its unique dependencies, i.e.:\n/*\ndefine(['./chunk1.js'], function (__chunk1__js) {\n // Code for worker script and its unique dependencies.\n // Expects the output of 'chunk1' module to be passed in as an argument,\n // since all references to common deps look like, e.g.,\n // __chunk1__js.shapeText().\n});\n*/\n// When this wrapper function is passed to our custom define() above,\n// it gets stringified, together with the chunk1 wrapper (using\n// Function.toString()), and the resulting string of code is made into a\n// Blob URL that gets used by the main module to create the web workers.\nimport './build/mapboxgl/worker';\n\n// Main module and its unique dependencies\n/*\ndefine(['./chunk1.js'], function (__chunk1__js) {\n // Code for main GL JS module and its unique dependencies.\n // Expects the output of 'chunk1' module to be passed in as an argument,\n // since all references to common deps look like, e.g.,\n // __chunk1__js.shapeText().\n //\n // Returns the actual mapboxgl (i.e. src/index.js)\n});\n*/\nimport './build/mapboxgl/index';\n\nexport default mapboxgl;\n"],"names":["module","UnitBezier","p1x","p1y","p2x","p2y","this","cx","bx","ax","cy","by","ay","prototype","sampleCurveX","t","sampleCurveY","sampleCurveDerivativeX","solveCurveX","x","epsilon","t0","t1","t2","x2","i","Math","abs","d2","solve","Coordinate","column","row","zoom","clone","zoomTo","_zoomTo","sub","c","_sub","scale","pow","Point","y","bezier","const","add","p","_add","multByPoint","_multByPoint","divByPoint","_divByPoint","mult","k","_mult","div","_div","rotate","a","_rotate","rotateAround","_rotateAround","matMult","m","_matMult","unit","_unit","perp","_perp","round","_round","mag","sqrt","equals","other","dist","distSqr","dx","dy","angle","atan2","angleTo","b","angleWith","angleWithSep","cos","sin","convert","Array","isArray","ease","clamp","n","min","max","extend","dest","sources","src","let","id","bindAll","fns","context","forEach","fn","bind","endsWith","string","suffix","indexOf","length","mapObject","input","iterator","output","key","call","filterObject","map","warnOnceHistory","warnOnce","message","console","warn","isCounterClockwise","calculateSignedArea","ring","sum","len","j","p1","p2","ResourceType","Unknown","Style","Source","Tile","Glyphs","SpriteImage","SpriteJSON","Image","Object","freeze","AJAXError","status","url","super","name","constructor","toString","Error","makeRequest","requestParameters","xhr","window","XMLHttpRequest","open","headers","setRequestHeader","withCredentials","credentials","getArrayBuffer","callback","responseType","onerror","statusText","onload","response","byteLength","data","cacheControl","getResponseHeader","expires","send","_addEventListener","type","listener","listenerList","push","_removeEventListener","index","splice","Event","ErrorEvent","error","Evented","on","_listeners","off","_oneTimeListeners","once","fire","event","arguments","listens","target","slice","listener$1","parent","_eventedParent","_eventedParentData","warning","setEventedParent","ValidationError","value","identifier","__line__","line","validateConstants","options","constants","unbundle","Number","String","Boolean","valueOf","deepUnbundle","ParsingError","Scope","bindings","ref","expression","concat","get","has","NullType","kind","NumberType","StringType","BooleanType","ColorType","ObjectType","ValueType","CollatorType","array","itemType","N","valueMemberTypes","checkSubtype","expected","kCSSColorTable","transparent","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen","clamp_css_byte","clamp_css_float","f","parse_css_int","str","parseFloat","parseInt","parse_css_float","css_hue_to_rgb","m1","m2","h","exports","css_str","iv","replace","toLowerCase","substr","op","ep","fname","params","split","alpha","pop","s","l","e","Color","r","g","parse","rgba","parseCSSColor","toArray","Collator","caseSensitive","diacriticSensitive","locale","sensitivity","collator","Intl","usage","compare","lhs","rhs","resolvedLocale","resolvedOptions","CollatorExpression","validateRGBA","join","typeOf","args","undefined","evaluate","ctx","eachChild","possibleOutputs","serialize","Literal","isValue","mixed","expectedType","RuntimeError","toJSON","types","number","boolean","object","Assertion","parsed","arg","ArrayAssertion","floor","serialized","to-number","to-color","Coercion","parseColor","JSON","stringify","num","isNaN","child","geometryTypes","EvaluationContext","_parseColorCache","feature","geometryType","properties","cached","CompoundExpression","_evaluate","isFeatureConstant","test","result","isGlobalPropertyConstant","definition","definitions","availableOverloads","overloads","filter","signature","parsedArgs","signatureContext","ParsingContext","registry","path","scope","errors","apply","signatures","actualTypes","register","Var","boundExpression","part","findStopLessThanOrEqualTo","stops","currentValue","upperValue","lowerIndex","upperIndex","currentIndex","expr","_parse","Expr","actual","omitTypeAnnotations","isConstant","isTypeAnnotation","childrenConstant","ec","keys","Step","labels","outputs","label","rest","outputType","unshift","Infinity","labelKey","valueKey","stopCount","from","to","d","Interpolate","interpolation","exponentialInterpolation","base","lowerValue","difference","progress","interpolationFactor","lower","upper","controlPoints","some","outputLower","outputUpper","interpolate","Coalesce","needsAnnotation","Let","At","Match","inputType","cases","otherwise","labelContext","MAX_SAFE_INTEGER","out","groupedByOutput","outputLookup","sort","outputIndex","coerceLabel","Case","branches","isComparableType","makeComparison","negate","Comparison","equal","Equals","NotEquals","Length","expressions","==","!=","at","case","coalesce","literal","match","step","var","obj","v","lt","gt","lteq","gteq","varargs","success","typeof","to-string","to-boolean","to-rgba","rgb","geometry-type","globals","heatmap-density","heatmapDensity","line-progress","lineProgress","+","*","-","/","%","ln2","LN2","pi","PI","E","^","log10","ln","log","log2","asin","acos","atan","ceil","filter-==","filter-id-==","filter-type-==","filter-<","filter-id-<","filter->","filter-id->","filter-<=","filter-id-<=","filter->=","filter-id->=","filter-has","filter-has-id","filter-type-in","filter-id-in","filter-in-small","filter-in-large","binarySearch",">","<",">=","<=","all","any","!","is-supported-script","isSupportedScript","upcase","toUpperCase","downcase","resolved-locale","Xn","Yn","Zn","t3","deg2rad","rad2deg","xyz2lab","lab2xyz","xyz2rgb","rgb2xyz","rgbToLab","rgbColor","labToRgb","labColor","z","lab","forward","reverse","interpolateNumber","hcl","hclColor","interpolateHue","getType","val","isFunction","identityFunction","evaluateCategoricalFunction","parameters","propertySpec","hashedStops","keyType","default","evaluateIntervalFunction","evaluateExponentialFunction","interp","colorSpace","colorspace","colorSpaces","evaluatedLower","evaluatedUpper","evaluateIdentityFunction","values","StyleExpression","spec","_warningHistory","_defaultValue","_enumValues","isExpression","createExpression","parser","color","enum","getExpectedType","evaluateWithoutErrorHandling","_evaluator","ZoomConstantExpression","_styleExpression","ZoomDependentExpression","zoomCurve","zoomStops","_interpolationType","createPropertyExpression","isZoomConstant","findZoomCurve","childResult","StylePropertyFunction","specification","_parameters","_specification","createFunction","innerFun","categoricalKeyType","isColor","zoomAndFeatureDependent","featureDependent","property","zoomDependent","function","stop","create","featureFunctions","featureFunctionStops","_","normalizePropertyExpression","err","constant","validateObject","elementSpecs","valueSpec","elementValidators","objectElementValidators","style","styleSpec","objectKey","elementSpecKey","elementSpec","validateElement","validateSpec","required","validateArray","arraySpec","validateArrayElement","arrayElementValidator","validate","arrayElementSpec","$version","arrayIndex","validateNumber","minimum","maximum","validateFunction","stopKeyType","previousStopDomainValue","previousStopDomainZoom","functionValueSpec","functionType","stopDomainValues","isZoomFunction","isPropertyFunction","isZoomAndPropertyFunction","validateFunctionStop","validateStopDomainValue","reportValue","isFinite","validateExpression","expressionContext","propertyKey","validateEnum","isExpressionFilter","deserialize","filterSpec","property-function","zoom-function","createFilter","convertFilter","compiled","globalProperties","filters","convertComparisonOp","convertNegation","convertInOp","convertHasOp","validateFilter","validateNonExpressionFilter","filter_operator","geometry_type","validateProperty","propertyType","layerSpec","layerType","transitionMatch","transition","tokenMatch","tokens","exec","glyphs","validatePaintProperty","validateLayoutProperty","validateLayer","layer","layerId","otherLayer","layers","source","sourceType","paint","lineMetrics","layout","validateSource","prop","source_geojson","source_video","source_image","validateLight","light","lightSpec","rootType","validateString","VALIDATORS","validateStyleMin","latestStyleSpec","$root","validateGlyphsURL","sortErrors","wrapCleanErrors","inner","paintProperty","layoutProperty","validateStyle","emitValidationErrors","emitter","hasErrors","GridIndex","NUM_PARAMS","extent","padding","cells","ArrayBuffer","arrayBuffer","Int32Array","start","end","subarray","keysOffset","bboxesOffset","bboxes","insert","_insertReadonly","uid","x1","y1","y2","_forEachCell","_insertCell","cellIndex","query","_queryCell","seenUids","cell","u","offset","arg1","arg2","cx1","_convertToCellCoord","cy1","cx2","cy2","toArrayBuffer","metadataLength","totalCellLength","set","buffer","ImageData","klass","defineProperty","writeable","omit","shallow","Grid","grid","transferables","ab","_classRegistryKey","Date","RegExp","isView","view","item","_serialized","hasOwnProperty","ZoomHistory","first","update","now","floorZ","lastIntegerZoom","lastIntegerZoomTime","lastZoom","lastFloorZoom","unicodeBlockLookup","Latin-1 Supplement","char","Arabic","Arabic Supplement","Arabic Extended-A","Hangul Jamo","Unified Canadian Aboriginal Syllabics","Khmer","Unified Canadian Aboriginal Syllabics Extended","General Punctuation","Letterlike Symbols","Number Forms","Miscellaneous Technical","Control Pictures","Optical Character Recognition","Enclosed Alphanumerics","Geometric Shapes","Miscellaneous Symbols","Miscellaneous Symbols and Arrows","CJK Radicals Supplement","Kangxi Radicals","Ideographic Description Characters","CJK Symbols and Punctuation","Hiragana","Katakana","Bopomofo","Hangul Compatibility Jamo","Kanbun","Bopomofo Extended","CJK Strokes","Katakana Phonetic Extensions","Enclosed CJK Letters and Months","CJK Compatibility","CJK Unified Ideographs Extension A","Yijing Hexagram Symbols","CJK Unified Ideographs","Yi Syllables","Yi Radicals","Hangul Jamo Extended-A","Hangul Syllables","Hangul Jamo Extended-B","Private Use Area","CJK Compatibility Ideographs","Arabic Presentation Forms-A","Vertical Forms","CJK Compatibility Forms","Small Form Variants","Arabic Presentation Forms-B","Halfwidth and Fullwidth Forms","allowsVerticalWritingMode","chars","charHasUprightVerticalOrientation","charCodeAt","charAllowsLetterSpacing","isChar","charHasRotatedVerticalOrientation","charHasNeutralVerticalOrientation","charInSupportedScript","canRenderRTL","_completionCallback","pluginRequested","pluginURL","foregroundLoadComplete","evented","plugin","applyArabicShaping","processBidirectionalText","isLoaded","EvaluationParameters","fadeDuration","zoomHistory","isStringInSupportedScript","rtlTextPlugin","crossFadingFactor","PropertyValue","isDataDriven","possiblyEvaluate","TransitionablePropertyValue","transitioned","prior","TransitioningPropertyValue","untransitioned","Transitionable","_properties","_values","defaultTransitionablePropertyValues","getValue","setValue","getTransition","setTransition","Transitioning","begin","delay","duration","finalValue","easeCubicInOut","defaultTransitioningPropertyValues","PossiblyEvaluated","hasTransition","Layout","defaultPropertyValues","PossiblyEvaluatedPropertyValue","constantOr","defaultPossiblyEvaluatedValues","DataConstantProperty","DataDrivenProperty","CrossFadedProperty","_calculate","mid","fraction","fromScale","toScale","ColorRampProperty","Properties","defaultPropertyValue","defaultTransitionablePropertyValue","StyleLayer","metadata","minzoom","maxzoom","visibility","sourceLayer","_featureFilter","_unevaluatedLayout","_transitionablePaint","setPaintProperty","setLayoutProperty","_transitioningPaint","getLayoutProperty","_validate","getPaintProperty","isHidden","updateTransitions","recalculate","source-layer","sprite","hasOffscreenPass","resize","viewTypes","Int8","Int8Array","Uint8","Uint8Array","Int16","Int16Array","Uint16","Uint16Array","Int32","Uint32","Uint32Array","Float32","Float32Array","Struct","structArray","_structArray","_pos1","size","_pos2","_pos4","_pos8","StructArray","isTransferred","capacity","createLayout","members","alignment","maxSize","member","typeSize","BYTES_PER_ELEMENT","memberOffset","align","components","_trim","bytesPerElement","_refreshViews","clear","reserve","oldUint8Array","uint8","StructArrayLayout2i4","int16","emplaceBack","v0","v1","o2","StructArrayLayout4i8","v2","v3","StructArrayLayout2i4i12","v4","v5","StructArrayLayout4i4ub12","v6","v7","o1","StructArrayLayout4i4ui16","uint16","StructArrayLayout3f12","float32","o4","StructArrayLayout1ul4","uint32","StructArrayLayout6i1ul2ui2i24","v8","v9","v10","StructArrayLayout2i2i2i12","StructArrayLayout2ub4","StructArrayLayout2i2ui3ul3ui2f2ub40","v11","v12","v13","StructArrayLayout1f4","StructArrayLayout3i6","StructArrayLayout1ul2ui8","StructArrayLayout3ui6","StructArrayLayout2ui4","StructArrayLayout2f8","StructArrayLayout4f16","CollisionBoxStruct","anchorPointX","prototypeAccessors","anchorPointY","featureIndex","sourceLayerIndex","bucketIndex","radius","signedDistanceFromAnchor","anchorPoint","CollisionBoxArray","PlacedSymbolStruct","anchorX","prototypeAccessors$1","anchorY","glyphStartIndex","numGlyphs","vertexStartIndex","lineStartIndex","lineLength","segment","lowerSize","upperSize","lineOffsetX","lineOffsetY","writingMode","hidden","PlacedSymbolArray","GlyphOffsetStruct","offsetX","prototypeAccessors$2","GlyphOffsetArray","getoffsetX","SymbolLineVertexStruct","prototypeAccessors$3","tileUnitDistanceFromAnchor","SymbolLineVertexArray","getx","gety","gettileUnitDistanceFromAnchor","FeatureIndexStruct","prototypeAccessors$4","FeatureIndexArray","SegmentVector","segments","prepareSegment","numVertices","layoutVertexArray","indexArray","MAX_VERTEX_ARRAY_LENGTH","vertexLength","vertexOffset","primitiveOffset","primitiveLength","destroy","vaos","packUint8ToFloat","packColor","ConstantBinder","statistics","defines","populatePaintArray","upload","setUniforms","program","gl","uniform4f","uniforms","uniform1f","SourceExpressionBinder","PaintVertexArray","paintVertexAttributes","paintVertexArray","paintArray","paintVertexBuffer","createVertexBuffer","CompositeExpressionBinder","useIntegerZoom","minColor","maxColor","currentZoom","ProgramConfiguration","binders","cacheKey","_buffers","createDynamic","filterProperties","self","paintAttributeName","populatePaintArrays","getPaintVertexBuffers","buffers","binder","ProgramConfigurationSet","layoutAttributes","programConfigurations","text-opacity","icon-opacity","text-color","icon-color","text-halo-color","icon-halo-color","text-halo-blur","icon-halo-blur","text-halo-width","icon-halo-width","line-gap-width","bits","bounds","loadGeometry","EXTENT","geometry","point","addCircleVertex","extrudeX","extrudeY","CircleBucket","overscaling","layerIds","CircleLayoutArray","TriangleIndexArray","multiPolygonIntersectsBufferedPoint","multiPolygon","polygon","polygonContainsPoint","pointIntersectsBufferedLine","multiPolygonIntersectsMultiPolygon","multiPolygonA","multiPolygonB","multiPolygonContainsPoint","lineIntersectsLine","multiPolygonIntersectsBufferedMultiLine","multiLine","lineIntersectsBufferedLine","lineA","lineB","a0","a1","lineSegmentIntersectsLineSegment","b0","b1","radiusSquared","distToSegmentSquared","w","l2","rings","getMaximumPaintValue","bucket","translateDistance","translate","queryGeometry","translateAnchor","bearing","pixelsToTileUnits","pt","translated","translatedRing","populate","features","addFeature","isEmpty","layoutVertexBuffer","indexBuffer","createIndexBuffer","circle-radius","circle-color","circle-blur","circle-opacity","circle-translate","circle-translate-anchor","circle-pitch-scale","circle-pitch-alignment","circle-stroke-width","circle-stroke-color","circle-stroke-opacity","create$1","vec3","transformMat3","vec4","transformMat4","mat2","rad","a2","a3","mat3","fromRotation","mat4","identity","a00","a01","a02","a03","a10","a11","a12","a13","a20","a21","a22","a23","multiply","a30","a31","a32","a33","b2","b3","perspective","fovy","aspect","near","far","nf","rotateX","rotateZ","invert","b00","b01","b02","b03","b04","b05","b06","b07","b08","b09","b10","b11","det","ortho","left","right","bottom","top","lr","bt","CircleStyleLayer","createBucket","queryRadius","circleBucket","queryIntersectsFeature","transform","posMatrix","translatedPolygon","alignWithMap","transformedPolygon","projectPoint","projectQueryGeometry","transformedSize","transformedPoint","adjustedSize","projectedCenter","cameraToCenterDistance","width","height","HeatmapBucket","createImage","image","channels","RangeError","resizeImage","newImage","copyImage","srcImg","dstImg","srcPt","dstPt","srcData","dstData","srcOffset","dstOffset","AlphaImage","copy","RGBAImage","heatmap-radius","heatmap-weight","heatmap-intensity","heatmap-color","heatmap-opacity","colorRampData","evaluationGlobals","colorRampEvaluationParameter","pxColor","HeatmapStyleLayer","_updateColorRamp","colorRamp","renderColorRamp","colorRampTexture","heatmapFbo","hillshade-illumination-direction","hillshade-illumination-anchor","hillshade-exaggeration","hillshade-shadow-color","hillshade-highlight-color","hillshade-accent-color","earcut","holeIndices","dim","minX","minY","maxX","maxY","invSize","hasHoles","outerLen","outerNode","linkedList","triangles","list","queue","next","steiner","getLeftmost","compareX","eliminateHole","filterPoints","eliminateHoles","earcutLinked","clockwise","last","signedArea","insertNode","removeNode","again","area","prev","ear","pass","zOrder","prevZ","nextZ","q","tail","numMerges","pSize","qSize","inSize","sortLinked","indexCurve","isEarHashed","isEar","cureLocalIntersections","splitEarcut","pointInTriangle","minTX","minTY","maxTX","maxTY","minZ","maxZ","intersects","locallyInside","isValidDiagonal","splitPolygon","hole","hx","hy","qx","mx","my","tanMin","findHoleBridge","leftmost","px","py","intersectsPolygon","inside","middleInside","q1","q2","Node","an","bp","deviation","polygonArea","trianglesArea","flatten","vertices","holes","dimensions","holeIndex","quickselect","arr","quickselectStep","exp","sd","newLeft","newRight","swap","defaultCompare","tmp","ccw","polygons","maxRings","compareAreas","FillBucket","FillLayoutArray","indexArray2","LineIndexArray","segments2","indexBuffer2","classifyRings","triangleSegment","triangleIndex","flattened","lineSegment","lineIndex","indices","fill-antialias","fill-opacity","fill-color","fill-outline-color","fill-translate","fill-translate-anchor","fill-pattern","outlineColor","FACTOR","addVertex","vertexArray","nx","ny","nz","FillExtrusionBucket","FillExtrusionLayoutArray","isBoundaryEdge","isEntirelyOutside","every","edgeDistance","bottomRight","fill-extrusion-opacity","fill-extrusion-color","fill-extrusion-translate","fill-extrusion-translate-anchor","fill-extrusion-pattern","fill-extrusion-height","fill-extrusion-base","viewportFrame","VectorTileFeature","pbf","_pbf","_geometry","_keys","readFields","readFeature","tag","readVarint","pos","readTag","cmd","lines","cmdLen","readSVarint","bbox","toGeoJSON","x0","y0","coords","project","points","coordinates","VectorTileLayer","version","_features","readLayer","readString","readFloat","readDouble","readVarint64","readBoolean","readValueMessage","readTile","require","vectorTileFeatureTypes","mvt","EXTRUDE_SCALE","COS_HALF_SHARP_CORNER","LINE_DISTANCE_SCALE","MAX_LINE_DISTANCE","LINE_DISTANCE_BUFFER_BITS","addLineVertex","extrude","up","dir","linesofar","LineBucket","LineLayoutArray","scaleDistance","tileDistance","stats","tileTotal","cap","miterLimit","roundLimit","addLine","lineDistances","mapbox_clip_start","mapbox_clip_end","isPolygon","currentVertex","nextVertex","total","calculateFullDistance","sharpCornerOffset","firstVertex","distance","offsetA","offsetB","beginCap","endCap","startOfLine","prevVertex","prevNormal","nextNormal","e1","e2","e3","joinNormal","cosHalfAngle","miterLength","isSharpCorner","prevSegmentLength","newPrevVertex","addCurrentVertex","middleVertex","currentJoin","direction","bevelLength","lineTurnsLeft","approxFractionalJoinNormal","addPieSliceVertex","nextSegmentLength","newCurrentVertex","normal","endLeft","endRight","distancesForScaling","line-cap","line-join","line-miter-limit","line-round-limit","line-opacity","line-color","line-translate","line-translate-anchor","line-width","line-offset","line-blur","line-dasharray","line-pattern","line-gradient","lineFloorwidthProperty","LineStyleLayer","_updateGradient","gradient","gradientTexture","lineBucket","getLineWidth","halfWidth","lineOffset","newRings","zero","newRing","aToB","bToC","offsetLine","lineWidth","lineGapWidth","symbolLayoutAttributes","dynamicLayoutAttributes","collisionVertexAttributes","collisionBoxLayout","collisionCircleLayout","verticalizedCharacterMap","#","$","&","(",")",",",".",":",";","=","?","@","[","\\","]","`","{","|","}","~","¢","£","Â¥","¦","¬","¯","–","—","‘","’","“","”","…","‧","₩","、","。","〈","〉","《","》","「","」","『","』","【","】","〔","〕","〖","〗","!","(",")",",","-",".",":",";","<",">","?","ï¼»","ï¼½","_","{","|","}","⦅","ï½ ","。","ï½¢","ï½£","Anchor","getSizeData","tileZoom","layoutSize","levels","zoomRange","propertyValue","sizeRange","shaderOpacityAttributes","ox","oy","tx","ty","sizeVertex","addDynamicAttributes","dynamicLayoutVertexArray","SymbolBuffers","SymbolLayoutArray","SymbolDynamicLayoutArray","opacityVertexArray","SymbolOpacityArray","placedSymbolArray","dynamicIndexBuffer","dynamicLayoutVertexBuffer","opacityVertexBuffer","itemSize","CollisionBuffers","LayoutArray","IndexArray","collisionVertexArray","CollisionVertexArray","collisionVertexBuffer","SymbolBucket","collisionBoxArray","pixelRatio","unevaluatedLayoutValues","textSizeData","iconSizeData","sortFeaturesByY","createArrays","text","icon","collisionBox","CollisionBoxLayoutArray","collisionCircle","CollisionCircleLayoutArray","glyphOffsetArray","lineVertexArray","textFont","textField","iconImage","hasText","hasIcon","icons","iconDependencies","stacks","glyphDependencies","transformText","getValueAndResolveTokens","symbolFeature","fontStack","stack","textAlongLine","doesAllowVerticalWritingMode","verticalChar","charAt","mergeLines","symbolInstances","addToLineVertexArray","anchor","sumForwardLength","sumBackwardLength","vertex","addSymbols","arrays","quads","alongLine","labelAnchor","glyphOffsetArrayStart","symbol","tl","tr","bl","br","tex","glyphOffset","_addCollisionDebugVertex","addCollisionDebugVertices","boxAnchorPoint","symbolInstance","isCircle","indexArray$1","generateCollisionDebugBuffers","textCollisionFeature","boxStartIndex","textBoxStartIndex","boxEndIndex","textBoxEndIndex","iconCollisionFeature","iconBoxStartIndex","iconBoxEndIndex","box","deserializeCollisionBoxes","textStartIndex","textEndIndex","iconStartIndex","iconEndIndex","collisionArrays","textBox","textFeatureIndex","textCircles","iconBox","iconFeatureIndex","hasTextData","hasIconData","hasCollisionBoxData","hasCollisionCircleData","sortFeatures","sortedAngle","symbolInstanceIndexes","aIndex","bIndex","featureSortOrder","this$1","placedTextSymbolIndices","placedTextSymbolIndex","placedSymbol","endIndex","vertexIndex","placedIcon","updateData","MAX_GLYPHS","symbol-placement","symbol-spacing","symbol-avoid-edges","icon-allow-overlap","icon-ignore-placement","icon-optional","icon-rotation-alignment","icon-size","icon-text-fit","icon-text-fit-padding","icon-image","icon-rotate","icon-padding","icon-keep-upright","icon-offset","icon-anchor","icon-pitch-alignment","text-pitch-alignment","text-rotation-alignment","text-field","text-font","text-size","text-max-width","text-line-height","text-letter-spacing","text-justify","text-anchor","text-max-angle","text-rotate","text-padding","text-keep-upright","text-transform","text-offset","text-allow-overlap","text-ignore-placement","text-optional","icon-translate","icon-translate-anchor","text-translate","text-translate-anchor","SymbolStyleLayer","unevaluated","background-color","background-pattern","background-opacity","raster-opacity","raster-hue-rotate","raster-brightness-min","raster-brightness-max","raster-saturation","raster-contrast","raster-fade-duration","subclasses","circle","heatmap","hillshade","fill","fill-extrusion","fillExtrusion","background","ShelfPack$1","autoResize","shelves","freebins","bins","maxId","Shelf","free","pack","allocation","results","packOne","inPlace","shrink","bin","shelf","waste","h1","h2","w1","w2","best","freebin","getBin","maxh","maxw","allocFreebin","allocShelf","refcount","alloc","unref","factory","ImagePosition","paddedRect","displaySize","ImageAtlas","images","positions","ShelfPack","isLE","mLen","nBytes","eLen","eMax","eBias","nBits","NaN","rt","Pbf","buf","Varint","Fixed64","Bytes","Fixed32","readPackedEnd","toNum","low","high","isSigned","makeRoomForExtraLength","startPos","extraLen","realloc","writePackedVarint","writeVarint","writePackedSVarint","writeSVarint","writePackedFloat","writeFloat","writePackedDouble","writeDouble","writePackedBoolean","writeBoolean","writePackedFixed32","writeFixed32","writePackedSFixed32","writeSFixed32","writePackedFixed64","writeFixed64","writePackedSFixed64","writeSFixed64","readUInt32","writeInt32","readInt32","readField","skip","readMessage","readFixed32","readSFixed32","readFixed64","readSFixed64","ieee754","readVarintRemainder","bytesPerSequence","fromCharCode","readUtf8","readBytes","readPackedVarint","readPackedSVarint","readPackedBoolean","readPackedFloat","readPackedDouble","readPackedFixed32","readPackedSFixed32","readPackedFixed64","readPackedSFixed64","writeTag","finish","writeBigVarintLow","lsb","writeBigVarintHigh","writeBigVarint","writeString","lead","writeUtf8","writeBytes","writeRawMessage","writeMessage","writeBytesField","writeFixed32Field","writeSFixed32Field","writeFixed64Field","writeSFixed64Field","writeVarintField","writeSVarintField","writeStringField","writeFloatField","writeDoubleField","writeBooleanField","border","readFontstacks","readFontstack","readGlyph","bitmap","advance","metrics","glyph","GLYPH_PBF_BORDER","Actor","mapId","callbacks","callbackID","addEventListener","receive","targetMapId","postMessage","sourceMapId","done","getWorkerSource","remove","removeEventListener","getTileBBox","getMercCoords","resolution","merc_x","merc_y","getURL","baseUrl","format","service","request","srs","CanonicalTileID","calculateKey","urls","scheme","WhooTS","quadkey","mask","getQuadkey","UnwrappedTileID","wrap","canonical","OverscaledTileID","overscaledZ","scaledTo","targetZ","zDifference","isChildOf","children","sourceMaxZoom","isLessThan","wrapped","unwrapTo","overscaleFactor","toUnwrapped","toCoordinate","stride","Level","_idx","DEMData","level","loaded","loadFromImage","encoding","pixels","_unpackData","_unpackMapbox","_unpackTerrarium","unpack","mapbox","terrarium","getPixels","backfillBorder","borderTile","o","_xMin","_xMax","_yMin","_yMax","xMin","xMax","yMin","yMax","DictionaryCoder","strings","_stringToNumber","_numberToString","encode","decode","Feature","vectorTileFeature","_vectorTileFeature","_z","_x","_y","json","FeatureIndex","tileID","featureIndexArray","topDownFeatureComparator","loadVTLayers","vtLayers","vt","VectorTile","Protobuf","rawTileData","sourceLayerCoder","styleLayers","tileSize","featureFilter","queryPadding","matching","previousIndex","featureGeometry","loadMatchingFeature","styleLayer","filterLayerIDs","intersectionTest","layerIDs","bucketLayerIDs","arraysIntersect","sourceLayerName","layerID","geojsonFeature","GeoJSONFeature","layerResult","lookupSymbolFeatures","symbolFeatureIndexes","symbolFeatureIndex","hasLayer","WritingMode","horizontal","vertical","horizontalOnly","whitespace","breakable","calculateBadness","targetWidth","penalty","isLastBreak","raggedness","calculatePenalty","codePoint","nextCodePoint","evaluateBreak","breakIndex","breakX","potentialBreaks","bestPriorBreak","bestBreakBadness","potentialBreak","breakBadness","badness","priorBreak","determineLineBreaks","logicalInput","spacing","maxWidth","potentialLineBreaks","totalWidth","determineAverageLineWidth","currentX","leastBadBreaks","lastLineBreak","getAnchorAlignment","horizontalAlign","verticalAlign","justifyLine","positionedGlyphs","justify","lastAdvance","lineIndent","imgData","img","URL","webkitURL","revokeObjectURL","blob","Blob","createObjectURL","remaining","azimuthal","polar","dMax","video","document","createElement","onloadstart","href","protocol","location","host","crossOrigin","appendChild","deepEqual","header","$0","$1","$2","$3","maxAge","sizeData","partiallyEvaluatedSize","uSizeT","uSize","polygonA","polygonB","completionCallback","lineHeight","textAnchor","textJustify","verticalHeight","trim","nextCharCode","prevCharCode","verticalizePunctuation","shaping","maxLineLength","lineCount","shiftX","shiftY","shapeLines","lineBreakPoints","lineBreak","substring","breakLines","iconOffset","iconAnchor","getKey","refProperties","StyleLayerIndex","layerConfigs","checkMaxAngle","labelLength","windowSize","maxAngle","anchorDistance","recentCorners","recentAngleDelta","current","angleDelta","shift","getAnchors","shapedText","shapedIcon","glyphSize","boxScale","tileExtent","angleWindowSize","isLineContinued","resample","placeAtMiddle","halfLabelLength","markedDistance","anchors","segmentDist","_layerConfigs","_layers","removedIds","layerConfig","createStyleLayer","familiesBySource","groups","group","groupByLayout","sourceId","sourceGroup","sourceLayerId","sourceLayerFamilies","OpacityState","opacity","targetOpacity","time","CollisionFeature","shaped","alignLine","_addLineCollisionCircles","boxSize","nBoxes","overscalingPaddingFactor","nPitchPaddingBoxes","firstBoxOffset","labelStartDistance","paddingStartDistance","segmentLength","boxOffset","boxDistanceToAnchor","segmentBoxDistance","p0","paddedAnchorDistance","TinyQueue","_down","Cell","compareMax","minDistSq","pointToPolygonDist","SQRT2","performSymbolLayout","glyphMap","glyphPositions","imageMap","imagePositions","showCollisionBoxes","tilePixelRatio","compareText","iconsNeedLinear","sizes","compositeTextSizes","compositeIconSizes","layoutTextSize","layoutIconSize","textMaxSize","keepUpright","fontstack","glyphPositionMap","shapedTextOrientations","textOffset","spacingIfAllowed","allowsLetterSpacing","shapeText","shapeIcon","sdfIcons","sdf","fontScale","textBoxScale","textMaxBoxScale","iconBoxScale","symbolMinDistance","textPadding","iconPadding","textMaxAngle","iconAlongLine","textRepeatDistance","addSymbolAtAnchor","lineArray","numIconVertices","numGlyphVertices","numVerticalGlyphVertices","addTextVertices","iconQuads","iconWidth","iconHeight","textLeft","textRight","textTop","textWidth","textHeight","padT","padR","padB","padL","offsetY","matrix","getIconQuads","textOpacityState","iconOpacityState","isDuplicate","crossTileID","addSymbol","clippedLines","clippedLine","clipLine","anchorIsTooClose","poi","findPoleOfInaccessibility","glyphQuads","textRotate","positionedGlyph","rect","rectBuffer","halfAdvance","builtInOffset","center","verticalRotation","xOffsetCorrection","getGlyphQuads","repeatDistance","otherAnchors","_up","peek","halfLength","GlyphAtlas","stackPositions","collectResourceTiming","recalculateLayers","WorkerTile","layerIndex","actor","buckets","layerFamilies","family","maybePrepare","glyphAtlas","imageAtlas","glyphAtlasImage","iconAtlasImage","exported","performance","getEntriesByName","loadVectorTile","vectorTile","rawData","abort","VectorTileWorkerSource","loadVectorData","loading","loadTile","workerTile","resourceTiming","resourceTimingData","perf","reloadTile","vtSource","reloadCallback","abortTile","removeTile","RasterDEMTileWorkerSource","dem","rawImageData","ringArea","middleIndex","coordsLength","wgs84","RADIUS","geometries","rewind","gj","outer","curryOuter","correctRings","correct","wind","geojsonArea","cw","FeatureWrapper","_feature","tags","geometry$1","GeoJSONWrapper","_geojsonTileLayer","rawGeometry","coord","fromVectorTileJs","tile","writeLayer","writeTile","keycache","valuecache","writeFeature","writeValue","writeProperties","writeGeometry","keyIndex","valueIndex","command","zigzag","count","sortKD","ids","nodeSize","depth","select","inc","swapItem","axis","nextAxis","qy","r2","sqDist","getX","getY","ArrayType","KDBush","defaultGetX","defaultGetY","range","within","SuperCluster","trees","maxZoom","createCluster","numPoints","parentId","createPointCluster","lngX","latY","getClusterJSON","cluster","getClusterProperties","abbrev","cluster_id","point_count","point_count_abbreviated","lng","lat","getSqSegDist","createFeature","geom","calcLineBBox","calcBBox","convertFeature","geojson","tolerance","convertPoint","convertLine","convertLines","projectX","projectY","simplify","sqTolerance","maxSqDist","clip","k1","k2","minAll","maxAll","clipped","newGeometry","clipPoints","clipLines","newGeom","trackMetrics","segLen","newSlice","intersect","intersectX","intersectY","az","exited","addPoint","shiftFeatureCoords","newFeatures","shiftCoords","newPolygon","newPoints","transformTile","transformed","z2","transformPoint","createTile","numSimplified","numFeatures","simplified","tileFeature","isOuter","GeoJSONVT","debug","tiles","tileCoords","timeEnd","indexMaxZoom","indexMaxPoints","merged","splitTile","toID","loadGeoJSONTile","_geoJSONIndex","geoJSONTile","getTile","geojsonWrapper","vtpbf","byteOffset","minZoom","reduce","initial","props","load","timerId","clusters","kdbush","_cluster","getClusters","tree","_limitZoom","getChildren","clusterId","clusterZoom","origin","getLeaves","limit","leaves","_appendLeaves","_addTileFeatures","getClusterExpansionZoom","skipped","neighborIds","wx","wy","clusterProperties","_accumulate","numPoints2","cz","k3","k4","z0","GeoJSONWorkerSource","loadGeoJSON","loadData","_pendingCallback","abandoned","_pendingLoadDataParams","_state","_loadData","supercluster","superclusterOptions","geojsonvt","geojsonVtOptions","getJSON","removeSource","Worker","layerIndexes","workerSourceTypes","vector","workerSources","demWorkerSources","registerWorkerSource","WorkerSource","registerRTLTextPlugin","globalRTLTextPlugin","setLayers","getLayerIndex","updateLayers","loadDEMTile","getDEMWorkerSource","removeDEMTile","worker","loadWorkerSource","importScripts","loadRTLTextPlugin","WorkerGlobalScope","isSupported","lastIndexOf","reduceRight","Function","getPrototypeOf","getOwnPropertyNames","isSealed","isFrozen","isExtensible","getOwnPropertyDescriptor","defineProperties","seal","preventExtensions","supported","workerURL","terminate","isWorkerSupported","failIfMajorPerformanceCaveat","isWebGLSupportedCache","canvas","attributes","webGLContextAttributes","probablySupportsContext","supportsContext","getContext","isWebGLSupported","isWebGLSupportedCached","mapboxgl","antialias","stencil","raf","requestAnimationFrame","mozRequestAnimationFrame","webkitRequestAnimationFrame","msRequestAnimationFrame","cancel","cancelAnimationFrame","mozCancelAnimationFrame","webkitCancelAnimationFrame","msCancelAnimationFrame","frame","cancelFrame","getImageData","drawImage","hardwareConcurrency","navigator","devicePixelRatio","supportsWebp","webpImgTest","DOM","tagName","className","container","el","namespaceURI","createElementNS","docStyle","documentElement","testProp","userSelect","selectProp","disableDrag","enableDrag","transformProp","setTransform","passiveSupported","capture","suppressClick","preventDefault","stopPropagation","setTimeout","mousePos","getBoundingClientRect","touches","clientX","clientLeft","clientY","clientTop","touchPos","changedTouches","mouseButton","InstallTrigger","button","ctrlKey","platform","node","parentNode","removeChild","config","API_URL","REQUIRE_ACCESS_TOKEN","ACCESS_TOKEN","help","makeAPIURL","urlObject","accessToken","apiUrlObject","parseUrl","authority","formatUrl","isMapboxURL","normalizeGlyphsURL","normalizeSourceURL","normalizeSpriteURL","extension","imageExtensionRe","normalizeTileURL","tileURL","sourceURL","browser","replaceTempAccessToken","urlRe","parts","HTMLImageElement","HTMLCanvasElement","HTMLVideoElement","Texture","texture","createTexture","useMipmap","bindTexture","TEXTURE_2D","pixelStoreUnpack","RGBA","premultiply","pixelStoreUnpackPremultiplyAlpha","texImage2D","UNSIGNED_BYTE","texSubImage2D","isSizePowerOfTwo","generateMipmap","minFilter","LINEAR_MIPMAP_NEAREST","LINEAR","texParameteri","TEXTURE_MAG_FILTER","TEXTURE_MIN_FILTER","TEXTURE_WRAP_S","TEXTURE_WRAP_T","deleteTexture","ImageManager","requestors","shelfPack","patterns","atlasImage","dirty","setLoaded","_notify","getImage","addImage","removeImage","pattern","getImages","hasAllDependencies","getPixelSize","getPattern","position","dst","atlasTexture","CLAMP_TO_EDGE","TinySDF","INF","fontSize","cutoff","fontFamily","fontWeight","font","textBaseline","fillStyle","gridOuter","Float64Array","gridInner","middle","userAgent","edt","edt1d","draw","clearRect","fillText","alphaChannel","Uint8ClampedArray","GlyphManager","requestTransform","localIdeographFontFamily","entries","setURL","getGlyphs","asyncAll","entry","requests","_tinySDF","loadGlyphRange","cb","tinySDF","LightPositionProperty","sphericalToCartesian","intensity","Light","lightOptions","_transitionable","setLight","_transitioning","getLight","LineAtlas","nextRow","bytes","getDash","dasharray","addDash","stretch","oddLength","partIndex","distLeft","distRight","signedDistance","distMiddle","distEdge","REPEAT","Dispatcher","workerPool","actors","currentActor","uniqueId","workers","acquire","broadcast","targetID","release","LngLat","toBounds","latAccuracy","lngAccuracy","LngLatBounds","sw","ne","setSouthWest","setNorthEast","_ne","_sw","sw2","ne2","getCenter","getSouthWest","getNorthEast","getNorthWest","getWest","getNorth","getSouthEast","getEast","getSouth","TileBounds","validateBounds","contains","VectorTileSource","dispatcher","eventedParent","reparseOverscaled","isTileClipped","pick","_options","_collectResourceTiming","dataType","loadTileJSON","_transformRequest","tileJSON","tileBounds","sourceDataType","hasTile","onAdd","normalizeURL","aborted","_refreshExpiredTiles","setExpiryData","painter","workerID","state","unloadTile","unloadVectorData","RasterTileSource","roundZoom","_loaded","getTileTexture","extTextureFilterAnisotropic","texParameterf","TEXTURE_MAX_ANISOTROPY_EXT","extTextureFilterAnisotropicMax","saveTileTexture","RasterDEMTileSource","needsHillshadePrepare","neighboringTiles","_getNeighboringTiles","pxw","nxw","backfilled","demTexture","fbo","GeoJSONSource","_removed","_data","_resourceTiming","workerOptions","clusterMaxZoom","clusterRadius","_updateWorkerData","setData","onRemove","VertexArrayObject","boundProgram","boundLayoutVertexBuffer","boundPaintVertexBuffers","boundIndexBuffer","boundVertexOffset","boundDynamicVertexBuffer","vao","paintVertexBuffers","dynamicVertexBuffer","dynamicVertexBuffer2","paintBuffersDiffer","isFreshBindRequired","boundDynamicVertexBuffer2","extVertexArrayObject","freshBind","bindVertexArrayOES","dynamicDraw","numPrevAttributes","numNextAttributes","numAttributes","createVertexArrayOES","currentNumAttributes","disableVertexAttribArray","enableAttributes","setVertexAttribPointers","vertexBuffer","vertexBuffer$1","deleteVertexArrayOES","ImageSource","_finishLoading","setCoordinates","cornerZ0Coords","locationCoordinate","centerCoord","getCoordinatesCenter","zoomedCoord","_boundsArray","RasterBoundsArray","boundsBuffer","prepare","rasterBoundsAttributes","boundsVAO","VideoSource","getVideo","loop","_rerender","play","readyState","paused","CanvasSource","animate","getElementById","_hasInvalidDimensions","_playing","pause","getCanvas","sourceTypes","raster","raster-dem","rasterDem","queryRenderedFeatures","sourceCache","maxPitchScaleFactor","tilesIn","sortTilesIn","renderedFeatureLayers","tileIn","wrappedTileID","queryResults","calculatePosMatrix","wrappedIDLayerMap","wrappedID","wrappedIDLayers","tileFeatures","wrappedIDFeatures","resultFeatures","mergeRenderedFeatureLayers","idA","idB","uses","expirationTime","expiredRequestCount","registerFadeDuration","fadeEndTime","timeAdded","wasRequested","justReloaded","hasData","latestFeatureIndex","latestRawTileData","getLayer","deserializeBucket","iconAtlasTexture","glyphAtlasTexture","unloadDEMData","getBucket","uploaded","ALPHA","querySourceFeatures","clearMask","maskedBoundsBuffer","maskedIndexBuffer","setMask","0","maskedBoundsArray","maskArray","maskCoord","vertexExtent","tlVertex","brVertex","parsedCC","parseCacheControl","getTime","isExpired","delta","getExpiryTimeout","TileCache","reset","removedData","timeout","clearTimeout","order","expiryTimeout","dataWrapper","_getAndRemoveByKey","getAndRemove","dataIndex","setMaxSize","IndexBuffer","createBuffer","unbindVAO","bindElementBuffer","bufferData","ELEMENT_ARRAY_BUFFER","DYNAMIC_DRAW","STATIC_DRAW","bufferSubData","deleteBuffer","AttributeType","VertexBuffer","bindVertexBuffer","ARRAY_BUFFER","attribIndex","enableVertexAttribArray","vertexAttribPointer","ClearColor","clearColor","ClearDepth","clearDepth","ClearStencil","clearStencil","ColorMask","colorMask","DepthMask","depthMask","StencilMask","stencilMask","StencilFunc","func","ALWAYS","stencilFunc","StencilOp","KEEP","stencilOp","StencilTest","enable","STENCIL_TEST","disable","DepthRange","depthRange","DepthTest","DEPTH_TEST","DepthFunc","LESS","depthFunc","Blend","BLEND","BlendFunc","ONE","ZERO","blendFunc","BlendColor","blendColor","Program","useProgram","LineWidth","lineWidthRange","clamped","ActiveTextureUnit","TEXTURE0","activeTexture","Viewport","drawingBufferWidth","drawingBufferHeight","viewport","BindFramebuffer","bindFramebuffer","FRAMEBUFFER","BindRenderbuffer","bindRenderbuffer","RENDERBUFFER","BindTexture","BindVertexBuffer","bindBuffer","BindElementBuffer","BindVertexArrayOES","PixelStoreUnpack","pixelStorei","UNPACK_ALIGNMENT","PixelStoreUnpackPremultiplyAlpha","UNPACK_PREMULTIPLY_ALPHA_WEBGL","FramebufferValue","ColorAttachment","framebufferTexture2D","COLOR_ATTACHMENT0","setDirty","DepthAttachment","framebufferRenderbuffer","DEPTH_ATTACHMENT","framebuffer","createFramebuffer","colorAttachment","depthAttachment","Framebuffer","renderbuffer","deleteRenderbuffer","deleteFramebuffer","DepthMode","ReadOnly","ReadWrite","disabled","StencilMode","fail","depthFail","ColorMode","blendFunction","Replace","unblended","alphaBlended","Context","getExtension","getParameter","ALIASED_LINE_WIDTH_RANGE","stencilTest","depthTest","blend","MAX_TEXTURE_MAX_ANISOTROPY_EXT","extTextureHalfFloat","createRenderbuffer","storageFormat","rbo","renderbufferStorage","COLOR_BUFFER_BIT","DEPTH_BUFFER_BIT","setDepthMode","depthMode","setStencilMode","stencilMode","setColorMode","colorMode","SourceCache","_sourceLoaded","_paused","reload","_sourceErrored","_source","createSource","_tiles","_cache","_unloadTile","_timers","_cacheTimers","_maxTileCacheSize","_isIdRenderable","_coveredTiles","getSource","resume","shouldReload","_shouldReloadOnResume","_loadTile","_abortTile","getIds","a_","b_","rotatedA","rotatedB","getRenderableIds","hasRenderableParent","parentTile","findLoadedParent","_reloadTile","_tileLoaded","previousState","refreshedUponExpiration","_setTileReloadTimer","_backfillDEM","tileExtentVAO","renderables","borderId","getTileByID","fillBorder","getZoom","scaleZoom","_findLoadedChildren","maxCoveringZoom","retain","found","minCoveringZoom","updateCacheSize","approxTilesInView","viewDependentMaxSize","handleWrapJump","worldDifference","_prevLng","wrapDelta","idealTileIDs","used","getVisibleUnwrappedCoordinates","unwrapped","coveringTiles","fadedParent","maxOverzooming","maxUnderzooming","_updateRetainedTiles","parentsForFading","isRasterType","_addTile","keysDifference","_removeTile","checked","parentWasRequested","covered","childCoord","childTile","clearTiles","tileResults","tileSpaceBounds","coordinateToTilePoint","tileSpaceQueryGeometry","getVisibleCoordinates","globalWorkerPool","WorkerPool","active","deref","derefLayers","workerCount","WebWorker","operations","setStyle","addLayer","removeLayer","setFilter","addSource","setGeoJSONSourceData","setLayerZoomRange","setLayerProperty","setCenter","setZoom","setBearing","setPitch","setSprite","setGlyphs","after","commands","sourcesRemoved","updateSource","canUpdateGeoJSON","before","isEqual","diffLayerPropertyChanges","pluckId","indexById","diffStyles","pitch","removeOrAddSourceCommands","diffSources","beforeLayers","beforeLayer","afterLayer","insertBeforeLayerId","beforeOrder","afterOrder","beforeIndex","afterIndex","tracker","clean","diffLayers","cellSize","boxCells","circleCells","xCellCount","yCellCount","circleKeys","boxKeys","circles","xScale","yScale","boxUid","circleUid","keysLength","_insertBoxCell","insertCircle","_insertCircleCell","_query","hitTest","queryArgs","_queryCircle","_queryCellCircle","hitTestCircle","boxCell","circleCell","_circleAndRectCollide","_circlesCollide","_convertToXCellCoord","_convertToYCellCoord","r1","bothRadii","circleX","circleY","halfRectWidth","distX","halfRectHeight","distY","symbolLayoutProperties","getLabelPlaneMatrix","pitchWithMap","rotateWithMap","getGlCoordMatrix","xyTransformMat4","signedDistanceFromCamera","isVisible","anchorPos","clippingBuffer","updateLineLabels","isText","labelPlaneMatrix","glCoordMatrix","symbolSize","placedSymbols","aspectRatio","useVertical","hideGlyphs","perspectiveRatio","pitchScaledFontSize","tileAnchorPoint","projectionCache","placeUnflipped","placeGlyphsAlongLine","notEnoughRoom","needsFlipping","placeFirstAndLastGlyph","flip","returnTileDistance","glyphEndIndex","lineEndIndex","firstGlyphOffset","lastGlyphOffset","firstPlacedGlyph","placeGlyphAlongLine","lastPlacedGlyph","requiresOrientationChange","firstPoint","lastPoint","placedGlyphs","firstAndLastGlyph","orientationChange","glyphIndex","tileVertexIndex","tileSegmentEnd","projectedVertex","projectTruncatedLineSegment","singleGlyph","previousTilePoint","currentTilePoint","previousProjectedPoint","minimumLength","projectionMatrix","projectedUnitVertex","projectedUnitSegment","anchorSegment","combinedOffsetX","initialIndex","distanceToPrev","currentSegmentDistance","absOffsetX","projection","previousLineVertexIndex","segmentInterpolationT","prevToCurrent","prevTileDistance","lastSegmentViewportDistance","hiddenGlyphAttributes","glmatrix","CollisionIndex","ignoredGrid","pitchfactor","_pitch","screenRightBoundary","screenBottomBoundary","markCollisionCircleUsed","collisionCircles","placeCollisionBox","allowOverlap","textPixelRatio","projectedPoint","projectAndGetPerspectiveRatio","tileToViewport","tlX","tlY","brX","brY","offscreen","isOffscreen","approximateTileDistance","lastSegmentAngle","cameraToAnchorDistance","incidenceStretch","lastSegmentTile","placeCollisionCircles","showCollisionCircles","placedCollisionCircles","projectedAnchor","projectAnchor","tileUnitAnchorPoint","collisionDetected","entirelyOffscreen","firstTileDistance","lastTileDistance","cameraDistance","tileUnitRadius","boxSignedDistanceFromAnchor","nextBoxDistanceToAnchor","collisionBoxArrayIndex","queryRenderedSymbols","viewportQueryGeometry","gridPoint","seenFeatures","featureKey","bucketInstanceId","intersectionTests","insertCollisionBox","ignorePlacement","insertCollisionCircles","prevState","increment","placed","skipFade","JointOpacityState","placedText","JointPlacement","Placement","collisionIndex","placements","opacities","stale","retainedQueryData","updateCollisionVertices","notUsed","placeLayerTile","seenCrossTileIDs","symbolBucket","bucketFeatureIndex","textLabelPlaneMatrix","iconLabelPlaneMatrix","placeLayerBucket","partiallyEvaluatedTextSize","iconWithoutText","textWithoutIcon","placeText","placeIcon","placedGlyphBoxes","placedGlyphCircles","placedIconBoxes","commit","prevPlacement","commitTime","placementChanged","prevOpacities","jointPlacement","prevOpacity","jointOpacity","lastPlacementChangeTime","updateLayerOpacities","updateBucketOpacities","duplicateOpacityState","defaultOpacityState","opacityState","packedOpacity","packOpacity","opacityEntryCount","symbolFadeChange","hasTransitions","stillRecent","setStale","shift25","shift24","shift17","shift16","shift9","shift8","shift1","targetBit","opacityBits","LayerPlacement","_currentTileIndex","_seenCrossTileIDs","continuePlacement","placement","shouldPausePlacement","PauseablePlacement","forceFullPlacement","_currentPlacementIndex","_forceFullPlacement","_showCollisionBoxes","_done","isDone","layerTiles","startTime","elapsedTime","placementZoom","_inProgressLayer","previousPlacement","roundingFactor","TileLayerIndex","indexedSymbolInstances","getScaledCoordinates","childTileID","findMatches","newTileID","zoomCrossTileIDs","indexedInstances","scaledSymbolCoord","thisTileSymbol","CrossTileIDs","maxCrossTileID","generate","CrossTileSymbolLayerIndex","indexes","usedCrossTileIDs","zoomIndexes","newZoomIndex","addBucket","crossTileIDs","removeBucketCrossTileIDs","childIndex","parentIndex","symbolInstance$1","removedBucket","removeStaleBuckets","currentIDs","tilesChanged","tileKey","CrossTileSymbolIndex","maxBucketInstanceId","bucketsInCurrentPlacement","symbolBucketsChanged","currentBucketIDs","pruneUnusedLayers","usedLayers","usedLayerMap","usedLayer","_emitValidationErrors","supportedDiffOperations","diffOperations","ignoredDiffOperations","imageManager","glyphManager","lineAtlas","crossTileSymbolIndex","_order","sourceCaches","_resetUpdates","_rtlTextPluginCallback","registerForPluginAvailability","vectorLayerIds","_validateLayer","loadURL","normalizeStyleURL","_load","loadJSON","stylesheet","loadSprite","_serializeLayers","_updatedSources","_checkLoaded","_changed","updatedIds","_updatedLayers","_removedLayers","_updateWorkerLayers","action","_reloadSource","_clearSource","_updatedPaintProps","setState","nextState","changes","unimplementedOps","isSourceLoaded","layerObject","_layerOrderChanged","removed","_updateLayer","moveLayer","newIndex","getFilter","wasDataDriven","_flattenRenderedFeatures","sourceResults","layerFeatures","includedSources","worldCoordinate","renderedSymbols","bucketQueryData","queryData","bucketSymbols","layerSymbols","sortedA","sourceID","dataTiles","dataID","addSourceType","SourceType","getSourceType","setSourceType","workerSourceURL","_update","_remove","rtlTextPluginEvented","_updateSources","_generateCollisionBoxes","_updatePlacement","placementCommitted","layerBucketsChanged","pauseablePlacement","configuration","showOverdrawInspector","createProgram","toFixed","fragmentSource","shaders","prelude","vertexSource","fragmentShader","createShader","FRAGMENT_SHADER","shaderSource","compileShader","attachShader","vertexShader","VERTEX_SHADER","bindAttribLocation","linkProgram","getProgramParameter","ACTIVE_ATTRIBUTES","attribute","getActiveAttrib","getAttribLocation","numUniforms","ACTIVE_UNIFORMS","uniform","getActiveUniform","getUniformLocation","computeTileMasks","rootTile","childArray","lowerBound","diffZ","maskTileId","drawCollisionDebugGeometry","drawCircles","colorModeForRenderPass","uniformMatrix4fv","u_matrix","u_camera_to_center_distance","u_pixels_to_tile_units","uniform2f","u_extrude_scale","pixelsToGLUnits","u_overscale_factor","TRIANGLES","LINES","drawMode","dynamicLayoutBuffer","dynamicLayoutBuffer2","primitiveSize","drawElements","UNSIGNED_SHORT","identityMat4","drawLayerSymbols","rotationAlignment","pitchAlignment","rotateInShader","depthOn","depthModeForSublayer","programConfiguration","isSDF","setSymbolDrawState","uniform1i","u_texture","uniform2fv","u_texsize","iconScaled","iconTransformed","rotating","zooming","NEAREST","translatePosMatrix","symbolProjection","u_gl_coord_matrix","u_label_plane_matrix","u_fade_change","drawTileSymbols","u_pitch_with_map","u_is_text","u_pitch","u_is_size_zoom_constant","u_is_size_feature_constant","u_size_t","u_size","u_aspect_ratio","u_rotate_symbol","hasHalo","gammaScale","u_gamma_scale","u_is_halo","drawSymbolElements","drawLineTile","programChanged","tileRatioChanged","posA","posB","imagePosA","imagePosB","tileRatio","widthA","widthB","u_patternscale_a","u_patternscale_b","u_sdfgamma","u_pattern_size_a","u_pattern_size_b","u_gl_units_to_pixels","u_image","u_tex_y_a","u_tex_y_b","u_mix","u_pattern_tl_a","u_pattern_br_a","u_pattern_tl_b","u_pattern_br_b","u_fade","stencilModeForClipping","u_ratio","isPatternMissing","u_scale_a","u_scale_b","setPatternUniforms","u_tile_units_to_pixels","numTiles","tileSizeAtNearestZoom","pixelX","pixelY","u_pixel_coord_upper","u_pixel_coord_lower","drawFillTiles","drawFn","firstTile","drawFillTile","setFillProgram","drawStrokeTile","u_world","programId","pat","prevProgram","preparePattern","glMatrix","drawExtrusion","u_height_factor","_lp","lightPos","lightMat","uniform3fv","u_lightpos","u_lightintensity","uniform3f","u_lightcolor","renderHillshade","u_light","latRange","coordinate0","coordinate1","coordinateLocation","getTileLatRange","u_latrange","shadowColor","u_shadow","highlightColor","u_highlight","accentColor","u_accent","rasterBoundsBuffer","rasterBoundsVAO","drawArrays","TRIANGLE_STRIP","prepareHillshade","pixelData","TEXTURE1","renderTexture","u_zoom","u_dimension","u_maxzoom","getFadeValues","sinceTile","sinceParent","idealZ","coveringZoomLevel","fadeIn","childOpacity","mix","drawDebugTile","u_color","debugVAO","debugBuffer","LINE_STRIP","baseline","len2","strokes","simplexFont","createTextVerticies","debugTextArray","PosArray","debugTextBuffer","posAttributes","onePixel","translations","translation"," ","\"","'","1","2","3","4","5","6","7","8","9","A","B","C","D","F","G","H","I","J","K","L","M","O","P","Q","R","S","T","U","V","W","X","Y","Z","renderPass","drawCollisionDebug","strokeWidth","strokeOpacity","u_scale_with_map","bindTextureToFramebuffer","HALF_FLOAT_OES","checkFramebufferStatus","FRAMEBUFFER_COMPLETE","u_intensity","u_opacity","u_color_ramp","viewportVAO","viewportBuffer","renderTextureToMap","prevTileZoom","renderTarget","depthRboNeedsClear","setupOffscreenDepthRenderbuffer","depthRbo","LEQUAL","drawToExtrusionFramebuffer","renderedTexture","drawExtrusionTexture","tileIDs","saturation","contrast","u_brightness_low","u_brightness_high","u_saturation_factor","u_contrast_factor","u_spin_weights","spinWeights","u_buffer_scale","u_image0","u_image1","minTileZ","fade","parentScaleBy","parentTL","u_tl_parent","u_scale_parent","u_fade_t","tileExtentPatternVAO","tileExtentBuffer","uniform4fv","Painter","_tileTextures","setup","numSublayers","depthEpsilon","emptyProgramConfiguration","edge","scanSpans","e0","ymin","ymax","scanLine","m0","d0","d1","scanTriangle","bc","ca","tileExtentArray","debugArray","rasterBoundsArray","viewportArray","_renderTileClippingMasks","idNext","_tileClippingMaskIDs","REPLACE","EQUAL","_showOverdrawInspector","CONSTANT_COLOR","farDepth","currentLayer","nearDepth","render","rasterSources","sc","updateTileMasks","coords$1","sourceCache$2","renderLayer","coords$2","sourceCache$3","coords$3","sourceCache$4","showTileBoundaries","DEPTH_COMPONENT16","inViewportPixelUnitsUnits","sinA","cosA","translatedMatrix","textures","_createProgramCached","cache","nextProgram","Transform","renderWorldCopies","_renderWorldCopies","_minZoom","_maxZoom","_center","_fov","_unmodified","_posMatrixCache","_alignedPosMatrixCache","_calcMatrices","worldSize","centerPoint","rotationMatrix","fov","_zoom","zoomScale","zoomFraction","_constrain","ul","pointCoordinate","ur","w0","actualZ","tileCover","unmodified","lnglat","unproject","xLng","yLat","setLocationAtPoint","locationPoint","coordinatePoint","pointLocation","coord0","coord1","pixelMatrixInverse","z1","pixelMatrix","unwrappedTileID","aligned","posMatrixKey","unwrappedX","alignedProjMatrix","projMatrix","_constraining","sy","sx","lngRange","halfFov","groundAngle","topHalfSurfaceDistance","farZ","verticalScale","xShift","yShift","angleCos","angleSin","alignedM","Hash","pending","later","_updateHash","_updateHashUnthrottled","addTo","_map","_onHashChange","getHashString","mapFeedback","precision","LN10","getBearing","getPitch","hash","loc","jumpTo","history","replaceState","MapMouseEvent","originalEvent","getCanvasContainer","lngLat","_defaultPrevented","defaultPrevented","MapTouchEvent","lngLats","curr","MapWheelEvent","ScrollZoomHandler","_el","_delta","isEnabled","_enabled","isActive","_active","_aroundCenter","around","onWheel","deltaMode","WheelEvent","DOM_DELTA_LINE","deltaY","timeDelta","_lastWheelEventTime","_type","_lastValue","_timeout","_onTimeout","shiftKey","_lastWheelEvent","_start","initialEvent","_frameId","_cancelRenderFrame","_finishTimeout","_around","_aroundPoint","_requestRenderFrame","_onScrollFrame","zoomRate","_targetZoom","_startZoom","_easing","_smoothOutEasing","finished","easing","_ease","_prevEase","speed","BoxZoomHandler","_container","getContainer","onMouseDown","_onMouseMove","_onKeyDown","_onMouseUp","_startPos","_box","classList","_fireEvent","_finish","fitBounds","linear","boxZoomBounds","keyCode","inertiaEasing","DragRotateHandler","element","_button","_bearingSnap","bearingSnap","_pitchWithRotate","pitchWithRotate","_unbind","_deactivate","_eventButton","_onBlur","_inertia","_previousPos","_lastMoveEvent","_pos","_onDragFrame","bearingDiff","pitchDiff","inertia","_drainInertiaBuffer","_normalizeBearing","_inertialRotate","mapBearing","resetNorth","noMoveStart","previous","flingDiff","sign","flingDuration","rotateTo","DragPanHandler","_onMove","onTouchStart","passive","_onTouchEnd","_inertialPan","flingOffset","velocity","panBy","KeyboardHandler","easeOut","altKey","metaKey","zoomDir","bearingDir","pitchDir","xDir","yDir","easeOptions","delayEndEvents","easeTo","DoubleClickZoomHandler","_tapped","onDblClick","_onZoomEnd","TouchZoomRotateHandler","disableRotation","_rotationDisabled","enableRotation","onStart","_startVec","_gestureIntent","_onEnd","_getTouchEventData","vec","scalingSignificantly","_lastTouchEvent","_onTouchFrame","gestureIntent","_startScale","_startBearing","aroundPoint","startScale","snapToNorth","lastScale","firstScale","scaleOffset","scaleDuration","targetScale","handlers","scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","Camera","_moving","_zooming","eventData","panTo","zoomIn","zoomOut","paddingOffset","lateralPadding","verticalPadding","nw","se","scaleX","scaleY","flyTo","zoomChanged","bearingChanged","pitchChanged","defaultEasing","startZoom","startBearing","startPitch","pointAtOffset","locationAtOffset","_normalizeCenter","finalScale","_rotating","_pitching","_prepareEase","_easeEndTimeoutID","speedup","newCenter","_fireMoveEvents","_afterEase","wasZooming","wasRotating","wasPitching","curve","rho","u1","wMax","rho2","sinh","cosh","r0","screenSpeed","maxDuration","isEasing","_easeFrameId","_onEaseFrame","_onEaseEnd","onEaseEnd","_easeStart","_easeOptions","_renderFrameCallback","currentBearing","diff","AttributionControl","getDefaultPosition","compact","_updateAttributions","_updateEditLink","_updateData","_updateCompact","editLink","_editLink","querySelector","styleOwner","styleId","paramString","acc","_hash","attributions","owner","attribution","attrib","innerHTML","offsetWidth","LogoControl","setAttribute","display","_updateLogo","_logoRequired","mapbox_logo","TaskQueue","_queue","_id","_cleared","_currentlyRunning","cancelled","running","task","run","HTMLElement","defaultOptions","interactive","attributionControl","preserveDrawingBuffer","trackResize","refreshExpiredTiles","maxTileCacheSize","transformRequest","Map","_interactive","_failIfMajorPerformanceCaveat","_preserveDrawingBuffer","_trackResize","_fadeDuration","_crossFadingFactor","_renderTaskQueue","transformRequestFn","maxBounds","setMaxBounds","_setupContainer","_setupPainter","_onWindowOnline","_onWindowResize","contextMenuEvent","mouseDown","mapEvent","toElement","bindHandlers","addControl","logoPosition","_onData","_onDataLoading","control","controlElement","positionContainer","_controlPositions","insertBefore","firstChild","removeControl","_containerDimensions","_resizeCanvas","getBounds","getMaxBounds","lnglatbounds","setMinZoom","getMinZoom","setMaxZoom","getRenderWorldCopies","setRenderWorldCopies","getMaxZoom","isMoving","isZooming","isRotating","delegatedListener","mousein","delegates","_delegatedListeners","listeners","_makeQueryGeometry","pointOrBox","getStyle","isStyleLoaded","areTilesLoaded","hasImage","loadImage","beforeId","_canvasContainer","_canvas","offsetHeight","_missingCSSContainer","canvasContainer","_contextLost","_contextRestored","controlContainer","_controlContainer","positionName","_styleDirty","_sourcesDirty","updateStyle","_render","crossFading","factor","_placementDirty","_repaint","loseContext","_showTileBoundaries","repaint","_vertices","showCompass","showZoom","NavigationControl","_zoomInButton","_createButton","_zoomOutButton","_compass","_compassArrow","_rotateCompassArrow","_handler","ariaLabel","anchorTranslate","top-left","top-right","bottom-left","bottom-right","applyAnchorClass","prefix","Marker","_anchor","_color","_element","_offset","_defaultMarker","svg","createNS","setAttributeNS","markerLarge","page1","shadow","rx","ry","ellipse","bgPath","borderPath","maki","circleContainer","circle1","circle2","_popup","_onMapClick","getLngLat","_lngLat","setLngLat","getElement","setPopup","popup","linearOffset","markerHeight","targetElement","togglePopup","getPopup","isOpen","smartWrap","getOffset","setOffset","supportsGeolocation","positionOptions","enableHighAccuracy","maximumAge","fitBoundsOptions","trackUserLocation","showUserLocation","GeolocateControl","_setupUI","permissions","then","geolocation","_geolocationWatchID","clearWatch","_userLocationDotMarker","_onSuccess","_lastKnownPosition","_watchState","_geolocateButton","_updateMarker","_updateCamera","_dotElement","longitude","latitude","accuracy","geolocateSource","_onError","code","_clearWatch","_timeoutId","trigger","_setup","watchPosition","getCurrentPosition","ScaleControl","updateScale","latlng1","latlng2","lat1","lat2","clientHeight","maxMeters","maxFeet","setScale","maxDistance","pow10","ratio","setUnit","FullscreenControl","_fullscreen","_fullscreenchange","_className","_mapContainer","_checkFullscreenSupport","_changeIcon","fullscreenEnabled","mozFullScreenEnabled","msFullscreenEnabled","webkitFullscreenEnabled","_fullscreenButton","_onClickFullscreen","_isFullscreen","fullscreenElement","mozFullScreenElement","webkitFullscreenElement","msFullscreenElement","toggle","exitFullscreen","mozCancelFullScreen","msExitFullscreen","webkitCancelFullScreen","requestFullscreen","mozRequestFullScreen","msRequestFullscreen","webkitRequestFullscreen","closeButton","closeOnClick","Popup","_onClickClose","_content","setText","setDOMContent","createTextNode","setHTML","html","frag","createDocumentFragment","temp","htmlNode","_createContent","_closeButton","_tip","normalizeOffset","cornerOffset","convertedOffset","anchorComponents","offsetedPos","setRTLTextPlugin","token","workerUrl"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;wTA4BAA,MAAiBC,EAEjB,SAASA,EAAWC,EAAKC,EAAKC,EAAKC,GAE/BC,KAAKC,GAAK,EAAML,EAChBI,KAAKE,GAAK,GAAOJ,EAAMF,GAAOI,KAAKC,GACnCD,KAAKG,GAAK,EAAMH,KAAKC,GAAKD,KAAKE,GAE/BF,KAAKI,GAAK,EAAMP,EAChBG,KAAKK,GAAK,GAAON,EAAMF,GAAOG,KAAKI,GACnCJ,KAAKM,GAAK,EAAMN,KAAKI,GAAKJ,KAAKK,GAE/BL,KAAKJ,IAAMA,EACXI,KAAKH,IAAME,EACXC,KAAKF,IAAMA,EACXE,KAAKD,IAAMA,GAGfJ,EAAWY,UAAUC,aAAe,SAASC,GAEzC,aAAcN,GAAKM,EAAIT,KAAKE,IAAMO,EAAIT,KAAKC,IAAMQ,GAGrDd,EAAWY,UAAUG,aAAe,SAASD,GACzC,aAAcH,GAAKG,EAAIT,KAAKK,IAAMI,EAAIT,KAAKI,IAAMK,GAGrDd,EAAWY,UAAUI,uBAAyB,SAASF,GACnD,SAAcT,KAAKG,GAAKM,EAAI,EAAMT,KAAKE,IAAMO,EAAIT,KAAKC,IAG1DN,EAAWY,UAAUK,YAAc,SAASC,EAAGC,OAGvCC,EAAIC,EAAIC,EAAIC,EAAIC,EAGpB,SALuB,IAAZL,IAAyBA,EAAU,MAKzCG,EAAKJ,EAAGM,EAAI,EAAGA,EAAI,EAAGA,IAAK,CAG5B,GADAD,OAAUV,aAAaS,GAAMJ,EACzBO,KAAKC,IAAIH,GAAMJ,EAAS,OAAOG,EAEnC,I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