From a2430ce42859a65e59927ba5a2cff35ccedc7d4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20de=20Metz?= Date: Sun, 3 Oct 2021 20:57:15 +0200 Subject: [PATCH] Release version 0.0.5. --- dist/openlayers-indoorequal.cjs.js | 18 ++++++++++++++++-- dist/openlayers-indoorequal.esm.js | 17 +++++++++++++++-- dist/openlayers-indoorequal.umd.min.js | 2 +- package.json | 2 +- 4 files changed, 33 insertions(+), 6 deletions(-) diff --git a/dist/openlayers-indoorequal.cjs.js b/dist/openlayers-indoorequal.cjs.js index 4641771..353ecc7 100644 --- a/dist/openlayers-indoorequal.cjs.js +++ b/dist/openlayers-indoorequal.cjs.js @@ -11,6 +11,7 @@ var TileGrid = require('ol/tilegrid/TileGrid'); var control = require('ol/control'); var style = require('ol/style'); var BaseObject = require('ol/Object'); +var debounce = require('debounce'); function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } @@ -20,6 +21,7 @@ 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 debounce__default = /*#__PURE__*/_interopDefaultLegacy(debounce); function extentFromTileJSON(tileJSON) { var bounds = tileJSON.bounds; @@ -367,6 +369,8 @@ class IndoorEqual extends BaseObject__default["default"] { this._changeLayerOnLevelChange(); this._setLayerStyle(); + + this._resetLevelOnLevelsChange(); } /** * 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. @@ -389,11 +393,13 @@ class IndoorEqual extends BaseObject__default["default"] { _listenForLevels() { this.layer.on('change:source', () => { const source = this.layer.getSource(); - source.on('tileloadend', () => { + const refreshLevels = debounce__default["default"](() => { const extent = this.map.getView().calculateExtent(this.map.getSize()); const features = source.getFeaturesInExtent(extent); this.set('levels', findAllLevels(features)); - }); + }, 1000); + source.on('tileloadend', refreshLevels); + this.map.getView().on('change:center', refreshLevels); }); } @@ -411,6 +417,14 @@ class IndoorEqual extends BaseObject__default["default"] { }); } + _resetLevelOnLevelsChange() { + this.on('change:levels', () => { + if (!this.get('levels').includes(this.get('level'))) { + this.set('level', '0'); + } + }); + } + } /** * Emitted when the list of available levels has been updated diff --git a/dist/openlayers-indoorequal.esm.js b/dist/openlayers-indoorequal.esm.js index d0d8a10..bf0913b 100644 --- a/dist/openlayers-indoorequal.esm.js +++ b/dist/openlayers-indoorequal.esm.js @@ -7,6 +7,7 @@ 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 debounce from 'debounce'; function extentFromTileJSON(tileJSON) { var bounds = tileJSON.bounds; @@ -354,6 +355,8 @@ class IndoorEqual extends BaseObject { this._changeLayerOnLevelChange(); this._setLayerStyle(); + + this._resetLevelOnLevelsChange(); } /** * 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. @@ -376,11 +379,13 @@ class IndoorEqual extends BaseObject { _listenForLevels() { this.layer.on('change:source', () => { const source = this.layer.getSource(); - source.on('tileloadend', () => { + const refreshLevels = debounce(() => { const extent = this.map.getView().calculateExtent(this.map.getSize()); const features = source.getFeaturesInExtent(extent); this.set('levels', findAllLevels(features)); - }); + }, 1000); + source.on('tileloadend', refreshLevels); + this.map.getView().on('change:center', refreshLevels); }); } @@ -398,6 +403,14 @@ class IndoorEqual extends BaseObject { }); } + _resetLevelOnLevelsChange() { + this.on('change:levels', () => { + if (!this.get('levels').includes(this.get('level'))) { + this.set('level', '0'); + } + }); + } + } /** * Emitted when the list of available levels has been updated diff --git a/dist/openlayers-indoorequal.umd.min.js b/dist/openlayers-indoorequal.umd.min.js index c67c974..b146d41 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";var e=function(){function t(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}return t.prototype.preventDefault=function(){this.defaultPrevented=!0},t.prototype.stopPropagation=function(){this.propagationStopped=!0},t}(),i="propertychange",n=function(){function t(){this.disposed=!1}return t.prototype.dispose=function(){this.disposed||(this.disposed=!0,this.disposeInternal())},t.prototype.disposeInternal=function(){},t}();function r(t,e){return t>e?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}},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})})); +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}},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}}function Pl(t,e,i){var n,r,o,s,a;function l(){var h=Date.now()-s;h=0?n=setTimeout(l,e-h):(n=null,i||(a=t.apply(o,r),o=r=null))}null==e&&(e=100);var h=function(){o=this,r=arguments,s=Date.now();var h=i&&!n;return n||(n=setTimeout(l,e)),h&&(a=t.apply(o,r),o=r=null),a};return h.clear=function(){n&&(clearTimeout(n),n=null)},h.flush=function(){n&&(a=t.apply(o,r),o=r=null,clearTimeout(n),n=null)},h}Pl.debounce=Pl;var Il=Pl;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(),this._resetLevelOnLevelsChange()}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(),e=Il((()=>{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))}),1e3);t.on("tileloadend",e),this.map.getView().on("change:center",e)}))}_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)}))}_resetLevelOnLevelsChange(){this.on("change:levels",(()=>{this.get("levels").includes(this.get("level"))||this.set("level","0")}))}},t.defaultStyle=Rl,t.getLayer=Tl,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/package.json b/package.json index 3147d1e..b20e677 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openlayers-indoorequal", - "version": "0.0.4", + "version": "0.0.5", "description": "Integrate indoor= into your OpenLayers map.", "repository": "https://github.com/indoorequal/openlayers-indoorequal", "author": "François de Metz",