From c85ea89f75b8402b7bc6ce7310496497d516fdb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20de=20Metz?= Date: Sat, 2 Oct 2021 17:42:30 +0200 Subject: [PATCH] Release version 0.0.4. --- dist/openlayers-indoorequal.cjs.js | 595 ++++++++++--------------- dist/openlayers-indoorequal.esm.js | 568 ++++++++++------------- dist/openlayers-indoorequal.umd.min.js | 4 +- package.json | 2 +- 4 files changed, 467 insertions(+), 702 deletions(-) diff --git a/dist/openlayers-indoorequal.cjs.js b/dist/openlayers-indoorequal.cjs.js index 609662a..4641771 100644 --- a/dist/openlayers-indoorequal.cjs.js +++ b/dist/openlayers-indoorequal.cjs.js @@ -9,11 +9,8 @@ var MVT = require('ol/format/MVT'); var proj = require('ol/proj'); var TileGrid = require('ol/tilegrid/TileGrid'); var control = require('ol/control'); +var style = require('ol/style'); var BaseObject = require('ol/Object'); -var Style = require('ol/style/Style'); -var Fill = require('ol/style/Fill'); -var Stroke = require('ol/style/Stroke'); -var Text = require('ol/style/Text'); function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } @@ -23,166 +20,6 @@ var TileJSON__default = /*#__PURE__*/_interopDefaultLegacy(TileJSON); var MVT__default = /*#__PURE__*/_interopDefaultLegacy(MVT); var TileGrid__default = /*#__PURE__*/_interopDefaultLegacy(TileGrid); var BaseObject__default = /*#__PURE__*/_interopDefaultLegacy(BaseObject); -var Style__default = /*#__PURE__*/_interopDefaultLegacy(Style); -var Fill__default = /*#__PURE__*/_interopDefaultLegacy(Fill); -var Stroke__default = /*#__PURE__*/_interopDefaultLegacy(Stroke); -var Text__default = /*#__PURE__*/_interopDefaultLegacy(Text); - -function ownKeys(object, enumerableOnly) { - var keys = Object.keys(object); - - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(object); - - if (enumerableOnly) { - symbols = symbols.filter(function (sym) { - return Object.getOwnPropertyDescriptor(object, sym).enumerable; - }); - } - - keys.push.apply(keys, symbols); - } - - return keys; -} - -function _objectSpread2(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? arguments[i] : {}; - - if (i % 2) { - ownKeys(Object(source), true).forEach(function (key) { - _defineProperty(target, key, source[key]); - }); - } else if (Object.getOwnPropertyDescriptors) { - Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); - } else { - ownKeys(Object(source)).forEach(function (key) { - Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); - }); - } - } - - return target; -} - -function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } -} - -function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } -} - -function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - return Constructor; -} - -function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - - return obj; -} - -function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); - } - - subClass.prototype = Object.create(superClass && superClass.prototype, { - constructor: { - value: subClass, - writable: true, - configurable: true - } - }); - if (superClass) _setPrototypeOf(subClass, superClass); -} - -function _getPrototypeOf(o) { - _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { - return o.__proto__ || Object.getPrototypeOf(o); - }; - return _getPrototypeOf(o); -} - -function _setPrototypeOf(o, p) { - _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }; - - return _setPrototypeOf(o, p); -} - -function _isNativeReflectConstruct() { - if (typeof Reflect === "undefined" || !Reflect.construct) return false; - if (Reflect.construct.sham) return false; - if (typeof Proxy === "function") return true; - - try { - Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); - return true; - } catch (e) { - return false; - } -} - -function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } - - return self; -} - -function _possibleConstructorReturn(self, call) { - if (call && (typeof call === "object" || typeof call === "function")) { - return call; - } else if (call !== void 0) { - throw new TypeError("Derived constructors may only return object or undefined"); - } - - return _assertThisInitialized(self); -} - -function _createSuper(Derived) { - var hasNativeReflectConstruct = _isNativeReflectConstruct(); - - return function _createSuperInternal() { - var Super = _getPrototypeOf(Derived), - result; - - if (hasNativeReflectConstruct) { - var NewTarget = _getPrototypeOf(this).constructor; - - result = Reflect.construct(Super, arguments, NewTarget); - } else { - result = Super.apply(this, arguments); - } - - return _possibleConstructorReturn(this, result); - }; -} function extentFromTileJSON(tileJSON) { var bounds = tileJSON.bounds; @@ -194,10 +31,10 @@ function extentFromTileJSON(tileJSON) { } } -var defaultResolutions = function () { - var resolutions = []; +const defaultResolutions = function () { + const resolutions = []; - for (var res = 78271.51696402048; resolutions.length <= 24; res /= 2) { + for (let res = 78271.51696402048; resolutions.length <= 24; res /= 2) { resolutions.push(res); } @@ -205,13 +42,13 @@ var defaultResolutions = function () { }(); function onTileJSONLoaded(layer, tilejson) { - var tileJSONDoc = tilejson.getTileJSON(); - var tiles = Array.isArray(tileJSONDoc.tiles) ? tileJSONDoc.tiles : [tileJSONDoc.tiles]; - var tileGrid = tilejson.getTileGrid(); - var extent = extentFromTileJSON(tileJSONDoc); - var minZoom = tileJSONDoc.minzoom; - var maxZoom = tileJSONDoc.maxzoom; - var source = new VectorTileSource__default["default"]({ + const tileJSONDoc = tilejson.getTileJSON(); + const tiles = Array.isArray(tileJSONDoc.tiles) ? tileJSONDoc.tiles : [tileJSONDoc.tiles]; + const tileGrid = tilejson.getTileGrid(); + const extent = extentFromTileJSON(tileJSONDoc); + const minZoom = tileJSONDoc.minzoom; + const maxZoom = tileJSONDoc.maxzoom; + const source = new VectorTileSource__default["default"]({ attributions: tilejson.getAttributions(), format: new MVT__default["default"](), tileGrid: new TileGrid__default["default"]({ @@ -228,15 +65,16 @@ function onTileJSONLoaded(layer, tilejson) { } function getLayer(url, options) { - var layer = new VectorTileLayer__default["default"](_objectSpread2({ + const layer = new VectorTileLayer__default["default"]({ declutter: true, - visible: false - }, options)); - var tilejson = new TileJSON__default["default"]({ - url: url + visible: false, + ...options + }); + const tilejson = new TileJSON__default["default"]({ + url }); tilejson.on('change', function () { - var state = tilejson.getState(); + const state = tilejson.getState(); if (state === 'ready') { onTileJSONLoaded(layer, tilejson); @@ -258,133 +96,90 @@ function getLayer(url, options) { * @return {LevelControl} `this` */ -var LevelControl = /*#__PURE__*/function (_Control) { - _inherits(LevelControl, _Control); - - var _super = _createSuper(LevelControl); - - function LevelControl(indoorEqual) { - var _this; - - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - _classCallCheck(this, LevelControl); - - var element = document.createElement('div'); +class LevelControl extends control.Control { + constructor(indoorEqual, options = {}) { + const element = document.createElement('div'); element.className = 'level-control ol-unselectable ol-control'; - _this = _super.call(this, { - element: element, + super({ + element, target: options.target }); - _this.indoorEqual = indoorEqual; - - _this._renderNewLevels(); - - _this.indoorEqual.on('change:levels', _this._renderNewLevels.bind(_assertThisInitialized(_this))); + this.indoorEqual = indoorEqual; - _this.indoorEqual.on('change:level', _this._renderNewLevels.bind(_assertThisInitialized(_this))); + this._renderNewLevels(); - return _this; + this.indoorEqual.on('change:levels', this._renderNewLevels.bind(this)); + this.indoorEqual.on('change:level', this._renderNewLevels.bind(this)); } - _createClass(LevelControl, [{ - key: "_renderNewLevels", - value: function _renderNewLevels() { - var _this2 = this; + _renderNewLevels() { + this.element.innerHTML = ''; + const currentLevel = this.indoorEqual.get('level'); + this.indoorEqual.get('levels').forEach(level => { + const button = document.createElement('button'); - this.element.innerHTML = ''; - var currentLevel = this.indoorEqual.get('level'); - this.indoorEqual.get('levels').forEach(function (level) { - var button = document.createElement('button'); + if (currentLevel === level) { + button.classList.add('level-control-active'); + } - if (currentLevel === level) { - button.classList.add('level-control-active'); - } - - button.textContent = level; - button.addEventListener('click', function () { - _this2.indoorEqual.set('level', level); - }); - - _this2.element.appendChild(button); + button.textContent = level; + button.addEventListener('click', () => { + this.indoorEqual.set('level', level); }); - } - }]); - - return LevelControl; -}(control.Control); - -function findAllLevels(features) { - var levels = []; - - for (var i = 0; i < features.length; i++) { - var feature = features[i]; - var properties = feature.getProperties(); - - if (properties.layer !== 'area' || properties["class"] === 'level') { - continue; - } - - var level = properties.level; - - if (!levels.includes(level)) { - levels.push(level); - } + this.element.appendChild(button); + }); } - return levels.sort(function (a, b) { - return a - b; - }).reverse(); } function areaLayer(feature, resolution) { - var properties = feature.getProperties(); + const properties = feature.getProperties(); - if (properties["class"] === 'level') { + if (properties.class === 'level') { return; } - var color = '#fdfcfa'; + let color = '#fdfcfa'; if (properties.access && ['no', 'private'].includes(properties.access)) { color = '#F2F1F0'; - } else if (properties.is_poi && properties["class"] !== 'corridor') { + } else if (properties.is_poi && properties.class !== 'corridor') { color = '#D4EDFF'; - } else if (properties["class"] === 'room') { + } else if (properties.class === 'room') { color = '#fefee2'; } - var stroke; + let stroke; - if (properties.layer === 'area' && ['area', 'corridor', 'plaform'].includes(properties["class"])) { - stroke = new Stroke__default["default"]({ + if (properties.layer === 'area' && ['area', 'corridor', 'plaform'].includes(properties.class)) { + stroke = new style.Stroke({ color: '#bfbfbf', width: 1 }); } - if (properties.layer === 'area' && properties["class"] === 'column') { + if (properties.layer === 'area' && properties.class === 'column') { color = '#bfbfbf'; } - if (properties.layer === 'area' && ['room', 'wall'].includes(properties["class"])) { - stroke = new Stroke__default["default"]({ + if (properties.layer === 'area' && ['room', 'wall'].includes(properties.class)) { + stroke = new style.Stroke({ color: 'gray', width: 2 }); } - return new Style__default["default"]({ - fill: new Fill__default["default"]({ - color: color + return new style.Style({ + fill: new style.Fill({ + color }), - stroke: stroke + stroke }); } function transportationLayer(feature, resolution) { - return new Style__default["default"]({ - stroke: new Stroke__default["default"]({ + return new style.Style({ + stroke: new style.Stroke({ color: 'gray', width: 2, lineDash: [4, 7] @@ -393,51 +188,148 @@ function transportationLayer(feature, resolution) { } function areanameLayer(feature, resolution) { - return new Style__default["default"]({ - text: new Text__default["default"]({ + return new style.Style({ + text: new style.Text({ + font: '13px Noto Sans Regular, sans-serif', text: feature.getProperties().name, - fill: new Fill__default["default"]({ + fill: new style.Fill({ color: '#666' + }), + stroke: new style.Stroke({ + color: 'white', + width: 1 }) }) }); } -function poiLayer(feature, resolution) { - return new Style__default["default"]({ - text: new Text__default["default"]({ - text: feature.getProperties().name, - fill: new Fill__default["default"]({ +function poiLayer(feature, resolution, map, sprite) { + const properties = feature.getProperties(); + const zoom = map.getView().getZoomForResolution(resolution); + + if (zoom < 19 && ['waste_basket', 'information', 'vending_machine'].includes(properties.class)) { + return; + } + + let icon; + + if (sprite) { + const iconDef = sprite.json['indoorequal-' + properties.subclass] || sprite.json['indoorequal-' + properties.class]; + + if (iconDef) { + icon = new style.Icon({ + img: sprite.png, + size: [iconDef.width, iconDef.height], + offset: [iconDef.x, iconDef.y], + imgSize: [sprite.png.width, sprite.png.height] + }); + } + } + + return new style.Style({ + text: new style.Text({ + font: '11px Noto Sans Regular, sans-serif', + text: properties.name, + fill: new style.Fill({ color: '#666' + }), + offsetY: 18, + stroke: new style.Stroke({ + color: 'white', + width: 1 }) - }) + }), + image: icon }); } -function defaultStyle(feature, resolution) { - var properties = feature.getProperties(); +function loadAsImage(spriteImageUrl) { + return new Promise((resolve, reject) => { + const img = new Image(); + img.crossOrigin = 'anonymous'; - if (properties.layer === 'area') { - return areaLayer(feature); - } + img.onload = function () { + img.onload = null; + resolve(img); + }; - if (properties.layer === 'transportation') { - return transportationLayer(); - } + img.onerror = reject; + img.src = spriteImageUrl; + }); +} + +async function loadSprite(basePath) { + const spriteScale = window.devicePixelRatio >= 1.5 ? 0.5 : 1; + const sizeFactor = spriteScale == 0.5 ? '@2x' : ''; + let spriteUrl = basePath + sizeFactor + '.json'; + const spriteJSON = await (await fetch(spriteUrl, { + credentials: 'same-origin' + })).json(); + const spritePNG = await loadAsImage(basePath + sizeFactor + '.png'); + return { + json: spriteJSON, + png: spritePNG + }; +} + +function defaultStyle(map, layer, spriteBaseUrl) { + let sprite = null; - if (properties.layer === 'area_name') { - return areanameLayer(feature); + if (spriteBaseUrl) { + loadSprite(spriteBaseUrl).then(spriteData => { + layer.changed(); + sprite = spriteData; + }); } - if (properties.layer === 'poi' && feature.getType() === 'Point') { - return poiLayer(feature); + return function (feature, resolution) { + const properties = feature.getProperties(); + + if (properties.layer === 'area') { + return areaLayer(feature); + } + + if (properties.layer === 'transportation') { + return transportationLayer(); + } + + if (properties.layer === 'area_name') { + return areanameLayer(feature); + } + + if (properties.layer === 'poi' && feature.getType() === 'Point') { + return poiLayer(feature, resolution, map, sprite); + } + }; +} + +function findAllLevels(features) { + const levels = []; + + for (let i = 0; i < features.length; i++) { + const feature = features[i]; + const properties = feature.getProperties(); + + if (properties.layer !== 'area' || properties.class === 'level') { + continue; + } + + const level = properties.level; + + if (!levels.includes(level)) { + levels.push(level); + } } + + return levels.sort((a, b) => a - b).reverse(); } /** * Load the indoor= source and layers in your map. * @param {object} map the OpenLayers instance of the map * @param {object} options + * @param {boolean} [options.defaultStyle] False to not set the default style. Default true. + * @param {string} [options.spriteBaseUrl] The base url of the sprite (without .json or .png). If not set, no sprite will be used in the default style. * @param {string} [options.url] Override the default tiles URL (https://tiles.indoorequal.org/). * @param {string} [options.apiKey] The API key if you use the default tile URL (get your free key at [indoorequal.com](https://indoorequal.com)). * @fires change:levels @@ -445,44 +337,36 @@ function defaultStyle(feature, resolution) { * @return {IndoorEqual} `this` */ -var IndoorEqual = /*#__PURE__*/function (_BaseObject) { - _inherits(IndoorEqual, _BaseObject); - - var _super = _createSuper(IndoorEqual); - - function IndoorEqual(map) { - var _this; - - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - _classCallCheck(this, IndoorEqual); - - var defaultOpts = { - url: 'https://tiles.indoorequal.org/' +class IndoorEqual extends BaseObject__default["default"] { + constructor(map, options = {}) { + const defaultOpts = { + url: 'https://tiles.indoorequal.org/', + defaultStyle: true, + spriteBaseUrl: null + }; + const opts = { ...defaultOpts, + ...options }; - - var opts = _objectSpread2(_objectSpread2({}, defaultOpts), options); if (opts.url === defaultOpts.url && !opts.apiKey) { throw 'You must register your apiKey at https://indoorequal.com before and set it as apiKey param.'; } - _this = _super.call(this, { + super({ levels: [], level: '0' }); - _this.map = map; - _this.url = opts.url; - _this.apiKey = opts.apiKey; - _this.styleFunction = defaultStyle; + this.map = map; + this.url = opts.url; + this.apiKey = opts.apiKey; - _this._addLayer(); + this._addLayer(); - _this._changeLayerOnLevelChange(); + this.styleFunction = opts.defaultStyle ? defaultStyle(this.map, this.layer, opts.spriteBaseUrl) : null; - _this._setLayerStyle(); + this._changeLayerOnLevelChange(); - return _this; + this._setLayerStyle(); } /** * Set the style for displayed features. This function takes a feature and resolution and returns an array of styles. If set to null, the layer has no style (a null style), so only features that have their own styles will be rendered in the layer. Call setStyle() without arguments to reset to the default style. See module:ol/style for information on the default style. @@ -490,62 +374,59 @@ var IndoorEqual = /*#__PURE__*/function (_BaseObject) { */ - _createClass(IndoorEqual, [{ - key: "setStyle", - value: function setStyle(styleFunction) { - this.styleFunction = styleFunction; - } - }, { - key: "_addLayer", - value: function _addLayer() { - var urlParams = this.apiKey ? "?key=".concat(this.apiKey) : ''; - this.layer = getLayer("".concat(this.url).concat(urlParams)); - this.map.addLayer(this.layer); - - this._listenForLevels(); - } - }, { - key: "_listenForLevels", - value: function _listenForLevels() { - var _this2 = this; - - this.layer.on('change:source', function () { - var source = _this2.layer.getSource(); + setStyle(styleFunction) { + this.styleFunction = styleFunction; + } - source.on('tileloadend', function () { - var extent = _this2.map.getView().calculateExtent(_this2.map.getSize()); + _addLayer() { + const urlParams = this.apiKey ? `?key=${this.apiKey}` : ''; + this.layer = getLayer(`${this.url}${urlParams}`); + this.map.addLayer(this.layer); - var features = source.getFeaturesInExtent(extent); + this._listenForLevels(); + } - _this2.set('levels', findAllLevels(features)); - }); + _listenForLevels() { + this.layer.on('change:source', () => { + const source = this.layer.getSource(); + source.on('tileloadend', () => { + const extent = this.map.getView().calculateExtent(this.map.getSize()); + const features = source.getFeaturesInExtent(extent); + this.set('levels', findAllLevels(features)); }); - } - }, { - key: "_changeLayerOnLevelChange", - value: function _changeLayerOnLevelChange() { - var _this3 = this; + }); + } - this.on('change:level', function () { - _this3.layer.changed(); - }); - } - }, { - key: "_setLayerStyle", - value: function _setLayerStyle() { - var _this4 = this; - - this.layer.setStyle(function (feature, resolution) { - if (feature.getProperties().level === _this4.get('level')) { - return _this4.styleFunction && _this4.styleFunction(feature, resolution); - } - }); - } - }]); + _changeLayerOnLevelChange() { + this.on('change:level', () => { + this.layer.changed(); + }); + } + + _setLayerStyle() { + this.layer.setStyle((feature, resolution) => { + if (feature.getProperties().level === this.get('level')) { + return this.styleFunction && this.styleFunction(feature, resolution); + } + }); + } + +} +/** + * Emitted when the list of available levels has been updated + * + * @event IndoorEqual#change:levels + * @type {array} + */ - return IndoorEqual; -}(BaseObject__default["default"]); +/** + * Emitted when the current level has been updated + * + * @event IndoorEqual#levelchange + * @type {string} always emitted when the level displayed has changed + */ exports.LevelControl = LevelControl; exports["default"] = IndoorEqual; +exports.defaultStyle = defaultStyle; exports.getLayer = getLayer; diff --git a/dist/openlayers-indoorequal.esm.js b/dist/openlayers-indoorequal.esm.js index 023f34e..d0d8a10 100644 --- a/dist/openlayers-indoorequal.esm.js +++ b/dist/openlayers-indoorequal.esm.js @@ -5,167 +5,8 @@ import MVT from 'ol/format/MVT'; import { fromLonLat } from 'ol/proj'; import TileGrid from 'ol/tilegrid/TileGrid'; import { Control } from 'ol/control'; +import { Style, Stroke, Text, Fill, Icon } from 'ol/style'; import BaseObject from 'ol/Object'; -import Style from 'ol/style/Style'; -import Fill from 'ol/style/Fill'; -import Stroke from 'ol/style/Stroke'; -import Text from 'ol/style/Text'; - -function ownKeys(object, enumerableOnly) { - var keys = Object.keys(object); - - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(object); - - if (enumerableOnly) { - symbols = symbols.filter(function (sym) { - return Object.getOwnPropertyDescriptor(object, sym).enumerable; - }); - } - - keys.push.apply(keys, symbols); - } - - return keys; -} - -function _objectSpread2(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? arguments[i] : {}; - - if (i % 2) { - ownKeys(Object(source), true).forEach(function (key) { - _defineProperty(target, key, source[key]); - }); - } else if (Object.getOwnPropertyDescriptors) { - Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); - } else { - ownKeys(Object(source)).forEach(function (key) { - Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); - }); - } - } - - return target; -} - -function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } -} - -function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } -} - -function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - return Constructor; -} - -function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - - return obj; -} - -function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); - } - - subClass.prototype = Object.create(superClass && superClass.prototype, { - constructor: { - value: subClass, - writable: true, - configurable: true - } - }); - if (superClass) _setPrototypeOf(subClass, superClass); -} - -function _getPrototypeOf(o) { - _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { - return o.__proto__ || Object.getPrototypeOf(o); - }; - return _getPrototypeOf(o); -} - -function _setPrototypeOf(o, p) { - _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }; - - return _setPrototypeOf(o, p); -} - -function _isNativeReflectConstruct() { - if (typeof Reflect === "undefined" || !Reflect.construct) return false; - if (Reflect.construct.sham) return false; - if (typeof Proxy === "function") return true; - - try { - Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); - return true; - } catch (e) { - return false; - } -} - -function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } - - return self; -} - -function _possibleConstructorReturn(self, call) { - if (call && (typeof call === "object" || typeof call === "function")) { - return call; - } else if (call !== void 0) { - throw new TypeError("Derived constructors may only return object or undefined"); - } - - return _assertThisInitialized(self); -} - -function _createSuper(Derived) { - var hasNativeReflectConstruct = _isNativeReflectConstruct(); - - return function _createSuperInternal() { - var Super = _getPrototypeOf(Derived), - result; - - if (hasNativeReflectConstruct) { - var NewTarget = _getPrototypeOf(this).constructor; - - result = Reflect.construct(Super, arguments, NewTarget); - } else { - result = Super.apply(this, arguments); - } - - return _possibleConstructorReturn(this, result); - }; -} function extentFromTileJSON(tileJSON) { var bounds = tileJSON.bounds; @@ -177,10 +18,10 @@ function extentFromTileJSON(tileJSON) { } } -var defaultResolutions = function () { - var resolutions = []; +const defaultResolutions = function () { + const resolutions = []; - for (var res = 78271.51696402048; resolutions.length <= 24; res /= 2) { + for (let res = 78271.51696402048; resolutions.length <= 24; res /= 2) { resolutions.push(res); } @@ -188,13 +29,13 @@ var defaultResolutions = function () { }(); function onTileJSONLoaded(layer, tilejson) { - var tileJSONDoc = tilejson.getTileJSON(); - var tiles = Array.isArray(tileJSONDoc.tiles) ? tileJSONDoc.tiles : [tileJSONDoc.tiles]; - var tileGrid = tilejson.getTileGrid(); - var extent = extentFromTileJSON(tileJSONDoc); - var minZoom = tileJSONDoc.minzoom; - var maxZoom = tileJSONDoc.maxzoom; - var source = new VectorTileSource({ + const tileJSONDoc = tilejson.getTileJSON(); + const tiles = Array.isArray(tileJSONDoc.tiles) ? tileJSONDoc.tiles : [tileJSONDoc.tiles]; + const tileGrid = tilejson.getTileGrid(); + const extent = extentFromTileJSON(tileJSONDoc); + const minZoom = tileJSONDoc.minzoom; + const maxZoom = tileJSONDoc.maxzoom; + const source = new VectorTileSource({ attributions: tilejson.getAttributions(), format: new MVT(), tileGrid: new TileGrid({ @@ -211,15 +52,16 @@ function onTileJSONLoaded(layer, tilejson) { } function getLayer(url, options) { - var layer = new VectorTileLayer(_objectSpread2({ + const layer = new VectorTileLayer({ declutter: true, - visible: false - }, options)); - var tilejson = new TileJSON({ - url: url + visible: false, + ...options + }); + const tilejson = new TileJSON({ + url }); tilejson.on('change', function () { - var state = tilejson.getState(); + const state = tilejson.getState(); if (state === 'ready') { onTileJSONLoaded(layer, tilejson); @@ -241,116 +83,73 @@ function getLayer(url, options) { * @return {LevelControl} `this` */ -var LevelControl = /*#__PURE__*/function (_Control) { - _inherits(LevelControl, _Control); - - var _super = _createSuper(LevelControl); - - function LevelControl(indoorEqual) { - var _this; - - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - _classCallCheck(this, LevelControl); - - var element = document.createElement('div'); +class LevelControl extends Control { + constructor(indoorEqual, options = {}) { + const element = document.createElement('div'); element.className = 'level-control ol-unselectable ol-control'; - _this = _super.call(this, { - element: element, + super({ + element, target: options.target }); - _this.indoorEqual = indoorEqual; - - _this._renderNewLevels(); - - _this.indoorEqual.on('change:levels', _this._renderNewLevels.bind(_assertThisInitialized(_this))); + this.indoorEqual = indoorEqual; - _this.indoorEqual.on('change:level', _this._renderNewLevels.bind(_assertThisInitialized(_this))); + this._renderNewLevels(); - return _this; + this.indoorEqual.on('change:levels', this._renderNewLevels.bind(this)); + this.indoorEqual.on('change:level', this._renderNewLevels.bind(this)); } - _createClass(LevelControl, [{ - key: "_renderNewLevels", - value: function _renderNewLevels() { - var _this2 = this; + _renderNewLevels() { + this.element.innerHTML = ''; + const currentLevel = this.indoorEqual.get('level'); + this.indoorEqual.get('levels').forEach(level => { + const button = document.createElement('button'); - this.element.innerHTML = ''; - var currentLevel = this.indoorEqual.get('level'); - this.indoorEqual.get('levels').forEach(function (level) { - var button = document.createElement('button'); + if (currentLevel === level) { + button.classList.add('level-control-active'); + } - if (currentLevel === level) { - button.classList.add('level-control-active'); - } - - button.textContent = level; - button.addEventListener('click', function () { - _this2.indoorEqual.set('level', level); - }); - - _this2.element.appendChild(button); + button.textContent = level; + button.addEventListener('click', () => { + this.indoorEqual.set('level', level); }); - } - }]); - - return LevelControl; -}(Control); - -function findAllLevels(features) { - var levels = []; - - for (var i = 0; i < features.length; i++) { - var feature = features[i]; - var properties = feature.getProperties(); - - if (properties.layer !== 'area' || properties["class"] === 'level') { - continue; - } - - var level = properties.level; - - if (!levels.includes(level)) { - levels.push(level); - } + this.element.appendChild(button); + }); } - return levels.sort(function (a, b) { - return a - b; - }).reverse(); } function areaLayer(feature, resolution) { - var properties = feature.getProperties(); + const properties = feature.getProperties(); - if (properties["class"] === 'level') { + if (properties.class === 'level') { return; } - var color = '#fdfcfa'; + let color = '#fdfcfa'; if (properties.access && ['no', 'private'].includes(properties.access)) { color = '#F2F1F0'; - } else if (properties.is_poi && properties["class"] !== 'corridor') { + } else if (properties.is_poi && properties.class !== 'corridor') { color = '#D4EDFF'; - } else if (properties["class"] === 'room') { + } else if (properties.class === 'room') { color = '#fefee2'; } - var stroke; + let stroke; - if (properties.layer === 'area' && ['area', 'corridor', 'plaform'].includes(properties["class"])) { + if (properties.layer === 'area' && ['area', 'corridor', 'plaform'].includes(properties.class)) { stroke = new Stroke({ color: '#bfbfbf', width: 1 }); } - if (properties.layer === 'area' && properties["class"] === 'column') { + if (properties.layer === 'area' && properties.class === 'column') { color = '#bfbfbf'; } - if (properties.layer === 'area' && ['room', 'wall'].includes(properties["class"])) { + if (properties.layer === 'area' && ['room', 'wall'].includes(properties.class)) { stroke = new Stroke({ color: 'gray', width: 2 @@ -359,9 +158,9 @@ function areaLayer(feature, resolution) { return new Style({ fill: new Fill({ - color: color + color }), - stroke: stroke + stroke }); } @@ -378,49 +177,146 @@ function transportationLayer(feature, resolution) { function areanameLayer(feature, resolution) { return new Style({ text: new Text({ + font: '13px Noto Sans Regular, sans-serif', text: feature.getProperties().name, fill: new Fill({ color: '#666' + }), + stroke: new Stroke({ + color: 'white', + width: 1 }) }) }); } -function poiLayer(feature, resolution) { +function poiLayer(feature, resolution, map, sprite) { + const properties = feature.getProperties(); + const zoom = map.getView().getZoomForResolution(resolution); + + if (zoom < 19 && ['waste_basket', 'information', 'vending_machine'].includes(properties.class)) { + return; + } + + let icon; + + if (sprite) { + const iconDef = sprite.json['indoorequal-' + properties.subclass] || sprite.json['indoorequal-' + properties.class]; + + if (iconDef) { + icon = new Icon({ + img: sprite.png, + size: [iconDef.width, iconDef.height], + offset: [iconDef.x, iconDef.y], + imgSize: [sprite.png.width, sprite.png.height] + }); + } + } + return new Style({ text: new Text({ - text: feature.getProperties().name, + font: '11px Noto Sans Regular, sans-serif', + text: properties.name, fill: new Fill({ color: '#666' + }), + offsetY: 18, + stroke: new Stroke({ + color: 'white', + width: 1 }) - }) + }), + image: icon }); } -function defaultStyle(feature, resolution) { - var properties = feature.getProperties(); +function loadAsImage(spriteImageUrl) { + return new Promise((resolve, reject) => { + const img = new Image(); + img.crossOrigin = 'anonymous'; - if (properties.layer === 'area') { - return areaLayer(feature); - } + img.onload = function () { + img.onload = null; + resolve(img); + }; - if (properties.layer === 'transportation') { - return transportationLayer(); - } + img.onerror = reject; + img.src = spriteImageUrl; + }); +} + +async function loadSprite(basePath) { + const spriteScale = window.devicePixelRatio >= 1.5 ? 0.5 : 1; + const sizeFactor = spriteScale == 0.5 ? '@2x' : ''; + let spriteUrl = basePath + sizeFactor + '.json'; + const spriteJSON = await (await fetch(spriteUrl, { + credentials: 'same-origin' + })).json(); + const spritePNG = await loadAsImage(basePath + sizeFactor + '.png'); + return { + json: spriteJSON, + png: spritePNG + }; +} + +function defaultStyle(map, layer, spriteBaseUrl) { + let sprite = null; - if (properties.layer === 'area_name') { - return areanameLayer(feature); + if (spriteBaseUrl) { + loadSprite(spriteBaseUrl).then(spriteData => { + layer.changed(); + sprite = spriteData; + }); } - if (properties.layer === 'poi' && feature.getType() === 'Point') { - return poiLayer(feature); + return function (feature, resolution) { + const properties = feature.getProperties(); + + if (properties.layer === 'area') { + return areaLayer(feature); + } + + if (properties.layer === 'transportation') { + return transportationLayer(); + } + + if (properties.layer === 'area_name') { + return areanameLayer(feature); + } + + if (properties.layer === 'poi' && feature.getType() === 'Point') { + return poiLayer(feature, resolution, map, sprite); + } + }; +} + +function findAllLevels(features) { + const levels = []; + + for (let i = 0; i < features.length; i++) { + const feature = features[i]; + const properties = feature.getProperties(); + + if (properties.layer !== 'area' || properties.class === 'level') { + continue; + } + + const level = properties.level; + + if (!levels.includes(level)) { + levels.push(level); + } } + + return levels.sort((a, b) => a - b).reverse(); } /** * Load the indoor= source and layers in your map. * @param {object} map the OpenLayers instance of the map * @param {object} options + * @param {boolean} [options.defaultStyle] False to not set the default style. Default true. + * @param {string} [options.spriteBaseUrl] The base url of the sprite (without .json or .png). If not set, no sprite will be used in the default style. * @param {string} [options.url] Override the default tiles URL (https://tiles.indoorequal.org/). * @param {string} [options.apiKey] The API key if you use the default tile URL (get your free key at [indoorequal.com](https://indoorequal.com)). * @fires change:levels @@ -428,44 +324,36 @@ function defaultStyle(feature, resolution) { * @return {IndoorEqual} `this` */ -var IndoorEqual = /*#__PURE__*/function (_BaseObject) { - _inherits(IndoorEqual, _BaseObject); - - var _super = _createSuper(IndoorEqual); - - function IndoorEqual(map) { - var _this; - - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - _classCallCheck(this, IndoorEqual); - - var defaultOpts = { - url: 'https://tiles.indoorequal.org/' +class IndoorEqual extends BaseObject { + constructor(map, options = {}) { + const defaultOpts = { + url: 'https://tiles.indoorequal.org/', + defaultStyle: true, + spriteBaseUrl: null + }; + const opts = { ...defaultOpts, + ...options }; - - var opts = _objectSpread2(_objectSpread2({}, defaultOpts), options); if (opts.url === defaultOpts.url && !opts.apiKey) { throw 'You must register your apiKey at https://indoorequal.com before and set it as apiKey param.'; } - _this = _super.call(this, { + super({ levels: [], level: '0' }); - _this.map = map; - _this.url = opts.url; - _this.apiKey = opts.apiKey; - _this.styleFunction = defaultStyle; + this.map = map; + this.url = opts.url; + this.apiKey = opts.apiKey; - _this._addLayer(); + this._addLayer(); - _this._changeLayerOnLevelChange(); + this.styleFunction = opts.defaultStyle ? defaultStyle(this.map, this.layer, opts.spriteBaseUrl) : null; - _this._setLayerStyle(); + this._changeLayerOnLevelChange(); - return _this; + this._setLayerStyle(); } /** * Set the style for displayed features. This function takes a feature and resolution and returns an array of styles. If set to null, the layer has no style (a null style), so only features that have their own styles will be rendered in the layer. Call setStyle() without arguments to reset to the default style. See module:ol/style for information on the default style. @@ -473,60 +361,56 @@ var IndoorEqual = /*#__PURE__*/function (_BaseObject) { */ - _createClass(IndoorEqual, [{ - key: "setStyle", - value: function setStyle(styleFunction) { - this.styleFunction = styleFunction; - } - }, { - key: "_addLayer", - value: function _addLayer() { - var urlParams = this.apiKey ? "?key=".concat(this.apiKey) : ''; - this.layer = getLayer("".concat(this.url).concat(urlParams)); - this.map.addLayer(this.layer); - - this._listenForLevels(); - } - }, { - key: "_listenForLevels", - value: function _listenForLevels() { - var _this2 = this; - - this.layer.on('change:source', function () { - var source = _this2.layer.getSource(); + setStyle(styleFunction) { + this.styleFunction = styleFunction; + } - source.on('tileloadend', function () { - var extent = _this2.map.getView().calculateExtent(_this2.map.getSize()); + _addLayer() { + const urlParams = this.apiKey ? `?key=${this.apiKey}` : ''; + this.layer = getLayer(`${this.url}${urlParams}`); + this.map.addLayer(this.layer); - var features = source.getFeaturesInExtent(extent); + this._listenForLevels(); + } - _this2.set('levels', findAllLevels(features)); - }); + _listenForLevels() { + this.layer.on('change:source', () => { + const source = this.layer.getSource(); + source.on('tileloadend', () => { + const extent = this.map.getView().calculateExtent(this.map.getSize()); + const features = source.getFeaturesInExtent(extent); + this.set('levels', findAllLevels(features)); }); - } - }, { - key: "_changeLayerOnLevelChange", - value: function _changeLayerOnLevelChange() { - var _this3 = this; + }); + } - this.on('change:level', function () { - _this3.layer.changed(); - }); - } - }, { - key: "_setLayerStyle", - value: function _setLayerStyle() { - var _this4 = this; - - this.layer.setStyle(function (feature, resolution) { - if (feature.getProperties().level === _this4.get('level')) { - return _this4.styleFunction && _this4.styleFunction(feature, resolution); - } - }); - } - }]); + _changeLayerOnLevelChange() { + this.on('change:level', () => { + this.layer.changed(); + }); + } + + _setLayerStyle() { + this.layer.setStyle((feature, resolution) => { + if (feature.getProperties().level === this.get('level')) { + return this.styleFunction && this.styleFunction(feature, resolution); + } + }); + } + +} +/** + * Emitted when the list of available levels has been updated + * + * @event IndoorEqual#change:levels + * @type {array} + */ - return IndoorEqual; -}(BaseObject); +/** + * Emitted when the current level has been updated + * + * @event IndoorEqual#levelchange + * @type {string} always emitted when the level displayed has changed + */ -export { LevelControl, IndoorEqual as default, getLayer }; +export { LevelControl, IndoorEqual as default, defaultStyle, getLayer }; diff --git a/dist/openlayers-indoorequal.umd.min.js b/dist/openlayers-indoorequal.umd.min.js index c52213c..c67c974 100644 --- a/dist/openlayers-indoorequal.umd.min.js +++ b/dist/openlayers-indoorequal.umd.min.js @@ -1,3 +1,3 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).IndoorEqual={})}(this,(function(t){"use strict";function e(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function i(t){for(var i=1;it.length)&&(e=t.length);for(var i=0,n=new Array(e);ie?1:t0)},e.prototype.removeEventListener=function(t,e){var i=this.listeners_&&this.listeners_[t];if(i){var n=i.indexOf(e);-1!==n&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=C,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}},e}(v),R="change",I="error",M="load";function k(t,e,i,n,r){if(n&&n!==t&&(i=i.bind(n)),r){var o=i;i=function(){t.removeEventListener(e,i),o.apply(this,arguments)}}var s={target:t,type:e,listener:i};return t.addEventListener(e,i),s}function L(t,e,i,n){return k(t,e,i,n,!0)}function j(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),b(t))}var A=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),D=function(t){function e(){var e=t.call(this)||this;return e.on=e.onInternal,e.once=e.onceInternal,e.un=e.unInternal,e.revision_=0,e}return A(e,t),e.prototype.changed=function(){++this.revision_,this.dispatchEvent(R)},e.prototype.getRevision=function(){return this.revision_},e.prototype.onInternal=function(t,e){if(Array.isArray(t)){for(var i=t.length,n=new Array(i),r=0;r1?(i=r,n=o):l>0&&(i+=s*l,n+=a*l)}return at(t,e,i,n)}function at(t,e,i,n){var r=i-t,o=n-e;return r*r+o*o}function lt(t){return t*Math.PI/180}function ht(t,e){var i=t%e;return i*e<0?i+e:i}function ut(t,e,i){return t+i*(e-t)}var ct=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),ft=function(t){function e(e){var i=t.call(this)||this;i.on,i.once,i.un;var r=T({},e);return"object"===n(e.properties)&&(delete r.properties,T(r,e.properties)),r[V]=void 0!==e.opacity?e.opacity:1,it("number"==typeof r[V],64),r[Z]=void 0===e.visible||e.visible,r[U]=e.zIndex,r[q]=void 0!==e.maxResolution?e.maxResolution:1/0,r[J]=void 0!==e.minResolution?e.minResolution:0,r[Q]=void 0!==e.minZoom?e.minZoom:-1/0,r[H]=void 0!==e.maxZoom?e.maxZoom:1/0,i.className_=void 0!==r.className?e.className:"ol-layer",delete r.className,i.setProperties(r),i.state_=null,i}return ct(e,t),e.prototype.getClassName=function(){return this.className_},e.prototype.getLayerState=function(t){var e=this.state_||{layer:this,managed:void 0===t||t},i=this.getZIndex();return e.opacity=nt(Math.round(100*this.getOpacity())/100,0,1),e.sourceState=this.getSourceState(),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=void 0!==i||e.managed?i:1/0,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e},e.prototype.getLayersArray=function(t){return W()},e.prototype.getLayerStatesArray=function(t){return W()},e.prototype.getExtent=function(){return this.get(K)},e.prototype.getMaxResolution=function(){return this.get(q)},e.prototype.getMinResolution=function(){return this.get(J)},e.prototype.getMinZoom=function(){return this.get(Q)},e.prototype.getMaxZoom=function(){return this.get(H)},e.prototype.getOpacity=function(){return this.get(V)},e.prototype.getSourceState=function(){return W()},e.prototype.getVisible=function(){return this.get(Z)},e.prototype.getZIndex=function(){return this.get(U)},e.prototype.setExtent=function(t){this.set(K,t)},e.prototype.setMaxResolution=function(t){this.set(q,t)},e.prototype.setMinResolution=function(t){this.set(J,t)},e.prototype.setMaxZoom=function(t){this.set(H,t)},e.prototype.setMinZoom=function(t){this.set(Q,t)},e.prototype.setOpacity=function(t){it("number"==typeof t,64),this.set(V,t)},e.prototype.setVisible=function(t){this.set(Z,t)},e.prototype.setZIndex=function(t){this.set(U,t)},e.prototype.disposeInternal=function(){this.state_&&(this.state_.layer=null,this.state_=null),t.prototype.disposeInternal.call(this)},e}(N),pt="prerender",dt="postrender",gt="precompose",_t="undefined",yt="loading",vt="ready",mt="error",xt=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),wt=function(t){function e(e){var i=this,n=T({},e);delete n.source,(i=t.call(this,n)||this).on,i.once,i.un,i.mapPrecomposeKey_=null,i.mapRenderKey_=null,i.sourceChangeKey_=null,i.renderer_=null,e.render&&(i.render=e.render),e.map&&i.setMap(e.map),i.addChangeListener($,i.handleSourcePropertyChange_);var r=e.source?e.source:null;return i.setSource(r),i}return xt(e,t),e.prototype.getLayersArray=function(t){var e=t||[];return e.push(this),e},e.prototype.getLayerStatesArray=function(t){var e=t||[];return e.push(this.getLayerState()),e},e.prototype.getSource=function(){return this.get($)||null},e.prototype.getSourceState=function(){var t=this.getSource();return t?t.getState():_t},e.prototype.handleSourceChange_=function(){this.changed()},e.prototype.handleSourcePropertyChange_=function(){this.sourceChangeKey_&&(j(this.sourceChangeKey_),this.sourceChangeKey_=null);var t=this.getSource();t&&(this.sourceChangeKey_=k(t,R,this.handleSourceChange_,this)),this.changed()},e.prototype.getFeatures=function(t){return this.renderer_?this.renderer_.getFeatures(t):new Promise((function(t){return t([])}))},e.prototype.render=function(t,e){var i=this.getRenderer();if(i.prepareFrame(t))return i.renderFrame(t,e)},e.prototype.setMap=function(t){this.mapPrecomposeKey_&&(j(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(j(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=k(t,gt,(function(t){var e=t.frameState.layerStatesArray,i=this.getLayerState(!1);it(!e.some((function(t){return t.layer===i.layer})),67),e.push(i)}),this),this.mapRenderKey_=k(this,R,t.render,t),this.changed())},e.prototype.setSource=function(t){this.set($,t)},e.prototype.getRenderer=function(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_},e.prototype.hasRenderer=function(){return!!this.renderer_},e.prototype.createRenderer=function(){return null},e.prototype.disposeInternal=function(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_),this.setSource(null),t.prototype.disposeInternal.call(this)},e}(ft);function St(t,e,i,n,r){Ct(t,e,i||0,n||t.length-1,r||bt)}function Ct(t,e,i,n,r){for(;n>i;){if(n-i>600){var o=n-i+1,s=e-i+1,a=Math.log(o),l=.5*Math.exp(2*a/3),h=.5*Math.sqrt(a*l*(o-l)/o)*(s-o/2<0?-1:1);Ct(t,e,Math.max(i,Math.floor(e-s*l/o+h)),Math.min(n,Math.floor(e+(o-s)*l/o+h)),r)}var u=t[e],c=i,f=n;for(Tt(t,i,e),r(t[n],u)>0&&Tt(t,i,n);c0;)f--}0===r(t[i],u)?Tt(t,i,f):Tt(t,++f,n),f<=e&&(i=f+1),e<=f&&(n=f-1)}}function Tt(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function bt(t,e){return te?1:0}var Ot=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:9;r(this,t),this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}return s(t,[{key:"all",value:function(){return this._all(this.data,[])}},{key:"search",value:function(t){var e=this.data,i=[];if(!At(t,e))return i;for(var n=this.toBBox,r=[];e;){for(var o=0;o=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(n,r,e)}},{key:"_split",value:function(t,e){var i=t[e],n=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,n);var o=this._chooseSplitIndex(i,r,n),s=Dt(i.children.splice(o,i.children.length-o));s.height=i.height,s.leaf=i.leaf,Ft(i,this.toBBox),Ft(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(i,s)}},{key:"_splitRoot",value:function(t,e){this.data=Dt([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Ft(this.data,this.toBBox)}},{key:"_chooseSplitIndex",value:function(t,e,i){for(var n,r,o,s,a,l,h,u=1/0,c=1/0,f=e;f<=i-e;f++){var p=Pt(t,0,f,this.toBBox),d=Pt(t,f,i,this.toBBox),g=(r=p,o=d,s=void 0,a=void 0,l=void 0,h=void 0,s=Math.max(r.minX,o.minX),a=Math.max(r.minY,o.minY),l=Math.min(r.maxX,o.maxX),h=Math.min(r.maxY,o.maxY),Math.max(0,l-s)*Math.max(0,h-a)),_=kt(p)+kt(d);g=e;u--){var c=t.children[u];Rt(s,t.leaf?r(c):c),a+=Lt(s)}return a}},{key:"_adjustParentBBoxes",value:function(t,e,i){for(var n=i;n>=0;n--)Rt(e[n],t)}},{key:"_condense",value:function(t){for(var e,i=t.length-1;i>=0;i--)0===t[i].children.length?i>0?(e=t[i-1].children).splice(e.indexOf(t[i]),1):this.clear():Ft(t[i],this.toBBox)}}]),t}();function Et(t,e,i){if(!i)return e.indexOf(t);for(var n=0;n=t.minX&&e.maxY>=t.minY}function Dt(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Gt(t,e,i,n,r){for(var o=[e,i];o.length;)if(!((i=o.pop())-(e=o.pop())<=n)){var s=e+Math.ceil((i-e)/n/2)*n;St(t,s,e,i,r),o.push(e,s,s,i)}}var Wt=0,Xt=1,Yt=2,zt=3;function Bt(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}var Nt=function(){function t(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=Bt(t.scale),this.displacement_=t.displacement}return t.prototype.clone=function(){var e=this.getScale();return new t({opacity:this.getOpacity(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice()})},t.prototype.getOpacity=function(){return this.opacity_},t.prototype.getRotateWithView=function(){return this.rotateWithView_},t.prototype.getRotation=function(){return this.rotation_},t.prototype.getScale=function(){return this.scale_},t.prototype.getScaleArray=function(){return this.scaleArray_},t.prototype.getDisplacement=function(){return this.displacement_},t.prototype.getAnchor=function(){return W()},t.prototype.getImage=function(t){return W()},t.prototype.getHitDetectionImage=function(){return W()},t.prototype.getPixelRatio=function(t){return 1},t.prototype.getImageState=function(){return W()},t.prototype.getImageSize=function(){return W()},t.prototype.getOrigin=function(){return W()},t.prototype.getSize=function(){return W()},t.prototype.setOpacity=function(t){this.opacity_=t},t.prototype.setRotateWithView=function(t){this.rotateWithView_=t},t.prototype.setRotation=function(t){this.rotation_=t},t.prototype.setScale=function(t){this.scale_=t,this.scaleArray_=Bt(t)},t.prototype.listenImageChange=function(t){W()},t.prototype.load=function(){W()},t.prototype.unlistenImageChange=function(t){W()},t}(),Vt=Nt,Zt=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,Kt=/^([a-z]*)$|^hsla?\(.*\)$/i;function Ut(t){return"string"==typeof t?t:Qt(t)}var qt=function(){var t={},e=0;return function(i){var n;if(t.hasOwnProperty(i))n=t[i];else{if(e>=1024){var r=0;for(var o in t)0==(3&r++)&&(delete t[o],--e)}n=function(t){var e,i,n,r,o;Kt.exec(t)&&(t=function(t){var e=document.createElement("div");if(e.style.color=t,""!==e.style.color){document.body.appendChild(e);var i=getComputedStyle(e).color;return document.body.removeChild(e),i}return""}(t));if(Zt.exec(t)){var s=t.length-1,a=void 0;a=s<=4?1:2;var l=4===s||8===s;e=parseInt(t.substr(1+0*a,a),16),i=parseInt(t.substr(1+1*a,a),16),n=parseInt(t.substr(1+2*a,a),16),r=l?parseInt(t.substr(1+3*a,a),16):255,1==a&&(e=(e<<4)+e,i=(i<<4)+i,n=(n<<4)+n,l&&(r=(r<<4)+r)),o=[e,i,n,r/255]}else 0==t.indexOf("rgba(")?Ht(o=t.slice(5,-1).split(",").map(Number)):0==t.indexOf("rgb(")?((o=t.slice(4,-1).split(",").map(Number)).push(1),Ht(o)):it(!1,14);return o}(i),t[i]=n,++e}return n}}();function Jt(t){return Array.isArray(t)?t:qt(t)}function Ht(t){return t[0]=nt(t[0]+.5|0,0,255),t[1]=nt(t[1]+.5|0,0,255),t[2]=nt(t[2]+.5|0,0,255),t[3]=nt(t[3],0,1),t}function Qt(t){var e=t[0];e!=(0|e)&&(e=e+.5|0);var i=t[1];i!=(0|i)&&(i=i+.5|0);var n=t[2];return n!=(0|n)&&(n=n+.5|0),"rgba("+e+","+i+","+n+","+(void 0===t[3]?1:t[3])+")"}function $t(t){return Array.isArray(t)?Qt(t):t}var te="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"";te.indexOf("firefox"),-1!==te.indexOf("safari")&&te.indexOf("chrom"),-1!==te.indexOf("webkit")&&te.indexOf("edge"),te.indexOf("macintosh");var ee="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,ie="undefined"!=typeof Image&&Image.prototype.decode;function ne(t,e,i,n){var r;return i&&i.length?r=i.shift():ee?r=new OffscreenCanvas(t||300,e||300):(r=document.createElement("canvas")).style.all="unset",t&&(r.width=t),e&&(r.height=e),r.getContext("2d",n)}function re(t){return t&&t.parentNode?t.parentNode.removeChild(t):null}!function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch(t){}}();var oe=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))","?\\s*([-,\\\"\\'\\sa-z]+?)\\s*$"].join(""),"i"),se=["style","variant","weight","size","lineHeight","family"],ae=function(t){var e=t.match(oe);if(!e)return null;for(var i={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"},n=0,r=se.length;nr&&(l|=hi),ao&&(l|=li),l===si&&(l=ai),l}function Ti(){return[1/0,1/0,-1/0,-1/0]}function bi(t,e,i,n,r){return r?(r[0]=t,r[1]=e,r[2]=i,r[3]=n,r):[t,e,i,n]}function Oi(t){return bi(1/0,1/0,-1/0,-1/0,t)}function Ei(t,e){var i=t[0],n=t[1];return bi(i,n,i,n,e)}function Fi(t,e,i,n,r){return Ii(Oi(r),t,e,i,n)}function Pi(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function Ri(t,e){e[0]t[2]&&(t[2]=e[0]),e[1]t[3]&&(t[3]=e[1])}function Ii(t,e,i,n,r){for(;ie[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function Vi(t,e,i,n){var r=[];if(n>1)for(var o=t[2]-t[0],s=t[3]-t[1],a=0;au&&this.instructions.push([oi.CUSTOM,u,r,t,i,Zi])):l==Ae&&(n=t.getFlatCoordinates(),this.coordinates.push(n[0],n[1]),r=this.coordinates.length,this.instructions.push([oi.CUSTOM,u,r,t,i]));this.endGeometry(e)},e.prototype.beginGeometry=function(t,e){this.beginGeometryInstruction1_=[oi.BEGIN_GEOMETRY,e,0,t],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[oi.BEGIN_GEOMETRY,e,0,t],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)},e.prototype.finish=function(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}},e.prototype.reverseHitDetectionInstructions=function(){var t,e=this.hitDetectionInstructions;e.reverse();var i,n,r=e.length,o=-1;for(t=0;tthis.maxLineWidth&&(this.maxLineWidth=i.lineWidth,this.bufferedMaxExtent_=null)}else i.strokeStyle=void 0,i.lineCap=void 0,i.lineDash=null,i.lineDashOffset=void 0,i.lineJoin=void 0,i.lineWidth=void 0,i.miterLimit=void 0},e.prototype.createFill=function(t){var e=t.fillStyle,i=[oi.SET_FILL_STYLE,e];return"string"!=typeof e&&i.push(!0),i},e.prototype.applyStroke=function(t){this.instructions.push(this.createStroke(t))},e.prototype.createStroke=function(t){return[oi.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]},e.prototype.updateFillStyle=function(t,e){var i=t.fillStyle;"string"==typeof i&&t.currentFillStyle==i||(void 0!==i&&this.instructions.push(e.call(this,t)),t.currentFillStyle=i)},e.prototype.updateStrokeStyle=function(t,e){var i=t.strokeStyle,n=t.lineCap,r=t.lineDash,o=t.lineDashOffset,s=t.lineJoin,a=t.lineWidth,l=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=n||r!=t.currentLineDash&&!S(t.currentLineDash,r)||t.currentLineDashOffset!=o||t.currentLineJoin!=s||t.currentLineWidth!=a||t.currentMiterLimit!=l)&&(void 0!==i&&e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=r,t.currentLineDashOffset=o,t.currentLineJoin=s,t.currentLineWidth=a,t.currentMiterLimit=l)},e.prototype.endGeometry=function(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;var e=[oi.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)},e.prototype.getBufferedMaxExtent=function(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=(e=this.maxExtent,i?(i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i):e.slice()),this.maxLineWidth>0)){var t=this.resolution*(this.maxLineWidth+1)/2;vi(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}var e,i;return this.bufferedMaxExtent_},e}(fi),Hi=Ji,Qi=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),$i=function(t){function e(e,i,n,r){var o=t.call(this,e,i,n,r)||this;return o.hitDetectionImage_=null,o.image_=null,o.imagePixelRatio_=void 0,o.anchorX_=void 0,o.anchorY_=void 0,o.height_=void 0,o.opacity_=void 0,o.originX_=void 0,o.originY_=void 0,o.rotateWithView_=void 0,o.rotation_=void 0,o.scale_=void 0,o.width_=void 0,o.declutterImageWithText_=void 0,o}return Qi(e,t),e.prototype.drawPoint=function(t,e){if(this.image_){this.beginGeometry(t,e);var i=t.getFlatCoordinates(),n=t.getStride(),r=this.coordinates.length,o=this.appendFlatPointCoordinates(i,n);this.instructions.push([oi.DRAW_IMAGE,r,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterImageWithText_]),this.hitDetectionInstructions.push([oi.DRAW_IMAGE,r,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterImageWithText_]),this.endGeometry(e)}},e.prototype.drawMultiPoint=function(t,e){if(this.image_){this.beginGeometry(t,e);var i=t.getFlatCoordinates(),n=t.getStride(),r=this.coordinates.length,o=this.appendFlatPointCoordinates(i,n);this.instructions.push([oi.DRAW_IMAGE,r,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterImageWithText_]),this.hitDetectionInstructions.push([oi.DRAW_IMAGE,r,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterImageWithText_]),this.endGeometry(e)}},e.prototype.finish=function(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,t.prototype.finish.call(this)},e.prototype.setImageStyle=function(t,e){var i=t.getAnchor(),n=t.getSize(),r=t.getHitDetectionImage(),o=t.getImage(this.pixelRatio),s=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=r,this.image_=o,this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=s[0]*this.imagePixelRatio_,this.originY_=s[1]*this.imagePixelRatio_,this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=n[0],this.declutterImageWithText_=e},e}(Hi),tn=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),en=function(t){function e(e,i,n,r){return t.call(this,e,i,n,r)||this}return tn(e,t),e.prototype.drawFlatCoordinates_=function(t,e,i,n){var r=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,i,n,!1,!1),s=[oi.MOVE_TO_LINE_TO,r,o];return this.instructions.push(s),this.hitDetectionInstructions.push(s),i},e.prototype.drawLineString=function(t,e){var i=this.state,n=i.strokeStyle,r=i.lineWidth;if(void 0!==n&&void 0!==r){this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([oi.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,fe,0],ni);var o=t.getFlatCoordinates(),s=t.getStride();this.drawFlatCoordinates_(o,0,o.length,s),this.hitDetectionInstructions.push(ii),this.endGeometry(e)}},e.prototype.drawMultiLineString=function(t,e){var i=this.state,n=i.strokeStyle,r=i.lineWidth;if(void 0!==n&&void 0!==r){this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([oi.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset],ni);for(var o=t.getEnds(),s=t.getFlatCoordinates(),a=t.getStride(),l=0,h=0,u=o.length;h0;){for(var c=h.pop(),f=h.pop(),p=0,d=t[f],g=t[f+1],_=t[c],y=t[c+1],v=f+n;vp&&(u=v,p=m)}p>r&&(l[(u-e)/n]=1,f+n0&&g>p)&&(d<0&&_0&&_>d)?(a=c,l=f):(o[s++]=a,o[s++]=l,h=a,u=l,a=c,l=f)}}return o[s++]=a,o[s++]=l,s}function sn(t,e,i,n,r,o,s,a){for(var l=0,h=i.length;lt&&(y>_&&(_=y,d=v,g=o),y=0,v=o-r)),s=a,u=f,c=p),l=m,h=x}return(y+=a)>_?[v,o]:[d,g]}var pn,dn=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),gn={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},_n=function(t){function e(e,i,n,r){var o=t.call(this,e,i,n,r)||this;return o.labels_=null,o.text_="",o.textOffsetX_=0,o.textOffsetY_=0,o.textRotateWithView_=void 0,o.textRotation_=0,o.textFillState_=null,o.fillStates={},o.textStrokeState_=null,o.strokeStates={},o.textState_={},o.textStates={},o.textKey_="",o.fillKey_="",o.strokeKey_="",o.declutterImageWithText_=void 0,o}return dn(e,t),e.prototype.finish=function(){var e=t.prototype.finish.call(this);return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e},e.prototype.drawText=function(t,e){var i=this.textFillState_,n=this.textStrokeState_,r=this.textState_;if(""!==this.text_&&r&&(i||n)){var o=this.coordinates,s=o.length,a=t.getType(),l=null,h=t.getStride();if(r.placement!==cn||a!=De&&a!=Ye&&a!=We&&a!=ze){var u=r.overflow?null:[];switch(a){case Ae:case Xe:l=t.getFlatCoordinates();break;case De:l=t.getFlatMidpoint();break;case Ne:l=t.getCenter();break;case Ye:l=t.getFlatMidpoints(),h=2;break;case We:l=t.getFlatInteriorPoint(),r.overflow||u.push(l[2]/this.resolution),h=3;break;case ze:var c=t.getFlatInteriorPoints();l=[];for(S=0,C=c.length;SF[2]}else b=x>O;var P,R=Math.PI,I=[],M=S+n===e;if(_=0,y=C,f=t[e=S],p=t[e+1],M){v(),P=Math.atan2(p-g,f-d),b&&(P+=P>0?-R:R);var k=(O+x)/2,L=(E+w)/2;return I[0]=[k,L,(T-o)/2,P,r],I}for(var j=0,A=r.length;j0?-R:R),void 0!==P){var G=D-P;if(G+=G>R?-2*R:G<-R?2*R:0,Math.abs(G)>s)return null}P=D;for(var W=j,X=0;jt?t-l:r,x=o+h>e?e-h:o,w=p[3]+m*c[0]+p[1],S=p[0]+x*c[1]+p[2],C=y-p[3],T=v-p[0];return(d||0!==u)&&(Dn[0]=C,Xn[0]=C,Dn[1]=T,Gn[1]=T,Gn[0]=C+w,Wn[0]=Gn[0],Wn[1]=T+S,Xn[1]=Wn[1]),0!==u?(Pn(_=In([1,0,0,1,0,0],i,n,1,1,u,-i,-n),Dn),Pn(_,Gn),Pn(_,Wn),Pn(_,Xn),bi(Math.min(Dn[0],Gn[0],Wn[0],Xn[0]),Math.min(Dn[1],Gn[1],Wn[1],Xn[1]),Math.max(Dn[0],Gn[0],Wn[0],Xn[0]),Math.max(Dn[1],Gn[1],Wn[1],Xn[1]),An)):bi(Math.min(C,C+w),Math.min(T,T+S),Math.max(C,C+w),Math.max(T,T+S),An),f&&(y=Math.round(y),v=Math.round(v)),{drawImageX:y,drawImageY:v,drawImageW:m,drawImageH:x,originX:l,originY:h,declutterBox:{minX:An[0],minY:An[1],maxX:An[2],maxY:An[3],value:g},canvasTransform:_,scale:c}},t.prototype.replayImageOrLabel_=function(t,e,i,n,r,o,s){var a=!(!o&&!s),l=n.declutterBox,h=t.canvas,u=s?s[2]*n.scale[0]/2:0;return l.minX-u<=h.width/e&&l.maxX+u>=0&&l.minY-u<=h.height/e&&l.maxY+u>=0&&(a&&this.replayTextBackground_(t,Dn,Gn,Wn,Xn,o,s),Fe(t,n.canvasTransform,r,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0},t.prototype.fill_=function(t){if(this.alignFill_){var e=Pn(this.renderedTransform_,[0,0]),i=512*this.pixelRatio;t.save(),t.translate(e[0]%i,e[1]%i),t.rotate(this.viewRotation_)}t.fill(),this.alignFill_&&t.restore()},t.prototype.setStrokeStyle_=function(t,e){t.strokeStyle=e[1],t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.setLineDash&&(t.lineDashOffset=e[7],t.setLineDash(e[6]))},t.prototype.drawLabelWithPointPlacement_=function(t,e,i,n){var r=this.textStates[e],o=this.createLabel(t,e,n,i),s=this.strokeStates[i],a=this.pixelRatio,l=Bn(t,r.textAlign||ge),h=gn[r.textBaseline||_e],u=s&&s.lineWidth?s.lineWidth:0;return{label:o,anchorX:l*(o.width/a-2*r.scale[0])+2*(.5-l)*u,anchorY:h*o.height/a+2*(.5-h)*u}},t.prototype.execute_=function(t,e,i,n,r,o,s,a){var l,h,u;this.pixelCoordinates_&&S(i,this.renderedTransform_)?l=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),l=Mn(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),h=this.renderedTransform_,u=i,h[0]=u[0],h[1]=u[1],h[2]=u[2],h[3]=u[3],h[4]=u[4],h[5]=u[5]);for(var c,f,p,d,g,_,y,v,m,x,w,C,T,b,O,E,F=0,P=n.length,R=0,I=0,M=0,k=null,L=null,j=this.coordinateCache_,A=this.viewRotation_,D=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,G={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:A},W=this.instructions!=n||this.overlaps?0:200;FW&&(this.fill_(t),I=0),M>W&&(t.stroke(),M=0),I||M||(t.beginPath(),d=NaN,g=NaN),++F;break;case oi.CIRCLE:var Y=l[R=X[1]],z=l[R+1],B=l[R+2]-Y,N=l[R+3]-z,V=Math.sqrt(B*B+N*N);t.moveTo(Y+V,z),t.arc(Y,z,V,0,2*Math.PI,!0),++F;break;case oi.CLOSE_PATH:t.closePath(),++F;break;case oi.CUSTOM:R=X[1],c=X[2];var Z=X[3],K=X[4],U=6==X.length?X[5]:void 0;G.geometry=Z,G.feature=T,F in j||(j[F]=[]);var q=j[F];U?U(l,R,c,2,q):(q[0]=l[R],q[1]=l[R+1],q.length=2),K(q,G),++F;break;case oi.DRAW_IMAGE:R=X[1],c=X[2],v=X[3],f=X[4],p=X[5];var J=X[6],H=X[7],Q=X[8],$=X[9],tt=X[10],et=X[11],it=X[12],nt=X[13],rt=X[14];if(!v&&X.length>=19){m=X[18],x=X[19],w=X[20],C=X[21];var ot=this.drawLabelWithPointPlacement_(m,x,w,C);v=ot.label,X[3]=v;var st=X[22];f=(ot.anchorX-st)*this.pixelRatio,X[4]=f;var at=X[23];p=(ot.anchorY-at)*this.pixelRatio,X[5]=p,J=v.height,X[6]=J,nt=v.width,X[13]=nt}var lt=void 0;X.length>24&&(lt=X[24]);var ht=void 0,ut=void 0,ct=void 0;X.length>16?(ht=X[15],ut=X[16],ct=X[17]):(ht=ye,ut=!1,ct=!1),tt&&D?et+=A:tt||D||(et-=A);for(var ft=0;Ri)break;var a=n[s];a||(a=[],n[s]=a),a.push(4*((t+r)*e+(t+o))+3),r>0&&a.push(4*((t-r)*e+(t+o))+3),o>0&&(a.push(4*((t+r)*e+(t-o))+3),r>0&&a.push(4*((t-r)*e+(t-o))+3))}for(var l=[],h=(r=0,n.length);r0){if(!o||c!==wn&&c!==Tn||-1!==o.indexOf(t)){var h=(f[a]-3)/4,p=n-h%s,d=n-(h/s|0),g=r(t,e,p*p+d*d);if(g)return g}u.clearRect(0,0,s,s);break}}var d,g,_,y,v,x=Object.keys(this.executorsByZIndex_).map(Number);for(x.sort(m),d=x.length-1;d>=0;--d){var w=x[d].toString();for(_=this.executorsByZIndex_[w],g=Zn.length-1;g>=0;--g)if(void 0!==(y=_[c=Zn[g]])&&(v=y.executeHitDetection(u,a,i,p,h)))return v}},t.prototype.getClipCoords=function(t){var e=this.maxExtent_;if(!e)return null;var i=e[0],n=e[1],r=e[2],o=e[3],s=[i,n,i,o,r,o,r,n];return Mn(s,0,8,2,t,s),s},t.prototype.isEmpty=function(){return O(this.executorsByZIndex_)},t.prototype.execute=function(t,e,i,n,r,o,s){var a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(m),this.maxExtent_&&(t.save(),this.clip(t,i));var l,h,u,c,f,p,d=o||Zn;for(s&&a.reverse(),l=0,h=a.length;lthis.maxX&&(this.maxX=t.maxX),t.minYthis.maxY&&(this.maxY=t.maxY)},t.prototype.getHeight=function(){return this.maxY-this.minY+1},t.prototype.getSize=function(){return[this.getWidth(),this.getHeight()]},t.prototype.getWidth=function(){return this.maxX-this.minX+1},t.prototype.intersects=function(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY},t}();function rr(t,e,i,n,r){return void 0!==r?(r.minX=t,r.maxX=e,r.minY=i,r.maxY=n,r):new nr(t,e,i,n)}var or=nr,sr=0,ar=1,lr=2,hr=3,ur=4,cr={RADIANS:"radians",DEGREES:"degrees",FEET:"ft",METERS:"m",PIXELS:"pixels",TILE_PIXELS:"tile-pixels",USFEET:"us-ft"},fr={};fr[cr.RADIANS]=6370997/(2*Math.PI),fr[cr.DEGREES]=2*Math.PI*6370997/360,fr[cr.FEET]=.3048,fr[cr.METERS]=1,fr[cr.USFEET]=1200/3937;var pr=cr,dr=function(){function t(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}return t.prototype.canWrapX=function(){return this.canWrapX_},t.prototype.getCode=function(){return this.code_},t.prototype.getExtent=function(){return this.extent_},t.prototype.getUnits=function(){return this.units_},t.prototype.getMetersPerUnit=function(){return this.metersPerUnit_||fr[this.units_]},t.prototype.getWorldExtent=function(){return this.worldExtent_},t.prototype.getAxisOrientation=function(){return this.axisOrientation_},t.prototype.isGlobal=function(){return this.global_},t.prototype.setGlobal=function(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)},t.prototype.getDefaultTileGrid=function(){return this.defaultTileGrid_},t.prototype.setDefaultTileGrid=function(t){this.defaultTileGrid_=t},t.prototype.setExtent=function(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)},t.prototype.setWorldExtent=function(t){this.worldExtent_=t},t.prototype.setGetPointResolution=function(t){this.getPointResolutionFunc_=t},t.prototype.getPointResolutionFunc=function(){return this.getPointResolutionFunc_},t}(),gr=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),_r=6378137,yr=Math.PI*_r,vr=[-yr,-yr,yr,yr],mr=[-180,-85,180,85],xr=_r*Math.log(Math.tan(Math.PI/2)),wr=function(t){function e(e){return t.call(this,{code:e,units:pr.METERS,extent:vr,global:!0,worldExtent:mr,getPointResolution:function(t,e){return t/rt(e[1]/_r)}})||this}return gr(e,t),e}(dr),Sr=[new wr("EPSG:3857"),new wr("EPSG:102100"),new wr("EPSG:102113"),new wr("EPSG:900913"),new wr("http://www.opengis.net/def/crs/EPSG/0/3857"),new wr("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Cr(t,e,i){var n=t.length,r=i>1?i:2,o=e;void 0===o&&(o=r>2?t.slice():new Array(n));for(var s=0;sxr?a=xr:a<-xr&&(a=-xr),o[s+1]=a}return o}function Tr(t,e,i){var n=t.length,r=i>1?i:2,o=e;void 0===o&&(o=r>2?t.slice():new Array(n));for(var s=0;sn[2])){var o=i||Bi(n);r=Math.floor((t[0]-n[0])/o)}return r}(t,e,i);n&&(t[0]-=n*i)}return t}function Gr(t,e,i){var n;if(void 0!==e){for(var r=0,o=t.length;r0&&(this.newTiles_=!0):a.setState(lr)),this.isDrawableTile(a)||(a=a.getInterimTile()),a},e.prototype.loadedTileCallback=function(e,i,n){return!!this.isDrawableTile(n)&&t.prototype.loadedTileCallback.call(this,e,i,n)},e.prototype.prepareFrame=function(t){return!!this.getLayer().getSource()},e.prototype.renderFrame=function(t,e){var i=t.layerStatesArray[t.layerIndex],n=t.viewState,r=n.projection,o=n.resolution,s=n.center,a=n.rotation,l=t.pixelRatio,h=this.getLayer(),u=h.getSource(),c=u.getRevision(),f=u.getTileGridForProjection(r),p=f.getZForResolution(o,u.zDirection),d=f.getResolution(p),g=t.extent,_=i.extent&&qr(i.extent);_&&(g=Xi(g,qr(i.extent)));var y=u.getTilePixelRatio(l),v=Math.round(t.size[0]*y),x=Math.round(t.size[1]*y);if(a){var w=Math.round(Math.sqrt(v*v+x*x));v=w,x=w}var S=d*v/2/y,C=d*x/2/y,b=[s[0]-S,s[1]-C,s[0]+S,s[1]+C],O=f.getTileRangeForExtentAndZ(g,p),E={};E[p]={};var F=this.createLoadedTileFinder(u,r,E),P=this.tmpExtent,R=this.tmpTileRange_;this.newTiles_=!1;for(var I=O.minX;I<=O.maxX;++I)for(var M=O.minY;M<=O.maxY;++M){var k=this.getTile(p,I,M,t);if(this.isDrawableTile(k)){var L=Y(this);if(k.getState()==lr){E[p][k.tileCoord.toString()]=k;var j=k.inTransition(L);this.newTiles_||!j&&-1!==this.renderedTiles.indexOf(k)||(this.newTiles_=!0)}if(1===k.getAlpha(L,t.time))continue}var A=f.getTileCoordChildTileRange(k.tileCoord,R,P),D=!1;A&&(D=F(p+1,A)),D||f.forEachTileCoordParentTileRange(k.tileCoord,F,R,P)}var G=d/o;In(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/y,1/y,a,-v/2,-x/2);var W=function(t){var e="matrix("+t.join(", ")+")";if(ee)return e;var i=pn||(pn=document.createElement("div"));return i.style.transform=e,i.style.transform}(this.pixelTransform);this.useContainer(e,W,i.opacity);var X=this.context,z=X.canvas;!function(t,e){var i,n=(i=e)[0]*i[3]-i[1]*i[2];it(0!==n,32);var r=e[0],o=e[1],s=e[2],a=e[3],l=e[4],h=e[5];t[0]=a/n,t[1]=-o/n,t[2]=-s/n,t[3]=r/n,t[4]=(s*h-a*l)/n,t[5]=-(r*h-o*l)/n}(this.inversePixelTransform,this.pixelTransform),In(this.tempTransform,v/2,x/2,G,G,0,-v/2,-x/2),z.width!=v||z.height!=x?(z.width=v,z.height=x):this.containerReused||X.clearRect(0,0,v,x),_&&this.clipUnrotated(X,t,_),T(X,u.getContextOptions()),this.preRender(X,t),this.renderedTiles.length=0;var B,N,V,Z=Object.keys(E).map(Number);Z.sort(m),1!==i.opacity||this.containerReused&&!u.getOpaque(t.viewState.projection)?(B=[],N=[]):Z=Z.reverse();for(var K=Z.length-1;K>=0;--K){var U=Z[K],q=u.getTilePixelSize(U,l,r),J=f.getResolution(U)/d,H=q[0]*J*G,Q=q[1]*J*G,$=f.getTileCoordForCoordAndZ(Yi(b),U),tt=f.getTileCoordExtent($),et=Pn(this.tempTransform,[y*(tt[0]-b[0])/d,y*(b[3]-tt[3])/d]),nt=y*u.getGutterForProjection(r),rt=E[U];for(var ot in rt){var st=(k=rt[ot]).tileCoord,at=$[1]-st[1],lt=Math.round(et[0]-(at-1)*H),ht=$[2]-st[2],ut=Math.round(et[1]-(ht-1)*Q),ct=lt-(I=Math.round(et[0]-at*H)),ft=ut-(M=Math.round(et[1]-ht*Q)),pt=p===U;if(!(j=pt&&1!==k.getAlpha(Y(this),t.time)))if(B){X.save(),V=[I,M,I+ct,M,I+ct,M+ft,I,M+ft];for(var dt=0,gt=B.length;dtthis.maxCacheSize_},t.prototype.expire=function(){if(this.canExpireCache()){var t=0;for(var e in this.cache_){var i=this.cache_[e];0!=(3&t++)||i.hasListener()||(delete this.cache_[e],--this.cacheSize_)}}},t.prototype.get=function(t,e,i){var n=Oo(t,e,i);return n in this.cache_?this.cache_[n]:null},t.prototype.set=function(t,e,i,n){var r=Oo(t,e,i);this.cache_[r]=n,++this.cacheSize_},t.prototype.setSize=function(t){this.maxCacheSize_=t,this.expire()},t}()),Fo=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Po=function(t){function e(e,i,n,r){var o=t.call(this)||this;return o.extent=e,o.pixelRatio_=n,o.resolution=i,o.state=r,o}return Fo(e,t),e.prototype.changed=function(){this.dispatchEvent(R)},e.prototype.getExtent=function(){return this.extent},e.prototype.getImage=function(){return W()},e.prototype.getPixelRatio=function(){return this.pixelRatio_},e.prototype.getResolution=function(){return this.resolution},e.prototype.getState=function(){return this.state},e.prototype.load=function(){W()},e}(P),Ro=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();function Io(t,e,i){var n=t;if(n.src&&ie){var r=n.decode(),o=!0;return r.then((function(){o&&e()})).catch((function(t){o&&("EncodingError"===t.name&&"Invalid image type."===t.message?e():i())})),function(){o=!1}}var s=[L(n,M,e),L(n,I,i)];return function(){s.forEach(j)}}!function(t){function e(e,i,n,r,o,s){var a=t.call(this,e,i,n,Wt)||this;return a.src_=r,a.image_=new Image,null!==o&&(a.image_.crossOrigin=o),a.unlisten_=null,a.state=Wt,a.imageLoadFunction_=s,a}Ro(e,t),e.prototype.getImage=function(){return this.image_},e.prototype.handleImageError_=function(){this.state=zt,this.unlistenImage_(),this.changed()},e.prototype.handleImageLoad_=function(){void 0===this.resolution&&(this.resolution=Wi(this.extent)/this.image_.height),this.state=Yt,this.unlistenImage_(),this.changed()},e.prototype.load=function(){this.state!=Wt&&this.state!=zt||(this.state=Xt,this.changed(),this.imageLoadFunction_(this,this.src_),this.unlisten_=Io(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},e.prototype.setImage=function(t){this.image_=t,this.resolution=Wi(this.extent)/this.image_.height},e.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}(Po);var Mo=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),ko=null,Lo=function(t){function e(e,i,n,r,o,s){var a=t.call(this)||this;return a.hitDetectionImage_=null,a.image_=e||new Image,null!==r&&(a.image_.crossOrigin=r),a.canvas_={},a.color_=s,a.unlisten_=null,a.imageState_=o,a.size_=n,a.src_=i,a.tainted_,a}return Mo(e,t),e.prototype.isTainted_=function(){if(void 0===this.tainted_&&this.imageState_===Yt){ko||(ko=ne(1,1)),ko.drawImage(this.image_,0,0);try{ko.getImageData(0,0,1,1),this.tainted_=!1}catch(t){ko=null,this.tainted_=!0}}return!0===this.tainted_},e.prototype.dispatchChangeEvent_=function(){this.dispatchEvent(R)},e.prototype.handleImageError_=function(){this.imageState_=zt,this.unlistenImage_(),this.dispatchChangeEvent_()},e.prototype.handleImageLoad_=function(){this.imageState_=Yt,this.size_?(this.image_.width=this.size_[0],this.image_.height=this.size_[1]):this.size_=[this.image_.width,this.image_.height],this.unlistenImage_(),this.dispatchChangeEvent_()},e.prototype.getImage=function(t){return this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_},e.prototype.getPixelRatio=function(t){return this.replaceColor_(t),this.canvas_[t]?t:1},e.prototype.getImageState=function(){return this.imageState_},e.prototype.getHitDetectionImage=function(){if(!this.hitDetectionImage_)if(this.isTainted_()){var t=this.size_[0],e=this.size_[1],i=ne(t,e);i.fillRect(0,0,t,e),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_},e.prototype.getSize=function(){return this.size_},e.prototype.getSrc=function(){return this.src_},e.prototype.load=function(){if(this.imageState_==Wt){this.imageState_=Xt;try{this.image_.src=this.src_}catch(t){this.handleImageError_()}this.unlisten_=Io(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}},e.prototype.replaceColor_=function(t){if(this.color_&&!this.canvas_[t]){var e=document.createElement("canvas");this.canvas_[t]=e,e.width=Math.ceil(this.image_.width*t),e.height=Math.ceil(this.image_.height*t);var i=e.getContext("2d");if(i.scale(t,t),i.drawImage(this.image_,0,0),i.globalCompositeOperation="multiply","multiply"===i.globalCompositeOperation||this.isTainted_())i.fillStyle=Ut(this.color_),i.fillRect(0,0,e.width/t,e.height/t),i.globalCompositeOperation="destination-in",i.drawImage(this.image_,0,0);else{for(var n=i.getImageData(0,0,e.width,e.height),r=n.data,o=this.color_[0]/255,s=this.color_[1]/255,a=this.color_[2]/255,l=this.color_[3],h=0,u=r.length;h0,6);var c=void 0!==n.src?Wt:Yt;return i.color_=void 0!==n.color?Jt(n.color):null,i.iconImage_=function(t,e,i,n,r,o){var s=Eo.get(e,n,o);return s||(s=new Lo(t,e,i,n,r,o),Eo.set(e,n,o,s)),s}(l,u,h,i.crossOrigin_,c,i.color_),i.offset_=void 0!==n.offset?n.offset:[0,0],i.offsetOrigin_=void 0!==n.offsetOrigin?n.offsetOrigin:To,i.origin_=null,i.size_=void 0!==n.size?n.size:null,i}return jo(e,t),e.prototype.clone=function(){var t=this.getScale();return new e({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,crossOrigin:this.crossOrigin_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,src:this.getSrc(),offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,size:null!==this.size_?this.size_.slice():void 0,opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView()})},e.prototype.getAnchor=function(){if(this.normalizedAnchor_)return this.normalizedAnchor_;var t=this.anchor_,e=this.getSize();if(this.anchorXUnits_==xo||this.anchorYUnits_==xo){if(!e)return null;t=this.anchor_.slice(),this.anchorXUnits_==xo&&(t[0]*=e[0]),this.anchorYUnits_==xo&&(t[1]*=e[1])}if(this.anchorOrigin_!=To){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),this.anchorOrigin_!=bo&&this.anchorOrigin_!=Co||(t[0]=-t[0]+e[0]),this.anchorOrigin_!=So&&this.anchorOrigin_!=Co||(t[1]=-t[1]+e[1])}var i=this.getDisplacement();return t[0]-=i[0],t[1]+=i[1],this.normalizedAnchor_=t,this.normalizedAnchor_},e.prototype.setAnchor=function(t){this.anchor_=t,this.normalizedAnchor_=null},e.prototype.getColor=function(){return this.color_},e.prototype.getImage=function(t){return this.iconImage_.getImage(t)},e.prototype.getPixelRatio=function(t){return this.iconImage_.getPixelRatio(t)},e.prototype.getImageSize=function(){return this.iconImage_.getSize()},e.prototype.getImageState=function(){return this.iconImage_.getImageState()},e.prototype.getHitDetectionImage=function(){return this.iconImage_.getHitDetectionImage()},e.prototype.getOrigin=function(){if(this.origin_)return this.origin_;var t=this.offset_;if(this.offsetOrigin_!=To){var e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),this.offsetOrigin_!=bo&&this.offsetOrigin_!=Co||(t[0]=i[0]-e[0]-t[0]),this.offsetOrigin_!=So&&this.offsetOrigin_!=Co||(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_},e.prototype.getSrc=function(){return this.iconImage_.getSrc()},e.prototype.getSize=function(){return this.size_?this.size_:this.iconImage_.getSize()},e.prototype.listenImageChange=function(t){this.iconImage_.addEventListener(R,t)},e.prototype.load=function(){this.iconImage_.load()},e.prototype.unlistenImageChange=function(t){this.iconImage_.removeEventListener(R,t)},e}(Vt),Do=Ao,Go=function(){function t(t){var e=t||{};this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.scale_=e.scale,this.scaleArray_=Bt(void 0!==e.scale?e.scale:1),this.text_=e.text,this.textAlign_=e.textAlign,this.textBaseline_=e.textBaseline,this.fill_=void 0!==e.fill?e.fill:new je({color:"#333"}),this.maxAngle_=void 0!==e.maxAngle?e.maxAngle:Math.PI/4,this.placement_=void 0!==e.placement?e.placement:un,this.overflow_=!!e.overflow,this.stroke_=void 0!==e.stroke?e.stroke:null,this.offsetX_=void 0!==e.offsetX?e.offsetX:0,this.offsetY_=void 0!==e.offsetY?e.offsetY:0,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=void 0===e.padding?null:e.padding}return t.prototype.clone=function(){var e=this.getScale();return new t({font:this.getFont(),placement:this.getPlacement(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(e)?e.slice():e,text:this.getText(),textAlign:this.getTextAlign(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()})},t.prototype.getOverflow=function(){return this.overflow_},t.prototype.getFont=function(){return this.font_},t.prototype.getMaxAngle=function(){return this.maxAngle_},t.prototype.getPlacement=function(){return this.placement_},t.prototype.getOffsetX=function(){return this.offsetX_},t.prototype.getOffsetY=function(){return this.offsetY_},t.prototype.getFill=function(){return this.fill_},t.prototype.getRotateWithView=function(){return this.rotateWithView_},t.prototype.getRotation=function(){return this.rotation_},t.prototype.getScale=function(){return this.scale_},t.prototype.getScaleArray=function(){return this.scaleArray_},t.prototype.getStroke=function(){return this.stroke_},t.prototype.getText=function(){return this.text_},t.prototype.getTextAlign=function(){return this.textAlign_},t.prototype.getTextBaseline=function(){return this.textBaseline_},t.prototype.getBackgroundFill=function(){return this.backgroundFill_},t.prototype.getBackgroundStroke=function(){return this.backgroundStroke_},t.prototype.getPadding=function(){return this.padding_},t.prototype.setOverflow=function(t){this.overflow_=t},t.prototype.setFont=function(t){this.font_=t},t.prototype.setMaxAngle=function(t){this.maxAngle_=t},t.prototype.setOffsetX=function(t){this.offsetX_=t},t.prototype.setOffsetY=function(t){this.offsetY_=t},t.prototype.setPlacement=function(t){this.placement_=t},t.prototype.setRotateWithView=function(t){this.rotateWithView_=t},t.prototype.setFill=function(t){this.fill_=t},t.prototype.setRotation=function(t){this.rotation_=t},t.prototype.setScale=function(t){this.scale_=t,this.scaleArray_=Bt(void 0!==t?t:1)},t.prototype.setStroke=function(t){this.stroke_=t},t.prototype.setText=function(t){this.text_=t},t.prototype.setTextAlign=function(t){this.textAlign_=t},t.prototype.setTextBaseline=function(t){this.textBaseline_=t},t.prototype.setBackgroundFill=function(t){this.backgroundFill_=t},t.prototype.setBackgroundStroke=function(t){this.backgroundStroke_=t},t.prototype.setPadding=function(t){this.padding_=t},t}(),Wo=Go,Xo=.5;var Yo={Point:function(t,e,i,n,r){var o,s=i.getImage(),a=i.getText();r&&(t=r,o=s&&a&&a.getText()?{}:void 0);if(s){if(s.getImageState()!=Yt)return;var l=t.getBuilder(i.getZIndex(),wn);l.setImageStyle(s,o),l.drawPoint(e,n)}if(a&&a.getText()){var h=t.getBuilder(i.getZIndex(),Tn);h.setTextStyle(a,o),h.drawText(e,n)}},LineString:function(t,e,i,n,r){var o=i.getStroke();if(o){var s=t.getBuilder(i.getZIndex(),Sn);s.setFillStrokeStyle(null,o),s.drawLineString(e,n)}var a=i.getText();if(a&&a.getText()){var l=(r||t).getBuilder(i.getZIndex(),Tn);l.setTextStyle(a),l.drawText(e,n)}},Polygon:function(t,e,i,n,r){var o=i.getFill(),s=i.getStroke();if(o||s){var a=t.getBuilder(i.getZIndex(),Cn);a.setFillStrokeStyle(o,s),a.drawPolygon(e,n)}var l=i.getText();if(l&&l.getText()){var h=(r||t).getBuilder(i.getZIndex(),Tn);h.setTextStyle(l),h.drawText(e,n)}},MultiPoint:function(t,e,i,n,r){var o,s=i.getImage(),a=i.getText();r&&(t=r,o=s&&a&&a.getText()?{}:void 0);if(s){if(s.getImageState()!=Yt)return;var l=t.getBuilder(i.getZIndex(),wn);l.setImageStyle(s,o),l.drawMultiPoint(e,n)}if(a&&a.getText()){var h=(r||t).getBuilder(i.getZIndex(),Tn);h.setTextStyle(a,o),h.drawText(e,n)}},MultiLineString:function(t,e,i,n,r){var o=i.getStroke();if(o){var s=t.getBuilder(i.getZIndex(),Sn);s.setFillStrokeStyle(null,o),s.drawMultiLineString(e,n)}var a=i.getText();if(a&&a.getText()){var l=(r||t).getBuilder(i.getZIndex(),Tn);l.setTextStyle(a),l.drawText(e,n)}},MultiPolygon:function(t,e,i,n,r){var o=i.getFill(),s=i.getStroke();if(s||o){var a=t.getBuilder(i.getZIndex(),Cn);a.setFillStrokeStyle(o,s),a.drawMultiPolygon(e,n)}var l=i.getText();if(l&&l.getText()){var h=(r||t).getBuilder(i.getZIndex(),Tn);h.setTextStyle(l),h.drawText(e,n)}},GeometryCollection:function(t,e,i,n,r){var o,s,a=e.getGeometriesArray();for(o=0,s=a.length;o0)e([]);else{var _=Yi(u.getTileCoordExtent(n.wrappedTileCoord)),y=[(c[0]-_[0])/h,(_[1]-c[1])/h],v=n.getSourceTiles().reduce((function(t,e){return t.concat(e.getFeatures())}),[]),x=n.hitDetectionImageData[o];if(!x&&!this.animatingOrInteracting_){var w=Bt(u.getTileSize(u.getZForResolution(h))),S=this.renderedRotation_;x=function(t,e,i,n,r,o,s){var a=ne(t[0]*Xo,t[1]*Xo);a.imageSmoothingEnabled=!1;for(var l=a.canvas,h=new mo(a,Xo,r,null,s),u=i.length,c=Math.floor(16777215/u),f={},p=1;p<=u;++p){var d=i[p-1],g=d.getStyleFunction()||n;if(n){var _=g(d,o);if(_){Array.isArray(_)||(_=[_]);for(var y="#"+("000000"+(p*c).toString(16)).slice(-6),v=0,x=_.length;v=0;--u)h[u].execute(this.context,1,this.getTileRenderTransform(l,t),t.viewState.rotation,r,void 0,t.declutterTree)}e.globalAlpha=i},e.prototype.getTileRenderTransform=function(t,e){var i=e.pixelRatio,n=e.viewState,r=n.center,o=n.resolution,s=n.rotation,a=e.size,l=Math.round(a[0]*i),h=Math.round(a[1]*i),u=this.getLayer().getSource().getTileGridForProjection(e.viewState.projection),c=t.tileCoord,f=u.getTileCoordExtent(t.wrappedTileCoord),p=u.getTileCoordExtent(c,this.tmpExtent)[0]-f[0];return En(Rn(this.inversePixelTransform.slice(),1/i,1/i),this.getRenderTransform(r,o,s,i,l,h,p))},e.prototype.renderFrame=function(e,i){var n=e.viewHints,r=!(n[io]||n[no]);t.prototype.renderFrame.call(this,e,i),this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice(),this.renderedRotation_=e.viewState.rotation;var o=this.getLayer(),s=o.getRenderMode(),a=this.context,l=a.globalAlpha;a.globalAlpha=o.getOpacity();for(var h=Ko[s],u=e.viewState.rotation,c=this.renderedTiles,f=[],p=[],d=c.length-1;d>=0;--d)for(var g=c[d],_=this.getTileRenderTransform(g,e),y=g.executorGroups[Y(o)],v=!1,m=0,x=y.length;mt)throw new Error("Tile load sequence violation");this.state=t,this.changed()},e.prototype.load=function(){W()},e.prototype.getAlpha=function(t,e){if(!this.transition_)return 1;var i=this.transitionStarts_[t];if(i){if(-1===i)return 1}else i=e,this.transitionStarts_[t]=i;var n,r=e-i+1e3/60;return r>=this.transition_?1:(n=r/this.transition_,Math.pow(n,3))},e.prototype.inTransition=function(t){return!!this.transition_&&-1!==this.transitionStarts_[t]},e.prototype.endTransition=function(t){this.transition_&&(this.transitionStarts_[t]=-1)},e}(P),is=es,ns=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),rs=function(t){function e(e,i,n,r,o,s){var a=t.call(this,e,i,s)||this;return a.extent=null,a.format_=r,a.features_=null,a.loader_,a.projection=null,a.resolution,a.tileLoadFunction_=o,a.url_=n,a.key=n,a}return ns(e,t),e.prototype.getFormat=function(){return this.format_},e.prototype.getFeatures=function(){return this.features_},e.prototype.load=function(){this.state==sr&&(this.setState(ar),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))},e.prototype.onLoad=function(t,e){this.setFeatures(t)},e.prototype.onError=function(){this.setState(hr)},e.prototype.setFeatures=function(t){this.features_=t,this.setState(lr)},e.prototype.setLoader=function(t){this.loader_=t},e}(is),os=rs,ss=function(){function t(t){this.highWaterMark=void 0!==t?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}return t.prototype.canExpireCache=function(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark},t.prototype.clear=function(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null},t.prototype.containsKey=function(t){return this.entries_.hasOwnProperty(t)},t.prototype.forEach=function(t){for(var e=this.oldest_;e;)t(e.value_,e.key_,this),e=e.newer},t.prototype.get=function(t,e){var i=this.entries_[t];return it(void 0!==i,15),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_},t.prototype.remove=function(t){var e=this.entries_[t];return it(void 0!==e,15),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_},t.prototype.getCount=function(){return this.count_},t.prototype.getKeys=function(){var t,e=new Array(this.count_),i=0;for(t=this.newest_;t;t=t.older)e[i++]=t.key_;return e},t.prototype.getValues=function(){var t,e=new Array(this.count_),i=0;for(t=this.newest_;t;t=t.older)e[i++]=t.value_;return e},t.prototype.peekLast=function(){return this.oldest_.value_},t.prototype.peekLastKey=function(){return this.oldest_.key_},t.prototype.peekFirstKey=function(){return this.newest_.key_},t.prototype.pop=function(){var t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_},t.prototype.replace=function(t,e){this.get(t),this.entries_[t].value_=e},t.prototype.set=function(t,e){it(!(t in this.entries_),16);var i={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[t]=i,++this.count_},t.prototype.setSize=function(t){this.highWaterMark=t},t}();function as(t,e,i,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=i,n):[t,e,i]}function ls(t,e,i){return t+"/"+e+"/"+i}function hs(t){return ls(t[0],t[1],t[2])}function us(t){return t.split("/").map(Number)}var cs=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),fs=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return cs(e,t),e.prototype.expireCache=function(t){for(;this.canExpireCache();){if(this.peekLast().getKey()in t)break;this.pop().release()}},e.prototype.pruneExceptNewestZ=function(){if(0!==this.getCount()){var t=us(this.peekFirstKey())[0];this.forEach(function(e){e.tileCoord[0]!==t&&(this.remove(hs(e.tileCoord)),e.release())}.bind(this))}},e}(ss),ps=fs,ds="tileloadstart",gs="tileloadend",_s="tileloaderror",ys=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();function vs(t){return t?Array.isArray(t)?function(e){return t}:"function"==typeof t?t:function(e){return[t]}:null}var ms=function(t){function e(e){var i=t.call(this)||this;i.projection=Yr(e.projection),i.attributions_=vs(e.attributions),i.attributionsCollapsible_=void 0===e.attributionsCollapsible||e.attributionsCollapsible,i.loading=!1,i.state_=void 0!==e.state?e.state:vt,i.wrapX_=void 0!==e.wrapX&&e.wrapX,i.viewResolver=null,i.viewRejector=null;var n=i;return i.viewPromise_=new Promise((function(t,e){n.viewResolver=t,n.viewRejector=e})),i}return ys(e,t),e.prototype.getAttributions=function(){return this.attributions_},e.prototype.getAttributionsCollapsible=function(){return this.attributionsCollapsible_},e.prototype.getProjection=function(){return this.projection},e.prototype.getResolutions=function(){return W()},e.prototype.getView=function(){return this.viewPromise_},e.prototype.getState=function(){return this.state_},e.prototype.getWrapX=function(){return this.wrapX_},e.prototype.getContextOptions=function(){},e.prototype.refresh=function(){this.changed()},e.prototype.setAttributions=function(t){this.attributions_=vs(t),this.changed()},e.prototype.setState=function(t){this.state_=t,this.changed()},e}(N),xs=[0,0,0],ws=function(){function t(t){var e,i,n,r;if(this.minZoom=void 0!==t.minZoom?t.minZoom:0,this.resolutions_=t.resolutions,it((e=this.resolutions_,i=!0,n=function(t,e){return e-t}||m,e.every((function(t,r){if(0===r)return!0;var o=n(e[r-1],t);return!(o>0||i&&0===o)}))),17),!t.origins)for(var o=0,s=this.resolutions_.length-1;o=this.minZoom;){if(e(a,2===this.zoomFactor_?rr(r=Math.floor(r/2),r,o=Math.floor(o/2),o,i):this.getTileRangeForExtentAndZ(s,a,i)))return!0;--a}return!1},t.prototype.getExtent=function(){return this.extent_},t.prototype.getMaxZoom=function(){return this.maxZoom},t.prototype.getMinZoom=function(){return this.minZoom},t.prototype.getOrigin=function(t){return this.origin_?this.origin_:this.origins_[t]},t.prototype.getResolution=function(t){return this.resolutions_[t]},t.prototype.getResolutions=function(){return this.resolutions_},t.prototype.getTileCoordChildTileRange=function(t,e,i){if(t[0]this.maxZoom||e0){for(r=1;r0?r-1:r:t[r-1]-e0?n:Math.max(s/a[0],o/a[1]),h=r+1,u=new Array(h),c=0;ci||i>e.getMaxZoom())return!1;var o=e.getFullTileRange(i);return!o||o.containsXY(n,r)}(t,n)?t:null},e.prototype.clear=function(){this.tileCache.clear()},e.prototype.refresh=function(){this.clear(),t.prototype.refresh.call(this)},e.prototype.updateCacheSize=function(t,e){var i=this.getTileCacheForProjection(e);t>i.highWaterMark&&(i.highWaterMark=t)},e.prototype.useTile=function(t,e,i,n){},e}(ms),Rs=function(t){function e(e,i){var n=t.call(this,e)||this;return n.tile=i,n}return Fs(e,t),e}(_),Is=Ps;function Ms(t,e){var i=/\{z\}/g,n=/\{x\}/g,r=/\{y\}/g,o=/\{-y\}/g;return function(s,a,l){return s?t.replace(i,s[0].toString()).replace(n,s[1].toString()).replace(r,s[2].toString()).replace(o,(function(){var t=s[0],i=e.getFullTileRange(t);return it(i,55),(i.getHeight()-s[2]-1).toString()})):void 0}}function ks(t,e){for(var i=t.length,n=new Array(i),r=0;r=200&&a.status<300){var n=e.getType(),l=void 0;n==Xs||n==Ys?l=a.responseText:n==zs?(l=a.responseXML)||(l=(new DOMParser).parseFromString(a.responseText,"application/xml")):n==Ws&&(l=a.response),l?o(e.readFeatures(l,{extent:i,featureProjection:r}),e.readProjection(l)):s()}else s()},a.onerror=s,a.send()}(e,t.getFormat(),i,n,r,t.onLoad.bind(t),t.onError.bind(t))}))}var Zs=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();var Ks,Us=function(t){function e(e,i,n,r,o,s){var a=t.call(this,e,i,s)||this;return a.crossOrigin_=r,a.src_=n,a.key=n,a.image_=new Image,null!==r&&(a.image_.crossOrigin=r),a.unlisten_=null,a.tileLoadFunction_=o,a}return Zs(e,t),e.prototype.getImage=function(){return this.image_},e.prototype.setImage=function(t){this.image_=t,this.state=lr,this.unlistenImage_(),this.changed()},e.prototype.handleImageError_=function(){var t;this.state=hr,this.unlistenImage_(),this.image_=((t=ne(1,1)).fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas),this.changed()},e.prototype.handleImageLoad_=function(){var t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=lr:this.state=ur,this.unlistenImage_(),this.changed()},e.prototype.load=function(){this.state==hr&&(this.state=sr,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==sr&&(this.state=ar,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=Io(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},e.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},e}(is),qs=function(){function t(t,e,i,n,r,o){this.sourceProj_=t,this.targetProj_=e;var s={},a=Kr(this.targetProj_,this.sourceProj_);this.transformInv_=function(t){var e=t[0]+"/"+t[1];return s[e]||(s[e]=a(t)),s[e]},this.maxSourceExtent_=n,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&Bi(n)==Bi(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?Bi(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?Bi(this.targetProj_.getExtent()):null;var l=Yi(i),h=zi(i),u=Ai(i),c=ji(i),f=this.transformInv_(l),p=this.transformInv_(h),d=this.transformInv_(u),g=this.transformInv_(c),_=10+(o?Math.max(0,Math.ceil(ot(Li(i)/(o*o*256*256)))):0);if(this.addQuad_(l,h,u,c,f,p,d,g,_),this.wrapsXInSource_){var y=1/0;this.triangles_.forEach((function(t,e,i){y=Math.min(y,t.source[0][0],t.source[1][0],t.source[2][0])})),this.triangles_.forEach(function(t){if(Math.max(t.source[0][0],t.source[1][0],t.source[2][0])-y>this.sourceWorldWidth_/2){var e=[[t.source[0][0],t.source[0][1]],[t.source[1][0],t.source[1][1]],[t.source[2][0],t.source[2][1]]];e[0][0]-y>this.sourceWorldWidth_/2&&(e[0][0]-=this.sourceWorldWidth_),e[1][0]-y>this.sourceWorldWidth_/2&&(e[1][0]-=this.sourceWorldWidth_),e[2][0]-y>this.sourceWorldWidth_/2&&(e[2][0]-=this.sourceWorldWidth_);var i=Math.min(e[0][0],e[1][0],e[2][0]);Math.max(e[0][0],e[1][0],e[2][0])-i.5&&u<1,p=!1;if(l>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_)p=Bi(yi([t,e,i,n]))/this.targetWorldWidth_>.25||p;!f&&this.sourceProj_.isGlobal()&&u&&(p=u>.25||p)}if(!(!p&&this.maxSourceExtent_&&isFinite(h[0])&&isFinite(h[1])&&isFinite(h[2])&&isFinite(h[3]))||Ni(h,this.maxSourceExtent_)){var d=0;if(!(p||isFinite(r[0])&&isFinite(r[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(s[0])&&isFinite(s[1])&&isFinite(a[0])&&isFinite(a[1])))if(l>0)p=!0;else if(1!=(d=(isFinite(r[0])&&isFinite(r[1])?0:8)+(isFinite(o[0])&&isFinite(o[1])?0:4)+(isFinite(s[0])&&isFinite(s[1])?0:2)+(isFinite(a[0])&&isFinite(a[1])?0:1))&&2!=d&&4!=d&&8!=d)return;if(l>0){if(!p){var g=[(t[0]+i[0])/2,(t[1]+i[1])/2],_=this.transformInv_(g),y=void 0;if(f)y=(ht(r[0],c)+ht(s[0],c))/2-ht(_[0],c);else y=(r[0]+s[0])/2-_[0];var v=(r[1]+s[1])/2-_[1];p=y*y+v*v>this.errorThresholdSquared_}if(p){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){var m=[(e[0]+i[0])/2,(e[1]+i[1])/2],x=this.transformInv_(m),w=[(n[0]+t[0])/2,(n[1]+t[1])/2],S=this.transformInv_(w);this.addQuad_(t,e,m,w,r,o,x,S,l-1),this.addQuad_(w,m,i,n,S,x,s,a,l-1)}else{var C=[(t[0]+e[0])/2,(t[1]+e[1])/2],T=this.transformInv_(C),b=[(i[0]+n[0])/2,(i[1]+n[1])/2],O=this.transformInv_(b);this.addQuad_(t,C,b,n,r,T,O,a,l-1),this.addQuad_(C,e,i,b,T,o,s,O,l-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}0==(11&d)&&this.addTriangle_(t,i,n,r,s,a),0==(14&d)&&this.addTriangle_(t,i,e,r,s,o),d&&(0==(13&d)&&this.addTriangle_(e,n,t,o,a,r),0==(7&d)&&this.addTriangle_(e,n,i,o,a,s))}},t.prototype.calculateSourceExtent=function(){var t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach((function(e,i,n){var r=e.source;Ri(t,r[0]),Ri(t,r[1]),Ri(t,r[2])})),t},t.prototype.getTriangles=function(){return this.triangles_},t}(),Js={imageSmoothingEnabled:!1,msImageSmoothingEnabled:!1};function Hs(t,e,i,n,r){t.beginPath(),t.moveTo(0,0),t.lineTo(e,i),t.lineTo(n,r),t.closePath(),t.save(),t.clip(),t.fillRect(0,0,Math.max(e,n)+1,Math.max(i,r)),t.restore()}function Qs(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function $s(t,e,i,n){var r=Ur(i,e,t),o=zr(e,n,i),s=e.getMetersPerUnit();void 0!==s&&(o*=s);var a=t.getMetersPerUnit();void 0!==a&&(o/=a);var l=t.getExtent();if(!l||xi(l,r)){var h=zr(t,o,r)/o;isFinite(h)&&h>0&&(o/=h)}return o}function ta(t,e,i,n,r,o,s,a,l,h,u,c){var f=ne(Math.round(i*t),Math.round(i*e));if(T(f,c),0===l.length)return f.canvas;function p(t){return Math.round(t*i)/i}f.scale(i,i),f.globalCompositeOperation="lighter";var d=[1/0,1/0,-1/0,-1/0];l.forEach((function(t,e,i){var n,r;n=d,(r=t.extent)[0]n[2]&&(n[2]=r[2]),r[1]n[3]&&(n[3]=r[3])}));var g=Bi(d),_=Wi(d),y=ne(Math.round(i*g/n),Math.round(i*_/n));T(y,c);var v=i/n;l.forEach((function(t,e,i){var n=t.extent[0]-d[0],r=-(t.extent[3]-d[3]),o=Bi(t.extent),s=Wi(t.extent);t.image.width>0&&t.image.height>0&&y.drawImage(t.image,h,h,t.image.width-2*h,t.image.height-2*h,n*v,r*v,o*v,s*v)}));var m=Yi(s);return a.getTriangles().forEach((function(t,e,r){var s=t.source,a=t.target,l=s[0][0],h=s[0][1],u=s[1][0],g=s[1][1],_=s[2][0],v=s[2][1],x=p((a[0][0]-m[0])/o),w=p(-(a[0][1]-m[1])/o),S=p((a[1][0]-m[0])/o),C=p(-(a[1][1]-m[1])/o),T=p((a[2][0]-m[0])/o),b=p(-(a[2][1]-m[1])/o),O=l,E=h;l=0,h=0;var F=function(t){for(var e=t.length,i=0;ir&&(r=s,n=o)}if(0===r)return null;var a=t[n];t[n]=t[i],t[i]=a;for(var l=i+1;l=0;f--){c[f]=t[f][e]/t[f][f];for(var p=f-1;p>=0;p--)t[p][e]-=t[p][f]*c[f]}return c}([[u-=O,g-=E,0,0,S-x],[_-=O,v-=E,0,0,T-x],[0,0,u,g,C-w],[0,0,_,v,b-w]]);if(F){if(f.save(),f.beginPath(),function(){if(void 0===Ks){var t=document.createElement("canvas").getContext("2d");t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",Hs(t,4,5,4,0),Hs(t,4,5,0,5);var e=t.getImageData(0,0,3,3).data;Ks=Qs(e,0)||Qs(e,4)||Qs(e,8)}return Ks}()||c===Js){f.moveTo(S,C);for(var P=x-S,R=w-C,I=0;I<4;I++)f.lineTo(S+p((I+1)*P/4),C+p(I*R/3)),3!=I&&f.lineTo(S+p((I+1)*P/4),C+p((I+1)*R/3));f.lineTo(T,b)}else f.moveTo(S,C),f.lineTo(x,w),f.lineTo(T,b);f.clip(),f.transform(F[0],F[2],F[1],F[3],x,w),f.translate(d[0]-O,d[3]-E),f.scale(n/i,-n/i),f.drawImage(y.canvas,0,0),f.restore()}})),u&&(f.save(),f.globalCompositeOperation="source-over",f.strokeStyle="black",f.lineWidth=1,a.getTriangles().forEach((function(t,e,i){var n=t.target,r=(n[0][0]-m[0])/o,s=-(n[0][1]-m[1])/o,a=(n[1][0]-m[0])/o,l=-(n[1][1]-m[1])/o,h=(n[2][0]-m[0])/o,u=-(n[2][1]-m[1])/o;f.beginPath(),f.moveTo(a,l),f.lineTo(r,s),f.lineTo(h,u),f.closePath(),f.stroke()})),f.restore()),f.canvas}var ea=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),ia=function(t){function e(e,i,n,r,o,s,a,l,h,u,c,f){var p=t.call(this,o,sr)||this;p.renderEdges_=void 0!==c&&c,p.contextOptions_=f,p.pixelRatio_=a,p.gutter_=l,p.canvas_=null,p.sourceTileGrid_=i,p.targetTileGrid_=r,p.wrappedTileCoord_=s||o,p.sourceTiles_=[],p.sourcesListenerKeys_=null,p.sourceZ_=0;var d=r.getTileCoordExtent(p.wrappedTileCoord_),g=p.targetTileGrid_.getExtent(),_=p.sourceTileGrid_.getExtent(),y=g?Xi(d,g):d;if(0===Li(y))return p.state=ur,p;var v=e.getExtent();v&&(_=_?Xi(_,v):v);var m=r.getResolution(p.wrappedTileCoord_[0]),x=function(t,e,i,n){var r=Di(i),o=$s(t,e,r,n);return(!isFinite(o)||o<=0)&&ki(i,(function(i){return o=$s(t,e,i,n),isFinite(o)&&o>0})),o}(e,n,y,m);if(!isFinite(x)||x<=0)return p.state=ur,p;var w=void 0!==u?u:.5;if(p.triangulation_=new qs(e,n,y,_,x*w,m),0===p.triangulation_.getTriangles().length)return p.state=ur,p;p.sourceZ_=i.getZForResolution(x);var S=p.triangulation_.calculateSourceExtent();if(_&&(e.canWrapX()?(S[1]=nt(S[1],_[1],_[3]),S[3]=nt(S[3],_[1],_[3])):S=Xi(S,_)),Li(S)){for(var C=i.getTileRangeForExtentAndZ(S,p.sourceZ_),T=C.minX;T<=C.maxX;T++)for(var b=C.minY;b<=C.maxY;b++){var O=h(p.sourceZ_,T,b,a);O&&p.sourceTiles_.push(O)}0===p.sourceTiles_.length&&(p.state=ur)}else p.state=ur;return p}return ea(e,t),e.prototype.getImage=function(){return this.canvas_},e.prototype.reproject_=function(){var t=[];if(this.sourceTiles_.forEach(function(e,i,n){e&&e.getState()==lr&&t.push({extent:this.sourceTileGrid_.getTileCoordExtent(e.tileCoord),image:e.getImage()})}.bind(this)),this.sourceTiles_.length=0,0===t.length)this.state=hr;else{var e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),n="number"==typeof i?i:i[0],r="number"==typeof i?i:i[1],o=this.targetTileGrid_.getResolution(e),s=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=ta(n,r,this.pixelRatio_,s,this.sourceTileGrid_.getExtent(),o,a,this.triangulation_,t,this.gutter_,this.renderEdges_,this.contextOptions_),this.state=lr}this.changed()},e.prototype.load=function(){if(this.state==sr){this.state=ar,this.changed();var t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(function(e,i,n){var r=e.getState();if(r==sr||r==ar){t++;var o=k(e,R,(function(i){var n=e.getState();n!=lr&&n!=hr&&n!=ur||(j(o),0===--t&&(this.unlistenSources_(),this.reproject_()))}),this);this.sourcesListenerKeys_.push(o)}}.bind(this)),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach((function(t,e,i){t.getState()==sr&&t.load()}))}},e.prototype.unlistenSources_=function(){this.sourcesListenerKeys_.forEach(j),this.sourcesListenerKeys_=null},e}(is),na=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),ra=function(t){function e(e){var i=t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,opaque:e.opaque,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:oa,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection})||this;return i.crossOrigin=void 0!==e.crossOrigin?e.crossOrigin:null,i.tileClass=void 0!==e.tileClass?e.tileClass:Us,i.tileCacheForProjection={},i.tileGridForProjection={},i.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,i.contextOptions_=!1===e.imageSmoothing?Js:void 0,i.renderReprojectionEdges_=!1,i}return na(e,t),e.prototype.canExpireCache=function(){if(this.tileCache.canExpireCache())return!0;for(var t in this.tileCacheForProjection)if(this.tileCacheForProjection[t].canExpireCache())return!0;return!1},e.prototype.expireCache=function(t,e){var i=this.getTileCacheForProjection(t);for(var n in this.tileCache.expireCache(this.tileCache==i?e:{}),this.tileCacheForProjection){var r=this.tileCacheForProjection[n];r.expireCache(r==i?e:{})}},e.prototype.getContextOptions=function(){return this.contextOptions_},e.prototype.getGutterForProjection=function(t){return this.getProjection()&&t&&!Vr(this.getProjection(),t)?0:this.getGutter()},e.prototype.getGutter=function(){return 0},e.prototype.getKey=function(){return t.prototype.getKey.call(this)+(this.contextOptions_?"\n"+JSON.stringify(this.contextOptions_):"")},e.prototype.getOpaque=function(e){return!(this.getProjection()&&e&&!Vr(this.getProjection(),e))&&t.prototype.getOpaque.call(this,e)},e.prototype.getTileGridForProjection=function(t){var e=this.getProjection();if(!this.tileGrid||e&&!Vr(e,t)){var i=Y(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=Cs(t)),this.tileGridForProjection[i]}return this.tileGrid},e.prototype.getTileCacheForProjection=function(t){var e=this.getProjection();if(!e||Vr(e,t))return this.tileCache;var i=Y(t);return i in this.tileCacheForProjection||(this.tileCacheForProjection[i]=new ps(this.tileCache.highWaterMark)),this.tileCacheForProjection[i]},e.prototype.createTile_=function(t,e,i,n,r,o){var s=[t,e,i],a=this.getTileCoordForTileUrlFunction(s,r),l=a?this.tileUrlFunction(a,n,r):void 0,h=new this.tileClass(s,void 0!==l?sr:ur,void 0!==l?l:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return h.key=o,h.addEventListener(R,this.handleTileChange.bind(this)),h},e.prototype.getTile=function(t,e,i,n,r){var o=this.getProjection();if(o&&r&&!Vr(o,r)){var s=this.getTileCacheForProjection(r),a=[t,e,i],l=void 0,h=hs(a);s.containsKey(h)&&(l=s.get(h));var u=this.getKey();if(l&&l.key==u)return l;var c=this.getTileGridForProjection(o),f=this.getTileGridForProjection(r),p=this.getTileCoordForTileUrlFunction(a,r),d=new ia(o,c,r,f,a,p,this.getTilePixelRatio(n),this.getGutter(),function(t,e,i,n){return this.getTileInternal(t,e,i,n,o)}.bind(this),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.contextOptions_);return d.key=u,l?(d.interimTile=l,d.refreshInterimChain(),s.replace(h,d)):s.set(h,d),d}return this.getTileInternal(t,e,i,n,o||r)},e.prototype.getTileInternal=function(t,e,i,n,r){var o=null,s=ls(t,e,i),a=this.getKey();if(this.tileCache.containsKey(s)){if((o=this.tileCache.get(s)).key!=a){var l=o;o=this.createTile_(t,e,i,n,r,a),l.getState()==sr?o.interimTile=l.interimTile:o.interimTile=l,o.refreshInterimChain(),this.tileCache.replace(s,o)}}else o=this.createTile_(t,e,i,n,r,a),this.tileCache.set(s,o);return o},e.prototype.setRenderReprojectionEdges=function(t){if(this.renderReprojectionEdges_!=t){for(var e in this.renderReprojectionEdges_=t,this.tileCacheForProjection)this.tileCacheForProjection[e].clear();this.changed()}},e.prototype.setTileGridForProjection=function(t,e){var i=Yr(t);if(i){var n=Y(i);n in this.tileGridForProjection||(this.tileGridForProjection[n]=e)}},e}(js);function oa(t,e){t.getImage().src=e}var sa=ra,aa=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();!function(t){function e(e){var i=this,n="Unexpected response status: "+e.status;return(i=t.call(this,n)||this).name="ResponseError",i.response=e,i}aa(e,t)}(Error),function(t){function e(e){var i=t.call(this,"Failed to issue request")||this;return i.name="ClientError",i.client=e,i}aa(e,t)}(Error);var la=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),ha=function(t){function e(e){var i=t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,imageSmoothing:e.imageSmoothing,projection:Yr("EPSG:3857"),reprojectionErrorThreshold:e.reprojectionErrorThreshold,state:yt,tileLoadFunction:e.tileLoadFunction,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition,zDirection:e.zDirection})||this;if(i.tileJSON_=null,i.tileSize_=e.tileSize,e.url)if(e.jsonp)!function(t,e,i,n){var r=document.createElement("script"),o="olc_"+Y(e);function s(){delete window[o],r.parentNode.removeChild(r)}r.async=!0,r.src=t+(-1==t.indexOf("?")?"?":"&")+(n||"callback")+"="+o;var a=setTimeout((function(){s(),i&&i()}),1e4);window[o]=function(t){clearTimeout(a),s(),e(t)},document.getElementsByTagName("head")[0].appendChild(r)}(e.url,i.handleTileJSONResponse.bind(i),i.handleTileJSONError.bind(i));else{var n=new XMLHttpRequest;n.addEventListener("load",i.onXHRLoad_.bind(i)),n.addEventListener("error",i.onXHRError_.bind(i)),n.open("GET",e.url),n.send()}else e.tileJSON?i.handleTileJSONResponse(e.tileJSON):it(!1,51);return i}return la(e,t),e.prototype.onXHRLoad_=function(t){var e=t.target;if(!e.status||e.status>=200&&e.status<300){var i=void 0;try{i=JSON.parse(e.responseText)}catch(t){return void this.handleTileJSONError()}this.handleTileJSONResponse(i)}else this.handleTileJSONError()},e.prototype.onXHRError_=function(t){this.handleTileJSONError()},e.prototype.getTileJSON=function(){return this.tileJSON_},e.prototype.handleTileJSONResponse=function(t){var e,i=Yr("EPSG:4326"),n=this.getProjection();if(void 0!==t.bounds){var r=Zr(i,n);e=Vi(t.bounds,r)}var o=Es(n),s=t.minzoom||0,a=Ts({extent:o,maxZoom:t.maxzoom||22,minZoom:s,tileSize:this.tileSize_});if(this.tileGrid=a,this.tileUrlFunction=ks(t.tiles,a),void 0!==t.attribution&&!this.getAttributions()){var l=void 0!==e?e:o;this.setAttributions((function(e){return Ni(l,e.extent)?[t.attribution]:null}))}this.tileJSON_=t,this.setState(vt)},e.prototype.handleTileJSONError=function(){this.setState(mt)},e}(sa),ua=ha,ca=function(){function t(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.supportedMediaTypes=null}return t.prototype.getReadOptions=function(t,e){var i;if(e){var n=e.dataProjection?Yr(e.dataProjection):this.readProjection(t);e.extent&&n&&n.getUnits()===pr.TILE_PIXELS&&(n=Yr(n)).setWorldExtent(e.extent),i={dataProjection:n,featureProjection:e.featureProjection}}return this.adaptOptions(i)},t.prototype.adaptOptions=function(t){return T({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection},t)},t.prototype.getType=function(){return W()},t.prototype.readFeature=function(t,e){return W()},t.prototype.readFeatures=function(t,e){return W()},t.prototype.readGeometry=function(t,e){return W()},t.prototype.readProjection=function(t){return W()},t.prototype.writeFeature=function(t,e){return W()},t.prototype.writeFeatures=function(t,e){return W()},t.prototype.writeGeometry=function(t,e){return W()},t}();function fa(t,e,i,n,r,o,s){var a,l=t[e],h=t[e+1],u=t[i]-l,c=t[i+1]-h;if(0===u&&0===c)a=e;else{var f=((r-l)*u+(o-h)*c)/(u*u+c*c);if(f>1)a=i;else{if(f>0){for(var p=0;pr&&(r=h),o=a,s=l}return r}function da(t,e,i,n,r){for(var o=0,s=i.length;o>1)],e))<0?s=n+1:(a=n,l=!r);return l?s:~s}(p,y);v<0?(l=(y-p[-v-2])/(p[-v-1]-p[-v-2]),a=e+(-v-2)*n):a=e+v*n}var x=s>1?s:2,w=o||new Array(x);for(d=0;d>1;ro&&(h-a)*(o-l)-(r-a)*(u-l)>0&&s++:u<=o&&(h-a)*(o-l)-(r-a)*(u-l)<0&&s--,a=h,l=u}return 0!==s}function Ta(t,e,i,n,r,o){if(0===i.length)return!1;if(!Ca(t,e,i[0],n,r,o))return!1;for(var s=1,a=i.length;s=r[0]&&o[2]<=r[2]||(o[1]>=r[1]&&o[3]<=r[3]||ma(t,e,i,n,(function(t,e){return function(t,e,i){var n=!1,r=Ci(t,e),o=Ci(t,i);if(r===ai||o===ai)n=!0;else{var s=t[0],a=t[1],l=t[2],h=t[3],u=e[0],c=e[1],f=i[0],p=i[1],d=(p-c)/(f-u),g=void 0,_=void 0;o&li&&!(r&li)&&(n=(g=f-(p-h)/d)>=s&&g<=l),n||!(o&hi)||r&hi||(n=(_=p-(f-l)*d)>=a&&_<=h),n||!(o&ui)||r&ui||(n=(g=f-(p-a)/d)>=s&&g<=l),n||!(o&ci)||r&ci||(n=(_=p-(f-s)*d)>=a&&_<=h)}return n}(r,t,e)})))))}function Oa(t,e,i,n,r){if(!function(t,e,i,n,r){return!!(ba(t,e,i,n,r)||Ca(t,e,i,n,r[0],r[1])||Ca(t,e,i,n,r[0],r[3])||Ca(t,e,i,n,r[2],r[1])||Ca(t,e,i,n,r[2],r[3]))}(t,e,i[0],n,r))return!1;if(1===i.length)return!0;for(var o=1,s=i.length;ow&&Ta(t,e,i,n,h=(u+c)/2,d)&&(x=h,w=S),u=c}return isNaN(x)&&(x=r[o]),s?(s.push(x,d,w),s):[x,d,w]}function Va(t,e,i,n,r){for(var o=[],s=0,a=i.length;s0}function Ua(t,e,i,n,r){for(var o=void 0!==r&&r,s=0,a=i.length;se?1:t0)},i.prototype.removeEventListener=function(t,e){var i=this.listeners_&&this.listeners_[t];if(i){var n=i.indexOf(e);-1!==n&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=l,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}},i}(n),g="change",_="error",y="load";function v(t,e,i,n,r){if(n&&n!==t&&(i=i.bind(n)),r){var o=i;i=function(){t.removeEventListener(e,i),o.apply(this,arguments)}}var s={target:t,type:e,listener:i};return t.addEventListener(e,i),s}function m(t,e,i,n){return v(t,e,i,n,!0)}function x(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),u(t))}var w=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),S=function(t){function e(){var e=t.call(this)||this;return e.on=e.onInternal,e.once=e.onceInternal,e.un=e.unInternal,e.revision_=0,e}return w(e,t),e.prototype.changed=function(){++this.revision_,this.dispatchEvent(g)},e.prototype.getRevision=function(){return this.revision_},e.prototype.onInternal=function(t,e){if(Array.isArray(t)){for(var i=t.length,n=new Array(i),r=0;r1?(i=r,n=o):l>0&&(i+=s*l,n+=a*l)}return Z(t,e,i,n)}function Z(t,e,i,n){var r=i-t,o=n-e;return r*r+o*o}function K(t){return t*Math.PI/180}function U(t,e){var i=t%e;return i*e<0?i+e:i}function q(t,e,i){return t+i*(e-t)}var J=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),H=function(t){function e(e){var i=t.call(this)||this;i.on,i.once,i.un;var n=h({},e);return"object"==typeof e.properties&&(delete n.properties,h(n,e.properties)),n[P]=void 0!==e.opacity?e.opacity:1,Y("number"==typeof n[P],64),n[I]=void 0===e.visible||e.visible,n[k]=e.zIndex,n[L]=void 0!==e.maxResolution?e.maxResolution:1/0,n[A]=void 0!==e.minResolution?e.minResolution:0,n[D]=void 0!==e.minZoom?e.minZoom:-1/0,n[j]=void 0!==e.maxZoom?e.maxZoom:1/0,i.className_=void 0!==n.className?e.className:"ol-layer",delete n.className,i.setProperties(n),i.state_=null,i}return J(e,t),e.prototype.getClassName=function(){return this.className_},e.prototype.getLayerState=function(t){var e=this.state_||{layer:this,managed:void 0===t||t},i=this.getZIndex();return e.opacity=z(Math.round(100*this.getOpacity())/100,0,1),e.sourceState=this.getSourceState(),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=void 0!==i||e.managed?i:1/0,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e},e.prototype.getLayersArray=function(t){return T()},e.prototype.getLayerStatesArray=function(t){return T()},e.prototype.getExtent=function(){return this.get(M)},e.prototype.getMaxResolution=function(){return this.get(L)},e.prototype.getMinResolution=function(){return this.get(A)},e.prototype.getMinZoom=function(){return this.get(D)},e.prototype.getMaxZoom=function(){return this.get(j)},e.prototype.getOpacity=function(){return this.get(P)},e.prototype.getSourceState=function(){return T()},e.prototype.getVisible=function(){return this.get(I)},e.prototype.getZIndex=function(){return this.get(k)},e.prototype.setExtent=function(t){this.set(M,t)},e.prototype.setMaxResolution=function(t){this.set(L,t)},e.prototype.setMinResolution=function(t){this.set(A,t)},e.prototype.setMaxZoom=function(t){this.set(j,t)},e.prototype.setMinZoom=function(t){this.set(D,t)},e.prototype.setOpacity=function(t){Y("number"==typeof t,64),this.set(P,t)},e.prototype.setVisible=function(t){this.set(I,t)},e.prototype.setZIndex=function(t){this.set(k,t)},e.prototype.disposeInternal=function(){this.state_&&(this.state_.layer=null,this.state_=null),t.prototype.disposeInternal.call(this)},e}(R),$="prerender",Q="postrender",tt="precompose",et="undefined",it="loading",nt="ready",rt="error",ot=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),st=function(t){function e(e){var i=this,n=h({},e);delete n.source,(i=t.call(this,n)||this).on,i.once,i.un,i.mapPrecomposeKey_=null,i.mapRenderKey_=null,i.sourceChangeKey_=null,i.renderer_=null,e.render&&(i.render=e.render),e.map&&i.setMap(e.map),i.addChangeListener(G,i.handleSourcePropertyChange_);var r=e.source?e.source:null;return i.setSource(r),i}return ot(e,t),e.prototype.getLayersArray=function(t){var e=t||[];return e.push(this),e},e.prototype.getLayerStatesArray=function(t){var e=t||[];return e.push(this.getLayerState()),e},e.prototype.getSource=function(){return this.get(G)||null},e.prototype.getSourceState=function(){var t=this.getSource();return t?t.getState():et},e.prototype.handleSourceChange_=function(){this.changed()},e.prototype.handleSourcePropertyChange_=function(){this.sourceChangeKey_&&(x(this.sourceChangeKey_),this.sourceChangeKey_=null);var t=this.getSource();t&&(this.sourceChangeKey_=v(t,g,this.handleSourceChange_,this)),this.changed()},e.prototype.getFeatures=function(t){return this.renderer_?this.renderer_.getFeatures(t):new Promise((function(t){return t([])}))},e.prototype.render=function(t,e){var i=this.getRenderer();if(i.prepareFrame(t))return i.renderFrame(t,e)},e.prototype.setMap=function(t){this.mapPrecomposeKey_&&(x(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(x(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=v(t,tt,(function(t){var e=t.frameState.layerStatesArray,i=this.getLayerState(!1);Y(!e.some((function(t){return t.layer===i.layer})),67),e.push(i)}),this),this.mapRenderKey_=v(this,g,t.render,t),this.changed())},e.prototype.setSource=function(t){this.set(G,t)},e.prototype.getRenderer=function(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_},e.prototype.hasRenderer=function(){return!!this.renderer_},e.prototype.createRenderer=function(){return null},e.prototype.disposeInternal=function(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_),this.setSource(null),t.prototype.disposeInternal.call(this)},e}(H);function at(t,e,i,n,r){lt(t,e,i||0,n||t.length-1,r||ut)}function lt(t,e,i,n,r){for(;n>i;){if(n-i>600){var o=n-i+1,s=e-i+1,a=Math.log(o),l=.5*Math.exp(2*a/3),h=.5*Math.sqrt(a*l*(o-l)/o)*(s-o/2<0?-1:1);lt(t,e,Math.max(i,Math.floor(e-s*l/o+h)),Math.min(n,Math.floor(e+(o-s)*l/o+h)),r)}var u=t[e],c=i,f=n;for(ht(t,i,e),r(t[n],u)>0&&ht(t,i,n);c0;)f--}0===r(t[i],u)?ht(t,i,f):ht(t,++f,n),f<=e&&(i=f+1),e<=f&&(n=f-1)}}function ht(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function ut(t,e){return te?1:0}class ct{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const i=[];if(!St(t,e))return i;const n=this.toBBox,r=[];for(;e;){for(let o=0;o=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(n,r,e)}_split(t,e){const i=t[e],n=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,n);const o=this._chooseSplitIndex(i,r,n),s=Ct(i.children.splice(o,i.children.length-o));s.height=i.height,s.leaf=i.leaf,pt(i,this.toBBox),pt(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(i,s)}_splitRoot(t,e){this.data=Ct([t,e]),this.data.height=t.height+1,this.data.leaf=!1,pt(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let n,r=1/0,o=1/0;for(let s=e;s<=i-e;s++){const e=dt(t,0,s,this.toBBox),a=dt(t,s,i,this.toBBox),l=xt(e,a),h=vt(e)+vt(a);l=e;n--){const e=t.children[n];gt(s,t.leaf?r(e):e),a+=mt(s)}return a}_adjustParentBBoxes(t,e,i){for(let n=i;n>=0;n--)gt(e[n],t)}_condense(t){for(let e,i=t.length-1;i>=0;i--)0===t[i].children.length?i>0?(e=t[i-1].children,e.splice(e.indexOf(t[i]),1)):this.clear():pt(t[i],this.toBBox)}}function ft(t,e,i){if(!i)return e.indexOf(t);for(let n=0;n=t.minX&&e.maxY>=t.minY}function Ct(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Tt(t,e,i,n,r){const o=[e,i];for(;o.length;){if((i=o.pop())-(e=o.pop())<=n)continue;const s=e+Math.ceil((i-e)/n/2)*n;at(t,s,e,i,r),o.push(e,s,s,i)}}var Ot=0,bt=1,Et=2,Ft=3;function Rt(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}var Pt=function(){function t(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=Rt(t.scale),this.displacement_=t.displacement}return t.prototype.clone=function(){var e=this.getScale();return new t({opacity:this.getOpacity(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice()})},t.prototype.getOpacity=function(){return this.opacity_},t.prototype.getRotateWithView=function(){return this.rotateWithView_},t.prototype.getRotation=function(){return this.rotation_},t.prototype.getScale=function(){return this.scale_},t.prototype.getScaleArray=function(){return this.scaleArray_},t.prototype.getDisplacement=function(){return this.displacement_},t.prototype.getAnchor=function(){return T()},t.prototype.getImage=function(t){return T()},t.prototype.getHitDetectionImage=function(){return T()},t.prototype.getPixelRatio=function(t){return 1},t.prototype.getImageState=function(){return T()},t.prototype.getImageSize=function(){return T()},t.prototype.getOrigin=function(){return T()},t.prototype.getSize=function(){return T()},t.prototype.setOpacity=function(t){this.opacity_=t},t.prototype.setRotateWithView=function(t){this.rotateWithView_=t},t.prototype.setRotation=function(t){this.rotation_=t},t.prototype.setScale=function(t){this.scale_=t,this.scaleArray_=Rt(t)},t.prototype.listenImageChange=function(t){T()},t.prototype.load=function(){T()},t.prototype.unlistenImageChange=function(t){T()},t}(),It=Pt,Mt=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,kt=/^([a-z]*)$|^hsla?\(.*\)$/i;function Lt(t){return"string"==typeof t?t:Gt(t)}var At=function(){var t={},e=0;return function(i){var n;if(t.hasOwnProperty(i))n=t[i];else{if(e>=1024){var r=0;for(var o in t)0==(3&r++)&&(delete t[o],--e)}n=function(t){var e,i,n,r,o;kt.exec(t)&&(t=function(t){var e=document.createElement("div");if(e.style.color=t,""!==e.style.color){document.body.appendChild(e);var i=getComputedStyle(e).color;return document.body.removeChild(e),i}return""}(t));if(Mt.exec(t)){var s=t.length-1,a=void 0;a=s<=4?1:2;var l=4===s||8===s;e=parseInt(t.substr(1+0*a,a),16),i=parseInt(t.substr(1+1*a,a),16),n=parseInt(t.substr(1+2*a,a),16),r=l?parseInt(t.substr(1+3*a,a),16):255,1==a&&(e=(e<<4)+e,i=(i<<4)+i,n=(n<<4)+n,l&&(r=(r<<4)+r)),o=[e,i,n,r/255]}else 0==t.indexOf("rgba(")?Dt(o=t.slice(5,-1).split(",").map(Number)):0==t.indexOf("rgb(")?((o=t.slice(4,-1).split(",").map(Number)).push(1),Dt(o)):Y(!1,14);return o}(i),t[i]=n,++e}return n}}();function jt(t){return Array.isArray(t)?t:At(t)}function Dt(t){return t[0]=z(t[0]+.5|0,0,255),t[1]=z(t[1]+.5|0,0,255),t[2]=z(t[2]+.5|0,0,255),t[3]=z(t[3],0,1),t}function Gt(t){var e=t[0];e!=(0|e)&&(e=e+.5|0);var i=t[1];i!=(0|i)&&(i=i+.5|0);var n=t[2];return n!=(0|n)&&(n=n+.5|0),"rgba("+e+","+i+","+n+","+(void 0===t[3]?1:t[3])+")"}function Wt(t){return Array.isArray(t)?Gt(t):t}var Xt="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"";Xt.indexOf("firefox"),-1!==Xt.indexOf("safari")&&Xt.indexOf("chrom"),-1!==Xt.indexOf("webkit")&&Xt.indexOf("edge"),Xt.indexOf("macintosh");var Yt="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,zt="undefined"!=typeof Image&&Image.prototype.decode;function Bt(t,e,i,n){var r;return i&&i.length?r=i.shift():Yt?r=new OffscreenCanvas(t||300,e||300):(r=document.createElement("canvas")).style.all="unset",t&&(r.width=t),e&&(r.height=e),r.getContext("2d",n)}function Nt(t){return t&&t.parentNode?t.parentNode.removeChild(t):null}!function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch(t){}}();var Vt=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))","?\\s*([-,\\\"\\'\\sa-z]+?)\\s*$"].join(""),"i"),Zt=["style","variant","weight","size","lineHeight","family"],Kt=function(t){var e=t.match(Vt);if(!e)return null;for(var i={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"},n=0,r=Zt.length;nr&&(l|=qe),ao&&(l|=Ue),l===Ze&&(l=Ke),l}function ui(){return[1/0,1/0,-1/0,-1/0]}function ci(t,e,i,n,r){return r?(r[0]=t,r[1]=e,r[2]=i,r[3]=n,r):[t,e,i,n]}function fi(t){return ci(1/0,1/0,-1/0,-1/0,t)}function pi(t,e){var i=t[0],n=t[1];return ci(i,n,i,n,e)}function di(t,e,i,n,r){return yi(fi(r),t,e,i,n)}function gi(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function _i(t,e){e[0]t[2]&&(t[2]=e[0]),e[1]t[3]&&(t[3]=e[1])}function yi(t,e,i,n,r){for(;ie[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function Ii(t,e,i,n){var r=[];if(n>1)for(var o=t[2]-t[0],s=t[3]-t[1],a=0;au&&this.instructions.push([Ve.CUSTOM,u,r,t,i,Mi])):l==Se&&(n=t.getFlatCoordinates(),this.coordinates.push(n[0],n[1]),r=this.coordinates.length,this.instructions.push([Ve.CUSTOM,u,r,t,i]));this.endGeometry(e)},e.prototype.beginGeometry=function(t,e){this.beginGeometryInstruction1_=[Ve.BEGIN_GEOMETRY,e,0,t],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[Ve.BEGIN_GEOMETRY,e,0,t],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)},e.prototype.finish=function(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}},e.prototype.reverseHitDetectionInstructions=function(){var t,e=this.hitDetectionInstructions;e.reverse();var i,n,r=e.length,s=-1;for(t=0;tthis.maxLineWidth&&(this.maxLineWidth=i.lineWidth,this.bufferedMaxExtent_=null)}else i.strokeStyle=void 0,i.lineCap=void 0,i.lineDash=null,i.lineDashOffset=void 0,i.lineJoin=void 0,i.lineWidth=void 0,i.miterLimit=void 0},e.prototype.createFill=function(t){var e=t.fillStyle,i=[Ve.SET_FILL_STYLE,e];return"string"!=typeof e&&i.push(!0),i},e.prototype.applyStroke=function(t){this.instructions.push(this.createStroke(t))},e.prototype.createStroke=function(t){return[Ve.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]},e.prototype.updateFillStyle=function(t,e){var i=t.fillStyle;"string"==typeof i&&t.currentFillStyle==i||(void 0!==i&&this.instructions.push(e.call(this,t)),t.currentFillStyle=i)},e.prototype.updateStrokeStyle=function(t,e){var i=t.strokeStyle,n=t.lineCap,r=t.lineDash,o=t.lineDashOffset,s=t.lineJoin,l=t.lineWidth,h=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=n||r!=t.currentLineDash&&!a(t.currentLineDash,r)||t.currentLineDashOffset!=o||t.currentLineJoin!=s||t.currentLineWidth!=l||t.currentMiterLimit!=h)&&(void 0!==i&&e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=r,t.currentLineDashOffset=o,t.currentLineJoin=s,t.currentLineWidth=l,t.currentMiterLimit=h)},e.prototype.endGeometry=function(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;var e=[Ve.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)},e.prototype.getBufferedMaxExtent=function(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=(e=this.maxExtent,i?(i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i):e.slice()),this.maxLineWidth>0)){var t=this.resolution*(this.maxLineWidth+1)/2;ri(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}var e,i;return this.bufferedMaxExtent_},e}($e),Di=ji,Gi=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Wi=function(t){function e(e,i,n,r){var o=t.call(this,e,i,n,r)||this;return o.hitDetectionImage_=null,o.image_=null,o.imagePixelRatio_=void 0,o.anchorX_=void 0,o.anchorY_=void 0,o.height_=void 0,o.opacity_=void 0,o.originX_=void 0,o.originY_=void 0,o.rotateWithView_=void 0,o.rotation_=void 0,o.scale_=void 0,o.width_=void 0,o.declutterImageWithText_=void 0,o}return Gi(e,t),e.prototype.drawPoint=function(t,e){if(this.image_){this.beginGeometry(t,e);var i=t.getFlatCoordinates(),n=t.getStride(),r=this.coordinates.length,o=this.appendFlatPointCoordinates(i,n);this.instructions.push([Ve.DRAW_IMAGE,r,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterImageWithText_]),this.hitDetectionInstructions.push([Ve.DRAW_IMAGE,r,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterImageWithText_]),this.endGeometry(e)}},e.prototype.drawMultiPoint=function(t,e){if(this.image_){this.beginGeometry(t,e);var i=t.getFlatCoordinates(),n=t.getStride(),r=this.coordinates.length,o=this.appendFlatPointCoordinates(i,n);this.instructions.push([Ve.DRAW_IMAGE,r,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterImageWithText_]),this.hitDetectionInstructions.push([Ve.DRAW_IMAGE,r,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterImageWithText_]),this.endGeometry(e)}},e.prototype.finish=function(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,t.prototype.finish.call(this)},e.prototype.setImageStyle=function(t,e){var i=t.getAnchor(),n=t.getSize(),r=t.getHitDetectionImage(),o=t.getImage(this.pixelRatio),s=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=r,this.image_=o,this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=s[0]*this.imagePixelRatio_,this.originY_=s[1]*this.imagePixelRatio_,this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=n[0],this.declutterImageWithText_=e},e}(Di),Xi=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Yi=function(t){function e(e,i,n,r){return t.call(this,e,i,n,r)||this}return Xi(e,t),e.prototype.drawFlatCoordinates_=function(t,e,i,n){var r=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,i,n,!1,!1),s=[Ve.MOVE_TO_LINE_TO,r,o];return this.instructions.push(s),this.hitDetectionInstructions.push(s),i},e.prototype.drawLineString=function(t,e){var i=this.state,n=i.strokeStyle,r=i.lineWidth;if(void 0!==n&&void 0!==r){this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([Ve.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,$t,0],Be);var o=t.getFlatCoordinates(),s=t.getStride();this.drawFlatCoordinates_(o,0,o.length,s),this.hitDetectionInstructions.push(ze),this.endGeometry(e)}},e.prototype.drawMultiLineString=function(t,e){var i=this.state,n=i.strokeStyle,r=i.lineWidth;if(void 0!==n&&void 0!==r){this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([Ve.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset],Be);for(var o=t.getEnds(),s=t.getFlatCoordinates(),a=t.getStride(),l=0,h=0,u=o.length;h0;){for(var c=h.pop(),f=h.pop(),p=0,d=t[f],g=t[f+1],_=t[c],y=t[c+1],v=f+n;vp&&(u=v,p=m)}p>r&&(l[(u-e)/n]=1,f+n0&&g>p)&&(d<0&&_0&&_>d)?(a=c,l=f):(o[s++]=a,o[s++]=l,h=a,u=l,a=c,l=f)}}return o[s++]=a,o[s++]=l,s}function Vi(t,e,i,n,r,o,s,a){for(var l=0,h=i.length;lt&&(y>_&&(_=y,d=v,g=o),y=0,v=o-r)),s=a,u=f,c=p),l=m,h=x}return(y+=a)>_?[v,o]:[d,g]}var $i,Qi=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),tn={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},en=function(t){function e(e,i,n,r){var o=t.call(this,e,i,n,r)||this;return o.labels_=null,o.text_="",o.textOffsetX_=0,o.textOffsetY_=0,o.textRotateWithView_=void 0,o.textRotation_=0,o.textFillState_=null,o.fillStates={},o.textStrokeState_=null,o.strokeStates={},o.textState_={},o.textStates={},o.textKey_="",o.fillKey_="",o.strokeKey_="",o.declutterImageWithText_=void 0,o}return Qi(e,t),e.prototype.finish=function(){var e=t.prototype.finish.call(this);return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e},e.prototype.drawText=function(t,e){var i=this.textFillState_,n=this.textStrokeState_,r=this.textState_;if(""!==this.text_&&r&&(i||n)){var o=this.coordinates,s=o.length,a=t.getType(),l=null,h=t.getStride();if(r.placement!==Ji||a!=Ce&&a!=Ee&&a!=Oe&&a!=Fe){var u=r.overflow?null:[];switch(a){case Se:case be:l=t.getFlatCoordinates();break;case Ce:l=t.getFlatMidpoint();break;case Pe:l=t.getCenter();break;case Ee:l=t.getFlatMidpoints(),h=2;break;case Oe:l=t.getFlatInteriorPoint(),r.overflow||u.push(l[2]/this.resolution),h=3;break;case Fe:var c=t.getFlatInteriorPoints();l=[];for(S=0,C=c.length;SF[2]}else O=x>b;var R,P=Math.PI,I=[],M=S+n===e;if(_=0,y=C,f=t[e=S],p=t[e+1],M){v(),R=Math.atan2(p-g,f-d),O&&(R+=R>0?-P:P);var k=(b+x)/2,L=(E+w)/2;return I[0]=[k,L,(T-o)/2,R,r],I}for(var A=0,j=r.length;A0?-P:P),void 0!==R){var G=D-R;if(G+=G>P?-2*P:G<-P?2*P:0,Math.abs(G)>s)return null}R=D;for(var W=A,X=0;At?t-l:r,x=o+h>e?e-h:o,w=p[3]+m*c[0]+p[1],S=p[0]+x*c[1]+p[2],C=y-p[3],T=v-p[0];return(d||0!==u)&&(Cn[0]=C,bn[0]=C,Cn[1]=T,Tn[1]=T,Tn[0]=C+w,On[0]=Tn[0],On[1]=T+S,bn[1]=On[1]),0!==u?(gn(_=yn([1,0,0,1,0,0],i,n,1,1,u,-i,-n),Cn),gn(_,Tn),gn(_,On),gn(_,bn),ci(Math.min(Cn[0],Tn[0],On[0],bn[0]),Math.min(Cn[1],Tn[1],On[1],bn[1]),Math.max(Cn[0],Tn[0],On[0],bn[0]),Math.max(Cn[1],Tn[1],On[1],bn[1]),Sn)):ci(Math.min(C,C+w),Math.min(T,T+S),Math.max(C,C+w),Math.max(T,T+S),Sn),f&&(y=Math.round(y),v=Math.round(v)),{drawImageX:y,drawImageY:v,drawImageW:m,drawImageH:x,originX:l,originY:h,declutterBox:{minX:Sn[0],minY:Sn[1],maxX:Sn[2],maxY:Sn[3],value:g},canvasTransform:_,scale:c}},t.prototype.replayImageOrLabel_=function(t,e,i,n,r,o,s){var a=!(!o&&!s),l=n.declutterBox,h=t.canvas,u=s?s[2]*n.scale[0]/2:0;return l.minX-u<=h.width/e&&l.maxX+u>=0&&l.minY-u<=h.height/e&&l.maxY+u>=0&&(a&&this.replayTextBackground_(t,Cn,Tn,On,bn,o,s),de(t,n.canvasTransform,r,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0},t.prototype.fill_=function(t){if(this.alignFill_){var e=gn(this.renderedTransform_,[0,0]),i=512*this.pixelRatio;t.save(),t.translate(e[0]%i,e[1]%i),t.rotate(this.viewRotation_)}t.fill(),this.alignFill_&&t.restore()},t.prototype.setStrokeStyle_=function(t,e){t.strokeStyle=e[1],t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.setLineDash&&(t.lineDashOffset=e[7],t.setLineDash(e[6]))},t.prototype.drawLabelWithPointPlacement_=function(t,e,i,n){var r=this.textStates[e],o=this.createLabel(t,e,n,i),s=this.strokeStates[i],a=this.pixelRatio,l=Rn(t,r.textAlign||ee),h=tn[r.textBaseline||ie],u=s&&s.lineWidth?s.lineWidth:0;return{label:o,anchorX:l*(o.width/a-2*r.scale[0])+2*(.5-l)*u,anchorY:h*o.height/a+2*(.5-h)*u}},t.prototype.execute_=function(t,e,i,n,r,o,s,l){var h,u,c;this.pixelCoordinates_&&a(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=vn(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),u=this.renderedTransform_,c=i,u[0]=c[0],u[1]=c[1],u[2]=c[2],u[3]=c[3],u[4]=c[4],u[5]=c[5]);for(var f,p,d,g,_,y,v,m,x,w,S,C,T,O,b,E,F=0,R=n.length,P=0,I=0,M=0,k=null,L=null,A=this.coordinateCache_,j=this.viewRotation_,D=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,G={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:j},W=this.instructions!=n||this.overlaps?0:200;FW&&(this.fill_(t),I=0),M>W&&(t.stroke(),M=0),I||M||(t.beginPath(),g=NaN,_=NaN),++F;break;case Ve.CIRCLE:var Y=h[P=X[1]],z=h[P+1],B=h[P+2]-Y,N=h[P+3]-z,V=Math.sqrt(B*B+N*N);t.moveTo(Y+V,z),t.arc(Y,z,V,0,2*Math.PI,!0),++F;break;case Ve.CLOSE_PATH:t.closePath(),++F;break;case Ve.CUSTOM:P=X[1],f=X[2];var Z=X[3],K=X[4],U=6==X.length?X[5]:void 0;G.geometry=Z,G.feature=T,F in A||(A[F]=[]);var q=A[F];U?U(h,P,f,2,q):(q[0]=h[P],q[1]=h[P+1],q.length=2),K(q,G),++F;break;case Ve.DRAW_IMAGE:P=X[1],f=X[2],m=X[3],p=X[4],d=X[5];var J=X[6],H=X[7],$=X[8],Q=X[9],tt=X[10],et=X[11],it=X[12],nt=X[13],rt=X[14];if(!m&&X.length>=19){x=X[18],w=X[19],S=X[20],C=X[21];var ot=this.drawLabelWithPointPlacement_(x,w,S,C);m=ot.label,X[3]=m;var st=X[22];p=(ot.anchorX-st)*this.pixelRatio,X[4]=p;var at=X[23];d=(ot.anchorY-at)*this.pixelRatio,X[5]=d,J=m.height,X[6]=J,nt=m.width,X[13]=nt}var lt=void 0;X.length>24&&(lt=X[24]);var ht=void 0,ut=void 0,ct=void 0;X.length>16?(ht=X[15],ut=X[16],ct=X[17]):(ht=ne,ut=!1,ct=!1),tt&&D?et+=j:tt||D||(et-=j);for(var ft=0;Pi)break;var a=n[s];a||(a=[],n[s]=a),a.push(4*((t+r)*e+(t+o))+3),r>0&&a.push(4*((t-r)*e+(t+o))+3),o>0&&(a.push(4*((t+r)*e+(t-o))+3),r>0&&a.push(4*((t-r)*e+(t-o))+3))}for(var l=[],h=(r=0,n.length);r0){if(!s||f!==an&&f!==un||-1!==s.indexOf(t)){var h=(p[r]-3)/4,u=n-h%a,d=n-(h/a|0),g=o(t,e,u*u+d*d);if(g)return g}c.clearRect(0,0,a,a);break}}var g,_,y,v,m,x=Object.keys(this.executorsByZIndex_).map(Number);for(x.sort(r),g=x.length-1;g>=0;--g){var w=x[g].toString();for(y=this.executorsByZIndex_[w],_=Mn.length-1;_>=0;--_)if(void 0!==(v=y[f=Mn[_]])&&(m=v.executeHitDetection(c,l,i,d,u)))return m}},t.prototype.getClipCoords=function(t){var e=this.maxExtent_;if(!e)return null;var i=e[0],n=e[1],r=e[2],o=e[3],s=[i,n,i,o,r,o,r,n];return vn(s,0,8,2,t,s),s},t.prototype.isEmpty=function(){return c(this.executorsByZIndex_)},t.prototype.execute=function(t,e,i,n,o,s,a){var l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(r),this.maxExtent_&&(t.save(),this.clip(t,i));var h,u,c,f,p,d,g=s||Mn;for(a&&l.reverse(),h=0,u=l.length;hthis.maxX&&(this.maxX=t.maxX),t.minYthis.maxY&&(this.maxY=t.maxY)},t.prototype.getHeight=function(){return this.maxY-this.minY+1},t.prototype.getSize=function(){return[this.getWidth(),this.getHeight()]},t.prototype.getWidth=function(){return this.maxX-this.minX+1},t.prototype.intersects=function(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY},t}();function Nn(t,e,i,n,r){return void 0!==r?(r.minX=t,r.maxX=e,r.minY=i,r.maxY=n,r):new Bn(t,e,i,n)}var Vn=Bn,Zn=0,Kn=1,Un=2,qn=3,Jn=4,Hn={RADIANS:"radians",DEGREES:"degrees",FEET:"ft",METERS:"m",PIXELS:"pixels",TILE_PIXELS:"tile-pixels",USFEET:"us-ft"},$n={};$n[Hn.RADIANS]=6370997/(2*Math.PI),$n[Hn.DEGREES]=2*Math.PI*6370997/360,$n[Hn.FEET]=.3048,$n[Hn.METERS]=1,$n[Hn.USFEET]=1200/3937;var Qn=Hn,tr=function(){function t(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}return t.prototype.canWrapX=function(){return this.canWrapX_},t.prototype.getCode=function(){return this.code_},t.prototype.getExtent=function(){return this.extent_},t.prototype.getUnits=function(){return this.units_},t.prototype.getMetersPerUnit=function(){return this.metersPerUnit_||$n[this.units_]},t.prototype.getWorldExtent=function(){return this.worldExtent_},t.prototype.getAxisOrientation=function(){return this.axisOrientation_},t.prototype.isGlobal=function(){return this.global_},t.prototype.setGlobal=function(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)},t.prototype.getDefaultTileGrid=function(){return this.defaultTileGrid_},t.prototype.setDefaultTileGrid=function(t){this.defaultTileGrid_=t},t.prototype.setExtent=function(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)},t.prototype.setWorldExtent=function(t){this.worldExtent_=t},t.prototype.setGetPointResolution=function(t){this.getPointResolutionFunc_=t},t.prototype.getPointResolutionFunc=function(){return this.getPointResolutionFunc_},t}(),er=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),ir=6378137,nr=Math.PI*ir,rr=[-nr,-nr,nr,nr],or=[-180,-85,180,85],sr=ir*Math.log(Math.tan(Math.PI/2)),ar=function(t){function e(e){return t.call(this,{code:e,units:Qn.METERS,extent:rr,global:!0,worldExtent:or,getPointResolution:function(t,e){return t/B(e[1]/ir)}})||this}return er(e,t),e}(tr),lr=[new ar("EPSG:3857"),new ar("EPSG:102100"),new ar("EPSG:102113"),new ar("EPSG:900913"),new ar("http://www.opengis.net/def/crs/EPSG/0/3857"),new ar("http://www.opengis.net/gml/srs/epsg.xml#3857")];function hr(t,e,i){var n=t.length,r=i>1?i:2,o=e;void 0===o&&(o=r>2?t.slice():new Array(n));for(var s=0;ssr?a=sr:a<-sr&&(a=-sr),o[s+1]=a}return o}function ur(t,e,i){var n=t.length,r=i>1?i:2,o=e;void 0===o&&(o=r>2?t.slice():new Array(n));for(var s=0;sn[2])){var o=i||Ri(n);r=Math.floor((t[0]-n[0])/o)}return r}(t,e,i);n&&(t[0]-=n*i)}return t}function Tr(t,e,i){var n;if(void 0!==e){for(var r=0,o=t.length;r0&&(this.newTiles_=!0):a.setState(Un)),this.isDrawableTile(a)||(a=a.getInterimTile()),a},e.prototype.loadedTileCallback=function(e,i,n){return!!this.isDrawableTile(n)&&t.prototype.loadedTileCallback.call(this,e,i,n)},e.prototype.prepareFrame=function(t){return!!this.getLayer().getSource()},e.prototype.renderFrame=function(t,e){var i=t.layerStatesArray[t.layerIndex],n=t.viewState,o=n.projection,s=n.resolution,a=n.center,l=n.rotation,u=t.pixelRatio,c=this.getLayer(),f=c.getSource(),p=f.getRevision(),d=f.getTileGridForProjection(o),g=d.getZForResolution(s,f.zDirection),_=d.getResolution(g),y=t.extent,v=i.extent&&Ar(i.extent);v&&(y=bi(y,Ar(i.extent)));var m=f.getTilePixelRatio(u),x=Math.round(t.size[0]*m),w=Math.round(t.size[1]*m);if(l){var S=Math.round(Math.sqrt(x*x+w*w));x=S,w=S}var C=_*x/2/m,T=_*w/2/m,O=[a[0]-C,a[1]-T,a[0]+C,a[1]+T],E=d.getTileRangeForExtentAndZ(y,g),F={};F[g]={};var R=this.createLoadedTileFinder(f,o,F),P=this.tmpExtent,I=this.tmpTileRange_;this.newTiles_=!1;for(var M=E.minX;M<=E.maxX;++M)for(var k=E.minY;k<=E.maxY;++k){var L=this.getTile(g,M,k,t);if(this.isDrawableTile(L)){var A=b(this);if(L.getState()==Un){F[g][L.tileCoord.toString()]=L;var j=L.inTransition(A);this.newTiles_||!j&&-1!==this.renderedTiles.indexOf(L)||(this.newTiles_=!0)}if(1===L.getAlpha(A,t.time))continue}var D=d.getTileCoordChildTileRange(L.tileCoord,I,P),G=!1;D&&(G=R(g+1,D)),G||d.forEachTileCoordParentTileRange(L.tileCoord,R,I,P)}var W=_/s;yn(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/m,1/m,l,-x/2,-w/2);var X=function(t){var e="matrix("+t.join(", ")+")";if(Yt)return e;var i=$i||($i=document.createElement("div"));return i.style.transform=e,i.style.transform}(this.pixelTransform);this.useContainer(e,X,i.opacity);var z=this.context,B=z.canvas;!function(t,e){var i,n=(i=e)[0]*i[3]-i[1]*i[2];Y(0!==n,32);var r=e[0],o=e[1],s=e[2],a=e[3],l=e[4],h=e[5];t[0]=a/n,t[1]=-o/n,t[2]=-s/n,t[3]=r/n,t[4]=(s*h-a*l)/n,t[5]=-(r*h-o*l)/n}(this.inversePixelTransform,this.pixelTransform),yn(this.tempTransform,x/2,w/2,W,W,0,-x/2,-w/2),B.width!=x||B.height!=w?(B.width=x,B.height=w):this.containerReused||z.clearRect(0,0,x,w),v&&this.clipUnrotated(z,t,v),h(z,f.getContextOptions()),this.preRender(z,t),this.renderedTiles.length=0;var N,V,Z,K=Object.keys(F).map(Number);K.sort(r),1!==i.opacity||this.containerReused&&!f.getOpaque(t.viewState.projection)?(N=[],V=[]):K=K.reverse();for(var U=K.length-1;U>=0;--U){var q=K[U],J=f.getTilePixelSize(q,u,o),H=d.getResolution(q)/_,$=J[0]*H*W,Q=J[1]*H*W,tt=d.getTileCoordForCoordAndZ(Ei(O),q),et=d.getTileCoordExtent(tt),it=gn(this.tempTransform,[m*(et[0]-O[0])/_,m*(O[3]-et[3])/_]),nt=m*f.getGutterForProjection(o),rt=F[q];for(var ot in rt){var st=(L=rt[ot]).tileCoord,at=tt[1]-st[1],lt=Math.round(it[0]-(at-1)*$),ht=tt[2]-st[2],ut=Math.round(it[1]-(ht-1)*Q),ct=lt-(M=Math.round(it[0]-at*$)),ft=ut-(k=Math.round(it[1]-ht*Q)),pt=g===q;if(!(j=pt&&1!==L.getAlpha(b(this),t.time)))if(N){z.save(),Z=[M,k,M+ct,k,M+ct,k+ft,M,k+ft];for(var dt=0,gt=N.length;dtthis.maxCacheSize_},t.prototype.expire=function(){if(this.canExpireCache()){var t=0;for(var e in this.cache_){var i=this.cache_[e];0!=(3&t++)||i.hasListener()||(delete this.cache_[e],--this.cacheSize_)}}},t.prototype.get=function(t,e,i){var n=co(t,e,i);return n in this.cache_?this.cache_[n]:null},t.prototype.set=function(t,e,i,n){var r=co(t,e,i);this.cache_[r]=n,++this.cacheSize_},t.prototype.setSize=function(t){this.maxCacheSize_=t,this.expire()},t}()),po=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),go=function(t){function e(e,i,n,r){var o=t.call(this)||this;return o.extent=e,o.pixelRatio_=n,o.resolution=i,o.state=r,o}return po(e,t),e.prototype.changed=function(){this.dispatchEvent(g)},e.prototype.getExtent=function(){return this.extent},e.prototype.getImage=function(){return T()},e.prototype.getPixelRatio=function(){return this.pixelRatio_},e.prototype.getResolution=function(){return this.resolution},e.prototype.getState=function(){return this.state},e.prototype.load=function(){T()},e}(d),_o=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();function yo(t,e,i){var n=t;if(n.src&&zt){var r=n.decode(),o=!0;return r.then((function(){o&&e()})).catch((function(t){o&&("EncodingError"===t.name&&"Invalid image type."===t.message?e():i())})),function(){o=!1}}var s=[m(n,y,e),m(n,_,i)];return function(){s.forEach(x)}}!function(t){function e(e,i,n,r,o,s){var a=t.call(this,e,i,n,Ot)||this;return a.src_=r,a.image_=new Image,null!==o&&(a.image_.crossOrigin=o),a.unlisten_=null,a.state=Ot,a.imageLoadFunction_=s,a}_o(e,t),e.prototype.getImage=function(){return this.image_},e.prototype.handleImageError_=function(){this.state=Ft,this.unlistenImage_(),this.changed()},e.prototype.handleImageLoad_=function(){void 0===this.resolution&&(this.resolution=Oi(this.extent)/this.image_.height),this.state=Et,this.unlistenImage_(),this.changed()},e.prototype.load=function(){this.state!=Ot&&this.state!=Ft||(this.state=bt,this.changed(),this.imageLoadFunction_(this,this.src_),this.unlisten_=yo(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},e.prototype.setImage=function(t){this.image_=t,this.resolution=Oi(this.extent)/this.image_.height},e.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}(go);var vo=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),mo=null,xo=function(t){function e(e,i,n,r,o,s){var a=t.call(this)||this;return a.hitDetectionImage_=null,a.image_=e||new Image,null!==r&&(a.image_.crossOrigin=r),a.canvas_={},a.color_=s,a.unlisten_=null,a.imageState_=o,a.size_=n,a.src_=i,a.tainted_,a}return vo(e,t),e.prototype.isTainted_=function(){if(void 0===this.tainted_&&this.imageState_===Et){mo||(mo=Bt(1,1)),mo.drawImage(this.image_,0,0);try{mo.getImageData(0,0,1,1),this.tainted_=!1}catch(t){mo=null,this.tainted_=!0}}return!0===this.tainted_},e.prototype.dispatchChangeEvent_=function(){this.dispatchEvent(g)},e.prototype.handleImageError_=function(){this.imageState_=Ft,this.unlistenImage_(),this.dispatchChangeEvent_()},e.prototype.handleImageLoad_=function(){this.imageState_=Et,this.size_?(this.image_.width=this.size_[0],this.image_.height=this.size_[1]):this.size_=[this.image_.width,this.image_.height],this.unlistenImage_(),this.dispatchChangeEvent_()},e.prototype.getImage=function(t){return this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_},e.prototype.getPixelRatio=function(t){return this.replaceColor_(t),this.canvas_[t]?t:1},e.prototype.getImageState=function(){return this.imageState_},e.prototype.getHitDetectionImage=function(){if(!this.hitDetectionImage_)if(this.isTainted_()){var t=this.size_[0],e=this.size_[1],i=Bt(t,e);i.fillRect(0,0,t,e),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_},e.prototype.getSize=function(){return this.size_},e.prototype.getSrc=function(){return this.src_},e.prototype.load=function(){if(this.imageState_==Ot){this.imageState_=bt;try{this.image_.src=this.src_}catch(t){this.handleImageError_()}this.unlisten_=yo(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}},e.prototype.replaceColor_=function(t){if(this.color_&&!this.canvas_[t]){var e=document.createElement("canvas");this.canvas_[t]=e,e.width=Math.ceil(this.image_.width*t),e.height=Math.ceil(this.image_.height*t);var i=e.getContext("2d");if(i.scale(t,t),i.drawImage(this.image_,0,0),i.globalCompositeOperation="multiply","multiply"===i.globalCompositeOperation||this.isTainted_())i.fillStyle=Lt(this.color_),i.fillRect(0,0,e.width/t,e.height/t),i.globalCompositeOperation="destination-in",i.drawImage(this.image_,0,0);else{for(var n=i.getImageData(0,0,e.width,e.height),r=n.data,o=this.color_[0]/255,s=this.color_[1]/255,a=this.color_[2]/255,l=this.color_[3],h=0,u=r.length;h0,6);var c=void 0!==n.src?Ot:Et;return i.color_=void 0!==n.color?jt(n.color):null,i.iconImage_=function(t,e,i,n,r,o){var s=fo.get(e,n,o);return s||(s=new xo(t,e,i,n,r,o),fo.set(e,n,o,s)),s}(l,u,h,i.crossOrigin_,c,i.color_),i.offset_=void 0!==n.offset?n.offset:[0,0],i.offsetOrigin_=void 0!==n.offsetOrigin?n.offsetOrigin:ho,i.origin_=null,i.size_=void 0!==n.size?n.size:null,i}return wo(e,t),e.prototype.clone=function(){var t=this.getScale();return new e({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,crossOrigin:this.crossOrigin_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,src:this.getSrc(),offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,size:null!==this.size_?this.size_.slice():void 0,opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView()})},e.prototype.getAnchor=function(){if(this.normalizedAnchor_)return this.normalizedAnchor_;var t=this.anchor_,e=this.getSize();if(this.anchorXUnits_==oo||this.anchorYUnits_==oo){if(!e)return null;t=this.anchor_.slice(),this.anchorXUnits_==oo&&(t[0]*=e[0]),this.anchorYUnits_==oo&&(t[1]*=e[1])}if(this.anchorOrigin_!=ho){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),this.anchorOrigin_!=uo&&this.anchorOrigin_!=lo||(t[0]=-t[0]+e[0]),this.anchorOrigin_!=ao&&this.anchorOrigin_!=lo||(t[1]=-t[1]+e[1])}var i=this.getDisplacement();return t[0]-=i[0],t[1]+=i[1],this.normalizedAnchor_=t,this.normalizedAnchor_},e.prototype.setAnchor=function(t){this.anchor_=t,this.normalizedAnchor_=null},e.prototype.getColor=function(){return this.color_},e.prototype.getImage=function(t){return this.iconImage_.getImage(t)},e.prototype.getPixelRatio=function(t){return this.iconImage_.getPixelRatio(t)},e.prototype.getImageSize=function(){return this.iconImage_.getSize()},e.prototype.getImageState=function(){return this.iconImage_.getImageState()},e.prototype.getHitDetectionImage=function(){return this.iconImage_.getHitDetectionImage()},e.prototype.getOrigin=function(){if(this.origin_)return this.origin_;var t=this.offset_;if(this.offsetOrigin_!=ho){var e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),this.offsetOrigin_!=uo&&this.offsetOrigin_!=lo||(t[0]=i[0]-e[0]-t[0]),this.offsetOrigin_!=ao&&this.offsetOrigin_!=lo||(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_},e.prototype.getSrc=function(){return this.iconImage_.getSrc()},e.prototype.getSize=function(){return this.size_?this.size_:this.iconImage_.getSize()},e.prototype.listenImageChange=function(t){this.iconImage_.addEventListener(g,t)},e.prototype.load=function(){this.iconImage_.load()},e.prototype.unlistenImageChange=function(t){this.iconImage_.removeEventListener(g,t)},e}(It),Co=So,To=function(){function t(t){var e=t||{};this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.scale_=e.scale,this.scaleArray_=Rt(void 0!==e.scale?e.scale:1),this.text_=e.text,this.textAlign_=e.textAlign,this.textBaseline_=e.textBaseline,this.fill_=void 0!==e.fill?e.fill:new we({color:"#333"}),this.maxAngle_=void 0!==e.maxAngle?e.maxAngle:Math.PI/4,this.placement_=void 0!==e.placement?e.placement:qi,this.overflow_=!!e.overflow,this.stroke_=void 0!==e.stroke?e.stroke:null,this.offsetX_=void 0!==e.offsetX?e.offsetX:0,this.offsetY_=void 0!==e.offsetY?e.offsetY:0,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=void 0===e.padding?null:e.padding}return t.prototype.clone=function(){var e=this.getScale();return new t({font:this.getFont(),placement:this.getPlacement(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(e)?e.slice():e,text:this.getText(),textAlign:this.getTextAlign(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()})},t.prototype.getOverflow=function(){return this.overflow_},t.prototype.getFont=function(){return this.font_},t.prototype.getMaxAngle=function(){return this.maxAngle_},t.prototype.getPlacement=function(){return this.placement_},t.prototype.getOffsetX=function(){return this.offsetX_},t.prototype.getOffsetY=function(){return this.offsetY_},t.prototype.getFill=function(){return this.fill_},t.prototype.getRotateWithView=function(){return this.rotateWithView_},t.prototype.getRotation=function(){return this.rotation_},t.prototype.getScale=function(){return this.scale_},t.prototype.getScaleArray=function(){return this.scaleArray_},t.prototype.getStroke=function(){return this.stroke_},t.prototype.getText=function(){return this.text_},t.prototype.getTextAlign=function(){return this.textAlign_},t.prototype.getTextBaseline=function(){return this.textBaseline_},t.prototype.getBackgroundFill=function(){return this.backgroundFill_},t.prototype.getBackgroundStroke=function(){return this.backgroundStroke_},t.prototype.getPadding=function(){return this.padding_},t.prototype.setOverflow=function(t){this.overflow_=t},t.prototype.setFont=function(t){this.font_=t},t.prototype.setMaxAngle=function(t){this.maxAngle_=t},t.prototype.setOffsetX=function(t){this.offsetX_=t},t.prototype.setOffsetY=function(t){this.offsetY_=t},t.prototype.setPlacement=function(t){this.placement_=t},t.prototype.setRotateWithView=function(t){this.rotateWithView_=t},t.prototype.setFill=function(t){this.fill_=t},t.prototype.setRotation=function(t){this.rotation_=t},t.prototype.setScale=function(t){this.scale_=t,this.scaleArray_=Rt(void 0!==t?t:1)},t.prototype.setStroke=function(t){this.stroke_=t},t.prototype.setText=function(t){this.text_=t},t.prototype.setTextAlign=function(t){this.textAlign_=t},t.prototype.setTextBaseline=function(t){this.textBaseline_=t},t.prototype.setBackgroundFill=function(t){this.backgroundFill_=t},t.prototype.setBackgroundStroke=function(t){this.backgroundStroke_=t},t.prototype.setPadding=function(t){this.padding_=t},t}(),Oo=To,bo=.5;var Eo={Point:function(t,e,i,n,r){var o,s=i.getImage(),a=i.getText();r&&(t=r,o=s&&a&&a.getText()?{}:void 0);if(s){if(s.getImageState()!=Et)return;var l=t.getBuilder(i.getZIndex(),an);l.setImageStyle(s,o),l.drawPoint(e,n)}if(a&&a.getText()){var h=t.getBuilder(i.getZIndex(),un);h.setTextStyle(a,o),h.drawText(e,n)}},LineString:function(t,e,i,n,r){var o=i.getStroke();if(o){var s=t.getBuilder(i.getZIndex(),ln);s.setFillStrokeStyle(null,o),s.drawLineString(e,n)}var a=i.getText();if(a&&a.getText()){var l=(r||t).getBuilder(i.getZIndex(),un);l.setTextStyle(a),l.drawText(e,n)}},Polygon:function(t,e,i,n,r){var o=i.getFill(),s=i.getStroke();if(o||s){var a=t.getBuilder(i.getZIndex(),hn);a.setFillStrokeStyle(o,s),a.drawPolygon(e,n)}var l=i.getText();if(l&&l.getText()){var h=(r||t).getBuilder(i.getZIndex(),un);h.setTextStyle(l),h.drawText(e,n)}},MultiPoint:function(t,e,i,n,r){var o,s=i.getImage(),a=i.getText();r&&(t=r,o=s&&a&&a.getText()?{}:void 0);if(s){if(s.getImageState()!=Et)return;var l=t.getBuilder(i.getZIndex(),an);l.setImageStyle(s,o),l.drawMultiPoint(e,n)}if(a&&a.getText()){var h=(r||t).getBuilder(i.getZIndex(),un);h.setTextStyle(a,o),h.drawText(e,n)}},MultiLineString:function(t,e,i,n,r){var o=i.getStroke();if(o){var s=t.getBuilder(i.getZIndex(),ln);s.setFillStrokeStyle(null,o),s.drawMultiLineString(e,n)}var a=i.getText();if(a&&a.getText()){var l=(r||t).getBuilder(i.getZIndex(),un);l.setTextStyle(a),l.drawText(e,n)}},MultiPolygon:function(t,e,i,n,r){var o=i.getFill(),s=i.getStroke();if(s||o){var a=t.getBuilder(i.getZIndex(),hn);a.setFillStrokeStyle(o,s),a.drawMultiPolygon(e,n)}var l=i.getText();if(l&&l.getText()){var h=(r||t).getBuilder(i.getZIndex(),un);h.setTextStyle(l),h.drawText(e,n)}},GeometryCollection:function(t,e,i,n,r){var o,s,a=e.getGeometriesArray();for(o=0,s=a.length;o0)e([]);else{var y=Ei(c.getTileCoordExtent(n.wrappedTileCoord)),v=[(f[0]-y[0])/u,(y[1]-f[1])/u],m=n.getSourceTiles().reduce((function(t,e){return t.concat(e.getFeatures())}),[]),x=n.hitDetectionImageData[s];if(!x&&!this.animatingOrInteracting_){var w=Rt(c.getTileSize(c.getZForResolution(u))),S=this.renderedRotation_;x=function(t,e,i,n,o,s,a){var l=Bt(t[0]*bo,t[1]*bo);l.imageSmoothingEnabled=!1;for(var h=l.canvas,u=new ro(l,bo,o,null,a),c=i.length,f=Math.floor(16777215/c),p={},d=1;d<=c;++d){var g=i[d-1],_=g.getStyleFunction()||n;if(n){var y=_(g,s);if(y){Array.isArray(y)||(y=[y]);for(var v="#"+("000000"+(d*f).toString(16)).slice(-6),m=0,x=y.length;m=0;--u)h[u].execute(this.context,1,this.getTileRenderTransform(l,t),t.viewState.rotation,r,void 0,t.declutterTree)}e.globalAlpha=i},e.prototype.getTileRenderTransform=function(t,e){var i=e.pixelRatio,n=e.viewState,r=n.center,o=n.resolution,s=n.rotation,a=e.size,l=Math.round(a[0]*i),h=Math.round(a[1]*i),u=this.getLayer().getSource().getTileGridForProjection(e.viewState.projection),c=t.tileCoord,f=u.getTileCoordExtent(t.wrappedTileCoord),p=u.getTileCoordExtent(c,this.tmpExtent)[0]-f[0];return pn(_n(this.inversePixelTransform.slice(),1/i,1/i),this.getRenderTransform(r,o,s,i,l,h,p))},e.prototype.renderFrame=function(e,i){var n=e.viewHints,r=!(n[zr]||n[Br]);t.prototype.renderFrame.call(this,e,i),this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice(),this.renderedRotation_=e.viewState.rotation;var o=this.getLayer(),s=o.getRenderMode(),a=this.context,l=a.globalAlpha;a.globalAlpha=o.getOpacity();for(var h=ko[s],u=e.viewState.rotation,c=this.renderedTiles,f=[],p=[],d=c.length-1;d>=0;--d)for(var g=c[d],_=this.getTileRenderTransform(g,e),y=g.executorGroups[b(o)],v=!1,m=0,x=y.length;mt)throw new Error("Tile load sequence violation");this.state=t,this.changed()},e.prototype.load=function(){T()},e.prototype.getAlpha=function(t,e){if(!this.transition_)return 1;var i=this.transitionStarts_[t];if(i){if(-1===i)return 1}else i=e,this.transitionStarts_[t]=i;var n,r=e-i+1e3/60;return r>=this.transition_?1:(n=r/this.transition_,Math.pow(n,3))},e.prototype.inTransition=function(t){return!!this.transition_&&-1!==this.transitionStarts_[t]},e.prototype.endTransition=function(t){this.transition_&&(this.transitionStarts_[t]=-1)},e}(d),zo=Yo,Bo=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),No=function(t){function e(e,i,n,r,o,s){var a=t.call(this,e,i,s)||this;return a.extent=null,a.format_=r,a.features_=null,a.loader_,a.projection=null,a.resolution,a.tileLoadFunction_=o,a.url_=n,a.key=n,a}return Bo(e,t),e.prototype.getFormat=function(){return this.format_},e.prototype.getFeatures=function(){return this.features_},e.prototype.load=function(){this.state==Zn&&(this.setState(Kn),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))},e.prototype.onLoad=function(t,e){this.setFeatures(t)},e.prototype.onError=function(){this.setState(qn)},e.prototype.setFeatures=function(t){this.features_=t,this.setState(Un)},e.prototype.setLoader=function(t){this.loader_=t},e}(zo),Vo=No,Zo=function(){function t(t){this.highWaterMark=void 0!==t?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}return t.prototype.canExpireCache=function(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark},t.prototype.clear=function(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null},t.prototype.containsKey=function(t){return this.entries_.hasOwnProperty(t)},t.prototype.forEach=function(t){for(var e=this.oldest_;e;)t(e.value_,e.key_,this),e=e.newer},t.prototype.get=function(t,e){var i=this.entries_[t];return Y(void 0!==i,15),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_},t.prototype.remove=function(t){var e=this.entries_[t];return Y(void 0!==e,15),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_},t.prototype.getCount=function(){return this.count_},t.prototype.getKeys=function(){var t,e=new Array(this.count_),i=0;for(t=this.newest_;t;t=t.older)e[i++]=t.key_;return e},t.prototype.getValues=function(){var t,e=new Array(this.count_),i=0;for(t=this.newest_;t;t=t.older)e[i++]=t.value_;return e},t.prototype.peekLast=function(){return this.oldest_.value_},t.prototype.peekLastKey=function(){return this.oldest_.key_},t.prototype.peekFirstKey=function(){return this.newest_.key_},t.prototype.pop=function(){var t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_},t.prototype.replace=function(t,e){this.get(t),this.entries_[t].value_=e},t.prototype.set=function(t,e){Y(!(t in this.entries_),16);var i={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[t]=i,++this.count_},t.prototype.setSize=function(t){this.highWaterMark=t},t}();function Ko(t,e,i,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=i,n):[t,e,i]}function Uo(t,e,i){return t+"/"+e+"/"+i}function qo(t){return Uo(t[0],t[1],t[2])}function Jo(t){return t.split("/").map(Number)}var Ho=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),$o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ho(e,t),e.prototype.expireCache=function(t){for(;this.canExpireCache();){if(this.peekLast().getKey()in t)break;this.pop().release()}},e.prototype.pruneExceptNewestZ=function(){if(0!==this.getCount()){var t=Jo(this.peekFirstKey())[0];this.forEach(function(e){e.tileCoord[0]!==t&&(this.remove(qo(e.tileCoord)),e.release())}.bind(this))}},e}(Zo),Qo=$o,ts="tileloadstart",es="tileloadend",is="tileloaderror",ns=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();function rs(t){return t?Array.isArray(t)?function(e){return t}:"function"==typeof t?t:function(e){return[t]}:null}var os=function(t){function e(e){var i=t.call(this)||this;i.projection=Er(e.projection),i.attributions_=rs(e.attributions),i.attributionsCollapsible_=void 0===e.attributionsCollapsible||e.attributionsCollapsible,i.loading=!1,i.state_=void 0!==e.state?e.state:nt,i.wrapX_=void 0!==e.wrapX&&e.wrapX,i.viewResolver=null,i.viewRejector=null;var n=i;return i.viewPromise_=new Promise((function(t,e){n.viewResolver=t,n.viewRejector=e})),i}return ns(e,t),e.prototype.getAttributions=function(){return this.attributions_},e.prototype.getAttributionsCollapsible=function(){return this.attributionsCollapsible_},e.prototype.getProjection=function(){return this.projection},e.prototype.getResolutions=function(){return T()},e.prototype.getView=function(){return this.viewPromise_},e.prototype.getState=function(){return this.state_},e.prototype.getWrapX=function(){return this.wrapX_},e.prototype.getContextOptions=function(){},e.prototype.refresh=function(){this.changed()},e.prototype.setAttributions=function(t){this.attributions_=rs(t),this.changed()},e.prototype.setState=function(t){this.state_=t,this.changed()},e}(R),ss=[0,0,0],as=function(){function t(t){var e,i,n,o;if(this.minZoom=void 0!==t.minZoom?t.minZoom:0,this.resolutions_=t.resolutions,Y((e=this.resolutions_,i=!0,n=function(t,e){return e-t}||r,e.every((function(t,r){if(0===r)return!0;var o=n(e[r-1],t);return!(o>0||i&&0===o)}))),17),!t.origins)for(var s=0,a=this.resolutions_.length-1;s=this.minZoom;){if(e(a,2===this.zoomFactor_?Nn(r=Math.floor(r/2),r,o=Math.floor(o/2),o,i):this.getTileRangeForExtentAndZ(s,a,i)))return!0;--a}return!1},t.prototype.getExtent=function(){return this.extent_},t.prototype.getMaxZoom=function(){return this.maxZoom},t.prototype.getMinZoom=function(){return this.minZoom},t.prototype.getOrigin=function(t){return this.origin_?this.origin_:this.origins_[t]},t.prototype.getResolution=function(t){return this.resolutions_[t]},t.prototype.getResolutions=function(){return this.resolutions_},t.prototype.getTileCoordChildTileRange=function(t,e,i){if(t[0]this.maxZoom||e0){for(r=1;r0?r-1:r:t[r-1]-e0?n:Math.max(s/a[0],o/a[1]),h=r+1,u=new Array(h),c=0;ci||i>e.getMaxZoom())return!1;var o=e.getFullTileRange(i);return!o||o.containsXY(n,r)}(t,n)?t:null},e.prototype.clear=function(){this.tileCache.clear()},e.prototype.refresh=function(){this.clear(),t.prototype.refresh.call(this)},e.prototype.updateCacheSize=function(t,e){var i=this.getTileCacheForProjection(e);t>i.highWaterMark&&(i.highWaterMark=t)},e.prototype.useTile=function(t,e,i,n){},e}(os),_s=function(t){function e(e,i){var n=t.call(this,e)||this;return n.tile=i,n}return ds(e,t),e}(e),ys=gs;function vs(t,e){var i=/\{z\}/g,n=/\{x\}/g,r=/\{y\}/g,o=/\{-y\}/g;return function(s,a,l){return s?t.replace(i,s[0].toString()).replace(n,s[1].toString()).replace(r,s[2].toString()).replace(o,(function(){var t=s[0],i=e.getFullTileRange(t);return Y(i,55),(i.getHeight()-s[2]-1).toString()})):void 0}}function ms(t,e){for(var i=t.length,n=new Array(i),r=0;r=200&&a.status<300){var n=e.getType(),l=void 0;n==bs||n==Es?l=a.responseText:n==Fs?(l=a.responseXML)||(l=(new DOMParser).parseFromString(a.responseText,"application/xml")):n==Os&&(l=a.response),l?o(e.readFeatures(l,{extent:i,featureProjection:r}),e.readProjection(l)):s()}else s()},a.onerror=s,a.send()}(e,t.getFormat(),i,n,r,t.onLoad.bind(t),t.onError.bind(t))}))}var Ms=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();var ks,Ls=function(t){function e(e,i,n,r,o,s){var a=t.call(this,e,i,s)||this;return a.crossOrigin_=r,a.src_=n,a.key=n,a.image_=new Image,null!==r&&(a.image_.crossOrigin=r),a.unlisten_=null,a.tileLoadFunction_=o,a}return Ms(e,t),e.prototype.getImage=function(){return this.image_},e.prototype.setImage=function(t){this.image_=t,this.state=Un,this.unlistenImage_(),this.changed()},e.prototype.handleImageError_=function(){var t;this.state=qn,this.unlistenImage_(),this.image_=((t=Bt(1,1)).fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas),this.changed()},e.prototype.handleImageLoad_=function(){var t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=Un:this.state=Jn,this.unlistenImage_(),this.changed()},e.prototype.load=function(){this.state==qn&&(this.state=Zn,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==Zn&&(this.state=Kn,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=yo(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},e.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},e}(zo),As=function(){function t(t,e,i,n,r,o){this.sourceProj_=t,this.targetProj_=e;var s={},a=kr(this.targetProj_,this.sourceProj_);this.transformInv_=function(t){var e=t[0]+"/"+t[1];return s[e]||(s[e]=a(t)),s[e]},this.maxSourceExtent_=n,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&Ri(n)==Ri(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?Ri(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?Ri(this.targetProj_.getExtent()):null;var l=Ei(i),h=Fi(i),u=Si(i),c=wi(i),f=this.transformInv_(l),p=this.transformInv_(h),d=this.transformInv_(u),g=this.transformInv_(c),_=10+(o?Math.max(0,Math.ceil(N(xi(i)/(o*o*256*256)))):0);if(this.addQuad_(l,h,u,c,f,p,d,g,_),this.wrapsXInSource_){var y=1/0;this.triangles_.forEach((function(t,e,i){y=Math.min(y,t.source[0][0],t.source[1][0],t.source[2][0])})),this.triangles_.forEach(function(t){if(Math.max(t.source[0][0],t.source[1][0],t.source[2][0])-y>this.sourceWorldWidth_/2){var e=[[t.source[0][0],t.source[0][1]],[t.source[1][0],t.source[1][1]],[t.source[2][0],t.source[2][1]]];e[0][0]-y>this.sourceWorldWidth_/2&&(e[0][0]-=this.sourceWorldWidth_),e[1][0]-y>this.sourceWorldWidth_/2&&(e[1][0]-=this.sourceWorldWidth_),e[2][0]-y>this.sourceWorldWidth_/2&&(e[2][0]-=this.sourceWorldWidth_);var i=Math.min(e[0][0],e[1][0],e[2][0]);Math.max(e[0][0],e[1][0],e[2][0])-i.5&&u<1,p=!1;if(l>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_)p=Ri(ni([t,e,i,n]))/this.targetWorldWidth_>.25||p;!f&&this.sourceProj_.isGlobal()&&u&&(p=u>.25||p)}if(!(!p&&this.maxSourceExtent_&&isFinite(h[0])&&isFinite(h[1])&&isFinite(h[2])&&isFinite(h[3]))||Pi(h,this.maxSourceExtent_)){var d=0;if(!(p||isFinite(r[0])&&isFinite(r[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(s[0])&&isFinite(s[1])&&isFinite(a[0])&&isFinite(a[1])))if(l>0)p=!0;else if(1!=(d=(isFinite(r[0])&&isFinite(r[1])?0:8)+(isFinite(o[0])&&isFinite(o[1])?0:4)+(isFinite(s[0])&&isFinite(s[1])?0:2)+(isFinite(a[0])&&isFinite(a[1])?0:1))&&2!=d&&4!=d&&8!=d)return;if(l>0){if(!p){var g=[(t[0]+i[0])/2,(t[1]+i[1])/2],_=this.transformInv_(g),y=void 0;if(f)y=(U(r[0],c)+U(s[0],c))/2-U(_[0],c);else y=(r[0]+s[0])/2-_[0];var v=(r[1]+s[1])/2-_[1];p=y*y+v*v>this.errorThresholdSquared_}if(p){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){var m=[(e[0]+i[0])/2,(e[1]+i[1])/2],x=this.transformInv_(m),w=[(n[0]+t[0])/2,(n[1]+t[1])/2],S=this.transformInv_(w);this.addQuad_(t,e,m,w,r,o,x,S,l-1),this.addQuad_(w,m,i,n,S,x,s,a,l-1)}else{var C=[(t[0]+e[0])/2,(t[1]+e[1])/2],T=this.transformInv_(C),O=[(i[0]+n[0])/2,(i[1]+n[1])/2],b=this.transformInv_(O);this.addQuad_(t,C,O,n,r,T,b,a,l-1),this.addQuad_(C,e,i,O,T,o,s,b,l-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}0==(11&d)&&this.addTriangle_(t,i,n,r,s,a),0==(14&d)&&this.addTriangle_(t,i,e,r,s,o),d&&(0==(13&d)&&this.addTriangle_(e,n,t,o,a,r),0==(7&d)&&this.addTriangle_(e,n,i,o,a,s))}},t.prototype.calculateSourceExtent=function(){var t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach((function(e,i,n){var r=e.source;_i(t,r[0]),_i(t,r[1]),_i(t,r[2])})),t},t.prototype.getTriangles=function(){return this.triangles_},t}(),js={imageSmoothingEnabled:!1,msImageSmoothingEnabled:!1};function Ds(t,e,i,n,r){t.beginPath(),t.moveTo(0,0),t.lineTo(e,i),t.lineTo(n,r),t.closePath(),t.save(),t.clip(),t.fillRect(0,0,Math.max(e,n)+1,Math.max(i,r)),t.restore()}function Gs(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function Ws(t,e,i,n){var r=Lr(i,e,t),o=Fr(e,n,i),s=e.getMetersPerUnit();void 0!==s&&(o*=s);var a=t.getMetersPerUnit();void 0!==a&&(o/=a);var l=t.getExtent();if(!l||si(l,r)){var h=Fr(t,o,r)/o;isFinite(h)&&h>0&&(o/=h)}return o}function Xs(t,e,i,n,r,o,s,a,l,u,c,f){var p=Bt(Math.round(i*t),Math.round(i*e));if(h(p,f),0===l.length)return p.canvas;function d(t){return Math.round(t*i)/i}p.scale(i,i),p.globalCompositeOperation="lighter";var g=[1/0,1/0,-1/0,-1/0];l.forEach((function(t,e,i){var n,r;n=g,(r=t.extent)[0]n[2]&&(n[2]=r[2]),r[1]n[3]&&(n[3]=r[3])}));var _=Ri(g),y=Oi(g),v=Bt(Math.round(i*_/n),Math.round(i*y/n));h(v,f);var m=i/n;l.forEach((function(t,e,i){var n=t.extent[0]-g[0],r=-(t.extent[3]-g[3]),o=Ri(t.extent),s=Oi(t.extent);t.image.width>0&&t.image.height>0&&v.drawImage(t.image,u,u,t.image.width-2*u,t.image.height-2*u,n*m,r*m,o*m,s*m)}));var x=Ei(s);return a.getTriangles().forEach((function(t,e,r){var s=t.source,a=t.target,l=s[0][0],h=s[0][1],u=s[1][0],c=s[1][1],_=s[2][0],y=s[2][1],m=d((a[0][0]-x[0])/o),w=d(-(a[0][1]-x[1])/o),S=d((a[1][0]-x[0])/o),C=d(-(a[1][1]-x[1])/o),T=d((a[2][0]-x[0])/o),O=d(-(a[2][1]-x[1])/o),b=l,E=h;l=0,h=0;var F=function(t){for(var e=t.length,i=0;ir&&(r=s,n=o)}if(0===r)return null;var a=t[n];t[n]=t[i],t[i]=a;for(var l=i+1;l=0;f--){c[f]=t[f][e]/t[f][f];for(var p=f-1;p>=0;p--)t[p][e]-=t[p][f]*c[f]}return c}([[u-=b,c-=E,0,0,S-m],[_-=b,y-=E,0,0,T-m],[0,0,u,c,C-w],[0,0,_,y,O-w]]);if(F){if(p.save(),p.beginPath(),function(){if(void 0===ks){var t=document.createElement("canvas").getContext("2d");t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",Ds(t,4,5,4,0),Ds(t,4,5,0,5);var e=t.getImageData(0,0,3,3).data;ks=Gs(e,0)||Gs(e,4)||Gs(e,8)}return ks}()||f===js){p.moveTo(S,C);for(var R=m-S,P=w-C,I=0;I<4;I++)p.lineTo(S+d((I+1)*R/4),C+d(I*P/3)),3!=I&&p.lineTo(S+d((I+1)*R/4),C+d((I+1)*P/3));p.lineTo(T,O)}else p.moveTo(S,C),p.lineTo(m,w),p.lineTo(T,O);p.clip(),p.transform(F[0],F[2],F[1],F[3],m,w),p.translate(g[0]-b,g[3]-E),p.scale(n/i,-n/i),p.drawImage(v.canvas,0,0),p.restore()}})),c&&(p.save(),p.globalCompositeOperation="source-over",p.strokeStyle="black",p.lineWidth=1,a.getTriangles().forEach((function(t,e,i){var n=t.target,r=(n[0][0]-x[0])/o,s=-(n[0][1]-x[1])/o,a=(n[1][0]-x[0])/o,l=-(n[1][1]-x[1])/o,h=(n[2][0]-x[0])/o,u=-(n[2][1]-x[1])/o;p.beginPath(),p.moveTo(a,l),p.lineTo(r,s),p.lineTo(h,u),p.closePath(),p.stroke()})),p.restore()),p.canvas}var Ys=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),zs=function(t){function e(e,i,n,r,o,s,a,l,h,u,c,f){var p=t.call(this,o,Zn)||this;p.renderEdges_=void 0!==c&&c,p.contextOptions_=f,p.pixelRatio_=a,p.gutter_=l,p.canvas_=null,p.sourceTileGrid_=i,p.targetTileGrid_=r,p.wrappedTileCoord_=s||o,p.sourceTiles_=[],p.sourcesListenerKeys_=null,p.sourceZ_=0;var d=r.getTileCoordExtent(p.wrappedTileCoord_),g=p.targetTileGrid_.getExtent(),_=p.sourceTileGrid_.getExtent(),y=g?bi(d,g):d;if(0===xi(y))return p.state=Jn,p;var v=e.getExtent();v&&(_=_?bi(_,v):v);var m=r.getResolution(p.wrappedTileCoord_[0]),x=function(t,e,i,n){var r=Ci(i),o=Ws(t,e,r,n);return(!isFinite(o)||o<=0)&&mi(i,(function(i){return o=Ws(t,e,i,n),isFinite(o)&&o>0})),o}(e,n,y,m);if(!isFinite(x)||x<=0)return p.state=Jn,p;var w=void 0!==u?u:.5;if(p.triangulation_=new As(e,n,y,_,x*w,m),0===p.triangulation_.getTriangles().length)return p.state=Jn,p;p.sourceZ_=i.getZForResolution(x);var S=p.triangulation_.calculateSourceExtent();if(_&&(e.canWrapX()?(S[1]=z(S[1],_[1],_[3]),S[3]=z(S[3],_[1],_[3])):S=bi(S,_)),xi(S)){for(var C=i.getTileRangeForExtentAndZ(S,p.sourceZ_),T=C.minX;T<=C.maxX;T++)for(var O=C.minY;O<=C.maxY;O++){var b=h(p.sourceZ_,T,O,a);b&&p.sourceTiles_.push(b)}0===p.sourceTiles_.length&&(p.state=Jn)}else p.state=Jn;return p}return Ys(e,t),e.prototype.getImage=function(){return this.canvas_},e.prototype.reproject_=function(){var t=[];if(this.sourceTiles_.forEach(function(e,i,n){e&&e.getState()==Un&&t.push({extent:this.sourceTileGrid_.getTileCoordExtent(e.tileCoord),image:e.getImage()})}.bind(this)),this.sourceTiles_.length=0,0===t.length)this.state=qn;else{var e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),n="number"==typeof i?i:i[0],r="number"==typeof i?i:i[1],o=this.targetTileGrid_.getResolution(e),s=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Xs(n,r,this.pixelRatio_,s,this.sourceTileGrid_.getExtent(),o,a,this.triangulation_,t,this.gutter_,this.renderEdges_,this.contextOptions_),this.state=Un}this.changed()},e.prototype.load=function(){if(this.state==Zn){this.state=Kn,this.changed();var t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(function(e,i,n){var r=e.getState();if(r==Zn||r==Kn){t++;var o=v(e,g,(function(i){var n=e.getState();n!=Un&&n!=qn&&n!=Jn||(x(o),0===--t&&(this.unlistenSources_(),this.reproject_()))}),this);this.sourcesListenerKeys_.push(o)}}.bind(this)),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach((function(t,e,i){t.getState()==Zn&&t.load()}))}},e.prototype.unlistenSources_=function(){this.sourcesListenerKeys_.forEach(x),this.sourcesListenerKeys_=null},e}(zo),Bs=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Ns=function(t){function e(e){var i=t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,opaque:e.opaque,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:Vs,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection})||this;return i.crossOrigin=void 0!==e.crossOrigin?e.crossOrigin:null,i.tileClass=void 0!==e.tileClass?e.tileClass:Ls,i.tileCacheForProjection={},i.tileGridForProjection={},i.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,i.contextOptions_=!1===e.imageSmoothing?js:void 0,i.renderReprojectionEdges_=!1,i}return Bs(e,t),e.prototype.canExpireCache=function(){if(this.tileCache.canExpireCache())return!0;for(var t in this.tileCacheForProjection)if(this.tileCacheForProjection[t].canExpireCache())return!0;return!1},e.prototype.expireCache=function(t,e){var i=this.getTileCacheForProjection(t);for(var n in this.tileCache.expireCache(this.tileCache==i?e:{}),this.tileCacheForProjection){var r=this.tileCacheForProjection[n];r.expireCache(r==i?e:{})}},e.prototype.getContextOptions=function(){return this.contextOptions_},e.prototype.getGutterForProjection=function(t){return this.getProjection()&&t&&!Ir(this.getProjection(),t)?0:this.getGutter()},e.prototype.getGutter=function(){return 0},e.prototype.getKey=function(){return t.prototype.getKey.call(this)+(this.contextOptions_?"\n"+JSON.stringify(this.contextOptions_):"")},e.prototype.getOpaque=function(e){return!(this.getProjection()&&e&&!Ir(this.getProjection(),e))&&t.prototype.getOpaque.call(this,e)},e.prototype.getTileGridForProjection=function(t){var e=this.getProjection();if(!this.tileGrid||e&&!Ir(e,t)){var i=b(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=hs(t)),this.tileGridForProjection[i]}return this.tileGrid},e.prototype.getTileCacheForProjection=function(t){var e=this.getProjection();if(!e||Ir(e,t))return this.tileCache;var i=b(t);return i in this.tileCacheForProjection||(this.tileCacheForProjection[i]=new Qo(this.tileCache.highWaterMark)),this.tileCacheForProjection[i]},e.prototype.createTile_=function(t,e,i,n,r,o){var s=[t,e,i],a=this.getTileCoordForTileUrlFunction(s,r),l=a?this.tileUrlFunction(a,n,r):void 0,h=new this.tileClass(s,void 0!==l?Zn:Jn,void 0!==l?l:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return h.key=o,h.addEventListener(g,this.handleTileChange.bind(this)),h},e.prototype.getTile=function(t,e,i,n,r){var o=this.getProjection();if(o&&r&&!Ir(o,r)){var s=this.getTileCacheForProjection(r),a=[t,e,i],l=void 0,h=qo(a);s.containsKey(h)&&(l=s.get(h));var u=this.getKey();if(l&&l.key==u)return l;var c=this.getTileGridForProjection(o),f=this.getTileGridForProjection(r),p=this.getTileCoordForTileUrlFunction(a,r),d=new zs(o,c,r,f,a,p,this.getTilePixelRatio(n),this.getGutter(),function(t,e,i,n){return this.getTileInternal(t,e,i,n,o)}.bind(this),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.contextOptions_);return d.key=u,l?(d.interimTile=l,d.refreshInterimChain(),s.replace(h,d)):s.set(h,d),d}return this.getTileInternal(t,e,i,n,o||r)},e.prototype.getTileInternal=function(t,e,i,n,r){var o=null,s=Uo(t,e,i),a=this.getKey();if(this.tileCache.containsKey(s)){if((o=this.tileCache.get(s)).key!=a){var l=o;o=this.createTile_(t,e,i,n,r,a),l.getState()==Zn?o.interimTile=l.interimTile:o.interimTile=l,o.refreshInterimChain(),this.tileCache.replace(s,o)}}else o=this.createTile_(t,e,i,n,r,a),this.tileCache.set(s,o);return o},e.prototype.setRenderReprojectionEdges=function(t){if(this.renderReprojectionEdges_!=t){for(var e in this.renderReprojectionEdges_=t,this.tileCacheForProjection)this.tileCacheForProjection[e].clear();this.changed()}},e.prototype.setTileGridForProjection=function(t,e){var i=Er(t);if(i){var n=b(i);n in this.tileGridForProjection||(this.tileGridForProjection[n]=e)}},e}(ws);function Vs(t,e){t.getImage().src=e}var Zs=Ns,Ks=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();!function(t){function e(e){var i=this,n="Unexpected response status: "+e.status;return(i=t.call(this,n)||this).name="ResponseError",i.response=e,i}Ks(e,t)}(Error),function(t){function e(e){var i=t.call(this,"Failed to issue request")||this;return i.name="ClientError",i.client=e,i}Ks(e,t)}(Error);var Us=window&&window.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),qs=function(t){function e(e){var i=t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,imageSmoothing:e.imageSmoothing,projection:Er("EPSG:3857"),reprojectionErrorThreshold:e.reprojectionErrorThreshold,state:it,tileLoadFunction:e.tileLoadFunction,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition,zDirection:e.zDirection})||this;if(i.tileJSON_=null,i.tileSize_=e.tileSize,e.url)if(e.jsonp)!function(t,e,i,n){var r=document.createElement("script"),o="olc_"+b(e);function s(){delete window[o],r.parentNode.removeChild(r)}r.async=!0,r.src=t+(-1==t.indexOf("?")?"?":"&")+(n||"callback")+"="+o;var a=setTimeout((function(){s(),i&&i()}),1e4);window[o]=function(t){clearTimeout(a),s(),e(t)},document.getElementsByTagName("head")[0].appendChild(r)}(e.url,i.handleTileJSONResponse.bind(i),i.handleTileJSONError.bind(i));else{var n=new XMLHttpRequest;n.addEventListener("load",i.onXHRLoad_.bind(i)),n.addEventListener("error",i.onXHRError_.bind(i)),n.open("GET",e.url),n.send()}else e.tileJSON?i.handleTileJSONResponse(e.tileJSON):Y(!1,51);return i}return Us(e,t),e.prototype.onXHRLoad_=function(t){var e=t.target;if(!e.status||e.status>=200&&e.status<300){var i=void 0;try{i=JSON.parse(e.responseText)}catch(t){return void this.handleTileJSONError()}this.handleTileJSONResponse(i)}else this.handleTileJSONError()},e.prototype.onXHRError_=function(t){this.handleTileJSONError()},e.prototype.getTileJSON=function(){return this.tileJSON_},e.prototype.handleTileJSONResponse=function(t){var e,i=Er("EPSG:4326"),n=this.getProjection();if(void 0!==t.bounds){var r=Mr(i,n);e=Ii(t.bounds,r)}var o=ps(n),s=t.minzoom||0,a=us({extent:o,maxZoom:t.maxzoom||22,minZoom:s,tileSize:this.tileSize_});if(this.tileGrid=a,this.tileUrlFunction=ms(t.tiles,a),void 0!==t.attribution&&!this.getAttributions()){var l=void 0!==e?e:o;this.setAttributions((function(e){return Pi(l,e.extent)?[t.attribution]:null}))}this.tileJSON_=t,this.setState(nt)},e.prototype.handleTileJSONError=function(){this.setState(rt)},e}(Zs),Js=qs,Hs=function(){function t(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.supportedMediaTypes=null}return t.prototype.getReadOptions=function(t,e){var i;if(e){var n=e.dataProjection?Er(e.dataProjection):this.readProjection(t);e.extent&&n&&n.getUnits()===Qn.TILE_PIXELS&&(n=Er(n)).setWorldExtent(e.extent),i={dataProjection:n,featureProjection:e.featureProjection}}return this.adaptOptions(i)},t.prototype.adaptOptions=function(t){return h({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection},t)},t.prototype.getType=function(){return T()},t.prototype.readFeature=function(t,e){return T()},t.prototype.readFeatures=function(t,e){return T()},t.prototype.readGeometry=function(t,e){return T()},t.prototype.readProjection=function(t){return T()},t.prototype.writeFeature=function(t,e){return T()},t.prototype.writeFeatures=function(t,e){return T()},t.prototype.writeGeometry=function(t,e){return T()},t}();function $s(t,e,i,n,r,o,s){var a,l=t[e],h=t[e+1],u=t[i]-l,c=t[i+1]-h;if(0===u&&0===c)a=e;else{var f=((r-l)*u+(o-h)*c)/(u*u+c*c);if(f>1)a=i;else{if(f>0){for(var p=0;pr&&(r=h),o=a,s=l}return r}function ta(t,e,i,n,r){for(var o=0,s=i.length;o>1)],e))<0?a=n+1:(l=n,h=!o);return h?a:~a}(d,v);m<0?(h=(v-d[-m-2])/(d[-m-1]-d[-m-2]),l=e+(-m-2)*n):l=e+m*n}var x=a>1?a:2,w=s||new Array(x);for(g=0;g>1;ro&&(h-a)*(o-l)-(r-a)*(u-l)>0&&s++:u<=o&&(h-a)*(o-l)-(r-a)*(u-l)<0&&s--,a=h,l=u}return 0!==s}function ua(t,e,i,n,r,o){if(0===i.length)return!1;if(!ha(t,e,i[0],n,r,o))return!1;for(var s=1,a=i.length;s=r[0]&&o[2]<=r[2]||(o[1]>=r[1]&&o[3]<=r[3]||oa(t,e,i,n,(function(t,e){return function(t,e,i){var n=!1,r=hi(t,e),o=hi(t,i);if(r===Ke||o===Ke)n=!0;else{var s=t[0],a=t[1],l=t[2],h=t[3],u=e[0],c=e[1],f=i[0],p=i[1],d=(p-c)/(f-u),g=void 0,_=void 0;o&Ue&&!(r&Ue)&&(n=(g=f-(p-h)/d)>=s&&g<=l),n||!(o&qe)||r&qe||(n=(_=p-(f-l)*d)>=a&&_<=h),n||!(o&Je)||r&Je||(n=(g=f-(p-a)/d)>=s&&g<=l),n||!(o&He)||r&He||(n=(_=p-(f-s)*d)>=a&&_<=h)}return n}(r,t,e)})))))}function fa(t,e,i,n,r){if(!function(t,e,i,n,r){return!!(ca(t,e,i,n,r)||ha(t,e,i,n,r[0],r[1])||ha(t,e,i,n,r[0],r[3])||ha(t,e,i,n,r[2],r[1])||ha(t,e,i,n,r[2],r[3]))}(t,e,i[0],n,r))return!1;if(1===i.length)return!0;for(var o=1,s=i.length;ow&&ua(t,e,i,n,u=(c+f)/2,g)&&(x=u,w=S),c=f}return isNaN(x)&&(x=o[s]),a?(a.push(x,g,w),a):[x,g,w]}function Ia(t,e,i,n,r){for(var o=[],s=0,a=i.length;s0}function La(t,e,i,n,r){for(var o=void 0!==r&&r,s=0,a=i.length;s */ -read:function(t,e,i,n,r){var o,s,a=8*r-n-1,l=(1<>1,u=-7,c=i?r-1:0,f=i?-1:1,p=t[e+c];for(c+=f,o=p&(1<<-u)-1,p>>=-u,u+=a;u>0;o=256*o+t[e+c],c+=f,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=n;u>0;s=256*s+t[e+c],c+=f,u-=8);if(0===o)o=1-h;else{if(o===l)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=h}return(p?-1:1)*s*Math.pow(2,o-n)},write:function(t,e,i,n,r,o){var s,a,l,h=8*o-r-1,u=(1<>1,f=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),(e+=s+c>=1?f/l:f*Math.pow(2,1-c))*l>=2&&(s++,l/=2),s+c>=u?(a=0,s=u):s+c>=1?(a=(e*l-1)*Math.pow(2,r),s+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,r),s=0));r>=8;t[i+p]=255&a,p+=d,a/=256,r-=8);for(s=s<0;t[i+p]=255&s,p+=d,s/=256,h-=8);t[i+p-d]|=128*g}},ol=al,sl=rl;function al(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}al.Varint=0,al.Fixed64=1,al.Bytes=2,al.Fixed32=5;var ll=4294967296,hl=1/ll,ul="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function cl(t){return t.type===al.Bytes?t.readVarint()+t.pos:t.pos+1}function fl(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function pl(t,e,i){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(n);for(var r=i.pos-1;r>=t;r--)i.buf[r+n]=i.buf[r]}function dl(t,e){for(var i=0;i>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function bl(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}al.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos>3,o=this.pos;this.type=7&n,t(r,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=Cl(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=bl(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Cl(this.buf,this.pos)+Cl(this.buf,this.pos+4)*ll;return this.pos+=8,t},readSFixed64:function(){var t=Cl(this.buf,this.pos)+bl(this.buf,this.pos+4)*ll;return this.pos+=8,t},readFloat:function(){var t=sl.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=sl.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,i,n=this.buf;return e=127&(i=n[this.pos++]),i<128?e:(e|=(127&(i=n[this.pos++]))<<7,i<128?e:(e|=(127&(i=n[this.pos++]))<<14,i<128?e:(e|=(127&(i=n[this.pos++]))<<21,i<128?e:function(t,e,i){var n,r,o=i.buf;if(r=o[i.pos++],n=(112&r)>>4,r<128)return fl(t,n,e);if(r=o[i.pos++],n|=(127&r)<<3,r<128)return fl(t,n,e);if(r=o[i.pos++],n|=(127&r)<<10,r<128)return fl(t,n,e);if(r=o[i.pos++],n|=(127&r)<<17,r<128)return fl(t,n,e);if(r=o[i.pos++],n|=(127&r)<<24,r<128)return fl(t,n,e);if(r=o[i.pos++],n|=(1&r)<<31,r<128)return fl(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(i=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&ul?function(t,e,i){return ul.decode(t.subarray(e,i))}(this.buf,e,t):function(t,e,i){var n="",r=e;for(;r239?4:l>223?3:l>191?2:1;if(r+u>i)break;1===u?l<128&&(h=l):2===u?128==(192&(o=t[r+1]))&&(h=(31&l)<<6|63&o)<=127&&(h=null):3===u?(o=t[r+1],s=t[r+2],128==(192&o)&&128==(192&s)&&((h=(15&l)<<12|(63&o)<<6|63&s)<=2047||h>=55296&&h<=57343)&&(h=null)):4===u&&(o=t[r+1],s=t[r+2],a=t[r+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&((h=(15&l)<<18|(63&o)<<12|(63&s)<<6|63&a)<=65535||h>=1114112)&&(h=null)),null===h?(h=65533,u=1):h>65535&&(h-=65536,n+=String.fromCharCode(h>>>10&1023|55296),h=56320|1023&h),n+=String.fromCharCode(h),r+=u}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==al.Bytes)return t.push(this.readVarint(e));var i=cl(this);for(t=t||[];this.pos127;);else if(e===al.Bytes)this.pos=this.readVarint()+this.pos;else if(e===al.Fixed32)this.pos+=4;else{if(e!==al.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455||t<0?function(t,e){var i,n;t>=0?(i=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(i=~(-t%4294967296))?i=i+1|0:(i=0,n=n+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos]=127&t}(i,0,e),function(t,e){var i=(7&t)<<4;if(e.buf[e.pos++]|=i|((t>>>=3)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;e.buf[e.pos++]=127&t}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,i){for(var n,r,o=0;o55295&&n<57344){if(!r){n>56319||o+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):r=n;continue}if(n<56320){t[i++]=239,t[i++]=191,t[i++]=189,r=n;continue}n=r-55296<<10|n-56320|65536,r=null}else r&&(t[i++]=239,t[i++]=191,t[i++]=189,r=null);n<128?t[i++]=n:(n<2048?t[i++]=n>>6|192:(n<65536?t[i++]=n>>12|224:(t[i++]=n>>18|240,t[i++]=n>>12&63|128),t[i++]=n>>6&63|128),t[i++]=63&n|128)}return i}(this.buf,t,this.pos);var i=this.pos-e;i>=128&&pl(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),sl.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),sl.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var i=0;i=128&&pl(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,i){this.writeTag(t,al.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,dl,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,gl,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,vl,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,_l,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,yl,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,ml,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,xl,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,wl,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Sl,e)},writeBytesField:function(t,e){this.writeTag(t,al.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,al.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,al.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,al.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,al.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,al.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,al.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,al.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,al.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,al.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var Ol=[1,0,0,1,0,0],El=function(){function t(t,e,i,n,r){this.extent_,this.id_=r,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i,this.properties_=n}return t.prototype.get=function(t){return this.properties_[t]},t.prototype.getExtent=function(){return this.extent_||(this.extent_=this.type_===Ae?Ei(this.flatCoordinates_):Fi(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_},t.prototype.getFlatInteriorPoint=function(){if(!this.flatInteriorPoints_){var t=Di(this.getExtent());this.flatInteriorPoints_=Na(this.flatCoordinates_,0,this.ends_,2,t,0)}return this.flatInteriorPoints_},t.prototype.getFlatInteriorPoints=function(){if(!this.flatInteriorPoints_){var t=tl(this.flatCoordinates_,0,this.ends_,2);this.flatInteriorPoints_=Va(this.flatCoordinates_,0,this.ends_,2,t)}return this.flatInteriorPoints_},t.prototype.getFlatMidpoint=function(){return this.flatMidpoints_||(this.flatMidpoints_=xa(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_},t.prototype.getFlatMidpoints=function(){if(!this.flatMidpoints_){this.flatMidpoints_=[];for(var t=this.flatCoordinates_,e=0,i=this.ends_,n=0,r=i.length;n>3}s--,1===o||2===o?(a+=t.readSVarint(),l+=t.readSVarint(),1===o&&h>u&&(n.push(h),u=h),i.push(a,l),h+=2):7===o?h>u&&(i.push(i[u],i[u+1]),h+=2):it(!1,59)}h>u&&(n.push(h),u=h)},e.prototype.createFeature_=function(t,e,i){var n,r=e.type;if(0===r)return null;var o,s=e.properties;this.idProperty_?(o=s[this.idProperty_],delete s[this.idProperty_]):o=e.id,s[this.layerName_]=e.layer.name;var a=[],l=[];this.readRawGeometry_(t,e,a,l);var h=function(t,e){var i;1===t?i=1===e?Ae:Xe:2===t?i=1===e?De:Ye:3===t&&(i=We);return i}(r,l.length);if(this.featureClass_===Fl)(n=new this.featureClass_(h,a,l,s,o)).transform(i.dataProjection);else{var u=void 0;if(h==We){for(var c=[],f=0,p=0,d=0,g=l.length;d1?new nl(a,lo,c):new $a(a,lo,l)}else u=h===Ae?new ja(a,lo):h===De?new Pa(a,lo):h===We?new $a(a,lo,l):h===Xe?new Ga(a,lo):h===Ye?new Ma(a,lo,l):null;n=new(0,this.featureClass_),this.geometryName_&&n.setGeometryName(this.geometryName_);var y=function(t,e,i){var n,r=i?Yr(i.featureProjection):null,o=i?Yr(i.dataProjection):null;if(n=r&&o&&!Vr(r,o)?(e?t.clone():t).transform(e?r:o,e?o:r):t,e&&i&&void 0!==i.decimals){var s=Math.pow(10,i.decimals);n===t&&(n=t.clone()),n.applyTransform((function(t){for(var e=0,i=t.length;e>3)?i.readString():2===t?i.readFloat():3===t?i.readDouble():4===t?i.readVarint64():5===t?i.readVarint():6===t?i.readSVarint():7===t?i.readBoolean():null;e.values.push(n)}}function kl(t,e,i){if(1==t)e.id=i.readVarint();else if(2==t)for(var n=i.readVarint()+i.pos;i.pos1&&void 0!==arguments[1]?arguments[1]:{};r(this,i);var s=document.createElement("div");return s.className="level-control ol-unselectable ol-control",(n=e.call(this,{element:s,target:o.target})).indoorEqual=t,n._renderNewLevels(),n.indoorEqual.on("change:levels",n._renderNewLevels.bind(c(n))),n.indoorEqual.on("change:level",n._renderNewLevels.bind(c(n))),n}return s(i,[{key:"_renderNewLevels",value:function(){var t=this;this.element.innerHTML="";var e=this.indoorEqual.get("level");this.indoorEqual.get("levels").forEach((function(i){var n=document.createElement("button");e===i&&n.classList.add("level-control-active"),n.textContent=i,n.addEventListener("click",(function(){t.indoorEqual.set("level",i)})),t.element.appendChild(n)}))}}]),i}(function(t){function e(e){var i=t.call(this)||this,n=e.element;return!n||e.target||n.style.pointerEvents||(n.style.pointerEvents="auto"),i.element=n||null,i.target_=null,i.map_=null,i.listenerKeys=[],e.render&&(i.render=e.render),e.target&&i.setTarget(e.target),i}return Xl(e,t),e.prototype.disposeInternal=function(){re(this.element),t.prototype.disposeInternal.call(this)},e.prototype.getMap=function(){return this.map_},e.prototype.setMap=function(t){this.map_&&re(this.element);for(var e=0,i=this.listenerKeys.length;e1&&void 0!==arguments[1]?arguments[1]:{};r(this,n);var a={url:"https://tiles.indoorequal.org/"},l=i(i({},a),s);if(l.url===a.url&&!l.apiKey)throw"You must register your apiKey at https://indoorequal.com before and set it as apiKey param.";return(o=e.call(this,{levels:[],level:"0"})).map=t,o.url=l.url,o.apiKey=l.apiKey,o.styleFunction=zl,o._addLayer(),o._changeLayerOnLevelChange(),o._setLayerStyle(),o}return s(n,[{key:"setStyle",value:function(t){this.styleFunction=t}},{key:"_addLayer",value:function(){var t=this.apiKey?"?key=".concat(this.apiKey):"";this.layer=Gl("".concat(this.url).concat(t)),this.map.addLayer(this.layer),this._listenForLevels()}},{key:"_listenForLevels",value:function(){var t=this;this.layer.on("change:source",(function(){var e=t.layer.getSource();e.on("tileloadend",(function(){var i=t.map.getView().calculateExtent(t.map.getSize()),n=e.getFeaturesInExtent(i);t.set("levels",function(t){for(var e=[],i=0;i>1,u=-7,c=i?r-1:0,f=i?-1:1,p=t[e+c];for(c+=f,o=p&(1<<-u)-1,p>>=-u,u+=a;u>0;o=256*o+t[e+c],c+=f,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=n;u>0;s=256*s+t[e+c],c+=f,u-=8);if(0===o)o=1-h;else{if(o===l)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=h}return(p?-1:1)*s*Math.pow(2,o-n)},write:function(t,e,i,n,r,o){var s,a,l,h=8*o-r-1,u=(1<>1,f=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),(e+=s+c>=1?f/l:f*Math.pow(2,1-c))*l>=2&&(s++,l/=2),s+c>=u?(a=0,s=u):s+c>=1?(a=(e*l-1)*Math.pow(2,r),s+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,r),s=0));r>=8;t[i+p]=255&a,p+=d,a/=256,r-=8);for(s=s<0;t[i+p]=255&s,p+=d,s/=256,h-=8);t[i+p-d]|=128*g}},Va=Ka,Za=Na;function Ka(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}Ka.Varint=0,Ka.Fixed64=1,Ka.Bytes=2,Ka.Fixed32=5;var Ua=4294967296,qa=1/Ua,Ja="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function Ha(t){return t.type===Ka.Bytes?t.readVarint()+t.pos:t.pos+1}function $a(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Qa(t,e,i){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(n);for(var r=i.pos-1;r>=t;r--)i.buf[r+n]=i.buf[r]}function tl(t,e){for(var i=0;i>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function cl(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}Ka.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos>3,o=this.pos;this.type=7&n,t(r,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=hl(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=cl(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=hl(this.buf,this.pos)+hl(this.buf,this.pos+4)*Ua;return this.pos+=8,t},readSFixed64:function(){var t=hl(this.buf,this.pos)+cl(this.buf,this.pos+4)*Ua;return this.pos+=8,t},readFloat:function(){var t=Za.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Za.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,i,n=this.buf;return e=127&(i=n[this.pos++]),i<128?e:(e|=(127&(i=n[this.pos++]))<<7,i<128?e:(e|=(127&(i=n[this.pos++]))<<14,i<128?e:(e|=(127&(i=n[this.pos++]))<<21,i<128?e:function(t,e,i){var n,r,o=i.buf;if(r=o[i.pos++],n=(112&r)>>4,r<128)return $a(t,n,e);if(r=o[i.pos++],n|=(127&r)<<3,r<128)return $a(t,n,e);if(r=o[i.pos++],n|=(127&r)<<10,r<128)return $a(t,n,e);if(r=o[i.pos++],n|=(127&r)<<17,r<128)return $a(t,n,e);if(r=o[i.pos++],n|=(127&r)<<24,r<128)return $a(t,n,e);if(r=o[i.pos++],n|=(1&r)<<31,r<128)return $a(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(i=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Ja?function(t,e,i){return Ja.decode(t.subarray(e,i))}(this.buf,e,t):function(t,e,i){var n="",r=e;for(;r239?4:l>223?3:l>191?2:1;if(r+u>i)break;1===u?l<128&&(h=l):2===u?128==(192&(o=t[r+1]))&&(h=(31&l)<<6|63&o)<=127&&(h=null):3===u?(o=t[r+1],s=t[r+2],128==(192&o)&&128==(192&s)&&((h=(15&l)<<12|(63&o)<<6|63&s)<=2047||h>=55296&&h<=57343)&&(h=null)):4===u&&(o=t[r+1],s=t[r+2],a=t[r+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&((h=(15&l)<<18|(63&o)<<12|(63&s)<<6|63&a)<=65535||h>=1114112)&&(h=null)),null===h?(h=65533,u=1):h>65535&&(h-=65536,n+=String.fromCharCode(h>>>10&1023|55296),h=56320|1023&h),n+=String.fromCharCode(h),r+=u}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==Ka.Bytes)return t.push(this.readVarint(e));var i=Ha(this);for(t=t||[];this.pos127;);else if(e===Ka.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Ka.Fixed32)this.pos+=4;else{if(e!==Ka.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455||t<0?function(t,e){var i,n;t>=0?(i=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(i=~(-t%4294967296))?i=i+1|0:(i=0,n=n+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos]=127&t}(i,0,e),function(t,e){var i=(7&t)<<4;if(e.buf[e.pos++]|=i|((t>>>=3)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;e.buf[e.pos++]=127&t}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,i){for(var n,r,o=0;o55295&&n<57344){if(!r){n>56319||o+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):r=n;continue}if(n<56320){t[i++]=239,t[i++]=191,t[i++]=189,r=n;continue}n=r-55296<<10|n-56320|65536,r=null}else r&&(t[i++]=239,t[i++]=191,t[i++]=189,r=null);n<128?t[i++]=n:(n<2048?t[i++]=n>>6|192:(n<65536?t[i++]=n>>12|224:(t[i++]=n>>18|240,t[i++]=n>>12&63|128),t[i++]=n>>6&63|128),t[i++]=63&n|128)}return i}(this.buf,t,this.pos);var i=this.pos-e;i>=128&&Qa(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),Za.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Za.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var i=0;i=128&&Qa(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,i){this.writeTag(t,Ka.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,tl,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,el,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,rl,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,il,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,nl,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,ol,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,sl,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,al,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,ll,e)},writeBytesField:function(t,e){this.writeTag(t,Ka.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,Ka.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,Ka.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,Ka.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,Ka.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,Ka.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,Ka.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,Ka.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,Ka.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,Ka.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var fl=[1,0,0,1,0,0],pl=function(){function t(t,e,i,n,r){this.extent_,this.id_=r,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i,this.properties_=n}return t.prototype.get=function(t){return this.properties_[t]},t.prototype.getExtent=function(){return this.extent_||(this.extent_=this.type_===Se?pi(this.flatCoordinates_):di(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_},t.prototype.getFlatInteriorPoint=function(){if(!this.flatInteriorPoints_){var t=Ci(this.getExtent());this.flatInteriorPoints_=Pa(this.flatCoordinates_,0,this.ends_,2,t,0)}return this.flatInteriorPoints_},t.prototype.getFlatInteriorPoints=function(){if(!this.flatInteriorPoints_){var t=Xa(this.flatCoordinates_,0,this.ends_,2);this.flatInteriorPoints_=Ia(this.flatCoordinates_,0,this.ends_,2,t)}return this.flatInteriorPoints_},t.prototype.getFlatMidpoint=function(){return this.flatMidpoints_||(this.flatMidpoints_=sa(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_},t.prototype.getFlatMidpoints=function(){if(!this.flatMidpoints_){this.flatMidpoints_=[];for(var t=this.flatCoordinates_,e=0,i=this.ends_,n=0,r=i.length;n>3}s--,1===o||2===o?(a+=t.readSVarint(),l+=t.readSVarint(),1===o&&h>u&&(n.push(h),u=h),i.push(a,l),h+=2):7===o?h>u&&(i.push(i[u],i[u+1]),h+=2):Y(!1,59)}h>u&&(n.push(h),u=h)},e.prototype.createFeature_=function(t,e,i){var n,r=e.type;if(0===r)return null;var o,s=e.properties;this.idProperty_?(o=s[this.idProperty_],delete s[this.idProperty_]):o=e.id,s[this.layerName_]=e.layer.name;var a=[],l=[];this.readRawGeometry_(t,e,a,l);var h=function(t,e){var i;1===t?i=1===e?Se:be:2===t?i=1===e?Ce:Ee:3===t&&(i=Oe);return i}(r,l.length);if(this.featureClass_===dl)(n=new this.featureClass_(h,a,l,s,o)).transform(i.dataProjection);else{var u=void 0;if(h==Oe){for(var c=[],f=0,p=0,d=0,g=l.length;d1?new Ba(a,Ur,c):new Wa(a,Ur,l)}else u=h===Se?new wa(a,Ur):h===Ce?new ga(a,Ur):h===Oe?new Wa(a,Ur,l):h===be?new Ta(a,Ur):h===Ee?new va(a,Ur,l):null;n=new(0,this.featureClass_),this.geometryName_&&n.setGeometryName(this.geometryName_);var y=function(t,e,i){var n,r=i?Er(i.featureProjection):null,o=i?Er(i.dataProjection):null;if(n=r&&o&&!Ir(r,o)?(e?t.clone():t).transform(e?r:o,e?o:r):t,e&&i&&void 0!==i.decimals){var s=Math.pow(10,i.decimals);n===t&&(n=t.clone()),n.applyTransform((function(t){for(var e=0,i=t.length;e>3)?i.readString():2===t?i.readFloat():3===t?i.readDouble():4===t?i.readVarint64():5===t?i.readVarint():6===t?i.readSVarint():7===t?i.readBoolean():null;e.values.push(n)}}function ml(t,e,i){if(1==t)e.id=i.readVarint();else if(2==t)for(var n=i.readVarint()+i.pos;i.pos=1.5?.5:1)?"@2x":"";let i=t+e+".json";var n;return{json:await(await fetch(i,{credentials:"same-origin"})).json(),png:await(n=t+e+".png",new Promise(((t,e)=>{const i=new Image;i.crossOrigin="anonymous",i.onload=function(){i.onload=null,t(i)},i.onerror=e,i.src=n})))}}function Rl(t,e,i){let n=null;return i&&Fl(i).then((t=>{e.changed(),n=t})),function(e,i){const r=e.getProperties();return"area"===r.layer?function(t,e){const i=t.getProperties();if("level"===i.class)return;let n,r="#fdfcfa";return i.access&&["no","private"].includes(i.access)?r="#F2F1F0":i.is_poi&&"corridor"!==i.class?r="#D4EDFF":"room"===i.class&&(r="#fefee2"),"area"===i.layer&&["area","corridor","plaform"].includes(i.class)&&(n=new Ie({color:"#bfbfbf",width:1})),"area"===i.layer&&"column"===i.class&&(r="#bfbfbf"),"area"===i.layer&&["room","wall"].includes(i.class)&&(n=new Ie({color:"gray",width:2})),new je({fill:new we({color:r}),stroke:n})}(e):"transportation"===r.layer?new je({stroke:new Ie({color:"gray",width:2,lineDash:[4,7]})}):"area_name"===r.layer?function(t,e){return new je({text:new Oo({font:"13px Noto Sans Regular, sans-serif",text:t.getProperties().name,fill:new we({color:"#666"}),stroke:new Ie({color:"white",width:1})})})}(e):"poi"===r.layer&&"Point"===e.getType()?function(t,e,i,n){const r=t.getProperties();if(i.getView().getZoomForResolution(e)<19&&["waste_basket","information","vending_machine"].includes(r.class))return;let o;if(n){const t=n.json["indoorequal-"+r.subclass]||n.json["indoorequal-"+r.class];t&&(o=new Co({img:n.png,size:[t.width,t.height],offset:[t.x,t.y],imgSize:[n.png.width,n.png.height]}))}return new je({text:new Oo({font:"11px Noto Sans Regular, sans-serif",text:r.name,fill:new we({color:"#666"}),offsetY:18,stroke:new Ie({color:"white",width:1})}),image:o})}(e,i,t,n):void 0}}t.LevelControl=class extends El{constructor(t,e={}){const i=document.createElement("div");i.className="level-control ol-unselectable ol-control",super({element:i,target:e.target}),this.indoorEqual=t,this._renderNewLevels(),this.indoorEqual.on("change:levels",this._renderNewLevels.bind(this)),this.indoorEqual.on("change:level",this._renderNewLevels.bind(this))}_renderNewLevels(){this.element.innerHTML="";const t=this.indoorEqual.get("level");this.indoorEqual.get("levels").forEach((e=>{const i=document.createElement("button");t===e&&i.classList.add("level-control-active"),i.textContent=e,i.addEventListener("click",(()=>{this.indoorEqual.set("level",e)})),this.element.appendChild(i)}))}},t.default=class extends R{constructor(t,e={}){const i={url:"https://tiles.indoorequal.org/",defaultStyle:!0,spriteBaseUrl:null},n={...i,...e};if(n.url===i.url&&!n.apiKey)throw"You must register your apiKey at https://indoorequal.com before and set it as apiKey param.";super({levels:[],level:"0"}),this.map=t,this.url=n.url,this.apiKey=n.apiKey,this._addLayer(),this.styleFunction=n.defaultStyle?Rl(this.map,this.layer,n.spriteBaseUrl):null,this._changeLayerOnLevelChange(),this._setLayerStyle()}setStyle(t){this.styleFunction=t}_addLayer(){const t=this.apiKey?`?key=${this.apiKey}`:"";this.layer=Tl(`${this.url}${t}`),this.map.addLayer(this.layer),this._listenForLevels()}_listenForLevels(){this.layer.on("change:source",(()=>{const t=this.layer.getSource();t.on("tileloadend",(()=>{const e=this.map.getView().calculateExtent(this.map.getSize()),i=t.getFeaturesInExtent(e);this.set("levels",function(t){const e=[];for(let i=0;it-e)).reverse()}(i))}))}))}_changeLayerOnLevelChange(){this.on("change:level",(()=>{this.layer.changed()}))}_setLayerStyle(){this.layer.setStyle(((t,e)=>{if(t.getProperties().level===this.get("level"))return this.styleFunction&&this.styleFunction(t,e)}))}},t.defaultStyle=Rl,t.getLayer=Tl,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/package.json b/package.json index 3182248..0275e85 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openlayers-indoorequal", - "version": "0.0.3", + "version": "0.0.4", "description": "Integrate indoor= into your OpenLayers map.", "repository": "https://github.com/indoorequal/openlayers-indoorequal", "author": "François de Metz",