(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const r of s)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function e(s){const r={};return s.integrity&&(r.integrity=s.integrity),s.referrerpolicy&&(r.referrerPolicy=s.referrerpolicy),s.crossorigin==="use-credentials"?r.credentials="include":s.crossorigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(s){if(s.ep)return;s.ep=!0;const r=e(s);fetch(s.href,r)}})();class Uo{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}const Gt=Uo,Se={PROPERTYCHANGE:"propertychange"};class $o{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}const Yn=$o;function Di(n,t){return n>t?1:n0){for(s=1;s0?s-1:s:n[s-1]-t0:!1}removeEventListener(t,e){const i=this.listeners_&&this.listeners_[t];if(i){const s=i.indexOf(e);s!==-1&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[s]=ae,++this.pendingRemovals_[t]):(i.splice(s,1),i.length===0&&delete this.listeners_[t]))}}}const Qi=qo,O={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 G(n,t,e,i,s){if(i&&i!==n&&(e=e.bind(i)),s){const o=e;e=function(){n.removeEventListener(t,e),o.apply(this,arguments)}}const r={target:n,type:t,listener:e};return n.addEventListener(t,e),r}function Fi(n,t,e,i){return G(n,t,e,i,!0)}function V(n){n&&n.target&&(n.target.removeEventListener(n.type,n.listener),oi(n))}class tn extends Qi{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(O.CHANGE)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,s=new Array(i);for(let r=0;r1?(e=s,i=r):l>0&&(e+=o*l,i+=a*l)}return Ie(n,t,e,i)}function Ie(n,t,e,i){const s=e-n,r=i-t;return s*s+r*r}function sa(n){const t=n.length;for(let i=0;ir&&(r=l,s=a)}if(r===0)return null;const o=n[s];n[s]=n[i],n[i]=o;for(let a=i+1;a=0;i--){e[i]=n[i][t]/n[i][i];for(let s=i-1;s>=0;s--)n[s][t]-=n[s][i]*e[i]}return e}function Pi(n){return n*Math.PI/180}function Be(n,t){const e=n%t;return e*t<0?e+t:e}function Qt(n,t,e){return n+e*(t-n)}class ra extends Ct{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);typeof t.properties=="object"&&(delete e.properties,Object.assign(e,t.properties)),e[X.OPACITY]=t.opacity!==void 0?t.opacity:1,Y(typeof e[X.OPACITY]=="number",64),e[X.VISIBLE]=t.visible!==void 0?t.visible:!0,e[X.Z_INDEX]=t.zIndex,e[X.MAX_RESOLUTION]=t.maxResolution!==void 0?t.maxResolution:1/0,e[X.MIN_RESOLUTION]=t.minResolution!==void 0?t.minResolution:0,e[X.MIN_ZOOM]=t.minZoom!==void 0?t.minZoom:-1/0,e[X.MAX_ZOOM]=t.maxZoom!==void 0?t.maxZoom:1/0,this.className_=e.className!==void 0?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:t===void 0?!0:t},i=this.getZIndex();return e.opacity=tt(Math.round(this.getOpacity()*100)/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=i===void 0&&!e.managed?1/0:i,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 N()}getLayerStatesArray(t){return N()}getExtent(){return this.get(X.EXTENT)}getMaxResolution(){return this.get(X.MAX_RESOLUTION)}getMinResolution(){return this.get(X.MIN_RESOLUTION)}getMinZoom(){return this.get(X.MIN_ZOOM)}getMaxZoom(){return this.get(X.MAX_ZOOM)}getOpacity(){return this.get(X.OPACITY)}getSourceState(){return N()}getVisible(){return this.get(X.VISIBLE)}getZIndex(){return this.get(X.Z_INDEX)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(X.EXTENT,t)}setMaxResolution(t){this.set(X.MAX_RESOLUTION,t)}setMinResolution(t){this.set(X.MIN_RESOLUTION,t)}setMaxZoom(t){this.set(X.MAX_ZOOM,t)}setMinZoom(t){this.set(X.MIN_ZOOM,t)}setOpacity(t){Y(typeof t=="number",64),this.set(X.OPACITY,t)}setVisible(t){this.set(X.VISIBLE,t)}setZIndex(t){this.set(X.Z_INDEX,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}const Gr=ra,Ut={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};class oa extends Gr{constructor(t){const e=Object.assign({},t);delete e.source,super(e),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.rendered=!1,t.render&&(this.render=t.render),t.map&&this.setMap(t.map),this.addChangeListener(X.SOURCE,this.handleSourcePropertyChange_);const i=t.source?t.source:null;this.setSource(i)}getLayersArray(t){return t=t||[],t.push(this),t}getLayerStatesArray(t){return t=t||[],t.push(this.getLayerState()),t}getSource(){return this.get(X.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed()}handleSourcePropertyChange_(){this.sourceChangeKey_&&(V(this.sourceChangeKey_),this.sourceChangeKey_=null);const t=this.getSource();t&&(this.sourceChangeKey_=G(t,O.CHANGE,this.handleSourceChange_,this)),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):new Promise(e=>e([]))}getData(t){return!this.renderer_||!this.rendered?null:this.renderer_.getData(t)}render(t,e){const i=this.getRenderer();if(i.prepareFrame(t))return this.rendered=!0,i.renderFrame(t,e)}unrender(){this.rendered=!1}setMapInternal(t){t||this.unrender(),this.set(X.MAP,t)}getMapInternal(){return this.get(X.MAP)}setMap(t){this.mapPrecomposeKey_&&(V(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(V(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=G(t,Ut.PRECOMPOSE,function(e){const s=e.frameState.layerStatesArray,r=this.getLayerState(!1);Y(!s.some(function(o){return o.layer===r.layer}),67),s.push(r)},this),this.mapRenderKey_=G(this,O.CHANGE,t.render,t),this.changed())}setSource(t){this.set(X.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 Kn(n,t){if(!n.visible)return!1;const e=t.resolution;if(e=n.maxResolution)return!1;const i=t.zoom;return i>n.minZoom&&i<=n.maxZoom}const en=oa;class aa extends en{constructor(t){t=t||{},super(t)}}const la=aa,P={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};class ha extends kr{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.declutterExecutorGroup=null}getFeatures(t){return N()}getData(t){return null}prepareFrame(t){return N()}renderFrame(t,e){return N()}loadedTileCallback(t,e,i){t[e]||(t[e]={}),t[e][i.tileCoord.toString()]=i}createLoadedTileFinder(t,e,i){return function(s,r){const o=this.loadedTileCallback.bind(this,i,s);return t.forEachLoadedTile(e,s,r,o)}.bind(this)}forEachFeatureAtCoordinate(t,e,i,s,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){t.target.getState()===P.LOADED&&this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=P.LOADED&&e!=P.ERROR&&t.addEventListener(O.CHANGE,this.boundHandleImageChange_),e==P.IDLE&&(t.load(),e=t.getState()),e==P.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&t.getSourceState()==="ready"&&t.changed()}disposeInternal(){delete this.layer_,super.disposeInternal()}}const ca=ha;class ua extends Gt{constructor(t,e,i,s){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=s}}const Wr=ua,$t=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",da=$t.includes("firefox"),fa=$t.includes("safari")&&!$t.includes("chrom");fa&&($t.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test($t));const ga=$t.includes("webkit")&&!$t.includes("edge"),_a=$t.includes("macintosh"),Xr=typeof devicePixelRatio<"u"?devicePixelRatio:1,Un=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,ma=typeof Image<"u"&&Image.prototype.decode,Br=function(){let n=!1;try{const t=Object.defineProperty({},"passive",{get:function(){n=!0}});window.addEventListener("_",null,t),window.removeEventListener("_",null,t)}catch{}return n}();new Array(6);function Tt(){return[1,0,0,1,0,0]}function pa(n,t,e,i,s,r,o){return n[0]=t,n[1]=e,n[2]=i,n[3]=s,n[4]=r,n[5]=o,n}function ya(n,t){return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n}function Q(n,t){const e=t[0],i=t[1];return t[0]=n[0]*e+n[2]*i+n[4],t[1]=n[1]*e+n[3]*i+n[5],t}function xa(n,t,e){return pa(n,t,0,0,e,0,0)}function Ht(n,t,e,i,s,r,o,a){const l=Math.sin(r),h=Math.cos(r);return n[0]=i*h,n[1]=s*l,n[2]=-i*l,n[3]=s*h,n[4]=o*i*h-a*i*l+t,n[5]=o*s*l+a*s*h+e,n}function $n(n,t){const e=Ea(t);Y(e!==0,32);const i=t[0],s=t[1],r=t[2],o=t[3],a=t[4],l=t[5];return n[0]=o/e,n[1]=-s/e,n[2]=-r/e,n[3]=i/e,n[4]=(r*l-o*a)/e,n[5]=-(i*l-s*a)/e,n}function Ea(n){return n[0]*n[3]-n[1]*n[2]}let Gs;function zr(n){const t="matrix("+n.join(", ")+")";if(Un)return t;const e=Gs||(Gs=document.createElement("div"));return e.style.transform=t,e.style.transform}const Ca=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,Ia=/^([a-z]*)$|^hsla?\(.*\)$/i;function Zr(n){return typeof n=="string"?n:Yr(n)}function Ra(n){const t=document.createElement("div");if(t.style.color=n,t.style.color!==""){document.body.appendChild(t);const e=getComputedStyle(t).color;return document.body.removeChild(t),e}else return""}const va=function(){const t={};let e=0;return function(i){let s;if(t.hasOwnProperty(i))s=t[i];else{if(e>=1024){let r=0;for(const o in t)r++&3||(delete t[o],--e)}s=Sa(i),t[i]=s,++e}return s}}();function ki(n){return Array.isArray(n)?n:va(n)}function Sa(n){let t,e,i,s,r;if(Ia.exec(n)&&(n=Ra(n)),Ca.exec(n)){const o=n.length-1;let a;o<=4?a=1:a=2;const l=o===4||o===8;t=parseInt(n.substr(1+0*a,a),16),e=parseInt(n.substr(1+1*a,a),16),i=parseInt(n.substr(1+2*a,a),16),l?s=parseInt(n.substr(1+3*a,a),16):s=255,a==1&&(t=(t<<4)+t,e=(e<<4)+e,i=(i<<4)+i,l&&(s=(s<<4)+s)),r=[t,e,i,s/255]}else n.startsWith("rgba(")?(r=n.slice(5,-1).split(",").map(Number),Ws(r)):n.startsWith("rgb(")?(r=n.slice(4,-1).split(",").map(Number),r.push(1),Ws(r)):Y(!1,14);return r}function Ws(n){return n[0]=tt(n[0]+.5|0,0,255),n[1]=tt(n[1]+.5|0,0,255),n[2]=tt(n[2]+.5|0,0,255),n[3]=tt(n[3],0,1),n}function Yr(n){let t=n[0];t!=(t|0)&&(t=t+.5|0);let e=n[1];e!=(e|0)&&(e=e+.5|0);let i=n[2];i!=(i|0)&&(i=i+.5|0);const s=n[3]===void 0?1:Math.round(n[3]*100)/100;return"rgba("+t+","+e+","+i+","+s+")"}function _t(n,t,e,i){let s;return e&&e.length?s=e.shift():Un?s=new OffscreenCanvas(n||300,t||300):s=document.createElement("canvas"),n&&(s.width=n),t&&(s.height=t),s.getContext("2d",i)}function wa(n){const t=n.canvas;t.width=1,t.height=1,n.clearRect(0,0,1,1)}function Ta(n){let t=n.offsetWidth;const e=getComputedStyle(n);return t+=parseInt(e.marginLeft,10)+parseInt(e.marginRight,10),t}function La(n){let t=n.offsetHeight;const e=getComputedStyle(n);return t+=parseInt(e.marginTop,10)+parseInt(e.marginBottom,10),t}function Xs(n,t){const e=t.parentNode;e&&e.replaceChild(n,t)}function Ni(n){return n&&n.parentNode?n.parentNode.removeChild(n):null}function Vr(n){for(;n.lastChild;)n.removeChild(n.lastChild)}function Ma(n,t){const e=n.childNodes;for(let i=0;;++i){const s=e[i],r=t[i];if(!s&&!r)break;if(s!==r){if(!s){n.appendChild(r);continue}if(!r){n.removeChild(s),--i;continue}n.insertBefore(r,s)}}}const j={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function Bs(n){const t=Lt();for(let e=0,i=n.length;es&&(l=l|j.RIGHT),ar&&(l=l|j.ABOVE),l===j.UNKNOWN&&(l=j.INTERSECTING),l}function Lt(){return[1/0,1/0,-1/0,-1/0]}function we(n,t,e,i,s){return s?(s[0]=n,s[1]=t,s[2]=e,s[3]=i,s):[n,t,e,i]}function nn(n){return we(1/0,1/0,-1/0,-1/0,n)}function ba(n,t){const e=n[0],i=n[1];return we(e,i,e,i,t)}function Aa(n,t,e,i,s){const r=nn(s);return Hr(r,n,t,e,i)}function He(n,t){return n[0]==t[0]&&n[2]==t[2]&&n[1]==t[1]&&n[3]==t[3]}function Oa(n,t){return t[0]n[2]&&(n[2]=t[2]),t[1]n[3]&&(n[3]=t[3]),n}function ze(n,t){t[0]n[2]&&(n[2]=t[0]),t[1]n[3]&&(n[3]=t[1])}function Hr(n,t,e,i,s){for(;et[0]?i[0]=n[0]:i[0]=t[0],n[1]>t[1]?i[1]=n[1]:i[1]=t[1],n[2]=t[0]&&n[1]<=t[3]&&n[3]>=t[1]}function rn(n){return n[2]=o&&m<=l),!i&&r&j.RIGHT&&!(s&j.RIGHT)&&(_=f-(d-l)*g,i=_>=a&&_<=h),!i&&r&j.BELOW&&!(s&j.BELOW)&&(m=d-(f-a)/g,i=m>=o&&m<=l),!i&&r&j.LEFT&&!(s&j.LEFT)&&(_=f-(d-o)*g,i=_>=a&&_<=h)}return i}function jr(n,t){const e=t.getExtent(),i=jt(n);if(t.canWrapX()&&(i[0]=e[2])){const s=z(e),o=Math.floor((i[0]-e[0])/s)*s;n[0]-=o,n[2]-=o}return n}function Wa(n,t){if(t.canWrapX()){const e=t.getExtent();if(!isFinite(n[0])||!isFinite(n[2]))return[[e[0],n[1],e[2],n[3]]];jr(n,t);const i=z(e);if(z(n)>i)return[[e[0],n[1],e[2],n[3]]];if(n[0]e[2])return[[n[0],n[1],e[2],n[3]],[e[0],n[1],n[2]-i,n[3]]]}return[n]}const zs=[];let ge=null;function Xa(){const n=document.createElement("canvas");n.width=1,n.height=1,ge=n.getContext("2d")}class Ba extends ca{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=Tt(),this.pixelTransform=Tt(),this.inversePixelTransform=Tt(),this.context=null,this.containerReused=!1,this.pixelContext_=null,this.frameState=null}getImageData(t,e,i){ge||Xa(),ge.clearRect(0,0,1,1);let s;try{ge.drawImage(t,e,i,1,1,0,0,1,1),s=ge.getImageData(0,0,1,1).data}catch{return ge=null,null}return s}getBackground(t){let i=this.getLayer().getBackground();return typeof i=="function"&&(i=i(t.viewState.resolution)),i||void 0}useContainer(t,e,i){const s=this.getLayer().getClassName();let r,o;if(t&&t.className===s&&(!i||t&&t.style.backgroundColor&&he(ki(t.style.backgroundColor),ki(i)))){const a=t.firstElementChild;a instanceof HTMLCanvasElement&&(o=a.getContext("2d"))}if(o&&o.canvas.style.transform===e?(this.container=t,this.context=o,this.containerReused=!0):this.containerReused&&(this.container=null,this.context=null,this.containerReused=!1),!this.container){r=document.createElement("div"),r.className=s;let a=r.style;a.position="absolute",a.width="100%",a.height="100%",o=_t();const l=o.canvas;r.appendChild(l),a=l.style,a.position="absolute",a.left="0",a.transformOrigin="top left",this.container=r,this.context=o}!this.containerReused&&i&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const s=sn(i),r=ts(i),o=Jn(i),a=qn(i);Q(e.coordinateToPixelTransform,s),Q(e.coordinateToPixelTransform,r),Q(e.coordinateToPixelTransform,o),Q(e.coordinateToPixelTransform,a);const l=this.inversePixelTransform;Q(l,s),Q(l,r),Q(l,o),Q(l,a),t.save(),t.beginPath(),t.moveTo(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.lineTo(Math.round(a[0]),Math.round(a[1])),t.clip()}dispatchRenderEvent_(t,e,i){const s=this.getLayer();if(s.hasListener(t)){const r=new Wr(t,this.inversePixelTransform,i,e);s.dispatchEvent(r)}}preRender(t,e){this.frameState=e,this.dispatchRenderEvent_(Ut.PRERENDER,t,e)}postRender(t,e){this.dispatchRenderEvent_(Ut.POSTRENDER,t,e)}getRenderTransform(t,e,i,s,r,o,a){const l=r/2,h=o/2,c=s/e,u=-c,d=-t[0]+a,f=-t[1];return Ht(this.tempTransform,l,h,c,u,-i,d,f)}disposeInternal(){delete this.frameState,super.disposeInternal()}}const qr=Ba,q={ANIMATING:0,INTERACTING:1},Gi={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class za{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=t.extent!==void 0?t.extent:null,this.worldExtent_=t.worldExtent!==void 0?t.worldExtent:null,this.axisOrientation_=t.axisOrientation!==void 0?t.axisOrientation:"enu",this.global_=t.global!==void 0?t.global:!1,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_||Gi[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_}}const es=za,ai=6378137,ye=Math.PI*ai,Za=[-ye,-ye,ye,ye],Ya=[-180,-85,180,85],Ci=ai*Math.log(Math.tan(Math.PI/2));class ue extends es{constructor(t){super({code:t,units:"m",extent:Za,global:!0,worldExtent:Ya,getPointResolution:function(e,i){return e/Math.cosh(i[1]/ai)}})}}const Zs=[new ue("EPSG:3857"),new ue("EPSG:102100"),new ue("EPSG:102113"),new ue("EPSG:900913"),new ue("http://www.opengis.net/def/crs/EPSG/0/3857"),new ue("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Va(n,t,e){const i=n.length;e=e>1?e:2,t===void 0&&(e>2?t=n.slice():t=new Array(i));for(let s=0;sCi?r=Ci:r<-Ci&&(r=-Ci),t[s+1]=r}return t}function Ka(n,t,e){const i=n.length;e=e>1?e:2,t===void 0&&(e>2?t=n.slice():t=new Array(i));for(let s=0;s=0;--i)if(n[i]!=t[i]){e=!1;break}return e}function is(n,t){const e=Math.cos(t),i=Math.sin(t),s=n[0]*e-n[1]*i,r=n[1]*e+n[0]*i;return n[0]=s,n[1]=r,n}function Qa(n,t){return n[0]*=t,n[1]*=t,n}function Jr(n,t){if(t.canWrapX()){const e=z(t.getExtent()),i=tl(n,t,e);i&&(n[0]-=i*e)}return n}function tl(n,t,e){const i=t.getExtent();let s=0;return t.canWrapX()&&(n[0]i[2])&&(e=e||z(i),s=Math.floor((n[0]-i[0])/e)),s}const el=63710088e-1;function Ks(n,t,e){e=e||el;const i=Pi(n[1]),s=Pi(t[1]),r=(s-i)/2,o=Pi(t[0]-n[0])/2,a=Math.sin(r)*Math.sin(r)+Math.sin(o)*Math.sin(o)*Math.cos(i)*Math.cos(s);return 2*e*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}let Fn=!0;function il(n){Fn=!(n===void 0?!0:n)}function ns(n,t,e){if(t!==void 0){for(let i=0,s=n.length;i=-180&&n[0]<=180&&n[1]>=-90&&n[1]<=90&&(Fn=!1,console.warn("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),n}function to(n,t){return n}function ie(n,t){return n}function al(){$s(Zs),$s(Vs),rl(Vs,Zs,Va,Ka)}al();class ll extends qr{constructor(t){super(t),this.image_=null}getImage(){return this.image_?this.image_.getImage():null}prepareFrame(t){const e=t.layerStatesArray[t.layerIndex],i=t.pixelRatio,s=t.viewState,r=s.resolution,o=this.getLayer().getSource(),a=t.viewHints;let l=t.extent;if(e.extent!==void 0&&(l=Qn(l,ie(e.extent,s.projection))),!a[q.ANIMATING]&&!a[q.INTERACTING]&&!rn(l))if(o){const h=s.projection,c=o.getImage(l,r,i,h);c&&(this.loadImage(c)?this.image_=c:c.getState()===P.EMPTY&&(this.image_=null))}else this.image_=null;return!!this.image_}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),s=Q(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!jn(r,s))return null;const o=this.image_.getExtent(),a=this.image_.getImage(),l=z(o),h=Math.floor(a.width*((s[0]-o[0])/l));if(h<0||h>=a.width)return null;const c=ut(o),u=Math.floor(a.height*((o[3]-s[1])/c));return u<0||u>=a.height?null:this.getImageData(a,h,u)}renderFrame(t,e){const i=this.image_,s=i.getExtent(),r=i.getResolution(),o=i.getPixelRatio(),a=t.layerStatesArray[t.layerIndex],l=t.pixelRatio,h=t.viewState,c=h.center,u=h.resolution,d=l*r/(u*o),f=t.extent,g=h.resolution,m=h.rotation,_=Math.round(z(f)/g*l),p=Math.round(ut(f)/g*l);Ht(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/l,1/l,m,-_/2,-p/2),$n(this.inversePixelTransform,this.pixelTransform);const y=zr(this.pixelTransform);this.useContainer(e,y,this.getBackground(t));const x=this.context,E=x.canvas;E.width!=_||E.height!=p?(E.width=_,E.height=p):this.containerReused||x.clearRect(0,0,_,p);let C=!1,v=!0;if(a.extent){const F=ie(a.extent,h.projection);v=ot(F,t.extent),C=v&&!Vt(F,t.extent),C&&this.clipUnrotated(x,t,F)}const R=i.getImage(),S=Ht(this.tempTransform,_/2,p/2,d,d,0,o*(s[0]-c[0])/r,o*(c[1]-s[3])/r);this.renderedResolution=r*l/o;const L=R.width*S[0],A=R.height*S[3];if(this.getLayer().getSource().getInterpolate()||(x.imageSmoothingEnabled=!1),this.preRender(x,t),v&&L>=.5&&A>=.5){const F=S[4],k=S[5],D=a.opacity;let $;D!==1&&($=x.globalAlpha,x.globalAlpha=D),x.drawImage(R,0,0,+R.width,+R.height,F,k,L,A),D!==1&&(x.globalAlpha=$)}return this.postRender(x,t),C&&x.restore(),x.imageSmoothingEnabled=!0,y!==E.style.transform&&(E.style.transform=y),this.container}}const hl=ll;class cl extends la{constructor(t){super(t)}createRenderer(){return new hl(this)}getData(t){return super.getData(t)}}const eo=cl,ct={ADD:"add",REMOVE:"remove"},js={LENGTH:"length"};class Ii extends Gt{constructor(t,e,i){super(t),this.element=e,this.index=i}}class ul extends Ct{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t||[],this.unique_)for(let i=0,s=this.array_.length;i0;)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 Ii(ct.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,s=e.length;i=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new Ii(ct.REMOVE,e,t)),e}setAt(t,e){const i=this.getLength();if(t>=i){this.insertAt(t,e);return}if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const s=this.array_[t];this.array_[t]=e,this.dispatchEvent(new Ii(ct.REMOVE,s,t)),this.dispatchEvent(new Ii(ct.ADD,e,t))}updateLength_(){this.set(js.LENGTH,this.array_.length)}assertUnique_(t,e){for(let i=0,s=this.array_.length;ithis.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const i=this.cache_[e];!(t++&3)&&!i.hasListener()&&(delete this.cache_[e],--this.cacheSize_)}}}get(t,e,i){const s=qs(t,e,i);return s in this.cache_?this.cache_[s]:null}set(t,e,i,s){const r=qs(t,e,i);this.cache_[r]=s,++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function qs(n,t,e){const i=e?Zr(e):"null";return t+":"+n+":"+i}const zi=new dl;class fl extends Yn{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){N()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,s=t.pixelToCoordinateTransform;Ht(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),$n(s,i)}forEachFeatureAtCoordinate(t,e,i,s,r,o,a,l){let h;const c=e.viewState;function u(E,C,v,R){return r.call(o,C,E?v:null,R)}const d=c.projection,f=Jr(t.slice(),d),g=[[0,0]];if(d.canWrapX()&&s){const E=d.getExtent(),C=z(E);g.push([-C,0],[C,0])}const m=e.layerStatesArray,_=m.length,p=[],y=[];for(let E=0;E=0;--C){const v=m[C],R=v.layer;if(R.hasRenderer()&&Kn(v,c)&&a.call(l,R)){const S=R.getRenderer(),L=R.getSource();if(S&&L){const A=L.getWrapX()?f:t,F=u.bind(null,v.managed);y[0]=A[0]+g[E][0],y[1]=A[1]+g[E][1],h=S.forEachFeatureAtCoordinate(y,e,i,F,p)}if(h)return h}}if(p.length===0)return;const x=1/p.length;return p.forEach((E,C)=>E.distanceSq+=C*x),p.sort((E,C)=>E.distanceSq-C.distanceSq),p.some(E=>h=E.callback(E.feature,E.layer,E.geometry)),h}hasFeatureAtCoordinate(t,e,i,s,r,o){return this.forEachFeatureAtCoordinate(t,e,i,s,Ue,this,r,o)!==void 0}getMap(){return this.map_}renderFrame(t){N()}scheduleExpireIconCache(t){zi.canExpireCache()&&t.postRenderFunctions.push(gl)}}function gl(n,t){zi.expire()}const _l=fl,Ri="ol-hidden",ml="ol-selectable",on="ol-unselectable",os="ol-control",Js="ol-collapsed",pl=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z]+?)\\s*$`].join(""),"i"),Qs=["style","variant","weight","size","lineHeight","family"],io=function(n){const t=n.match(pl);if(!t)return null;const e={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"};for(let i=0,s=Qs.length;iMath.max(s,Vi(n,r)),0);return e[t]=i,i}function El(n,t){const e=[],i=[],s=[];let r=0,o=0,a=0,l=0;for(let h=0,c=t.length;h<=c;h+=2){const u=t[h];if(u===` `||h===c){r=Math.max(r,o),s.push(o),o=0,a+=l;continue}const d=t[h+1]||n.font,f=Vi(d,u);e.push(f),o+=f;const g=xl(d);i.push(g),l=Math.max(l,g)}return{width:r,height:a,widths:e,heights:i,lineWidths:s}}function Cl(n,t,e,i,s,r,o,a,l,h,c){n.save(),e!==1&&(n.globalAlpha*=e),t&&n.setTransform.apply(n,t),i.contextInstructions?(n.translate(l,h),n.scale(c[0],c[1]),Il(i,n)):c[0]<0||c[1]<0?(n.translate(l,h),n.scale(c[0],c[1]),n.drawImage(i,s,r,o,a,0,0,o,a)):n.drawImage(i,s,r,o,a,l,h,o*c[0],a*c[1]),n.restore()}function Il(n,t){const e=n.contextInstructions;for(let i=0,s=e.length;i=0;--o)s[o].renderDeclutter(t);Ma(this.element_,this.children_),this.dispatchRenderEvent(Ut.POSTCOMPOSE,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}}const vl=Rl;class Zt extends Gt{constructor(t,e){super(t),this.layer=e}}const pn={LAYERS:"layers"};class as extends Gr{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(pn.LAYERS,this.handleLayersChanged_),i?Array.isArray(i)?i=new St(i.slice(),{unique:!0}):Y(typeof i.getArray=="function",43):i=new St(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(V),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(G(t,ct.ADD,this.handleLayersAdd_,this),G(t,ct.REMOVE,this.handleLayersRemove_,this));for(const i in this.listenerKeys_)this.listenerKeys_[i].forEach(V);oi(this.listenerKeys_);const e=t.getArray();for(let i=0,s=e.length;ithis.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(V(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(O.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(V(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(V),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const Ll=Tl,Ft={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},rt={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},Ki=1/0;class Ml{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,oi(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,i=t[0];t.length==1?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const s=this.keyFunction_(i);return delete this.queuedElements_[s],i}enqueue(t){Y(!(this.keyFunction_(t)in this.queuedElements_),31);const e=this.priorityFunction_(t);return e!=Ki?(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(t){return t*2+1}getRightChildIndex_(t){return t*2+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 this.elements_.length===0}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,s=e.length,r=e[t],o=i[t],a=t;for(;t>1;){const l=this.getLeftChildIndex_(t),h=this.getRightChildIndex_(t),c=ht;){const a=this.getParentIndex_(e);if(s[a]>o)i[e]=i[a],s[e]=s[a],e=a;else break}i[e]=r,s[e]=o}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let s=0;const r=e.length;let o,a,l;for(a=0;a0;)r=this.dequeue()[0],o=r.getKey(),s=r.getState(),s===Fe.IDLE&&!(o in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[o]=!0,++this.tilesLoading_,++i,r.load())}}const Ol=Al;function Pl(n,t,e,i,s){if(!n||!(e in n.wantedTiles)||!n.wantedTiles[e][t.getKey()])return Ki;const r=n.viewState.center,o=i[0]-r[0],a=i[1]-r[1];return 65536*Math.log(s)+Math.sqrt(o*o+a*a)/s}const xt={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"},Dl=256;function er(n,t,e){return function(i,s,r,o,a){if(!i)return;if(!s&&!t)return i;const l=t?0:r[0]*s,h=t?0:r[1]*s,c=a?a[0]:0,u=a?a[1]:0;let d=n[0]+l/2+c,f=n[2]-l/2+c,g=n[1]+h/2+u,m=n[3]-h/2+u;d>f&&(d=(f+d)/2,f=d),g>m&&(g=(m+g)/2,m=g);let _=tt(i[0],d,f),p=tt(i[1],g,m);if(o&&e&&s){const y=30*s;_+=-y*Math.log(1+Math.max(0,d-i[0])/y)+y*Math.log(1+Math.max(0,i[0]-f)/y),p+=-y*Math.log(1+Math.max(0,g-i[1])/y)+y*Math.log(1+Math.max(0,i[1]-m)/y)}return[_,p]}}function Fl(n){return n}function ls(n,t,e,i){const s=z(t)/e[0],r=ut(t)/e[1];return i?Math.min(n,Math.max(s,r)):Math.min(n,Math.min(s,r))}function hs(n,t,e){let i=Math.min(n,t);const s=50;return i*=Math.log(1+s*Math.max(0,n/t-1))/s+1,e&&(i=Math.max(i,e),i/=Math.log(1+s*Math.max(0,e/n-1))/s+1),tt(i,e/2,t*2)}function kl(n,t,e,i){return t=t!==void 0?t:!0,function(s,r,o,a){if(s!==void 0){const l=n[0],h=n[n.length-1],c=e?ls(l,e,o,i):l;if(a)return t?hs(s,c,h):tt(s,h,c);const u=Math.min(c,s),d=Math.floor(Vn(n,u,r));return n[d]>c&&d1)u=e;else if(d>0){for(let f=0;fs&&(s=h),r=a,o=l}return s}function jl(n,t,e,i,s){for(let r=0,o=e.length;r0;){const u=h.pop(),d=h.pop();let f=0;const g=n[d],m=n[d+1],_=n[u],p=n[u+1];for(let y=d+i;yf&&(c=y,f=C)}f>s&&(l[(c-t)/i]=1,d+i0&&m>f)&&(g<0&&_0&&_>g)){h=u,c=d;continue}r[o++]=h,r[o++]=c,a=h,l=c,h=u,c=d}return r[o++]=h,r[o++]=c,o}function ih(n,t,e,i,s,r,o,a){for(let l=0,h=e.length;lr&&(h-a)*(r-l)-(s-a)*(c-l)>0&&o++:c<=r&&(h-a)*(r-l)-(s-a)*(c-l)<0&&o--,a=h,l=c}return o!==0}function co(n,t,e,i,s,r){if(e.length===0||!se(n,t,e[0],i,s,r))return!1;for(let o=1,a=e.length;op&&(h=(c+u)/2,co(n,t,e,i,h,g)&&(_=h,p=y)),c=u}return isNaN(_)&&(_=s[r]),o?(o.push(_,g,p),o):[_,g,p]}function oh(n,t,e,i,s){let r;for(t+=i;t=s[0]&&r[2]<=s[2]||r[1]>=s[1]&&r[3]<=s[3]?!0:oh(n,t,e,i,function(o,a){return Ga(s,o,a)}):!1}function ah(n,t,e,i,s){return!!(uo(n,t,e,i,s)||se(n,t,e,i,s[0],s[1])||se(n,t,e,i,s[0],s[3])||se(n,t,e,i,s[2],s[1])||se(n,t,e,i,s[2],s[3]))}function lh(n,t,e,i,s){if(!ah(n,t,e[0],i,s))return!1;if(e.length===1)return!0;for(let r=1,o=e.length;r0}function ch(n,t,e,i,s){s=s!==void 0?s:!1;for(let r=0,o=e.length;r1&&typeof arguments[e-1]=="function"&&(i=arguments[e-1],--e);let s=0;for(;s0}getInteracting(){return this.hints_[q.INTERACTING]>0}cancelAnimations(){this.setHint(q.ANIMATING,-this.hints_[q.ANIMATING]);let t;for(let e=0,i=this.animations_.length;e=0;--i){const s=this.animations_[i];let r=!0;for(let o=0,a=s.length;o0?h/l.duration:1;c>=1?(l.complete=!0,c=1):r=!1;const u=l.easing(c);if(l.sourceCenter){const d=l.sourceCenter[0],f=l.sourceCenter[1],g=l.targetCenter[0],m=l.targetCenter[1];this.nextCenter_=l.targetCenter;const _=d+u*(g-d),p=f+u*(m-f);this.targetCenter_=[_,p]}if(l.sourceResolution&&l.targetResolution){const d=u===1?l.targetResolution:l.sourceResolution+u*(l.targetResolution-l.sourceResolution);if(l.anchor){const f=this.getViewportSize_(this.getRotation()),g=this.constraints_.resolution(d,0,f,!0);this.targetCenter_=this.calculateCenterZoom(g,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=d,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){const d=u===1?Be(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+u*(l.targetRotation-l.sourceRotation);if(l.anchor){const f=this.constraints_.rotation(d,!0);this.targetCenter_=this.calculateCenterRotate(f,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=d}if(this.applyTargetState_(!0),e=!0,!l.complete)break}if(r){this.animations_[i]=null,this.setHint(q.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const o=s[0].callback;o&&vi(o,!0)}}this.animations_=this.animations_.filter(Boolean),e&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const s=this.getCenterInternal();return s!==void 0&&(i=[s[0]-e[0],s[1]-e[1]],is(i,t-this.getRotation()),Ja(i,e)),i}calculateCenterZoom(t,e){let i;const s=this.getCenterInternal(),r=this.getResolution();if(s!==void 0&&r!==void 0){const o=e[0]-t*(e[0]-s[0])/r,a=e[1]-t*(e[1]-s[1])/r;i=[o,a]}return i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],s=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(s*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(s*Math.cos(t))]}else 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&&kn(t,this.getProjection())}getCenterInternal(){return this.get(xt.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return t!==void 0?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){const e=this.calculateExtentInternal(t);return to(e,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();Y(e,1);const i=this.getResolution();Y(i!==void 0,2);const s=this.getRotation();return Y(s!==void 0,3),Pn(e,i,s,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(xt.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(ie(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=z(t)/e[0],s=ut(t)/e[1];return Math.max(i,s)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,s=Math.log(e/i)/Math.log(t);return function(r){return e/Math.pow(t,r*s)}}getRotation(){return this.get(xt.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),s=this.minResolution_,r=Math.log(i/s)/e;return function(o){return Math.log(i/o)/e/r}}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 s=this.getCenterInternal();const r=this.padding_;if(r){const o=this.getViewportSizeMinusPadding_();s=xn(s,this.getViewportSize_(),[o[0]/2+r[3],o[1]/2+r[0]],e,i)}return{center:s.slice(0),projection:t!==void 0?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getZoom(){let t;const e=this.getResolution();return e!==void 0&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e=this.minZoom_||0,i,s;if(this.resolutions_){const r=Vn(this.resolutions_,t,1);e=r,i=this.resolutions_[r],r==this.resolutions_.length-1?s=2:s=i/this.resolutions_[r+1]}else i=this.maxResolution_,s=this.zoomFactor_;return e+Math.log(i/t)/Math.log(s)}getResolutionForZoom(t){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;const e=tt(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,tt(t-e,0,1))}else return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(Y(Array.isArray(t)||typeof t.getSimplifiedGeometry=="function",24),Array.isArray(t)){Y(!rn(t),25);const s=ie(t,this.getProjection());i=cr(s)}else if(t.getType()==="Circle"){const s=ie(t.getExtent(),this.getProjection());i=cr(s),i.rotate(this.getRotation(),jt(s))}else i=t;this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),s=Math.sin(-e),r=t.getFlatCoordinates(),o=t.getStride();let a=1/0,l=1/0,h=-1/0,c=-1/0;for(let u=0,d=r.length;u0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!he(e,this.renderedAttributions_)){Vr(this.ulElement_);for(let s=0,r=e.length;s0&&i%(2*Math.PI)!==0?e.animate({rotation:0,duration:this.duration_,easing:Le}):e.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const i=e.viewState.rotation;if(i!=this.rotation_){const s="rotate("+i+"rad)";if(this.autoHide_){const r=this.element.classList.contains(Ri);!r&&i===0?this.element.classList.add(Ri):r&&i!==0&&this.element.classList.remove(Ri)}this.label_.style.transform=s}this.rotation_=i}}const Eh=xh;class Ch extends li{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=t.className!==void 0?t.className:"ol-zoom",i=t.delta!==void 0?t.delta:1,s=t.zoomInClassName!==void 0?t.zoomInClassName:e+"-in",r=t.zoomOutClassName!==void 0?t.zoomOutClassName:e+"-out",o=t.zoomInLabel!==void 0?t.zoomInLabel:"+",a=t.zoomOutLabel!==void 0?t.zoomOutLabel:"–",l=t.zoomInTipLabel!==void 0?t.zoomInTipLabel:"Zoom in",h=t.zoomOutTipLabel!==void 0?t.zoomOutTipLabel:"Zoom out",c=document.createElement("button");c.className=s,c.setAttribute("type","button"),c.title=l,c.appendChild(typeof o=="string"?document.createTextNode(o):o),c.addEventListener(O.CLICK,this.handleClick_.bind(this,i),!1);const u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=h,u.appendChild(typeof a=="string"?document.createTextNode(a):a),u.addEventListener(O.CLICK,this.handleClick_.bind(this,-i),!1);const d=e+" "+on+" "+os,f=this.element;f.className=d,f.appendChild(c),f.appendChild(u),this.duration_=t.duration!==void 0?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const i=this.getMap().getView();if(!i)return;const s=i.getZoom();if(s!==void 0){const r=i.getConstrainedZoom(s+t);this.duration_>0?(i.getAnimating()&&i.cancelAnimations(),i.animate({zoom:r,duration:this.duration_,easing:Le})):i.setZoom(r)}}}const Ih=Ch;function go(n){n=n||{};const t=new St;return(n.zoom!==void 0?n.zoom:!0)&&t.push(new Ih(n.zoomOptions)),(n.rotate!==void 0?n.rotate:!0)&&t.push(new Eh(n.rotateOptions)),(n.attribution!==void 0?n.attribution:!0)&&t.push(new yh(n.attributionOptions)),t}const ur={ACTIVE:"active"};class Rh extends Ct{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(ur.ACTIVE)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(ur.ACTIVE,t)}setMap(t){this.map_=t}}function vh(n,t,e){const i=n.getCenterInternal();if(i){const s=[i[0]+t[0],i[1]+t[1]];n.animateInternal({duration:e!==void 0?e:250,easing:zl,center:n.getConstrainedCenter(s)})}}function fs(n,t,e,i){const s=n.getZoom();if(s===void 0)return;const r=n.getConstrainedZoom(s+t),o=n.getResolutionForZoom(r);n.getAnimating()&&n.cancelAnimations(),n.animate({resolution:o,anchor:e,duration:i!==void 0?i:250,easing:Le})}const hi=Rh;class Sh extends hi{constructor(t){super(),t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=t.duration!==void 0?t.duration:250}handleEvent(t){let e=!1;if(t.type==K.DBLCLICK){const i=t.originalEvent,s=t.map,r=t.coordinate,o=i.shiftKey?-this.delta_:this.delta_,a=s.getView();fs(a,o,r,this.duration_),i.preventDefault(),e=!0}return!e}}const wh=Sh;class Th extends hi{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==K.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==K.POINTERUP){const i=this.handleUpEvent(t);this.handlingDownUpSequence=i&&this.targetPointers.length>0}}else if(t.type==K.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==K.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 gs(n){const t=n.length;let e=0,i=0;for(let s=0;s0&&this.condition_(t)){const i=t.map.getView();return this.lastCentroid=null,i.getAnimating()&&i.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}else return!1}}const Dh=Ph;class Fh extends ci{constructor(t){t=t||{},super({stopDown:Ji}),this.condition_=t.condition?t.condition:Lh,this.lastAngle_=void 0,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){if(!En(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===cs)return;const s=e.getSize(),r=t.pixel,o=Math.atan2(s[1]/2-r[1],r[0]-s[0]/2);if(this.lastAngle_!==void 0){const a=o-this.lastAngle_;i.adjustRotationInternal(-a)}this.lastAngle_=o}handleUpEvent(t){return En(t)?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){return En(t)&&mo(t)&&this.condition_(t)?(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}}const kh=Fh;class Nh extends Yn{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",s=this.element_.style;s.left=Math.min(t[0],e[0])+i,s.top=Math.min(t[1],e[1])+i,s.width=Math.abs(e[0]-t[0])+i,s.height=Math.abs(e[1]-t[1])+i}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const e=this.element_.style;e.left="inherit",e.top="inherit",e.width="inherit",e.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_,s=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);s[4]=s[0].slice(),this.geometry_?this.geometry_.setCoordinates([s]):this.geometry_=new ii([s])}getGeometry(){return this.geometry_}}const Gh=Nh,Si={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"};class Cn extends Gt{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}class Wh extends ci{constructor(t){super(),this.on,this.once,this.un,t=t||{},this.box_=new Gh(t.className||"ol-dragbox"),this.minArea_=t.minArea!==void 0?t.minArea:64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition?t.condition:mo,this.boxEndCondition_=t.boxEndCondition?t.boxEndCondition:this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,i){const s=i[0]-e[0],r=i[1]-e[1];return s*s+r*r>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new Cn(Si.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 Cn(e?Si.BOXEND:Si.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 Cn(Si.BOXSTART,t.coordinate,t)),!0):!1}onBoxEnd(t){}}const Xh=Wh;class Bh extends Xh{constructor(t){t=t||{};const e=t.condition?t.condition:Ah;super({condition:e,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=t.duration!==void 0?t.duration:200,this.out_=t.out!==void 0?t.out:!1}onBoxEnd(t){const i=this.getMap().getView();let s=this.getGeometry();if(this.out_){const r=i.rotatedExtentForGeometry(s),o=i.getResolutionForExtentInternal(r),a=i.getResolution()/o;s=s.clone(),s.scale(a*a)}i.fitInternal(s,{duration:this.duration_,easing:Le})}}const zh=Bh,Jt={LEFT:37,UP:38,RIGHT:39,DOWN:40};class Zh extends hi{constructor(t){super(),t=t||{},this.defaultCondition_=function(e){return po(e)&&yo(e)},this.condition_=t.condition!==void 0?t.condition:this.defaultCondition_,this.duration_=t.duration!==void 0?t.duration:100,this.pixelDelta_=t.pixelDelta!==void 0?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==O.KEYDOWN){const i=t.originalEvent,s=i.keyCode;if(this.condition_(t)&&(s==Jt.DOWN||s==Jt.LEFT||s==Jt.RIGHT||s==Jt.UP)){const o=t.map.getView(),a=o.getResolution()*this.pixelDelta_;let l=0,h=0;s==Jt.DOWN?h=-a:s==Jt.LEFT?l=-a:s==Jt.RIGHT?l=a:h=a;const c=[l,h];is(c,o.getRotation()),vh(o,c,this.duration_),i.preventDefault(),e=!0}}return!e}}const Yh=Zh;class Vh extends hi{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:yo,this.delta_=t.delta?t.delta:1,this.duration_=t.duration!==void 0?t.duration:100}handleEvent(t){let e=!1;if(t.type==O.KEYDOWN||t.type==O.KEYPRESS){const i=t.originalEvent,s=i.charCode;if(this.condition_(t)&&(s=="+".charCodeAt(0)||s=="-".charCodeAt(0))){const r=t.map,o=s=="+".charCodeAt(0)?this.delta_:-this.delta_,a=r.getView();fs(a,o,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}}const Kh=Vh;class Uh{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 s=this.points_[e+2]-this.points_[i+2];if(s<1e3/60)return!1;const r=this.points_[e]-this.points_[i],o=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(o,r),this.initialVelocity_=Math.sqrt(r*r+o*o)/s,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}const $h=Uh;class Hh extends hi{constructor(t){t=t||{},super(t),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=t.maxDelta!==void 0?t.maxDelta:1,this.duration_=t.duration!==void 0?t.duration:250,this.timeout_=t.timeout!==void 0?t.timeout:80,this.useAnchor_=t.useAnchor!==void 0?t.useAnchor:!0,this.constrainResolution_=t.constrainResolution!==void 0?t.constrainResolution:!1;const e=t.condition?t.condition:bh;this.condition_=t.onFocusOnly?Xn(_o,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;t.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_)}handleEvent(t){if(!this.condition_(t)||t.type!==O.WHEEL)return!0;const i=t.map,s=t.originalEvent;s.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.coordinate);let r;if(t.type==O.WHEEL&&(r=s.deltaY,da&&s.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(r/=Xr),s.deltaMode===WheelEvent.DOM_DELTA_LINE&&(r*=40)),r===0)return!1;this.lastDelta_=r;const o=Date.now();this.startTime_===void 0&&(this.startTime_=o),(!this.mode_||o-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(r)<4?"trackpad":"wheel");const a=i.getView();if(this.mode_==="trackpad"&&!(a.getConstrainResolution()||this.constrainResolution_))return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(a.getAnimating()&&a.cancelAnimations(),a.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),a.adjustZoom(-r/this.deltaPerZoom_,this.lastAnchor_),this.startTime_=o,!1;this.totalDelta_+=r;const l=Math.max(this.timeout_-(o-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,i),l),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let i=-tt(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),fs(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)}}const jh=Hh;class qh extends ci{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=Ji),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=t.threshold!==void 0?t.threshold:.3,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){let e=0;const i=this.targetPointers[0],s=this.targetPointers[1],r=Math.atan2(s.clientY-i.clientY,s.clientX-i.clientX);if(this.lastAngle_!==void 0){const c=r-this.lastAngle_;this.rotationDelta_+=c,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=c}this.lastAngle_=r;const o=t.map,a=o.getView();if(a.getConstraints().rotation===cs)return;const l=o.getViewport().getBoundingClientRect(),h=gs(this.targetPointers);h[0]-=l.left,h[1]-=l.top,this.anchor_=o.getCoordinateFromPixelInternal(h),this.rotating_&&(o.render(),a.adjustRotationInternal(e,this.anchor_))}handleUpEvent(t){return this.targetPointers.length<2?(t.map.getView().endInteraction(this.duration_),!1):!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}else return!1}}const Jh=qh;class Qh extends ci{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=Ji),super(e),this.anchor_=null,this.duration_=t.duration!==void 0?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const i=this.targetPointers[0],s=this.targetPointers[1],r=i.clientX-s.clientX,o=i.clientY-s.clientY,a=Math.sqrt(r*r+o*o);this.lastDistance_!==void 0&&(e=this.lastDistance_/a),this.lastDistance_=a;const l=t.map,h=l.getView();e!=1&&(this.lastScaleDelta_=e);const c=l.getViewport().getBoundingClientRect(),u=gs(this.targetPointers);u[0]-=c.left,u[1]-=c.top,this.anchor_=l.getCoordinateFromPixelInternal(u),l.render(),h.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const i=t.map.getView(),s=this.lastScaleDelta_>1?1:-1;return i.endInteraction(this.duration_,s),!1}else 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}else return!1}}const tc=Qh;function xo(n){n=n||{};const t=new St,e=new $h(-.005,.05,100);return(n.altShiftDragRotate!==void 0?n.altShiftDragRotate:!0)&&t.push(new kh),(n.doubleClickZoom!==void 0?n.doubleClickZoom:!0)&&t.push(new wh({delta:n.zoomDelta,duration:n.zoomDuration})),(n.dragPan!==void 0?n.dragPan:!0)&&t.push(new Dh({onFocusOnly:n.onFocusOnly,kinetic:e})),(n.pinchRotate!==void 0?n.pinchRotate:!0)&&t.push(new Jh),(n.pinchZoom!==void 0?n.pinchZoom:!0)&&t.push(new tc({duration:n.zoomDuration})),(n.keyboard!==void 0?n.keyboard:!0)&&(t.push(new Yh),t.push(new Kh({delta:n.zoomDelta,duration:n.zoomDuration}))),(n.mouseWheelZoom!==void 0?n.mouseWheelZoom:!0)&&t.push(new jh({onFocusOnly:n.onFocusOnly,duration:n.zoomDuration})),(n.shiftDragZoom!==void 0?n.shiftDragZoom:!0)&&t.push(new zh({duration:n.zoomDuration})),t}function dr(n){return n[0]>0&&n[1]>0}function Hi(n,t){return Array.isArray(n)?n:(t===void 0?t=[n,n]:(t[0]=n,t[1]=n),t)}function Eo(n){if(n instanceof en){n.setMapInternal(null);return}n instanceof an&&n.getLayers().forEach(Eo)}function Co(n,t){if(n instanceof en){n.setMapInternal(t);return}if(n instanceof an){const e=n.getLayers().getArray();for(let i=0,s=e.length;i=0;r--){const o=s[r];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(t)||t.propagationStopped)break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let s=this.maxTilesLoading_,r=s;if(t){const o=t.viewHints;if(o[q.ANIMATING]||o[q.INTERACTING]){const a=Date.now()-t.time>8;s=a?0:8,r=a?0:2}}e.getTilesLoading(){this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new Zt("removelayer",e)),this.set(rt.LAYERGROUP,t)}setSize(t){this.set(rt.SIZE,t)}setTarget(t){this.set(rt.TARGET,t)}setView(t){if(!t||t instanceof Rt){this.set(rt.VIEW,t);return}this.set(rt.VIEW,new Rt);const e=this;t.then(function(i){e.setView(new Rt(i))})}updateSize(){const t=this.getTargetElement();let e;if(t){const i=getComputedStyle(t),s=t.offsetWidth-parseFloat(i.borderLeftWidth)-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight)-parseFloat(i.borderRightWidth),r=t.offsetHeight-parseFloat(i.borderTopWidth)-parseFloat(i.paddingTop)-parseFloat(i.paddingBottom)-parseFloat(i.borderBottomWidth);!isNaN(s)&&!isNaN(r)&&(e=[s,r],!dr(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&console.warn("No map visible because the map container's width or height are 0."))}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 ic(n){let t=null;n.keyboardEventTarget!==void 0&&(t=typeof n.keyboardEventTarget=="string"?document.getElementById(n.keyboardEventTarget):n.keyboardEventTarget);const e={},i=n.layers&&typeof n.layers.getLayers=="function"?n.layers:new an({layers:n.layers});e[rt.LAYERGROUP]=i,e[rt.TARGET]=n.target,e[rt.VIEW]=n.view instanceof Rt?n.view:new Rt;let s;n.controls!==void 0&&(Array.isArray(n.controls)?s=new St(n.controls.slice()):(Y(typeof n.controls.getArray=="function",47),s=n.controls));let r;n.interactions!==void 0&&(Array.isArray(n.interactions)?r=new St(n.interactions.slice()):(Y(typeof n.interactions.getArray=="function",48),r=n.interactions));let o;return n.overlays!==void 0?Array.isArray(n.overlays)?o=new St(n.overlays.slice()):(Y(typeof n.overlays.getArray=="function",49),o=n.overlays):o=new St,{controls:s,interactions:r,keyboardEventTarget:t,overlays:o,values:e}}const nc=ec,sc=.5;class rc extends Qi{constructor(t,e,i,s){super(),this.extent=t,this.pixelRatio_=i,this.resolution=e,this.state=s}changed(){this.dispatchEvent(O.CHANGE)}getExtent(){return this.extent}getImage(){return N()}getPixelRatio(){return this.pixelRatio_}getResolution(){return this.resolution}getState(){return this.state}load(){N()}}const Io=rc,oc=10,fr=.25;class ac{constructor(t,e,i,s,r,o){this.sourceProj_=t,this.targetProj_=e;let a={};const l=Bi(this.targetProj_,this.sourceProj_);this.transformInv_=function(y){const x=y[0]+"/"+y[1];return a[x]||(a[x]=l(y)),a[x]},this.maxSourceExtent_=s,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!s&&!!this.sourceProj_.getExtent()&&z(s)==z(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?z(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?z(this.targetProj_.getExtent()):null;const h=sn(i),c=ts(i),u=Jn(i),d=qn(i),f=this.transformInv_(h),g=this.transformInv_(c),m=this.transformInv_(u),_=this.transformInv_(d),p=oc+(o?Math.max(0,Math.ceil(Math.log2(Fa(i)/(o*o*256*256)))):0);if(this.addQuad_(h,c,u,d,f,g,m,_,p),this.wrapsXInSource_){let y=1/0;this.triangles_.forEach(function(x,E,C){y=Math.min(y,x.source[0][0],x.source[1][0],x.source[2][0])}),this.triangles_.forEach(function(x){if(Math.max(x.source[0][0],x.source[1][0],x.source[2][0])-y>this.sourceWorldWidth_/2){const E=[[x.source[0][0],x.source[0][1]],[x.source[1][0],x.source[1][1]],[x.source[2][0],x.source[2][1]]];E[0][0]-y>this.sourceWorldWidth_/2&&(E[0][0]-=this.sourceWorldWidth_),E[1][0]-y>this.sourceWorldWidth_/2&&(E[1][0]-=this.sourceWorldWidth_),E[2][0]-y>this.sourceWorldWidth_/2&&(E[2][0]-=this.sourceWorldWidth_);const C=Math.min(E[0][0],E[1][0],E[2][0]);Math.max(E[0][0],E[1][0],E[2][0])-C.5&&u<1;let g=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const _=Bs([t,e,i,s]);g=z(_)/this.targetWorldWidth_>fr||g}!f&&this.sourceProj_.isGlobal()&&u&&(g=u>fr||g)}if(!g&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!ot(c,this.maxSourceExtent_))return;let m=0;if(!g&&(!isFinite(r[0])||!isFinite(r[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(h>0)g=!0;else if(m=(!isFinite(r[0])||!isFinite(r[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),m!=1&&m!=2&&m!=4&&m!=8)return}if(h>0){if(!g){const _=[(t[0]+i[0])/2,(t[1]+i[1])/2],p=this.transformInv_(_);let y;f?y=(Be(r[0],d)+Be(a[0],d))/2-Be(p[0],d):y=(r[0]+a[0])/2-p[0];const x=(r[1]+a[1])/2-p[1];g=y*y+x*x>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const _=[(e[0]+i[0])/2,(e[1]+i[1])/2],p=this.transformInv_(_),y=[(s[0]+t[0])/2,(s[1]+t[1])/2],x=this.transformInv_(y);this.addQuad_(t,e,_,y,r,o,p,x,h-1),this.addQuad_(y,_,i,s,x,p,a,l,h-1)}else{const _=[(t[0]+e[0])/2,(t[1]+e[1])/2],p=this.transformInv_(_),y=[(i[0]+s[0])/2,(i[1]+s[1])/2],x=this.transformInv_(y);this.addQuad_(t,_,y,s,r,p,x,l,h-1),this.addQuad_(_,e,i,y,p,o,a,x,h-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}m&11||this.addTriangle_(t,i,s,r,a,l),m&14||this.addTriangle_(t,i,e,r,a,o),m&&(m&13||this.addTriangle_(e,s,t,o,l,r),m&7||this.addTriangle_(e,s,i,o,l,a))}calculateSourceExtent(){const t=Lt();return this.triangles_.forEach(function(e,i,s){const r=e.source;ze(t,r[0]),ze(t,r[1]),ze(t,r[2])}),t}getTriangles(){return this.triangles_}}const lc=ac;let In;const hc=[];function gr(n,t,e,i,s){n.beginPath(),n.moveTo(0,0),n.lineTo(t,e),n.lineTo(i,s),n.closePath(),n.save(),n.clip(),n.fillRect(0,0,Math.max(t,i)+1,Math.max(e,s)),n.restore()}function Rn(n,t){return Math.abs(n[t*4]-210)>2||Math.abs(n[t*4+3]-.75*255)>2}function cc(){if(In===void 0){const n=document.createElement("canvas").getContext("2d");n.globalCompositeOperation="lighter",n.fillStyle="rgba(210, 0, 0, 0.75)",gr(n,4,5,4,0),gr(n,4,5,0,5);const t=n.getImageData(0,0,3,3).data;In=Rn(t,0)||Rn(t,4)||Rn(t,8)}return In}function uc(n,t,e,i){const s=ol(e,t,n);let r=Us(t,i,e);const o=t.getMetersPerUnit();o!==void 0&&(r*=o);const a=n.getMetersPerUnit();a!==void 0&&(r/=a);const l=n.getExtent();if(!l||jn(l,s)){const h=Us(n,r,s)/r;isFinite(h)&&h>0&&(r/=h)}return r}function dc(n,t,e,i,s,r,o,a,l,h,c,u){const d=_t(Math.round(e*n),Math.round(e*t),hc);if(u||(d.imageSmoothingEnabled=!1),l.length===0)return d.canvas;d.scale(e,e);function f(E){return Math.round(E*e)/e}d.globalCompositeOperation="lighter";const g=Lt();l.forEach(function(E,C,v){Oa(g,E.extent)});const m=z(g),_=ut(g),p=_t(Math.round(e*m/i),Math.round(e*_/i));u||(p.imageSmoothingEnabled=!1);const y=e/i;l.forEach(function(E,C,v){const R=E.extent[0]-g[0],S=-(E.extent[3]-g[3]),L=z(E.extent),A=ut(E.extent);E.image.width>0&&E.image.height>0&&p.drawImage(E.image,h,h,E.image.width-2*h,E.image.height-2*h,R*y,S*y,L*y,A*y)});const x=sn(o);return a.getTriangles().forEach(function(E,C,v){const R=E.source,S=E.target;let L=R[0][0],A=R[0][1],F=R[1][0],k=R[1][1],D=R[2][0],$=R[2][1];const w=f((S[0][0]-x[0])/r),M=f(-(S[0][1]-x[1])/r),b=f((S[1][0]-x[0])/r),W=f(-(S[1][1]-x[1])/r),et=f((S[2][0]-x[0])/r),H=f(-(S[2][1]-x[1])/r),at=L,I=A;L=0,A=0,F-=at,k-=I,D-=at,$-=I;const fi=[[F,k,0,0,b-w],[D,$,0,0,et-w],[0,0,F,k,W-M],[0,0,D,$,H-M]],it=sa(fi);if(it){if(d.save(),d.beginPath(),cc()||!u){d.moveTo(b,W);const dt=4,gi=w-b,_i=M-W;for(let It=0;Ith?c=Math.round(o/h):u=Math.round(a/l),c!==s||u!==r){const d=_t(c,u);this.getInterpolate()||(d.imageSmoothingEnabled=!1);const f=d.canvas;d.drawImage(i,0,0,s,r,0,0,f.width,f.height),this.image_.setImage(f)}}super.handleImageChange(t)}}const So=Ic;function Rc(n,t,e,i){let s=n[t],r=n[t+1],o=0;for(let a=t+i;ae;){if(i-e>600){var r=i-e+1,o=t-e+1,a=Math.log(r),l=.5*Math.exp(2*a/3),h=.5*Math.sqrt(a*l*(r-l)/r)*(o-r/2<0?-1:1),c=Math.max(e,Math.floor(t-o*l/r+h)),u=Math.min(i,Math.floor(t+(r-o)*l/r+h));bo(n,t,c,u,s)}var d=n[t],f=e,g=i;for(ke(n,e,t),s(n[i],d)>0&&ke(n,e,i);f0;)g--}s(n[e],d)===0?ke(n,e,g):(g++,ke(n,g,i)),g<=t&&(e=g+1),t<=g&&(i=g-1)}}function ke(n,t,e){var i=n[t];n[t]=n[e],n[e]=i}function bc(n,t){return nt?1:0}let Ao=class{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const i=[];if(!Ti(t,e))return i;const s=this.toBBox,r=[];for(;e;){for(let o=0;o=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(s,r,e)}_split(t,e){const i=t[e],s=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,s);const o=this._chooseSplitIndex(i,r,s),a=pe(i.children.splice(o,i.children.length-o));a.height=i.height,a.leaf=i.leaf,de(i,this.toBBox),de(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)}_splitRoot(t,e){this.data=pe([t,e]),this.data.height=t.height+1,this.data.leaf=!1,de(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let s,r=1/0,o=1/0;for(let a=e;a<=i-e;a++){const l=Ge(t,0,a,this.toBBox),h=Ge(t,a,i,this.toBBox),c=Fc(l,h),u=wn(l)+wn(h);c=e;h--){const c=t.children[h];We(a,t.leaf?r(c):c),l+=wi(a)}return l}_adjustParentBBoxes(t,e,i){for(let s=i;s>=0;s--)We(e[s],t)}_condense(t){for(let e=t.length-1,i;e>=0;e--)t[e].children.length===0?e>0?(i=t[e-1].children,i.splice(i.indexOf(t[e]),1)):this.clear():de(t[e],this.toBBox)}};function Ac(n,t,e){if(!e)return t.indexOf(n);for(let i=0;i=n.minX&&t.maxY>=n.minY}function pe(n){return{children:n,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function pr(n,t,e,i,s){const r=[t,e];for(;r.length;){if(e=r.pop(),t=r.pop(),e-t<=i)continue;const o=t+Math.ceil((e-t)/i/2)*i;Mc(n,o,t,e,s),r.push(t,o,o,e)}}let Ne=null;class kc extends Qi{constructor(t,e,i,s,r,o){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=s,this.canvas_={},this.color_=o,this.unlisten_=null,this.imageState_=r,this.size_=i,this.src_=e,this.tainted_}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===P.LOADED){Ne||(Ne=_t(1,1)),Ne.drawImage(this.image_,0,0);try{Ne.getImageData(0,0,1,1),this.tainted_=!1}catch{Ne=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(O.CHANGE)}handleImageError_(){this.imageState_=P.ERROR,this.unlistenImage_(),this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=P.LOADED,this.size_?(this.image_.width=this.size_[0],this.image_.height=this.size_[1]):this.size_=[this.image_.width,this.image_.height],this.unlistenImage_(),this.dispatchChangeEvent_()}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=_t(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_===P.IDLE){this.image_||this.initializeImage_(),this.imageState_=P.LOADING;try{this.image_.src=this.src_}catch{this.handleImageError_()}this.unlisten_=vo(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==P.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 s=i.getContext("2d");s.scale(t,t),s.drawImage(e,0,0),s.globalCompositeOperation="multiply",s.fillStyle=Zr(this.color_),s.fillRect(0,0,i.width/t,i.height/t),s.globalCompositeOperation="destination-in",s.drawImage(e,0,0),this.canvas_[t]=i}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function Nc(n,t,e,i,s,r){let o=zi.get(t,i,r);return o||(o=new kc(n,t,e,i,s,r),zi.set(t,i,r,o)),o}class vs extends To{constructor(t){t=t||{};const e=t.opacity!==void 0?t.opacity:1,i=t.rotation!==void 0?t.rotation:0,s=t.scale!==void 0?t.scale:1,r=t.rotateWithView!==void 0?t.rotateWithView:!1;super({opacity:e,rotation:i,scale:s,displacement:t.displacement!==void 0?t.displacement:[0,0],rotateWithView:r,declutterMode:t.declutterMode}),this.anchor_=t.anchor!==void 0?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=t.anchorOrigin!==void 0?t.anchorOrigin:"top-left",this.anchorXUnits_=t.anchorXUnits!==void 0?t.anchorXUnits:"fraction",this.anchorYUnits_=t.anchorYUnits!==void 0?t.anchorYUnits:"fraction",this.crossOrigin_=t.crossOrigin!==void 0?t.crossOrigin:null;const o=t.img!==void 0?t.img:null;this.imgSize_=t.imgSize;let a=t.src;Y(!(a!==void 0&&o),4),Y(!o||o&&this.imgSize_,5),(a===void 0||a.length===0)&&o&&(a=o.src||U(o)),Y(a!==void 0&&a.length>0,6);const l=t.src!==void 0?P.IDLE:P.LOADED;this.color_=t.color!==void 0?ki(t.color):null,this.iconImage_=Nc(o,a,this.imgSize_!==void 0?this.imgSize_:null,this.crossOrigin_,l,this.color_),this.offset_=t.offset!==void 0?t.offset:[0,0],this.offsetOrigin_=t.offsetOrigin!==void 0?t.offsetOrigin:"top-left",this.origin_=null,this.size_=t.size!==void 0?t.size:null}clone(){const t=this.getScale();return new vs({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_,imgSize:this.imgSize_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:Array.isArray(t)?t.slice():t,size:this.size_!==null?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 s=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!s)return null;t=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(t[0]*=s[0]),this.anchorYUnits_=="fraction"&&(t[1]*=s[1])}if(this.anchorOrigin_!="top-left"){if(!s)return null;t===this.anchor_&&(t=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(t[0]=-t[0]+s[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(t[1]=-t[1]+s[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(this.offsetOrigin_!="top-left"){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(t[0]=i[0]-e[0]-t[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(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()}listenImageChange(t){this.iconImage_.addEventListener(O.CHANGE,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(O.CHANGE,t)}}const Me=vs;function yr(n){return new le({fill:ni(n,""),stroke:si(n,""),text:Gc(n),image:Wc(n)})}function ni(n,t){const e=n[t+"fill-color"];if(e)return new ys({color:e})}function si(n,t){const e=n[t+"stroke-width"],i=n[t+"stroke-color"];if(!(!e&&!i))return new wo({width:e,color:i,lineCap:n[t+"stroke-line-cap"],lineJoin:n[t+"stroke-line-join"],lineDash:n[t+"stroke-line-dash"],lineDashOffset:n[t+"stroke-line-dash-offset"],miterLimit:n[t+"stroke-miter-limit"]})}function Gc(n){const t=n["text-value"];return t?new Lc({text:t,font:n["text-font"],maxAngle:n["text-max-angle"],offsetX:n["text-offset-x"],offsetY:n["text-offset-y"],overflow:n["text-overflow"],placement:n["text-placement"],scale:n["text-scale"],rotateWithView:n["text-rotate-with-view"],rotation:n["text-rotation"],textAlign:n["text-align"],justify:n["text-justify"],textBaseline:n["text-baseline"],padding:n["text-padding"],fill:ni(n,"text-"),backgroundFill:ni(n,"text-background-"),stroke:si(n,"text-"),backgroundStroke:si(n,"text-background-")}):void 0}function Wc(n){const t=n["icon-src"],e=n["icon-img"];if(t||e)return new Me({src:t,img:e,imgSize:n["icon-img-size"],anchor:n["icon-anchor"],anchorOrigin:n["icon-anchor-origin"],anchorXUnits:n["icon-anchor-x-units"],anchorYUnits:n["icon-anchor-y-units"],color:n["icon-color"],crossOrigin:n["icon-cross-origin"],offset:n["icon-offset"],displacement:n["icon-displacement"],opacity:n["icon-opacity"],scale:n["icon-scale"],rotation:n["icon-rotation"],rotateWithView:n["icon-rotate-with-view"],size:n["icon-size"],declutterMode:n["icon-declutter-mode"]});const i=n["shape-points"];if(i){const r="shape-";return new Lo({points:i,fill:ni(n,r),stroke:si(n,r),radius:n["shape-radius"],radius1:n["shape-radius1"],radius2:n["shape-radius2"],angle:n["shape-angle"],displacement:n["shape-displacement"],rotation:n["shape-rotation"],rotateWithView:n["shape-rotate-with-view"],scale:n["shape-scale"],declutterMode:n["shape-declutter-mode"]})}const s=n["circle-radius"];if(s){const r="circle-";return new Mo({radius:s,fill:ni(n,r),stroke:si(n,r),displacement:n["circle-displacement"],scale:n["circle-scale"],rotation:n["circle-rotation"],rotateWithView:n["circle-rotate-with-view"],declutterMode:n["circle-declutter-mode"]})}}const xr={RENDER_ORDER:"renderOrder"};class Xc extends en{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_=t.declutter!==void 0?t.declutter:!1,this.renderBuffer_=t.renderBuffer!==void 0?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=t.updateWhileAnimating!==void 0?t.updateWhileAnimating:!1,this.updateWhileInteracting_=t.updateWhileInteracting!==void 0?t.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(xr.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 Ao(9)),this.getRenderer().renderDeclutter(t)}setRenderOrder(t){this.set(xr.RENDER_ORDER,t)}setStyle(t){let e;if(t===void 0)e=wc;else if(t===null)e=null;else if(typeof t=="function")e=t;else if(t instanceof le)e=t;else if(Array.isArray(t)){const i=t.length,s=new Array(i);for(let r=0;ra&&(this.instructions.push([T.CUSTOM,a,h,t,i,xe]),this.hitDetectionInstructions.push([T.CUSTOM,a,h,t,s||i,xe]));break;case"Point":l=t.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),h=this.coordinates.length,this.instructions.push([T.CUSTOM,a,h,t,i]),this.hitDetectionInstructions.push([T.CUSTOM,a,h,t,s||i]);break}this.endGeometry(e)}beginGeometry(t,e){this.beginGeometryInstruction1_=[T.BEGIN_GEOMETRY,e,0,t],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[T.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;t.reverse();let e;const i=t.length;let s,r,o=-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=[T.SET_FILL_STYLE,e];return typeof e!="string"&&i.push(!0),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[T.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;(typeof i!="string"||t.currentFillStyle!=i)&&(i!==void 0&&this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,s=t.lineCap,r=t.lineDash,o=t.lineDashOffset,a=t.lineJoin,l=t.lineWidth,h=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=s||r!=t.currentLineDash&&!he(t.currentLineDash,r)||t.currentLineDashOffset!=o||t.currentLineJoin!=a||t.currentLineWidth!=l||t.currentMiterLimit!=h)&&(i!==void 0&&e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=s,t.currentLineDash=r,t.currentLineDashOffset=o,t.currentLineJoin=a,t.currentLineWidth=l,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=[T.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Kr(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;Hn(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}const di=Zc;class Yc extends di{constructor(t,e,i,s){super(t,e,i,s),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(),s=t.getStride(),r=this.coordinates.length,o=this.appendFlatPointCoordinates(i,s);this.instructions.push([T.DRAW_IMAGE,r,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.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([T.DRAW_IMAGE,r,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e){if(!this.image_)return;this.beginGeometry(t,e);const i=t.getFlatCoordinates(),s=t.getStride(),r=this.coordinates.length,o=this.appendFlatPointCoordinates(i,s);this.instructions.push([T.DRAW_IMAGE,r,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.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([T.DRAW_IMAGE,r,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.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(),s=t.getSize(),r=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_=s[1],this.opacity_=t.getOpacity(),this.originX_=r[0],this.originY_=r[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=s[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}const Vc=Yc;class Kc extends di{constructor(t,e,i,s){super(t,e,i,s)}drawFlatCoordinates_(t,e,i,s){const r=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,i,s,!1,!1),a=[T.MOVE_TO_LINE_TO,r,o];return this.instructions.push(a),this.hitDetectionInstructions.push(a),i}drawLineString(t,e){const i=this.state,s=i.strokeStyle,r=i.lineWidth;if(s===void 0||r===void 0)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([T.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,je,qe],re);const o=t.getFlatCoordinates(),a=t.getStride();this.drawFlatCoordinates_(o,0,o.length,a),this.hitDetectionInstructions.push(Kt),this.endGeometry(e)}drawMultiLineString(t,e){const i=this.state,s=i.strokeStyle,r=i.lineWidth;if(s===void 0||r===void 0)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([T.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset],re);const o=t.getEnds(),a=t.getFlatCoordinates(),l=t.getStride();let h=0;for(let c=0,u=o.length;cn&&(l>a&&(a=l,r=h,o=u),l=0,h=u-s)),d=f,_=y,p=x),g=E,m=C}return l+=f,l>a?[h,u]:[r,o]}const Ze={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class jc extends di{constructor(t,e,i,s){super(t,e,i,s),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},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_,s=this.textStrokeState_,r=this.textState_;if(this.text_===""||!r||!i&&!s)return;const o=this.coordinates;let a=o.length;const l=t.getType();let h=null,c=t.getStride();if(r.placement==="line"&&(l=="LineString"||l=="MultiLineString"||l=="Polygon"||l=="MultiPolygon")){if(!ot(this.getBufferedMaxExtent(),t.getExtent()))return;let u;if(h=t.getFlatCoordinates(),l=="LineString")u=[h.length];else if(l=="MultiLineString")u=t.getEnds();else if(l=="Polygon")u=t.getEnds().slice(0,1);else if(l=="MultiPolygon"){const m=t.getEndss();u=[];for(let _=0,p=m.length;_{const x=o[(_+y)*2]===h[y*c]&&o[(_+y)*2+1]===h[y*c+1];return x||--_,x})}this.saveTextStates_(),(r.backgroundFill||r.backgroundStroke)&&(this.setFillStrokeStyle(r.backgroundFill,r.backgroundStroke),r.backgroundFill&&(this.updateFillStyle(this.state,this.createFill),this.hitDetectionInstructions.push(this.createFill(this.state))),r.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(t,e);let f=r.padding;if(f!=ne&&(r.scale[0]<0||r.scale[1]<0)){let _=r.padding[0],p=r.padding[1],y=r.padding[2],x=r.padding[3];r.scale[0]<0&&(p=-p,x=-x),r.scale[1]<0&&(_=-_,y=-y),f=[_,p,y,x]}const g=this.pixelRatio;this.instructions.push([T.DRAW_IMAGE,a,d,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,void 0,this.declutterImageWithText_,f==ne?ne:f.map(function(_){return _*g}),!!r.backgroundFill,!!r.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,u]);const m=1/g;this.hitDetectionInstructions.push([T.DRAW_IMAGE,a,d,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[m,m],NaN,void 0,this.declutterImageWithText_,f,!!r.backgroundFill,!!r.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,u]),this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,s=this.strokeKey_;t&&(s in this.strokeStates||(this.strokeStates[s]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const r=this.textKey_;r in this.textStates||(this.textStates[r]={font:e.font,textAlign:e.textAlign||ti,justify:e.justify,textBaseline:e.textBaseline||Yi,scale:e.scale});const o=this.fillKey_;i&&(o in this.fillStates||(this.fillStates[o]={fillStyle:i.fillStyle}))}drawChars_(t,e){const i=this.textStrokeState_,s=this.textState_,r=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();const l=this.pixelRatio,h=Ze[s.textBaseline],c=this.textOffsetY_*l,u=this.text_,d=i?i.lineWidth*Math.abs(s.scale[0])/2:0;this.instructions.push([T.DRAW_CHARS,t,e,h,s.overflow,a,s.maxAngle,l,c,r,d*l,u,o,1]),this.hitDetectionInstructions.push([T.DRAW_CHARS,t,e,h,s.overflow,a,s.maxAngle,1,c,r,d,u,o,1/l])}setTextStyle(t,e){let i,s,r;if(!t)this.text_="";else{const o=t.getFill();o?(s=this.textFillState_,s||(s={},this.textFillState_=s),s.fillStyle=wt(o.getColor()||kt)):(s=null,this.textFillState_=s);const a=t.getStroke();if(!a)r=null,this.textStrokeState_=r;else{r=this.textStrokeState_,r||(r={},this.textStrokeState_=r);const g=a.getLineDash(),m=a.getLineDashOffset(),_=a.getWidth(),p=a.getMiterLimit();r.lineCap=a.getLineCap()||Zi,r.lineDash=g?g.slice():je,r.lineDashOffset=m===void 0?qe:m,r.lineJoin=a.getLineJoin()||Te,r.lineWidth=_===void 0?ei:_,r.miterLimit=p===void 0?Je:p,r.strokeStyle=wt(a.getColor()||Qe)}i=this.textState_;const l=t.getFont()||no;yl(l);const h=t.getScaleArray();i.overflow=t.getOverflow(),i.font=l,i.maxAngle=t.getMaxAngle(),i.placement=t.getPlacement(),i.textAlign=t.getTextAlign(),i.justify=t.getJustify(),i.textBaseline=t.getTextBaseline()||Yi,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||ne,i.scale=h===void 0?[1,1]:h;const c=t.getOffsetX(),u=t.getOffsetY(),d=t.getRotateWithView(),f=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=c===void 0?0:c,this.textOffsetY_=u===void 0?0:u,this.textRotateWithView_=d===void 0?!1:d,this.textRotation_=f===void 0?0:f,this.strokeKey_=r?(typeof r.strokeStyle=="string"?r.strokeStyle:U(r.strokeStyle))+r.lineCap+r.lineDashOffset+"|"+r.lineWidth+r.lineJoin+r.miterLimit+"["+r.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=s?typeof s.fillStyle=="string"?s.fillStyle:"|"+U(s.fillStyle):""}this.declutterImageWithText_=e}}const qc={Circle:Cr,Default:di,Image:Vc,LineString:Uc,Polygon:Cr,Text:jc};class Jc{constructor(t,e,i,s){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=s,this.resolution_=i,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const i=this.buildersByZIndex_[e];for(const s in i){const r=i[s].finish();t[e][s]=r}}return t}getBuilder(t,e){const i=t!==void 0?t.toString():"0";let s=this.buildersByZIndex_[i];s===void 0&&(s={},this.buildersByZIndex_[i]=s);let r=s[e];if(r===void 0){const o=qc[e];r=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),s[e]=r}return r}}const Ir=Jc;function Qc(n,t,e,i,s,r,o,a,l,h,c,u){let d=n[t],f=n[t+1],g=0,m=0,_=0,p=0;function y(){g=d,m=f,t+=i,d=n[t],f=n[t+1],p+=_,_=Math.sqrt((d-g)*(d-g)+(f-m)*(f-m))}do y();while(tM[2]}else F=E>L;const k=Math.PI,D=[],$=v+i===t;t=v,_=0,p=R,d=n[t],f=n[t+1];let w;if($){y(),w=Math.atan2(f-m,d-g),F&&(w+=w>0?-k:k);const M=(L+E)/2,b=(A+C)/2;return D[0]=[M,b,(S-r)/2,w,s],D}s=s.replace(/\n/g," ");for(let M=0,b=s.length;M0?-k:k),w!==void 0){let it=W-w;if(it+=it>k?-2*k:it<-k?2*k:0,Math.abs(it)>o)return null}w=W;const et=M;let H=0;for(;M0&&n.push(` `,""),n.push(t,""),n}class iu{constructor(t,e,i,s){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignFill_,this.instructions=s.instructions,this.coordinates=s.coordinates,this.coordinateCache_={},this.renderedTransform_=Tt(),this.hitDetectionInstructions=s.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=s.fillStates||{},this.strokeStates=s.strokeStates||{},this.textStates=s.textStates||{},this.widths_={},this.labels_={}}createLabel(t,e,i,s){const r=t+e+i+s;if(this.labels_[r])return this.labels_[r];const o=s?this.strokeStates[s]:null,a=i?this.fillStates[i]:null,l=this.textStates[e],h=this.pixelRatio,c=[l.scale[0]*h,l.scale[1]*h],u=Array.isArray(t),d=l.justify?Ze[l.justify]:vr(Array.isArray(t)?t[0]:t,l.textAlign||ti),f=s&&o.lineWidth?o.lineWidth:0,g=u?t:t.split(` `).reduce(eu,[]),{width:m,height:_,widths:p,heights:y,lineWidths:x}=El(l,g),E=m+f,C=[],v=(E+2)*c[0],R=(_+f)*c[1],S={width:v<0?Math.floor(v):Math.ceil(v),height:R<0?Math.floor(R):Math.ceil(R),contextInstructions:C};(c[0]!=1||c[1]!=1)&&C.push("scale",c),s&&(C.push("strokeStyle",o.strokeStyle),C.push("lineWidth",f),C.push("lineCap",o.lineCap),C.push("lineJoin",o.lineJoin),C.push("miterLimit",o.miterLimit),C.push("setLineDash",[o.lineDash]),C.push("lineDashOffset",o.lineDashOffset)),i&&C.push("fillStyle",a.fillStyle),C.push("textBaseline","middle"),C.push("textAlign","center");const L=.5-d;let A=d*E+L*f;const F=[],k=[];let D=0,$=0,w=0,M=0,b;for(let W=0,et=g.length;Wt?t-h:r,E=o+c>e?e-c:o,C=g[3]+x*d[0]+g[1],v=g[0]+E*d[1]+g[2],R=p-g[3],S=y-g[0];(m||u!==0)&&(Wt[0]=R,Xt[0]=R,Wt[1]=S,At[1]=S,At[0]=R+C,Ot[0]=At[0],Ot[1]=S+v,Xt[1]=Ot[1]);let L;return u!==0?(L=Ht(Tt(),i,s,1,1,u,-i,-s),Q(L,Wt),Q(L,At),Q(L,Ot),Q(L,Xt),we(Math.min(Wt[0],At[0],Ot[0],Xt[0]),Math.min(Wt[1],At[1],Ot[1],Xt[1]),Math.max(Wt[0],At[0],Ot[0],Xt[0]),Math.max(Wt[1],At[1],Ot[1],Xt[1]),fe)):we(Math.min(R,R+C),Math.min(S,S+v),Math.max(R,R+C),Math.max(S,S+v),fe),f&&(p=Math.round(p),y=Math.round(y)),{drawImageX:p,drawImageY:y,drawImageW:x,drawImageH:E,originX:h,originY:c,declutterBox:{minX:fe[0],minY:fe[1],maxX:fe[2],maxY:fe[3],value:_},canvasTransform:L,scale:d}}replayImageOrLabel_(t,e,i,s,r,o,a){const l=!!(o||a),h=s.declutterBox,c=t.canvas,u=a?a[2]*s.scale[0]/2:0;return h.minX-u<=c.width/e&&h.maxX+u>=0&&h.minY-u<=c.height/e&&h.maxY+u>=0&&(l&&this.replayTextBackground_(t,Wt,At,Ot,Xt,o,a),Cl(t,s.canvasTransform,r,i,s.originX,s.originY,s.drawImageW,s.drawImageH,s.drawImageX,s.drawImageY,s.scale)),!0}fill_(t){if(this.alignFill_){const e=Q(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,s){const r=this.textStates[e],o=this.createLabel(t,e,s,i),a=this.strokeStates[i],l=this.pixelRatio,h=vr(Array.isArray(t)?t[0]:t,r.textAlign||ti),c=Ze[r.textBaseline||Yi],u=a&&a.lineWidth?a.lineWidth:0,d=o.width/l-2*r.scale[0],f=h*d+2*(.5-h)*u,g=c*o.height/l+2*(.5-c)*u;return{label:o,anchorX:f,anchorY:g}}execute_(t,e,i,s,r,o,a,l){let h;this.pixelCoordinates_&&he(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=oe(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),ya(this.renderedTransform_,i));let c=0;const u=s.length;let d=0,f,g,m,_,p,y,x,E,C,v,R,S,L=0,A=0,F=null,k=null;const D=this.coordinateCache_,$=this.viewRotation_,w=Math.round(Math.atan2(-i[1],i[0])*1e12)/1e12,M={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:$},b=this.instructions!=s||this.overlaps?0:200;let W,et,H,at;for(;cb&&(this.fill_(t),L=0),A>b&&(t.stroke(),A=0),!L&&!A&&(t.beginPath(),_=NaN,p=NaN),++c;break;case T.CIRCLE:d=I[1];const it=h[d],dt=h[d+1],gi=h[d+2],_i=h[d+3],It=gi-it,Ss=_i-dt,ws=Math.sqrt(It*It+Ss*Ss);t.moveTo(it+ws,dt),t.arc(it,dt,ws,0,2*Math.PI,!0),++c;break;case T.CLOSE_PATH:t.closePath(),++c;break;case T.CUSTOM:d=I[1],f=I[2];const No=I[3],Go=I[4],Ts=I.length==6?I[5]:void 0;M.geometry=No,M.feature=W,c in D||(D[c]=[]);const be=D[c];Ts?Ts(h,d,f,2,be):(be[0]=h[d],be[1]=h[d+1],be.length=2),Go(be,M),++c;break;case T.DRAW_IMAGE:d=I[1],f=I[2],E=I[3],g=I[4],m=I[5];let cn=I[6];const Wo=I[7],Xo=I[8],Bo=I[9],Ls=I[10];let un=I[11];const zo=I[12];let mi=I[13];const Ms=I[14],Ae=I[15];if(!E&&I.length>=20){C=I[19],v=I[20],R=I[21],S=I[22];const ft=this.drawLabelWithPointPlacement_(C,v,R,S);E=ft.label,I[3]=E;const ce=I[23];g=(ft.anchorX-ce)*this.pixelRatio,I[4]=g;const mt=I[24];m=(ft.anchorY-mt)*this.pixelRatio,I[5]=m,cn=E.height,I[6]=cn,mi=E.width,I[13]=mi}let dn;I.length>25&&(dn=I[25]);let fn,pi,yi;I.length>17?(fn=I[16],pi=I[17],yi=I[18]):(fn=ne,pi=!1,yi=!1),Ls&&w?un+=$:!Ls&&!w&&(un-=$);let Zo=0;for(;d0){if(!o||f!=="Image"&&f!=="Text"||o.includes(C)){const A=(d[S]-3)/4,F=s-A%a,k=s-(A/a|0),D=r(C,v,F*F+k*k);if(D)return D}c.clearRect(0,0,a,a);break}}const m=Object.keys(this.executorsByZIndex_).map(Number);m.sort(Di);let _,p,y,x,E;for(_=m.length-1;_>=0;--_){const C=m[_].toString();for(y=this.executorsByZIndex_[C],p=Ln.length-1;p>=0;--p)if(f=Ln[p],x=y[f],x!==void 0&&(E=x.executeHitDetection(c,l,i,g,u),E))return E}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],s=e[1],r=e[2],o=e[3],a=[i,s,i,o,r,o,r,s];return oe(a,0,8,2,t,a),a}isEmpty(){return $e(this.executorsByZIndex_)}execute(t,e,i,s,r,o,a){const l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(Di),this.maxExtent_&&(t.save(),this.clip(t,i)),o=o||Ln;let h,c,u,d,f,g;for(a&&l.reverse(),h=0,c=l.length;he)break;let l=i[a];l||(l=[],i[a]=l),l.push(((n+r)*t+(n+o))*4+3),r>0&&l.push(((n-r)*t+(n+o))*4+3),o>0&&(l.push(((n+r)*t+(n-o))*4+3),r>0&&l.push(((n-r)*t+(n-o))*4+3))}const s=[];for(let r=0,o=i.length;ru*this.pixelRatio_),lineDashOffset:(o||qe)*this.pixelRatio_,lineJoin:a!==void 0?a:Te,lineWidth:(l!==void 0?l:ei)*this.pixelRatio_,miterLimit:h!==void 0?h:Je,strokeStyle:wt(i||Qe)}}}setImageStyle(t){let e;if(!t||!(e=t.getSize())){this.image_=null;return}const i=t.getPixelRatio(this.pixelRatio_),s=t.getAnchor(),r=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=s[0]*i,this.imageAnchorY_=s[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=r[0],this.imageOriginY_=r[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const o=t.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/i,o[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(!t)this.text_="";else{const e=t.getFill();if(!e)this.textFillState_=null;else{const f=e.getColor();this.textFillState_={fillStyle:wt(f||kt)}}const i=t.getStroke();if(!i)this.textStrokeState_=null;else{const f=i.getColor(),g=i.getLineCap(),m=i.getLineDash(),_=i.getLineDashOffset(),p=i.getLineJoin(),y=i.getWidth(),x=i.getMiterLimit();this.textStrokeState_={lineCap:g!==void 0?g:Zi,lineDash:m||je,lineDashOffset:_||qe,lineJoin:p!==void 0?p:Te,lineWidth:y!==void 0?y:ei,miterLimit:x!==void 0?x:Je,strokeStyle:wt(f||Qe)}}const s=t.getFont(),r=t.getOffsetX(),o=t.getOffsetY(),a=t.getRotateWithView(),l=t.getRotation(),h=t.getScaleArray(),c=t.getText(),u=t.getTextAlign(),d=t.getTextBaseline();this.textState_={font:s!==void 0?s:no,textAlign:u!==void 0?u:ti,textBaseline:d!==void 0?d:Yi},this.text_=c!==void 0?Array.isArray(c)?c.reduce((f,g,m)=>f+=m%2?" ":g,""):c:"",this.textOffsetX_=r!==void 0?this.pixelRatio_*r:0,this.textOffsetY_=o!==void 0?this.pixelRatio_*o:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*h[0],this.pixelRatio_*h[1]]}}}const au=ou,vt=.5;function lu(n,t,e,i,s,r,o){const a=n[0]*vt,l=n[1]*vt,h=_t(a,l);h.imageSmoothingEnabled=!1;const c=h.canvas,u=new au(h,vt,s,null,o),d=e.length,f=Math.floor((256*256*256-1)/d),g={};for(let _=1;_<=d;++_){const p=e[_-1],y=p.getStyleFunction()||i;if(!i)continue;let x=y(p,r);if(!x)continue;Array.isArray(x)||(x=[x]);const C="#"+("000000"+(_*f).toString(16)).slice(-6);for(let v=0,R=x.length;vg[2];)++p,y=_*p,c.push(this.getRenderTransform(s,r,o,vt,u,d,y).slice()),m-=_}this.hitDetectionImageData_=lu(i,c,this.renderedFeatures_,h.getStyleFunction(),l,r,o)}e(hu(t,this.renderedFeatures_,this.hitDetectionImageData_))}.bind(this))}forEachFeatureAtCoordinate(t,e,i,s,r){if(!this.replayGroup_)return;const o=e.viewState.resolution,a=e.viewState.rotation,l=this.getLayer(),h={},c=function(f,g,m){const _=U(f),p=h[_];if(p){if(p!==!0&&mu=f.forEachFeatureAtCoordinate(t,o,a,i,c,f===this.declutterExecutorGroup&&e.declutterTree?e.declutterTree.all().map(g=>g.value):null)),u}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 s=t.viewHints[q.ANIMATING],r=t.viewHints[q.INTERACTING],o=e.getUpdateWhileAnimating(),a=e.getUpdateWhileInteracting();if(this.ready&&!o&&s||!a&&r)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const l=t.extent,h=t.viewState,c=h.projection,u=h.resolution,d=t.pixelRatio,f=e.getRevision(),g=e.getRenderBuffer();let m=e.getRenderOrder();m===void 0&&(m=uu);const _=h.center.slice(),p=Hn(l,g*u),y=p.slice(),x=[p.slice()],E=c.getExtent();if(i.getWrapX()&&c.canWrapX()&&!Vt(E,t.extent)){const w=z(E),M=Math.max(z(p)/2,w);p[0]=E[0]-M,p[2]=E[2]+M,Jr(_,c);const b=jr(x[0],c);b[0]E[0]&&b[2]>E[2]&&x.push([b[0]-w,b[1],b[2]-w,b[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedRevision_==f&&this.renderedRenderOrder_==m&&Vt(this.wrappedRenderedExtent_,p))return he(this.renderedExtent_,y)||(this.hitDetectionImageData_=null,this.renderedExtent_=y),this.renderedCenter_=_,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const C=new Ir(Bn(u,d),p,u,d);let v;this.getLayer().getDeclutter()&&(v=new Ir(Bn(u,d),p,u,d));let R;for(let w=0,M=x.length;w=200&&a.status<300){const h=t.getType();let c;h=="json"||h=="text"?c=a.responseText:h=="xml"?(c=a.responseXML,c||(c=new DOMParser().parseFromString(a.responseText,"application/xml"))):h=="arraybuffer"&&(c=a.response),c?r(t.readFeatures(c,{extent:e,featureProjection:s}),t.readProjection(c)):o()}else o()},a.onerror=o,a.send()}function Lr(n,t){return function(e,i,s,r,o){const a=this;Lu(n,t,e,i,s,function(l,h){a.addFeatures(l),r!==void 0&&r(l)},o||ae)}}class Bt extends Gt{constructor(t,e,i){super(t),this.feature=e,this.features=i}}class Mu extends Ro{constructor(t){t=t||{},super({attributions:t.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:t.wrapX!==void 0?t.wrapX:!0}),this.on,this.once,this.un,this.loader_=ae,this.format_=t.format,this.overlaps_=t.overlaps===void 0?!0:t.overlaps,this.url_=t.url,t.loader!==void 0?this.loader_=t.loader:this.url_!==void 0&&(Y(this.format_,7),this.loader_=Lr(this.url_,this.format_)),this.strategy_=t.strategy!==void 0?t.strategy:wu;const e=t.useSpatialIndex!==void 0?t.useSpatialIndex:!0;this.featuresRtree_=e?new Tr:null,this.loadedExtentsRtree_=new Tr,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let i,s;Array.isArray(t.features)?s=t.features:t.features&&(i=t.features,s=i.getArray()),!e&&i===void 0&&(i=new St(s)),s!==void 0&&this.addFeaturesInternal(s),i!==void 0&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=U(t);if(!this.addToIndex_(e,t)){this.featuresCollection_&&this.featuresCollection_.remove(t);return}this.setupChangeEvents_(e,t);const i=t.getGeometry();if(i){const s=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(s,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new Bt(Et.ADDFEATURE,t))}setupChangeEvents_(t,e){this.featureChangeKeys_[t]=[G(e,O.CHANGE,this.handleFeatureChange_,this),G(e,Se.PROPERTYCHANGE,this.handleFeatureChange_,this)]}addToIndex_(t,e){let i=!0;const s=e.getId();return s!==void 0&&(s.toString()in this.idIndex_?i=!1:this.idIndex_[s.toString()]=e),i&&(Y(!(t in this.uidIndex_),30),this.uidIndex_[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],i=[],s=[];for(let r=0,o=t.length;rthis.featuresRtree_.getInExtent(r)))}else return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],s=t[1];let r=null;const o=[NaN,NaN];let a=1/0;const l=[-1/0,-1/0,1/0,1/0];return e=e||Ue,this.featuresRtree_.forEachInExtent(l,function(h){if(e(h)){const c=h.getGeometry(),u=a;if(a=c.closestPointXY(i,s,o,a),a0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_;let i;e.forEachInExtent(t,function(s){if(He(s.extent,t))return i=s,!0}),i&&e.remove(i)}removeFeature(t){if(!t)return;const e=U(t);e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t),this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=U(t),i=this.featureChangeKeys_[e];if(!i)return;i.forEach(V),delete this.featureChangeKeys_[e];const s=t.getId();return s!==void 0&&delete this.idIndex_[s.toString()],delete this.uidIndex_[e],this.dispatchEvent(new Bt(Et.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){Y(this.format_,7),this.url_=t,this.setLoader(Lr(t,this.format_))}}const bi=Mu,nt={ELEMENT:"element",MAP:"map",OFFSET:"offset",POSITION:"position",POSITIONING:"positioning"};class bu extends Ct{constructor(t){super(),this.on,this.once,this.un,this.options=t,this.id=t.id,this.insertFirst=t.insertFirst!==void 0?t.insertFirst:!0,this.stopEvent=t.stopEvent!==void 0?t.stopEvent:!0,this.element=document.createElement("div"),this.element.className=t.className!==void 0?t.className:"ol-overlay-container "+ml,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=t.autoPan===!0?{}:t.autoPan||void 0,this.rendered={transform_:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(nt.ELEMENT,this.handleElementChanged),this.addChangeListener(nt.MAP,this.handleMapChanged),this.addChangeListener(nt.OFFSET,this.handleOffsetChanged),this.addChangeListener(nt.POSITION,this.handlePositionChanged),this.addChangeListener(nt.POSITIONING,this.handlePositioningChanged),t.element!==void 0&&this.setElement(t.element),this.setOffset(t.offset!==void 0?t.offset:[0,0]),this.setPositioning(t.positioning||"top-left"),t.position!==void 0&&this.setPosition(t.position)}getElement(){return this.get(nt.ELEMENT)}getId(){return this.id}getMap(){return this.get(nt.MAP)||null}getOffset(){return this.get(nt.OFFSET)}getPosition(){return this.get(nt.POSITION)}getPositioning(){return this.get(nt.POSITIONING)}handleElementChanged(){Vr(this.element);const t=this.getElement();t&&this.element.appendChild(t)}handleMapChanged(){this.mapPostrenderListenerKey&&(Ni(this.element),V(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const t=this.getMap();if(t){this.mapPostrenderListenerKey=G(t,Ft.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(nt.ELEMENT,t)}setMap(t){this.set(nt.MAP,t)}setOffset(t){this.set(nt.OFFSET,t)}setPosition(t){this.set(nt.POSITION,t)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(t){const e=this.getMap();if(!e||!e.getTargetElement()||!this.get(nt.POSITION))return;const i=this.getRect(e.getTargetElement(),e.getSize()),s=this.getElement(),r=this.getRect(s,[Ta(s),La(s)]);t=t||{};const o=t.margin===void 0?20:t.margin;if(!Vt(i,r)){const a=r[0]-i[0],l=i[2]-r[2],h=r[1]-i[1],c=i[3]-r[3],u=[0,0];if(a<0?u[0]=a-o:l<0&&(u[0]=Math.abs(l)+o),h<0?u[1]=h-o:c<0&&(u[1]=Math.abs(c)+o),u[0]!==0||u[1]!==0){const d=e.getView().getCenterInternal(),f=e.getPixelFromCoordinateInternal(d);if(!f)return;const g=[f[0]+u[0],f[1]+u[1]],m=t.animation||{};e.getView().animateInternal({center:e.getCoordinateFromPixelInternal(g),duration:m.duration,easing:m.easing})}}}getRect(t,e){const i=t.getBoundingClientRect(),s=i.left+window.pageXOffset,r=i.top+window.pageYOffset;return[s,r,s+e[0],r+e[1]]}setPositioning(t){this.set(nt.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){this.setVisible(!1);return}const i=t.getPixelFromCoordinate(e),s=t.getSize();this.updateRenderedPosition(i,s)}updateRenderedPosition(t,e){const i=this.element.style,s=this.getOffset(),r=this.getPositioning();this.setVisible(!0);const o=Math.round(t[0]+s[0])+"px",a=Math.round(t[1]+s[1])+"px";let l="0%",h="0%";r=="bottom-right"||r=="center-right"||r=="top-right"?l="-100%":(r=="bottom-center"||r=="center-center"||r=="top-center")&&(l="-50%"),r=="bottom-left"||r=="bottom-center"||r=="bottom-right"?h="-100%":(r=="center-left"||r=="center-center"||r=="center-right")&&(h="-50%");const c=`translate(${l}, ${h}) translate(${o}, ${a})`;this.rendered.transform_!=c&&(this.rendered.transform_=c,i.transform=c)}getOptions(){return this.options}}const Au=bu;class ri extends Au{constructor(t){var e=t||{};e.autoPan===void 0&&(e.autoPan={animation:{duration:250}});var i=document.createElement("div");e.element=i,super(e),this.container=i,this.container.className="ol-popup",this.closer=document.createElement("a"),this.closer.className="ol-popup-closer",this.closer.href="#",this.container.appendChild(this.closer);var s=this;this.closer.addEventListener("click",function(r){s.container.style.display="none",s.closer.blur(),r.preventDefault()},!1),this.content=document.createElement("div"),this.content.className="ol-popup-content",this.container.appendChild(this.content),ri.enableTouchScroll_(this.content)}show(t,e){return e instanceof HTMLElement?(this.content.innerHTML="",this.content.appendChild(e)):this.content.innerHTML=e,this.container.style.display="block",this.content.scrollTop=0,this.setPosition(t),this}static isTouchDevice_(){try{return document.createEvent("TouchEvent"),!0}catch{return!1}}static enableTouchScroll_(t){if(ri.isTouchDevice_()){var e=0;t.addEventListener("touchstart",function(i){e=this.scrollTop+i.touches[0].pageY},!1),t.addEventListener("touchmove",function(i){this.scrollTop=e-i.touches[0].pageY},!1)}}hide(){return this.container.style.display="none",this}isOpened(){return this.container.style.display=="block"}}window.ol&&window.ol.Overlay&&(window.ol.Overlay.Popup=ri);const Ou="Streets Of Tarkov",Pu="streets_of_tarkov_map.webp",Du=0,Fu=[4197.661354206046,-6.144540226440713],ku=[3793.4236435407015,-6.159675146789232],Nu=[0,0,7620,5877],Gu=3,Wu={MapName:Ou,MapImageFile:Pu,MapRotation:Du,XCoefficients:Fu,ZCoefficients:ku,bounds:Nu,initialZoom:Gu},Xu="Customs Loot",Bu="customs_loot_map.webp",zu=0,Zu=[2732.9161506786527,-3.5663081181666576],Yu=[1032.361207609253,-3.9093873291430583],Vu=[0,0,4097,2142],Ku=3,Uu={MapName:Xu,MapImageFile:Bu,MapRotation:zu,XCoefficients:Zu,ZCoefficients:Yu,bounds:Vu,initialZoom:Ku},$u="Woods",Hu="woods_map.webp",ju=0,qu=[3252.9906914995267,-4.79913682017364],Ju=[2298.038598312056,-4.832134384063305],Qu=[0,0,6994,6843],td=3,ed={MapName:$u,MapImageFile:Hu,MapRotation:ju,XCoefficients:qu,ZCoefficients:Ju,bounds:Qu,initialZoom:td},id="Lighthouse",nd="lighthouse_loot_map.webp",sd=-90,rd=[1093.2324052239378,-2.071213108045849],od=[1433.9007733904355,-2.060136350830603],ad=[0,0,2242,3891],ld=3,hd={MapName:id,MapImageFile:nd,MapRotation:sd,XCoefficients:rd,ZCoefficients:od,bounds:ad,initialZoom:ld},cd="Shoreline",ud="shoreline_map.webp",dd=0,fd=[1805.7042893063785,-3.3843382417716645],gd=[2056.5993628473566,-3.302461486951288],_d=[0,0,6668,4567],md=3,pd={MapName:cd,MapImageFile:ud,MapRotation:dd,XCoefficients:fd,ZCoefficients:gd,bounds:_d,initialZoom:md},yd="Interchange",xd="interchange_map_modified.webp",Ed=0,Cd=[2207.0466279693674,-4.0354940505471735],Id=[1241.4215545544469,-3.024349431071123],Rd=[3749.241922164323,-4.8580938330422425],vd=[1243.8646222369562,-3.640703282748387],Sd=[359.9058928832488,-2.9441812244156975],wd=[680.2782313420158,-2.23713108324646],Td=[0,0,4190,2704],Ld=3,Md={MapName:yd,MapImageFile:xd,MapRotation:Ed,XCoefficients:Cd,ZCoefficients:Id,InteriorFloor2XCoefficients:Rd,InteriorFloor2ZCoefficients:vd,ParkingGarageXCoefficients:Sd,ParkingGarageZCoefficients:wd,bounds:Td,initialZoom:Ld},bd="Reserve",Ad="reserve_map2.webp",Od=-15,Pd=[2023.2594754169422,-5.109575331023586],Dd=[2077.025288738703,-5.105301552064156],Fd=[0,0,5263,3907],kd=3,Nd={MapName:bd,MapImageFile:Ad,MapRotation:Od,XCoefficients:Pd,ZCoefficients:Dd,bounds:Fd,initialZoom:kd},Gd="Laboratory Loot",Wd="laboratory_loot_map_modified.webp",Xd=0,Bd=[1625.3518606902544,-15.25742566200499],zd=[-3634.0838765085923,-16.69684966834031],Zd=[3958.1026747466453,-20.825287173847645],Yd=[-6148.09603885268,-22.86684305773968],Vd=[-1876.990527970124,-17.20918685422704],Kd=[-5057.205361523029,-21.093014235848095],Ud=[0,0,9826,4e3],$d=3,Hd={MapName:Gd,MapImageFile:Wd,MapRotation:Xd,XCoefficients:Bd,ZCoefficients:zd,Floor2XCoefficients:Zd,Floor2ZCoefficients:Yd,TechnicalLevelXCoefficients:Vd,TechnicalLevelZCoefficients:Kd,bounds:Ud,initialZoom:$d},jd="Factory",qd="factory_loot_map.webp",Jd=0,Qd=[3562.6225441386364,6.805260888915667],tf=[1493.926420016474,-4.245237032551324],ef=[0,0,7680,4320],nf=3,Mr={MapName:jd,MapImageFile:qd,MapRotation:Jd,XCoefficients:Qd,ZCoefficients:tf,bounds:ef,initialZoom:nf},sf="Sandbox",rf="ground_zero.webp",of=0,af=[6261.426673481858,-10.792852448092246],lf=[5478.3166785893,-10.798650102958929],hf=[2873.6365652701643,-10.97094689383093],cf=[5479.394707941099,-10.880222425342021],uf=[0,0,8e3,8e3],df=3,ff={MapName:sf,MapImageFile:rf,MapRotation:of,XCoefficients:af,ZCoefficients:lf,UndergroundXCoefficients:hf,UndergroundZCoefficients:cf,bounds:uf,initialZoom:df},gf="Factory",_f="map_not_implemented.webp",mf=0,pf=[3562.6225441386364,6.805260888915667],yf=[1493.926420016474,-4.245237032551324],xf=[0,0,600,400],Ef=3,Cf={MapName:gf,MapImageFile:_f,MapRotation:mf,XCoefficients:pf,ZCoefficients:yf,bounds:xf,initialZoom:Ef};let Yt,If=[0,0,6539,4394],Ye=[-200,-200,6739,4594];const Ve=new es({code:"xkcd-image",units:"pixels",extent:If}),Ee=new ri;let J,ve,Ce,Fo,bn,Ke,An,ji,Xe=[],Ai,qi,ko=[],Oi,zn,br=[];const Rf=new le({image:new Me({anchor:[.5,.5],anchorXUnits:"fraction",anchorYUnits:"fraction",src:"/images/airdrop.png",scale:.5})}),vf=new le({image:new Me({anchor:[.5,.5],anchorXUnits:"fraction",anchorYUnits:"fraction",src:"/images/check-mark.png",scale:.5})});new le({image:new Me({anchor:[.5,.5],anchorXUnits:"fraction",anchorYUnits:"fraction",src:"/images/convergence-target.png",scale:.5})});let Zn=!1,Ar=0,Z="",Or=0,ht=0,yt=0,ee=0,Pr=[];const B={bigmap:Uu,TarkovStreets:Wu,Woods:ed,Lighthouse:hd,Shoreline:pd,Interchange:Md,RezervBase:Nd,laboratory:Hd,factory4_day:Mr,factory4_night:Mr,Sandbox:ff,map_not_implemented:Cf};function Sf(){console.log("init() called"),J=new nc({target:"map",controls:go().extend([new Pf,new Df]),interactions:xo({altShiftDragRotate:!1,pinchRotate:!1}),view:new Rt({projection:Ve,center:jt(Ye),zoom:1,extent:Ye})}),J.addOverlay(Ee),J.on("click",function(e){var i=e.coordinate;console.log(`${ht} ${i[0]} ${yt} ${i[1]}`),console.log(`${ee}`);const s=J.getFeaturesAtPixel(e.pixel,{layerFilter:o=>o===Ai}),r=J.getFeaturesAtPixel(e.pixel,{layerFilter:o=>o===Oi});if(s.length>0){Ee.show(e.coordinate,`${s[0].questName}
${s[0].questDescription}`);return}if(r.length>0){Ee.show(e.coordinate,`Cache

${r[0].cacheHint}`);return}Ee.hide()}),Ke=new ms({geometry:new ln([0,0])});const n=new le({image:new Me({anchor:[.5,.5],anchorXUnits:"fraction",anchorYUnits:"fraction",src:"/images/plain-arrow.png",scale:.5})});Ke.setStyle(n);const t=new bi({features:[Ke]});bn=new Mi({source:t}),bn.setZIndex(99),J.addLayer(bn),ji=new bi({features:[]}),An=new Mi({source:ji}),An.setZIndex(98),J.addLayer(An),qi=new bi({features:[]}),Ai=new Mi({source:qi}),Ai.setZIndex(98),J.addLayer(Ai),zn=new bi({features:[]}),Oi=new Mi({source:zn}),Oi.setZIndex(98),J.addLayer(Oi),Mf(),Ce=new eo({source:new So({url:"/maps/enter_a_raid.png",projection:Ve,imageExtent:[0,0,600,400]})}),J.addLayer(Ce),ve=new Rt({projection:Ve,center:[-100,-100,700,500],showFullExtent:!0,zoom:3,extent:[0,0,600,400],rotation:0}),J.setView(ve)}function wf(n){console.log("Changing map to:",n),Ce&&J.removeLayer(Ce),B[n]===null&&(n="map_not_implemented"),Ce=new eo({source:new So({url:`/maps/${B[n].MapImageFile}`,projection:Ve,imageExtent:B[n].bounds})}),J.addLayer(Ce),Ye=[B[n].bounds[2]*-.1,B[n].bounds[2]*-.1,B[n].bounds[2]*1.1,B[n].bounds[3]*1.1],ve=new Rt({projection:Ve,center:jt(Ye),showFullExtent:!0,zoom:B[n].initialZoom,extent:[0,0,B[n].bounds[2],B[n].bounds[3]],rotation:B[n].MapRotation*(Math.PI/180)}),ve.fit(Ye,J.getSize()),J.setView(ve),br.forEach(t=>{zn.removeFeature(t)}),br=[],Fo=n}function Tf(n,t){const e=new ms({geometry:new ln([n,t])});e.setStyle(Rf),ji.addFeature(e),Xe.push(e)}function Lf(n,t,e,i){const s=new ms({geometry:new ln([n,t])});s.setStyle(vf),s.questName=e,s.questDescription=i,qi.addFeature(s),ko.push(s)}function Mf(){try{Yt=new WebSocket("ws://"+location.host+"/"),Yt.onopen=function(n){Af(n)},Yt.onclose=function(n){Of(n)},Yt.onmessage=function(n){bf(n)},Yt.onerror=function(n){Dr(n)}}catch(n){Dr(n)}}function bf(n){try{let i=JSON.parse(n.data);if(i.msgType==="mapData"){Z=i.mapName,Or=i.playerRotationX,ht=i.playerPositionX,yt=i.playerPositionZ,ee=i.playerPositionY;let s=i.lastQuestChangeTime;Pr!==s&&(console.log("Updating with new quest data."),Yt.send(JSON.stringify({type:"getQuestData"}))),Ar{ji.removeFeature(a)}),Xe=[]),Xe.length!Xe.includes(l)).forEach(l=>{let h=st(l.x,B[Z].XCoefficients),c=st(l.z,B[Z].ZCoefficients);Tf(h,c)}),Fo!==Z&&wf(Z);let r=st(ht,B[Z].XCoefficients),o=st(yt,B[Z].ZCoefficients);Z==="Interchange"?(ht<83&&ht>-157.8&&yt<193.2&&yt>-303.87||ht<-157.8&&ht>-183.4&&yt<69&&yt>-178.66)&&(ee<23?(r=st(ht,B[Z].ParkingGarageXCoefficients),o=st(yt,B[Z].ParkingGarageZCoefficients)):ee>32&&(r=st(ht,B[Z].InteriorFloor2XCoefficients),o=st(yt,B[Z].InteriorFloor2ZCoefficients))):Z==="laboratory"?ee>3?(r=st(ht,B[Z].Floor2XCoefficients),o=st(yt,B[Z].Floor2ZCoefficients)):ee<-2&&(r=st(ht,B[Z].TechnicalLevelXCoefficients),o=st(yt,B[Z].TechnicalLevelZCoefficients)):Z==="Sandbox"?ee<15&&ht<144&&ht>50&&(r=st(ht,B[Z].UndergroundXCoefficients),o=st(yt,B[Z].UndergroundZCoefficients)):(Z==="factory4_day"||Z==="factory4_night")&&(r=-50,o=-50),Ke.getGeometry().setCoordinates([r,o]),Ke.getStyle().getImage().setRotation((B[Z].MapRotation+Or)*(Math.PI/180)),Zn&&ve.setCenter([r,o]),Ar=i.raidCounter}else if(i.msgType==="questData")console.log("Received questData message. Redrawing quest markers."),console.log("incomingMessageJSON",i),Pr=i.newQuestUpdateTime,ko.forEach(s=>{qi.removeFeature(s)}),i.quests.forEach(s=>{let r=st(s.Location.x,B[Z].XCoefficients),o=st(s.Location.z,B[Z].ZCoefficients);Lf(r,o,s.NameText,s.Description)});else if(i.msgType==="connectAddress"){var t=i.ipAddress;console.log("Got connect address:",t);var e=`http://${t}:${location.port}/index.html`;Ee.show(J.getView().getCenter(),`
${e}
`);const s=new QRCode(document.getElementById("qr-code"),{text:e,width:100,height:100})}else console.log("Unknown message type:",i.msgType)}catch(i){console.error(i)}}function Af(n){console.log("Opened websocket")}function Of(n){console.log("Websocket closed"),console.log(n)}function Dr(n){console.error(n),Ee.show(J.getView().getCenter(),'
Failed to connect to SPT-AKI mod.
Please check the LogOutput.log in your SPT BepInEx folder.
'),Yt.close()}function st(n,t){let e=0;return e=t[0],e+=t[1]*n,e}class Pf extends li{constructor(t){const e=t||{},i=document.createElement("button");i.className="custom-control-button";const s=document.createElement("div");s.className="follow-player ol-unselectable ol-control",s.appendChild(i),super({element:s,target:e.target}),i.addEventListener("click",this.toggleShouldFollowPlayer.bind(this),!1)}toggleShouldFollowPlayer(){Zn=!Zn}}class Df extends li{constructor(t){const e=t||{},i=document.createElement("button");i.className="custom-control-button";const s=document.createElement("div");s.className="qr-code-button ol-unselectable ol-control",s.appendChild(i),super({element:s,target:e.target}),i.addEventListener("click",this.showQRCode.bind(this),!1)}showQRCode(){console.log("Showing QR Code"),Yt.send(JSON.stringify({type:"getConnectAddress"}))}}window.init=Sf; //# sourceMappingURL=index-d733604d.js.map