(self["webpackChunkhd_glasses_app"]=self["webpackChunkhd_glasses_app"]||[]).push([[10],{7010:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return Cu}});var n=function(){var t=this,e=t._self._c;return e("div",{attrs:{id:"content"}},[e("div",{ref:"map",staticStyle:{width:"100vw",height:"100vh"},attrs:{id:"map"}}),e("div",{attrs:{id:"overlay-box"}}),e("div",{staticClass:"actionList"},[e("van-grid",{attrs:{"column-num":3}},[e("van-grid-item",[e("van-button",{attrs:{size:"mini",type:"primary"},on:{click:function(e){t.canAddPoints=!0}}},[t._v("开始新增点位")])],1),e("van-grid-item",[e("van-button",{attrs:{size:"mini",type:"primary"},on:{click:function(e){t.canAddPoints=!1}}},[t._v("结束新增点位")])],1),e("van-grid-item",[e("van-button",{attrs:{size:"mini",type:"primary"},on:{click:t.clearPointsLayers}},[t._v("清除点位")])],1),e("van-grid-item",[e("van-button",{attrs:{size:"mini",type:"primary"},on:{click:function(e){return t.startAnimation()}}},[t._v("开始沿轨迹运动")])],1),e("van-grid-item",[e("van-button",{attrs:{size:"mini",type:"primary"},on:{click:function(e){return t.stopAnimation()}}},[t._v("结束沿轨迹运动")])],1)],1),e("br")],1)])},s=[];i(7658);class r{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}var o=r,a={PROPERTYCHANGE:"propertychange"};class h{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}var l=h;function c(t,e,i){let n,s;i=i||u;let r=0,o=t.length,a=!1;while(r>1),s=+i(t[n],e),s<0?r=n+1:(o=n,a=!s);return a?r:~r}function u(t,e){return t>e?1:t0?s-1:s}return n-1}if(i>0){for(let i=1;i0||i&&0===r)}))}function m(){return!0}function y(){return!1}function v(){}function x(t){let e,i,n,s=!1;return function(){const r=Array.prototype.slice.call(arguments);return s&&this===n&&f(r,i)||(s=!0,n=this,i=r,e=t.apply(this,arguments)),e}}function E(t){for(const e in t)delete t[e]}function C(t){let e;for(e in t)return!1;return!e}class S extends l{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),n=i[t]||(i[t]=[]);n.includes(e)||n.push(e)}dispatchEvent(t){const e="string"===typeof t,i=e?t:t.type,n=this.listeners_&&this.listeners_[i];if(!n)return;const s=e?new o(t):t;s.target||(s.target=this.eventTarget_||this);const r=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});let h;i in r||(r[i]=0,a[i]=0),++r[i];for(let o=0,l=n.length;o0)}removeEventListener(t,e){const i=this.listeners_&&this.listeners_[t];if(i){const n=i.indexOf(e);-1!==n&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=v,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}}}var w=S,R={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};function T(t,e,i,n,s){if(n&&n!==t&&(i=i.bind(n)),s){const n=i;i=function(){t.removeEventListener(e,i),n.apply(this,arguments)}}const r={target:t,type:e,listener:i};return t.addEventListener(e,i),r}function I(t,e,i,n){return T(t,e,i,n,!0)}function M(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),E(t))}class L extends w{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(R.CHANGE)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let s=0;s1?(i=s,n=r):h>0&&(i+=o*h,n+=a*h)}return Y(t,e,i,n)}function Y(t,e,i,n){const s=i-t,r=n-e;return s*s+r*r}function B(t){const e=t.length;for(let n=0;ns&&(s=e,i=o)}if(0===s)return null;const r=t[i];t[i]=t[n],t[n]=r;for(let o=n+1;o=0;n--){i[n]=t[n][e]/t[n][n];for(let s=n-1;s>=0;s--)t[s][e]-=t[s][n]*i[n]}return i}function K(t){return t*Math.PI/180}function V(t,e){const i=t%e;return i*e<0?i+e:i}function j(t,e,i){return t+i*(e-t)}function Z(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function U(t,e){return Math.floor(Z(t,e))}function H(t,e){return Math.ceil(Z(t,e))}class q extends N{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);"object"===typeof t.properties&&(delete e.properties,Object.assign(e,t.properties)),e[G.OPACITY]=void 0!==t.opacity?t.opacity:1,W("number"===typeof e[G.OPACITY],"Layer opacity must be a number"),e[G.VISIBLE]=void 0===t.visible||t.visible,e[G.Z_INDEX]=t.zIndex,e[G.MAX_RESOLUTION]=void 0!==t.maxResolution?t.maxResolution:1/0,e[G.MIN_RESOLUTION]=void 0!==t.minResolution?t.minResolution:0,e[G.MIN_ZOOM]=void 0!==t.minZoom?t.minZoom:-1/0,e[G.MAX_ZOOM]=void 0!==t.maxZoom?t.maxZoom:1/0,this.className_=void 0!==e.className?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const 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.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}getLayersArray(t){return O()}getLayerStatesArray(t){return O()}getExtent(){return this.get(G.EXTENT)}getMaxResolution(){return this.get(G.MAX_RESOLUTION)}getMinResolution(){return this.get(G.MIN_RESOLUTION)}getMinZoom(){return this.get(G.MIN_ZOOM)}getMaxZoom(){return this.get(G.MAX_ZOOM)}getOpacity(){return this.get(G.OPACITY)}getSourceState(){return O()}getVisible(){return this.get(G.VISIBLE)}getZIndex(){return this.get(G.Z_INDEX)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(G.EXTENT,t)}setMaxResolution(t){this.set(G.MAX_RESOLUTION,t)}setMinResolution(t){this.set(G.MIN_RESOLUTION,t)}setMaxZoom(t){this.set(G.MAX_ZOOM,t)}setMinZoom(t){this.set(G.MIN_ZOOM,t)}setOpacity(t){W("number"===typeof t,"Layer opacity must be a number"),this.set(G.OPACITY,t)}setVisible(t){this.set(G.VISIBLE,t)}setZIndex(t){this.set(G.Z_INDEX,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}var J=q,$={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"},Q={ANIMATING:0,INTERACTING:1},tt={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};const et=42,it=256;const nt={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class st{constructor(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}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||nt[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}}var rt=st;const ot=6378137,at=Math.PI*ot,ht=[-at,-at,at,at],lt=[-180,-85,180,85],ct=ot*Math.log(Math.tan(Math.PI/2));class ut extends rt{constructor(t){super({code:t,units:"m",extent:ht,global:!0,worldExtent:lt,getPointResolution:function(t,e){return t/Math.cosh(e[1]/ot)}})}}const dt=[new ut("EPSG:3857"),new ut("EPSG:102100"),new ut("EPSG:102113"),new ut("EPSG:900913"),new ut("http://www.opengis.net/def/crs/EPSG/0/3857"),new ut("http://www.opengis.net/gml/srs/epsg.xml#3857")];function gt(t,e,i){const n=t.length;i=i>1?i:2,void 0===e&&(e=i>2?t.slice():new Array(n));for(let s=0;sct?i=ct:i<-ct&&(i=-ct),e[s+1]=i}return e}function _t(t,e,i){const n=t.length;i=i>1?i:2,void 0===e&&(e=i>2?t.slice():new Array(n));for(let s=0;ss&&(h|=Tt.RIGHT),ar&&(h|=Tt.ABOVE),h===Tt.UNKNOWN&&(h=Tt.INTERSECTING),h}function kt(){return[1/0,1/0,-1/0,-1/0]}function Nt(t,e,i,n,s){return s?(s[0]=t,s[1]=e,s[2]=i,s[3]=n,s):[t,e,i,n]}function Gt(t){return Nt(1/0,1/0,-1/0,-1/0,t)}function Wt(t,e){const i=t[0],n=t[1];return Nt(i,n,i,n,e)}function zt(t,e,i,n,s){const r=Gt(s);return Kt(r,t,e,i,n)}function Xt(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function Yt(t,e){return e[0]t[2]&&(t[2]=e[2]),e[1]t[3]&&(t[3]=e[3]),t}function Bt(t,e){e[0]t[2]&&(t[2]=e[0]),e[1]t[3]&&(t[3]=e[1])}function Kt(t,e,i,n,s){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 oe(t){return t[2]=o&&f<=h),n||!(r&Tt.RIGHT)||s&Tt.RIGHT||(p=g-(d-h)*_,n=p>=a&&p<=l),n||!(r&Tt.BELOW)||s&Tt.BELOW||(f=d-(g-a)/_,n=f>=o&&f<=h),n||!(r&Tt.LEFT)||s&Tt.LEFT||(p=g-(d-o)*_,n=p>=a&&p<=l)}return n}function le(t,e,i,n){if(oe(t))return Gt(i);let s=[];if(n>1){const e=t[2]-t[0],i=t[3]-t[1];for(let r=0;r=i[2])){const e=se(i),s=Math.floor((n[0]-i[0])/e),r=s*e;t[0]-=r,t[2]-=r}return t}function ue(t,e){if(e.canWrapX()){const i=e.getExtent();if(!isFinite(t[0])||!isFinite(t[2]))return[[i[0],t[1],i[2],t[3]]];ce(t,e);const n=se(i);if(se(t)>n)return[[i[0],t[1],i[2],t[3]]];if(t[0]i[2])return[[t[0],t[1],i[2],t[3]],[i[0],t[1],t[2]-n,t[3]]]}return[t]}function de(t,e){return t[0]+=+e[0],t[1]+=+e[1],t}function ge(t,e){let i=!0;for(let n=t.length-1;n>=0;--n)if(t[n]!=e[n]){i=!1;break}return i}function _e(t,e){const i=Math.cos(e),n=Math.sin(e),s=t[0]*i-t[1]*n,r=t[1]*i+t[0]*n;return t[0]=s,t[1]=r,t}function fe(t,e){return t[0]*=e,t[1]*=e,t}function pe(t,e){if(e.canWrapX()){const i=se(e.getExtent()),n=me(t,e,i);n&&(t[0]-=n*i)}return t}function me(t,e,i){const n=e.getExtent();let s=0;return e.canWrapX()&&(t[0]n[2])&&(i=i||se(n),s=Math.floor((t[0]-n[0])/i)),s}const ye=6371008.8;function ve(t,e,i){i=i||ye;const n=K(t[1]),s=K(e[1]),r=(s-n)/2,o=K(e[0]-t[0])/2,a=Math.sin(r)*Math.sin(r)+Math.sin(o)*Math.sin(o)*Math.cos(n)*Math.cos(s);return 2*i*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}const xe={info:1,warn:2,error:3,none:4};let Ee=xe.info;function Ce(...t){Ee>xe.warn||console.warn(...t)}let Se=!0;function we(t){const e=void 0===t||t;Se=!e}function Re(t,e){if(void 0!==e)for(let i=0,n=t.length;i=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(Se=!1,Ce("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t)}function Be(t,e){return We?Ge(t,e,We):t}function Ke(t,e){return We?Ge(t,We,e):t}function Ve(t,e){if(!We)return t;const i=Le(e).getUnits(),n=We.getUnits();return i&&n?t*nt[i]/nt[n]:t}function je(){Ae(dt),Ae(vt),Oe(vt,dt,gt,_t)}function Ze(t,e,i){return function(n,s,r,o,a){if(!n)return;if(!s&&!e)return n;const h=e?0:r[0]*s,l=e?0:r[1]*s,c=a?a[0]:0,u=a?a[1]:0;let d=t[0]+h/2+c,g=t[2]-h/2+c,_=t[1]+l/2+u,f=t[3]-l/2+u;d>g&&(d=(g+d)/2,g=d),_>f&&(_=(f+_)/2,f=_);let p=z(n[0],d,g),m=z(n[1],_,f);if(o&&i&&s){const t=30*s;p+=-t*Math.log(1+Math.max(0,d-n[0])/t)+t*Math.log(1+Math.max(0,n[0]-g)/t),m+=-t*Math.log(1+Math.max(0,_-n[1])/t)+t*Math.log(1+Math.max(0,n[1]-f)/t)}return[p,m]}}function Ue(t){return t}function He(t,e,i,n){const s=se(e)/i[0],r=te(e)/i[1];return n?Math.min(t,Math.max(s,r)):Math.min(t,Math.min(s,r))}function qe(t,e,i){let n=Math.min(t,e);const s=50;return n*=Math.log(1+s*Math.max(0,t/e-1))/s+1,i&&(n=Math.max(n,i),n/=Math.log(1+s*Math.max(0,i/t-1))/s+1),z(n,i/2,2*e)}function Je(t,e,i,n){return e=void 0===e||e,function(s,r,o,a){if(void 0!==s){const h=t[0],l=t[t.length-1],c=i?He(h,i,o,n):h;if(a)return e?qe(s,c,l):z(s,l,c);const u=Math.min(c,s),g=Math.floor(d(t,u,r));return t[g]>c&&g1)u=i;else{if(d>0){for(let s=0;ss&&(s=a),r=i,o=n}return s}function Yi(t,e,i,n,s){for(let r=0,o=i.length;r0){const i=l.pop(),r=l.pop();let o=0;const a=t[r],u=t[r+1],d=t[i],g=t[i+1];for(let e=r+n;eo&&(c=e,o=s)}o>s&&(h[(c-e)/n]=1,r+n0&&_>d)&&(g<0&&f0&&f>g)?(a=i,h=u):(r[o++]=a,r[o++]=h,l=a,c=h,a=i,h=u)}return r[o++]=a,r[o++]=h,o}function Ji(t,e,i,n,s,r,o,a){for(let h=0,l=i.length;hr&&(i-a)*(r-h)-(s-a)*(n-h)>0&&o++:n<=r&&(i-a)*(r-h)-(s-a)*(n-h)<0&&o--,a=i,h=n}return 0!==o}function cn(t,e,i,n,s,r){if(0===i.length)return!1;if(!ln(t,e,i[0],n,s,r))return!1;for(let o=1,a=i.length;oy&&(l=(c+d)/2,cn(t,e,i,n,l,f)&&(m=l,y=s)),c=d}return isNaN(m)&&(m=s[r]),o?(o.push(m,f,y),o):[m,f,y]}function dn(t,e,i,n,s){let r;for(e+=n;e=s[0]&&r[2]<=s[2]||(r[1]>=s[1]&&r[3]<=s[3]||dn(t,e,i,n,(function(t,e){return he(s,t,e)})))))}function _n(t,e,i,n,s){return!!gn(t,e,i,n,s)||(!!ln(t,e,i,n,s[0],s[1])||(!!ln(t,e,i,n,s[0],s[3])||(!!ln(t,e,i,n,s[2],s[1])||!!ln(t,e,i,n,s[2],s[3]))))}function fn(t,e,i,n,s){if(!_n(t,e,i[0],n,s))return!1;if(1===i.length)return!0;for(let r=1,o=i.length;r0}function yn(t,e,i,n,s){s=void 0!==s&&s;for(let r=0,o=i.length;r1&&"function"===typeof arguments[i-1]&&(e=arguments[i-1],--i);let n=0;for(;n0}getInteracting(){return this.hints_[Q.INTERACTING]>0}cancelAnimations(){let t;this.setHint(Q.ANIMATING,-this.hints_[Q.ANIMATING]);for(let e=0,i=this.animations_.length;e=0;--i){const n=this.animations_[i];let s=!0;for(let i=0,r=n.length;i0?o/r.duration:1;a>=1?(r.complete=!0,a=1):s=!1;const h=r.easing(a);if(r.sourceCenter){const t=r.sourceCenter[0],e=r.sourceCenter[1],i=r.targetCenter[0],n=r.targetCenter[1];this.nextCenter_=r.targetCenter;const s=t+h*(i-t),o=e+h*(n-e);this.targetCenter_=[s,o]}if(r.sourceResolution&&r.targetResolution){const t=1===h?r.targetResolution:r.sourceResolution+h*(r.targetResolution-r.sourceResolution);if(r.anchor){const e=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(i,r.anchor)}this.nextResolution_=r.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==r.sourceRotation&&void 0!==r.targetRotation){const t=1===h?V(r.targetRotation+Math.PI,2*Math.PI)-Math.PI:r.sourceRotation+h*(r.targetRotation-r.sourceRotation);if(r.anchor){const e=this.constraints_.rotation(t,!0);this.targetCenter_=this.calculateCenterRotate(e,r.anchor)}this.nextRotation_=r.targetRotation,this.targetRotation_=t}if(this.applyTargetState_(!0),e=!0,!r.complete)break}if(s){this.animations_[i]=null,this.setHint(Q.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=n[0].callback;t&&Rn(t,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const n=this.getCenterInternal();return void 0!==n&&(i=[n[0]-e[0],n[1]-e[1]],_e(i,t-this.getRotation()),de(i,e)),i}calculateCenterZoom(t,e){let i;const n=this.getCenterInternal(),s=this.getResolution();if(void 0!==n&&void 0!==s){const r=e[0]-t*(e[0]-n[0])/s,o=e[1]-t*(e[1]-n[1])/s;i=[r,o]}return i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],n=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(n*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t?Xe(t,this.getProjection()):t}getCenterInternal(){return this.get(tt.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){const e=this.calculateExtentInternal(t);return Be(e,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();W(e,"The view center is not defined");const i=this.getResolution();W(void 0!==i,"The view resolution is not defined");const n=this.getRotation();return W(void 0!==n,"The view rotation is not defined"),$t(e,i,n,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(tt.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(Ke(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=se(t)/e[0],n=te(t)/e[1];return Math.max(i,n)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,n=Math.log(e/i)/Math.log(t);return function(i){const s=e/Math.pow(t,i*n);return s}}getRotation(){return this.get(tt.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,s=Math.log(i/n)/e;return function(t){const n=Math.log(i/t)/e/s;return n}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let n=this.getCenterInternal();const s=this.padding_;if(s){const t=this.getViewportSizeMinusPadding_();n=bn(n,this.getViewportSize_(),[t[0]/2+s[3],t[1]/2+s[0]],e,i)}return{center:n.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,i,n=this.minZoom_||0;if(this.resolutions_){const s=d(this.resolutions_,t,1);n=s,e=this.resolutions_[s],i=s==this.resolutions_.length-1?2:e/this.resolutions_[s+1]}else e=this.maxResolution_,i=this.zoomFactor_;return n+Math.log(e/t)/Math.log(i)}getResolutionForZoom(t){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;const e=z(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,z(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(W(Array.isArray(t)||"function"===typeof t.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){W(!oe(t),"Cannot fit empty extent provided as `geometry`");const e=Ke(t,this.getProjection());i=Cn(e)}else if("Circle"===t.getType()){const e=Ke(t.getExtent(),this.getProjection());i=Cn(e),i.rotate(this.getRotation(),qt(e))}else{const e=ze();i=e?t.clone().transform(e,this.getProjection()):t}this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),n=Math.sin(-e),s=t.getFlatCoordinates(),r=t.getStride();let o=1/0,a=1/0,h=-1/0,l=-1/0;for(let c=0,u=s.length;c{this.dispatchEvent("sourceready")}),0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return this.renderer_&&this.rendered?this.renderer_.getData(t):null}isVisible(t){let e;const i=this.getMapInternal();let n;!t&&i&&(t=i.getView()),e=t instanceof An?{viewState:t.getState(),extent:t.calculateExtent()}:t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray()),n=e.layerStatesArray?e.layerStatesArray.find((t=>t.layer===this)):this.getLayerState();const s=this.getExtent();return Pn(n,e.viewState)&&(!s||re(s,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];let e;const i=this.getSource();if(i&&(e=i.getAttributions()),!e)return[];const n=t instanceof An?t.getViewStateAndExtent():t;let s=e(n);return Array.isArray(s)||(s=[s]),s}render(t,e){const i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}setMapInternal(t){t||this.unrender(),this.set(G.MAP,t)}getMapInternal(){return this.get(G.MAP)}setMap(t){this.mapPrecomposeKey_&&(M(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(M(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=T(t,$.PRECOMPOSE,(function(t){const e=t,i=e.frameState.layerStatesArray,n=this.getLayerState(!1);W(!i.some((function(t){return t.layer===n.layer})),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),i.push(n)}),this),this.mapRenderKey_=T(this,R.CHANGE,t.render,t),this.changed())}setSource(t){this.set(G.SOURCE,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}disposeInternal(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_),this.setSource(null),super.disposeInternal()}}function Pn(t,e){if(!t.visible)return!1;const i=e.resolution;if(i=t.maxResolution)return!1;const n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}var Dn=On,Fn={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class kn extends Dn{constructor(t){t=t||{};const e=Object.assign({},t);delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.setPreload(void 0!==t.preload?t.preload:0),this.setUseInterimTilesOnError(void 0===t.useInterimTilesOnError||t.useInterimTilesOnError)}getPreload(){return this.get(Fn.PRELOAD)}setPreload(t){this.set(Fn.PRELOAD,t)}getUseInterimTilesOnError(){return this.get(Fn.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(t){this.set(Fn.USE_INTERIM_TILES_ON_ERROR,t)}getData(t){return super.getData(t)}}var Nn=kn,Gn=(i(541),{IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4});class Wn extends A{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.declutterExecutorGroup=null}getFeatures(t){return O()}getData(t){return null}prepareFrame(t){return O()}renderFrame(t,e){return O()}loadedTileCallback(t,e,i){t[e]||(t[e]={}),t[e][i.tileCoord.toString()]=i}createLoadedTileFinder(t,e,i){return(n,s)=>{const r=this.loadedTileCallback.bind(this,i,n);return t.forEachLoadedTile(e,n,s,r)}}forEachFeatureAtCoordinate(t,e,i,n,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;e.getState()!==Gn.LOADED&&e.getState()!==Gn.ERROR||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=Gn.LOADED&&e!=Gn.ERROR&&t.addEventListener(R.CHANGE,this.boundHandleImageChange_),e==Gn.IDLE&&(t.load(),e=t.getState()),e==Gn.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}disposeInternal(){delete this.layer_,super.disposeInternal()}}var zn=Wn;class Xn extends o{constructor(t,e,i,n){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=n}}var Yn=Xn;const Bn=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,Kn=/^([a-z]*)$|^hsla?\(.*\)$/i;function Vn(t){return"string"===typeof t?t:Jn(t)}function jn(t){const e=document.createElement("div");if(e.style.color=t,""!==e.style.color){document.body.appendChild(e);const t=getComputedStyle(e).color;return document.body.removeChild(e),t}return""}const Zn=function(){const t=1024,e={};let i=0;return function(n){let s;if(e.hasOwnProperty(n))s=e[n];else{if(i>=t){let t=0;for(const n in e)0===(3&t++)&&(delete e[n],--i)}s=Hn(n),e[n]=s,++i}return s}}();function Un(t){return Array.isArray(t)?t:Zn(t)}function Hn(t){let e,i,n,s,r;if(Kn.exec(t)&&(t=jn(t)),Bn.exec(t)){const o=t.length-1;let a;a=o<=4?1:2;const h=4===o||8===o;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),s=h?parseInt(t.substr(1+3*a,a),16):255,1==a&&(e=(e<<4)+e,i=(i<<4)+i,n=(n<<4)+n,h&&(s=(s<<4)+s)),r=[e,i,n,s/255]}else if(t.startsWith("rgba("))r=t.slice(5,-1).split(",").map(Number),qn(r);else{if(!t.startsWith("rgb("))throw new Error("Invalid color");r=t.slice(4,-1).split(",").map(Number),r.push(1),qn(r)}return r}function qn(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 Jn(t){let e=t[0];e!=(0|e)&&(e=e+.5|0);let i=t[1];i!=(0|i)&&(i=i+.5|0);let n=t[2];n!=(0|n)&&(n=n+.5|0);const s=void 0===t[3]?1:Math.round(100*t[3])/100;return"rgba("+e+","+i+","+n+","+s+")"}function $n(t,e,i,n){let s;return s=i&&i.length?i.shift():_i?new OffscreenCanvas(t||300,e||300):document.createElement("canvas"),t&&(s.width=t),e&&(s.height=e),s.getContext("2d",n)}function Qn(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}function ts(t){let e=t.offsetWidth;const i=getComputedStyle(t);return e+=parseInt(i.marginLeft,10)+parseInt(i.marginRight,10),e}function es(t){let e=t.offsetHeight;const i=getComputedStyle(t);return e+=parseInt(i.marginTop,10)+parseInt(i.marginBottom,10),e}function is(t,e){const i=e.parentNode;i&&i.replaceChild(t,e)}function ns(t){return t&&t.parentNode?t.parentNode.removeChild(t):null}function ss(t){while(t.lastChild)t.removeChild(t.lastChild)}function rs(t,e){const i=t.childNodes;for(let n=0;1;++n){const s=i[n],r=e[n];if(!s&&!r)break;s!==r&&(s?r?t.insertBefore(r,s):(t.removeChild(s),--n):t.appendChild(r))}}const os=[];let as=null;function hs(){as=$n(1,1,void 0,{willReadFrequently:!0})}class ls extends zn{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=mi(),this.pixelTransform=mi(),this.inversePixelTransform=mi(),this.context=null,this.containerReused=!1,this.pixelContext_=null,this.frameState=null}getImageData(t,e,i){let n;as||hs(),as.clearRect(0,0,1,1);try{as.drawImage(t,e,i,1,1,0,0,1,1),n=as.getImageData(0,0,1,1).data}catch(s){return as=null,null}return n}getBackground(t){const e=this.getLayer();let i=e.getBackground();return"function"===typeof i&&(i=i(t.viewState.resolution)),i||void 0}useContainer(t,e,i){const n=this.getLayer().getClassName();let s,r;if(t&&t.className===n&&(!i||t&&t.style.backgroundColor&&f(Un(t.style.backgroundColor),Un(i)))){const e=t.firstElementChild;e instanceof HTMLCanvasElement&&(r=e.getContext("2d"))}if(r&&r.canvas.style.transform===e?(this.container=t,this.context=r,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){s=document.createElement("div"),s.className=n;let t=s.style;t.position="absolute",t.width="100%",t.height="100%",r=$n();const e=r.canvas;s.appendChild(e),t=e.style,t.position="absolute",t.left="0",t.transformOrigin="top left",this.container=s,this.context=r}this.containerReused||!i||this.container.style.backgroundColor||(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const n=ie(i),s=ne(i),r=Ht(i),o=Ut(i);Ei(e.coordinateToPixelTransform,n),Ei(e.coordinateToPixelTransform,s),Ei(e.coordinateToPixelTransform,r),Ei(e.coordinateToPixelTransform,o);const a=this.inversePixelTransform;Ei(a,n),Ei(a,s),Ei(a,r),Ei(a,o),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.clip()}dispatchRenderEvent_(t,e,i){const n=this.getLayer();if(n.hasListener(t)){const s=new Yn(t,this.inversePixelTransform,i,e);n.dispatchEvent(s)}}preRender(t,e){this.frameState=e,this.dispatchRenderEvent_($.PRERENDER,t,e)}postRender(t,e){this.dispatchRenderEvent_($.POSTRENDER,t,e)}getRenderTransform(t,e,i,n,s,r,o){const a=s/2,h=r/2,l=n/e,c=-l,u=-t[0]+o,d=-t[1];return Si(this.tempTransform,a,h,l,c,-i,u,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}}var cs=ls,us={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};class ds extends w{constructor(t,e,i){super(),i=i||{},this.tileCoord=t,this.state=e,this.interimTile=null,this.key="",this.transition_=void 0===i.transition?250:i.transition,this.transitionStarts_={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(R.CHANGE)}release(){this.state===us.ERROR&&this.setState(us.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getInterimTile(){if(!this.interimTile)return this;let t=this.interimTile;do{if(t.getState()==us.LOADED)return this.transition_=0,t;t=t.interimTile}while(t);return this}refreshInterimChain(){if(!this.interimTile)return;let t=this.interimTile,e=this;do{if(t.getState()==us.LOADED){t.interimTile=null;break}t.getState()==us.LOADING?e=t:t.getState()==us.IDLE?e.interimTile=t.interimTile:e=t,t=e.interimTile}while(t)}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==us.ERROR&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}load(){O()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(i){if(-1===i)return 1}else i=e,this.transitionStarts_[t]=i;const n=e-i+1e3/60;return n>=this.transition_?1:si(n/this.transition_)}inTransition(t){return!!this.transition_&&-1!==this.transitionStarts_[t]}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}}var gs=ds;function _s(t,e,i){const n=t;let s=!0,r=!1,o=!1;const a=[I(n,R.LOAD,(function(){o=!0,r||e()}))];return n.src&&fi?(r=!0,n.decode().then((function(){s&&e()})).catch((function(t){s&&(o?e():i())}))):a.push(I(n,R.ERROR,i)),function(){s=!1,a.forEach(M)}}function fs(t,e){return new Promise(((i,n)=>{function s(){o(),i(t)}function r(){o(),n(new Error("Image load error"))}function o(){t.removeEventListener("load",s),t.removeEventListener("error",r)}t.addEventListener("load",s),t.addEventListener("error",r),e&&(t.src=e)}))}function ps(t,e){return e&&(t.src=e),fi?new Promise(((e,i)=>t.decode().then((()=>e(t)),i))):fs(t)}class ms extends gs{constructor(t,e,i,n,s,r){super(t,e,r),this.crossOrigin_=n,this.src_=i,this.key=i,this.image_=new Image,null!==n&&(this.image_.crossOrigin=n),this.unlisten_=null,this.tileLoadFunction_=s}getImage(){return this.image_}setImage(t){this.image_=t,this.state=us.LOADED,this.unlistenImage_(),this.changed()}handleImageError_(){this.state=us.ERROR,this.unlistenImage_(),this.image_=ys(),this.changed()}handleImageLoad_(){const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=us.LOADED:this.state=us.EMPTY,this.unlistenImage_(),this.changed()}load(){this.state==us.ERROR&&(this.state=us.IDLE,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==us.IDLE&&(this.state=us.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=_s(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function ys(){const t=$n(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas}var vs=ms;const xs=.5,Es=10,Cs=.25;class Ss{constructor(t,e,i,n,s,r){this.sourceProj_=t,this.targetProj_=e;let o={};const a=ke(this.targetProj_,this.sourceProj_);this.transformInv_=function(t){const e=t[0]+"/"+t[1];return o[e]||(o[e]=a(t)),o[e]},this.maxSourceExtent_=n,this.errorThresholdSquared_=s*s,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&se(n)>=se(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?se(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?se(this.targetProj_.getExtent()):null;const h=ie(i),l=ne(i),c=Ht(i),u=Ut(i),d=this.transformInv_(h),g=this.transformInv_(l),_=this.transformInv_(c),f=this.transformInv_(u),p=Es+(r?Math.max(0,Math.ceil(Math.log2(Zt(i)/(r*r*256*256)))):0);if(this.addQuad_(h,l,c,u,d,g,_,f,p),this.wrapsXInSource_){let t=1/0;this.triangles_.forEach((function(e,i,n){t=Math.min(t,e.source[0][0],e.source[1][0],e.source[2][0])})),this.triangles_.forEach((e=>{if(Math.max(e.source[0][0],e.source[1][0],e.source[2][0])-t>this.sourceWorldWidth_/2){const i=[[e.source[0][0],e.source[0][1]],[e.source[1][0],e.source[1][1]],[e.source[2][0],e.source[2][1]]];i[0][0]-t>this.sourceWorldWidth_/2&&(i[0][0]-=this.sourceWorldWidth_),i[1][0]-t>this.sourceWorldWidth_/2&&(i[1][0]-=this.sourceWorldWidth_),i[2][0]-t>this.sourceWorldWidth_/2&&(i[2][0]-=this.sourceWorldWidth_);const n=Math.min(i[0][0],i[1][0],i[2][0]),s=Math.max(i[0][0],i[1][0],i[2][0]);s-n.5&&c<1;let g=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const s=It([t,e,i,n]),r=se(s)/this.targetWorldWidth_;g=r>Cs||g}!d&&this.sourceProj_.isGlobal()&&c&&(g=c>Cs||g)}if(!g&&this.maxSourceExtent_&&isFinite(l[0])&&isFinite(l[1])&&isFinite(l[2])&&isFinite(l[3])&&!re(l,this.maxSourceExtent_))return;let _=0;if(!g&&(!isFinite(s[0])||!isFinite(s[1])||!isFinite(r[0])||!isFinite(r[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])))if(h>0)g=!0;else if(_=(isFinite(s[0])&&isFinite(s[1])?0:8)+(isFinite(r[0])&&isFinite(r[1])?0:4)+(isFinite(o[0])&&isFinite(o[1])?0:2)+(isFinite(a[0])&&isFinite(a[1])?0:1),1!=_&&2!=_&&4!=_&&8!=_)return;if(h>0){if(!g){const e=[(t[0]+i[0])/2,(t[1]+i[1])/2],n=this.transformInv_(e);let r;if(d){const t=(V(s[0],u)+V(o[0],u))/2;r=t-V(n[0],u)}else r=(s[0]+o[0])/2-n[0];const a=(s[1]+o[1])/2-n[1],h=r*r+a*a;g=h>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const l=[(e[0]+i[0])/2,(e[1]+i[1])/2],c=this.transformInv_(l),u=[(n[0]+t[0])/2,(n[1]+t[1])/2],d=this.transformInv_(u);this.addQuad_(t,e,l,u,s,r,c,d,h-1),this.addQuad_(u,l,i,n,d,c,o,a,h-1)}else{const l=[(t[0]+e[0])/2,(t[1]+e[1])/2],c=this.transformInv_(l),u=[(i[0]+n[0])/2,(i[1]+n[1])/2],d=this.transformInv_(u);this.addQuad_(t,l,u,n,s,c,d,a,h-1),this.addQuad_(l,e,i,u,c,r,o,d,h-1)}return}}if(d){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}0==(11&_)&&this.addTriangle_(t,i,n,s,o,a),0==(14&_)&&this.addTriangle_(t,i,e,s,o,r),_&&(0==(13&_)&&this.addTriangle_(e,n,t,r,a,s),0==(7&_)&&this.addTriangle_(e,n,i,r,a,o))}calculateSourceExtent(){const t=kt();return this.triangles_.forEach((function(e,i,n){const s=e.source;Bt(t,s[0]),Bt(t,s[1]),Bt(t,s[2])})),t}getTriangles(){return this.triangles_}}var ws=Ss;let Rs;const Ts=[];function Is(t,e,i,n,s){t.beginPath(),t.moveTo(0,0),t.lineTo(e,i),t.lineTo(n,s),t.closePath(),t.save(),t.clip(),t.fillRect(0,0,Math.max(e,n)+1,Math.max(i,s)),t.restore()}function Ms(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function Ls(){if(void 0===Rs){const t=$n(6,6,Ts);t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",Is(t,4,5,4,0),Is(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;Rs=Ms(e,0)||Ms(e,4)||Ms(e,8),Qn(t),Ts.push(t.canvas)}return Rs}function bs(t,e,i,n){const s=Ne(i,e,t);let r=be(e,n,i);const o=e.getMetersPerUnit();void 0!==o&&(r*=o);const a=t.getMetersPerUnit();void 0!==a&&(r/=a);const h=t.getExtent();if(!h||Ot(h,s)){const e=be(t,r,s)/r;isFinite(e)&&e>0&&(r/=e)}return r}function As(t,e,i,n){const s=qt(i);let r=bs(t,e,s,n);return(!isFinite(r)||r<=0)&&jt(i,(function(i){return r=bs(t,e,i,n),isFinite(r)&&r>0})),r}function Os(t,e,i,n,s,r,o,a,h,l,c,u){const d=$n(Math.round(i*t),Math.round(i*e),Ts);if(u||(d.imageSmoothingEnabled=!1),0===h.length)return d.canvas;function g(t){return Math.round(t*i)/i}d.scale(i,i),d.globalCompositeOperation="lighter";const _=kt();h.forEach((function(t,e,i){Yt(_,t.extent)}));const f=se(_),p=te(_),m=$n(Math.round(i*f/n),Math.round(i*p/n),Ts);u||(m.imageSmoothingEnabled=!1);const y=i/n;h.forEach((function(t,e,i){const n=t.extent[0]-_[0],s=-(t.extent[3]-_[3]),r=se(t.extent),o=te(t.extent);t.image.width>0&&t.image.height>0&&m.drawImage(t.image,l,l,t.image.width-2*l,t.image.height-2*l,n*y,s*y,r*y,o*y)}));const v=ie(o);return a.getTriangles().forEach((function(t,e,s){const o=t.source,a=t.target;let h=o[0][0],l=o[0][1],c=o[1][0],f=o[1][1],p=o[2][0],y=o[2][1];const x=g((a[0][0]-v[0])/r),E=g(-(a[0][1]-v[1])/r),C=g((a[1][0]-v[0])/r),S=g(-(a[1][1]-v[1])/r),w=g((a[2][0]-v[0])/r),R=g(-(a[2][1]-v[1])/r),T=h,I=l;h=0,l=0,c-=T,f-=I,p-=T,y-=I;const M=[[c,f,0,0,C-x],[p,y,0,0,w-x],[0,0,c,f,S-E],[0,0,p,y,R-E]],L=B(M);if(L){if(d.save(),d.beginPath(),Ls()||!u){d.moveTo(C,S);const t=4,e=x-C,i=E-S;for(let n=0;n{e&&e.getState()==us.LOADED&&t.push({extent:this.sourceTileGrid_.getTileCoordExtent(e.tileCoord),image:e.getImage()})})),this.sourceTiles_.length=0,0===t.length)this.state=us.ERROR;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),n="number"===typeof i?i:i[0],s="number"===typeof i?i:i[1],r=this.targetTileGrid_.getResolution(e),o=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Os(n,s,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),r,a,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=us.LOADED}this.changed()}load(){if(this.state==us.IDLE){this.state=us.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach((e=>{const i=e.getState();if(i==us.IDLE||i==us.LOADING){t++;const i=T(e,R.CHANGE,(function(n){const s=e.getState();s!=us.LOADED&&s!=us.ERROR&&s!=us.EMPTY||(M(i),t--,0===t&&(this.unlistenSources_(),this.reproject_()))}),this);this.sourcesListenerKeys_.push(i)}})),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach((function(t,e,i){const n=t.getState();n==us.IDLE&&t.load()}))}}unlistenSources_(){this.sourcesListenerKeys_.forEach(M),this.sourcesListenerKeys_=null}release(){this.canvas_&&(Qn(this.canvas_.getContext("2d")),Ts.push(this.canvas_),this.canvas_=null),super.release()}}var Ds=Ps;class Fs{constructor(t,e,i,n){this.minX=t,this.maxX=e,this.minY=i,this.maxY=n}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minXthis.maxX&&(this.maxX=t.maxX),t.minYthis.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}function ks(t,e,i,n,s){return void 0!==s?(s.minX=t,s.maxX=e,s.minY=i,s.maxY=n,s):new Fs(t,e,i,n)}var Ns=Fs;function Gs(t){return t[0]>0&&t[1]>0}function Ws(t,e,i){return void 0===i&&(i=[0,0]),i[0]=t[0]*e+.5|0,i[1]=t[1]*e+.5|0,i}function zs(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}class Xs extends cs{constructor(t){super(t),this.extentChanged=!0,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedRevision,this.renderedTiles=[],this.newTiles_=!1,this.tmpExtent=kt(),this.tmpTileRange_=new Ns(0,0,0,0)}isDrawableTile(t){const e=this.getLayer(),i=t.getState(),n=e.getUseInterimTilesOnError();return i==us.LOADED||i==us.EMPTY||i==us.ERROR&&!n}getTile(t,e,i,n){const s=n.pixelRatio,r=n.viewState.projection,o=this.getLayer(),a=o.getSource();let h=a.getTile(t,e,i,s,r);return h.getState()==us.ERROR&&o.getUseInterimTilesOnError()&&o.getPreload()>0&&(this.newTiles_=!0),this.isDrawableTile(h)||(h=h.getInterimTile()),h}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=Ei(e.pixelToCoordinateTransform,t.slice()),s=i.getExtent();if(s&&!Ot(s,n))return null;const r=e.pixelRatio,o=e.viewState.projection,a=e.viewState,h=i.getRenderSource(),l=h.getTileGridForProjection(a.projection),c=h.getTilePixelRatio(e.pixelRatio);for(let u=l.getZForResolution(a.resolution);u>=l.getMinZoom();--u){const t=l.getTileCoordForCoordAndZ(n,u),e=h.getTile(u,t[1],t[2],r,o);if(!(e instanceof vs||e instanceof Ds)||e instanceof Ds&&e.getState()===us.EMPTY)return null;if(e.getState()!==us.LOADED)continue;const i=l.getOrigin(u),s=zs(l.getTileSize(u)),d=l.getResolution(u),g=Math.floor(c*((n[0]-i[0])/d-t[1]*s[0])),_=Math.floor(c*((i[1]-n[1])/d-t[2]*s[1])),f=Math.round(c*h.getGutterForProjection(a.projection));return this.getImageData(e.getImage(),g+f,_+f)}return null}loadedTileCallback(t,e,i){return!!this.isDrawableTile(i)&&super.loadedTileCallback(t,e,i)}prepareFrame(t){return!!this.getLayer().getSource()}renderFrame(t,e){const i=t.layerStatesArray[t.layerIndex],n=t.viewState,s=n.projection,r=n.resolution,o=n.center,a=n.rotation,h=t.pixelRatio,l=this.getLayer(),c=l.getSource(),d=c.getRevision(),g=c.getTileGridForProjection(s),_=g.getZForResolution(r,c.zDirection),f=g.getResolution(_);let p=t.extent;const m=t.viewState.resolution,y=c.getTilePixelRatio(h),v=Math.round(se(p)/m*h),x=Math.round(te(p)/m*h),E=i.extent&&Ke(i.extent,s);E&&(p=ee(p,Ke(i.extent,s)));const C=f*v/2/y,S=f*x/2/y,w=[o[0]-C,o[1]-S,o[0]+C,o[1]+S],R=g.getTileRangeForExtentAndZ(p,_),T={};T[_]={};const I=this.createLoadedTileFinder(c,s,T),M=this.tmpExtent,L=this.tmpTileRange_;this.newTiles_=!1;const b=a?Qt(n.center,m,a,t.size):void 0;for(let u=R.minX;u<=R.maxX;++u)for(let e=R.minY;e<=R.maxY;++e){if(a&&!g.tileCoordIntersectsViewport([_,u,e],b))continue;const n=this.getTile(_,u,e,t);if(this.isDrawableTile(n)){const e=D(this);if(n.getState()==us.LOADED){T[_][n.tileCoord.toString()]=n;let t=n.inTransition(e);t&&1!==i.opacity&&(n.endTransition(e),t=!1),this.newTiles_||!t&&this.renderedTiles.includes(n)||(this.newTiles_=!0)}if(1===n.getAlpha(e,t.time))continue}const s=g.getTileCoordChildTileRange(n.tileCoord,L,M);let r=!1;s&&(r=I(_+1,s)),r||g.forEachTileCoordParentTileRange(n.tileCoord,I,L,M)}const A=f/r*h/y;Si(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/h,1/h,a,-v/2,-x/2);const O=Ii(this.pixelTransform);this.useContainer(e,O,this.getBackground(t));const P=this.context,F=P.canvas;wi(this.inversePixelTransform,this.pixelTransform),Si(this.tempTransform,v/2,x/2,A,A,0,-v/2,-x/2),F.width!=v||F.height!=x?(F.width=v,F.height=x):this.containerReused||P.clearRect(0,0,v,x),E&&this.clipUnrotated(P,t,E),c.getInterpolate()||(P.imageSmoothingEnabled=!1),this.preRender(P,t),this.renderedTiles.length=0;let k,N,G,W=Object.keys(T).map(Number);W.sort(u),1!==i.opacity||this.containerReused&&!c.getOpaque(t.viewState.projection)?(k=[],N=[]):W=W.reverse();for(let u=W.length-1;u>=0;--u){const e=W[u],i=c.getTilePixelSize(e,h,s),n=g.getResolution(e),r=n/f,o=i[0]*r*A,a=i[1]*r*A,l=g.getTileCoordForCoordAndZ(ie(w),e),d=g.getTileCoordExtent(l),p=Ei(this.tempTransform,[y*(d[0]-w[0])/f,y*(w[3]-d[3])/f]),m=y*c.getGutterForProjection(s),v=T[e];for(const s in v){const i=v[s],n=i.tileCoord,r=l[1]-n[1],h=Math.round(p[0]-(r-1)*o),u=l[2]-n[2],d=Math.round(p[1]-(u-1)*a),g=Math.round(p[0]-r*o),f=Math.round(p[1]-u*a),y=h-g,x=d-f,E=_===e,C=E&&1!==i.getAlpha(D(this),t.time);let S=!1;if(!C)if(k){G=[g,f,g+y,f,g+y,f+x,g,f+x];for(let t=0,i=k.length;tMath.max(e,Cr(t,i))),0);return i[e]=n,n}function wr(t,e){const i=[],n=[],s=[];let r=0,o=0,a=0,h=0;for(let l=0,c=e.length;l<=c;l+=2){const u=e[l];if("\n"===u||l===c){r=Math.max(r,o),s.push(o),o=0,a+=h;continue}const d=e[l+1]||t.font,g=Cr(d,u);i.push(g),o+=g;const _=xr(d);n.push(_),h=Math.max(h,_)}return{width:r,height:a,widths:i,heights:n,lineWidths:s}}function Rr(t,e,i,n,s,r,o,a,h,l,c){t.save(),1!==i&&(t.globalAlpha*=i),e&&t.transform.apply(t,e),n.contextInstructions?(t.translate(h,l),t.scale(c[0],c[1]),Tr(n,t)):c[0]<0||c[1]<0?(t.translate(h,l),t.scale(c[0],c[1]),t.drawImage(n,s,r,o,a,0,0,o,a)):t.drawImage(n,s,r,o,a,h,l,o*c[0],a*c[1]),t.restore()}function Tr(t,e){const i=t.contextInstructions;for(let n=0,s=i.length;nthis.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const i=this.cache_[e];0!==(3&t++)||i.hasListener()||(delete this.cache_[e],--this.cacheSize_)}}}get(t,e,i){const n=Yr(t,e,i);return n in this.cache_?this.cache_[n]:null}set(t,e,i,n){const s=Yr(t,e,i);this.cache_[s]=n,++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function Yr(t,e,i){const n=i?Vn(i):"null";return e+":"+t+":"+n}const Br=new Xr;let Kr=null;class Vr extends w{constructor(t,e,i,n,s){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i,this.canvas_={},this.color_=s,this.imageState_=void 0===n?Gn.IDLE:n,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_}initializeImage_(){this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(void 0===this.tainted_&&this.imageState_===Gn.LOADED){Kr||(Kr=$n(1,1,void 0,{willReadFrequently:!0})),Kr.drawImage(this.image_,0,0);try{Kr.getImageData(0,0,1,1),this.tainted_=!1}catch(t){Kr=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(R.CHANGE)}handleImageError_(){this.imageState_=Gn.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Gn.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],i=$n(t,e);i.fillRect(0,0,t,e),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===Gn.IDLE){this.image_||this.initializeImage_(),this.imageState_=Gn.LOADING;try{void 0!==this.src_&&(this.image_.src=this.src_)}catch(t){this.handleImageError_()}this.image_ instanceof HTMLImageElement&&ps(this.image_,this.src_).then((t=>{this.image_=t,this.handleImageLoad_()})).catch(this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==Gn.LOADED)return;const e=this.image_,i=document.createElement("canvas");i.width=Math.ceil(e.width*t),i.height=Math.ceil(e.height*t);const n=i.getContext("2d");n.scale(t,t),n.drawImage(e,0,0),n.globalCompositeOperation="multiply",n.fillStyle=Vn(this.color_),n.fillRect(0,0,i.width/t,i.height/t),n.globalCompositeOperation="destination-in",n.drawImage(e,0,0),this.canvas_[t]=i}}function jr(t,e,i,n,s){let r=void 0===e?void 0:Br.get(e,i,s);return r||(r=new Vr(t,t instanceof HTMLImageElement?t.src||void 0:e,i,n,s),Br.set(e,i,s,r)),r}function Zr(t,e,i,n){return void 0!==i&&void 0!==n?[i/t,n/e]:void 0!==i?i/t:void 0!==n?n/e:1}class Ur extends Zs{constructor(t){t=t||{};const e=void 0!==t.opacity?t.opacity:1,i=void 0!==t.rotation?t.rotation:0,n=void 0!==t.scale?t.scale:1,s=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:e,rotation:i,scale:n,displacement:void 0!==t.displacement?t.displacement:[0,0],rotateWithView:s,declutterMode:t.declutterMode}),this.anchor_=void 0!==t.anchor?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=void 0!==t.anchorOrigin?t.anchorOrigin:"top-left",this.anchorXUnits_=void 0!==t.anchorXUnits?t.anchorXUnits:"fraction",this.anchorYUnits_=void 0!==t.anchorYUnits?t.anchorYUnits:"fraction",this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null;const r=void 0!==t.img?t.img:null;let o,a=t.src;if(W(!(void 0!==a&&r),"`image` and `src` cannot be provided at the same time"),void 0!==a&&0!==a.length||!r||(a=r.src||D(r)),W(void 0!==a&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),W(!((void 0!==t.width||void 0!==t.height)&&void 0!==t.scale),"`width` or `height` cannot be provided together with `scale`"),void 0!==t.src?o=Gn.IDLE:void 0!==r&&(o=r instanceof HTMLImageElement?r.complete?r.src?Gn.LOADED:Gn.IDLE:Gn.LOADING:Gn.LOADED),this.color_=void 0!==t.color?Un(t.color):null,this.iconImage_=jr(r,a,this.crossOrigin_,o,this.color_),this.offset_=void 0!==t.offset?t.offset:[0,0],this.offsetOrigin_=void 0!==t.offsetOrigin?t.offsetOrigin:"top-left",this.origin_=null,this.size_=void 0!==t.size?t.size:null,void 0!==t.width||void 0!==t.height){let e,i;if(t.size)[e,i]=t.size;else{const n=this.getImage(1);if(n.width&&n.height)e=n.width,i=n.height;else if(n instanceof HTMLImageElement){this.initialOptions_=t;const e=()=>{if(this.unlistenImageChange(e),!this.initialOptions_)return;const i=this.iconImage_.getSize();this.setScale(Zr(i[0],i[1],t.width,t.height))};return void this.listenImageChange(e)}}void 0!==e&&this.setScale(Zr(e,i,t.width,t.height))}}clone(){let t,e,i;return this.initialOptions_?(e=this.initialOptions_.width,i=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new Ur({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:i,size:null!==this.size_?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const e=this.getSize();if("fraction"==this.anchorXUnits_||"fraction"==this.anchorYUnits_){if(!e)return null;t=this.anchor_.slice(),"fraction"==this.anchorXUnits_&&(t[0]*=e[0]),"fraction"==this.anchorYUnits_&&(t[1]*=e[1])}if("top-left"!=this.anchorOrigin_){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),"top-right"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[0]=-t[0]+e[0]),"bottom-left"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[1]=-t[1]+e[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),i=this.getScaleArray();return[t[0]-e[0]/i[0],t[1]+e[1]/i[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if("top-left"!=this.offsetOrigin_){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),"top-right"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[0]=i[0]-e[0]-t[0]),"bottom-left"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();return this.size_?this.size_[0]*t[0]:this.iconImage_.getImageState()==Gn.LOADED?this.iconImage_.getSize()[0]*t[0]:void 0}getHeight(){const t=this.getScaleArray();return this.size_?this.size_[1]*t[1]:this.iconImage_.getImageState()==Gn.LOADED?this.iconImage_.getSize()[1]*t[1]:void 0}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(R.CHANGE,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(R.CHANGE,t)}}var Hr=Ur;const qr="#333";class Jr{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.scale_=t.scale,this.scaleArray_=zs(void 0!==t.scale?t.scale:1),this.text_=t.text,this.textAlign_=t.textAlign,this.justify_=t.justify,this.repeat_=t.repeat,this.textBaseline_=t.textBaseline,this.fill_=void 0!==t.fill?t.fill:new Or({color:qr}),this.maxAngle_=void 0!==t.maxAngle?t.maxAngle:Math.PI/4,this.placement_=void 0!==t.placement?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=void 0!==t.stroke?t.stroke:null,this.offsetX_=void 0!==t.offsetX?t.offsetX:0,this.offsetY_=void 0!==t.offsetY?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=void 0===t.padding?null:t.padding}clone(){const t=this.getScale();return new Jr({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),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()||void 0})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}setOverflow(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=zs(void 0!==t?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}}var $r=Jr;let Qr=0;const to=1<",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match"},mo={[po.Number]:Co(Eo(1,1/0,ro),eo),[po.String]:Co(Eo(1,1/0,ro),io),[po.Get]:Co(yo,ro),[po.Var]:Co(vo,ro),[po.Resolution]:Co(xo,eo),[po.Any]:Co(Eo(2,1/0,to),to),[po.All]:Co(Eo(2,1/0,to),to),[po.Not]:Co(Eo(1,1,to),to),[po.Equal]:Co(Eo(2,2,ro),to),[po.NotEqual]:Co(Eo(2,2,ro),to),[po.GreaterThan]:Co(Eo(2,2,ro),to),[po.GreaterThanOrEqualTo]:Co(Eo(2,2,ro),to),[po.LessThan]:Co(Eo(2,2,ro),to),[po.LessThanOrEqualTo]:Co(Eo(2,2,ro),to),[po.Multiply]:Co(Eo(2,1/0,eo),eo),[po.Divide]:Co(Eo(2,2,eo),eo),[po.Add]:Co(Eo(2,1/0,eo),eo),[po.Subtract]:Co(Eo(2,2,eo),eo),[po.Clamp]:Co(Eo(3,3,eo),eo),[po.Mod]:Co(Eo(2,2,eo),eo),[po.Pow]:Co(Eo(2,2,eo),eo),[po.Abs]:Co(Eo(1,1,eo),eo),[po.Floor]:Co(Eo(1,1,eo),eo),[po.Ceil]:Co(Eo(1,1,eo),eo),[po.Round]:Co(Eo(1,1,eo),eo),[po.Sin]:Co(Eo(1,1,eo),eo),[po.Cos]:Co(Eo(1,1,eo),eo),[po.Atan]:Co(Eo(1,2,eo),eo),[po.Sqrt]:Co(Eo(1,1,eo),eo),[po.Match]:Co(Eo(4,1/0,io|eo),ro)};function yo(t,e){if(2!==t.length)throw new Error("Expected 1 argument for get operation");const i=fo(t[1],e);if(!(i instanceof uo))throw new Error("Expected a literal argument for get operation");if("string"!==typeof i.value)throw new Error("Expected a string argument for get operation");return e.properties.add(i.value),[i]}function vo(t,e){if(2!==t.length)throw new Error("Expected 1 argument for var operation");const i=fo(t[1],e);if(!(i instanceof uo))throw new Error("Expected a literal argument for var operation");if("string"!==typeof i.value)throw new Error("Expected a string argument for get operation");return e.variables.add(i.value),[i]}function xo(t,e){const i=t[0];if(1!==t.length)throw new Error(`Expected no arguments for ${i} operation`);return[]}function Eo(t,e,i){return function(n,s){const r=n[0],o=n.length-1;if(t===e){if(o!==t){const e=1===t?"":"s";throw new Error(`Expected ${t} argument${e} for operation ${r}, got ${o}`)}}else if(oe)throw new Error(`Expected ${t} to ${e} arguments for operation ${r}, got ${o}`);const a=new Array(o);for(let t=0;tt.resolution;case po.Any:case po.All:case po.Not:return bo(t,e);case po.Equal:case po.NotEqual:case po.LessThan:case po.LessThanOrEqualTo:case po.GreaterThan:case po.GreaterThanOrEqualTo:return Lo(t,e);case po.Multiply:case po.Divide:case po.Add:case po.Subtract:case po.Clamp:case po.Mod:case po.Pow:case po.Abs:case po.Floor:case po.Ceil:case po.Round:case po.Sin:case po.Cos:case po.Atan:case po.Sqrt:return Ao(t,e);case po.Match:return Oo(t,e);default:throw new Error(`Unsupported operator ${i}`)}}function Io(t,e){const i=t.operator,n=t.args.length,s=new Array(n);for(let r=0;r{for(let e=0;et.properties[n];case po.Var:return t=>t.variables[n];default:throw new Error(`Unsupported accessor operator ${t.operator}`)}}function Lo(t,e){const i=t.operator,n=To(t.args[0],e),s=To(t.args[1],e);switch(i){case po.Equal:return t=>n(t)===s(t);case po.NotEqual:return t=>n(t)!==s(t);case po.LessThan:return t=>n(t)n(t)<=s(t);case po.GreaterThan:return t=>n(t)>s(t);case po.GreaterThanOrEqualTo:return t=>n(t)>=s(t);default:throw new Error(`Unsupported comparison operator ${i}`)}}function bo(t,e){const i=t.operator,n=t.args.length,s=new Array(n);for(let r=0;r{for(let e=0;e{for(let e=0;e!s[0](t);default:throw new Error(`Unsupported logical operator ${i}`)}}function Ao(t,e){const i=t.operator,n=t.args.length,s=new Array(n);for(let r=0;r{let e=1;for(let i=0;is[0](t)/s[1](t);case po.Add:return t=>{let e=0;for(let i=0;is[0](t)-s[1](t);case po.Clamp:return t=>{const e=s[0](t),i=s[1](t);if(en?n:e};case po.Mod:return t=>s[0](t)%s[1](t);case po.Pow:return t=>Math.pow(s[0](t),s[1](t));case po.Abs:return t=>Math.abs(s[0](t));case po.Floor:return t=>Math.floor(s[0](t));case po.Ceil:return t=>Math.ceil(s[0](t));case po.Round:return t=>Math.round(s[0](t));case po.Sin:return t=>Math.sin(s[0](t));case po.Cos:return t=>Math.cos(s[0](t));case po.Atan:return 2===n?t=>Math.atan2(s[0](t),s[1](t)):t=>Math.atan(s[0](t));case po.Sqrt:return t=>Math.sqrt(s[0](t));default:throw new Error(`Unsupported numeric operator ${i}`)}}function Oo(t,e){const i=t.args.length,n=new Array(i);for(let s=0;s{const e=n[0](t);for(let s=1;s4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return i}function ca(t,e){if("number"===typeof t)return t;const i=oa(t,e);if(2!==i.length)throw new Error(`Expected an array of two numbers for ${e}`);return i}const ua={RENDER_ORDER:"renderOrder"};class da extends Dn{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.declutter_=void 0!==t.declutter&&t.declutter,this.renderBuffer_=void 0!==t.renderBuffer?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=void 0!==t.updateWhileAnimating&&t.updateWhileAnimating,this.updateWhileInteracting_=void 0!==t.updateWhileInteracting&&t.updateWhileInteracting}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(ua.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t){t.declutterTree||(t.declutterTree=new Vs(9)),this.getRenderer().renderDeclutter(t)}setRenderOrder(t){this.set(ua.RENDER_ORDER,t)}setStyle(t){this.style_=ga(t),this.styleFunction_=null===t?void 0:kr(this.style_),this.changed()}}function ga(t){if(void 0===t)return Gr;if(!t)return null;if("function"===typeof t)return t;if(t instanceof zr)return t;if(!Array.isArray(t))return Fo([t]);if(0===t.length)return[];const e=t.length,i=t[0];if(i instanceof zr){const i=new Array(e);for(let n=0;no&&(this.instructions.push([xa.CUSTOM,o,h,t,i,$i]),this.hitDetectionInstructions.push([xa.CUSTOM,o,h,t,n||i,$i]));break;case"Point":a=t.getFlatCoordinates(),this.coordinates.push(a[0],a[1]),h=this.coordinates.length,this.instructions.push([xa.CUSTOM,o,h,t,i]),this.hitDetectionInstructions.push([xa.CUSTOM,o,h,t,n||i]);break;default:}this.endGeometry(e)}beginGeometry(t,e){this.beginGeometryInstruction1_=[xa.BEGIN_GEOMETRY,e,0,t],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[xa.BEGIN_GEOMETRY,e,0,t],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;let e;t.reverse();const i=t.length;let n,s,r=-1;for(e=0;ethis.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}createFill(t){const e=t.fillStyle,i=[xa.SET_FILL_STYLE,e];return"string"!==typeof e&&i.push(!0),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[xa.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;"string"===typeof i&&t.currentFillStyle==i||(void 0!==i&&this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,n=t.lineCap,s=t.lineDash,r=t.lineDashOffset,o=t.lineJoin,a=t.lineWidth,h=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=n||s!=t.currentLineDash&&!f(t.currentLineDash,s)||t.currentLineDashOffset!=r||t.currentLineJoin!=o||t.currentLineWidth!=a||t.currentMiterLimit!=h)&&(void 0!==i&&e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=s,t.currentLineDashOffset=r,t.currentLineJoin=o,t.currentLineWidth=a,t.currentMiterLimit=h)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[xa.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=bt(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;Lt(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}var wa=Sa;class Ra extends wa{constructor(t,e,i,n){super(t,e,i,n),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e){if(!this.image_)return;this.beginGeometry(t,e);const i=t.getFlatCoordinates(),n=t.getStride(),s=this.coordinates.length,r=this.appendFlatPointCoordinates(i,n);this.instructions.push([xa.DRAW_IMAGE,s,r,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,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.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([xa.DRAW_IMAGE,s,r,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e){if(!this.image_)return;this.beginGeometry(t,e);const i=t.getFlatCoordinates(),n=t.getStride(),s=this.coordinates.length,r=this.appendFlatPointCoordinates(i,n);this.instructions.push([xa.DRAW_IMAGE,s,r,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,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.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([xa.DRAW_IMAGE,s,r,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){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,super.finish()}setImageStyle(t,e){const i=t.getAnchor(),n=t.getSize(),s=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=s[0],this.originY_=s[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=n[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}var Ta=Ra;class Ia extends wa{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinates_(t,e,i,n){const s=this.coordinates.length,r=this.appendFlatLineCoordinates(t,e,i,n,!1,!1),o=[xa.MOVE_TO_LINE_TO,s,r];return this.instructions.push(o),this.hitDetectionInstructions.push(o),i}drawLineString(t,e){const i=this.state,n=i.strokeStyle,s=i.lineWidth;if(void 0===n||void 0===s)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([xa.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,or,ar],ya);const r=t.getFlatCoordinates(),o=t.getStride();this.drawFlatCoordinates_(r,0,r.length,o),this.hitDetectionInstructions.push(ma),this.endGeometry(e)}drawMultiLineString(t,e){const i=this.state,n=i.strokeStyle,s=i.lineWidth;if(void 0===n||void 0===s)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([xa.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,or,ar],ya);const r=t.getEnds(),o=t.getFlatCoordinates(),a=t.getStride();let h=0;for(let l=0,c=r.length;l=t){const e=(t-a+u)/u,d=j(i,l,e),g=j(n,c,e);h.push(d,g),r.push(h),h=[d,g],a==t&&(o+=s),a=0}else if(a0&&r.push(h),r}function Oa(t,e,i,n,s){let r,o,a,h,l,c,u,d,g,_,f=i,p=i,m=0,y=0,v=i;for(o=i;ot&&(y>m&&(m=y,f=v,p=o),y=0,v=o-s)),a=h,u=g,d=_),l=i,c=n}return y+=h,y>m?[v,o]:[f,p]}const Pa={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class Da extends wa{constructor(t,e,i,n){super(t,e,i,n),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[sr]={fillStyle:sr},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e){const i=this.textFillState_,n=this.textStrokeState_,s=this.textState_;if(""===this.text_||!s||!i&&!n)return;const r=this.coordinates;let o=r.length;const a=t.getType();let h=null,l=t.getStride();if("line"!==s.placement||"LineString"!=a&&"MultiLineString"!=a&&"Polygon"!=a&&"MultiPolygon"!=a){let i=s.overflow?null:[];switch(a){case"Point":case"MultiPoint":h=t.getFlatCoordinates();break;case"LineString":h=t.getFlatMidpoint();break;case"Circle":h=t.getCenter();break;case"MultiLineString":h=t.getFlatMidpoints(),l=2;break;case"Polygon":h=t.getFlatInteriorPoint(),s.overflow||i.push(h[2]/this.resolution),l=3;break;case"MultiPolygon":const e=t.getFlatInteriorPoints();h=[];for(let t=0,n=e.length;t{const n=r[2*(t+i)]===h[i*l]&&r[2*(t+i)+1]===h[i*l+1];return n||--t,n}))}this.saveTextStates_(),(s.backgroundFill||s.backgroundStroke)&&(this.setFillStrokeStyle(s.backgroundFill,s.backgroundStroke),s.backgroundFill&&this.updateFillStyle(this.state,this.createFill),s.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(t,e);let c=s.padding;if(c!=gr&&(s.scale[0]<0||s.scale[1]<0)){let t=s.padding[0],e=s.padding[1],i=s.padding[2],n=s.padding[3];s.scale[0]<0&&(e=-e,n=-n),s.scale[1]<0&&(t=-t,i=-i),c=[t,e,i,n]}const u=this.pixelRatio;this.instructions.push([xa.DRAW_IMAGE,o,n,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,void 0,this.declutterImageWithText_,c==gr?gr:c.map((function(t){return t*u})),!!s.backgroundFill,!!s.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,i]);const d=1/u,g=this.state.fillStyle;s.backgroundFill&&(this.state.fillStyle=sr,this.hitDetectionInstructions.push(this.createFill(this.state))),this.hitDetectionInstructions.push([xa.DRAW_IMAGE,o,n,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[d,d],NaN,void 0,this.declutterImageWithText_,c,!!s.backgroundFill,!!s.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?sr:this.fillKey_,this.textOffsetX_,this.textOffsetY_,i]),s.backgroundFill&&(this.state.fillStyle=g,this.hitDetectionInstructions.push(this.createFill(this.state))),this.endGeometry(e)}else{if(!re(this.getBufferedMaxExtent(),t.getExtent()))return;let i;if(h=t.getFlatCoordinates(),"LineString"==a)i=[h.length];else if("MultiLineString"==a)i=t.getEnds();else if("Polygon"==a)i=t.getEnds().slice(0,1);else if("MultiPolygon"==a){const e=t.getEndss();i=[];for(let t=0,n=e.length;tt[2]}else I=x>R;const M=Math.PI,L=[],b=C+n===e;let A;if(e=C,p=0,m=S,d=t[e],g=t[e+1],b){y(),A=Math.atan2(g-f,d-_),I&&(A+=A>0?-M:M);const t=(R+x)/2,e=(T+E)/2;return L[0]=[t,e,(w-r)/2,A,s],L}s=s.replace(/\n/g," ");for(let O=0,P=s.length;O0?-M:M),void 0!==A){let e=t-A;if(e+=e>M?-2*M:e<-M?2*M:0,Math.abs(e)>o)return null}A=t;const u=O;let x=0;for(;O0&&t.push("\n",""),t.push(e,""),t}class qa{constructor(t,e,i,n){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=mi(),this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={}}createLabel(t,e,i,n){const s=t+e+i+n;if(this.labels_[s])return this.labels_[s];const r=n?this.strokeStates[n]:null,o=i?this.fillStates[i]:null,a=this.textStates[e],h=this.pixelRatio,l=[a.scale[0]*h,a.scale[1]*h],c=Array.isArray(t),u=a.justify?Pa[a.justify]:Ua(Array.isArray(t)?t[0]:t,a.textAlign||ur),d=n&&r.lineWidth?r.lineWidth:0,g=c?t:t.split("\n").reduce(Ha,[]),{width:_,height:f,widths:p,heights:m,lineWidths:y}=wr(a,g),v=_+d,x=[],E=(v+2)*l[0],C=(f+d)*l[1],S={width:E<0?Math.floor(E):Math.ceil(E),height:C<0?Math.floor(C):Math.ceil(C),contextInstructions:x};1==l[0]&&1==l[1]||x.push("scale",l),n&&(x.push("strokeStyle",r.strokeStyle),x.push("lineWidth",d),x.push("lineCap",r.lineCap),x.push("lineJoin",r.lineJoin),x.push("miterLimit",r.miterLimit),x.push("setLineDash",[r.lineDash]),x.push("lineDashOffset",r.lineDashOffset)),i&&x.push("fillStyle",o.fillStyle),x.push("textBaseline","middle"),x.push("textAlign","center");const w=.5-u;let R=u*v+w*d;const T=[],I=[];let M,L=0,b=0,A=0,O=0;for(let P=0,D=g.length;Pt?t-h:s,v=r+l>e?e-l:r,x=g[3]+y*u[0]+g[1],E=g[0]+v*u[1]+g[2],C=p-g[3],S=m-g[0];let w;return(_||0!==c)&&(Ya[0]=C,Va[0]=C,Ya[1]=S,Ba[1]=S,Ba[0]=C+x,Ka[0]=Ba[0],Ka[1]=S+E,Va[1]=Ka[1]),0!==c?(w=Si(mi(),i,n,1,1,c,-i,-n),Ei(w,Ya),Ei(w,Ba),Ei(w,Ka),Ei(w,Va),Nt(Math.min(Ya[0],Ba[0],Ka[0],Va[0]),Math.min(Ya[1],Ba[1],Ka[1],Va[1]),Math.max(Ya[0],Ba[0],Ka[0],Va[0]),Math.max(Ya[1],Ba[1],Ka[1],Va[1]),Xa)):Nt(Math.min(C,C+x),Math.min(S,S+E),Math.max(C,C+x),Math.max(S,S+E),Xa),d&&(p=Math.round(p),m=Math.round(m)),{drawImageX:p,drawImageY:m,drawImageW:y,drawImageH:v,originX:h,originY:l,declutterBox:{minX:Xa[0],minY:Xa[1],maxX:Xa[2],maxY:Xa[3],value:f},canvasTransform:w,scale:u}}replayImageOrLabel_(t,e,i,n,s,r,o){const a=!(!r&&!o),h=n.declutterBox,l=t.canvas,c=o?o[2]*n.scale[0]/2:0,u=h.minX-c<=l.width/e&&h.maxX+c>=0&&h.minY-c<=l.height/e&&h.maxY+c>=0;return u&&(a&&this.replayTextBackground_(t,Ya,Ba,Ka,Va,r,o),Rr(t,n.canvasTransform,s,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(t){if(this.alignFill_){const e=Ei(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()}setStrokeStyle_(t,e){t["strokeStyle"]=e[1],t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6])}drawLabelWithPointPlacement_(t,e,i,n){const s=this.textStates[e],r=this.createLabel(t,e,n,i),o=this.strokeStates[i],a=this.pixelRatio,h=Ua(Array.isArray(t)?t[0]:t,s.textAlign||ur),l=Pa[s.textBaseline||dr],c=o&&o.lineWidth?o.lineWidth:0,u=r.width/a-2*s.scale[0],d=h*u+2*(.5-h)*c,g=l*r.height/a+2*(.5-l)*c;return{label:r,anchorX:d,anchorY:g}}execute_(t,e,i,n,s,r,o,a){let h;this.pixelCoordinates_&&f(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=Mi(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),xi(this.renderedTransform_,i));let l=0;const c=n.length;let u,d,g,_,p,m,y,v,x,E,C,S,w=0,R=0,T=0,I=null,M=null;const L=this.coordinateCache_,b=this.viewRotation_,A=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,O={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:b},P=this.instructions!=n||this.overlaps?0:200;let D,F,k,N;while(lP&&(this.fill_(t),R=0),T>P&&(t.stroke(),T=0),R||T||(t.beginPath(),_=NaN,p=NaN),++l;break;case xa.CIRCLE:w=i[1];const n=h[w],c=h[w+1],f=h[w+2],G=h[w+3],W=f-n,z=G-c,X=Math.sqrt(W*W+z*z);t.moveTo(n+X,c),t.arc(n,c,X,0,2*Math.PI,!0),++l;break;case xa.CLOSE_PATH:t.closePath(),++l;break;case xa.CUSTOM:w=i[1],u=i[2];const Y=i[3],B=i[4],K=6==i.length?i[5]:void 0;O.geometry=Y,O.feature=D,l in L||(L[l]=[]);const V=L[l];K?K(h,w,u,2,V):(V[0]=h[w],V[1]=h[w+1],V.length=2),B(V,O),++l;break;case xa.DRAW_IMAGE:w=i[1],u=i[2],v=i[3],d=i[4],g=i[5];let j=i[6];const Z=i[7],U=i[8],H=i[9],q=i[10];let J=i[11];const $=i[12];let Q=i[13];const tt=i[14],et=i[15];if(!v&&i.length>=20){x=i[19],E=i[20],C=i[21],S=i[22];const t=this.drawLabelWithPointPlacement_(x,E,C,S);v=t.label,i[3]=v;const e=i[23];d=(t.anchorX-e)*this.pixelRatio,i[4]=d;const n=i[24];g=(t.anchorY-n)*this.pixelRatio,i[5]=g,j=v.height,i[6]=j,Q=v.width,i[13]=Q}let it,nt,st,rt;i.length>25&&(it=i[25]),i.length>17?(nt=i[16],st=i[17],rt=i[18]):(nt=gr,st=!1,rt=!1),q&&A?J+=b:q||A||(J-=b);let ot=0;for(;w0){if(!r||"Image"!==g&&"Text"!==g||r.includes(t)){const i=(d[a]-3)/4,r=n-i%o,h=n-(i/o|0),l=s(t,e,r*r+h*h);if(l)return l}l.clearRect(0,0,o,o);break}}const f=Object.keys(this.executorsByZIndex_).map(Number);let p,m,y,v,x;for(f.sort(u),p=f.length-1;p>=0;--p){const t=f[p].toString();for(y=this.executorsByZIndex_[t],m=$a.length-1;m>=0;--m)if(g=$a[m],v=y[g],void 0!==v&&(x=v.executeHitDetection(l,a,i,_,c),x))return x}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],n=e[1],s=e[2],r=e[3],o=[i,n,i,r,s,r,s,n];return Mi(o,0,8,2,t,o),o}isEmpty(){return C(this.executorsByZIndex_)}execute(t,e,i,n,s,r,o){const a=Object.keys(this.executorsByZIndex_).map(Number);let h,l,c,d,g,_;for(a.sort(u),this.maxExtent_&&(t.save(),this.clip(t,i)),r=r||$a,o&&a.reverse(),h=0,l=a.length;hi)break;let a=n[o];a||(a=[],n[o]=a),a.push(4*((t+r)*e+(t+s))+3),r>0&&a.push(4*((t-r)*e+(t+s))+3),s>0&&(a.push(4*((t+r)*e+(t-s))+3),r>0&&a.push(4*((t-r)*e+(t-s))+3))}const s=[];for(let r=0,o=n.length;rt*this.pixelRatio_)),lineDashOffset:(s||ar)*this.pixelRatio_,lineJoin:void 0!==r?r:hr,lineWidth:(void 0!==o?o:_r)*this.pixelRatio_,miterLimit:void 0!==a?a:lr,strokeStyle:Us(t||cr)}}else this.strokeState_=null}setImageStyle(t){let e;if(!t||!(e=t.getSize()))return void(this.image_=null);const i=t.getPixelRatio(this.pixelRatio_),n=t.getAnchor(),s=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*i,this.imageAnchorY_=n[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const r=t.getScaleArray();this.imageScale_=[r[0]*this.pixelRatio_/i,r[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(t){const e=t.getFill();if(e){const t=e.getColor();this.textFillState_={fillStyle:Us(t||sr)}}else this.textFillState_=null;const i=t.getStroke();if(i){const t=i.getColor(),e=i.getLineCap(),n=i.getLineDash(),s=i.getLineDashOffset(),r=i.getLineJoin(),o=i.getWidth(),a=i.getMiterLimit();this.textStrokeState_={lineCap:void 0!==e?e:rr,lineDash:n||or,lineDashOffset:s||ar,lineJoin:void 0!==r?r:hr,lineWidth:void 0!==o?o:_r,miterLimit:void 0!==a?a:lr,strokeStyle:Us(t||cr)}}else this.textStrokeState_=null;const n=t.getFont(),s=t.getOffsetX(),r=t.getOffsetY(),o=t.getRotateWithView(),a=t.getRotation(),h=t.getScaleArray(),l=t.getText(),c=t.getTextAlign(),u=t.getTextBaseline();this.textState_={font:void 0!==n?n:nr,textAlign:void 0!==c?c:ur,textBaseline:void 0!==u?u:dr},this.text_=void 0!==l?Array.isArray(l)?l.reduce(((t,e,i)=>t+(i%2?" ":e)),""):l:"",this.textOffsetX_=void 0!==s?this.pixelRatio_*s:0,this.textOffsetY_=void 0!==r?this.pixelRatio_*r:0,this.textRotateWithView_=void 0!==o&&o,this.textRotation_=void 0!==a?a:0,this.textScale_=[this.pixelRatio_*h[0],this.pixelRatio_*h[1]]}else this.text_=""}}var sh=nh;const rh=.5;function oh(t,e,i,n,s,r,o){const a=t[0]*rh,h=t[1]*rh,l=$n(a,h);l.imageSmoothingEnabled=!1;const c=l.canvas,d=new sh(l,rh,s,null,o),g=i.length,_=Math.floor(16777215/g),f={};for(let u=1;u<=g;++u){const t=i[u-1],e=t.getStyleFunction()||n;if(!e)continue;let o=e(t,r);if(!o)continue;Array.isArray(o)||(o=[o]);const a=u*_,h=a.toString(16).padStart(7,"#00000");for(let i=0,n=o.length;i{if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const t=[this.context.canvas.width,this.context.canvas.height];Ei(this.pixelTransform,t);const e=this.renderedCenter_,i=this.renderedResolution_,n=this.renderedRotation_,s=this.renderedProjection_,r=this.wrappedRenderedExtent_,o=this.getLayer(),a=[],h=t[0]*rh,l=t[1]*rh;a.push(this.getRenderTransform(e,i,n,rh,h,l,0).slice());const c=o.getSource(),u=s.getExtent();if(c.getWrapX()&&s.canWrapX()&&!Pt(u,r)){let t=r[0];const s=se(u);let o,c=0;while(tu[2])++c,o=s*c,a.push(this.getRenderTransform(e,i,n,rh,h,l,o).slice()),t-=s}this.hitDetectionImageData_=oh(t,a,this.renderedFeatures_,o.getStyleFunction(),r,i,n)}e(ah(t,this.renderedFeatures_,this.hitDetectionImageData_))}))}forEachFeatureAtCoordinate(t,e,i,n,s){if(!this.replayGroup_)return;const r=e.viewState.resolution,o=e.viewState.rotation,a=this.getLayer(),h={},l=function(t,e,i){const r=D(t),o=h[r];if(o){if(!0!==o&&ic=n.forEachFeatureAtCoordinate(t,r,o,i,l,n===this.declutterExecutorGroup&&e.declutterTree?e.declutterTree.all().map((t=>t.value)):null))),c}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const n=t.viewHints[Q.ANIMATING],s=t.viewHints[Q.INTERACTING],r=e.getUpdateWhileAnimating(),o=e.getUpdateWhileInteracting();if(this.ready&&!r&&n||!o&&s)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const a=t.extent,h=t.viewState,l=h.projection,c=h.resolution,u=t.pixelRatio,d=e.getRevision(),g=e.getRenderBuffer();let _=e.getRenderOrder();void 0===_&&(_=ch);const p=h.center.slice(),m=Lt(a,g*c),y=m.slice(),v=[m.slice()],x=l.getExtent();if(i.getWrapX()&&l.canWrapX()&&!Pt(x,t.extent)){const t=se(x),e=Math.max(se(m)/2,t);m[0]=x[0]-e,m[2]=x[2]+e,pe(p,l);const i=ce(v[0],l);i[0]x[0]&&i[2]>x[2]&&v.push([i[0]-t,i[1],i[2]-t,i[3]])}if(this.ready&&this.renderedResolution_==c&&this.renderedRevision_==d&&this.renderedRenderOrder_==_&&Pt(this.wrappedRenderedExtent_,m))return f(this.renderedExtent_,y)||(this.hitDetectionImageData_=null,this.renderedExtent_=y),this.renderedCenter_=p,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const E=new Ga(dh(c,u),m,c,u);let C;this.getLayer().getDeclutter()&&(C=new Ga(dh(c,u),m,c,u));const S=ze();let w;if(S){for(let t=0,e=v.length;t{let i;const n=t.getStyleFunction()||e.getStyleFunction();if(n&&(i=n(t,c)),i){const e=this.renderFeature(t,R,i,E,w,C);T=T&&!e}},M=Be(m,l),L=i.getFeaturesInExtent(M);_&&L.sort(_);for(let f=0,O=L.length;f0)this.pop()}extend(t){for(let e=0,i=t.length;ethis.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new bh(Mh.ADD,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){this.unique_&&this.assertUnique_(t);const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,n=e.length;i=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new bh(Mh.REMOVE,e,t)),e}setAt(t,e){const i=this.getLength();if(t>=i)return void this.insertAt(t,e);if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const n=this.array_[t];this.array_[t]=e,this.dispatchEvent(new bh(Mh.REMOVE,n,t)),this.dispatchEvent(new bh(Mh.ADD,e,t))}updateLength_(){this.set(Lh.LENGTH,this.array_.length)}assertUnique_(t,e){for(let i=0,n=this.array_.length;i=200&&a.status<300){const t=e.getType();let n;"json"==t||"text"==t?n=a.responseText:"xml"==t?(n=a.responseXML,n||(n=(new DOMParser).parseFromString(a.responseText,"application/xml"))):"arraybuffer"==t&&(n=a.response),n?r(e.readFeatures(n,{extent:i,featureProjection:s}),e.readProjection(n)):o()}else o()},a.onerror=o,a.send()}function Yh(t,e){return function(i,n,s,r,o){const a=this;Xh(t,e,i,n,s,(function(t,e){a.addFeatures(t),void 0!==r&&r(t)}),o||v)}}class Bh extends o{constructor(t,e,i){super(t),this.feature=e,this.features=i}}class Kh extends Nh{constructor(t){t=t||{},super({attributions:t.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:void 0===t.wrapX||t.wrapX}),this.on,this.once,this.un,this.loader_=v,this.format_=t.format,this.overlaps_=void 0===t.overlaps||t.overlaps,this.url_=t.url,void 0!==t.loader?this.loader_=t.loader:void 0!==this.url_&&(W(this.format_,"`format` must be set when `url` is set"),this.loader_=Yh(this.url_,this.format_)),this.strategy_=void 0!==t.strategy?t.strategy:Wh;const e=void 0===t.useSpatialIndex||t.useSpatialIndex;let i,n;this.featuresRtree_=e?new Dh:null,this.loadedExtentsRtree_=new Dh,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null,Array.isArray(t.features)?n=t.features:t.features&&(i=t.features,n=i.getArray()),e||void 0!==i||(i=new Oh(n)),void 0!==n&&this.addFeaturesInternal(n),void 0!==i&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=D(t);if(!this.addToIndex_(e,t))return void(this.featuresCollection_&&this.featuresCollection_.remove(t));this.setupChangeEvents_(e,t);const i=t.getGeometry();if(i){const e=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(e,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new Bh(Gh.ADDFEATURE,t))}setupChangeEvents_(t,e){this.featureChangeKeys_[t]=[T(e,R.CHANGE,this.handleFeatureChange_,this),T(e,a.PROPERTYCHANGE,this.handleFeatureChange_,this)]}addToIndex_(t,e){let i=!0;const n=e.getId();return void 0!==n&&(n.toString()in this.idIndex_?i=!1:this.idIndex_[n.toString()]=e),i&&(W(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],i=[],n=[];for(let s=0,r=t.length;s{e||(e=!0,this.addFeature(t.element),e=!1)})),t.addEventListener(Mh.REMOVE,(t=>{e||(e=!0,this.removeFeature(t.element),e=!1)})),this.featuresCollection_=t}clear(t){if(t){for(const t in this.featureChangeKeys_){const e=this.featureChangeKeys_[t];e.forEach(M)}this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){const t=t=>{this.removeFeatureInternal(t)};this.featuresRtree_.forEach(t);for(const e in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[e])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new Bh(Gh.CLEAR);this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){const i=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(i,(function(i){const n=i.getGeometry();if(n.intersectsCoordinate(t))return e(i)}))}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,(function(i){const n=i.getGeometry();if(n.intersectsExtent(t)){const t=e(i);if(t)return t}}))}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),C(this.nullGeometryFeatures_)||_(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,(function(t){e.push(t)})),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){const i=e&&e.canWrapX()&&this.getWrapX();if(!i)return this.featuresRtree_.getInExtent(t);const n=ue(t,e);return[].concat(...n.map((t=>this.featuresRtree_.getInExtent(t))))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],n=t[1];let s=null;const r=[NaN,NaN];let o=1/0;const a=[-1/0,-1/0,1/0,1/0];return e=e||m,this.featuresRtree_.forEachInExtent(a,(function(t){if(e(t)){const e=t.getGeometry(),h=o;if(o=e.closestPointXY(i,n,r,o),o{--this.loadingExtentsCount_,this.dispatchEvent(new Bh(Gh.FEATURESLOADEND,void 0,t))}),(()=>{--this.loadingExtentsCount_,this.dispatchEvent(new Bh(Gh.FEATURESLOADERROR))})),n.insert(t,{extent:t.slice()}))}this.loading=!(this.loader_.length<4)&&this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_;let i;e.forEachInExtent(t,(function(e){if(Xt(e.extent,t))return i=e,!0})),i&&e.remove(i)}removeFeature(t){if(!t)return;const e=D(t);e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t);const i=this.removeFeatureInternal(t);i&&this.changed()}removeFeatureInternal(t){const e=D(t),i=this.featureChangeKeys_[e];if(!i)return;i.forEach(M),delete this.featureChangeKeys_[e];const n=t.getId();return void 0!==n&&delete this.idIndex_[n.toString()],delete this.uidIndex_[e],this.dispatchEvent(new Bh(Gh.REMOVEFEATURE,t)),t}removeFromIdIndex_(t){let e=!1;for(const i in this.idIndex_)if(this.idIndex_[i]===t){delete this.idIndex_[i],e=!0;break}return e}setLoader(t){this.loader_=t}setUrl(t){W(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader(Yh(t,this.format_))}}var Vh=Kh;class jh{constructor(t){this.highWaterMark=void 0!==t?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){while(this.canExpireCache())this.pop()}clear(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;while(e)t(e.value_,e.key_,this),e=e.newer}get(t,e){const i=this.entries_[t];return W(void 0!==i,"Tried to get a value for a key that does not exist in the cache"),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_}remove(t){const e=this.entries_[t];return W(void 0!==e,"Tried to get a value for a key that does not exist in the cache"),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_}getCount(){return this.count_}getKeys(){const t=new Array(this.count_);let e,i=0;for(e=this.newest_;e;e=e.older)t[i++]=e.key_;return t}getValues(){const t=new Array(this.count_);let e,i=0;for(e=this.newest_;e;e=e.older)t[i++]=e.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){if(this.containsKey(t))return this.entries_[t].value_}pop(){const 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_}replace(t,e){this.get(t),this.entries_[t].value_=e}set(t,e){W(!(t in this.entries_),"Tried to set a value for a key that is used already");const 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_}setSize(t){this.highWaterMark=t}}var Zh=jh;function Uh(t,e,i,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=i,n):[t,e,i]}function Hh(t,e,i){return t+"/"+e+"/"+i}function qh(t){return Hh(t[0],t[1],t[2])}function Jh(t){return t.split("/").map(Number)}function $h(t){return(t[1]<i||i>e.getMaxZoom())return!1;const r=e.getFullTileRange(i);return!r||r.containsXY(n,s)}class tl extends Zh{clear(){while(this.getCount()>0)this.pop().release();super.clear()}expireCache(t){while(this.canExpireCache()){const e=this.peekLast();if(e.getKey()in t)break;this.pop().release()}}pruneExceptNewestZ(){if(0===this.getCount())return;const t=this.peekFirstKey(),e=Jh(t),i=e[0];this.forEach((t=>{t.tileCoord[0]!==i&&(this.remove(qh(t.tileCoord)),t.release())}))}}var el=tl,il={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};const nl=[0,0,0],sl=5;class rl{constructor(t){let e;if(this.minZoom=void 0!==t.minZoom?t.minZoom:0,this.resolutions_=t.resolutions,W(p(this.resolutions_,(function(t,e){return e-t}),!0),"`resolutions` must be sorted in descending order"),!t.origins)for(let n=0,s=this.resolutions_.length-1;n=this.minZoom){if(2===this.zoomFactor_?(r=Math.floor(r/2),o=Math.floor(o/2),s=ks(r,r,o,o,i)):s=this.getTileRangeForExtentAndZ(a,h,i),e(h,s))return!0;--h}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]this.maxZoom||e0?n:Math.max(r/i[0],s/i[1]);const o=e+1,a=new Array(o);for(let h=0;hi.highWaterMark&&(i.highWaterMark=t)}useTile(t,e,i,n){}}class fl extends o{constructor(t,e){super(t),this.tile=e}}var pl=_l;function ml(t,e){const i=/\{z\}/g,n=/\{x\}/g,s=/\{y\}/g,r=/\{-y\}/g;return function(o,a,h){if(o)return t.replace(i,o[0].toString()).replace(n,o[1].toString()).replace(s,o[2].toString()).replace(r,(function(){const t=o[0],i=e.getFullTileRange(t);W(i,"The {-y} placeholder requires a tile grid with extent");const n=i.getHeight()-o[2]-1;return n.toString()}))}}function yl(t,e){const i=t.length,n=new Array(i);for(let s=0;sthis.getTileInternal(t,e,i,n,r)),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.getInterpolate());return _.key=c,h?(_.interimTile=h,_.refreshInterimChain(),o.replace(l,_)):o.set(l,_),_}getTileInternal(t,e,i,n,s){let r=null;const o=Hh(t,e,i),a=this.getKey();if(this.tileCache.containsKey(o)){if(r=this.tileCache.get(o),r.key!=a){const h=r;r=this.createTile_(t,e,i,n,s,a),h.getState()==us.IDLE?r.interimTile=h.interimTile:r.interimTile=h,r.refreshInterimChain(),this.tileCache.replace(o,r)}}else r=this.createTile_(t,e,i,n,s,a),this.tileCache.set(o,r);return r}setRenderReprojectionEdges(t){if(this.renderReprojectionEdges_!=t){this.renderReprojectionEdges_=t;for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear();this.changed()}}setTileGridForProjection(t,e){const i=Le(t);if(i){const t=D(i);t in this.tileGridForProjection||(this.tileGridForProjection[t]=e)}}clear(){super.clear();for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear()}}function wl(t,e){t.getImage().src=e}var Rl=Sl;class Tl extends Rl{constructor(t){t=t||{};const e=void 0!==t.projection?t.projection:"EPSG:3857",i=void 0!==t.tileGrid?t.tileGrid:cl({extent:gl(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize});super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,opaque:t.opaque,projection:e,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.gutter_=void 0!==t.gutter?t.gutter:0}getGutter(){return this.gutter_}}var Il=Tl;class Ml extends N{constructor(t){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),t)if("function"===typeof t.getSimplifiedGeometry){const e=t;this.setGeometry(e)}else{const e=t;this.setProperties(e)}}clone(){const t=new Ml(this.hasProperties()?this.getProperties():null);t.setGeometryName(this.getGeometryName());const e=this.getGeometry();e&&t.setGeometry(e.clone());const i=this.getStyle();return i&&t.setStyle(i),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(M(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=T(t,R.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?Ll(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}}function Ll(t){if("function"===typeof t)return t;let e;if(Array.isArray(t))e=t;else{W("function"===typeof t.getZIndex,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`");const i=t;e=[i]}return function(){return e}}var bl=Ml;class Al extends l{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){O()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,n=t.pixelToCoordinateTransform;Si(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),wi(n,i)}forEachFeatureAtCoordinate(t,e,i,n,s,r,o,a){let h;const l=e.viewState;function c(t,e,i,n){return s.call(r,e,t?i:null,n)}const u=l.projection,d=pe(t.slice(),u),g=[[0,0]];if(u.canWrapX()&&n){const t=u.getExtent(),e=se(t);g.push([-e,0],[e,0])}const _=e.layerStatesArray,f=_.length,p=[],m=[];for(let v=0;v=0;--n){const s=_[n],r=s.layer;if(r.hasRenderer()&&Pn(s,l)&&o.call(a,r)){const n=r.getRenderer(),o=r.getSource();if(n&&o){const r=o.getWrapX()?d:t,a=c.bind(null,s.managed);m[0]=r[0]+g[v][0],m[1]=r[1]+g[v][1],h=n.forEachFeatureAtCoordinate(m,e,i,a,p)}if(h)return h}}if(0===p.length)return;const y=1/p.length;return p.forEach(((t,e)=>t.distanceSq+=e*y)),p.sort(((t,e)=>t.distanceSq-e.distanceSq)),p.some((t=>h=t.callback(t.feature,t.layer,t.geometry))),h}hasFeatureAtCoordinate(t,e,i,n,s,r){const o=this.forEachFeatureAtCoordinate(t,e,i,n,m,this,s,r);return void 0!==o}getMap(){return this.map_}renderFrame(t){O()}flushDeclutterItems(t){}scheduleExpireIconCache(t){Br.canExpireCache()&&t.postRenderFunctions.push(Ol)}}function Ol(t,e){Br.expire()}var Pl=Al;class Dl extends Pl{constructor(t){super(t),this.fontChangeListenerKey_=T(fr,a.PROPERTYCHANGE,t.redrawText.bind(t)),this.element_=document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=Js+" ol-layers";const i=t.getViewport();i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0,this.declutterLayers_=[]}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const n=new Yn(t,void 0,e);i.dispatchEvent(n)}}disposeInternal(){M(this.fontChangeListenerKey_),this.element_.parentNode.removeChild(this.element_),super.disposeInternal()}renderFrame(t){if(!t)return void(this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1));this.calculateMatrices2D(t),this.dispatchRenderEvent($.PRECOMPOSE,t);const e=t.layerStatesArray.sort((function(t,e){return t.zIndex-e.zIndex})),i=t.viewState;this.children_.length=0;const n=this.declutterLayers_;n.length=0;let s=null;for(let r=0,o=e.length;r=0;--i)e[i].renderDeclutter(t);e.length=0}}var Fl=Dl;class kl extends o{constructor(t,e){super(t),this.layer=e}}const Nl={LAYERS:"layers"};class Gl extends J{constructor(t){t=t||{};const e=Object.assign({},t);delete e.layers;let i=t.layers;super(e),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(Nl.LAYERS,this.handleLayersChanged_),i?Array.isArray(i)?i=new Oh(i.slice(),{unique:!0}):W("function"===typeof i.getArray,"Expected `layers` to be an array or a `Collection`"):i=new Oh(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(M),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(T(t,Mh.ADD,this.handleLayersAdd_,this),T(t,Mh.REMOVE,this.handleLayersRemove_,this));for(const i in this.listenerKeys_)this.listenerKeys_[i].forEach(M);E(this.listenerKeys_);const e=t.getArray();for(let i=0,n=e.length;i{this.clickTimeoutId_=void 0;const e=new Bl(Kl.SINGLECLICK,this.map_,t);this.dispatchEvent(e)}),250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==Kl.POINTERUP||e.type==Kl.POINTERCANCEL){delete this.trackedTouches_[i];for(const t in this.trackedTouches_)if(this.trackedTouches_[t].target!==e.target){delete this.trackedTouches_[t];break}}else e.type!=Kl.POINTERDOWN&&e.type!=Kl.POINTERMOVE||(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new Bl(Kl.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.emulateClick_(this.down_),0===this.activePointers_.length&&(this.dragListenerKeys_.forEach(M),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return 0===t.button}handlePointerDown_(t){this.emulateClicks_=0===this.activePointers_.length,this.updateActivePointers_(t);const e=new Bl(Kl.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),0===this.dragListenerKeys_.length){const t=this.map_.getOwnerDocument();this.dragListenerKeys_.push(T(t,Kl.POINTERMOVE,this.handlePointerMove_,this),T(t,Kl.POINTERUP,this.handlePointerUp_,this),T(this.element_,Kl.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==t&&this.dragListenerKeys_.push(T(this.element_.getRootNode(),Kl.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new Bl(Kl.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;const e=!(!this.down_||!this.isMoving_(t));this.dispatchEvent(new Bl(Kl.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;e&&!e.defaultPrevented||"boolean"===typeof t.cancelable&&!0!==t.cancelable||t.preventDefault()}isMoving_(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(M(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(R.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(M(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(M),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}var Zl=jl,Ul={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},Hl={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};const ql=1/0;class Jl{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,E(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,i=t[0];1==t.length?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const n=this.keyFunction_(i);return delete this.queuedElements_[n],i}enqueue(t){W(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const e=this.priorityFunction_(t);return e!=ql&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)}getCount(){return this.elements_.length}getLeftChildIndex_(t){return 2*t+1}getRightChildIndex_(t){return 2*t+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return 0===this.elements_.length}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,n=e.length,s=e[t],r=i[t],o=t;while(t>1){const s=this.getLeftChildIndex_(t),r=this.getRightChildIndex_(t),o=rt){const t=this.getParentIndex_(e);if(!(n[t]>r))break;i[e]=i[t],n[e]=n[t],e=t}i[e]=s,n[e]=r}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let n=0;const s=e.length;let r,o,a;for(o=0;o0)n=this.dequeue()[0],s=n.getKey(),i=n.getState(),i!==us.IDLE||s in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[s]=!0,++this.tilesLoading_,++r,n.load())}}var tc=Ql;function ec(t,e,i,n,s){if(!t||!(i in t.wantedTiles))return ql;if(!t.wantedTiles[i][e.getKey()])return ql;const r=t.viewState.center,o=n[0]-r[0],a=n[1]-r[1];return 65536*Math.log(s)+Math.sqrt(o*o+a*a)/s}class ic extends N{constructor(t){super();const e=t.element;!e||t.target||e.style.pointerEvents||(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){ns(this.element),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&ns(this.element);for(let e=0,i=this.listenerKeys.length;ee.getAttributions(t))))),i=!this.getMap().getAllLayers().some((t=>t.getSource()&&!1===t.getSource().getAttributionsCollapsible()));return this.overrideCollapsible_||this.setCollapsible(i),e}updateElement_(t){if(!t)return void(this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1));const e=this.collectSourceAttributions_(t),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!f(e,this.renderedAttributions_)){ss(this.ulElement_);for(let t=0,i=e.length;t0&&i%(2*Math.PI)!==0?e.animate({rotation:0,duration:this.duration_,easing:ri}):e.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const i=e.viewState.rotation;if(i!=this.rotation_){const t="rotate("+i+"rad)";if(this.autoHide_){const t=this.element.classList.contains(Hs);t||0!==i?t&&0!==i&&this.element.classList.remove(Hs):this.element.classList.add(Hs)}this.label_.style.transform=t}this.rotation_=i}}var ac=oc;class hc extends nc{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=void 0!==t.className?t.className:"ol-zoom",i=void 0!==t.delta?t.delta:1,n=void 0!==t.zoomInClassName?t.zoomInClassName:e+"-in",s=void 0!==t.zoomOutClassName?t.zoomOutClassName:e+"-out",r=void 0!==t.zoomInLabel?t.zoomInLabel:"+",o=void 0!==t.zoomOutLabel?t.zoomOutLabel:"–",a=void 0!==t.zoomInTipLabel?t.zoomInTipLabel:"Zoom in",h=void 0!==t.zoomOutTipLabel?t.zoomOutTipLabel:"Zoom out",l=document.createElement("button");l.className=n,l.setAttribute("type","button"),l.title=a,l.appendChild("string"===typeof r?document.createTextNode(r):r),l.addEventListener(R.CLICK,this.handleClick_.bind(this,i),!1);const c=document.createElement("button");c.className=s,c.setAttribute("type","button"),c.title=h,c.appendChild("string"===typeof o?document.createTextNode(o):o),c.addEventListener(R.CLICK,this.handleClick_.bind(this,-i),!1);const u=e+" "+Js+" "+$s,d=this.element;d.className=u,d.appendChild(l),d.appendChild(c),this.duration_=void 0!==t.duration?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const e=this.getMap(),i=e.getView();if(!i)return;const n=i.getZoom();if(void 0!==n){const e=i.getConstrainedZoom(n+t);this.duration_>0?(i.getAnimating()&&i.cancelAnimations(),i.animate({zoom:e,duration:this.duration_,easing:ri})):i.setZoom(e)}}}var lc=hc;function cc(t){t=t||{};const e=new Oh,i=void 0===t.zoom||t.zoom;i&&e.push(new lc(t.zoomOptions));const n=void 0===t.rotate||t.rotate;n&&e.push(new ac(t.rotateOptions));const s=void 0===t.attribution||t.attribution;return s&&e.push(new rc(t.attributionOptions)),e}var uc={ACTIVE:"active"};class dc extends N{constructor(t){super(),this.on,this.once,this.un,t&&t.handleEvent&&(this.handleEvent=t.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(uc.ACTIVE)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(uc.ACTIVE,t)}setMap(t){this.map_=t}}function gc(t,e,i){const n=t.getCenterInternal();if(n){const s=[n[0]+e[0],n[1]+e[1]];t.animateInternal({duration:void 0!==i?i:250,easing:ai,center:t.getConstrainedCenter(s)})}}function _c(t,e,i,n){const s=t.getZoom();if(void 0===s)return;const r=t.getConstrainedZoom(s+e),o=t.getResolutionForZoom(r);t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:o,anchor:i,duration:void 0!==n?n:250,easing:ri})}var fc=dc;class pc extends fc{constructor(t){super(),t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:250}handleEvent(t){let e=!1;if(t.type==Kl.DBLCLICK){const i=t.originalEvent,n=t.map,s=t.coordinate,r=i.shiftKey?-this.delta_:this.delta_,o=n.getView();_c(o,r,s,this.duration_),i.preventDefault(),e=!0}return!e}}var mc=pc;class yc extends fc{constructor(t){t=t||{},super(t),t.handleDownEvent&&(this.handleDownEvent=t.handleDownEvent),t.handleDragEvent&&(this.handleDragEvent=t.handleDragEvent),t.handleMoveEvent&&(this.handleMoveEvent=t.handleMoveEvent),t.handleUpEvent&&(this.handleUpEvent=t.handleUpEvent),t.stopDown&&(this.stopDown=t.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(t){return!1}handleDragEvent(t){}handleEvent(t){if(!t.originalEvent)return!0;let e=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence){if(t.type==Kl.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==Kl.POINTERUP){const e=this.handleUpEvent(t);this.handlingDownUpSequence=e&&this.targetPointers.length>0}}else if(t.type==Kl.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==Kl.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}}function vc(t){const e=t.length;let i=0,n=0;for(let s=0;s0&&this.condition_(t)){const e=t.map,i=e.getView();return this.lastCentroid=null,i.getAnimating()&&i.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}}var Dc=Pc;class Fc extends xc{constructor(t){t=t||{},super({stopDown:y}),this.condition_=t.condition?t.condition:Cc,this.lastAngle_=void 0,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){if(!Ac(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===ti)return;const n=e.getSize(),s=t.pixel,r=Math.atan2(n[1]/2-s[1],s[0]-n[0]/2);if(void 0!==this.lastAngle_){const t=r-this.lastAngle_;i.adjustRotationInternal(-t)}this.lastAngle_=r}handleUpEvent(t){if(!Ac(t))return!0;const e=t.map,i=e.getView();return i.endInteraction(this.duration_),!1}handleDownEvent(t){if(!Ac(t))return!1;if(Tc(t)&&this.condition_(t)){const e=t.map;return e.getView().beginInteraction(),this.lastAngle_=void 0,!0}return!1}}var kc=Fc;class Nc extends l{constructor(t){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const t=this.startPixel_,e=this.endPixel_,i="px",n=this.element_.style;n.left=Math.min(t[0],e[0])+i,n.top=Math.min(t[1],e[1])+i,n.width=Math.abs(e[0]-t[0])+i,n.height=Math.abs(e[1]-t[1])+i}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){const t=this.startPixel_,e=this.endPixel_,i=[t,[t[0],e[1]],e,[e[0],t[1]]],n=i.map(this.map_.getCoordinateFromPixelInternal,this.map_);n[4]=n[0].slice(),this.geometry_?this.geometry_.setCoordinates([n]):this.geometry_=new En([n])}getGeometry(){return this.geometry_}}var Gc=Nc;const Wc={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"};class zc extends o{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}class Xc extends xc{constructor(t){super(),this.on,this.once,this.un,t=t||{},this.box_=new Gc(t.className||"ol-dragbox"),this.minArea_=void 0!==t.minArea?t.minArea:64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition?t.condition:Tc,this.boxEndCondition_=t.boxEndCondition?t.boxEndCondition:this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,i){const n=i[0]-e[0],s=i[1]-e[1];return n*n+s*s>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new zc(Wc.BOXDRAG,t.coordinate,t))}handleUpEvent(t){this.box_.setMap(null);const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new zc(e?Wc.BOXEND:Wc.BOXCANCEL,t.coordinate,t)),!1}handleDownEvent(t){return!!this.condition_(t)&&(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new zc(Wc.BOXSTART,t.coordinate,t)),!0)}onBoxEnd(t){}}var Yc=Xc;class Bc extends Yc{constructor(t){t=t||{};const e=t.condition?t.condition:Lc;super({condition:e,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=void 0!==t.duration?t.duration:200,this.out_=void 0!==t.out&&t.out}onBoxEnd(t){const e=this.getMap(),i=e.getView();let n=this.getGeometry();if(this.out_){const t=i.rotatedExtentForGeometry(n),e=i.getResolutionForExtentInternal(t),s=i.getResolution()/e;n=n.clone(),n.scale(s*s)}i.fitInternal(n,{duration:this.duration_,easing:ri})}}var Kc=Bc,Vc={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};class jc extends fc{constructor(t){super(),t=t||{},this.defaultCondition_=function(t){return Ic(t)&&bc(t)},this.condition_=void 0!==t.condition?t.condition:this.defaultCondition_,this.duration_=void 0!==t.duration?t.duration:100,this.pixelDelta_=void 0!==t.pixelDelta?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==R.KEYDOWN){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&(n==Vc.DOWN||n==Vc.LEFT||n==Vc.RIGHT||n==Vc.UP)){const s=t.map,r=s.getView(),o=r.getResolution()*this.pixelDelta_;let a=0,h=0;n==Vc.DOWN?h=-o:n==Vc.LEFT?a=-o:n==Vc.RIGHT?a=o:h=o;const l=[a,h];_e(l,r.getRotation()),gc(r,l,this.duration_),i.preventDefault(),e=!0}}return!e}}var Zc=jc;class Uc extends fc{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(t){return!Mc(t)&&bc(t)},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:100}handleEvent(t){let e=!1;if(t.type==R.KEYDOWN||t.type==R.KEYPRESS){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&("+"===n||"-"===n)){const s=t.map,r="+"===n?this.delta_:-this.delta_,o=s.getView();_c(o,r,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}}var Hc=Uc;class qc{constructor(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]0&&this.points_[i+2]>t)i-=3;const n=this.points_[e+2]-this.points_[i+2];if(n<1e3/60)return!1;const s=this.points_[e]-this.points_[i],r=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(r,s),this.initialVelocity_=Math.sqrt(s*s+r*r)/n,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}var Jc=qc;class $c extends fc{constructor(t){t=t||{},super(t),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=void 0!==t.maxDelta?t.maxDelta:1,this.duration_=void 0!==t.duration?t.duration:250,this.timeout_=void 0!==t.timeout?t.timeout:80,this.useAnchor_=void 0===t.useAnchor||t.useAnchor,this.constrainResolution_=void 0!==t.constrainResolution&&t.constrainResolution;const e=t.condition?t.condition:Rc;this.condition_=t.onFocusOnly?Ec(wc,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();if(!t)return;const e=t.getView();e.endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_)}handleEvent(t){if(!this.condition_(t))return!0;const e=t.type;if(e!==R.WHEEL)return!0;const i=t.map,n=t.originalEvent;let s;if(n.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.coordinate),t.type==R.WHEEL&&(s=n.deltaY,li&&n.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(s/=gi),n.deltaMode===WheelEvent.DOM_DELTA_LINE&&(s*=40)),0===s)return!1;this.lastDelta_=s;const r=Date.now();void 0===this.startTime_&&(this.startTime_=r),(!this.mode_||r-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(s)<4?"trackpad":"wheel");const o=i.getView();if("trackpad"===this.mode_&&!o.getConstrainResolution()&&!this.constrainResolution_)return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(o.getAnimating()&&o.cancelAnimations(),o.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),o.adjustZoom(-s/this.deltaPerZoom_,this.lastAnchor_),this.startTime_=r,!1;this.totalDelta_+=s;const a=Math.max(this.timeout_-(r-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,i),a),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let i=-z(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),_c(e,i,this.lastAnchor_,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}}var Qc=$c;class tu extends xc{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=y),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=void 0!==t.threshold?t.threshold:.3,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){let e=0;const i=this.targetPointers[0],n=this.targetPointers[1],s=Math.atan2(n.clientY-i.clientY,n.clientX-i.clientX);if(void 0!==this.lastAngle_){const t=s-this.lastAngle_;this.rotationDelta_+=t,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=t}this.lastAngle_=s;const r=t.map,o=r.getView();o.getConstraints().rotation!==ti&&(this.anchor_=r.getCoordinateFromPixelInternal(r.getEventPixel(vc(this.targetPointers))),this.rotating_&&(r.render(),o.adjustRotationInternal(e,this.anchor_)))}handleUpEvent(t){if(this.targetPointers.length<2){const e=t.map,i=e.getView();return i.endInteraction(this.duration_),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}var eu=tu;class iu extends xc{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=y),super(e),this.anchor_=null,this.duration_=void 0!==t.duration?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const i=this.targetPointers[0],n=this.targetPointers[1],s=i.clientX-n.clientX,r=i.clientY-n.clientY,o=Math.sqrt(s*s+r*r);void 0!==this.lastDistance_&&(e=this.lastDistance_/o),this.lastDistance_=o;const a=t.map,h=a.getView();1!=e&&(this.lastScaleDelta_=e),this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel(vc(this.targetPointers))),a.render(),h.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const e=t.map,i=e.getView(),n=this.lastScaleDelta_>1?1:-1;return i.endInteraction(this.duration_,n),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}var nu=iu;function su(t){t=t||{};const e=new Oh,i=new Jc(-.005,.05,100),n=void 0===t.altShiftDragRotate||t.altShiftDragRotate;n&&e.push(new kc);const s=void 0===t.doubleClickZoom||t.doubleClickZoom;s&&e.push(new mc({delta:t.zoomDelta,duration:t.zoomDuration}));const r=void 0===t.dragPan||t.dragPan;r&&e.push(new Dc({onFocusOnly:t.onFocusOnly,kinetic:i}));const o=void 0===t.pinchRotate||t.pinchRotate;o&&e.push(new eu);const a=void 0===t.pinchZoom||t.pinchZoom;a&&e.push(new nu({duration:t.zoomDuration}));const h=void 0===t.keyboard||t.keyboard;h&&(e.push(new Zc),e.push(new Hc({delta:t.zoomDelta,duration:t.zoomDuration})));const l=void 0===t.mouseWheelZoom||t.mouseWheelZoom;l&&e.push(new Qc({onFocusOnly:t.onFocusOnly,duration:t.zoomDuration}));const c=void 0===t.shiftDragZoom||t.shiftDragZoom;return c&&e.push(new Kc({duration:t.zoomDuration})),e}function ru(t){t instanceof Dn?t.setMapInternal(null):t instanceof Wl&&t.getLayers().forEach(ru)}function ou(t,e){if(t instanceof Dn)t.setMapInternal(e);else if(t instanceof Wl){const i=t.getLayers().getArray();for(let t=0,n=i.length;tthis.updateSize())),this.controls=e.controls||cc(),this.interactions=e.interactions||su({onFocusOnly:!0}),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new tc(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(Hl.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(Hl.VIEW,this.handleViewChanged_),this.addChangeListener(Hl.SIZE,this.handleSizeChanged_),this.addChangeListener(Hl.TARGET,this.handleTargetChanged_),this.setProperties(e.values);const i=this;!t.view||t.view instanceof An||t.view.then((function(t){i.setView(new An(t))})),this.controls.addEventListener(Mh.ADD,(t=>{t.element.setMap(this)})),this.controls.addEventListener(Mh.REMOVE,(t=>{t.element.setMap(null)})),this.interactions.addEventListener(Mh.ADD,(t=>{t.element.setMap(this)})),this.interactions.addEventListener(Mh.REMOVE,(t=>{t.element.setMap(null)})),this.overlays_.addEventListener(Mh.ADD,(t=>{this.addOverlayInternal_(t.element)})),this.overlays_.addEventListener(Mh.REMOVE,(t=>{const e=t.element.getId();void 0!==e&&delete this.overlayIdIndex_[e.toString()],t.element.setMap(null)})),this.controls.forEach((t=>{t.setMap(this)})),this.interactions.forEach((t=>{t.setMap(this)})),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){const e=this.getLayerGroup().getLayers();e.push(t)}handleLayerAdd_(t){ou(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();void 0!==e&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;const n=this.getCoordinateFromPixelInternal(t);i=void 0!==i?i:{};const s=void 0!==i.hitTolerance?i.hitTolerance:0,r=void 0!==i.layerFilter?i.layerFilter:m,o=!1!==i.checkWrapped;return this.renderer_.forEachFeatureAtCoordinate(n,this.frameState_,s,o,e,null,r,null)}getFeaturesAtPixel(t,e){const i=[];return this.forEachFeatureAtPixel(t,(function(t){i.push(t)}),e),i}getAllLayers(){const t=[];function e(i){i.forEach((function(i){i instanceof Wl?e(i.getLayers()):t.push(i)}))}return e(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(t);e=void 0!==e?e:{};const n=void 0!==e.layerFilter?e.layerFilter:m,s=void 0!==e.hitTolerance?e.hitTolerance:0,r=!1!==e.checkWrapped;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,s,r,n,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const e=this.viewport_,i=e.getBoundingClientRect(),n=this.getSize(),s=i.width/n[0],r=i.height/n[1],o="changedTouches"in t?t.changedTouches[0]:t;return[(o.clientX-i.left)/s,(o.clientY-i.top)/r]}getTarget(){return this.get(Hl.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return Xe(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?Ei(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){const e=this.overlayIdIndex_[t.toString()];return void 0!==e?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(Hl.LAYERGROUP)}setLayers(t){const e=this.getLayerGroup();if(t instanceof Oh)return void e.setLayers(t);const i=e.getLayers();i.clear(),i.extend(t)}getLayers(){const t=this.getLayerGroup().getLayers();return t}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e=0;i--){const n=e[i];if(n.getMap()!==this||!n.getActive()||!this.getTargetElement())continue;const s=n.handleEvent(t);if(!s||t.propagationStopped)break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let i=this.maxTilesLoading_,n=i;if(t){const e=t.viewHints;if(e[Q.ANIMATING]||e[Q.INTERACTING]){const e=Date.now()-t.time>8;i=e?0:8,n=e?0:2}}e.getTilesLoading(){this.postRenderTimeoutHandle_=void 0,this.handlePostRender()}),0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new kl("removelayer",e)),this.set(Hl.LAYERGROUP,t)}setSize(t){this.set(Hl.SIZE,t)}setTarget(t){this.set(Hl.TARGET,t)}setView(t){if(!t||t instanceof An)return void this.set(Hl.VIEW,t);this.set(Hl.VIEW,new An);const e=this;t.then((function(t){e.setView(new An(t))}))}updateSize(){const t=this.getTargetElement();let e;if(t){const i=getComputedStyle(t),n=t.offsetWidth-parseFloat(i["borderLeftWidth"])-parseFloat(i["paddingLeft"])-parseFloat(i["paddingRight"])-parseFloat(i["borderRightWidth"]),s=t.offsetHeight-parseFloat(i["borderTopWidth"])-parseFloat(i["paddingTop"])-parseFloat(i["paddingBottom"])-parseFloat(i["borderBottomWidth"]);isNaN(n)||isNaN(s)||(e=[n,s],!Gs(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&Ce("No map visible because the map container's width or height are 0."))}const i=this.getSize();!e||i&&f(e,i)||(this.setSize(e),this.updateViewportSize_())}updateViewportSize_(){const t=this.getView();if(t){let e;const i=getComputedStyle(this.viewport_);i.width&&i.height&&(e=[parseInt(i.width,10),parseInt(i.height,10)]),t.setViewportSize(e)}}}function hu(t){let e=null;void 0!==t.keyboardEventTarget&&(e="string"===typeof t.keyboardEventTarget?document.getElementById(t.keyboardEventTarget):t.keyboardEventTarget);const i={},n=t.layers&&"function"===typeof t.layers.getLayers?t.layers:new Wl({layers:t.layers});let s,r,o;return i[Hl.LAYERGROUP]=n,i[Hl.TARGET]=t.target,i[Hl.VIEW]=t.view instanceof An?t.view:new An,void 0!==t.controls&&(Array.isArray(t.controls)?s=new Oh(t.controls.slice()):(W("function"===typeof t.controls.getArray,"Expected `controls` to be an array or an `ol/Collection.js`"),s=t.controls)),void 0!==t.interactions&&(Array.isArray(t.interactions)?r=new Oh(t.interactions.slice()):(W("function"===typeof t.interactions.getArray,"Expected `interactions` to be an array or an `ol/Collection.js`"),r=t.interactions)),void 0!==t.overlays?Array.isArray(t.overlays)?o=new Oh(t.overlays.slice()):(W("function"===typeof t.overlays.getArray,"Expected `overlays` to be an array or an `ol/Collection.js`"),o=t.overlays):o=new Oh,{controls:s,interactions:r,keyboardEventTarget:e,overlays:o,values:i}}var lu=au;const cu={ELEMENT:"element",MAP:"map",OFFSET:"offset",POSITION:"position",POSITIONING:"positioning"};class uu extends N{constructor(t){super(),this.on,this.once,this.un,this.options=t,this.id=t.id,this.insertFirst=void 0===t.insertFirst||t.insertFirst,this.stopEvent=void 0===t.stopEvent||t.stopEvent,this.element=document.createElement("div"),this.element.className=void 0!==t.className?t.className:"ol-overlay-container "+qs,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=!0===t.autoPan?{}:t.autoPan||void 0,this.rendered={transform_:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(cu.ELEMENT,this.handleElementChanged),this.addChangeListener(cu.MAP,this.handleMapChanged),this.addChangeListener(cu.OFFSET,this.handleOffsetChanged),this.addChangeListener(cu.POSITION,this.handlePositionChanged),this.addChangeListener(cu.POSITIONING,this.handlePositioningChanged),void 0!==t.element&&this.setElement(t.element),this.setOffset(void 0!==t.offset?t.offset:[0,0]),this.setPositioning(t.positioning||"top-left"),void 0!==t.position&&this.setPosition(t.position)}getElement(){return this.get(cu.ELEMENT)}getId(){return this.id}getMap(){return this.get(cu.MAP)||null}getOffset(){return this.get(cu.OFFSET)}getPosition(){return this.get(cu.POSITION)}getPositioning(){return this.get(cu.POSITIONING)}handleElementChanged(){ss(this.element);const t=this.getElement();t&&this.element.appendChild(t)}handleMapChanged(){this.mapPostrenderListenerKey&&(ns(this.element),M(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const t=this.getMap();if(t){this.mapPostrenderListenerKey=T(t,Ul.POSTRENDER,this.render,this),this.updatePixelPosition();const e=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();this.insertFirst?e.insertBefore(this.element,e.childNodes[0]||null):e.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(t){this.set(cu.ELEMENT,t)}setMap(t){this.set(cu.MAP,t)}setOffset(t){this.set(cu.OFFSET,t)}setPosition(t){this.set(cu.POSITION,t)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(t){const e=this.getMap();if(!e||!e.getTargetElement()||!this.get(cu.POSITION))return;const i=this.getRect(e.getTargetElement(),e.getSize()),n=this.getElement(),s=this.getRect(n,[ts(n),es(n)]);t=t||{};const r=void 0===t.margin?20:t.margin;if(!Pt(i,s)){const n=s[0]-i[0],o=i[2]-s[2],a=s[1]-i[1],h=i[3]-s[3],l=[0,0];if(n<0?l[0]=n-r:o<0&&(l[0]=Math.abs(o)+r),a<0?l[1]=a-r:h<0&&(l[1]=Math.abs(h)+r),0!==l[0]||0!==l[1]){const i=e.getView().getCenterInternal(),n=e.getPixelFromCoordinateInternal(i);if(!n)return;const s=[n[0]+l[0],n[1]+l[1]],r=t.animation||{};e.getView().animateInternal({center:e.getCoordinateFromPixelInternal(s),duration:r.duration,easing:r.easing})}}}getRect(t,e){const i=t.getBoundingClientRect(),n=i.left+window.pageXOffset,s=i.top+window.pageYOffset;return[n,s,n+e[0],s+e[1]]}setPositioning(t){this.set(cu.POSITIONING,t)}setVisible(t){this.rendered.visible!==t&&(this.element.style.display=t?"":"none",this.rendered.visible=t)}updatePixelPosition(){const t=this.getMap(),e=this.getPosition();if(!t||!t.isRendered()||!e)return void this.setVisible(!1);const i=t.getPixelFromCoordinate(e),n=t.getSize();this.updateRenderedPosition(i,n)}updateRenderedPosition(t,e){const i=this.element.style,n=this.getOffset(),s=this.getPositioning();this.setVisible(!0);const r=Math.round(t[0]+n[0])+"px",o=Math.round(t[1]+n[1])+"px";let a="0%",h="0%";"bottom-right"==s||"center-right"==s||"top-right"==s?a="-100%":"bottom-center"!=s&&"center-center"!=s&&"top-center"!=s||(a="-50%"),"bottom-left"==s||"bottom-center"==s||"bottom-right"==s?h="-100%":"center-left"!=s&&"center-center"!=s&&"center-right"!=s||(h="-50%");const l=`translate(${a}, ${h}) translate(${r}, ${o})`;this.rendered.transform_!=l&&(this.rendered.transform_=l,i.transform=l)}getOptions(){return this.options}}var du=uu;function gu(t,e,i,n,s,r,o){let a,h;const l=(i-e)/n;if(1===l)a=e;else if(2===l)a=e,h=s;else if(0!==l){let r=t[e],o=t[e+1],l=0;const u=[0];for(let s=e+n;s1?o:2,r=r||new Array(o);for(let c=0;c>1;sthis.styles[t.get("type")]}),this.map=new lu({target:"map",layers:[new Ks({source:new Il({url:"http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetPurplishBlue/MapServer/tile/{z}/{y}/{x}"})})],view:new An({projection:"EPSG:4326",center:[113.948306,22.562039],zoom:16})}),this.map.addLayer(this.vectorLayer)},clickMap(){this.map.on("click",(t=>{this.canAddPoints&&this.addPoints(t.coordinate)}))},addPoints(t){this.coordinate.push(t),console.log(JSON.stringify(this.coordinate)),0==Object.keys(this.pointLayer).length&&(this.pointLayer=new Ih({source:new Vh}),this.map.addLayer(this.pointLayer));const e=new bl({geometry:new an(t)});e.setStyle(new zr({image:new Hr({src:"https://smart-garden-manage.oss-cn-chengdu.aliyuncs.com/shexiangtou.png",scale:.3})})),this.pointLayer.getSource().addFeature(e)},addText(t){const e=document.getElementById("overlay-box"),i=document.createElement("span");i.contentEditable=!0,i.id=t[0];let n=document.createTextNode("摄像头"+t[0].toFixed(2));i.appendChild(n),e.appendChild(i);let s=new du({position:t,element:document.getElementById(t[0]),offset:[-25,30]});this.map.addOverlay(s)},moveFeature(t){let e=t.frameState.time;this.distance=(this.distance+this.speed*(e-this.lastTime)/1e3)%1,this.lastTime=e;const i=this.route.getCoordinateAt(this.distance>1?2-this.distance:this.distance);this.geometryMove.setCoordinates(i);const n=mu(t);n.setStyle(this.styles.featureMove),n.drawGeometry(this.geometryMove),this.map.render()},startAnimation(){this.lastTime=Date.now(),this.vectorLayer.on("postrender",this.moveFeature),this.featureMove.setGeometry(null)},stopAnimation(){this.featureMove.setGeometry(this.geometryMove),this.vectorLayer.un("postrender",this.moveFeature)}}},vu=yu,xu=i(3736),Eu=(0,xu.Z)(vu,n,s,!1,null,null,null),Cu=Eu.exports},5325:function(t,e,i){i(7658),function(e,i){t.exports=i()}(0,(function(){"use strict";function t(t,n,s,r,o){!function t(i,n,s,r,o){for(;r>s;){if(r-s>600){var a=r-s+1,h=n-s+1,l=Math.log(a),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(a-c)/a)*(h-a/2<0?-1:1),d=Math.max(s,Math.floor(n-h*c/a+u)),g=Math.min(r,Math.floor(n+(a-h)*c/a+u));t(i,n,d,g,o)}var _=i[n],f=s,p=r;for(e(i,s,n),o(i[r],_)>0&&e(i,s,r);f0;)p--}0===o(i[s],_)?e(i,s,p):e(i,++p,r),p<=n&&(s=p+1),n<=p&&(r=p-1)}}(t,n,s||0,r||t.length-1,o||i)}function e(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function i(t,e){return te?1:0}var n=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function s(t,e,i){if(!i)return e.indexOf(t);for(var n=0;n=t.minX&&e.maxY>=t.minY}function _(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function f(e,i,n,s,r){for(var o=[i,n];o.length;)if(!((n=o.pop())-(i=o.pop())<=s)){var a=i+Math.ceil((n-i)/s/2)*s;t(e,a,i,n,r),o.push(i,a,a,n)}}return n.prototype.all=function(){return this._all(this.data,[])},n.prototype.search=function(t){var e=this.data,i=[];if(!g(t,e))return i;for(var n=this.toBBox,s=[];e;){for(var r=0;r=0&&s[e].children.length>this._maxEntries;)this._split(s,e),e--;this._adjustParentBBoxes(n,s,e)},n.prototype._split=function(t,e){var i=t[e],n=i.children.length,s=this._minEntries;this._chooseSplitAxis(i,s,n);var o=this._chooseSplitIndex(i,s,n),a=_(i.children.splice(o,i.children.length-o));a.height=i.height,a.leaf=i.leaf,r(i,this.toBBox),r(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)},n.prototype._splitRoot=function(t,e){this.data=_([t,e]),this.data.height=t.height+1,this.data.leaf=!1,r(this.data,this.toBBox)},n.prototype._chooseSplitIndex=function(t,e,i){for(var n,s,r,a,h,l,u,d=1/0,g=1/0,_=e;_<=i-e;_++){var f=o(t,0,_,this.toBBox),p=o(t,_,i,this.toBBox),m=(s=f,r=p,a=void 0,h=void 0,l=void 0,u=void 0,a=Math.max(s.minX,r.minX),h=Math.max(s.minY,r.minY),l=Math.min(s.maxX,r.maxX),u=Math.min(s.maxY,r.maxY),Math.max(0,l-a)*Math.max(0,u-h)),y=c(f)+c(p);m=e;g--){var _=t.children[g];a(h,t.leaf?s(_):_),l+=u(h)}return l},n.prototype._adjustParentBBoxes=function(t,e,i){for(var n=i;n>=0;n--)a(e[n],t)},n.prototype._condense=function(t){for(var e=t.length-1,i=void 0;e>=0;e--)0===t[e].children.length?e>0?(i=t[e-1].children).splice(i.indexOf(t[e]),1):this.clear():r(t[e],this.toBBox)},n}))}}]); //# sourceMappingURL=10.bf685dc9.js.map