t?t-l:r,x=s+h>e?e-h:s,v=p[3]+_*c[0]+p[1],w=p[0]+x*c[1]+p[2],b=m-p[3],S=y-p[0];let T;return(f||0!==u)&&(Ml[0]=b,Fl[0]=b,Ml[1]=S,Il[1]=S,Il[0]=b+v,kl[0]=Il[0],kl[1]=S+w,Fl[1]=kl[1]),0!==u?(T=qn([1,0,0,1,0,0],i,n,1,1,u,-i,-n),Un(T,Ml),Un(T,Il),Un(T,kl),Un(T,Fl),ge(Math.min(Ml[0],Il[0],kl[0],Fl[0]),Math.min(Ml[1],Il[1],kl[1],Fl[1]),Math.max(Ml[0],Il[0],kl[0],Fl[0]),Math.max(Ml[1],Il[1],kl[1],Fl[1]),Rl)):ge(Math.min(b,b+v),Math.min(S,S+w),Math.max(b,b+v),Math.max(S,S+w),Rl),d&&(m=Math.round(m),y=Math.round(y)),{drawImageX:m,drawImageY:y,drawImageW:_,drawImageH:x,originX:l,originY:h,declutterBox:{minX:Rl[0],minY:Rl[1],maxX:Rl[2],maxY:Rl[3],value:g},canvasTransform:T,scale:c}}replayImageOrLabel_(t,e,i,n,r,s,o){const a=!(!s&&!o),l=n.declutterBox,h=o?o[2]*n.scale[0]/2:0;return l.minX-h<=e[0]&&l.maxX+h>=0&&l.minY-h<=e[1]&&l.maxY+h>=0&&(a&&this.replayTextBackground_(t,Ml,Il,kl,Fl,s,o),Bt(t,n.canvasTransform,r,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const i=Un(this.renderedTransform_,[0,0]),n=512*this.pixelRatio;t.save(),t.translate(i[0]%n,i[1]%n),1!==e&&t.scale(e,e),t.rotate(this.viewRotation_)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6])}drawLabelWithPointPlacement_(t,e,i,n){const r=this.textStates[e],s=this.createLabel(t,e,n,i),o=this.strokeStates[i],a=this.pixelRatio,l=Pl(Array.isArray(t)?t[0]:t,r.textAlign||Dt),h=wl[r.textBaseline||Pt],u=o&&o.lineWidth?o.lineWidth:0;return{label:s,anchorX:l*(s.width/a-2*r.scale[0])+2*(.5-l)*u,anchorY:h*s.height/a+2*(.5-h)*u}}execute_(t,e,i,n,r,s,o,a){const l=this.zIndexContext_;let h;var u,c;this.pixelCoordinates_&&K(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=li(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),u=this.renderedTransform_,c=i,u[0]=c[0],u[1]=c[1],u[2]=c[2],u[3]=c[3],u[4]=c[4],u[5]=c[5]);let d=0;const p=n.length;let f,g,m,y,_,x,v,w,b,S,T,C,E,R=0,M=0,I=0,k=null,F=null;const A=this.coordinateCache_,D=this.viewRotation_,P=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,L={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:D},z=this.instructions!=n||this.overlaps?0:200;let O,G,X,j;for(;dz&&(this.fill_(t),M=0),I>z&&(t.stroke(),I=0),M||I||(t.beginPath(),_=NaN,x=NaN),++d;break;case fl.CIRCLE:R=i[1];const n=h[R],u=h[R+1],c=h[R+2]-n,p=h[R+3]-u,N=Math.sqrt(c*c+p*p);t.moveTo(n+N,u),t.arc(n,u,N,0,2*Math.PI,!0),++d;break;case fl.CLOSE_PATH:t.closePath(),++d;break;case fl.CUSTOM:R=i[1],f=i[2];const W=i[3],Y=i[4],U=i[5];L.geometry=W,L.feature=O,d in A||(A[d]=[]);const B=A[d];U?U(h,R,f,2,B):(B[0]=h[R],B[1]=h[R+1],B.length=2),l&&(l.zIndex=i[6]),Y(B,L),++d;break;case fl.DRAW_IMAGE:R=i[1],f=i[2],b=i[3],g=i[4],m=i[5];let q=i[6];const Z=i[7],$=i[8],V=i[9],K=i[10];let H=i[11];const J=i[12];let Q=i[13];y=i[14]||"declutter";const tt=i[15];if(!b&&i.length>=20){S=i[19],T=i[20],C=i[21],E=i[22];const t=this.drawLabelWithPointPlacement_(S,T,C,E);b=t.label,i[3]=b;const e=i[23];g=(t.anchorX-e)*this.pixelRatio,i[4]=g;const n=i[24];m=(t.anchorY-n)*this.pixelRatio,i[5]=m,q=b.height,i[6]=q,Q=b.width,i[13]=Q}let et,it,nt,rt;i.length>25&&(et=i[25]),i.length>17?(it=i[16],nt=i[17],rt=i[18]):(it=Lt,nt=!1,rt=!1),K&&P?H+=D:K||P||(H-=D);let st=0;for(;R!Gl.includes(t)));const Xl={};var jl=class{constructor(t,e,i,n,r,s,o){this.maxExtent_=t,this.overlaps_=n,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=s,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=[1,0,0,1,0,0],this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(r,o)}clip(t,e){const i=this.getClipCoords(e);t.beginPath(),t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3]),t.lineTo(i[4],i[5]),t.lineTo(i[6],i[7]),t.clip()}createExecutors_(t,e){for(const i in t){let n=this.executorsByZIndex_[i];void 0===n&&(n={},this.executorsByZIndex_[i]=n);const r=t[i];for(const t in r){const i=r[t];n[t]=new zl(this.resolution_,this.pixelRatio_,this.overlaps_,i,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const i=this.executorsByZIndex_[e];for(let e=0,n=t.length;ei)break;let a=n[o];a||(a=[],n[o]=a),a.push(4*((t+r)*e+(t+s))+3),r>0&&a.push(4*((t-r)*e+(t+s))+3),s>0&&(a.push(4*((t+r)*e+(t-s))+3),r>0&&a.push(4*((t-r)*e+(t-s))+3))}const r=[];for(let t=0,e=n.length;t0){if(!s||"none"===i||"Image"!==d&&"Text"!==d||s.includes(t)){const i=(c[l]-3)/4,s=n-i%o,a=n-(i/o|0),h=r(t,e,s*s+a*a);if(h)return h}h.clearRect(0,0,o,o);break}}const f=Object.keys(this.executorsByZIndex_).map(Number);let g,m,y,_,x;for(f.sort(B),g=f.length-1;g>=0;--g){const t=f[g].toString();for(y=this.executorsByZIndex_[t],m=Ol.length-1;m>=0;--m)if(d=Ol[m],_=y[d],void 0!==_&&(x=_.executeHitDetection(h,a,i,p,u),x))return x}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],n=e[1],r=e[2],s=e[3],o=[i,n,i,s,r,s,r,n];return li(o,0,8,2,t,o),o}isEmpty(){return et(this.executorsByZIndex_)}execute(t,e,i,n,r,s,o){const a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(o?q:B),s=s||Ol;const l=Ol.length;for(let h=0,u=a.length;hp.execute(t,e,i,n,r,o))):p.execute(c,e,i,n,r,o),f&&c.restore(),s){s.offset();const t=a[h]*l+u;this.deferredZIndexContexts_[t]||(this.deferredZIndexContexts_[t]=[]),this.deferredZIndexContexts_[t].push(s)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(B);for(let i=0,n=e.length;i{t.draw(this.renderedContext_),t.clear()})),t[e[i]].length=0}};var Nl=class extends ll{constructor(t,e,i,n,r,s,o){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=n,this.transformRotation_=n?v(Math.atan2(n[1],n[0]),10):0,this.viewRotation_=r,this.squaredTolerance_=s,this.userTransform_=o,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=[1,0,0,1,0,0]}drawImages_(t,e,i,n){if(!this.image_)return;const r=li(t,e,i,n,this.transform_,this.pixelCoordinates_),s=this.context_,o=this.tmpLocalTransform_,a=s.globalAlpha;1!=this.imageOpacity_&&(s.globalAlpha=a*this.imageOpacity_);let l=this.imageRotation_;0===this.transformRotation_&&(l-=this.viewRotation_),this.imageRotateWithView_&&(l+=this.viewRotation_);for(let t=0,e=r.length;tt*this.pixelRatio_)),lineDashOffset:(r||0)*this.pixelRatio_,lineJoin:void 0!==s?s:Ft,lineWidth:(void 0!==o?o:1)*this.pixelRatio_,miterLimit:void 0!==a?a:10,strokeStyle:gt(t||At)}}else this.strokeState_=null}setImageStyle(t){let e;if(!t||!(e=t.getSize()))return void(this.image_=null);const i=t.getPixelRatio(this.pixelRatio_),n=t.getAnchor(),r=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*i,this.imageAnchorY_=n[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=r[0],this.imageOriginY_=r[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const s=t.getScaleArray();this.imageScale_=[s[0]*this.pixelRatio_/i,s[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(t){const e=t.getFill();if(e){const t=e.getColor();this.textFillState_={fillStyle:gt(t||Mt)}}else this.textFillState_=null;const i=t.getStroke();if(i){const t=i.getColor(),e=i.getLineCap(),n=i.getLineDash(),r=i.getLineDashOffset(),s=i.getLineJoin(),o=i.getWidth(),a=i.getMiterLimit();this.textStrokeState_={lineCap:void 0!==e?e:It,lineDash:n||kt,lineDashOffset:r||0,lineJoin:void 0!==s?s:Ft,lineWidth:void 0!==o?o:1,miterLimit:void 0!==a?a:10,strokeStyle:gt(t||At)}}else this.textStrokeState_=null;const n=t.getFont(),r=t.getOffsetX(),s=t.getOffsetY(),o=t.getRotateWithView(),a=t.getRotation(),l=t.getScaleArray(),h=t.getText(),u=t.getTextAlign(),c=t.getTextBaseline();this.textState_={font:void 0!==n?n:Rt,textAlign:void 0!==u?u:Dt,textBaseline:void 0!==c?c:Pt},this.text_=void 0!==h?Array.isArray(h)?h.reduce(((t,e,i)=>t+(i%2?" ":e)),""):h:"",this.textOffsetX_=void 0!==r?this.pixelRatio_*r:0,this.textOffsetY_=void 0!==s?this.pixelRatio_*s:0,this.textRotateWithView_=void 0!==o&&o,this.textRotation_=void 0!==a?a:0,this.textScale_=[this.pixelRatio_*l[0],this.pixelRatio_*l[1]]}else this.text_=""}};const Wl=.5;function Yl(t,e,i,n,r,s,o,a,l){const h=l?Ln(r,l):r,u=O(t[0]*Wl,t[1]*Wl);u.imageSmoothingEnabled=!1;const c=u.canvas,d=new Nl(u,Wl,r,null,o,a,l?En(An(),l):null),p=i.length,f=Math.floor(16777215/p),g={};for(let t=1;t<=p;++t){const e=i[t-1],r=e.getStyleFunction()||n;if(!r)continue;let o=r(e,s);if(!o)continue;Array.isArray(o)||(o=[o]);const a=(t*f).toString(16).padStart(7,"#00000");for(let t=0,i=o.length;t0;return d&&Promise.all(h).then((()=>s(null))),function(t,e,i,n,r,s,o){const a=i.getGeometryFunction()(e);if(!a)return;const l=a.simplifyTransformed(n,r),h=i.getRenderer();if(h)Kl(t,l,i,e,o);else{(0,ql[l.getType()])(t,l,i,e,o,s)}}(t,e,n,r,o,a,l),d}function Kl(t,e,i,n,r){if("GeometryCollection"==e.getType()){const s=e.getGeometries();for(let e=0,o=s.length;ethis.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(t){return xt()}getData(t){return null}prepareFrame(t){return xt()}renderFrame(t,e){return xt()}forEachFeatureAtCoordinate(t,e,i,n,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;e.getState()!==i.LOADED&&e.getState()!==i.ERROR||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=i.LOADED&&e!=i.ERROR&&t.addEventListener(N,this.boundHandleImageChange_),e==i.IDLE&&(t.load(),e=t.getState()),e==i.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}};let Jl=null;var Ql=class extends Hl{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=[1,0,0,1,0,0],this.pixelTransform=[1,0,0,1,0,0],this.inversePixelTransform=[1,0,0,1,0,0],this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,i){let n;Jl||(Jl=O(1,1,void 0,{willReadFrequently:!0})),Jl.clearRect(0,0,1,1);try{Jl.drawImage(t,e,i,1,1,0,0,1,1),n=Jl.getImageData(0,0,1,1).data}catch{return Jl=null,null}return n}getBackground(t){let e=this.getLayer().getBackground();return"function"==typeof e&&(e=e(t.viewState.resolution)),e||void 0}useContainer(t,e,i){const n=this.getLayer().getClassName();let r,s;if(t&&t.className===n&&(!i||t&&t.style.backgroundColor&&K(F(t.style.backgroundColor),F(i)))){const e=t.firstElementChild;e instanceof HTMLCanvasElement&&(s=e.getContext("2d"))}if(s&&s.canvas.style.transform===e?(this.container=t,this.context=s,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){r=document.createElement("div"),r.className=n;let t=r.style;t.position="absolute",t.width="100%",t.height="100%",s=O();const e=s.canvas;r.appendChild(e),t=e.style,t.position="absolute",t.left="0",t.transformOrigin="top left",this.container=r,this.context=s}this.containerReused||!i||this.container.style.backgroundColor||(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const n=Pe(i),r=Le(i),s=Re(i),o=Ee(i);Un(e.coordinateToPixelTransform,n),Un(e.coordinateToPixelTransform,r),Un(e.coordinateToPixelTransform,s),Un(e.coordinateToPixelTransform,o);const a=this.inversePixelTransform;Un(a,n),Un(a,r),Un(a,s),Un(a,o),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.clip()}prepareContainer(t,e){const i=t.extent,n=t.viewState.resolution,r=t.viewState.rotation,s=t.pixelRatio,o=Math.round(ze(i)/n*s),a=Math.round(Ae(i)/n*s);qn(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/s,1/s,r,-o/2,-a/2),Zn(this.inversePixelTransform,this.pixelTransform);const l=Vn(this.pixelTransform);if(this.useContainer(e,l,this.getBackground(t)),!this.containerReused){const t=this.context.canvas;t.width!=o||t.height!=a?(t.width=o,t.height=a):this.context.clearRect(0,0,o,a),l!==t.style.transform&&(t.style.transform=l)}}dispatchRenderEvent_(t,e,i){const n=this.getLayer();if(n.hasListener(t)){const r=new Ca(t,this.inversePixelTransform,i,e);n.dispatchEvent(r)}}preRender(t,e){this.frameState=e,e.declutter||this.dispatchRenderEvent_(xs,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(vs,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new El),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(xs,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(vs,this.context,t))}getRenderTransform(t,e,i,n,r,s,o){const a=r/2,l=s/2,h=n/e,u=-h,c=-t[0]+o,d=-t[1];return qn(this.tempTransform,a,l,h,u,-i,c,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}};let th=!1;function eh(t,e,i,n,r,s,o){const a=new XMLHttpRequest;a.open("GET","function"==typeof t?t(i,n,r):t,!0),"arraybuffer"==e.getType()&&(a.responseType="arraybuffer"),a.withCredentials=th,a.onload=function(t){if(!a.status||a.status>=200&&a.status<300){const t=e.getType();try{let n;"text"==t||"json"==t?n=a.responseText:"xml"==t?n=a.responseXML||a.responseText:"arraybuffer"==t&&(n=a.response),n?s(e.readFeatures(n,{extent:i,featureProjection:r}),e.readProjection(n)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function ih(t){return t instanceof Image||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageBitmap?t:null}const nh=new Error("disposed");let rh=null;const sh=[256,256];var oh=class extends dr{constructor(t){const e=lr.IDLE;super(t.tileCoord,e,{transition:t.transition,interpolate:t.interpolate}),this.loader_=t.loader,this.data_=null,this.error_=null,this.size_=t.size||null,this.controller_=t.controller||null}getSize(){if(this.size_)return this.size_;const t=ih(this.data_);return t?[t.width,t.height]:sh}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==lr.IDLE&&this.state!==lr.ERROR)return;this.state=lr.LOADING,this.changed();const t=this;this.loader_().then((function(e){t.data_=e,t.state=lr.LOADED,t.changed()})).catch((function(e){t.error_=e,t.state=lr.ERROR,t.changed()}))}disposeInternal(){this.controller_&&(this.controller_.abort(nh),this.controller_=null),super.disposeInternal()}};function ah(t,e,i,n,r,s,o){const a=1/(t-e),l=1/(i-n),h=1/(r-s);return(o=o??[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])[0]=-2*a,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=-2*l,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=2*h,o[11]=0,o[12]=(t+e)*a,o[13]=(n+i)*l,o[14]=(s+r)*h,o[15]=1,o}function lh(t,e,i,n,r){return(r=r??[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])[0]=t[0]*e,r[1]=t[1]*e,r[2]=t[2]*e,r[3]=t[3]*e,r[4]=t[4]*i,r[5]=t[5]*i,r[6]=t[6]*i,r[7]=t[7]*i,r[8]=t[8]*n,r[9]=t[9]*n,r[10]=t[10]*n,r[11]=t[11]*n,r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r}class hh{constructor(t){this.gl_=t,this.program_=ch(t,"\n precision mediump float;\n\n varying vec2 v_texcoord;\n\n uniform sampler2D u_texture;\n\n void main() {\n if (\n v_texcoord.x < 0.0 ||\n v_texcoord.y < 0.0 ||\n v_texcoord.x > 1.0 ||\n v_texcoord.y > 1.0\n ) {\n discard;\n }\n gl_FragColor = texture2D(u_texture, v_texcoord);\n }\n","\n attribute vec4 a_position;\n attribute vec4 a_texcoord;\n\n uniform mat4 u_matrix;\n uniform mat4 u_textureMatrix;\n\n varying vec2 v_texcoord;\n\n void main() {\n gl_Position = u_matrix * a_position;\n vec2 texcoord = (u_textureMatrix * a_texcoord).xy;\n v_texcoord = texcoord;\n }\n"),this.positionLocation=t.getAttribLocation(this.program_,"a_position"),this.texcoordLocation=t.getAttribLocation(this.program_,"a_texcoord"),this.matrixLocation=t.getUniformLocation(this.program_,"u_matrix"),this.textureMatrixLocation=t.getUniformLocation(this.program_,"u_textureMatrix"),this.textureLocation=t.getUniformLocation(this.program_,"u_texture"),this.positionBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),this.positions=[0,0,0,1,1,0,1,0,0,1,1,1],t.bufferData(t.ARRAY_BUFFER,new Float32Array(this.positions),t.STATIC_DRAW),this.texcoordBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this.texcoordBuffer),this.texcoords=[0,0,0,1,1,0,1,0,0,1,1,1],t.bufferData(t.ARRAY_BUFFER,new Float32Array(this.texcoords),t.STATIC_DRAW)}drawImage(t,e,i,n,r,s,o,a,l,h,u,c,d){const p=this.gl_;void 0===a&&(a=n),void 0===l&&(l=r),void 0===s&&(s=e),void 0===o&&(o=i),void 0===h&&(h=s),void 0===u&&(u=o),void 0===c&&(c=p.canvas.width),void 0===d&&(d=p.canvas.height),p.bindTexture(p.TEXTURE_2D,t),p.useProgram(this.program_),p.bindBuffer(p.ARRAY_BUFFER,this.positionBuffer),p.enableVertexAttribArray(this.positionLocation),p.vertexAttribPointer(this.positionLocation,2,p.FLOAT,!1,0,0),p.bindBuffer(p.ARRAY_BUFFER,this.texcoordBuffer),p.enableVertexAttribArray(this.texcoordLocation),p.vertexAttribPointer(this.texcoordLocation,2,p.FLOAT,!1,0,0);let f=ah(0,c,0,d,-1,1);f=function(t,e,i,n,r){let s,o,a,l,h,u,c,d,p,f,g,m;return t===(r=r??[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])?(r[12]=t[0]*e+t[4]*i+t[8]*n+t[12],r[13]=t[1]*e+t[5]*i+t[9]*n+t[13],r[14]=t[2]*e+t[6]*i+t[10]*n+t[14],r[15]=t[3]*e+t[7]*i+t[11]*n+t[15]):(s=t[0],o=t[1],a=t[2],l=t[3],h=t[4],u=t[5],c=t[6],d=t[7],p=t[8],f=t[9],g=t[10],m=t[11],r[0]=s,r[1]=o,r[2]=a,r[3]=l,r[4]=h,r[5]=u,r[6]=c,r[7]=d,r[8]=p,r[9]=f,r[10]=g,r[11]=m,r[12]=s*e+h*i+p*n+t[12],r[13]=o*e+u*i+f*n+t[13],r[14]=a*e+c*i+g*n+t[14],r[15]=l*e+d*i+m*n+t[15]),r}(f,a,l,0),f=lh(f,h,u,1),p.uniformMatrix4fv(this.matrixLocation,!1,f);let g=(m=n/e,y=r/i,_=0,(x=x??[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])[0]=1,x[1]=0,x[2]=0,x[3]=0,x[4]=0,x[5]=1,x[6]=0,x[7]=0,x[8]=0,x[9]=0,x[10]=1,x[11]=0,x[12]=m,x[13]=y,x[14]=_,x[15]=1,x);var m,y,_,x;g=lh(g,s/e,o/i,1),p.uniformMatrix4fv(this.textureMatrixLocation,!1,g),p.uniform1i(this.textureLocation,0),p.drawArrays(p.TRIANGLES,0,this.positions.length/2)}}function uh(t,e,i){const n=t.createShader(e);if(null===n)throw new Error("Shader compilation failed");if(t.shaderSource(n,i),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS)){const e=t.getShaderInfoLog(n);if(null===e)throw new Error("Shader info log creation failed");throw new Error(e)}return n}function ch(t,e,i){const n=t.createProgram(),r=uh(t,t.VERTEX_SHADER,i),s=uh(t,t.FRAGMENT_SHADER,e);if(null===n)throw new Error("Program creation failed");if(t.attachShader(n,r),t.attachShader(n,s),t.linkProgram(n),!t.getProgramParameter(n,t.LINK_STATUS)){if(null===t.getProgramInfoLog(n))throw new Error("Program info log creation failed");throw new Error}return n}const dh=[];function ph(t,e,i,n,r,s,o,a,l,h,u,c,d,p){const f=Math.round(n*e),g=Math.round(n*i);let m,y;if(t.canvas.width=f,t.canvas.height=g,y=t.createTexture(),t.bindTexture(t.TEXTURE_2D,y),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),d?(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR)):(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST)),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,f,g,0,t.RGBA,u,null),m=t.createFramebuffer(),t.bindFramebuffer(t.FRAMEBUFFER,m),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,y,0),null===m)throw new Error("Could not create framebuffer");if(null===y)throw new Error("Could not create texture");if(0===l.length)return{width:f,height:g,framebuffer:m,texture:y};const _=[1/0,1/0,-1/0,-1/0];let x,v,w;l.forEach((function(t,e,i){ve(_,t.extent)}));const b=1/r;if(p&&1===l.length&&0===h)x=l[0].texture,v=l[0].width,w=l[0].width;else{if(x=t.createTexture(),null===y)throw new Error("Could not create texture");v=Math.round(ze(_)*b),w=Math.round(Ae(_)*b);const e=t.getParameter(t.MAX_TEXTURE_SIZE),i=Math.max(v,w),n=i>e?e/i:1,r=Math.round(v*n),s=Math.round(w*n);t.bindTexture(t.TEXTURE_2D,x),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),d?(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR)):(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST)),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,r,s,0,t.RGBA,u,null);const o=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,o),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,x,0);const a=new hh(t);l.forEach((function(e,i,l){const u=(e.extent[0]-_[0])*b*n,c=-(e.extent[3]-_[3])*b*n,p=ze(e.extent)*b*n,f=Ae(e.extent)*b*n;if(t.bindFramebuffer(t.FRAMEBUFFER,o),t.viewport(0,0,r,s),e.clipExtent){const i=(e.clipExtent[0]-_[0])*b*n,r=-(e.clipExtent[3]-_[3])*b*n,s=ze(e.clipExtent)*b*n,o=Ae(e.clipExtent)*b*n;t.enable(t.SCISSOR_TEST),t.scissor(d?i:Math.round(i),d?r:Math.round(r),d?s:Math.round(i+s)-Math.round(i),d?o:Math.round(r+o)-Math.round(r))}a.drawImage(e.texture,e.width,e.height,h,h,e.width-2*h,e.height-2*h,d?u:Math.round(u),d?c:Math.round(c),d?p:Math.round(u+p)-Math.round(u),d?f:Math.round(c+f)-Math.round(c),r,s),t.disable(t.SCISSOR_TEST)})),t.deleteFramebuffer(o)}const S=Pe(o),T=Pe(_),C=t=>{const e=(t[0][0]-S[0])/s*n,i=-(t[0][1]-S[1])/s*n;return{u1:(t[1][0]-S[0])/s*n,v1:-(t[1][1]-S[1])/s*n,u0:e,v0:i,u2:(t[2][0]-S[0])/s*n,v2:-(t[2][1]-S[1])/s*n}};t.bindFramebuffer(t.FRAMEBUFFER,m),t.viewport(0,0,f,g);{const e=[],i=[],n=ch(t,"\n precision mediump float;\n\n varying vec2 v_texcoord;\n\n uniform sampler2D u_texture;\n\n void main() {\n if (v_texcoord.x < 0.0 || v_texcoord.x > 1.0 || v_texcoord.y < 0.0 || v_texcoord.y > 1.0) {\n discard;\n }\n gl_FragColor = texture2D(u_texture, v_texcoord);\n }\n","\n attribute vec4 a_position;\n attribute vec2 a_texcoord;\n\n varying vec2 v_texcoord;\n\n uniform mat4 u_matrix;\n\n void main() {\n gl_Position = u_matrix * a_position;\n v_texcoord = a_texcoord;\n }\n");t.useProgram(n);const s=t.getUniformLocation(n,"u_texture");t.bindTexture(t.TEXTURE_2D,x),t.uniform1i(s,0),a.getTriangles().forEach((function(t,n,s){const o=t.source,a=t.target,{u1:l,v1:h,u0:u,v0:c,u2:d,v2:p}=C(a),f=(o[0][0]-T[0])/r/v,g=-(o[0][1]-T[1])/r/w,m=(o[1][0]-T[0])/r/v,y=-(o[1][1]-T[1])/r/w,_=(o[2][0]-T[0])/r/v,x=-(o[2][1]-T[1])/r/w;e.push(l,h,u,c,d,p),i.push(m,y,f,g,_,x)}));const o=ah(0,f,g,0,-1,1),l=t.getUniformLocation(n,"u_matrix");t.uniformMatrix4fv(l,!1,o);const h=t.getAttribLocation(n,"a_position"),u=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,u),t.bufferData(t.ARRAY_BUFFER,new Float32Array(e),t.STATIC_DRAW),t.vertexAttribPointer(h,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(h);const c=t.getAttribLocation(n,"a_texcoord"),d=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,d),t.bufferData(t.ARRAY_BUFFER,new Float32Array(i),t.STATIC_DRAW),t.vertexAttribPointer(c,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(c),t.drawArrays(t.TRIANGLES,0,e.length/2)}if(c){const e=ch(t,"\n precision mediump float;\n\n uniform vec4 u_val;\n void main() {\n gl_FragColor = u_val;\n }\n","\n attribute vec4 a_position;\n\n uniform mat4 u_matrix;\n\n void main() {\n gl_Position = u_matrix * a_position;\n }\n");t.useProgram(e);const i=ah(0,f,g,0,-1,1),n=t.getUniformLocation(e,"u_matrix");t.uniformMatrix4fv(n,!1,i);const r=Array.isArray(c)?c:[0,0,0,255],s=t.getUniformLocation(e,"u_val");!0?t.uniform4fv(s,r):t.uniform4iv(s,r);const o=t.getAttribLocation(e,"a_position"),l=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,l),t.vertexAttribPointer(o,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(o);const h=a.getTriangles().reduce((function(t,e){const i=e.target,{u1:n,v1:r,u0:s,v0:o,u2:a,v2:l}=C(i);return t.concat([n,r,s,o,s,o,a,l,a,l,n,r])}),[]);t.bufferData(t.ARRAY_BUFFER,new Float32Array(h),t.STATIC_DRAW),t.drawArrays(t.LINES,0,h.length/2)}return{width:f,height:g,framebuffer:m,texture:y}}var fh=class extends oh{constructor(t){super({tileCoord:t.tileCoord,loader:()=>Promise.resolve(new Uint8ClampedArray(4)),interpolate:t.interpolate,transition:t.transition}),this.renderEdges_=void 0!==t.renderEdges&&t.renderEdges,this.pixelRatio_=t.pixelRatio,this.gutter_=t.gutter,this.reprojData_=null,this.reprojError_=null,this.reprojSize_=void 0,this.sourceTileGrid_=t.sourceTileGrid,this.targetTileGrid_=t.targetTileGrid,this.wrappedTileCoord_=t.wrappedTileCoord||t.tileCoord,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;const e=t.sourceProj,i=e.getExtent(),n=t.sourceTileGrid.getExtent();this.clipExtent_=e.canWrapX()?n?De(i,n):i:n;const r=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_),s=this.targetTileGrid_.getExtent();let o=this.sourceTileGrid_.getExtent();const a=s?De(r,s):r;if(0===Ce(a))return void(this.state=lr.EMPTY);i&&(o=o?De(o,i):i);const l=this.targetTileGrid_.getResolution(this.wrappedTileCoord_[0]),h=t.targetProj,u=Ha(e,h,a,l);if(!isFinite(u)||u<=0)return void(this.state=lr.EMPTY);const c=void 0!==t.errorThreshold?t.errorThreshold:.5;if(this.triangulation_=new Qa(e,h,a,o,u*c,l,t.transformMatrix),0===this.triangulation_.getTriangles().length)return void(this.state=lr.EMPTY);this.sourceZ_=this.sourceTileGrid_.getZForResolution(u);let d=this.triangulation_.calculateSourceExtent();if(o&&(e.canWrapX()?(d[1]=p(d[1],o[1],o[3]),d[3]=p(d[3],o[1],o[3])):d=De(d,o)),Ce(d)){let n=0,r=0;e.canWrapX()&&(n=ze(i),r=Math.floor((d[0]-i[0])/n));Ne(d.slice(),e,!0).forEach((e=>{const i=this.sourceTileGrid_.getTileRangeForExtentAndZ(e,this.sourceZ_),s=t.getTileFunction;for(let t=i.minX;t<=i.maxX;t++)for(let e=i.minY;e<=i.maxY;e++){const i=s(this.sourceZ_,t,e,this.pixelRatio_);if(i){const t=r*n;this.sourceTiles_.push({tile:i,offset:t})}}++r})),0===this.sourceTiles_.length&&(this.state=lr.EMPTY)}else this.state=lr.EMPTY}getSize(){return this.reprojSize_}getData(){return this.reprojData_}getError(){return this.reprojError_}reproject_(){const t=[];let e=!1;if(this.sourceTiles_.forEach((i=>{const n=i.tile;if(!n||n.getState()!==lr.LOADED)return;const r=n.getSize(),s=this.gutter_;let o;const a=(l=n.getData())instanceof Uint8Array||l instanceof Uint8ClampedArray||l instanceof Float32Array||l instanceof DataView?l:null;var l;a?o=a:(e=!0,o=function(t){rh||(rh=O(t.width,t.height,void 0,{willReadFrequently:!0}));const e=rh.canvas,i=t.width;e.width!==i&&(e.width=i);const n=t.height;return e.height!==n&&(e.height=n),rh.clearRect(0,0,i,n),rh.drawImage(t,0,0),rh.getImageData(0,0,i,n).data}(ih(n.getData())));const h=[r[0]+2*s,r[1]+2*s],u=o instanceof Float32Array,c=h[0]*h[1],d=u?Float32Array:Uint8ClampedArray,p=new d(o.buffer),f=d.BYTES_PER_ELEMENT,g=f*p.length/c,m=p.byteLength/h[1],y=Math.floor(m/f/h[0]),_=this.sourceTileGrid_.getTileCoordExtent(n.tileCoord);_[0]+=i.offset,_[2]+=i.offset;const x=this.clipExtent_?.slice();x&&(x[0]+=i.offset,x[2]+=i.offset),t.push({extent:_,clipExtent:x,data:p,dataType:d,bytesPerPixel:g,pixelSize:h,bandCount:y})})),this.sourceTiles_.length=0,0===t.length)return this.state=lr.ERROR,void this.changed();const i=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(i),r="number"==typeof n?n:n[0],s="number"==typeof n?n:n[1],o=r*this.pixelRatio_,a=s*this.pixelRatio_,l=this.targetTileGrid_.getResolution(i),h=this.sourceTileGrid_.getResolution(this.sourceZ_),u=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_),c=t[0].bandCount,d=new t[0].dataType(c*o*a),p=function(t,e,i,n){let r;return r=i&&i.length?i.shift():L?new OffscreenCanvas(t||300,e||300):document.createElement("canvas"),t&&(r.width=t),e&&(r.height=e),r.getContext("webgl",n)}(o,a,dh,{premultipliedAlpha:!1,antialias:!1});let f;const g=p.RGBA;let m;if(t[0].dataType==Float32Array){m=p.FLOAT,p.getExtension("WEBGL_color_buffer_float"),p.getExtension("OES_texture_float"),p.getExtension("EXT_float_blend");f=null!==p.getExtension("OES_texture_float_linear")&&this.interpolate}else m=p.UNSIGNED_BYTE,f=this.interpolate;for(let e=Math.ceil(c/4)-1;e>=0;--e){const i=[];for(let n=0,r=t.length;n{const i=e.getState();if(i!==lr.IDLE&&i!==lr.LOADING)return;t++;const n=rt(e,N,(()=>{const i=e.getState();i!=lr.LOADED&&i!=lr.ERROR&&i!=lr.EMPTY||(ot(n),t--,0===t&&(this.unlistenSources_(),this.reproject_()))}));this.sourcesListenerKeys_.push(n)})),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach((function({tile:t}){t.getState()==lr.IDLE&&t.load()}))}unlistenSources_(){this.sourcesListenerKeys_.forEach(ot),this.sourcesListenerKeys_=null}};var gh=class{constructor(t){this.highWaterMark=void 0!==t?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){const t=this.pop();t instanceof U&&t.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;for(;e;)t(e.value_,e.key_,this),e=e.newer}get(t,e){const i=this.entries_[t];return ee(void 0!==i,"Tried to get a value for a key that does not exist in the cache"),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_}remove(t){const e=this.entries_[t];return ee(void 0!==e,"Tried to get a value for a key that does not exist in the cache"),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_}getCount(){return this.count_}getKeys(){const t=new Array(this.count_);let e,i=0;for(e=this.newest_;e;e=e.older)t[i++]=e.key_;return t}getValues(){const t=new Array(this.count_);let e,i=0;for(e=this.newest_;e;e=e.older)t[i++]=e.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){return this.entries_[t]?.value_}pop(){const t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_}replace(t,e){this.get(t),this.entries_[t].value_=e}set(t,e){ee(!(t in this.entries_),"Tried to set a value for a key that is used already");const i={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[t]=i,++this.count_}setSize(t){this.highWaterMark=t}};function mh(t,e,i,n){return`${t},${Aa(e,i,n)}`}function yh(t,e,i){if(!(i in t))return t[i]=new Set([e]),!0;const n=t[i],r=n.has(e);return r||n.add(e),!r}function _h(t,e,i){const n=t[i];return!!n&&n.delete(e)}function xh(t,e){const i=t.layerStatesArray[t.layerIndex];i.extent&&(e=De(e,zn(i.extent,t.viewState.projection)));const n=i.layer.getRenderSource();if(!n.getWrapX()){const i=n.getTileGridForProjection(t.viewState.projection).getExtent();i&&(e=De(e,i))}return e}var vh=class extends Ql{constructor(t,e){super(t),e=e||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedRevision_,this.renderedTiles=[],this.renderedSourceKey_,this.renderedSourceRevision_,this.tempExtent=[1/0,1/0,-1/0,-1/0],this.tempTileRange_=new ka(0,0,0,0),this.tempTileCoord_=Fa(0,0,0);const i=void 0!==e.cacheSize?e.cacheSize:512;this.tileCache_=new gh(i),this.maxStaleKeys=.5*i}getTileCache(){return this.tileCache_}getOrCreateTile(t,e,i,n){const r=this.tileCache_,s=this.getLayer().getSource(),o=mh(s.getKey(),t,e,i);let a;if(r.containsKey(o))a=r.get(o);else{if(a=s.getTile(t,e,i,n.pixelRatio,n.viewState.projection),!a)return null;r.set(o,a)}return a}getTile(t,e,i,n){const r=this.getOrCreateTile(t,e,i,n);return r||null}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=Un(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!ue(r,n))return null;const s=e.viewState,o=i.getRenderSource(),a=o.getTileGridForProjection(s.projection),l=o.getTilePixelRatio(e.pixelRatio);for(let t=a.getZForResolution(s.resolution);t>=a.getMinZoom();--t){const i=a.getTileCoordForCoordAndZ(n,t),r=this.getTile(t,i[1],i[2],e);if(!r||r.getState()!==lr.LOADED)continue;const h=a.getOrigin(t),u=qt(a.getTileSize(t)),c=a.getResolution(t);let d;if(r instanceof Ba||r instanceof tl)d=r.getImage();else{if(!(r instanceof oh))continue;if(d=ih(r.getData()),!d)continue}const p=Math.floor(l*((n[0]-h[0])/c-i[1]*u[0])),f=Math.floor(l*((h[1]-n[1])/c-i[2]*u[1])),g=Math.round(l*o.getGutterForProjection(s.projection));return this.getImageData(d,p+g,f+g)}return null}prepareFrame(t){this.renderedProjection?t.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=t.viewState.projection):this.renderedProjection=t.viewState.projection;const e=this.getLayer().getSource();if(!e)return!1;const i=e.getRevision();return this.renderedRevision_?this.renderedRevision_!==i&&(this.renderedRevision_=i,this.renderedSourceKey_===e.getKey()&&this.tileCache_.clear()):this.renderedRevision_=i,!0}enqueueTiles(t,e,i,n,r){const s=t.viewState,o=this.getLayer(),a=o.getRenderSource(),l=a.getTileGridForProjection(s.projection),h=wt(a);h in t.wantedTiles||(t.wantedTiles[h]={});const u=t.wantedTiles[h],c=o.getMapInternal(),d=Math.max(i-r,l.getMinZoom(),l.getZForResolution(Math.min(o.getMaxResolution(),c?c.getView().getResolutionForZoom(Math.max(o.getMinZoom(),0)):l.getResolution(0)),a.zDirection)),p=s.rotation,f=p?Fe(s.center,s.resolution,p,t.size):void 0;for(let r=i;r>=d;--r){const i=l.getTileRangeForExtentAndZ(e,r,this.tempTileRange_),s=l.getResolution(r);for(let e=i.minX;e<=i.maxX;++e)for(let o=i.minY;o<=i.maxY;++o){if(p&&!l.tileCoordIntersectsViewport([r,e,o],f))continue;const i=this.getTile(r,e,o,t);if(!i)continue;if(!yh(n,i,r))continue;const a=i.getKey();if(u[a]=!0,i.getState()===lr.IDLE&&!t.tileQueue.isKeyQueued(a)){const n=Fa(r,e,o,this.tempTileCoord_);t.tileQueue.enqueue([i,h,l.getTileCoordCenter(n),s])}}}}findStaleTile_(t,e){const i=this.tileCache_,n=t[0],r=t[1],s=t[2],o=this.getStaleKeys();for(let t=0;t0&&setTimeout((()=>{this.enqueueTiles(t,C,d-1,S,T-1)}),0),!(d in S))return this.container;const E=wt(this),R=t.time;for(const e of S[d]){const n=e.getState();if((e instanceof tl||e instanceof fh)&&n===lr.EMPTY)continue;const r=e.tileCoord;if(n===lr.LOADED){if(1===e.getAlpha(E,R)){e.endTransition(E);continue}}n!==lr.IDLE&&(i=!1),n!==lr.ERROR&&(this.renderComplete=!1);if(this.findStaleTile_(r,S)){_h(S,e,d),t.animate=!0;continue}if(this.findAltTiles_(c,r,d+1,S))continue;const s=c.getMinZoom();for(let t=d-1;t>=s;--t){if(this.findAltTiles_(c,r,t,S))break}}const M=p/o*l/m,I=this.getRenderContext(t);qn(this.tempTransform,y/2,_/2,M,M,0,-y/2,-_/2),n.extent&&this.clipUnrotated(I,t,x),u.getInterpolate()||(I.imageSmoothingEnabled=!1),this.preRender(I,t);const k=Object.keys(S).map(Number);let F;k.sort(B);const A=[],D=[];for(let e=k.length-1;e>=0;--e){const i=k[e],n=u.getTilePixelSize(i,l,s),r=c.getResolution(i)/p,o=n[0]*r*M,a=n[1]*r*M,h=c.getTileCoordForCoordAndZ(Pe(b),i),d=c.getTileCoordExtent(h),f=Un(this.tempTransform,[m*(d[0]-b[0])/p,m*(b[3]-d[3])/p]),g=m*u.getGutterForProjection(s);for(const e of S[i]){if(e.getState()!==lr.LOADED)continue;const n=e.tileCoord,r=h[1]-n[1],s=Math.round(f[0]-(r-1)*o),l=h[2]-n[2],c=Math.round(f[1]-(l-1)*a),d=Math.round(f[0]-r*o),p=Math.round(f[1]-l*a),m=s-d,y=c-p,_=1===k.length;let x=!1;F=[d,p,d+m,p,d+m,p+y,d,p+y];for(let t=0,e=A.length;t{const i=wt(u),n=e.wantedTiles[i],r=n?Object.keys(n).length:0;this.updateCacheSize(r),this.tileCache_.expireCache()};t.postRenderFunctions.push(e)}return this.renderComplete||i||(t.animate=!0),this.container}updateCacheSize(t){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,2*t)}drawTile(t,e,i,n,r,s,o,a){let l;if(t instanceof oh){if(l=ih(t.getData()),!l)throw new Error("Rendering array data is not yet supported")}else l=this.getTileImage(t);if(!l)return;const h=this.getRenderContext(e),u=wt(this),c=e.layerStatesArray[e.layerIndex],d=c.opacity*(a?t.getAlpha(u,e.time):1),p=d!==h.globalAlpha;p&&(h.save(),h.globalAlpha=d),h.drawImage(l,o,o,l.width-2*o,l.height-2*o,i,n,r,s),p&&h.restore(),d!==c.opacity?e.animate=!0:a&&t.endTransition(u)}getImage(){const t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}updateUsedTiles(t,e,i){const n=wt(e);n in t||(t[n]={}),t[n][i.getKey()]=!0}};const wh={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},bh={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]};var Sh=class extends vh{constructor(t,e){super(t,e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.renderedOpacity_=1,this.tmpTransform_=[1,0,0,1,0,0],this.tileClipContexts_=null}drawTile(t,e,i,n,r,s,o,a){this.updateExecutorGroup_(t,e.pixelRatio,e.viewState.projection),this.tileImageNeedsRender_(t)&&this.renderTileImage_(t,e),super.drawTile(t,e,i,n,r,s,o,a)}getTile(t,e,i,n){const r=this.getOrCreateTile(t,e,i,n);if(!r)return null;const s=n.viewState.resolution,o=n.viewHints;return!!(o[ns]||o[rs])&&r.wantedResolution||(r.wantedResolution=s),r}prepareFrame(t){const e=this.getLayer().getRevision();return this.renderedLayerRevision_!==e&&(this.renderedLayerRevision_=e,this.renderedTiles.length=0),super.prepareFrame(t)}updateExecutorGroup_(t,e,i){const n=this.getLayer(),r=n.getRevision(),s=n.getRenderOrder()||null,o=t.wantedResolution,a=t.getReplayState(n);if(!a.dirty&&a.renderedResolution===o&&a.renderedRevision==r&&a.renderedRenderOrder==s)return;const l=n.getSource(),h=!!n.getDeclutter(),u=l.getTileGrid(),c=l.getTileGridForProjection(i).getTileCoordExtent(t.wrappedTileCoord),d=l.getSourceTiles(e,i,t),p=wt(n);delete t.hitDetectionImageData[p],t.executorGroups[p]=[],a.dirty=!1;for(let i=0,r=d.length;it.value)):null;let m;t:for(let e=0,n=d.length;e{const n=this.getLayer(),r=n.getSource(),s=this.renderedProjection,o=s.getExtent(),a=this.renderedResolution,l=r.getTileGridForProjection(s),h=Un(this.renderedPixelToCoordinateTransform_,t.slice()),u=l.getTileCoordForCoordAndResolution(h,a).toString(),c=this.renderedTiles.find((t=>t.tileCoord.toString()===u&&t.getState()===lr.LOADED));if(!c||c.loadingSourceTiles>0)return void e([]);r.getWrapX()&&s.canWrapX()&&!ce(o,l.getTileCoordExtent(c.tileCoord))&&gi(h,s);const d=wt(n),p=Pe(l.getTileCoordExtent(c.wrappedTileCoord)),f=[(h[0]-p[0])/a,(p[1]-h[1])/a],g=c.getSourceTiles().reduce(((t,e)=>t.concat(e.getFeatures())),[]);let m=c.hitDetectionImageData[d];if(!m){const t=qt(l.getTileSize(l.getZForResolution(a,r.zDirection))),e=this.renderedRotation_;m=Yl(t,[this.getRenderTransform(l.getTileCoordCenter(c.wrappedTileCoord),a,0,Wl,t[0]*Wl,t[1]*Wl,0)],g,n.getStyleFunction(),l.getTileCoordExtent(c.wrappedTileCoord),c.getReplayState(n).renderedResolution,e),c.hitDetectionImageData[d]=m}e(Ul(f,g,m))}))}getFeaturesInExtent(t){const e=[],i=this.getTileCache();if(0===i.getCount())return e;const n=this.getLayer().getSource().getTileGridForProjection(this.frameState.viewState.projection),r=n.getZForResolution(this.renderedResolution),s={};return i.forEach((i=>{if(i.tileCoord[0]!==r||i.getState()!==lr.LOADED)return;const o=i.getSourceTiles();for(let i=0,r=o.length;i=0;--e)n[e].execute(this.context,o,this.getTileRenderTransform(i,t),t.viewState.rotation,s,Gl,l)}i.globalAlpha=n}renderDeferredInternal(t){const e=this.renderedTiles,i=wt(this.getLayer()),n=e.reduce(((t,e,n)=>(e.executorGroups[i].forEach((e=>t.push({executorGroup:e,index:n}))),t)),[]),r=n.map((({executorGroup:t})=>t.getDeferredZIndexContexts())),s={};for(let t=0,e=n.length;t{r.forEach(((e,i)=>{e[t]&&(e[t].forEach((t=>{const{executorGroup:e,index:r}=n[i],s=e.getRenderedContext(),o=s.globalAlpha;s.globalAlpha=this.renderedOpacity_;const a=this.tileClipContexts_[r];a&&a.draw(s),t.draw(s),a&&s.restore(),s.globalAlpha=o,t.clear()})),e[t].length=0)}))}))}getTileRenderTransform(t,e){const i=e.pixelRatio,n=e.viewState,r=n.center,s=n.resolution,o=n.rotation,a=e.size,l=Math.round(a[0]*i),h=Math.round(a[1]*i),u=this.getLayer().getSource().getTileGridForProjection(e.viewState.projection),c=t.tileCoord,d=u.getTileCoordExtent(t.wrappedTileCoord),p=u.getTileCoordExtent(c,this.tempExtent)[0]-d[0];return Wn(Bn(this.inversePixelTransform.slice(),1/i,1/i),this.getRenderTransform(r,s,o,i,l,h,p))}postRender(t,e){const i=e.viewHints,n=!(i[ns]||i[rs]);this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice(),this.renderedRotation_=e.viewState.rotation,this.renderedOpacity_=e.layerStatesArray[e.layerIndex].opacity;const r=this.getLayer(),s=r.getRenderMode(),o=t.globalAlpha;t.globalAlpha=this.renderedOpacity_;const a=r.getDeclutter(),l=a?bh[s].filter((t=>!Gl.includes(t))):bh[s],h=e.viewState,u=h.rotation,c=r.getSource(),d=c.getTileGridForProjection(h.projection).getZForResolution(h.resolution,c.zDirection),p=this.renderedTiles,f=[],g=[],m=[],y=wt(r);let _=!0;for(let i=p.length-1;i>=0;--i){const s=p[i];_=_&&!s.getReplayState(r).dirty;const o=s.executorGroups[y].filter((t=>t.hasExecutors(l)));if(0===o.length)continue;const h=this.getTileRenderTransform(s,e),c=s.tileCoord[0];let x=!1;const v=o[0].getClipCoords(h);let w,b=t;if(v){w=new El,b=w.getContext();for(let t=0,e=f.length;t{const r=this.tileUrlFunction(n,t,e);this.sourceTiles_[r]||(this.sourceTiles_[r]=new this.tileClass(n,r?lr.IDLE:lr.EMPTY,r,this.format_,this.tileLoadFunction));const s=this.sourceTiles_[r];i.sourceTiles.push(s),this.tileKeysBySourceTileUrl_[r]||(this.tileKeysBySourceTileUrl_[r]=[]),this.tileKeysBySourceTileUrl_[r].push(i.getKey());const o=s.getState();if(o{this.handleTileChange(e);const n=s.getState();if(n===lr.LOADED||n===lr.ERROR){const e=s.getKey();e in i.errorTileKeys?s.getState()===lr.LOADED&&delete i.errorTileKeys[e]:i.loadingSourceTiles--,n===lr.ERROR?i.errorTileKeys[e]=!0:s.removeEventListener(N,t),0===i.loadingSourceTiles&&i.setState(et(i.errorTileKeys)?lr.LOADED:lr.ERROR)}};s.addEventListener(N,t),i.loadingSourceTiles++}o===lr.IDLE&&(s.extent=l.getTileCoordExtent(n),s.projection=e,s.resolution=l.getResolution(n[0]),s.load())})),i.loadingSourceTiles||i.setState(i.sourceTiles.some((t=>t.getState()===lr.ERROR))?lr.ERROR:lr.LOADED)}return i.sourceTiles}removeSourceTiles(t){const e=t.sourceTiles;for(let t=0,i=e.length;t{h=h&&!this.tileUrlFunction(t,n,r)}))}const u=new Mh(s,h?lr.EMPTY:lr.IDLE,o,this.getSourceTiles.bind(this,n,r),this.removeSourceTiles.bind(this));return u.key=this.getKey(),u}getTileGridForProjection(t){const e=t.getCode();let i=this.tileGrids_[e];if(!i){const t=this.tileGrid,n=t.getResolutions().slice(),r=n.map((function(e,i){return t.getOrigin(i)})),s=n.map((function(e,i){return t.getTileSize(i)})),o=ps+1;for(let t=n.length;t255?255:t}function Lh(t){return t<0?0:t>1?1:t}function zh(t){return"%"===t[t.length-1]?Ph(parseFloat(t)/100*255):Ph(parseInt(t))}function Oh(t){return"%"===t[t.length-1]?Lh(parseFloat(t)/100):Lh(parseFloat(t))}function Gh(t,e,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}try{Ah={}.parseCSSColor=function(t){var e,i=t.replace(/ /g,"").toLowerCase();if(i in Dh)return Dh[i].slice();if("#"===i[0])return 4===i.length?(e=parseInt(i.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===i.length&&(e=parseInt(i.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var n=i.indexOf("("),r=i.indexOf(")");if(-1!==n&&r+1===i.length){var s=i.substr(0,n),o=i.substr(n+1,r-(n+1)).split(","),a=1;switch(s){case"rgba":if(4!==o.length)return null;a=Oh(o.pop());case"rgb":return 3!==o.length?null:[zh(o[0]),zh(o[1]),zh(o[2]),a];case"hsla":if(4!==o.length)return null;a=Oh(o.pop());case"hsl":if(3!==o.length)return null;var l=(parseFloat(o[0])%360+360)%360/360,h=Oh(o[1]),u=Oh(o[2]),c=u<=.5?u*(h+1):u+h-u*h,d=2*u-c;return[Ph(255*Gh(d,c,l+1/3)),Ph(255*Gh(d,c,l)),Ph(255*Gh(d,c,l-1/3)),a];default:return null}}return null}}catch(t){}class Xh{constructor(t,e,i,n=1){this.r=t,this.g=e,this.b=i,this.a=n}static parse(t){if(!t)return;if(t instanceof Xh)return t;if("string"!=typeof t)return;const e=Ah(t);return e?new Xh(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3]):void 0}toString(){const[t,e,i,n]=this.toArray();return`rgba(${Math.round(t)},${Math.round(e)},${Math.round(i)},${n})`}toArray(){const{r:t,g:e,b:i,a:n}=this;return 0===n?[0,0,0,0]:[255*t/n,255*e/n,255*i/n,n]}toArray01(){const{r:t,g:e,b:i,a:n}=this;return 0===n?[0,0,0,0]:[t/n,e/n,i/n,n]}toArray01PremultipliedAlpha(){const{r:t,g:e,b:i,a:n}=this;return[t,e,i,n]}}Xh.black=new Xh(0,0,0,1),Xh.white=new Xh(1,1,1,1),Xh.transparent=new Xh(0,0,0,0),Xh.red=new Xh(1,0,0,1),Xh.blue=new Xh(0,0,1,1);var jh=Xh;function Nh(t){return"object"==typeof t?["literal",t]:t}function Wh(t,e){let i=t.stops;if(!i)return function(t,e){const i=["get",t.property];if(void 0===t.default)return"string"===e.type?["string",i]:i;if("enum"===e.type)return["match",i,Object.keys(e.values),i,t.default];{const n=["color"===e.type?"to-color":e.type,i,Nh(t.default)];return"array"===e.type&&n.splice(1,0,e.value,e.length||null),n}}(t,e);const n=i&&"object"==typeof i[0][0],r=n||void 0!==t.property,s=n||!r;return i=i.map((t=>!r&&e.tokens&&"string"==typeof t[1]?[t[0],Vh(t[1])]:[t[0],Nh(t[1])])),n?function(t,e,i){const n={},r={},s=[];for(let e=0;e3&&e===t[t.length-2]||(n&&2===t.length||t.push(e),t.push(i))}function $h(t,e){return t.type?t.type:e.expression.interpolated?"exponential":"interval"}function Vh(t){const e=["concat"],i=/{([^{}]+)}/g;let n=0;for(let r=i.exec(t);null!==r;r=i.exec(t)){const s=t.slice(n,i.lastIndex-r[0].length);n=i.lastIndex,s.length>0&&e.push(s),e.push(["get",r[1]])}if(1===e.length)return t;if(n`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const du=[tu,eu,iu,nu,ru,lu,su,uu(ou),hu];function pu(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!pu(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of du)if(!pu(t,e))return null}return`Expected ${cu(t)} but found ${cu(e)} instead.`}function fu(t,e){return e.some((e=>e.kind===t.kind))}function gu(t,e){return e.some((e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t))}class mu{constructor(t,e,i){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class yu{constructor(t,e,i,n,r){this.text=t.normalize?t.normalize():t,this.image=e,this.scale=i,this.fontStack=n,this.textColor=r}}class _u{constructor(t){this.sections=t}static fromString(t){return new _u([new yu(t,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((t=>0!==t.text.length||t.image&&0!==t.image.name.length))}static factory(t){return t instanceof _u?t:_u.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}serialize(){const t=["format"];for(const e of this.sections){if(e.image){t.push(["image",e.image.name]);continue}t.push(e.text);const i={};e.fontStack&&(i["text-font"]=["literal",e.fontStack.split(",")]),e.scale&&(i["font-scale"]=e.scale),e.textColor&&(i["text-color"]=["rgba"].concat(e.textColor.toArray())),t.push(i)}return t}}class xu{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new xu({name:t,available:!1}):null}serialize(){return["image",this.name]}}function vu(t,e,i,n){if(!("number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof i&&i>=0&&i<=255)){return`Invalid rgba value [${("number"==typeof n?[t,e,i,n]:[t,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}return void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,i,n].join(", ")}]: 'a' must be between 0 and 1.`}function wu(t){if(null===t)return!0;if("string"==typeof t)return!0;if("boolean"==typeof t)return!0;if("number"==typeof t)return!0;if(t instanceof jh)return!0;if(t instanceof mu)return!0;if(t instanceof _u)return!0;if(t instanceof xu)return!0;if(Array.isArray(t)){for(const e of t)if(!wu(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!wu(t[e]))return!1;return!0}return!1}function bu(t){if(null===t)return tu;if("string"==typeof t)return iu;if("boolean"==typeof t)return nu;if("number"==typeof t)return eu;if(t instanceof jh)return ru;if(t instanceof mu)return au;if(t instanceof _u)return lu;if(t instanceof xu)return hu;if(Array.isArray(t)){const e=t.length;let i;for(const e of t){const t=bu(e);if(i){if(i===t)continue;i=ou;break}i=t}return uu(i||ou,e)}return su}function Su(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof jh||t instanceof _u||t instanceof xu?t.toString():JSON.stringify(t)}class Tu{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!wu(t[1]))return e.error("invalid value");const i=t[1];let n=bu(i);const r=e.expectedType;return"array"!==n.kind||0!==n.N||!r||"array"!==r.kind||"number"==typeof r.N&&0!==r.N||(n=r),new Tu(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof jh?["rgba"].concat(this.value.toArray()):this.value instanceof _u?this.value.serialize():this.value}}var Cu=Tu;var Eu=class{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}};const Ru={string:iu,number:eu,boolean:nu,object:su};class Mu{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i,n=1;const r=t[0];if("array"===r){let r,s;if(t.length>2){const i=t[1];if("string"!=typeof i||!(i in Ru)||"object"===i)return e.error('The item type argument of "array" must be one of string, number, boolean',1);r=Ru[i],n++}else r=ou;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);s=t[2],n++}i=uu(r,s)}else i=Ru[r];const s=[];for(;nt.outputDefined()))}serialize(){const t=this.type,e=[t.kind];if("array"===t.kind){const i=t.itemType;if("string"===i.kind||"number"===i.kind||"boolean"===i.kind){e.push(i.kind);const n=t.N;("number"==typeof n||this.args.length>1)&&e.push(n)}}return e.concat(this.args.map((t=>t.serialize())))}}var Iu=Mu;class ku{constructor(t){this.type=lu,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[1];if(!Array.isArray(i)&&"object"==typeof i)return e.error("First argument must be an image or text section.");const n=[];let r=!1;for(let i=1;i<=t.length-1;++i){const s=t[i];if(r&&"object"==typeof s&&!Array.isArray(s)){r=!1;let t=null;if(s["font-scale"]&&(t=e.parse(s["font-scale"],1,eu),!t))return null;let i=null;if(s["text-font"]&&(i=e.parse(s["text-font"],1,uu(iu)),!i))return null;let o=null;if(s["text-color"]&&(o=e.parse(s["text-color"],1,ru),!o))return null;const a=n[n.length-1];a.scale=t,a.font=i,a.textColor=o}else{const s=e.parse(t[i],1,ou);if(!s)return null;const o=s.type.kind;if("string"!==o&&"value"!==o&&"null"!==o&&"resolvedImage"!==o)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");r=!0,n.push({content:s,scale:null,font:null,textColor:null})}}return new ku(n)}evaluate(t){return new _u(this.sections.map((e=>{const i=e.content.evaluate(t);return bu(i)===hu?new yu("",i,null,null,null):new yu(Su(i),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor)}outputDefined(){return!1}serialize(){const t=["format"];for(const e of this.sections){t.push(e.content.serialize());const i={};e.scale&&(i["font-scale"]=e.scale.serialize()),e.font&&(i["text-font"]=e.font.serialize()),e.textColor&&(i["text-color"]=e.textColor.serialize()),t.push(i)}return t}}class Fu{constructor(t){this.type=hu,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,iu);return i?new Fu(i):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),i=xu.fromString(e);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(e)>-1),i}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const Au={"to-boolean":nu,"to-color":ru,"to-number":eu,"to-string":iu};class Du{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[0];if(("to-boolean"===i||"to-string"===i)&&2!==t.length)return e.error("Expected one argument.");const n=Au[i],r=[];for(let i=1;i4?`Invalid rbga value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:vu(e[0],e[1],e[2],e[3]),!i))return new jh(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new Eu(i||`Could not parse color from value '${"string"==typeof e?e:String(JSON.stringify(e))}'`)}if("number"===this.type.kind){let e=null;for(const i of this.args){if(e=i.evaluate(t),null===e)return 0;const n=Number(e);if(!isNaN(n))return n}throw new Eu(`Could not convert ${JSON.stringify(e)} to number.`)}return"formatted"===this.type.kind?_u.fromString(Su(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?xu.fromString(Su(this.args[0].evaluate(t))):Su(this.args[0].evaluate(t))}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){if("formatted"===this.type.kind)return new ku([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new Fu(this.args[0]).serialize();const t=[`to-${this.type.kind}`];return this.eachChild((e=>{t.push(e.serialize())})),t}}var Pu=Du;const Lu=["Unknown","Point","LineString","Polygon"];var zu=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?Lu[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const t=this.featureDistanceData.center,e=this.featureDistanceData.scale,{x:i,y:n}=this.featureTileCoord,r=i*e-t[0],s=n*e-t[1];return this.featureDistanceData.bearing[0]*r+this.featureDistanceData.bearing[1]*s}return 0}parseColor(t){let e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=jh.parse(t)),e}};class Ou{constructor(t,e,i,n){this.name=t,this.type=e,this._evaluate=i,this.args=n}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map((t=>t.serialize())))}static parse(t,e){const i=t[0],n=Ou.definitions[i];if(!n)return e.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const r=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,o=s.filter((([e])=>!Array.isArray(e)||e.length===t.length-1));let a=null;for(const[n,s]of o){a=new dc(e.registry,e.path,null,e.scope);const o=[];let l=!1;for(let e=1;e{return e=t,Array.isArray(e)?`(${e.map(cu).join(", ")})`:`(${cu(e.type)}...)`;var e})).join(" | "),n=[];for(let i=1;i=e[2])&&(!(t[1]<=e[1])&&!(t[3]>=e[3])))}function Yu(t,e){const i=(180+t[0])/360;const n=(r=t[1],(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360);var r;const s=Math.pow(2,e.z);return[Math.round(i*s*ju),Math.round(n*s*ju)]}function Uu(t,e,i){const n=t[0]-e[0],r=t[1]-e[1],s=t[0]-i[0],o=t[1]-i[1];return n*o-s*r==0&&n*s<=0&&r*o<=0}function Bu(t,e,i){return e[1]>t[1]!=i[1]>t[1]&&t[0]<(i[0]-e[0])*(t[1]-e[1])/(i[1]-e[1])+e[0]}function qu(t,e){let i=!1;for(let n=0,r=e.length;n0&&c<0||u<0&&c>0}function Vu(t,e,i,n){const r=[e[0]-t[0],e[1]-t[1]],s=[n[0]-i[0],n[1]-i[1]];return 0!=(o=s)[0]*(a=r)[1]-o[1]*a[0]&&!(!$u(t,e,i,n)||!$u(i,n,t,e));var o,a}function Ku(t,e,i){for(const n of i)for(let i=0;ii[2]){const e=.5*n;let r=t[0]-i[0]>e?-n:i[0]-t[0]>e?n:0;0===r&&(r=t[0]-i[2]>e?-n:i[2]-t[0]>e?n:0),t[0]+=r}Nu(e,t)}function ic(t,e,i,n){const r=Math.pow(2,n.z)*ju,s=[n.x*ju,n.y*ju],o=[];if(!t)return o;for(const n of t)for(const t of n){const n=[t.x+s[0],t.y+s[1]];ec(n,e,i,r),o.push(n)}return o}function nc(t,e,i,n){const r=Math.pow(2,n.z)*ju,s=[n.x*ju,n.y*ju],o=[];if(!t)return o;for(const i of t){const t=[];for(const n of i){const i=[n.x+s[0],n.y+s[1]];Nu(e,i),t.push(i)}o.push(t)}if(e[2]-e[0]<=r/2){!function(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}(e);for(const t of o)for(const n of t)ec(n,e,i,r)}return o}class rc{constructor(t,e){this.type=nu,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(wu(t[1])){const e=t[1];if("FeatureCollection"===e.type)for(let t=0;t{e&&!oc(t)&&(e=!1)})),e}function ac(t){if(t instanceof Gu&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild((t=>{e&&!ac(t)&&(e=!1)})),e}function lc(t,e){if(t instanceof Gu&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild((t=>{i&&!lc(t,e)&&(i=!1)})),i}class hc{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");const i=t[1];return e.scope.has(i)?new hc(i,e.scope.get(i)):e.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}var uc=hc;class cc{constructor(t,e=[],i,n=new Qh,r=[]){this.registry=t,this.path=e,this.key=e.map((t=>`[${t}]`)).join(""),this.scope=n,this.errors=r,this.expectedType=i}parse(t,e,i,n,r={}){return e?this.concat(e,i,n)._parse(t,r):this._parse(t,r)}_parse(t,e){function i(t,e,i){return"assert"===i?new Iu(e,[t]):"coerce"===i?new Pu(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const n=t[0];if("string"!=typeof n)return this.error(`Expression name must be a string, but found ${typeof n} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const r=this.registry[n];if(r){let n=r.parse(t,this);if(!n)return null;if(this.expectedType){const t=this.expectedType,r=n.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==r.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==r.kind&&"string"!==r.kind){if(this.checkSubtype(t,r))return null}else n=i(n,t,e.typeAnnotation||"coerce");else n=i(n,t,e.typeAnnotation||"assert")}if(!(n instanceof Cu)&&"resolvedImage"!==n.type.kind&&pc(n)){const t=new zu;try{n=new Cu(n.type,n.evaluate(t))}catch(t){return this.error(t.message),null}}return n}return this.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0)}return void 0===t?this.error("'undefined' value invalid. Use null instead."):"object"==typeof t?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof t} instead.`)}concat(t,e,i){const n="number"==typeof t?this.path.concat(t):this.path,r=i?this.scope.concat(i):this.scope;return new cc(this.registry,n,e||null,r,this.errors)}error(t,...e){const i=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new Hh(i,t))}checkSubtype(t,e){const i=pu(t,e);return i&&this.error(i),i}}var dc=cc;function pc(t){if(t instanceof uc)return pc(t.boundExpression);if(t instanceof Gu&&"error"===t.name)return!1;if(t instanceof Xu)return!1;if(t instanceof sc)return!1;const e=t instanceof Pu||t instanceof Iu;let i=!0;return t.eachChild((t=>{i=e?i&&pc(t):i&&t instanceof Cu})),!!i&&(oc(t)&&lc(t,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"]))}function fc(t,e){const i=t.length-1;let n,r,s=0,o=i,a=0;for(;s<=o;)if(a=Math.floor((s+o)/2),n=t[a],r=t[a+1],n<=e){if(a===i||ee))throw new Eu("Input is not a number.");o=a-1}return 0}class gc{constructor(t,e,i){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of i)this.labels.push(t),this.outputs.push(e)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");const i=e.parse(t[1],1,eu);if(!i)return null;const n=[];let r=null;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);for(let i=1;i=s)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const h=e.parse(o,l,r);if(!h)return null;r=r||h.type,n.push([s,h])}return new gc(r,i,n)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);const r=e.length;if(n>=e[r-1])return i[r-1].evaluate(t);return i[fc(e,n)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){const t=["step",this.input.serialize()];for(let e=0;e0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t}}var mc=gc,yc=_c;function _c(t,e,i,n){this.cx=3*t,this.bx=3*(i-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=i,this.p2y=n}_c.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},_c.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},_c.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},_c.prototype.solveCurveX=function(t,e){var i,n,r,s,o;for(void 0===e&&(e=1e-6),r=t,o=0;o<8;o++){if(s=this.sampleCurveX(r)-t,Math.abs(s)(n=1))return n;for(;is?i=r:n=r,r=.5*(n-i)+i}return r},_c.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var xc=Fh(yc);function vc(t,e,i){return t*(1-i)+e*i}var wc=Object.freeze({__proto__:null,number:vc,color:function(t,e,i){return new jh(vc(t.r,e.r,i),vc(t.g,e.g,i),vc(t.b,e.b,i),vc(t.a,e.a,i))},array:function(t,e,i){return t.map(((t,n)=>vc(t,e[n],i)))}});const bc=.95047,Sc=1,Tc=1.08883,Cc=4/29,Ec=6/29,Rc=3*Ec*Ec,Mc=Ec*Ec*Ec,Ic=Math.PI/180,kc=180/Math.PI;function Fc(t){return t>Mc?Math.pow(t,1/3):t/Rc+Cc}function Ac(t){return t>Ec?t*t*t:Rc*(t-Cc)}function Dc(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Pc(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Lc(t){const e=Pc(t.r),i=Pc(t.g),n=Pc(t.b),r=Fc((.4124564*e+.3575761*i+.1804375*n)/bc),s=Fc((.2126729*e+.7151522*i+.072175*n)/Sc);return{l:116*s-16,a:500*(r-s),b:200*(s-Fc((.0193339*e+.119192*i+.9503041*n)/Tc)),alpha:t.a}}function zc(t){let e=(t.l+16)/116,i=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=Sc*Ac(e),i=bc*Ac(i),n=Tc*Ac(n),new jh(Dc(3.2404542*i-1.5371385*e-.4985314*n),Dc(-.969266*i+1.8760108*e+.041556*n),Dc(.0556434*i-.2040259*e+1.0572252*n),t.alpha)}function Oc(t,e,i){const n=e-t;return t+i*(n>180||n<-180?n-360*Math.round(n/360):n)}const Gc={forward:Lc,reverse:zc,interpolate:function(t,e,i){return{l:vc(t.l,e.l,i),a:vc(t.a,e.a,i),b:vc(t.b,e.b,i),alpha:vc(t.alpha,e.alpha,i)}}},Xc={forward:function(t){const{l:e,a:i,b:n}=Lc(t),r=Math.atan2(n,i)*kc;return{h:r<0?r+360:r,c:Math.sqrt(i*i+n*n),l:e,alpha:t.a}},reverse:function(t){const e=t.h*Ic,i=t.c;return zc({l:t.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:t.alpha})},interpolate:function(t,e,i){return{h:Oc(t.h,e.h,i),c:vc(t.c,e.c,i),l:vc(t.l,e.l,i),alpha:vc(t.alpha,e.alpha,i)}}};class jc{constructor(t,e,i,n,r){this.type=t,this.operator=e,this.interpolation=i,this.input=n,this.labels=[],this.outputs=[];for(const[t,e]of r)this.labels.push(t),this.outputs.push(e)}static interpolationFactor(t,e,i,n){let r=0;if("exponential"===t.name)r=Nc(e,t.base,i,n);else if("linear"===t.name)r=Nc(e,1,i,n);else if("cubic-bezier"===t.name){const s=t.controlPoints;r=new xc(s[0],s[1],s[2],s[3]).solve(Nc(e,1,i,n))}return r}static parse(t,e){let[i,n,r,...s]=t;if(!Array.isArray(n)||0===n.length)return e.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){const t=n[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:t}}else{if("cubic-bezier"!==n[0])return e.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const t=n.slice(1);if(4!==t.length||t.some((t=>"number"!=typeof t||t<0||t>1)))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(r=e.parse(r,2,eu),!r)return null;const o=[];let a=null;"interpolate-hcl"===i||"interpolate-lab"===i?a=ru:e.expectedType&&"value"!==e.expectedType.kind&&(a=e.expectedType);for(let t=0;t=i)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',r);const h=e.parse(n,l,a);if(!h)return null;a=a||h.type,o.push([i,h])}return"number"===a.kind||"color"===a.kind||"array"===a.kind&&"number"===a.itemType.kind&&"number"==typeof a.N?new jc(a,i,n,r,o):e.error(`Type ${cu(a)} is not interpolatable.`)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);const r=e.length;if(n>=e[r-1])return i[r-1].evaluate(t);const s=fc(e,n),o=e[s],a=e[s+1],l=jc.interpolationFactor(this.interpolation,n,o,a),h=i[s].evaluate(t),u=i[s+1].evaluate(t);return"interpolate"===this.operator?wc[this.type.kind.toLowerCase()](h,u,l):"interpolate-hcl"===this.operator?Xc.reverse(Xc.interpolate(Xc.forward(h),Xc.forward(u),l)):Gc.reverse(Gc.interpolate(Gc.forward(h),Gc.forward(u),l))}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){let t;t="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const e=[this.operator,t,this.input.serialize()];for(let t=0;tpu(n,t.type)));return new Yc(s?ou:i,r)}evaluate(t){let e,i=null,n=0;for(const r of this.args){if(n++,i=r.evaluate(t),i&&i instanceof xu&&!i.available&&(e||(e=i),i=null,n===this.args.length))return e;if(null!==i)break}return i}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){const t=["coalesce"];return this.eachChild((e=>{t.push(e.serialize())})),t}}var Uc=Yc;class Bc{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const i=[];for(let n=1;n=i.length)throw new Eu(`Array index out of bounds: ${e} > ${i.length-1}.`);if(e!==Math.floor(e))throw new Eu(`Array index must be an integer, but found ${e} instead.`);return i[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}var $c=Zc;class Vc{constructor(t,e){this.type=nu,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,ou),n=e.parse(t[2],2,ou);return i&&n?fu(i.type,[nu,iu,eu,tu,ou])?new Vc(i,n):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${cu(i.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(null==i)return!1;if(!gu(e,["boolean","string","number","null"]))throw new Eu(`Expected first argument to be of type boolean, string, number or null, but found ${cu(bu(e))} instead.`);if(!gu(i,["string","array"]))throw new Eu(`Expected second argument to be of type array or string, but found ${cu(bu(i))} instead.`);return i.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}var Kc=Vc;class Hc{constructor(t,e,i){this.type=eu,this.needle=t,this.haystack=e,this.fromIndex=i}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,ou),n=e.parse(t[2],2,ou);if(!i||!n)return null;if(!fu(i.type,[nu,iu,eu,tu,ou]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${cu(i.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,eu);return r?new Hc(i,n,r):null}return new Hc(i,n)}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!gu(e,["boolean","string","number","null"]))throw new Eu(`Expected first argument to be of type boolean, string, number or null, but found ${cu(bu(e))} instead.`);if(!gu(i,["string","array"]))throw new Eu(`Expected second argument to be of type array or string, but found ${cu(bu(i))} instead.`);if(this.fromIndex){const n=this.fromIndex.evaluate(t);return i.indexOf(e,n)}return i.indexOf(e)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}var Jc=Hc;class Qc{constructor(t,e,i,n,r,s){this.inputType=t,this.type=e,this.input=i,this.cases=n,this.outputs=r,this.otherwise=s}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let i,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);const r={},s=[];for(let o=2;oNumber.MAX_SAFE_INTEGER)return h.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return h.error("Numeric branch labels must be integer values.");if(i){if(h.checkSubtype(i,bu(t)))return null}else i=bu(t);if(void 0!==r[String(t)])return h.error("Branch labels must be unique.");r[String(t)]=s.length}const u=e.parse(l,o,n);if(!u)return null;n=n||u.type,s.push(u)}const o=e.parse(t[1],1,ou);if(!o)return null;const a=e.parse(t[t.length-1],t.length-1,n);return a?"value"!==o.type.kind&&e.concat(1).checkSubtype(i,o.type)?null:new Qc(i,n,o,r,s,a):null}evaluate(t){const e=this.input.evaluate(t);return(bu(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["match",this.input.serialize()],e=Object.keys(this.cases).sort(),i=[],n={};for(const t of e){const e=n[this.cases[t]];void 0===e?(n[this.cases[t]]=i.length,i.push([this.cases[t],[t]])):i[e][1].push(t)}const r=t=>"number"===this.inputType.kind?Number(t):t;for(const[e,n]of i)1===n.length?t.push(r(n[0])):t.push(n.map(r)),t.push(this.outputs[e].serialize());return t.push(this.otherwise.serialize()),t}}var td=Qc;class ed{constructor(t,e,i){this.type=t,this.branches=e,this.otherwise=i}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let i;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);const n=[];for(let r=1;re.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["case"];return this.eachChild((e=>{t.push(e.serialize())})),t}}var id=ed;class nd{constructor(t,e,i,n){this.type=t,this.input=e,this.beginIndex=i,this.endIndex=n}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,ou),n=e.parse(t[2],2,eu);if(!i||!n)return null;if(!fu(i.type,[uu(ou),iu,ou]))return e.error(`Expected first argument to be of type array or string, but found ${cu(i.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,eu);return r?new nd(i.type,i,n,r):null}return new nd(i.type,i,n)}evaluate(t){const e=this.input.evaluate(t),i=this.beginIndex.evaluate(t);if(!gu(e,["string","array"]))throw new Eu(`Expected first argument to be of type array or string, but found ${cu(bu(e))} instead.`);if(this.endIndex){const n=this.endIndex.evaluate(t);return e.slice(i,n)}return e.slice(i)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}var rd=nd;function sd(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function od(t,e,i,n){return 0===n.compare(e,i)}function ad(t,e,i){const n="=="!==t&&"!="!==t;return class r{constructor(t,e,i){this.type=nu,this.lhs=t,this.rhs=e,this.collator=i,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const i=t[0];let s=e.parse(t[1],1,ou);if(!s)return null;if(!sd(i,s.type))return e.concat(1).error(`"${i}" comparisons are not supported for type '${cu(s.type)}'.`);let o=e.parse(t[2],2,ou);if(!o)return null;if(!sd(i,o.type))return e.concat(2).error(`"${i}" comparisons are not supported for type '${cu(o.type)}'.`);if(s.type.kind!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error(`Cannot compare types '${cu(s.type)}' and '${cu(o.type)}'.`);n&&("value"===s.type.kind&&"value"!==o.type.kind?s=new Iu(o.type,[s]):"value"!==s.type.kind&&"value"===o.type.kind&&(o=new Iu(s.type,[o])));let a=null;if(4===t.length){if("string"!==s.type.kind&&"string"!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error("Cannot use collator to compare non-string types.");if(a=e.parse(t[3],3,au),!a)return null}return new r(s,o,a)}evaluate(r){const s=this.lhs.evaluate(r),o=this.rhs.evaluate(r);if(n&&this.hasUntypedArgument){const e=bu(s),i=bu(o);if(e.kind!==i.kind||"string"!==e.kind&&"number"!==e.kind)throw new Eu(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${i.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const t=bu(s),i=bu(o);if("string"!==t.kind||"string"!==i.kind)return e(r,s,o)}return this.collator?i(r,s,o,this.collator.evaluate(r)):e(r,s,o)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}serialize(){const e=[t];return this.eachChild((t=>{e.push(t.serialize())})),e}}}const ld=ad("==",(function(t,e,i){return e===i}),od),hd=ad("!=",(function(t,e,i){return e!==i}),(function(t,e,i,n){return!od(0,e,i,n)})),ud=ad("<",(function(t,e,i){return e",(function(t,e,i){return e>i}),(function(t,e,i,n){return n.compare(e,i)>0})),dd=ad("<=",(function(t,e,i){return e<=i}),(function(t,e,i,n){return n.compare(e,i)<=0})),pd=ad(">=",(function(t,e,i){return e>=i}),(function(t,e,i,n){return n.compare(e,i)>=0}));class fd{constructor(t,e,i,n,r,s){this.type=iu,this.number=t,this.locale=e,this.currency=i,this.unit=n,this.minFractionDigits=r,this.maxFractionDigits=s}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,eu);if(!i)return null;const n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");let r=null;if(n.locale&&(r=e.parse(n.locale,1,iu),!r))return null;let s=null;if(n.currency&&(s=e.parse(n.currency,1,iu),!s))return null;let o=null;if(n.unit&&(o=e.parse(n.unit,1,iu),!o))return null;let a=null;if(n["min-fraction-digits"]&&(a=e.parse(n["min-fraction-digits"],1,eu),!a))return null;let l=null;return n["max-fraction-digits"]&&(l=e.parse(n["max-fraction-digits"],1,eu),!l)?null:new fd(i,r,s,o,a,l)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(t):void 0,unit:this.unit?this.unit.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.unit&&t(this.unit),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.unit&&(t.unit=this.unit.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]}}class gd{constructor(t){this.type=eu,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const i=e.parse(t[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?e.error(`Expected argument of type string or array, but found ${cu(i.type)} instead.`):new gd(i):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new Eu(`Expected value to be of type string or array, but found ${cu(bu(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){const t=["length"];return this.eachChild((e=>{t.push(e.serialize())})),t}}const md={"==":ld,"!=":hd,">":cd,"<":ud,">=":pd,"<=":dd,array:Iu,at:$c,boolean:Iu,case:id,coalesce:Uc,collator:Xu,format:ku,image:Fu,in:Kc,"index-of":Jc,interpolate:Wc,"interpolate-hcl":Wc,"interpolate-lab":Wc,length:gd,let:qc,literal:Cu,match:td,number:Iu,"number-format":fd,object:Iu,slice:rd,step:mc,string:Iu,"to-boolean":Pu,"to-color":Pu,"to-number":Pu,"to-string":Pu,var:uc,within:sc};function yd(t,[e,i,n,r]){e=e.evaluate(t),i=i.evaluate(t),n=n.evaluate(t);const s=r?r.evaluate(t):1,o=vu(e,i,n,s);if(o)throw new Eu(o);return new jh(e/255*s,i/255*s,n/255*s,s)}function _d(t,e){return t in e}function xd(t,e){const i=e[t];return void 0===i?null:i}function vd(t){return{type:t}}Gu.register(md,{error:[{kind:"error"},[iu],(t,[e])=>{throw new Eu(e.evaluate(t))}],typeof:[iu,[ou],(t,[e])=>cu(bu(e.evaluate(t)))],"to-rgba":[uu(eu,4),[ru],(t,[e])=>e.evaluate(t).toArray()],rgb:[ru,[eu,eu,eu],yd],rgba:[ru,[eu,eu,eu,eu],yd],has:{type:nu,overloads:[[[iu],(t,[e])=>_d(e.evaluate(t),t.properties())],[[iu,su],(t,[e,i])=>_d(e.evaluate(t),i.evaluate(t))]]},get:{type:ou,overloads:[[[iu],(t,[e])=>xd(e.evaluate(t),t.properties())],[[iu,su],(t,[e,i])=>xd(e.evaluate(t),i.evaluate(t))]]},"feature-state":[ou,[iu],(t,[e])=>xd(e.evaluate(t),t.featureState||{})],properties:[su,[],t=>t.properties()],"geometry-type":[iu,[],t=>t.geometryType()],id:[ou,[],t=>t.id()],zoom:[eu,[],t=>t.globals.zoom],pitch:[eu,[],t=>t.globals.pitch||0],"distance-from-center":[eu,[],t=>t.distanceFromCenter()],"heatmap-density":[eu,[],t=>t.globals.heatmapDensity||0],"line-progress":[eu,[],t=>t.globals.lineProgress||0],"sky-radial-progress":[eu,[],t=>t.globals.skyRadialProgress||0],accumulated:[ou,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[eu,vd(eu),(t,e)=>{let i=0;for(const n of e)i+=n.evaluate(t);return i}],"*":[eu,vd(eu),(t,e)=>{let i=1;for(const n of e)i*=n.evaluate(t);return i}],"-":{type:eu,overloads:[[[eu,eu],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[eu],(t,[e])=>-e.evaluate(t)]]},"/":[eu,[eu,eu],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[eu,[eu,eu],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[eu,[],()=>Math.LN2],pi:[eu,[],()=>Math.PI],e:[eu,[],()=>Math.E],"^":[eu,[eu,eu],(t,[e,i])=>Math.pow(e.evaluate(t),i.evaluate(t))],sqrt:[eu,[eu],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[eu,[eu],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[eu,[eu],(t,[e])=>Math.log(e.evaluate(t))],log2:[eu,[eu],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[eu,[eu],(t,[e])=>Math.sin(e.evaluate(t))],cos:[eu,[eu],(t,[e])=>Math.cos(e.evaluate(t))],tan:[eu,[eu],(t,[e])=>Math.tan(e.evaluate(t))],asin:[eu,[eu],(t,[e])=>Math.asin(e.evaluate(t))],acos:[eu,[eu],(t,[e])=>Math.acos(e.evaluate(t))],atan:[eu,[eu],(t,[e])=>Math.atan(e.evaluate(t))],min:[eu,vd(eu),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[eu,vd(eu),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[eu,[eu],(t,[e])=>Math.abs(e.evaluate(t))],round:[eu,[eu],(t,[e])=>{const i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[eu,[eu],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[eu,[eu],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[nu,[iu,ou],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[nu,[ou],(t,[e])=>t.id()===e.value],"filter-type-==":[nu,[iu],(t,[e])=>t.geometryType()===e.value],"filter-<":[nu,[iu,ou],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n{const i=t.id(),n=e.value;return typeof i==typeof n&&i":[nu,[iu,ou],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n>r}],"filter-id->":[nu,[ou],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>n}],"filter-<=":[nu,[iu,ou],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n<=r}],"filter-id-<=":[nu,[ou],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<=n}],"filter->=":[nu,[iu,ou],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n>=r}],"filter-id->=":[nu,[ou],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>=n}],"filter-has":[nu,[ou],(t,[e])=>e.value in t.properties()],"filter-has-id":[nu,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[nu,[uu(iu)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[nu,[uu(ou)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[nu,[iu,uu(ou)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[nu,[iu,uu(ou)],(t,[e,i])=>function(t,e,i,n){for(;i<=n;){const r=i+n>>1;if(e[r]===t)return!0;e[r]>t?n=r-1:i=r+1}return!1}(t.properties()[e.value],i.value,0,i.value.length-1)],all:{type:nu,overloads:[[[nu,nu],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[vd(nu),(t,e)=>{for(const i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:nu,overloads:[[[nu,nu],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[vd(nu),(t,e)=>{for(const i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[nu,[nu],(t,[e])=>!e.evaluate(t)],"is-supported-script":[nu,[iu],(t,[e])=>{const i=t.globals&&t.globals.isSupportedScript;return!i||i(e.evaluate(t))}],upcase:[iu,[iu],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[iu,[iu],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[iu,vd(ou),(t,e)=>e.map((e=>Su(e.evaluate(t)))).join("")],"resolved-locale":[iu,[au],(t,[e])=>e.evaluate(t).resolvedLocale()]});var wd=md;function bd(t){return{result:"success",value:t}}function Sd(t){return{result:"error",value:t}}function Td(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}class Cd{constructor(t,e){this.expression=t,this._warningHistory={},this._evaluator=new zu,this._defaultValue=e?function(t){return"color"===t.type&&(Td(t.default)||Array.isArray(t.default))?new jh(0,0,0,0):"color"===t.type?jh.parse(t.default)||null:void 0===t.default?null:t.default}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null}evaluateWithoutErrorHandling(t,e,i,n,r,s,o,a){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=i,this._evaluator.canonical=n||null,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=s,this._evaluator.featureTileCoord=o||null,this._evaluator.featureDistanceData=a||null,this.expression.evaluate(this._evaluator)}evaluate(t,e,i,n,r,s,o,a){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=i||null,this._evaluator.canonical=n||null,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=s||null,this._evaluator.featureTileCoord=o||null,this._evaluator.featureDistanceData=a||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new Eu(`Expected value to be one of ${Object.keys(this._enumValues).map((t=>JSON.stringify(t))).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}}}function Ed(t,e){const i=new dc(wd,[],e?function(t){const e={color:ru,string:iu,number:eu,enum:iu,boolean:nu,formatted:lu,resolvedImage:hu};if("array"===t.type)return uu(e[t.value]||ou,t.length);return e[t.type]}(e):void 0),n=i.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return n?bd(new Cd(n,e)):Sd(i.errors)}class Rd{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!ac(e.expression)}evaluateWithoutErrorHandling(t,e,i,n,r,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,n,r,s)}evaluate(t,e,i,n,r,s){return this._styleExpression.evaluate(t,e,i,n,r,s)}}class Md{constructor(t,e,i,n){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent="camera"!==t&&!ac(e.expression),this.interpolationType=n}evaluateWithoutErrorHandling(t,e,i,n,r,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,n,r,s)}evaluate(t,e,i,n,r,s){return this._styleExpression.evaluate(t,e,i,n,r,s)}interpolationFactor(t,e,i){return this.interpolationType?Wc.interpolationFactor(this.interpolationType,t,e,i):0}}function Id(t,e){if("error"===(t=Ed(t,e)).result)return t;const i=t.value.expression,n=oc(i);if(!n&&!function(t){return"data-driven"===t["property-type"]}(e))return Sd([new Hh("","data expressions not supported")]);const r=lc(i,["zoom","pitch","distance-from-center"]);if(!r&&!function(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}(e))return Sd([new Hh("","zoom expressions not supported")]);const s=kd(i);if(!s&&!r)return Sd([new Hh("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(s instanceof Hh)return Sd([s]);if(s instanceof Wc&&!function(t){return!!t.expression&&t.expression.interpolated}(e))return Sd([new Hh("",'"interpolate" expressions cannot be used with this property')]);if(!s)return bd(new Rd(n?"constant":"source",t.value));const o=s instanceof Wc?s.interpolation:void 0;return bd(new Md(n?"camera":"composite",t.value,s.labels,o))}function kd(t){let e=null;if(t instanceof qc)e=kd(t.result);else if(t instanceof Uc){for(const i of t.args)if(e=kd(i),e)break}else(t instanceof mc||t instanceof Wc)&&t.input instanceof Gu&&"zoom"===t.input.name&&(e=t);return e instanceof Hh||t.eachChild((t=>{const i=kd(t);i instanceof Hh?e=i:!e&&i?e=new Hh("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&i&&e!==i&&(e=new Hh("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function Fd(t){if(Array.isArray(t))return t.map(Fd);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const i in t)e[i]=Fd(t[i]);return e}return function(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}(t)}var Ad={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},fog:{type:"fog"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},projection:{type:"projection"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{},sky:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background","layout_sky"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_sky:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"},"fill-extrusion-edge-radius":{type:"number",private:!0,default:0,minimum:0,maximum:1,"property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_symbol:{type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature","pitch","distance-from-center"]}},filter_fill:{type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}},filter_line:{type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}},filter_circle:{type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}},"filter_fill-extrusion":{type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}},filter_heatmap:{type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},expression_name:{type:"enum",values:{let:{group:"Variable binding"},var:{group:"Variable binding"},literal:{group:"Types"},array:{group:"Types"},at:{group:"Lookup"},in:{group:"Lookup"},"index-of":{group:"Lookup"},slice:{group:"Lookup"},case:{group:"Decision"},match:{group:"Decision"},coalesce:{group:"Decision"},step:{group:"Ramps, scales, curves"},interpolate:{group:"Ramps, scales, curves"},"interpolate-hcl":{group:"Ramps, scales, curves"},"interpolate-lab":{group:"Ramps, scales, curves"},ln2:{group:"Math"},pi:{group:"Math"},e:{group:"Math"},typeof:{group:"Types"},string:{group:"Types"},number:{group:"Types"},boolean:{group:"Types"},object:{group:"Types"},collator:{group:"Types"},format:{group:"Types"},image:{group:"Types"},"number-format":{group:"Types"},"to-string":{group:"Types"},"to-number":{group:"Types"},"to-boolean":{group:"Types"},"to-rgba":{group:"Color"},"to-color":{group:"Types"},rgb:{group:"Color"},rgba:{group:"Color"},get:{group:"Lookup"},has:{group:"Lookup"},length:{group:"Lookup"},properties:{group:"Feature data"},"feature-state":{group:"Feature data"},"geometry-type":{group:"Feature data"},id:{group:"Feature data"},zoom:{group:"Camera"},pitch:{group:"Camera"},"distance-from-center":{group:"Camera"},"heatmap-density":{group:"Heatmap"},"line-progress":{group:"Feature data"},"sky-radial-progress":{group:"sky"},accumulated:{group:"Feature data"},"+":{group:"Math"},"*":{group:"Math"},"-":{group:"Math"},"/":{group:"Math"},"%":{group:"Math"},"^":{group:"Math"},sqrt:{group:"Math"},log10:{group:"Math"},ln:{group:"Math"},log2:{group:"Math"},sin:{group:"Math"},cos:{group:"Math"},tan:{group:"Math"},asin:{group:"Math"},acos:{group:"Math"},atan:{group:"Math"},min:{group:"Math"},max:{group:"Math"},round:{group:"Math"},abs:{group:"Math"},ceil:{group:"Math"},floor:{group:"Math"},distance:{group:"Math"},"==":{group:"Decision"},"!=":{group:"Decision"},">":{group:"Decision"},"<":{group:"Decision"},">=":{group:"Decision"},"<=":{group:"Decision"},all:{group:"Decision"},any:{group:"Decision"},"!":{group:"Decision"},within:{group:"Decision"},"is-supported-script":{group:"String"},upcase:{group:"String"},downcase:{group:"String"},concat:{group:"String"},"resolved-locale":{group:"String"}}},fog:{range:{type:"array",default:[.5,10],minimum:-20,maximum:20,length:2,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"high-color":{type:"color","property-type":"data-constant",default:"#245cdf",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"space-color":{type:"color","property-type":"data-constant",default:["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-blend":{type:"number","property-type":"data-constant",default:["interpolate",["linear"],["zoom"],4,.2,7,.1],minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"star-intensity":{type:"number","property-type":"data-constant",default:["interpolate",["linear"],["zoom"],5,.35,6,0],minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},projection:{name:{type:"enum",values:{albers:{},equalEarth:{},equirectangular:{},lambertConformalConic:{},mercator:{},naturalEarth:{},winkelTripel:{},globe:{}},default:"mercator",required:!0},center:{type:"array",length:2,value:"number","property-type":"data-constant",minimum:[-180,-90],maximum:[180,90],transition:!1,requires:[{name:["albers","lambertConformalConic"]}]},parallels:{type:"array",length:2,value:"number","property-type":"data-constant",minimum:[-90,-90],maximum:[90,90],transition:!1,requires:[{name:["albers","lambertConformalConic"]}]}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number","property-type":"data-constant",default:1,minimum:0,maximum:1e3,expression:{interpolated:!0,parameters:["zoom"]},transition:!0,requires:["source"]}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!1,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!1,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant",type:"number",private:!0,default:0,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant",type:"number",private:!0,default:3,minimum:0,expression:{interpolated:!0,parameters:["zoom"]},transition:!0,requires:["fill-extrusion-edge-radius"]}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!1,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{type:"resolvedImage",transition:!1,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"},"line-trim-offset":{type:"array",value:"number",length:2,default:[0,0],minimum:[0,0],maximum:[1,1],transition:!1,requires:[{source:"geojson",has:{lineMetrics:!0}}],"property-type":"constant"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_sky:{"sky-type":{type:"enum",values:{gradient:{},atmosphere:{}},default:"atmosphere",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{type:"array",value:"number",length:2,units:"degrees",minimum:[0,0],maximum:[360,180],transition:!1,requires:[{"sky-type":"atmosphere"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{type:"number",requires:[{"sky-type":"atmosphere"}],default:10,minimum:0,maximum:100,transition:!1,"property-type":"data-constant"},"sky-gradient-center":{type:"array",requires:[{"sky-type":"gradient"}],value:"number",default:[0,0],length:2,units:"degrees",minimum:[0,0],maximum:[360,180],transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{type:"number",requires:[{"sky-type":"gradient"}],default:90,minimum:0,maximum:180,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-gradient":{type:"color",default:["interpolate",["linear"],["sky-radial-progress"],.8,"#87ceeb",1,"white"],transition:!1,requires:[{"sky-type":"gradient"}],expression:{interpolated:!0,parameters:["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{type:"color",default:"white",transition:!1,requires:[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-atmosphere-color":{type:"color",default:"white",transition:!1,requires:[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};function Dd(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!Dd(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}function Pd(t,e="fill"){if(null==t)return{filter:()=>!0,needGeometry:!1,needFeature:!1};Dd(t)||(t=Nd(t));const i=t;let n=!0;try{n=function(t){if(!Od(t))return t;let e=Fd(t);return zd(e),e=Ld(e),e}(i)}catch(t){console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.\nThis is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md\nand paste the contents of this message in the report.\nThank you!\nFilter Expression:\n${JSON.stringify(i,null,2)}\n `)}const r=Ad[`filter_${e}`],s=Ed(n,r);let o=null;if("error"===s.result)throw new Error(s.value.map((t=>`${t.key}: ${t.message}`)).join(", "));o=(t,e,i)=>s.value.evaluate(t,e,{},i);let a=null,l=null;if(n!==i){const t=Ed(i,r);if("error"===t.result)throw new Error(t.value.map((t=>`${t.key}: ${t.message}`)).join(", "));a=(e,i,n,r,s)=>t.value.evaluate(e,i,{},n,void 0,void 0,r,s),l=!oc(t.value.expression)}return{filter:o,dynamicFilter:a||void 0,needGeometry:jd(n),needFeature:!!l}}function Ld(t){if(!Array.isArray(t))return t;const e=function(t){if(Gd.has(t[0]))for(let e=1;eLd(t)))}function zd(t){let e=!1;const i=[];if("case"===t[0]){for(let n=1;n",">=","<","<=","to-boolean"]);function Xd(t,e){return te?1:0}function jd(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(let e=1;e"===e||"<="===e||">="===e?Wd(t[1],t[2],e):"any"===e?(i=t.slice(1),["any"].concat(i.map(Nd))):"all"===e?["all"].concat(t.slice(1).map(Nd)):"none"===e?["all"].concat(t.slice(1).map(Nd).map(Bd)):"in"===e?Yd(t[1],t.slice(2)):"!in"===e?Bd(Yd(t[1],t.slice(2))):"has"===e?Ud(t[1]):"!has"===e?Bd(Ud(t[1])):"within"!==e||t}function Wd(t,e,i){switch(t){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,t,e]}}function Yd(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((t=>typeof t!=typeof e[0]))?["filter-in-large",t,["literal",e.sort(Xd)]]:["filter-in-small",t,["literal",e]]}}function Ud(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Bd(t){return["!",t]}var qd=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Zd(t,e){const i={};for(const e in t)"ref"!==e&&(i[e]=t[e]);return qd.forEach((t=>{t in e&&(i[t]=e[t])})),i}function $d(t){t=t.slice();const e=Object.create(null);for(let i=0;i1?c[c.length-2].toLowerCase():"";if(d==p||d==p.replace("-","")||f+"-"+d==p){o=r?o:Vd[p],c.pop(),f&&p.startsWith(f)&&c.pop();break}}r||"number"!=typeof d||(o=d,r=!0);var g=c.join(Kd).replace("Klokantech Noto Sans","Noto Sans");-1!==g.indexOf(Kd)&&(g='"'+g+'"'),l.push(g)}n=Jd[t]=[a,o,l]}return n[0]+Kd+n[1]+Kd+e+"px"+(i?"/"+i:"")+Kd+n[2]}));const tp={},ep={};let ip=0;function np(t){return t.id||(t.id=ip++),t.id}function rp(t,e){return np(t)+"."+wt(e)}function sp(t){let e=tp[t.id];return e||(e={},tp[np(t)]=e),e}function op(t){let e=ep[t.id];return e||(e={},ep[np(t)]=e),e}function ap(t){return t*Math.PI/180}const lp=function(){const t=[];for(let e=78271.51696402048;t.length<=24;e/=2)t.push(e);return t}();function hp(t,e){if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas)return new OffscreenCanvas(t,e);const i=document.createElement("canvas");return i.width=t,i.height=e,i}function up(t,e){let i=0;const n=e.length;for(;i0&&o.arc(t,r,i*e.pixelRatio,0,2*Math.PI)}return o.fill(),s}function dp(t,e,i){const n=Math.max(0,Math.min(1,(i-t)/(e-t)));return n*n*(3-2*n)}function pp(t,e,i){const n=hp(e.width,e.height),r=n.getContext("2d");r.drawImage(t,e.x,e.y,e.width,e.height,0,0,e.width,e.height);const s=r.getImageData(0,0,e.width,e.height),o=s.data;for(let t=0,e=s.width;t0?(o[r+0]=Math.round(255*i.r*l),o[r+1]=Math.round(255*i.g*l),o[r+2]=Math.round(255*i.b*l),o[r+3]=Math.round(255*l)):o[r+3]=0}return r.putImageData(s,0,0),n}const fp=Array(256).join(" ");function gp(t,e){if(e>=.05){let i="";const n=t.split("\n"),r=fp.slice(0,Math.round(e/.1));for(let t=0,e=n.length;t0&&(i+="\n"),i+=n[t].split("").join(r);return i}return t}let mp;function yp(){return mp||(mp=hp(1,1).getContext("2d")),mp}function _p(t,e){return yp().measureText(t).width+(t.length-1)*e}const xp={};function vp(t,e,i,n){if(-1!==t.indexOf("\n")){const r=t.split("\n"),s=[];for(let t=0,o=r.length;t1){const t=yp();t.font=e;const r=t.measureText("M").width*i;let a="";const l=[];for(let t=0,e=o.length;t1;++t){const i=l[t];if(_p(i,n)<.35*r){const r=t>0?_p(l[t-1],n):1/0,s=t.7*r&&_p(s,n)<.6*r){const o=i.split(" "),a=o.pop();_p(a,n)<.2*r&&(l[t]=o.join(" "),l[t+1]=a+" "+s),e-=1}}s=l.join("\n")}else s=t;s=gp(s,n),xp[r]=s}return s}const wp={Point:1,MultiPoint:1,LineString:2,MultiLineString:2,Polygon:3,MultiPolygon:3},bp={center:[.5,.5],left:[0,.5],right:[1,.5],top:[.5,0],bottom:[.5,1],"top-left":[0,0],"top-right":[1,0],"bottom-left":[0,1],"bottom-right":[1,1]},Sp=function(t,e){const i=Id(t,e);if("error"===i.result)throw new Error(i.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return i.value},Tp={},Cp={zoom:0};let Ep,Rp;function Mp(t,e,i,n,r,s,o){const a=t.id;s||(s={},console.warn("No functionCache provided to getValue()")),s[a]||(s[a]={});const l=s[a];if(!l[i]){let n=(t[e]||Tp)[i];const r=Ad[`${e}_${t.type}`][i];void 0===n&&(n=r.default);let s=(h=n,Array.isArray(h)&&h.length>0&&"string"==typeof h[0]&&h[0]in wd);if(!s&&Td(n)&&(n=Wh(n,r),s=!0),s){const t=Sp(n,r);l[i]=t.evaluate.bind(t)}else"color"==r.type&&(n=jh.parse(n)),l[i]=function(){return n}}var h;return Cp.zoom=n,l[i](Cp,r,o)}function Ip(t,e,i,n,r){if(!Mp(t,"layout",`${n}-allow-overlap`,e,i,r))return"declutter";return Mp(t,"layout",`${n}-ignore-placement`,e,i,r)?"none":"obstacle"}function kp(t,e,i,n,r){return r||console.warn("No filterCache provided to evaluateFilter()"),t in r||(r[t]=Pd(e).filter),Cp.zoom=n,r[t](Cp,i)}let Fp=!1;function Ap(t,e){if(t){if(!Fp&&(0===t.a||0===e))return;const i=t.a;return e=void 0===e?1:e,0===i?"transparent":"rgba("+Math.round(255*t.r/i)+","+Math.round(255*t.g/i)+","+Math.round(255*t.b/i)+","+i*e+")"}return t}const Dp=/\{[^{}}]*\}/g;function Pp(t,e){return t.replace(Dp,(function(t){return e[t.slice(1,-1)]||""}))}let Lp=!1;const zp={};function Op(t,e,i,n=lp,r=void 0,s=void 0,o=void 0,a=void 0){if("string"==typeof e&&(e=JSON.parse(e)),8!=e.version)throw new Error("glStyle version 8 required.");let l,h,u;if(zp[rp(e,t)]=Array.from(arguments),s)if("undefined"!=typeof Image){const e=new Image;let i;Q((()=>s)).then((t=>{t instanceof Request?fetch(t).then((t=>t.blob())).then((t=>{i=URL.createObjectURL(t),e.src=i})).catch((()=>{})):(e.crossOrigin="anonymous",e.src=t,i&&URL.revokeObjectURL(i))})),e.onload=function(){l=e,h=[e.width,e.height],t.changed(),e.onload=null}}else if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope){const t=self;t.postMessage({action:"loadImage",src:s}),t.addEventListener("message",(function(t){"imageLoaded"===t.data.action&&t.data.src===s&&(l=t.data.image,h=[l.width,l.height])}))}const c=$d(e.layers),d={},p=[],f={},g={},m=sp(e),y=op(e);let _;for(let t=0,n=c.length;t=M.maxzoom)continue;const A=M.filter;if(!A||kp(I,A,T,b,y)){let n,c,y,_,I,A;E=M;const D=d.index;if(3==S&&("fill"==M.type||"fill-extrusion"==M.type))if(c=Mp(M,"paint",M.type+"-opacity",b,T,m,C),M.type+"-pattern"in F){const t=Mp(M,"paint",M.type+"-pattern",b,T,m,C);if(t){const e="string"==typeof t?Pp(t,p):t.toString();if(l&&r&&r[e]){++R,A=w[R],A&&A.getFill()&&!A.getStroke()&&!A.getText()||(A=new sr({fill:new te}),w[R]=A),y=A.getFill(),A.setZIndex(D);const t=e+"."+c;let i=g[t];if(!i){const n=r[e],s=hp(n.width,n.height),o=s.getContext("2d");o.globalAlpha=c,o.drawImage(l,n.x,n.y,n.width,n.height,0,0,n.width,n.height),i=o.createPattern(s,"repeat"),g[t]=i}y.setColor(i)}}}else n=Ap(Mp(M,"paint",M.type+"-color",b,T,m,C),c),M.type+"-outline-color"in F&&(I=Ap(Mp(M,"paint",M.type+"-outline-color",b,T,m,C),c)),I||(I=n),(n||I)&&(++R,A=w[R],(!A||n&&!A.getFill()||!n&&A.getFill()||I&&!A.getStroke()||!I&&A.getStroke()||A.getText())&&(A=new sr({fill:n?new te:void 0,stroke:I?new tr:void 0}),w[R]=A),n&&(y=A.getFill(),y.setColor(n)),I&&(_=A.getStroke(),_.setColor(I),_.setWidth(.5)),A.setZIndex(D));if(1!=S&&"line"==M.type){n="line-pattern"in F?void 0:Ap(Mp(M,"paint","line-color",b,T,m,C),Mp(M,"paint","line-opacity",b,T,m,C));const t=Mp(M,"paint","line-width",b,T,m,C);n&&t>0&&(++R,A=w[R],A&&A.getStroke()&&!A.getFill()&&!A.getText()||(A=new sr({stroke:new tr}),w[R]=A),_=A.getStroke(),_.setLineCap(Mp(M,"layout","line-cap",b,T,m,C)),_.setLineJoin(Mp(M,"layout","line-join",b,T,m,C)),_.setMiterLimit(Mp(M,"layout","line-miter-limit",b,T,m,C)),_.setColor(n),_.setWidth(t),_.setLineDash(F["line-dasharray"]?Mp(M,"paint","line-dasharray",b,T,m,C).map((function(e){return e*t})):null),A.setZIndex(D))}let P,L,z,O,G,X,j,N,W,Y=!1,U=null,B=0;if((1==S||2==S)&&"icon-image"in k){const e=Mp(M,"layout","icon-image",b,T,m,C);if(e){let n;P="string"==typeof e?Pp(e,p):e.toString();const o=a?a(t,P):void 0;if(l&&r&&r[P]||o){const t=Mp(M,"layout","icon-rotation-alignment",b,T,m,C);if(2==S){const e=i.getGeometry();if(e.getFlatMidpoint||e.getFlatMidpoints){const i=e.getExtent();if(Math.sqrt(Math.max(Math.pow((i[2]-i[0])/s,2),Math.pow((i[3]-i[1])/s,2)))>150){const i="MultiLineString"===e.getType()?e.getFlatMidpoints():e.getFlatMidpoint();Rp||(Ep=[NaN,NaN],Rp=new Jn("Point",Ep,[],2,{},void 0)),n=Rp,Ep[0]=i[0],Ep[1]=i[1];if("line"===Mp(M,"layout","symbol-placement",b,T,m,C)&&"map"===t){const t=e.getStride(),n=e.getFlatCoordinates();for(let e=0,r=n.length-t;e=l){B=Math.atan2(s-a,o-r);break}}}}}}if(2!==S||n){const e=Mp(M,"layout","icon-size",b,T,m,C),i=void 0!==F["icon-color"]?Mp(M,"paint","icon-color",b,T,m,C):null;if(!i||0!==i.a){const n=Mp(M,"paint","icon-halo-color",b,T,m,C),s=Mp(M,"paint","icon-halo-width",b,T,m,C);let a=`${P}.${e}.${s}.${n}`;if(null!==i&&(a+=`.${i}`),L=f[a],!L){const c=Ip(M,b,T,"icon",m);let d;"icon-offset"in k&&(d=Mp(M,"layout","icon-offset",b,T,m,C).slice(0),d[0]*=e,d[1]*=-e);let p=i?[255*i.r,255*i.g,255*i.b,i.a]:void 0;if(o){const i={color:p,rotateWithView:"map"===t,displacement:d,declutterMode:c,scale:e};"string"==typeof o?i.src=o:(i.img=o,i.imgSize=[o.width,o.height]),L=new re(i)}else{const o=r[P];let a,f,g;s?o.sdf?(a=cp(pp(l,o,i||[0,0,0,1]),{x:0,y:0,width:o.width,height:o.height,pixelRatio:o.pixelRatio},s,n),p=void 0):a=cp(l,o,s,n):(o.sdf?(u||(u=pp(l,{x:0,y:0,width:h[0],height:h[1]},{r:1,g:1,b:1,a:1})),a=u):a=l,f=[o.width,o.height],g=[o.x,o.y]),L=new re({color:p,img:a,imgSize:h,size:f,offset:g,rotateWithView:"map"===t,scale:e/o.pixelRatio,displacement:d,declutterMode:c})}f[a]=L}}L&&(++R,A=w[R],A&&A.getImage()&&!A.getFill()&&!A.getStroke()||(A=new sr,w[R]=A),A.setGeometry(n),L.setRotation(B+ap(Mp(M,"layout","icon-rotate",b,T,m,C))),L.setOpacity(Mp(M,"paint","icon-opacity",b,T,m,C)),L.setAnchor(bp[Mp(M,"layout","icon-anchor",b,T,m,C)]),A.setImage(L),U=A.getText(),A.setText(void 0),A.setZIndex(D),Y=!0,z=!1)}else z=!0}}}if(1==S&&"circle"===M.type){++R,A=w[R],A&&A.getImage()&&!A.getFill()&&!A.getStroke()||(A=new sr,w[R]=A);const t="circle-radius"in F?Mp(M,"paint","circle-radius",b,T,m,C):5,e=Ap(Mp(M,"paint","circle-stroke-color",b,T,m,C),Mp(M,"paint","circle-stroke-opacity",b,T,m,C)),i=Mp(M,"paint","circle-translate",b,T,m,C),n=Ap(Mp(M,"paint","circle-color",b,T,m,C),Mp(M,"paint","circle-opacity",b,T,m,C)),r=Mp(M,"paint","circle-stroke-width",b,T,m,C),s=t+"."+e+"."+n+"."+r+"."+i[0]+"."+i[1];L=f[s],L||(L=new Jt({radius:t,displacement:[i[0],-i[1]],stroke:e&&r>0?new tr({width:r,color:e}):void 0,fill:n?new te({color:n}):void 0,declutterMode:"none"}),f[s]=L),A.setImage(L),U=A.getText(),A.setText(void 0),A.setGeometry(void 0),A.setZIndex(D),Y=!0}if("text-field"in k){j=Math.round(Mp(M,"layout","text-size",b,T,m,C));const t=Mp(M,"layout","text-font",b,T,m,C);X=Mp(M,"layout","text-line-height",b,T,m,C),G=Qd(o?o(t,e.metadata?e.metadata["ol:webfonts"]:void 0):t,j,X),G.includes("sans-serif")||(G+=",sans-serif"),N=Mp(M,"layout","text-letter-spacing",b,T,m,C),W=Mp(M,"layout","text-max-width",b,T,m,C);const i=Mp(M,"layout","text-field",b,T,m,C);O="object"==typeof i&&i.sections?1===i.sections.length?i.toString():i.sections.reduce(((e,i,n)=>{const r=i.fontStack?i.fontStack.split(","):t,s=Qd(o?o(r):r,j*(i.scale||1),X);let a=i.text;if("\n"===a)return e.push("\n",""),e;if(2==S)return e.push(gp(a,N),s),e;a=vp(a,s,W,N).split("\n");for(let t=0,i=a.length;t0&&e.push("\n",""),e.push(a[t],s);return e}),[]):Pp(i,p).trim(),c=Mp(M,"paint","text-opacity",b,T,m,C)}if(O&&c&&!z){Y||(++R,A=w[R],A&&A.getText()&&!A.getFill()&&!A.getStroke()||(A=new sr,w[R]=A),A.setImage(void 0),A.setGeometry(void 0));const t=Ip(M,b,T,"text",m);A.getText()||A.setText(U),U=A.getText(),(!U||"getDeclutterMode"in U&&U.getDeclutterMode()!==t)&&(U=new ar({padding:[2,2,2,2],declutterMode:t}),A.setText(U));const e=Mp(M,"layout","text-transform",b,T,m,C);"uppercase"==e?O=Array.isArray(O)?O.map(((t,e)=>e%2?t:t.toUpperCase())):O.toUpperCase():"lowercase"==e&&(O=Array.isArray(O)?O.map(((t,e)=>e%2?t:t.toLowerCase())):O.toLowerCase());const i=Array.isArray(O)?O:2==S?gp(O,N):vp(O,G,W,N);if(U.setText(i),U.setFont(G),U.setRotation(ap(Mp(M,"layout","text-rotate",b,T,m,C))),"function"==typeof U.setKeepUpright){const t=Mp(M,"layout","text-keep-upright",b,T,m,C);U.setKeepUpright(t)}const n=Mp(M,"layout","text-anchor",b,T,m,C),r=Y||1==S?"point":Mp(M,"layout","symbol-placement",b,T,m,C);let s;if("line-center"===r?(U.setPlacement("line"),s="center"):U.setPlacement(r),"line"===r&&"function"==typeof U.setRepeat){const t=Mp(M,"layout","symbol-spacing",b,T,m,C);U.setRepeat(2*t)}U.setOverflow("point"===r);let o=Mp(M,"paint","text-halo-width",b,T,m,C);const a=Mp(M,"layout","text-offset",b,T,m,C),l=Mp(M,"paint","text-translate",b,T,m,C);let h=0,u=0;if("point"==r){s="center",-1!==n.indexOf("left")?(s="left",u=o):-1!==n.indexOf("right")&&(s="right",u=-o);const t=Mp(M,"layout","text-rotation-alignment",b,T,m,C);U.setRotateWithView("map"==t)}else U.setMaxAngle(ap(Mp(M,"layout","text-max-angle",b,T,m,C))*O.length/i.length),U.setRotateWithView(!1);U.setTextAlign(s);let d="middle";0==n.indexOf("bottom")?(d="bottom",h=-o-.5*(X-1)*j):0==n.indexOf("top")&&(d="top",h=o+.5*(X-1)*j),U.setTextBaseline(d);const p=Mp(M,"layout","text-justify",b,T,m,C);U.setJustify("auto"===p?void 0:p),U.setOffsetX(a[0]*j+u+l[0]),U.setOffsetY(a[1]*j+h+l[1]),v.setColor(Ap(Mp(M,"paint","text-color",b,T,m,C),c)),U.setFill(v);const f=Ap(Mp(M,"paint","text-halo-color",b,T,m,C),c);if(f&&o>0){x.setColor(f),o*=2;const t=.5*j;x.setWidth(o<=t?o:t),U.setStroke(x)}else U.setStroke(void 0);const g=Mp(M,"layout","text-padding",b,T,m,C),y=U.getPadding();g!==y[0]&&(y[0]=g,y[1]=g,y[2]=g,y[3]=g),A.setZIndex(D)}}}return R>-1?(w.length=R+1,Lp&&("set"in i?i.set("mapbox-layer",E):i.getProperties()["mapbox-layer"]=E),w):void 0};return t.setStyle(b),t.set("mapbox-source",_),t.set("mapbox-layers",p),t.set("mapbox-featurestate",t.get("mapbox-featurestate")||{}),b}const Gp="get_your_own_D6rA4zTHduk6KOKTXzGB",Xp=self;let jp,Np,Wp;const Yp=new OffscreenCanvas(1,1);Yp.style={};const Up=Yp.getContext("2d"),Bp={landcover:new Ih({maxZoom:9,format:new to,url:"https://api.maptiler.com/tiles/landcover/{z}/{x}/{y}.pbf?key="+Gp}),contours:new Ih({minZoom:9,maxZoom:14,format:new to,url:"https://api.maptiler.com/tiles/contours/{z}/{x}/{y}.pbf?key="+Gp}),maptiler_planet:new Ih({format:new to,maxZoom:14,url:"https://api.maptiler.com/tiles/v3/{z}/{x}/{y}.pbf?key="+Gp})},qp=[];function Zp(t){return t[0].replace("Noto Sans","serif").replace("Roboto","sans-serif")}const $p=new no(((t,e,i,n)=>ro(jp,t,e,i,n)),(()=>Xp.postMessage({action:"requestRender"})));Xp.addEventListener("message",(t=>{if("requestFeatures"===t.data.action){const e=qp.filter((t=>Ds(t.getLayerState(),jp.viewState))).map((e=>e.getFeatures(t.data.pixel)));return void Promise.all(e).then((t=>{const e=t.flat();Xp.postMessage({action:"getFeatures",features:e.map((t=>t.getProperties()))})}))}if("render"!==t.data.action)return;jp=t.data.frameState,Np||(Np=jp.pixelRatio,fetch("https://api.maptiler.com/maps/streets-v2/style.json?key="+Gp).then((t=>t.json())).then((t=>{const e=[];let i;t.layers.forEach((t=>{t.source&&(i!==t.source&&(i=t.source,e.push({source:t.source,layers:[]})),e[e.length-1].layers.push(t.id))}));const n=t.sprite+(Np>1?"@2x":"")+".json",r=t.sprite+(Np>1?"@2x":"")+".png";fetch(n).then((t=>t.json())).then((i=>{e.forEach((e=>{const n=Bp[e.source];if(!n)return;const s=new Eh({declutter:!0,source:n,minZoom:n.getTileGrid().getMinZoom()});s.getRenderer().useContainer=function(t,e){this.containerReused=this.getLayer()!==qp[0],this.canvas=Yp,this.context=Up,this.container={firstElementChild:Yp,style:{opacity:s.getOpacity()}},Wp=e},Op(s,t,e.layers,void 0,i,r,Zp),qp.push(s)})),Xp.postMessage({action:"requestRender"})}))}))),jp.tileQueue=$p,jp.viewState.projection=vn("EPSG:3857"),jp.layerStatesArray=qp.map((t=>t.getLayerState())),qp.forEach((t=>{if(Ds(t.getLayerState(),jp.viewState)){t.getDeclutter()&&!jp.declutterTree&&(jp.declutter={});t.getRenderer().renderFrame(jp,Yp)}})),qp.forEach((t=>{t.getRenderer().context&&(t.renderDeclutter(jp,t.getLayerState()),t.renderDeferred(jp))})),jp.postRenderFunctions.forEach((t=>t(null,jp))),$p.getTilesLoading()<8&&($p.reprioritize(),$p.loadMoreTiles(8,2));const e=Yp.transferToImageBitmap();Xp.postMessage({action:"rendered",imageData:e,transform:Wp,frameState:{viewState:{center:jp.viewState.center.slice(0),resolution:jp.viewState.resolution,rotation:jp.viewState.rotation},pixelRatio:jp.pixelRatio,size:jp.size.slice(0),extent:jp.extent.slice(0),coordinateToPixelTransform:jp.coordinateToPixelTransform.slice(0),pixelToCoordinateTransform:jp.pixelToCoordinateTransform.slice(0)}},[e])}))}();
+!function(){"use strict";var t={880:function(t){t.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}}},e={};var i={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4},n=function i(n){var r=e[n];if(void 0!==r)return r.exports;var s=e[n]={exports:{}};return t[n](s,s.exports,i),s.exports}(880),r=function(t){var e,i,r=[],o=1;if("number"==typeof t)return{space:"rgb",values:[t>>>16,(65280&t)>>>8,255&t],alpha:1};if("number"==typeof t)return{space:"rgb",values:[t>>>16,(65280&t)>>>8,255&t],alpha:1};if(t=String(t).toLowerCase(),n[t])r=n[t].slice(),i="rgb";else if("transparent"===t)o=0,i="rgb",r=[0,0,0];else if("#"===t[0]){var a=t.slice(1),l=a.length;o=1,l<=4?(r=[parseInt(a[0]+a[0],16),parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16)],4===l&&(o=parseInt(a[3]+a[3],16)/255)):(r=[parseInt(a[0]+a[1],16),parseInt(a[2]+a[3],16),parseInt(a[4]+a[5],16)],8===l&&(o=parseInt(a[6]+a[7],16)/255)),r[0]||(r[0]=0),r[1]||(r[1]=0),r[2]||(r[2]=0),i="rgb"}else if(e=/^((?:rgba?|hs[lvb]a?|hwba?|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms|oklch|oklab|color))\s*\(([^\)]*)\)/.exec(t)){var h=e[1],u="cmyk"===(i=h.replace(/a$/,""))?4:"gray"===i?1:3;r=e[2].trim().split(/\s*[,\/]\s*|\s+/),"color"===i&&(i=r.shift()),o=(r=r.map((function(t,e){if("%"===t[t.length-1])return t=parseFloat(t)/100,3===e?t:"rgb"===i?255*t:"h"===i[0]?100*t:"l"!==i[0]||e?"lab"===i?125*t:"lch"===i?e<2?150*t:360*t:"o"!==i[0]||e?"oklab"===i?.4*t:"oklch"===i?e<2?.4*t:360*t:t:t:100*t;if("h"===i[e]||2===e&&"h"===i[i.length-1]){if(void 0!==s[t])return s[t];if(t.endsWith("deg"))return parseFloat(t);if(t.endsWith("turn"))return 360*parseFloat(t);if(t.endsWith("grad"))return 360*parseFloat(t)/400;if(t.endsWith("rad"))return 180*parseFloat(t)/Math.PI}return"none"===t?0:parseFloat(t)}))).length>u?r.pop():1}else/[0-9](?:\s|\/|,)/.test(t)&&(r=t.match(/([0-9]+)/g).map((function(t){return parseFloat(t)})),i=t.match(/([a-z])/gi)?.join("")?.toLowerCase()||"rgb");return{space:i,values:r,alpha:o}},s={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};var o={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]},a={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],alias:["HSL"],rgb:function(t){var e,i,n,r,s,o=t[0]/360,a=t[1]/100,l=t[2]/100,h=0;if(0===a)return[s=255*l,s,s];for(e=2*l-(i=l<.5?l*(1+a):l+a-l*a),r=[0,0,0];h<3;)(n=o+1/3*-(h-1))<0?n++:n>1&&n--,s=6*n<1?e+6*(i-e)*n:2*n<1?i:3*n<2?e+(i-e)*(2/3-n)*6:e,r[h++]=255*s;return r}};o.hsl=function(t){var e,i,n=t[0]/255,r=t[1]/255,s=t[2]/255,o=Math.min(n,r,s),a=Math.max(n,r,s),l=a-o;return a===o?e=0:n===a?e=(r-s)/l:r===a?e=2+(s-n)/l:s===a&&(e=4+(n-r)/l),(e=Math.min(60*e,360))<0&&(e+=360),i=(o+a)/2,[e,100*(a===o?0:i<=.5?l/(a+o):l/(2-a-o)),100*i]};var l={name:"xyz",min:[0,0,0],channel:["X","Y","Z"],alias:["XYZ","ciexyz","cie1931"],whitepoint:{2:{A:[109.85,100,35.585],C:[98.074,100,118.232],D50:[96.422,100,82.521],D55:[95.682,100,92.149],D65:[95.045592705167,100,108.9057750759878],D75:[94.972,100,122.638],F2:[99.187,100,67.395],F7:[95.044,100,108.755],F11:[100.966,100,64.37],E:[100,100,100]},10:{A:[111.144,100,35.2],C:[97.285,100,116.145],D50:[96.72,100,81.427],D55:[95.799,100,90.926],D65:[94.811,100,107.304],D75:[94.416,100,120.641],F2:[103.28,100,69.026],F7:[95.792,100,107.687],F11:[103.866,100,65.627],E:[100,100,100]}}};l.max=l.whitepoint[2].D65,l.rgb=function(t,e){e=e||l.whitepoint[2].E;var i,n,r,s=t[0]/e[0],o=t[1]/e[1],a=t[2]/e[2];return n=-.96924363628087*s+1.87596750150772*o+.041555057407175*a,r=.055630079696993*s+-.20397695888897*o+1.056971514242878*a,i=(i=3.240969941904521*s+-1.537383177570093*o+-.498610760293*a)>.0031308?1.055*Math.pow(i,1/2.4)-.055:i*=12.92,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:n*=12.92,r=r>.0031308?1.055*Math.pow(r,1/2.4)-.055:r*=12.92,[255*(i=Math.min(Math.max(0,i),1)),255*(n=Math.min(Math.max(0,n),1)),255*(r=Math.min(Math.max(0,r),1))]},o.xyz=function(t,e){var i=t[0]/255,n=t[1]/255,r=t[2]/255,s=.21263900587151*(i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92)+.71516867876775*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)+.072192315360733*(r=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92),o=.019330818715591*i+.11919477979462*n+.95053215224966*r;return[(.41239079926595*i+.35758433938387*n+.18048078840183*r)*(e=e||l.whitepoint[2].E)[0],s*e[1],o*e[2]]};var h=l,u={name:"luv",min:[0,-134,-140],max:[100,224,122],channel:["lightness","u","v"],alias:["LUV","cieluv","cie1976"],xyz:function(t,e,i){var n,r,s,o,a,l,u,c,d;if(s=t[0],o=t[1],a=t[2],0===s)return[0,0,0];return e=e||"D65",i=i||2,n=o/(13*s)+4*(u=h.whitepoint[i][e][0])/(u+15*(c=h.whitepoint[i][e][1])+3*(d=h.whitepoint[i][e][2]))||0,r=a/(13*s)+9*c/(u+15*c+3*d)||0,[9*(l=s>8?c*Math.pow((s+16)/116,3):c*s*.0011070564598794539)*n/(4*r)||0,l,l*(12-3*n-20*r)/(4*r)||0]}};h.luv=function(t,e,i){var n,r,s,o,a,l,u,c,d,p,f;e=e||"D65",i=i||2,p=4*(u=h.whitepoint[i][e][0])/(u+15*(c=h.whitepoint[i][e][1])+3*(d=h.whitepoint[i][e][2])),f=9*c/(u+15*c+3*d),n=4*(o=t[0])/(o+15*(a=t[1])+3*(l=t[2]))||0,r=9*a/(o+15*a+3*l)||0;var g=a/c;return[s=g<=.008856451679035631?903.2962962962961*g:116*Math.pow(g,1/3)-16,13*s*(n-p),13*s*(r-f)]};var c={name:"lchuv",channel:["lightness","chroma","hue"],alias:["LCHuv","cielchuv"],min:[0,0,0],max:[100,100,360],luv:function(t){var e,i=t[0],n=t[1];return e=t[2]/360*2*Math.PI,[i,n*Math.cos(e),n*Math.sin(e)]},xyz:function(t){return u.xyz(c.luv(t))}},d=c;function p(t,e,i){return Math.min(Math.max(t,e),i)}function f(t,e,i,n,r,s){const o=r-i,a=s-n;if(0!==o||0!==a){const l=((t-i)*o+(e-n)*a)/(o*o+a*a);l>1?(i=r,n=s):l>0&&(i+=o*l,n+=a*l)}return g(t,e,i,n)}function g(t,e,i,n){const r=i-t,s=n-e;return r*r+s*s}function m(t){return 180*t/Math.PI}function y(t){return t*Math.PI/180}function _(t,e){const i=t%e;return i*e<0?i+e:i}function x(t,e,i){return t+i*(e-t)}function v(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function w(t,e){return Math.floor(v(t,e))}function b(t,e){return Math.ceil(v(t,e))}function S(t,e,i){if(t>=e&&t=C){let t=0;for(const e in E)0==(3&t++)&&(delete E[e],--R)}const e=function(t){var e;Array.isArray(t)&&t.raw&&(t=String.raw(...arguments)),t instanceof Number&&(t=+t);var i=r(t);if(!i.space)return[];const n="h"===i.space[0]?a.min:o.min,s="h"===i.space[0]?a.max:o.max;return(e=Array(3))[0]=Math.min(Math.max(i.values[0],n[0]),s[0]),e[1]=Math.min(Math.max(i.values[1],n[1]),s[1]),e[2]=Math.min(Math.max(i.values[2],n[2]),s[2]),"h"===i.space[0]&&(e=a.rgb(e)),e.push(Math.min(Math.max(i.alpha,0),1)),e}(t);if(4!==e.length)throw new Error('failed to parse "'+t+'" as color');for(const i of e)if(isNaN(i))throw new Error('failed to parse "'+t+'" as color');return A(e),E[t]=e,++R,e}function F(t){return Array.isArray(t)?t:k(t)}function A(t){return t[0]=p(t[0]+.5|0,0,255),t[1]=p(t[1]+.5|0,0,255),t[2]=p(t[2]+.5|0,0,255),t[3]=p(t[3],0,1),t}function D(t){let e=t[0];e!=(0|e)&&(e=e+.5|0);let i=t[1];i!=(0|i)&&(i=i+.5|0);let n=t[2];n!=(0|n)&&(n=n+.5|0);return"rgba("+e+","+i+","+n+","+(void 0===t[3]?1:Math.round(1e3*t[3])/1e3)+")"}const P="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"",L=(P.includes("firefox"),P.includes("safari")&&!P.includes("chrom")&&(P.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(P)),P.includes("webkit")&&P.includes("edge"),P.includes("macintosh"),"undefined"!=typeof devicePixelRatio&&devicePixelRatio,"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope),z="undefined"!=typeof Image&&Image.prototype.decode;!function(){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch{}}();function O(t,e,i,n){let r;return r=i&&i.length?i.shift():L?new OffscreenCanvas(t||300,e||300):document.createElement("canvas"),t&&(r.width=t),e&&(r.height=e),r.getContext("2d",n)}let G;function X(){return G||(G=O(1,1)),G}function j(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}var N="change",W="error",Y="load";var U=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};function B(t,e){return t>e?1:te?-1:0}function Z(t,e,i){if(t[0]<=e)return 0;const n=t.length;if(e<=t[n-1])return n-1;if("function"==typeof i){for(let r=1;r0?r-1:r}return n-1}if(i>0){for(let i=1;i0)}removeEventListener(t,e){if(!this.listeners_)return;const i=this.listeners_[t];if(!i)return;const n=i.indexOf(e);-1!==n&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=H,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}};function rt(t,e,i,n,r){if(r){const r=i;i=function(s){return t.removeEventListener(e,i),r.call(n??this,s)}}else n&&n!==t&&(i=i.bind(n));const s={target:t,type:e,listener:i};return t.addEventListener(e,i),s}function st(t,e,i,n){return rt(t,e,i,n,!0)}function ot(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),tt(t))}function at(t,e){return e&&(t.src=e),t.src&&z?new Promise(((e,i)=>t.decode().then((()=>e(t))).catch((n=>t.complete&&t.width?e(t):i(n))))):function(t,e){return new Promise(((i,n)=>{function r(){o(),i(t)}function s(){o(),n(new Error("Image load error"))}function o(){t.removeEventListener("load",r),t.removeEventListener("error",s)}t.addEventListener("load",r),t.addEventListener("error",s),e&&(t.src=e)}))}(t)}class lt{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const i=this.cache_[e];0!=(3&t++)||i.hasListener()||(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e,i){const n=ht(t,e,i);return n in this.cache_?this.cache_[n]:null}getPattern(t,e,i){const n=ht(t,e,i);return n in this.patternCache_?this.patternCache_[n]:null}set(t,e,n,r,s){const o=ht(t,e,n),a=o in this.cache_;this.cache_[o]=r,s&&(r.getImageState()===i.IDLE&&r.load(),r.getImageState()===i.LOADING?r.ready().then((()=>{this.patternCache_[o]=X().createPattern(r.getImage(1),"repeat")})):this.patternCache_[o]=X().createPattern(r.getImage(1),"repeat")),a||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function ht(t,e,i){return e+":"+t+":"+(i?F(i):"null")}const ut=new lt;let ct=null;class dt extends nt{constructor(t,e,n,r,s){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=n,this.canvas_={},this.color_=s,this.imageState_=void 0===r?i.IDLE:r,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(void 0===this.tainted_&&this.imageState_===i.LOADED){ct||(ct=O(1,1,void 0,{willReadFrequently:!0})),ct.drawImage(this.image_,0,0);try{ct.getImageData(0,0,1,1),this.tainted_=!1}catch{ct=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(N)}handleImageError_(){this.imageState_=i.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=i.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],i=O(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_===i.IDLE){this.image_||this.initializeImage_(),this.imageState_=i.LOADING;try{void 0!==this.src_&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&at(this.image_,this.src_).then((t=>{this.image_=t,this.handleImageLoad_()})).catch(this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==i.LOADED)return;const e=this.image_,n=O(Math.ceil(e.width*t),Math.ceil(e.height*t)),r=n.canvas;n.scale(t,t),n.drawImage(e,0,0),n.globalCompositeOperation="multiply",n.fillStyle=function(t){return"string"==typeof t?t:D(t)}(this.color_),n.fillRect(0,0,r.width/t,r.height/t),n.globalCompositeOperation="destination-in",n.drawImage(e,0,0),this.canvas_[t]=r}ready(){return this.ready_||(this.ready_=new Promise((t=>{if(this.imageState_===i.LOADED||this.imageState_===i.ERROR)t();else{const e=()=>{this.imageState_!==i.LOADED&&this.imageState_!==i.ERROR||(this.removeEventListener(N,e),t())};this.addEventListener(N,e)}}))),this.ready_}}function pt(t,e,i,n,r,s){let o=void 0===e?void 0:ut.get(e,i,r);return o||(o=new dt(t,t&&"src"in t?t.src||void 0:e,i,n,r),ut.set(e,i,r,o,s)),s&&o&&!ut.getPattern(e,i,r)&&ut.set(e,i,r,o,s),o}var ft=dt;function gt(t){return t?Array.isArray(t)?D(t):"object"==typeof t&&"src"in t?function(t){if(!t.offset||!t.size)return ut.getPattern(t.src,"anonymous",t.color);const e=t.src+":"+t.offset,n=ut.getPattern(e,void 0,t.color);if(n)return n;const r=ut.get(t.src,"anonymous",null);if(r.getImageState()!==i.LOADED)return null;const s=O(t.size[0],t.size[1]);return s.drawImage(r.getImage(1),t.offset[0],t.offset[1],t.size[0],t.size[1],0,0,t.size[0],t.size[1]),pt(s.canvas,e,void 0,i.LOADED,t.color,!0),ut.getPattern(e,void 0,t.color)}(t):t:null}var mt="propertychange";class yt extends nt{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(N)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let r=0;rMath.max(e,Yt(t,i))),0);return i[e]=n,n}function Bt(t,e,i,n,r,s,o,a,l,h,u){t.save(),1!==i&&(void 0===t.globalAlpha?t.globalAlpha=t=>t.globalAlpha*=i:t.globalAlpha*=i),e&&t.transform.apply(t,e),n.contextInstructions?(t.translate(l,h),t.scale(u[0],u[1]),function(t,e){const i=t.contextInstructions;for(let t=0,n=i.length;tthis.imageState_=i.LOADED)),this.render()}clone(){const t=this.getScale(),e=new Vt({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_,e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){const e=this.fill_?.getKey(),n=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(",");let r=ut.get(n,null,null)?.getImage(1);if(!r){const e=this.renderOptions_,s=Math.ceil(e.size*t),o=O(s,s);this.draw_(e,o,t),r=o.canvas,ut.set(n,null,null,new ft(r,void 0,null,i.LOADED,null))}return r}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}getRadius2(){return this.radius2_}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(0===e||this.points_===1/0||"bevel"!==t&&"miter"!==t)return e;let n=this.radius,r=void 0===this.radius2_?n:this.radius2_;if(n{this.patternImage_=null})),e.getImageState()===i.IDLE&&e.load(),e.getImageState()===i.LOADING&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?wt(t):"object"==typeof t&&"src"in t?t.src+":"+t.offset:F(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}var te=Qt;function ee(t,e){if(!t)throw new Error(e)}function ie(t,e,i,n){return void 0!==i&&void 0!==n?[i/t,n/e]:void 0!==i?i/t:void 0!==n?n/e:1}class ne extends $t{constructor(t){const e=void 0!==(t=t||{}).opacity?t.opacity:1,n=void 0!==t.rotation?t.rotation:0,r=void 0!==t.scale?t.scale:1,s=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:e,rotation:n,scale:r,displacement:void 0!==t.displacement?t.displacement:[0,0],rotateWithView:s,declutterMode:t.declutterMode}),this.anchor_=void 0!==t.anchor?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=void 0!==t.anchorOrigin?t.anchorOrigin:"top-left",this.anchorXUnits_=void 0!==t.anchorXUnits?t.anchorXUnits:"fraction",this.anchorYUnits_=void 0!==t.anchorYUnits?t.anchorYUnits:"fraction",this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null;const o=void 0!==t.img?t.img:null;let a,l=t.src;if(ee(!(void 0!==l&&o),"`image` and `src` cannot be provided at the same time"),void 0!==l&&0!==l.length||!o||(l=o.src||wt(o)),ee(void 0!==l&&l.length>0,"A defined and non-empty `src` or `image` must be provided"),ee(!((void 0!==t.width||void 0!==t.height)&&void 0!==t.scale),"`width` or `height` cannot be provided together with `scale`"),void 0!==t.src?a=i.IDLE:void 0!==o&&(a="complete"in o?o.complete?o.src?i.LOADED:i.IDLE:i.LOADING:i.LOADED),this.color_=void 0!==t.color?F(t.color):null,this.iconImage_=pt(o,l,this.crossOrigin_,a,this.color_),this.offset_=void 0!==t.offset?t.offset:[0,0],this.offsetOrigin_=void 0!==t.offsetOrigin?t.offsetOrigin:"top-left",this.origin_=null,this.size_=void 0!==t.size?t.size:null,this.initialOptions_,void 0!==t.width||void 0!==t.height){let e,i;if(t.size)[e,i]=t.size;else{const n=this.getImage(1);if(n.width&&n.height)e=n.width,i=n.height;else if(n instanceof HTMLImageElement){this.initialOptions_=t;const e=()=>{if(this.unlistenImageChange(e),!this.initialOptions_)return;const i=this.iconImage_.getSize();this.setScale(ie(i[0],i[1],t.width,t.height))};return void this.listenImageChange(e)}}void 0!==e&&this.setScale(ie(e,i,t.width,t.height))}}clone(){let t,e,i;return this.initialOptions_?(e=this.initialOptions_.width,i=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new ne({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:i,size:null!==this.size_?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const e=this.getSize();if("fraction"==this.anchorXUnits_||"fraction"==this.anchorYUnits_){if(!e)return null;t=this.anchor_.slice(),"fraction"==this.anchorXUnits_&&(t[0]*=e[0]),"fraction"==this.anchorYUnits_&&(t[1]*=e[1])}if("top-left"!=this.anchorOrigin_){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),"top-right"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[0]=-t[0]+e[0]),"bottom-left"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[1]=-t[1]+e[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),i=this.getScaleArray();return[t[0]-e[0]/i[0],t[1]+e[1]/i[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if("top-left"!=this.offsetOrigin_){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),"top-right"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[0]=i[0]-e[0]-t[0]),"bottom-left"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();return this.size_?this.size_[0]*t[0]:this.iconImage_.getImageState()==i.LOADED?this.iconImage_.getSize()[0]*t[0]:void 0}getHeight(){const t=this.getScaleArray();return this.size_?this.size_[1]*t[1]:this.iconImage_.getImageState()==i.LOADED?this.iconImage_.getSize()[1]*t[1]:void 0}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(N,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(N,t)}ready(){return this.iconImage_.ready()}}var re=ne,se={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function oe(t){const e=fe();for(let i=0,n=t.length;ir&&(l|=se.RIGHT),as&&(l|=se.ABOVE),l===se.UNKNOWN&&(l=se.INTERSECTING),l}function fe(){return[1/0,1/0,-1/0,-1/0]}function ge(t,e,i,n,r){return r?(r[0]=t,r[1]=e,r[2]=i,r[3]=n,r):[t,e,i,n]}function me(t){return ge(1/0,1/0,-1/0,-1/0,t)}function ye(t,e){const i=t[0],n=t[1];return ge(i,n,i,n,e)}function _e(t,e,i,n,r){return be(me(r),t,e,i,n)}function xe(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function ve(t,e){return e[0]t[2]&&(t[2]=e[2]),e[1]t[3]&&(t[3]=e[3]),t}function we(t,e){e[0]t[2]&&(t[2]=e[0]),e[1]t[3]&&(t[3]=e[1])}function be(t,e,i,n,r){for(;ie[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function Ge(t){return t[2]1){const e=t[2]-t[0],i=t[3]-t[1];for(let s=0;s=i[2])){const e=ze(i),r=Math.floor((n[0]-i[0])/e)*e;t[0]-=r,t[2]-=r}return t}function Ne(t,e,i){if(e.canWrapX()){const n=e.getExtent();if(!isFinite(t[0])||!isFinite(t[2]))return[[n[0],t[1],n[2],t[3]]];je(t,e);const r=ze(n);if(ze(t)>r&&!i)return[[n[0],t[1],n[2],t[3]]];if(t[0]n[2])return[[t[0],t[1],n[2],t[3]],[n[0],t[1],t[2]-r,t[3]]]}return[t]}function We(t,e,i,n){const r=[];let s=[1/0,1/0,-1/0,-1/0];for(let o=0,a=i.length;os&&(i-a)*(s-l)-(r-a)*(n-l)>0&&o++:n<=s&&(i-a)*(s-l)-(r-a)*(n-l)<0&&o--,a=i,l=n}return 0!==o}function Be(t,e,i,n,r,s){if(0===i.length)return!1;if(!Ue(t,e,i[0],n,r,s))return!1;for(let e=1,o=i.length;ey&&(h=(u+c)/2,Be(t,e,i,n,h,f)&&(m=h,y=r)),u=c}return isNaN(m)&&(m=r[s]),o?(o.push(m,f,y),o):[m,f,y]}function Ze(t,e,i,n,r){let s=[];for(let o=0,a=i.length;o>1),r=+i(t[n],e),r<0?s=n+1:(o=n,a=!r);return a?s:~s}(u,c);d<0?(l=(c-u[-d-2])/(u[-d-1]-u[-d-2]),a=e+(-d-2)*n):a=e+d*n}o=o>1?o:2,s=s||new Array(o);for(let e=0;e>1;r0}function Je(t,e,i,n,r){r=void 0!==r&&r;for(let s=0,o=i.length;s0;){const i=h.pop(),s=h.pop();let o=0;const a=t[s],c=t[s+1],d=t[i],p=t[i+1];for(let e=s+n;eo&&(u=e,o=i)}o>r&&(l[(u-e)/n]=1,s+n0&&f>d)&&(p<0&&g0&&g>p)?(a=i,l=c):(s[o++]=a,s[o++]=l,h=a,u=l,a=i,l=c)}return s[o++]=a,s[o++]=l,o}function ai(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;lui.warn||console.warn(...t)}function pi(t,e){let i=!0;for(let n=t.length-1;n>=0;--n)if(t[n]!=e[n]){i=!1;break}return i}function fi(t,e){const i=Math.cos(e),n=Math.sin(e),r=t[0]*i-t[1]*n,s=t[1]*i+t[0]*n;return t[0]=r,t[1]=s,t}function gi(t,e){if(e.canWrapX()){const i=ze(e.getExtent()),n=function(t,e,i){const n=e.getExtent();let r=0;e.canWrapX()&&(t[0]n[2])&&(i=i||ze(n),r=Math.floor((t[0]-n[0])/i));return r}(t,e,i);n&&(t[0]-=n*i)}return t}const mi={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var yi=class{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||mi[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 _i=6378137,xi=Math.PI*_i,vi=[-xi,-xi,xi,xi],wi=[-180,-85,180,85],bi=_i*Math.log(Math.tan(Math.PI/2));class Si extends yi{constructor(t){super({code:t,units:"m",extent:vi,global:!0,worldExtent:wi,getPointResolution:function(t,e){return t/Math.cosh(e[1]/_i)}})}}const Ti=[new Si("EPSG:3857"),new Si("EPSG:102100"),new Si("EPSG:102113"),new Si("EPSG:900913"),new Si("http://www.opengis.net/def/crs/EPSG/0/3857"),new Si("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Ci(t,e,i,n){const r=t.length;i=i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(r));for(let i=0;ibi?n=bi:n<-bi&&(n=-bi),e[i+1]=n}return e}function Ei(t,e,i,n){const r=t.length;i=i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(r));for(let i=0;irn&&(e=rn);const n=y(e),r=Math.sin(n),s=Math.cos(n),o=r/s,a=o*o,l=a*a,h=y(t),u=y(ln(i.number)),c=tn/Math.sqrt(1-zi*r**2),d=Xi*s**2,p=s*S(h-u,-Math.PI,Math.PI),f=p*p,g=f*p,m=g*p,_=m*p,x=_*p,v=tn*(qi*n-Zi*Math.sin(2*n)+$i*Math.sin(4*n)-Vi*Math.sin(6*n)),w=Li*c*(p+g/6*(1-a+d)+_/120*(5-18*a+l+72*d-58*Xi))+5e5;let b=Li*(v+c*o*(f/2+m/24*(5-a+9*d+4*d**2)+x/720*(61-58*a+l+600*d-330*Xi)));return i.north||(b+=1e7),[w,b]}function ln(t){return 6*(t-1)-180+3}const hn=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function un(t){let e=0;for(const i of hn){const n=t.match(i);if(n){e=parseInt(n[1]);break}}if(!e)return null;let i=0,n=!1;return e>32700&&e<32761?i=e-32700:e>32600&&e<32661&&(n=!0,i=e-32600),i?{number:i,north:n}:null}function cn(t,e){return function(i,n,r,s){const o=i.length;r=r>1?r:2,s=s??r,n||(n=r>2?i.slice():new Array(o));for(let r=0;r=a?e[o+t]:s[t]}return i}}function Cn(t,e){if(t===e)return!0;const i=t.getUnits()===e.getUnits();if(t.getCode()===e.getCode())return i;return En(t,e)===_n&&i}function En(t,e){const i=t.getCode(),n=e.getCode();let r=Pi(i,n);if(r)return r;let s=null,o=null;for(const i of fn)s||(s=i(t)),o||(o=i(e));if(!s&&!o)return null;const a="EPSG:4326";if(o)if(s)r=Rn(s.inverse,o.forward);else{const t=Pi(i,a);t&&(r=Rn(t,o.forward))}else{const t=Pi(a,n);t&&(r=Rn(s.inverse,t))}return r&&(xn(t),xn(e),Di(t,e,r)),r}function Rn(t,e){return function(i,n,r,s){return n=t(i,n,r,s),e(n,n,r,s)}}function Mn(t,e){return En(vn(t),vn(e))}function In(t,e,i){const n=Mn(e,i);if(!n){const t=vn(e).getCode(),n=vn(i).getCode();throw new Error(`No transform available between ${t} and ${n}`)}return n(t,void 0,t.length)}function kn(t,e,i,n){return Xe(t,Mn(e,i),void 0,n)}let Fn=null;function An(){return Fn}function Dn(t,e){return Fn?In(t,e,Fn):t}function Pn(t,e){return Fn?In(t,Fn,e):(mn&&!pi(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(mn=!1,di("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t)}function Ln(t,e){return Fn?kn(t,e,Fn):t}function zn(t,e){return Fn?kn(t,Fn,e):t}var On,Gn,Xn;bn(Ti),bn(ki),On=Ti,Gn=Ci,Xn=Ei,ki.forEach((function(t){On.forEach((function(e){Di(t,e,Gn),Di(e,t,Xn)}))}));const jn=new Array(6);function Nn(t){return Yn(t,1,0,0,1,0,0)}function Wn(t,e){const i=t[0],n=t[1],r=t[2],s=t[3],o=t[4],a=t[5],l=e[0],h=e[1],u=e[2],c=e[3],d=e[4],p=e[5];return t[0]=i*l+r*h,t[1]=n*l+s*h,t[2]=i*u+r*c,t[3]=n*u+s*c,t[4]=i*d+r*p+o,t[5]=n*d+s*p+a,t}function Yn(t,e,i,n,r,s,o){return t[0]=e,t[1]=i,t[2]=n,t[3]=r,t[4]=s,t[5]=o,t}function Un(t,e){const i=e[0],n=e[1];return e[0]=t[0]*i+t[2]*n+t[4],e[1]=t[1]*i+t[3]*n+t[5],e}function Bn(t,e,i){return Wn(t,Yn(jn,e,0,0,i,0,0))}function qn(t,e,i,n,r,s,o,a){const l=Math.sin(s),h=Math.cos(s);return t[0]=n*h,t[1]=r*l,t[2]=-n*l,t[3]=r*h,t[4]=o*n*h-a*n*l+e,t[5]=o*r*l+a*r*h+i,t}function Zn(t,e){const i=(n=e)[0]*n[3]-n[1]*n[2];var n;ee(0!==i,"Transformation matrix cannot be inverted");const r=e[0],s=e[1],o=e[2],a=e[3],l=e[4],h=e[5];return t[0]=a/i,t[1]=-s/i,t[2]=-o/i,t[3]=r/i,t[4]=(o*h-a*l)/i,t[5]=-(r*h-s*l)/i,t}const $n=[1e6,1e6,1e6,1e6,2,2];function Vn(t){return"matrix("+t.map(((t,e)=>Math.round(t*$n[e])/$n[e])).join(", ")+")"}const Kn=[1,0,0,1,0,0];class Hn{constructor(t,e,i,n,r,s){this.styleFunction,this.extent_,this.id_=s,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i||null,this.properties_=r,this.squaredTolerance_,this.stride_=n,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_="Point"===this.type_?ye(this.flatCoordinates_):_e(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=Me(this.getExtent());this.flatInteriorPoints_=qe(this.flatCoordinates_,0,this.ends_,2,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=ii(this.flatCoordinates_,this.ends_),e=We(this.flatCoordinates_,0,t,2);this.flatInteriorPoints_=Ze(this.flatCoordinates_,0,t,2,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=$e(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const t=this.flatCoordinates_;let e=0;const i=this.ends_;for(let n=0,r=i.length;n{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);const i=this.simplifiedGeometry_.getFlatCoordinates();let n;switch(this.type_){case"LineString":i.length=ni(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),n=[i.length];break;case"MultiLineString":n=[],i.length=ri(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,n);break;case"Polygon":n=[],i.length=ai(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,n)}return n&&(this.simplifiedGeometry_=new Hn(this.type_,i,n,2,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_})),this}}Hn.prototype.getFlatCoordinates=Hn.prototype.getOrientedFlatCoordinates;var Jn=Hn;class Qn{constructor(t){t=t||{},this.color_=void 0!==t.color?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=void 0!==t.lineDash?t.lineDash:null,this.lineDashOffset_=t.lineDashOffset,this.lineJoin_=t.lineJoin,this.miterLimit_=t.miterLimit,this.width_=t.width}clone(){const t=this.getColor();return new Qn({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getWidth(){return this.width_}setColor(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setWidth(t){this.width_=t}}var tr=Qn;class er{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=rr,void 0!==t.geometry&&this.setGeometry(t.geometry),this.fill_=void 0!==t.fill?t.fill:null,this.image_=void 0!==t.image?t.image:null,this.renderer_=void 0!==t.renderer?t.renderer:null,this.hitDetectionRenderer_=void 0!==t.hitDetectionRenderer?t.hitDetectionRenderer:null,this.stroke_=void 0!==t.stroke?t.stroke:null,this.text_=void 0!==t.text?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&"object"==typeof t&&(t=t.clone()),new er({geometry:t??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(t){this.renderer_=t}setHitDetectionRenderer(t){this.hitDetectionRenderer_=t}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(t){this.fill_=t}getImage(){return this.image_}setImage(t){this.image_=t}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t}getText(){return this.text_}setText(t){this.text_=t}getZIndex(){return this.zIndex_}setGeometry(t){"function"==typeof t?this.geometryFunction_=t:"string"==typeof t?this.geometryFunction_=function(e){return e.get(t)}:t?void 0!==t&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=rr,this.geometry_=t}setZIndex(t){this.zIndex_=t}}let ir=null;function nr(t,e){if(!ir){const t=new te({color:"rgba(255,255,255,0.4)"}),e=new tr({color:"#3399CC",width:1.25});ir=[new er({image:new Jt({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return ir}function rr(t){return t.getGeometry()}var sr=er;class or{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.keepUpright_=t.keepUpright,this.scale_=t.scale,this.scaleArray_=qt(void 0!==t.scale?t.scale:1),this.text_=t.text,this.textAlign_=t.textAlign,this.justify_=t.justify,this.repeat_=t.repeat,this.textBaseline_=t.textBaseline,this.fill_=void 0!==t.fill?t.fill:new te({color:"#333"}),this.maxAngle_=void 0!==t.maxAngle?t.maxAngle:Math.PI/4,this.placement_=void 0!==t.placement?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=void 0!==t.stroke?t.stroke:null,this.offsetX_=void 0!==t.offsetX?t.offsetX:0,this.offsetY_=void 0!==t.offsetY?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=void 0===t.padding?null:t.padding,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new or({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setKeepUpright(t){this.keepUpright_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=qt(void 0!==t?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}}var ar=or,lr={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function hr(t){return Math.pow(t,3)}function ur(t){return 1-hr(1-t)}function cr(t){return 3*t*t-2*t*t*t}var dr=class extends nt{constructor(t,e,i){super(),i=i||{},this.tileCoord=t,this.state=e,this.key="",this.transition_=void 0===i.transition?250:i.transition,this.transitionStarts_={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(N)}release(){this.setState(lr.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==lr.EMPTY){if(this.state!==lr.ERROR&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}}load(){xt()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(i){if(-1===i)return 1}else i=e,this.transitionStarts_[t]=i;const n=e-i+1e3/60;return n>=this.transition_?1:hr(n/this.transition_)}inTransition(t){return!!this.transition_&&-1!==this.transitionStarts_[t]}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}disposeInternal(){this.release(),super.disposeInternal()}};var pr=class extends dr{constructor(t,e,i,n,r,s){super(t,e,s),this.extent=null,this.format_=n,this.features_=null,this.loader_,this.projection=null,this.resolution,this.tileLoadFunction_=r,this.url_=i,this.key=i}getTileUrl(){return this.url_}getFormat(){return this.format_}getFeatures(){return this.features_}load(){this.state==lr.IDLE&&(this.setState(lr.LOADING),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))}onLoad(t,e){this.setFeatures(t)}onError(){this.setState(lr.ERROR)}setFeatures(t){this.features_=t,this.setState(lr.LOADED)}setLoader(t){this.loader_=t}};class fr extends St{constructor(t){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),t)if("function"==typeof t.getSimplifiedGeometry){const e=t;this.setGeometry(e)}else{const e=t;this.setProperties(e)}}clone(){const t=new fr(this.hasProperties()?this.getProperties():null);t.setGeometryName(this.getGeometryName());const e=this.getGeometry();e&&t.setGeometry(e.clone());const i=this.getStyle();return i&&t.setStyle(i),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(ot(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=rt(t,N,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?function(t){if("function"==typeof t)return t;let e;if(Array.isArray(t))e=t;else{ee("function"==typeof t.getZIndex,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`");e=[t]}return function(){return e}}(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}}var gr=fr;const mr=[1,0,0,1,0,0],yr=[NaN,NaN];var _r=class extends St{constructor(){super(),this.extent_=[1/0,1/0,-1/0,-1/0],this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=J(((t,e,i)=>{if(!i)return this.getSimplifiedGeometry(e);const n=this.clone();return n.applyTransform(i),n.getSimplifiedGeometry(e)}))}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return xt()}closestPointXY(t,e,i,n){return xt()}containsXY(t,e){return 0===this.closestPointXY(t,e,yr,Number.MIN_VALUE)}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return xt()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&me(t),this.extentRevision_=this.getRevision()}return function(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t}(this.extent_,t)}rotate(t,e){xt()}scale(t,e,i){xt()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return xt()}getType(){return xt()}applyTransform(t){xt()}intersectsExtent(t){return xt()}translate(t,e){xt()}transform(t,e){const i=vn(t),n="tile-pixels"==i.getUnits()?function(t,n,r){const s=i.getExtent(),o=i.getWorldExtent(),a=Ae(o)/Ae(s);qn(mr,o[0],o[3],a,-a,0,0,0);const l=li(t,0,t.length,r,mr,n),h=Mn(i,e);return h?h(l,l,r):l}:Mn(i,e);return this.applyTransform(n),this}};function xr(t){let e;return 2==t?e="XY":3==t?e="XYZ":4==t&&(e="XYZM"),e}function vr(t){let e;return"XY"==t?e=2:"XYZ"==t||"XYM"==t?e=3:"XYZM"==t&&(e=4),e}var wr=class extends _r{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return _e(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return xt()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length1)c=i;else{if(d>0){for(let r=0;rr&&(r=a),s=i,o=n}return r}function Ir(t,e,i,n,r){for(let s=0,o=i.length;s=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]||Lr(t,e,i,n,(function(t,e){return function(t,e,i){let n=!1;const r=pe(t,e),s=pe(t,i);if(r===se.INTERSECTING||s===se.INTERSECTING)n=!0;else{const o=t[0],a=t[1],l=t[2],h=t[3],u=e[0],c=e[1],d=i[0],p=i[1],f=(p-c)/(d-u);let g,m;s&se.ABOVE&&!(r&se.ABOVE)&&(g=d-(p-h)/f,n=g>=o&&g<=l),n||!(s&se.RIGHT)||r&se.RIGHT||(m=p-(d-l)*f,n=m>=a&&m<=h),n||!(s&se.BELOW)||r&se.BELOW||(g=d-(p-a)/f,n=g>=o&&g<=l),n||!(s&se.LEFT)||r&se.LEFT||(m=p-(d-o)*f,n=m>=a&&m<=h)}return n}(r,t,e)})))}function Or(t,e,i,n,r){return!!zr(t,e,i,n,r)||(!!Ue(t,e,i,n,r[0],r[1])||(!!Ue(t,e,i,n,r[0],r[3])||(!!Ue(t,e,i,n,r[2],r[1])||!!Ue(t,e,i,n,r[2],r[3]))))}function Gr(t,e,i,n,r){if(!Or(t,e,i[0],n,r))return!1;if(1===i.length)return!0;for(let e=1,s=i.length;ef&&(d=(f+d)/2,f=d),g>m&&(g=(m+g)/2,m=g);let y=p(n[0],d,f),_=p(n[1],g,m);if(o&&i&&r){const t=30*r;y+=-t*Math.log(1+Math.max(0,d-n[0])/t)+t*Math.log(1+Math.max(0,n[0]-f)/t),_+=-t*Math.log(1+Math.max(0,g-n[1])/t)+t*Math.log(1+Math.max(0,n[1]-m)/t)}return[y,_]}}function as(t){return t}function ls(t,e,i,n){const r=ze(e)/i[0],s=Ae(e)/i[1];return n?Math.min(t,Math.max(r,s)):Math.min(t,Math.min(r,s))}function hs(t,e,i){let n=Math.min(t,e);return n*=Math.log(1+50*Math.max(0,t/e-1))/50+1,i&&(n=Math.max(n,i),n/=Math.log(1+50*Math.max(0,i/t-1))/50+1),p(n,i/2,2*e)}function us(t,e,i,n,r){return i=void 0===i||i,function(s,o,a,l){if(void 0!==s){const o=n?ls(t,n,a,r):t;return i&&l?hs(s,o,e):p(s,e,o)}}}function cs(t){if(void 0!==t)return 0}function ds(t){if(void 0!==t)return t}const ps=42,fs=256;function gs(t,e){setTimeout((function(){t(e)}),0)}function ms(t){return!(t.sourceCenter&&t.targetCenter&&!pi(t.sourceCenter,t.targetCenter))&&(t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation)}function ys(t,e,i,n,r){const s=Math.cos(-r);let o=Math.sin(-r),a=t[0]*s-t[1]*o,l=t[1]*s+t[0]*o;a+=(e[0]/2-i[0])*n,l+=(i[1]-e[1]/2)*n,o=-o;return[a*s-l*o,l*s+a*o]}var _s=class extends St{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=Sn(t.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,t.projection&&yn(),t.center&&(t.center=Pn(t.center,this.projection_)),t.extent&&(t.extent=zn(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const t in ss)delete e[t];this.setProperties(e,!0);const i=function(t){let e,i,n;const r=28,s=2;let o=void 0!==t.minZoom?t.minZoom:0,a=void 0!==t.maxZoom?t.maxZoom:r;const l=void 0!==t.zoomFactor?t.zoomFactor:s,h=void 0!==t.multiWorld&&t.multiWorld,u=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,c=void 0!==t.showFullExtent&&t.showFullExtent,d=Sn(t.projection,"EPSG:3857"),f=d.getExtent();let g=t.constrainOnlyCenter,m=t.extent;h||m||!d.isGlobal()||(g=!1,m=f);if(void 0!==t.resolutions){const r=t.resolutions;i=r[o],n=void 0!==r[a]?r[a]:r[r.length-1],e=t.constrainResolution?function(t,e,i,n){return e=void 0===e||e,function(r,s,o,a){if(void 0!==r){const l=t[0],h=t[t.length-1],u=i?ls(l,i,o,n):l;if(a)return e?hs(r,u,h):p(r,h,u);const c=Math.min(u,r),d=Math.floor(Z(t,c,s));return t[d]>u&&d1&&"function"==typeof arguments[i-1]&&(e=arguments[i-1],--i);let n=0;for(;n0}getInteracting(){return this.hints_[rs]>0}cancelAnimations(){let t;this.setHint(ns,-this.hints_[ns]);for(let e=0,i=this.animations_.length;e=0;--i){const n=this.animations_[i];let r=!0;for(let i=0,s=n.length;i0?o/s.duration:1;a>=1?(s.complete=!0,a=1):r=!1;const l=s.easing(a);if(s.sourceCenter){const t=s.sourceCenter[0],e=s.sourceCenter[1],i=s.targetCenter[0],n=s.targetCenter[1];this.nextCenter_=s.targetCenter;const r=t+l*(i-t),o=e+l*(n-e);this.targetCenter_=[r,o]}if(s.sourceResolution&&s.targetResolution){const t=1===l?s.targetResolution:s.sourceResolution+l*(s.targetResolution-s.sourceResolution);if(s.anchor){const e=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(i,s.anchor)}this.nextResolution_=s.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==s.sourceRotation&&void 0!==s.targetRotation){const t=1===l?_(s.targetRotation+Math.PI,2*Math.PI)-Math.PI:s.sourceRotation+l*(s.targetRotation-s.sourceRotation);if(s.anchor){const e=this.constraints_.rotation(t,!0);this.targetCenter_=this.calculateCenterRotate(e,s.anchor)}this.nextRotation_=s.targetRotation,this.targetRotation_=t}if(this.applyTargetState_(!0),e=!0,!s.complete)break}if(r){this.animations_[i]=null,this.setHint(ns,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=n[0].callback;t&&gs(t,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const n=this.getCenterInternal();var r,s;return void 0!==n&&(i=[n[0]-e[0],n[1]-e[1]],fi(i,t-this.getRotation()),s=e,(r=i)[0]+=+s[0],r[1]+=+s[1]),i}calculateCenterZoom(t,e){let i;const n=this.getCenterInternal(),r=this.getResolution();if(void 0!==n&&void 0!==r){i=[e[0]-t*(e[0]-n[0])/r,e[1]-t*(e[1]-n[1])/r]}return i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],n=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(n*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t?Dn(t,this.getProjection()):t}getCenterInternal(){return this.get(ss.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){return Ln(this.calculateExtentInternal(t),this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();ee(e,"The view center is not defined");const i=this.getResolution();ee(void 0!==i,"The view resolution is not defined");const n=this.getRotation();return ee(void 0!==n,"The view rotation is not defined"),ke(e,i,n,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(ss.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(zn(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=ze(t)/e[0],n=Ae(t)/e[1];return Math.max(i,n)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,n=Math.log(e/i)/Math.log(t);return function(i){return e/Math.pow(t,i*n)}}getRotation(){return this.get(ss.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(i/n)/e;return function(t){return Math.log(i/t)/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 n=this.getCenterInternal();const r=this.padding_;if(r){const t=this.getViewportSizeMinusPadding_();n=ys(n,this.getViewportSize_(),[t[0]/2+r[3],t[1]/2+r[0]],e,i)}return{center:n.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,i,n=this.minZoom_||0;if(this.resolutions_){const r=Z(this.resolutions_,t,1);n=r,e=this.resolutions_[r],i=r==this.resolutions_.length-1?2:e/this.resolutions_[r+1]}else e=this.maxResolution_,i=this.zoomFactor_;return n+Math.log(e/t)/Math.log(i)}getResolutionForZoom(t){if(this.resolutions_?.length){if(1===this.resolutions_.length)return this.resolutions_[0];const e=p(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,p(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(ee(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){ee(!Ge(t),"Cannot fit empty extent provided as `geometry`");i=$r(zn(t,this.getProjection()))}else if("Circle"===t.getType()){const e=zn(t.getExtent(),this.getProjection());i=$r(e),i.rotate(this.getRotation(),Me(e))}else{const e=An();i=e?t.clone().transform(e,this.getProjection()):t}this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),n=Math.sin(-e),r=t.getFlatCoordinates(),s=t.getStride();let o=1/0,a=1/0,l=-1/0,h=-1/0;for(let t=0,e=r.length;t=t.maxResolution)return!1;const n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}var Ps=class extends As{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.sourceReady_=!1,this.rendered=!1,t.render&&(this.render=t.render),t.map&&this.setMap(t.map),this.addChangeListener(ks,this.handleSourcePropertyChange_);const i=t.source?t.source:null;this.setSource(i)}getLayersArray(t){return(t=t||[]).push(this),t}getLayerStatesArray(t){return(t=t||[]).push(this.getLayerState()),t}getSource(){return this.get(ks)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed(),this.sourceReady_||"ready"!==this.getSource().getState()||(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(ot(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=rt(t,N,this.handleSourceChange_,this),"ready"===t.getState()&&(this.sourceReady_=!0,setTimeout((()=>{this.dispatchEvent("sourceready")}),0)),this.clearRenderer()),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return this.renderer_&&this.rendered?this.renderer_.getData(t):null}isVisible(t){let e;const i=this.getMapInternal();let n;if(!t&&i&&(t=i.getView()),e=t instanceof _s?{viewState:t.getState(),extent:t.calculateExtent()}:t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray()),e.layerStatesArray){if(n=e.layerStatesArray.find((t=>t.layer===this)),!n)return!1}else n=this.getLayerState();const r=this.getExtent();return Ds(n,e.viewState)&&(!r||Oe(r,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];let i=e(t instanceof _s?t.getViewStateAndExtent():t);return Array.isArray(i)||(i=[i]),i}render(t,e){const i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(t,e){}renderDeferred(t){const e=this.getRenderer();e&&e.renderDeferred(t)}setMapInternal(t){t||this.unrender(),this.set(Fs,t)}getMapInternal(){return this.get(Fs)}setMap(t){this.mapPrecomposeKey_&&(ot(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(ot(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=rt(t,ws,this.handlePrecompose_,this),this.mapRenderKey_=rt(this,N,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);ee(!e.some((t=>t.layer===i.layer)),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(i)}setSource(t){this.set(ks,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}};const Ls=4294967296,zs=1/Ls,Os="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");class Gs{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(t,e,i=this.length){for(;this.pos>3,r=this.pos;this.type=7&i,t(n,e,this),this.pos===r&&this.skip(i)}return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){const t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){const t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Ls;return this.pos+=8,t}readSFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Ls;return this.pos+=8,t}readFloat(){const t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){const t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){const e=this.buf;let i,n;return n=e[this.pos++],i=127&n,n<128?i:(n=e[this.pos++],i|=(127&n)<<7,n<128?i:(n=e[this.pos++],i|=(127&n)<<14,n<128?i:(n=e[this.pos++],i|=(127&n)<<21,n<128?i:(n=e[this.pos],i|=(15&n)<<28,function(t,e,i){const n=i.buf;let r,s;if(s=n[i.pos++],r=(112&s)>>4,s<128)return Xs(t,r,e);if(s=n[i.pos++],r|=(127&s)<<3,s<128)return Xs(t,r,e);if(s=n[i.pos++],r|=(127&s)<<10,s<128)return Xs(t,r,e);if(s=n[i.pos++],r|=(127&s)<<17,s<128)return Xs(t,r,e);if(s=n[i.pos++],r|=(127&s)<<24,s<128)return Xs(t,r,e);if(s=n[i.pos++],r|=(1&s)<<31,s<128)return Xs(t,r,e);throw new Error("Expected varint not more than 10 bytes")}(i,t,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return Boolean(this.readVarint())}readString(){const t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Os?Os.decode(this.buf.subarray(e,t)):function(t,e,i){let n="",r=e;for(;r239?4:e>223?3:e>191?2:1;if(r+h>i)break;1===h?e<128&&(l=e):2===h?(s=t[r+1],128==(192&s)&&(l=(31&e)<<6|63&s,l<=127&&(l=null))):3===h?(s=t[r+1],o=t[r+2],128==(192&s)&&128==(192&o)&&(l=(15&e)<<12|(63&s)<<6|63&o,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===h&&(s=t[r+1],o=t[r+2],a=t[r+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(l=(15&e)<<18|(63&s)<<12|(63&o)<<6|63&a,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,h=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),r+=h}return n}(this.buf,e,t)}readBytes(){const t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){const i=this.readPackedEnd();for(;this.pos127;);else if(2===e)this.pos=this.readVarint()+this.pos;else if(5===e)this.pos+=4;else{if(1!==e)throw new Error(`Unimplemented type: ${e}`);this.pos+=8}}writeTag(t,e){this.writeVarint(t<<3|e)}realloc(t){let e=this.length||16;for(;e268435455||t<0?function(t,e){let i,n;t>=0?(i=t%4294967296|0,n=t/4294967296|0):(i=~(-t%4294967296),n=~(-t/4294967296),4294967295^i?i=i+1|0:(i=0,n=n+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos]=127&t}(i,0,e),function(t,e){const i=(7&t)<<4;if(e.buf[e.pos++]|=i|((t>>>=3)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;e.buf[e.pos++]=127&t}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))}writeSVarint(t){this.writeVarint(t<0?2*-t-1:2*t)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(4*t.length),this.pos++;const e=this.pos;this.pos=function(t,e,i){for(let n,r,s=0;s55295&&n<57344){if(!r){n>56319||s+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):r=n;continue}if(n<56320){t[i++]=239,t[i++]=191,t[i++]=189,r=n;continue}n=r-55296<<10|n-56320|65536,r=null}else r&&(t[i++]=239,t[i++]=191,t[i++]=189,r=null);n<128?t[i++]=n:(n<2048?t[i++]=n>>6|192:(n<65536?t[i++]=n>>12|224:(t[i++]=n>>18|240,t[i++]=n>>12&63|128),t[i++]=n>>6&63|128),t[i++]=63&n|128)}return i}(this.buf,t,this.pos);const i=this.pos-e;i>=128&&js(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){const e=t.length;this.writeVarint(e),this.realloc(e);for(let i=0;i=128&&js(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n}writeMessage(t,e,i){this.writeTag(t,2),this.writeRawMessage(e,i)}writePackedVarint(t,e){e.length&&this.writeMessage(t,Ns,e)}writePackedSVarint(t,e){e.length&&this.writeMessage(t,Ws,e)}writePackedBoolean(t,e){e.length&&this.writeMessage(t,Bs,e)}writePackedFloat(t,e){e.length&&this.writeMessage(t,Ys,e)}writePackedDouble(t,e){e.length&&this.writeMessage(t,Us,e)}writePackedFixed32(t,e){e.length&&this.writeMessage(t,qs,e)}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,Zs,e)}writePackedFixed64(t,e){e.length&&this.writeMessage(t,$s,e)}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,Vs,e)}writeBytesField(t,e){this.writeTag(t,2),this.writeBytes(e)}writeFixed32Field(t,e){this.writeTag(t,5),this.writeFixed32(e)}writeSFixed32Field(t,e){this.writeTag(t,5),this.writeSFixed32(e)}writeFixed64Field(t,e){this.writeTag(t,1),this.writeFixed64(e)}writeSFixed64Field(t,e){this.writeTag(t,1),this.writeSFixed64(e)}writeVarintField(t,e){this.writeTag(t,0),this.writeVarint(e)}writeSVarintField(t,e){this.writeTag(t,0),this.writeSVarint(e)}writeStringField(t,e){this.writeTag(t,2),this.writeString(e)}writeFloatField(t,e){this.writeTag(t,5),this.writeFloat(e)}writeDoubleField(t,e){this.writeTag(t,1),this.writeDouble(e)}writeBooleanField(t,e){this.writeVarintField(t,+e)}}function Xs(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function js(t,e,i){const n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(n);for(let e=i.pos-1;e>=t;e--)i.buf[e+n]=i.buf[e]}function Ns(t,e){for(let i=0;i>3)?i.readString():2===t?i.readFloat():3===t?i.readDouble():4===t?i.readVarint64():5===t?i.readVarint():6===t?i.readSVarint():7===t?i.readBoolean():null;e.values.push(n)}}function Js(t,e,i){if(1==t)e.id=i.readVarint();else if(2==t){const t=i.readVarint()+i.pos;for(;i.pos>3}if(o--,1===s||2===s)a+=t.readSVarint(),l+=t.readSVarint(),1===s&&h>u&&(n.push(h),u=h),i.push(a,l),h+=2;else{if(7!==s)throw new Error("Invalid command found in the PBF");h>u&&(i.push(i[u],i[u+1]),h+=2)}}h>u&&(n.push(h),u=h)}createFeature_(t,e,i){const n=e.type;if(0===n)return null;let r;const s=e.properties;let o;this.idProperty_?(o=s[this.idProperty_],delete s[this.idProperty_]):o=e.id,s[this.layerName_]=e.layer.name;const a=[],l=[];this.readRawGeometry_(t,e,a,l);const h=function(t,e){let i;1===t?i=1===e?"Point":"MultiPoint":2===t?i=1===e?"LineString":"MultiLineString":3===t&&(i="Polygon");return i}(n,l.length);if(this.featureClass===Jn)r=new this.featureClass(h,a,l,2,s,o),r.transform(i.dataProjection);else{let t;if("Polygon"==h){const e=ii(a,l);t=e.length>1?new ts(a,"XY",e):new Zr(a,"XY",l)}else t="Point"===h?new Er(a,"XY"):"LineString"===h?new Nr(a,"XY"):"MultiPoint"===h?new Kr(a,"XY"):"MultiLineString"===h?new Jr(a,"XY",l):null;r=new(0,this.featureClass),this.geometryName_&&r.setGeometryName(this.geometryName_);const e=is(t,!1,i);r.setGeometry(e),void 0!==o&&r.setId(o),r.setProperties(s,!0)}return r}getType(){return"arraybuffer"}readFeatures(t,e){const i=this.layers_,n=vn((e=this.adaptOptions(e)).dataProjection);n.setWorldExtent(e.extent),e.dataProjection=n;const r=new Gs(t),s=r.readFields(Ks,{}),o=[];for(const t in s){if(i&&!i.includes(t))continue;const a=s[t],l=a?[0,0,a.extent,a.extent]:null;n.setExtent(l);for(let t=0,i=a.length;t>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return 0===this.elements_.length}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,n=e.length,r=e[t],s=i[t],o=t;for(;t>1;){const r=this.getLeftChildIndex_(t),s=this.getRightChildIndex_(t),o=st;){const t=this.getParentIndex_(e);if(!(n[t]>s))break;i[e]=i[t],n[e]=n[t],e=t}i[e]=r,n[e]=s}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let n=0;const r=e.length;let s,o,a;for(o=0;ot.apply(null,e)),(t=>t[0].getKey())),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){const e=super.enqueue(t);if(e){t[0].addEventListener(N,this.boundHandleTileChange_)}return e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(i===lr.LOADED||i===lr.ERROR||i===lr.EMPTY){i!==lr.ERROR&&e.removeEventListener(N,this.boundHandleTileChange_);const t=e.getKey();t in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[t],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let i=0;for(;this.tilesLoading_0;){const t=this.dequeue()[0],e=t.getKey();t.getState()!==lr.IDLE||e in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[e]=!0,++this.tilesLoading_,++i,t.load())}}};function ro(t,e,i,n,r){if(!t||!(i in t.wantedTiles))return eo;if(!t.wantedTiles[i][e.getKey()])return eo;const s=t.viewState.center,o=n[0]-s[0],a=n[1]-s[1];return 65536*Math.log(r)+Math.sqrt(o*o+a*a)/r}function so(t,e,i=0,n=t.length-1,r=ao){for(;n>i;){if(n-i>600){const s=n-i+1,o=e-i+1,a=Math.log(s),l=.5*Math.exp(2*a/3),h=.5*Math.sqrt(a*l*(s-l)/s)*(o-s/2<0?-1:1);so(t,e,Math.max(i,Math.floor(e-o*l/s+h)),Math.min(n,Math.floor(e+(s-o)*l/s+h)),r)}const s=t[e];let o=i,a=n;for(oo(t,i,e),r(t[n],s)>0&&oo(t,i,n);o0;)a--}0===r(t[i],s)?oo(t,i,a):(a++,oo(t,a,n)),a<=e&&(i=a+1),e<=a&&(n=a-1)}}function oo(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function ao(t,e){return te?1:0}class lo{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const i=[];if(!vo(t,e))return i;const n=this.toBBox,r=[];for(;e;){for(let s=0;s=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(n,r,e)}_split(t,e){const i=t[e],n=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,n);const s=this._chooseSplitIndex(i,r,n),o=wo(i.children.splice(s,i.children.length-s));o.height=i.height,o.leaf=i.leaf,uo(i,this.toBBox),uo(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(i,o)}_splitRoot(t,e){this.data=wo([t,e]),this.data.height=t.height+1,this.data.leaf=!1,uo(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let n,r=1/0,s=1/0;for(let o=e;o<=i-e;o++){const e=co(t,0,o,this.toBBox),a=co(t,o,i,this.toBBox),l=_o(e,a),h=mo(e)+mo(a);l=e;n--){const e=t.children[n];po(o,t.leaf?r(e):e),a+=yo(o)}return a}_adjustParentBBoxes(t,e,i){for(let n=i;n>=0;n--)po(e[n],t)}_condense(t){for(let e,i=t.length-1;i>=0;i--)0===t[i].children.length?i>0?(e=t[i-1].children,e.splice(e.indexOf(t[i]),1)):this.clear():uo(t[i],this.toBBox)}}function ho(t,e,i){if(!i)return e.indexOf(t);for(let n=0;n=t.minX&&e.maxY>=t.minY}function wo(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function bo(t,e,i,n,r){const s=[e,i];for(;s.length;){if((i=s.pop())-(e=s.pop())<=n)continue;const o=e+Math.ceil((i-e)/n/2)*n;so(t,o,e,i,r),s.push(e,o,o,i)}}let So=0;const To=1<",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",Coalesce:"coalesce",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette",ToString:"to-string",Has:"has"},No={[jo.Get]:$o(Uo(1,1/0),Wo),[jo.Var]:$o(Uo(1,1),(function(t,e,i){const n=t[1];if("string"!=typeof n)throw new Error("expected a string argument for var operation");return i.variables.add(n),[new zo(Eo,n)]})),[jo.Has]:$o(Uo(1,1/0),Wo),[jo.Id]:$o((function(t,e,i){i.featureId=!0}),Yo),[jo.Concat]:$o(Uo(2,1/0),qo(Eo)),[jo.GeometryType]:$o((function(t,e,i){i.geometryType=!0}),Yo),[jo.LineMetric]:$o(Yo),[jo.Resolution]:$o(Yo),[jo.Zoom]:$o(Yo),[jo.Time]:$o(Yo),[jo.Any]:$o(Uo(2,1/0),qo(To)),[jo.All]:$o(Uo(2,1/0),qo(To)),[jo.Not]:$o(Uo(1,1),qo(To)),[jo.Equal]:$o(Uo(2,2),qo(ko)),[jo.NotEqual]:$o(Uo(2,2),qo(ko)),[jo.GreaterThan]:$o(Uo(2,2),qo(Co)),[jo.GreaterThanOrEqualTo]:$o(Uo(2,2),qo(Co)),[jo.LessThan]:$o(Uo(2,2),qo(Co)),[jo.LessThanOrEqualTo]:$o(Uo(2,2),qo(Co)),[jo.Multiply]:$o(Uo(2,1/0),Bo),[jo.Coalesce]:$o(Uo(2,1/0),Bo),[jo.Divide]:$o(Uo(2,2),qo(Co)),[jo.Add]:$o(Uo(2,1/0),qo(Co)),[jo.Subtract]:$o(Uo(2,2),qo(Co)),[jo.Clamp]:$o(Uo(3,3),qo(Co)),[jo.Mod]:$o(Uo(2,2),qo(Co)),[jo.Pow]:$o(Uo(2,2),qo(Co)),[jo.Abs]:$o(Uo(1,1),qo(Co)),[jo.Floor]:$o(Uo(1,1),qo(Co)),[jo.Ceil]:$o(Uo(1,1),qo(Co)),[jo.Round]:$o(Uo(1,1),qo(Co)),[jo.Sin]:$o(Uo(1,1),qo(Co)),[jo.Cos]:$o(Uo(1,1),qo(Co)),[jo.Atan]:$o(Uo(1,2),qo(Co)),[jo.Sqrt]:$o(Uo(1,1),qo(Co)),[jo.Match]:$o(Uo(4,1/0),Zo,(function(t,e,i){const n=t.length-1,r=Eo|Co|To,s=Xo(t[1],r,i),o=Xo(t[t.length-1],e,i),a=new Array(n-2);for(let e=0;ee){throw new Error(`expected ${e===1/0?`${t} or more`:`${t} to ${e}`} arguments for ${s}, got ${o}`)}}}function Bo(t,e,i){const n=t.length-1,r=new Array(n);for(let s=0;s{for(let e=0;e{for(let e=0;e{const i=t.args;let r=e.properties[n];for(let t=1,e=i.length;tt.variables[n];case jo.Has:return e=>{const i=t.args;if(!(n in e.properties))return!1;let r=e.properties[n];for(let t=1,e=i.length;tt.featureId;case jo.GeometryType:return t=>t.geometryType;case jo.Concat:{const i=t.args.map((t=>Ho(t,e)));return t=>"".concat(...i.map((e=>e(t).toString())))}case jo.Resolution:return t=>t.resolution;case jo.Any:case jo.All:case jo.Between:case jo.In:case jo.Not:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i{for(let e=0;e{for(let e=0;e{const e=r[0](t),i=r[1](t),n=r[2](t);return e>=i&&e<=n};case jo.In:return t=>{const e=r[0](t);for(let i=1;i!r[0](t);default:throw new Error(`Unsupported logical operator ${i}`)}}(t,e);case jo.Equal:case jo.NotEqual:case jo.LessThan:case jo.LessThanOrEqualTo:case jo.GreaterThan:case jo.GreaterThanOrEqualTo:return function(t,e){const i=t.operator,n=Ho(t.args[0],e),r=Ho(t.args[1],e);switch(i){case jo.Equal:return t=>n(t)===r(t);case jo.NotEqual:return t=>n(t)!==r(t);case jo.LessThan:return t=>n(t)n(t)<=r(t);case jo.GreaterThan:return t=>n(t)>r(t);case jo.GreaterThanOrEqualTo:return t=>n(t)>=r(t);default:throw new Error(`Unsupported comparison operator ${i}`)}}(t,e);case jo.Multiply:case jo.Divide:case jo.Add:case jo.Subtract:case jo.Clamp:case jo.Mod:case jo.Pow:case jo.Abs:case jo.Floor:case jo.Ceil:case jo.Round:case jo.Sin:case jo.Cos:case jo.Atan:case jo.Sqrt:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i{let e=1;for(let i=0;ir[0](t)/r[1](t);case jo.Add:return t=>{let e=0;for(let i=0;ir[0](t)-r[1](t);case jo.Clamp:return t=>{const e=r[0](t),i=r[1](t);if(en?n:e};case jo.Mod:return t=>r[0](t)%r[1](t);case jo.Pow:return t=>Math.pow(r[0](t),r[1](t));case jo.Abs:return t=>Math.abs(r[0](t));case jo.Floor:return t=>Math.floor(r[0](t));case jo.Ceil:return t=>Math.ceil(r[0](t));case jo.Round:return t=>Math.round(r[0](t));case jo.Sin:return t=>Math.sin(r[0](t));case jo.Cos:return t=>Math.cos(r[0](t));case jo.Atan:return 2===n?t=>Math.atan2(r[0](t),r[1](t)):t=>Math.atan(r[0](t));case jo.Sqrt:return t=>Math.sqrt(r[0](t));default:throw new Error(`Unsupported numeric operator ${i}`)}}(t,e);case jo.Case:return function(t,e){const i=t.args.length,n=new Array(i);for(let r=0;r{for(let e=0;e{const e=n[0](t);for(let r=1;r{const e=n[0](t),r=n[1](t);let s,o;for(let a=2;a=r)return 2===a?l:h?Qo(e,r,s,o,i,l):Jo(e,r,s,o,i,l);s=i,o=l}return o}}(t,e);case jo.ToString:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i{const i=r[0](e);return t.args[0].type===Ro?D(i):i.toString()};throw new Error(`Unsupported convert operator ${i}`)}(t,e);default:throw new Error(`Unsupported operator ${i}`)}}function Jo(t,e,i,n,r,s){const o=r-i;if(0===o)return n;const a=e-i;return n+(1===t?a/o:(Math.pow(t,a)-1)/(Math.pow(t,o)-1))*(s-n)}function Qo(t,e,i,n,r,s){if(0===r-i)return n;const o=I(n),a=I(s);let l=a[2]-o[2];l>180?l-=360:l<-180&&(l+=360);return A(function(t){const e=h.rgb(d.xyz(t));return e[3]=t[3],e}([Jo(t,e,i,o[0],r,a[0]),Jo(t,e,i,o[1],r,a[1]),o[2]+Jo(t,e,i,0,r,l),Jo(t,e,i,n[3],r,s[3])]))}function ta(t){return!0}function ea(t){const e=Go(),i=function(t,e){const i=t.length,n=new Array(i);for(let r=0;rnull;n=ha(t,e+"fill-color",i)}if(!n)return null;const r=new te;return function(t){const e=n(t);return e===T?null:(r.setColor(e),r)}}function sa(t,e,i){const n=oa(t,e+"stroke-width",i),r=ha(t,e+"stroke-color",i);if(!n&&!r)return null;const s=aa(t,e+"stroke-line-cap",i),o=aa(t,e+"stroke-line-join",i),a=ua(t,e+"stroke-line-dash",i),l=oa(t,e+"stroke-line-dash-offset",i),h=oa(t,e+"stroke-miter-limit",i),u=new tr;return function(t){if(r){const e=r(t);if(e===T)return null;u.setColor(e)}if(n&&u.setWidth(n(t)),s){const e=s(t);if("butt"!==e&&"round"!==e&&"square"!==e)throw new Error("Expected butt, round, or square line cap");u.setLineCap(e)}if(o){const e=o(t);if("bevel"!==e&&"round"!==e&&"miter"!==e)throw new Error("Expected bevel, round, or miter line join");u.setLineJoin(e)}return a&&u.setLineDash(a(t)),l&&u.setLineDashOffset(l(t)),h&&u.setMiterLimit(h(t)),u}}function oa(t,e,i){if(!(e in t))return;const n=Ko(t[e],Co,i);return function(t){return va(n(t),e)}}function aa(t,e,i){if(!(e in t))return null;const n=Ko(t[e],Eo,i);return function(t){return xa(n(t),e)}}function la(t,e,i){if(!(e in t))return null;const n=Ko(t[e],To,i);return function(t){const i=n(t);if("boolean"!=typeof i)throw new Error(`Expected a boolean for ${e}`);return i}}function ha(t,e,i){if(!(e in t))return null;const n=Ko(t[e],Ro,i);return function(t){return wa(n(t),e)}}function ua(t,e,i){if(!(e in t))return null;const n=Ko(t[e],Mo,i);return function(t){return _a(n(t),e)}}function ca(t,e,i){if(!(e in t))return null;const n=Ko(t[e],Mo,i);return function(t){const i=_a(n(t),e);if(2!==i.length)throw new Error(`Expected two numbers for ${e}`);return i}}function da(t,e,i){if(!(e in t))return null;const n=Ko(t[e],Mo,i);return function(t){return ba(n(t),e)}}function pa(t,e,i){if(!(e in t))return null;const n=Ko(t[e],Mo|Co,i);return function(t){return function(t,e){if("number"==typeof t)return t;return ba(t,e)}(n(t),e)}}function fa(t,e){const i=t[e];if(void 0!==i){if("number"!=typeof i)throw new Error(`Expected a number for ${e}`);return i}}function ga(t,e){const i=t[e];if(void 0!==i){if("bottom-left"!==i&&"bottom-right"!==i&&"top-left"!==i&&"top-right"!==i)throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${e}`);return i}}function ma(t,e){const i=t[e];if(void 0!==i){if("pixels"!==i&&"fraction"!==i)throw new Error(`Expected pixels or fraction for ${e}`);return i}}function ya(t,e){const i=t[e];if(void 0!==i){if("string"!=typeof i)throw new Error(`Expected a string for ${e}`);if("declutter"!==i&&"obstacle"!==i&&"none"!==i)throw new Error(`Expected declutter, obstacle, or none for ${e}`);return i}}function _a(t,e){if(!Array.isArray(t))throw new Error(`Expected an array for ${e}`);const i=t.length;for(let n=0;n4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return i}function ba(t,e){const i=_a(t,e);if(2!==i.length)throw new Error(`Expected an array of two numbers for ${e}`);return i}const Sa="renderOrder";var Ta=class extends Ps{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?String(t.declutter):void 0,this.renderBuffer_=void 0!==t.renderBuffer?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=void 0!==t.updateWhileAnimating&&t.updateWhileAnimating,this.updateWhileInteracting_=void 0!==t.updateWhileInteracting&&t.updateWhileInteracting}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(Sa)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){const i=this.getDeclutter();i in t.declutter==!1&&(t.declutter[i]=new lo(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(Sa,t)}setStyle(t){this.style_=void 0===t?nr:t;const e=function(t){if(void 0===t)return nr;if(!t)return null;if("function"==typeof t)return t;if(t instanceof sr)return t;if(!Array.isArray(t))return ia([t]);if(0===t.length)return[];const e=t.length,i=t[0];if(i instanceof sr){const i=new Array(e);for(let n=0;nt):null}var Ra=class extends St{constructor(t){super(),this.projection=vn(t.projection),this.attributions_=Ea(t.attributions),this.attributionsCollapsible_=t.attributionsCollapsible??!0,this.loading=!1,this.state_=void 0!==t.state?t.state:"ready",this.wrapX_=void 0!==t.wrapX&&t.wrapX,this.interpolate_=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;const e=this;this.viewPromise_=new Promise((function(t,i){e.viewResolver=t,e.viewRejector=i}))}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(t){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(t){this.attributions_=Ea(t),this.changed()}setState(t){this.state_=t,this.changed()}};class Ma{constructor(t,e,i,n){this.minX=t,this.maxX=e,this.minY=i,this.maxY=n}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minXthis.maxX&&(this.maxX=t.maxX),t.minYthis.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}function Ia(t,e,i,n,r){return void 0!==r?(r.minX=t,r.maxX=e,r.minY=i,r.maxY=n,r):new Ma(t,e,i,n)}var ka=Ma;function Fa(t,e,i,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=i,n):[t,e,i]}function Aa(t,e,i){return t+"/"+e+"/"+i}const Da=[0,0,0];var Pa=class{constructor(t){let e;if(this.minZoom=void 0!==t.minZoom?t.minZoom:0,this.resolutions_=t.resolutions,ee(function(t,e,i){const n=e||B;return t.every((function(e,r){if(0===r)return!0;const s=n(t[r-1],e);return!(s>0||i&&0===s)}))}(this.resolutions_,((t,e)=>e-t),!0),"`resolutions` must be sorted in descending order"),!t.origins)for(let t=0,i=this.resolutions_.length-1;t{const n=new ka(Math.min(0,t[0]),Math.max(t[0]-1,-1),Math.min(0,t[1]),Math.max(t[1]-1,-1));if(i){const t=this.getTileRangeForExtentAndZ(i,e);n.minX=Math.max(t.minX,n.minX),n.maxX=Math.min(t.maxX,n.maxX),n.minY=Math.max(t.minY,n.minY),n.maxY=Math.min(t.maxY,n.maxY)}return n})):i&&this.calculateTileRanges_(i)}forEachTileCoord(t,e,i){const n=this.getTileRangeForExtentAndZ(t,e);for(let t=n.minX,r=n.maxX;t<=r;++t)for(let r=n.minY,s=n.maxY;r<=s;++r)i([e,t,r])}forEachTileCoordParentTileRange(t,e,i,n){let r,s,o,a=null,l=t[0]-1;for(2===this.zoomFactor_?(s=t[1],o=t[2]):a=this.getTileCoordExtent(t,n);l>=this.minZoom;){if(void 0!==s&&void 0!==o?(s=Math.floor(s/2),o=Math.floor(o/2),r=Ia(s,s,o,o,i)):r=this.getTileRangeForExtentAndZ(a,l,i),e(l,r))return!0;--l}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]this.maxZoom||e0?n:Math.max(s/i[0],r/i[1]);const o=e+1,a=new Array(o);for(let t=0;t2||Math.abs(t[4*e+3]-191.25)>2}function Ka(t,e,i,n){const r=In(i,e,t);let s=wn(e,n,i);const o=e.getMetersPerUnit();void 0!==o&&(s*=o);const a=t.getMetersPerUnit();void 0!==a&&(s/=a);const l=t.getExtent();if(!l||ue(l,r)){const e=wn(t,s,r)/s;isFinite(e)&&e>0&&(s/=e)}return s}function Ha(t,e,i,n){const r=Me(i);let s=Ka(t,e,r,n);return(!isFinite(s)||s<=0)&&Te(i,(function(i){return s=Ka(t,e,i,n),isFinite(s)&&s>0})),s}function Ja(t,e,i,n,r,s,o,a,l,h,u,c,d,p){const f=O(Math.round(i*t),Math.round(i*e),Za);if(c||(f.imageSmoothingEnabled=!1),0===l.length)return f.canvas;function g(t){return Math.round(t*i)/i}f.scale(i,i),f.globalCompositeOperation="lighter";const m=[1/0,1/0,-1/0,-1/0];let y;l.forEach((function(t,e,i){ve(m,t.extent)}));const _=i/n,x=(c?1:1+Math.pow(2,-24))/_;if(!d||1!==l.length||0!==h){if(y=O(Math.round(ze(m)*_),Math.round(Ae(m)*_),Za),c||(y.imageSmoothingEnabled=!1),r&&p){const t=(r[0]-m[0])*_,e=-(r[3]-m[3])*_,i=ze(r)*_,n=Ae(r)*_;y.rect(t,e,i,n),y.clip()}l.forEach((function(t,e,i){if(t.image.width>0&&t.image.height>0){if(t.clipExtent){y.save();const e=(t.clipExtent[0]-m[0])*_,i=-(t.clipExtent[3]-m[3])*_,n=ze(t.clipExtent)*_,r=Ae(t.clipExtent)*_;y.rect(c?e:Math.round(e),c?i:Math.round(i),c?n:Math.round(e+n)-Math.round(e),c?r:Math.round(i+r)-Math.round(i)),y.clip()}const e=(t.extent[0]-m[0])*_,i=-(t.extent[3]-m[3])*_,n=ze(t.extent)*_,r=Ae(t.extent)*_;y.drawImage(t.image,h,h,t.image.width-2*h,t.image.height-2*h,c?e:Math.round(e),c?i:Math.round(i),c?n:Math.round(e+n)-Math.round(e),c?r:Math.round(i+r)-Math.round(i)),t.clipExtent&&y.restore()}}))}const v=Pe(o);return a.getTriangles().forEach((function(t,e,i){const n=t.source,r=t.target;let o=n[0][0],a=n[0][1],h=n[1][0],u=n[1][1],d=n[2][0],p=n[2][1];const _=g((r[0][0]-v[0])/s),w=g(-(r[0][1]-v[1])/s),b=g((r[1][0]-v[0])/s),S=g(-(r[1][1]-v[1])/s),T=g((r[2][0]-v[0])/s),C=g(-(r[2][1]-v[1])/s),E=o,R=a;o=0,a=0,h-=E,u-=R,d-=E,p-=R;const M=function(t){const e=t.length;for(let i=0;ir&&(r=e,n=s)}if(0===r)return null;const s=t[n];t[n]=t[i],t[i]=s;for(let n=i+1;n=0;n--){i[n]=t[n][e]/t[n][n];for(let r=n-1;r>=0;r--)t[r][e]-=t[r][n]*i[n]}return i}([[h,u,0,0,b-_],[d,p,0,0,T-_],[0,0,h,u,S-w],[0,0,d,p,C-w]]);if(!M)return;if(f.save(),f.beginPath(),function(){if(void 0===qa){const t=O(6,6,Za);t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",$a(t,4,5,4,0),$a(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;qa=Va(e,0)||Va(e,4)||Va(e,8),j(t),Za.push(t.canvas)}return qa}()||!c){f.moveTo(b,S);const t=4,e=_-b,i=w-S;for(let n=0;nUn(o,In(t,this.targetProj_,this.sourceProj_)))):Mn(this.targetProj_,this.sourceProj_);this.transformInv_=function(t){const e=t[0]+"/"+t[1];return a[e]||(a[e]=l(t)),a[e]},this.maxSourceExtent_=n,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&ze(n)>=ze(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?ze(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?ze(this.targetProj_.getExtent()):null;const h=Pe(i),u=Le(i),c=Re(i),d=Ee(i),p=this.transformInv_(h),f=this.transformInv_(u),g=this.transformInv_(c),m=this.transformInv_(d),y=10+(s?Math.max(0,Math.ceil(Math.log2(Ce(i)/(s*s*256*256)))):0);if(this.addQuad_(h,u,c,d,p,f,g,m,y),this.wrapsXInSource_){let t=1/0;this.triangles_.forEach((function(e,i,n){t=Math.min(t,e.source[0][0],e.source[1][0],e.source[2][0])})),this.triangles_.forEach((e=>{if(Math.max(e.source[0][0],e.source[1][0],e.source[2][0])-t>this.sourceWorldWidth_/2){const i=[[e.source[0][0],e.source[0][1]],[e.source[1][0],e.source[1][1]],[e.source[2][0],e.source[2][1]]];i[0][0]-t>this.sourceWorldWidth_/2&&(i[0][0]-=this.sourceWorldWidth_),i[1][0]-t>this.sourceWorldWidth_/2&&(i[1][0]-=this.sourceWorldWidth_),i[2][0]-t>this.sourceWorldWidth_/2&&(i[2][0]-=this.sourceWorldWidth_);const n=Math.min(i[0][0],i[1][0],i[2][0]);Math.max(i[0][0],i[1][0],i[2][0])-n.5&&u<1;let p=!1;if(l>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){p=ze(oe([t,e,i,n]))/this.targetWorldWidth_>.25||p}!d&&this.sourceProj_.isGlobal()&&u&&(p=u>.25||p)}if(!p&&this.maxSourceExtent_&&isFinite(h[0])&&isFinite(h[1])&&isFinite(h[2])&&isFinite(h[3])&&!Oe(h,this.maxSourceExtent_))return;let f=0;if(!(p||isFinite(r[0])&&isFinite(r[1])&&isFinite(s[0])&&isFinite(s[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(a[0])&&isFinite(a[1])))if(l>0)p=!0;else if(f=(isFinite(r[0])&&isFinite(r[1])?0:8)+(isFinite(s[0])&&isFinite(s[1])?0:4)+(isFinite(o[0])&&isFinite(o[1])?0:2)+(isFinite(a[0])&&isFinite(a[1])?0:1),1!=f&&2!=f&&4!=f&&8!=f)return;if(l>0){if(!p){const e=[(t[0]+i[0])/2,(t[1]+i[1])/2],n=this.transformInv_(e);let s;if(d){s=(_(r[0],c)+_(o[0],c))/2-_(n[0],c)}else s=(r[0]+o[0])/2-n[0];const a=(r[1]+o[1])/2-n[1];p=s*s+a*a>this.errorThresholdSquared_}if(p){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const h=[(e[0]+i[0])/2,(e[1]+i[1])/2],u=this.transformInv_(h),c=[(n[0]+t[0])/2,(n[1]+t[1])/2],d=this.transformInv_(c);this.addQuad_(t,e,h,c,r,s,u,d,l-1),this.addQuad_(c,h,i,n,d,u,o,a,l-1)}else{const h=[(t[0]+e[0])/2,(t[1]+e[1])/2],u=this.transformInv_(h),c=[(i[0]+n[0])/2,(i[1]+n[1])/2],d=this.transformInv_(c);this.addQuad_(t,h,c,n,r,u,d,a,l-1),this.addQuad_(h,e,i,c,u,s,o,d,l-1)}return}}if(d){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}0==(11&f)&&this.addTriangle_(t,i,n,r,o,a),0==(14&f)&&this.addTriangle_(t,i,e,r,o,s),f&&(0==(13&f)&&this.addTriangle_(e,n,t,s,a,r),0==(7&f)&&this.addTriangle_(e,n,i,s,a,o))}calculateSourceExtent(){const t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach((function(e,i,n){const r=e.source;we(t,r[0]),we(t,r[1]),we(t,r[2])})),t}getTriangles(){return this.triangles_}};var tl=class extends dr{constructor(t,e,i,n,r,s,o,a,l,h,u,c){super(r,lr.IDLE,c),this.renderEdges_=void 0!==u&&u,this.pixelRatio_=o,this.gutter_=a,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=n,this.wrappedTileCoord_=s||r,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()?t.getExtent():void 0;const d=n.getTileCoordExtent(this.wrappedTileCoord_),f=this.targetTileGrid_.getExtent();let g=this.sourceTileGrid_.getExtent();const m=f?De(d,f):d;if(0===Ce(m))return void(this.state=lr.EMPTY);const y=t.getExtent();y&&(g=g?De(g,y):y);const _=n.getResolution(this.wrappedTileCoord_[0]),x=Ha(t,i,m,_);if(!isFinite(x)||x<=0)return void(this.state=lr.EMPTY);const v=void 0!==h?h:.5;if(this.triangulation_=new Qa(t,i,m,g,x*v,_),0===this.triangulation_.getTriangles().length)return void(this.state=lr.EMPTY);this.sourceZ_=e.getZForResolution(x);let w=this.triangulation_.calculateSourceExtent();if(g&&(t.canWrapX()?(w[1]=p(w[1],g[1],g[3]),w[3]=p(w[3],g[1],g[3])):w=De(w,g)),Ce(w)){let i=0,n=0;t.canWrapX()&&(i=ze(y),n=Math.floor((w[0]-y[0])/i));Ne(w.slice(),t,!0).forEach((t=>{const r=e.getTileRangeForExtentAndZ(t,this.sourceZ_);for(let t=r.minX;t<=r.maxX;t++)for(let e=r.minY;e<=r.maxY;e++){const r=l(this.sourceZ_,t,e,o);if(r){const t=n*i;this.sourceTiles_.push({tile:r,offset:t})}}++n})),0===this.sourceTiles_.length&&(this.state=lr.EMPTY)}else this.state=lr.EMPTY}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach((e=>{const i=e.tile;if(i&&i.getState()==lr.LOADED){const n=this.sourceTileGrid_.getTileCoordExtent(i.tileCoord);n[0]+=e.offset,n[2]+=e.offset;const r=this.clipExtent_?.slice();r&&(r[0]+=e.offset,r[2]+=e.offset),t.push({extent:n,clipExtent:r,image:i.getImage()})}})),this.sourceTiles_.length=0,0===t.length)this.state=lr.ERROR;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),n="number"==typeof i?i:i[0],r="number"==typeof i?i:i[1],s=this.targetTileGrid_.getResolution(e),o=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Ja(n,r,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),s,a,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=lr.LOADED}this.changed()}load(){if(this.state==lr.IDLE){this.state=lr.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach((({tile:e})=>{const i=e.getState();if(i==lr.IDLE||i==lr.LOADING){t++;const i=rt(e,N,(n=>{const r=e.getState();r!=lr.LOADED&&r!=lr.ERROR&&r!=lr.EMPTY||(ot(i),t--,0===t&&(this.unlistenSources_(),this.reproject_()))}));this.sourcesListenerKeys_.push(i)}})),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach((function({tile:t},e,i){t.getState()==lr.IDLE&&t.load()}))}}unlistenSources_(){this.sourcesListenerKeys_.forEach(ot),this.sourcesListenerKeys_=null}release(){this.canvas_&&(j(this.canvas_.getContext("2d")),Za.push(this.canvas_),this.canvas_=null),super.release()}};class el extends it{constructor(t,e){super(t),this.tile=e}}var il=class extends Ra{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:t.projection,state:t.state,wrapX:t.wrapX,interpolate:t.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=void 0!==t.tilePixelRatio?t.tilePixelRatio:1,this.tileGrid=void 0!==t.tileGrid?t.tileGrid:null;const e=[256,256];this.tileGrid&&qt(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tmpSize=[0,0],this.key_=t.key||wt(this),this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getResolutions(t){const e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,i,n,r){return xt()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:La(t)}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const n=this.getTileGridForProjection(i),r=this.getTilePixelRatio(e),s=qt(n.getTileSize(t),this.tmpSize);return 1==r?s:(o=s,a=r,void 0===(l=this.tmpSize)&&(l=[0,0]),l[0]=o[0]*a+.5|0,l[1]=o[1]*a+.5|0,l);var o,a,l}getTileCoordForTileUrlFunction(t,e){const i=void 0!==e?e:this.getProjection(),n=void 0!==e?this.getTileGridForProjection(i):this.tileGrid||this.getTileGridForProjection(i);return this.getWrapX()&&i.isGlobal()&&(t=function(t,e,i){const n=e[0],r=t.getTileCoordCenter(e),s=Ga(i);if(!ue(s,r)){const e=ze(s),i=Math.ceil((s[0]-r[0])/e);return r[0]+=e*i,t.getTileCoordForCoordAndZ(r,n)}return e}(n,t,i)),function(t,e){const i=t[0],n=t[1],r=t[2];if(e.getMinZoom()>i||i>e.getMaxZoom())return!1;const s=e.getFullTileRange(i);return!s||s.containsXY(n,r)}(t,n)?t:null}clear(){}refresh(){this.clear(),super.refresh()}},nl="tileloadstart",rl="tileloadend",sl="tileloaderror";class ol extends il{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===ol.prototype.tileUrlFunction,this.tileLoadFunction=t.tileLoadFunction,t.tileUrlFunction&&(this.tileUrlFunction=t.tileUrlFunction),this.urls=null,t.urls?this.setUrls(t.urls):t.url&&this.setUrl(t.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(t){const e=t.target,i=wt(e),n=e.getState();let r;n==lr.LOADING?(this.tileLoadingKeys_[i]=!0,r=nl):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],r=n==lr.ERROR?sl:n==lr.LOADED?rl:void 0),null!=r&&this.dispatchEvent(new el(r,e))}setTileLoadFunction(t){this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,void 0!==e?this.setKey(e):this.changed()}setUrl(t){const e=function(t){const e=[];let i=/\{([a-z])-([a-z])\}/.exec(t);if(i){const n=i[1].charCodeAt(0),r=i[2].charCodeAt(0);let s;for(s=n;s<=r;++s)e.push(t.replace(i[0],String.fromCharCode(s)));return e}if(i=/\{(\d+)-(\d+)\}/.exec(t),i){const n=parseInt(i[2],10);for(let r=parseInt(i[1],10);r<=n;r++)e.push(t.replace(i[0],r.toString()));return e}return e.push(t),e}(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join("\n");this.generateTileUrlFunction_?this.setTileUrlFunction(Ua(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}}var al=ol;var ll=class{drawCustom(t,e,i,n,r){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,i){}drawFeature(t,e,i){}drawGeometryCollection(t,e,i){}drawLineString(t,e,i){}drawMultiLineString(t,e,i){}drawMultiPoint(t,e,i){}drawMultiPolygon(t,e,i){}drawPoint(t,e,i){}drawPolygon(t,e,i){}drawText(t,e,i){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}};const hl={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},ul=[hl.FILL],cl=[hl.STROKE],dl=[hl.BEGIN_PATH],pl=[hl.CLOSE_PATH];var fl=hl;var gl=class extends ll{constructor(t,e,i,n){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=n,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){const e=this.pixelRatio;return 1==e?t:t.map((function(t){return t*e}))}appendFlatPointCoordinates(t,e){const i=this.getBufferedMaxExtent(),n=this.tmpCoordinate_,r=this.coordinates;let s=r.length;for(let o=0,a=t.length;oa&&(this.instructions.push([fl.CUSTOM,a,h,t,i,Ar,r]),this.hitDetectionInstructions.push([fl.CUSTOM,a,h,t,n||i,Ar,r]));break;case"Point":l=t.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),h=this.coordinates.length,this.instructions.push([fl.CUSTOM,a,h,t,i,void 0,r]),this.hitDetectionInstructions.push([fl.CUSTOM,a,h,t,n||i,void 0,r])}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[fl.BEGIN_GEOMETRY,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[fl.BEGIN_GEOMETRY,e,0,t,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;let e;t.reverse();const i=t.length;let n,r,s=-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=[fl.SET_FILL_STYLE,e];return"string"!=typeof e&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[fl.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;"string"==typeof i&&t.currentFillStyle==i||(void 0!==i&&this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,n=t.lineCap,r=t.lineDash,s=t.lineDashOffset,o=t.lineJoin,a=t.lineWidth,l=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=n||r!=t.currentLineDash&&!K(t.currentLineDash,r)||t.currentLineDashOffset!=s||t.currentLineJoin!=o||t.currentLineWidth!=a||t.currentMiterLimit!=l)&&(void 0!==i&&e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=r,t.currentLineDashOffset=s,t.currentLineJoin=o,t.currentLineWidth=a,t.currentMiterLimit=l)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[fl.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=le(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;ae(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}};var ml=class extends gl{constructor(t,e,i,n){super(t,e,i,n),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e,i){if(!this.image_||this.maxExtent&&!ue(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),r=t.getStride(),s=this.coordinates.length,o=this.appendFlatPointCoordinates(n,r);this.instructions.push([fl.DRAW_IMAGE,s,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([fl.DRAW_IMAGE,s,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e,i){if(!this.image_)return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),r=[];for(let e=0,i=n.length;e=t){const e=(t-a+c)/c,d=x(i,h,e),p=x(n,u,e);l.push(d,p),s.push(l),l=[d,p],a==t&&(o+=r),a=0}else if(a0&&s.push(l),s}function vl(t,e,i,n,r){let s,o,a,l,h,u,c,d,p,f,g=i,m=i,y=0,_=0,x=i;for(o=i;o