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ACjC,EAAU,KAAK,KAAK,UAAU,WAAW,KAAK,QAAQ,QAAU,GAChE,EAAW,KAAK,UAAU,UAAU,GAGpC,EAAU,KAAK,KAAK,QAAQ,EAAE,OAAQ,EAAE,MACvC,UAAU,GACV,KAAK,KAAK,KAAK,iBACf,IAAI,IAAU,SACf,EAAS,KAAK,KAAK,QAAQ,KAAK,KAAK,YAAY,eAAgB,EAAE,MAClE,UAAU,GAEf,EAAE,QAAQ,aACN,KAAK,OAAO,cACZ,EAAO,SAAS,KAAK,SACrB,EAER,EAEA,WAAY,SAAU,GAClB,KAAK,UAAW,CACpB,EAEA,SAAU,WACN,IAAI,EAAQ,KAAK,KAAK,aAAa,KAAK,KAAK,WAE7C,EAAE,QAAQ,aACN,KAAK,OAAO,cAEZ,KACA,GAGJ,KAAK,UAAW,EAEhB,KAAK,SACT,EAEA,eAAgB,SAAU,GACtB,EAAE,KAAK,kBAAiB,WACpB,IAAI,EAAO,KAAK,KAAK,UACjB,EAAS,KAAK,KAAK,YACnB,EAAS,KAAK,KAAK,uBACnB,KAAK,KAAK,YAAY,gBAI1B,EAAE,QAAQ,aAAa,KAAK,OAAO,cAAe,EAAQ,GAG1D,KAAK,OAAO,KAAK,UAAW,EAAE,KAAK,MAAK,WACpC,KAAK,UACT,GAAG,OAGH,KAAK,OAAO,OAAO,CACf,OAAQ,EACR,KAAM,EAAO,GAErB,GAAG,KACP,EAEA,QAAS,SAAU,GACf,KAAK,eAAe,EACxB,IAGJ,EAAE,SAAW,SAAU,GACnB,OAAO,IAAI,EAAE,SAAS,EAC1B,CAEJ","file":"/npm/mapbox-gl-leaflet@0.0.16/leaflet-mapbox-gl.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/mapbox-gl-leaflet@0.0.16/leaflet-mapbox-gl.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","(function (root, factory) {\n    if (typeof define === 'function' && define.amd) {\n        // AMD\n        define(['leaflet', 'mapbox-gl'], factory);\n    } else if (typeof exports === 'object') {\n        // Node, CommonJS-like\n        module.exports = factory(require('leaflet'), require('mapbox-gl'));\n    } else {\n        // Browser globals (root is window)\n        root.returnExports = factory(window.L, window.mapboxgl);\n    }\n}(this, function (L, mapboxgl) {\n    L.MapboxGL = L.Layer.extend({\n            options: {\n            updateInterval: 32,\n            // How much to extend the overlay view (relative to map size)\n            // e.g. 0.1 would be 10% of map view in each direction\n            padding: 0.1,\n            // whether or not to register the mouse and keyboard\n            // events on the mapbox overlay\n            interactive: false,\n            // set the tilepane as the default pane to draw gl tiles\n            pane: 'tilePane'\n        },\n\n        initialize: function (options) {\n            L.setOptions(this, options);\n\n            if (options.accessToken) {\n                mapboxgl.accessToken = options.accessToken;\n            }\n\n            // setup throttling the update event when panning\n            this._throttledUpdate = L.Util.throttle(this._update, this.options.updateInterval, this);\n        },\n\n        onAdd: function (map) {\n            if (!this._container) {\n                this._initContainer();\n            }\n\n            var paneName = this.getPaneName();\n            map.getPane(paneName).appendChild(this._container);\n            \n            this._initGL();\n\n            this._offset = this._map.containerPointToLayerPoint([0, 0]);\n\n            // work around https://github.com/mapbox/mapbox-gl-leaflet/issues/47\n            if (map.options.zoomAnimation) {\n                L.DomEvent.on(map._proxy, L.DomUtil.TRANSITION_END, this._transitionEnd, this);\n            }\n            \n            map._addZoomLimit(this);\n        },\n\n        onRemove: function (map) {\n            if (this._map._proxy && this._map.options.zoomAnimation) {\n                L.DomEvent.off(this._map._proxy, L.DomUtil.TRANSITION_END, this._transitionEnd, this);\n            }\n            var paneName = this.getPaneName();\n            map.getPane(paneName).removeChild(this._container);\n        },\n\n        getEvents: function () {\n            return {\n                move: this._throttledUpdate, // sensibly throttle updating while panning\n                zoomanim: this._animateZoom, // applys the zoom animation to the <canvas>\n                zoom: this._pinchZoom, // animate every zoom event for smoother pinch-zooming\n                zoomstart: this._zoomStart, // flag starting a zoom to disable panning\n                zoomend: this._zoomEnd,\n                resize: this._resize\n            };\n        },\n\n        getMapboxMap: function () {\n            return this._glMap;\n        },\n\n        getCanvas: function () {\n            return this._glMap.getCanvas();\n        },\n\n        getSize: function () {\n            return this._map.getSize().multiplyBy(1 + this.options.padding * 2);\n        },\n\n        getBounds: function () {\n            var halfSize = this.getSize().multiplyBy(0.5);\n            var center = this._map.latLngToContainerPoint(this._map.getCenter());\n            return L.latLngBounds(\n                this._map.containerPointToLatLng(center.subtract(halfSize)),\n                this._map.containerPointToLatLng(center.add(halfSize))\n            );\n        },\n\n        getContainer: function () {\n            return this._container;\n        },\n        \n        // returns the pane name set in options if it is a valid pane, defaults to tilePane\n        getPaneName: function () {\n            return this._map.getPane(this.options.pane) ? this.options.pane : 'tilePane'; \n        },\n        \n        _initContainer: function () {\n            var container = this._container = L.DomUtil.create('div', 'leaflet-gl-layer');\n\n            var size = this.getSize();\n            var offset = this._map.getSize().multiplyBy(this.options.padding);\n            container.style.width  = size.x + 'px';\n            container.style.height = size.y + 'px';\n\n            var topLeft = this._map.containerPointToLayerPoint([0, 0]).subtract(offset);\n\n            L.DomUtil.setPosition(container, topLeft);\n        },\n\n        _initGL: function () {\n            var center = this._map.getCenter();\n\n            var options = L.extend({}, this.options, {\n                container: this._container,\n                center: [center.lng, center.lat],\n                zoom: this._map.getZoom() - 1,\n                attributionControl: false\n            });\n\n            if (!this._glMap) this._glMap = new mapboxgl.Map(options);\n            else {\n                this._glMap.setCenter(options.center);\n                this._glMap.setZoom(options.zoom);\n            }\n\n            // allow GL base map to pan beyond min/max latitudes\n            this._glMap.transform.latRange = null;\n            this._transformGL(this._glMap);\n\n            if (this._glMap._canvas.canvas) {\n                // older versions of mapbox-gl surfaced the canvas differently\n                this._glMap._actualCanvas = this._glMap._canvas.canvas;\n            } else {\n                this._glMap._actualCanvas = this._glMap._canvas;\n            }\n\n            // treat child <canvas> element like L.ImageOverlay\n            var canvas = this._glMap._actualCanvas;\n            L.DomUtil.addClass(canvas, 'leaflet-image-layer');\n            L.DomUtil.addClass(canvas, 'leaflet-zoom-animated');\n            if (this.options.interactive) {\n                L.DomUtil.addClass(canvas, 'leaflet-interactive');\n            }\n            if (this.options.className) {\n                L.DomUtil.addClass(canvas, this.options.className);\n            }\n        },\n\n        _update: function (e) {\n            if (!this._map) {\n                return;\n            }\n            // update the offset so we can correct for it later when we zoom\n            this._offset = this._map.containerPointToLayerPoint([0, 0]);\n\n            if (this._zooming) {\n                return;\n            }\n\n            var size = this.getSize(),\n                container = this._container,\n                gl = this._glMap,\n                offset = this._map.getSize().multiplyBy(this.options.padding),\n                topLeft = this._map.containerPointToLayerPoint([0, 0]).subtract(offset);\n\n            L.DomUtil.setPosition(container, topLeft);\n\n            this._transformGL(gl);\n\n            var x_round = Math.round(size.x), y_round = Math.round(size.y);\n\n            if (Math.round(gl.transform.width) !== x_round || Math.round(gl.transform.height) !== y_round) {\n                container.style.width  = x_round + 'px';\n                container.style.height = y_round + 'px';\n                if (gl._resize !== null && gl._resize !== undefined){\n                    gl._resize();\n                } else {\n                    gl.resize();\n                }\n            } else {\n                // older versions of mapbox-gl surfaced update publicly\n                if (gl._update !== null && gl._update !== undefined){\n                    gl._update();\n                } else {\n                    gl.update();\n                }\n            }\n        },\n\n        _transformGL: function (gl) {\n            var center = this._map.getCenter();\n\n            // gl.setView([center.lat, center.lng], this._map.getZoom() - 1, 0);\n            // calling setView directly causes sync issues because it uses requestAnimFrame\n\n            var tr = gl.transform;\n            tr.center = mapboxgl.LngLat.convert([center.lng, center.lat]);\n            tr.zoom = this._map.getZoom() - 1;\n        },\n\n        // update the map constantly during a pinch zoom\n        _pinchZoom: function (e) {\n            this._glMap.jumpTo({\n                zoom: this._map.getZoom() - 1,\n                center: this._map.getCenter()\n            });\n        },\n\n        // borrowed from L.ImageOverlay\n        // https://github.com/Leaflet/Leaflet/blob/master/src/layer/ImageOverlay.js#L139-L144\n        _animateZoom: function (e) {\n            var scale = this._map.getZoomScale(e.zoom);\n            var padding = this._map.getSize().multiplyBy(this.options.padding * scale);\n            var viewHalf = this.getSize()._divideBy(2);\n            // corrections for padding (scaled), adapted from\n            // https://github.com/Leaflet/Leaflet/blob/master/src/map/Map.js#L1490-L1508\n            var topLeft = this._map.project(e.center, e.zoom)\n                ._subtract(viewHalf)\n                ._add(this._map._getMapPanePos()\n                .add(padding))._round();\n            var offset = this._map.project(this._map.getBounds().getNorthWest(), e.zoom)\n                ._subtract(topLeft);\n\n            L.DomUtil.setTransform(\n                this._glMap._actualCanvas,\n                offset.subtract(this._offset),\n                scale\n            );\n        },\n\n        _zoomStart: function (e) {\n            this._zooming = true;\n        },\n\n        _zoomEnd: function () {\n            var scale = this._map.getZoomScale(this._map.getZoom());\n\n            L.DomUtil.setTransform(\n                this._glMap._actualCanvas,\n                // https://github.com/mapbox/mapbox-gl-leaflet/pull/130\n                null,\n                scale\n            );\n\n            this._zooming = false;\n\n            this._update();\n        },\n\n        _transitionEnd: function (e) {\n            L.Util.requestAnimFrame(function () {\n                var zoom = this._map.getZoom();\n                var center = this._map.getCenter();\n                var offset = this._map.latLngToContainerPoint(\n                    this._map.getBounds().getNorthWest()\n                );\n\n                // reset the scale and offset\n                L.DomUtil.setTransform(this._glMap._actualCanvas, offset, 1);\n\n                // enable panning once the gl map is ready again\n                this._glMap.once('moveend', L.Util.bind(function () {\n                    this._zoomEnd();\n                }, this));\n\n                // update the map position\n                this._glMap.jumpTo({\n                    center: center,\n                    zoom: zoom - 1\n                });\n            }, this);\n        },\n\n        _resize: function (e) {\n            this._transitionEnd(e);\n        }\n    });\n\n    L.mapboxGL = function (options) {\n        return new L.MapboxGL(options);\n    };\n\n}));\n\n"]}