xm-olmap 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,12 @@
1
- var xiaominMap=function(dt,x){"use strict";var LC=Object.defineProperty;var PC=(dt,x,st)=>x in dt?LC(dt,x,{enumerable:!0,configurable:!0,writable:!0,value:st}):dt[x]=st;var El=(dt,x,st)=>(PC(dt,typeof x!="symbol"?x+"":x,st),st);const st={ANIMATING:0,INTERACTING:1};function ld(i,t,e){let n,s;e=e||Re;let r=0,o=i.length,a=!1;for(;r<o;)n=r+(o-r>>1),s=+e(i[n],t),s<0?r=n+1:(o=n,a=!s);return a?r:~r}function Re(i,t){return i>t?1:i<t?-1:0}function hd(i,t){return i<t?1:i>t?-1:0}function vs(i,t,e){if(i[0]<=t)return 0;const n=i.length;if(t<=i[n-1])return n-1;if(typeof e=="function"){for(let s=1;s<n;++s){const r=i[s];if(r===t)return s;if(r<t)return e(t,i[s-1],r)>0?s-1:s}return n-1}if(e>0){for(let s=1;s<n;++s)if(i[s]<t)return s-1;return n-1}if(e<0){for(let s=1;s<n;++s)if(i[s]<=t)return s;return n-1}for(let s=1;s<n;++s){if(i[s]==t)return s;if(i[s]<t)return i[s-1]-t<t-i[s]?s-1:s}return n-1}function cd(i,t,e){for(;t<e;){const n=i[t];i[t]=i[e],i[e]=n,++t,--e}}function ne(i,t){const e=Array.isArray(t)?t:[t],n=e.length;for(let s=0;s<n;s++)i[i.length]=e[s]}function Be(i,t){const e=i.length;if(e!==t.length)return!1;for(let n=0;n<e;n++)if(i[n]!==t[n])return!1;return!0}function ud(i,t,e){const n=t||Re;return i.every(function(s,r){if(r===0)return!0;const o=n(i[r-1],s);return!(o>0||e&&o===0)})}const pt={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function Rs(i){const t=Mt();for(let e=0,n=i.length;e<n;++e)Li(t,i[e]);return t}function Gn(i,t,e){return e?(e[0]=i[0]-t,e[1]=i[1]-t,e[2]=i[2]+t,e[3]=i[3]+t,e):[i[0]-t,i[1]-t,i[2]+t,i[3]+t]}function Cl(i,t){return t?(t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t):i.slice()}function hn(i,t,e){let n,s;return t<i[0]?n=i[0]-t:i[2]<t?n=t-i[2]:n=0,e<i[1]?s=i[1]-e:i[3]<e?s=e-i[3]:s=0,n*n+s*s}function cn(i,t){return Br(i,t[0],t[1])}function fe(i,t){return i[0]<=t[0]&&t[2]<=i[2]&&i[1]<=t[1]&&t[3]<=i[3]}function Br(i,t,e){return i[0]<=t&&t<=i[2]&&i[1]<=e&&e<=i[3]}function Yr(i,t){const e=i[0],n=i[1],s=i[2],r=i[3],o=t[0],a=t[1];let l=pt.UNKNOWN;return o<e?l=l|pt.LEFT:o>s&&(l=l|pt.RIGHT),a<n?l=l|pt.BELOW:a>r&&(l=l|pt.ABOVE),l===pt.UNKNOWN&&(l=pt.INTERSECTING),l}function Mt(){return[1/0,1/0,-1/0,-1/0]}function Te(i,t,e,n,s){return s?(s[0]=i,s[1]=t,s[2]=e,s[3]=n,s):[i,t,e,n]}function Ii(i){return Te(1/0,1/0,-1/0,-1/0,i)}function Wr(i,t){const e=i[0],n=i[1];return Te(e,n,e,n,t)}function Vr(i,t,e,n,s){const r=Ii(s);return vl(r,i,t,e,n)}function zn(i,t){return i[0]==t[0]&&i[2]==t[2]&&i[1]==t[1]&&i[3]==t[3]}function wl(i,t){return t[0]<i[0]&&(i[0]=t[0]),t[2]>i[2]&&(i[2]=t[2]),t[1]<i[1]&&(i[1]=t[1]),t[3]>i[3]&&(i[3]=t[3]),i}function Li(i,t){t[0]<i[0]&&(i[0]=t[0]),t[0]>i[2]&&(i[2]=t[0]),t[1]<i[1]&&(i[1]=t[1]),t[1]>i[3]&&(i[3]=t[1])}function vl(i,t,e,n,s){for(;e<n;e+=s)dd(i,t[e],t[e+1]);return i}function dd(i,t,e){i[0]=Math.min(i[0],t),i[1]=Math.min(i[1],e),i[2]=Math.max(i[2],t),i[3]=Math.max(i[3],e)}function Ur(i,t){let e;return e=t(jn(i)),e||(e=t(Pi(i)),e)||(e=t(bi(i)),e)||(e=t(Ye(i)),e)?e:!1}function Kr(i){let t=0;return Xn(i)||(t=K(i)*ct(i)),t}function jn(i){return[i[0],i[1]]}function Pi(i){return[i[2],i[1]]}function ie(i){return[(i[0]+i[2])/2,(i[1]+i[3])/2]}function fd(i,t){let e;if(t==="bottom-left")e=jn(i);else if(t==="bottom-right")e=Pi(i);else if(t==="top-left")e=Ye(i);else if(t==="top-right")e=bi(i);else throw new Error("Invalid corner");return e}function Ts(i,t,e,n,s){const[r,o,a,l,h,c,u,d]=Rl(i,t,e,n);return Te(Math.min(r,a,h,u),Math.min(o,l,c,d),Math.max(r,a,h,u),Math.max(o,l,c,d),s)}function Rl(i,t,e,n){const s=t*n[0]/2,r=t*n[1]/2,o=Math.cos(e),a=Math.sin(e),l=s*o,h=s*a,c=r*o,u=r*a,d=i[0],f=i[1];return[d-l+u,f-h-c,d-l-u,f-h+c,d+l-u,f+h+c,d+l+u,f+h-c,d-l+u,f-h-c]}function ct(i){return i[3]-i[1]}function Se(i,t,e){const n=e||Mt();return Ct(i,t)?(i[0]>t[0]?n[0]=i[0]:n[0]=t[0],i[1]>t[1]?n[1]=i[1]:n[1]=t[1],i[2]<t[2]?n[2]=i[2]:n[2]=t[2],i[3]<t[3]?n[3]=i[3]:n[3]=t[3]):Ii(n),n}function Ye(i){return[i[0],i[3]]}function bi(i){return[i[2],i[3]]}function K(i){return i[2]-i[0]}function Ct(i,t){return i[0]<=t[2]&&i[2]>=t[0]&&i[1]<=t[3]&&i[3]>=t[1]}function Xn(i){return i[2]<i[0]||i[3]<i[1]}function gd(i,t){return t?(t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t):i}function _d(i,t){const e=(i[2]-i[0])/2*(t-1),n=(i[3]-i[1])/2*(t-1);i[0]-=e,i[2]+=e,i[1]-=n,i[3]+=n}function md(i,t,e){let n=!1;const s=Yr(i,t),r=Yr(i,e);if(s===pt.INTERSECTING||r===pt.INTERSECTING)n=!0;else{const o=i[0],a=i[1],l=i[2],h=i[3],c=t[0],u=t[1],d=e[0],f=e[1],g=(f-u)/(d-c);let _,m;r&pt.ABOVE&&!(s&pt.ABOVE)&&(_=d-(f-h)/g,n=_>=o&&_<=l),!n&&r&pt.RIGHT&&!(s&pt.RIGHT)&&(m=f-(d-l)*g,n=m>=a&&m<=h),!n&&r&pt.BELOW&&!(s&pt.BELOW)&&(_=d-(f-a)/g,n=_>=o&&_<=l),!n&&r&pt.LEFT&&!(s&pt.LEFT)&&(m=f-(d-o)*g,n=m>=a&&m<=h)}return n}function Tl(i,t){const e=t.getExtent(),n=ie(i);if(t.canWrapX()&&(n[0]<e[0]||n[0]>=e[2])){const s=K(e),o=Math.floor((n[0]-e[0])/s)*s;i[0]-=o,i[2]-=o}return i}function Sl(i,t,e){if(t.canWrapX()){const n=t.getExtent();if(!isFinite(i[0])||!isFinite(i[2]))return[[n[0],i[1],n[2],i[3]]];Tl(i,t);const s=K(n);if(K(i)>s&&!e)return[[n[0],i[1],n[2],i[3]]];if(i[0]<n[0])return[[i[0]+s,i[1],n[2],i[3]],[n[0],i[1],i[2],i[3]]];if(i[2]>n[2])return[[i[0],i[1],n[2],i[3]],[n[0],i[1],i[2]-s,i[3]]]}return[i]}function rt(i,t,e){return Math.min(Math.max(i,t),e)}function pd(i,t,e,n,s,r){const o=s-e,a=r-n;if(o!==0||a!==0){const l=((i-e)*o+(t-n)*a)/(o*o+a*a);l>1?(e=s,n=r):l>0&&(e+=o*l,n+=a*l)}return Ie(i,t,e,n)}function Ie(i,t,e,n){const s=e-i,r=n-t;return s*s+r*r}function yd(i){const t=i.length;for(let n=0;n<t;n++){let s=n,r=Math.abs(i[n][n]);for(let a=n+1;a<t;a++){const l=Math.abs(i[a][n]);l>r&&(r=l,s=a)}if(r===0)return null;const o=i[s];i[s]=i[n],i[n]=o;for(let a=n+1;a<t;a++){const l=-i[a][n]/i[n][n];for(let h=n;h<t+1;h++)n==h?i[a][h]=0:i[a][h]+=l*i[n][h]}}const e=new Array(t);for(let n=t-1;n>=0;n--){e[n]=i[n][t]/i[n][n];for(let s=n-1;s>=0;s--)i[s][t]-=i[s][n]*e[n]}return e}function Ss(i){return i*180/Math.PI}function ge(i){return i*Math.PI/180}function un(i,t){const e=i%t;return e*t<0?e+t:e}function Gt(i,t,e){return i+e*(t-i)}function Bn(i,t){const e=Math.pow(10,t);return Math.round(i*e)/e}function Il(i,t){return Math.round(Bn(i,t))}function Is(i,t){return Math.floor(Bn(i,t))}function We(i,t){return Math.ceil(Bn(i,t))}function $r(i,t,e){if(i>=t&&i<e)return i;const n=e-t;return((i-t)%n+n)%n+t}function Ll(i,t){const e=(""+i).split("."),n=(""+t).split(".");for(let s=0;s<Math.max(e.length,n.length);s++){const r=parseInt(e[s]||"0",10),o=parseInt(n[s]||"0",10);if(r>o)return 1;if(o>r)return-1}return 0}function Pl(i,t){return i[0]+=+t[0],i[1]+=+t[1],i}function Ls(i,t){let e=!0;for(let n=i.length-1;n>=0;--n)if(i[n]!=t[n]){e=!1;break}return e}function Zr(i,t){const e=Math.cos(t),n=Math.sin(t),s=i[0]*e-i[1]*n,r=i[1]*e+i[0]*n;return i[0]=s,i[1]=r,i}function bl(i,t){return i[0]*=t,i[1]*=t,i}function Ml(i,t){const e=i[0]-t[0],n=i[1]-t[1];return e*e+n*n}function Al(i,t){return Math.sqrt(Ml(i,t))}function Ol(i,t){if(t.canWrapX()){const e=K(t.getExtent()),n=xd(i,t,e);n&&(i[0]-=n*e)}return i}function xd(i,t,e){const n=t.getExtent();let s=0;return t.canWrapX()&&(i[0]<n[0]||i[0]>n[2])&&(e=e||K(n),s=Math.floor((i[0]-n[0])/e)),s}const dn=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"";dn.includes("safari")&&!dn.includes("chrom")&&(dn.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(dn));const Ed=dn.includes("webkit")&&!dn.includes("edge"),Dl=dn.includes("macintosh"),Cd=typeof devicePixelRatio<"u"?devicePixelRatio:1,Bt=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,Fl=typeof Image<"u"&&Image.prototype.decode,wd=typeof createImageBitmap=="function",kl=function(){let i=!1;try{const t=Object.defineProperty({},"passive",{get:function(){i=!0}});window.addEventListener("_",null,t),window.removeEventListener("_",null,t)}catch{}return i}();function ft(i,t,e,n){let s;return e&&e.length?s=e.shift():Bt?s=new class extends OffscreenCanvas{constructor(){super(...arguments);El(this,"style",{})}}(i??300,t??150):s=document.createElement("canvas"),i&&(s.width=i),t&&(s.height=t),s.getContext("2d",n)}let Hr;function Ps(){return Hr||(Hr=ft(1,1)),Hr}function bs(i){const t=i.canvas;t.width=1,t.height=1,i.clearRect(0,0,1,1)}function vd(i){let t=i.offsetWidth;const e=getComputedStyle(i);return t+=parseInt(e.marginLeft,10)+parseInt(e.marginRight,10),t}function Rd(i){let t=i.offsetHeight;const e=getComputedStyle(i);return t+=parseInt(e.marginTop,10)+parseInt(e.marginBottom,10),t}function Nl(i,t){const e=t.parentNode;e&&e.replaceChild(i,t)}function Gl(i){for(;i.lastChild;)i.lastChild.remove()}function Td(i,t){const e=i.childNodes;for(let n=0;;++n){const s=e[n],r=t[n];if(!s&&!r)break;if(s!==r){if(!s){i.appendChild(r);continue}if(!r){i.removeChild(s),--n;continue}i.insertBefore(r,s)}}}function zl(){return new Proxy({childNodes:[],appendChild:function(t){return this.childNodes.push(t),t},remove:function(){},removeChild:function(t){const e=this.childNodes.indexOf(t);if(e===-1)throw new Error("Node to remove was not found");return this.childNodes.splice(e,1),t},insertBefore:function(t,e){const n=this.childNodes.indexOf(e);if(n===-1)throw new Error("Reference node not found");return this.childNodes.splice(n,0,t),t},style:{}},{get(t,e,n){return e==="firstElementChild"?t.childNodes.length>0?t.childNodes[0]:null:Reflect.get(t,e,n)}})}function Ve(i){return typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas}const jl={info:1,warn:2,error:3,none:4};let Sd=jl.info;function Xl(...i){Sd>jl.warn||console.warn(...i)}const Mi={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class Id{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=t.extent!==void 0?t.extent:null,this.worldExtent_=t.worldExtent!==void 0?t.worldExtent:null,this.axisOrientation_=t.axisOrientation!==void 0?t.axisOrientation:"enu",this.global_=t.global!==void 0?t.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||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 qr=Id,Ai=6378137,Yn=Math.PI*Ai,Ld=[-Yn,-Yn,Yn,Yn],Pd=[-180,-85,180,85],Ms=Ai*Math.log(Math.tan(Math.PI/2));class Wn extends qr{constructor(t){super({code:t,units:"m",extent:Ld,global:!0,worldExtent:Pd,getPointResolution:function(e,n){return e/Math.cosh(n[1]/Ai)}})}}const Bl=[new Wn("EPSG:3857"),new Wn("EPSG:102100"),new Wn("EPSG:102113"),new Wn("EPSG:900913"),new Wn("http://www.opengis.net/def/crs/EPSG/0/3857"),new Wn("http://www.opengis.net/gml/srs/epsg.xml#3857")];function bd(i,t,e,n){const s=i.length;e=e>1?e:2,n=n??e,t===void 0&&(e>2?t=i.slice():t=new Array(s));for(let r=0;r<s;r+=n){t[r]=Yn*i[r]/180;let o=Ai*Math.log(Math.tan(Math.PI*(+i[r+1]+90)/360));o>Ms?o=Ms:o<-Ms&&(o=-Ms),t[r+1]=o}return t}function Md(i,t,e,n){const s=i.length;e=e>1?e:2,n=n??e,t===void 0&&(e>2?t=i.slice():t=new Array(s));for(let r=0;r<s;r+=n)t[r]=180*i[r]/Yn,t[r+1]=360*Math.atan(Math.exp(i[r+1]/Ai))/Math.PI-90;return t}const Ad=6378137,Yl=[-180,-90,180,90],Od=Math.PI*Ad/180;class fn extends qr{constructor(t,e){super({code:t,units:"degrees",extent:Yl,axisOrientation:e,global:!0,metersPerUnit:Od,worldExtent:Yl})}}const Wl=[new fn("CRS:84"),new fn("EPSG:4326","neu"),new fn("urn:ogc:def:crs:OGC:1.3:CRS84"),new fn("urn:ogc:def:crs:OGC:2:84"),new fn("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new fn("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new fn("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Jr={};function Dd(i){return Jr[i]||Jr[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function Fd(i,t){Jr[i]=t}function Oi(i){for(const t in i)delete i[t]}function gn(i){let t;for(t in i)return!1;return!t}let Vn={};function Di(i,t,e){const n=i.getCode(),s=t.getCode();n in Vn||(Vn[n]={}),Vn[n][s]=e}function Qr(i,t){return i in Vn&&t in Vn[i]?Vn[i][t]:null}const As=.9996,Yt=.00669438,Os=Yt*Yt,Ds=Os*Yt,_n=Yt/(1-Yt),Vl=Math.sqrt(1-Yt),Un=(1-Vl)/(1+Vl),Ul=Un*Un,to=Ul*Un,eo=to*Un,Kl=eo*Un,$l=1-Yt/4-3*Os/64-5*Ds/256,kd=3*Yt/8+3*Os/32+45*Ds/1024,Nd=15*Os/256+45*Ds/1024,Gd=35*Ds/3072,zd=3/2*Un-27/32*to+269/512*Kl,jd=21/16*Ul-55/32*eo,Xd=151/96*to-417/128*Kl,Bd=1097/512*eo,Fs=6378137;function Yd(i,t,e){const n=i-5e5,o=(e.north?t:t-1e7)/As/(Fs*$l),a=o+zd*Math.sin(2*o)+jd*Math.sin(4*o)+Xd*Math.sin(6*o)+Bd*Math.sin(8*o),l=Math.sin(a),h=l*l,c=Math.cos(a),u=l/c,d=u*u,f=d*d,g=1-Yt*h,_=Math.sqrt(1-Yt*h),m=Fs/_,p=(1-Yt)/g,y=_n*c**2,C=y*y,E=n/(m*As),w=E*E,T=w*E,v=T*E,R=v*E,I=R*E,b=a-u/p*(w/2-v/24*(5+3*d+10*y-4*C-9*_n))+I/720*(61+90*d+298*y+45*f-252*_n-3*C);let O=(E-T/6*(1+2*d+y)+R/120*(5-2*y+28*d-3*C+8*_n+24*f))/c;return O=$r(O+ge(ql(e.number)),-Math.PI,Math.PI),[Ss(O),Ss(b)]}const Zl=-80,Hl=84,Wd=-180,Vd=180;function Ud(i,t,e){i=$r(i,Wd,Vd),t<Zl?t=Zl:t>Hl&&(t=Hl);const n=ge(t),s=Math.sin(n),r=Math.cos(n),o=s/r,a=o*o,l=a*a,h=ge(i),c=ql(e.number),u=ge(c),d=Fs/Math.sqrt(1-Yt*s**2),f=_n*r**2,g=r*$r(h-u,-Math.PI,Math.PI),_=g*g,m=_*g,p=m*g,y=p*g,C=y*g,E=Fs*($l*n-kd*Math.sin(2*n)+Nd*Math.sin(4*n)-Gd*Math.sin(6*n)),w=As*d*(g+m/6*(1-a+f)+y/120*(5-18*a+l+72*f-58*_n))+5e5;let T=As*(E+d*o*(_/2+p/24*(5-a+9*f+4*f**2)+C/720*(61-58*a+l+600*f-330*_n)));return e.north||(T+=1e7),[w,T]}function ql(i){return(i-1)*6-180+3}const Kd=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function Jl(i){let t=0;for(const s of Kd){const r=i.match(s);if(r){t=parseInt(r[1]);break}}if(!t)return null;let e=0,n=!1;return t>32700&&t<32761?e=t-32700:t>32600&&t<32661&&(n=!0,e=t-32600),e?{number:e,north:n}:null}function Ql(i,t){return function(e,n,s,r){const o=e.length;s=s>1?s:2,r=r??s,n||(s>2?n=e.slice():n=new Array(o));for(let a=0;a<o;a+=r){const l=e[a],h=e[a+1],c=i(l,h,t);n[a]=c[0],n[a+1]=c[1]}return n}}function $d(i){return Jl(i)?new qr({code:i,units:"m"}):null}function Zd(i){const t=Jl(i.getCode());return t?{forward:Ql(Ud,t),inverse:Ql(Yd,t)}:null}const th=63710088e-1;function eh(i,t,e){e=e||th;const n=ge(i[1]),s=ge(t[1]),r=(s-n)/2,o=ge(t[0]-i[0])/2,a=Math.sin(r)*Math.sin(r)+Math.sin(o)*Math.sin(o)*Math.cos(n)*Math.cos(s);return 2*e*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}function Hd(i,t,e,n){n=n||th;const s=ge(i[1]),r=ge(i[0]),o=t/n,a=Math.asin(Math.sin(s)*Math.cos(o)+Math.cos(s)*Math.sin(o)*Math.cos(e)),l=r+Math.atan2(Math.sin(e)*Math.sin(o)*Math.cos(s),Math.cos(o)-Math.sin(s)*Math.sin(a));return[Ss(l),Ss(a)]}const qd=[Zd],Jd=[$d];let no=!0;function Qd(i){no=!(i===void 0?!0:i)}function io(i,t){if(t!==void 0){for(let e=0,n=i.length;e<n;++e)t[e]=i[e];t=t}else t=i.slice();return t}function so(i){Fd(i.getCode(),i),Di(i,i,io)}function tf(i){i.forEach(so)}function at(i){if(typeof i!="string")return i;const t=Dd(i);if(t)return t;for(const e of Jd){const n=e(i);if(n)return n}return null}function nh(i,t,e,n){i=at(i);let s;const r=i.getPointResolutionFunc();if(r){if(s=r(t,e),n&&n!==i.getUnits()){const o=i.getMetersPerUnit();o&&(s=s*o/Mi[n])}}else{const o=i.getUnits();if(o=="degrees"&&!n||n=="degrees")s=t;else{const a=ks(i,at("EPSG:4326"));if(!a&&o!=="degrees")s=t*i.getMetersPerUnit();else{let h=[e[0]-t/2,e[1],e[0]+t/2,e[1],e[0],e[1]-t/2,e[0],e[1]+t/2];h=a(h,h,2);const c=eh(h.slice(0,2),h.slice(2,4)),u=eh(h.slice(4,6),h.slice(6,8));s=(c+u)/2}const l=n?Mi[n]:i.getMetersPerUnit();l!==void 0&&(s/=l)}}return s}function ih(i){tf(i),i.forEach(function(t){i.forEach(function(e){t!==e&&Di(t,e,io)})})}function ef(i,t,e,n){i.forEach(function(s){t.forEach(function(r){Di(s,r,e),Di(r,s,n)})})}function ro(i,t){return i?typeof i=="string"?at(i):i:at(t)}function nf(i){return function(t,e,n,s){const r=t.length;n=n!==void 0?n:2,s=s??n,e=e!==void 0?e:new Array(r);for(let o=0;o<r;o+=s){const a=i(t.slice(o,o+n)),l=a.length;for(let h=0,c=s;h<c;++h)e[o+h]=h>=l?t[o+h]:a[h]}return e}}function mn(i,t){if(i===t)return!0;const e=i.getUnits()===t.getUnits();return(i.getCode()===t.getCode()||ks(i,t)===io)&&e}function ks(i,t){const e=i.getCode(),n=t.getCode();let s=Qr(e,n);if(s)return s;let r=null,o=null;for(const l of qd)r||(r=l(i)),o||(o=l(t));if(!r&&!o)return null;const a="EPSG:4326";if(o)if(r)s=oo(r.inverse,o.forward);else{const l=Qr(e,a);l&&(s=oo(l,o.forward))}else{const l=Qr(a,n);l&&(s=oo(r.inverse,l))}return s&&(so(i),so(t),Di(i,t,s)),s}function oo(i,t){return function(e,n,s,r){return n=i(e,n,s,r),t(n,n,s,r)}}function Fi(i,t){const e=at(i),n=at(t);return ks(e,n)}function ao(i,t,e){const n=Fi(t,e);if(!n){const s=at(t).getCode(),r=at(e).getCode();throw new Error(`No transform available between ${s} and ${r}`)}return n(i,void 0,i.length)}let sf=null;function rf(){return sf}function lo(i,t){return i}function Wt(i,t){return no&&!Ls(i,[0,0])&&i[0]>=-180&&i[0]<=180&&i[1]>=-90&&i[1]<=90&&(no=!1,Xl("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),i}function ho(i,t){return i}function _e(i,t){return i}function of(){ih(Bl),ih(Wl),ef(Wl,Bl,bd,Md)}of();const Vt={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"},M={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4},co=[NaN,NaN,NaN,0];let uo;function af(){return uo||(uo=ft(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),uo}const lf=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,hf=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,cf=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,uf=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function Ns(i,t){return i.endsWith("%")?Number(i.substring(0,i.length-1))/t:Number(i)}function ki(i){throw new Error('failed to parse "'+i+'" as color')}function sh(i){if(i.toLowerCase().startsWith("rgb")){const r=i.match(hf)||i.match(lf)||i.match(cf);if(r){const o=r[4],a=100/255;return[rt(Ns(r[1],a)+.5|0,0,255),rt(Ns(r[2],a)+.5|0,0,255),rt(Ns(r[3],a)+.5|0,0,255),o!==void 0?rt(Ns(o,100),0,1):1]}ki(i)}if(i.startsWith("#")){if(uf.test(i)){const r=i.substring(1),o=r.length<=4?1:2,a=[0,0,0,255];for(let l=0,h=r.length;l<h;l+=o){let c=parseInt(r.substring(l,l+o),16);o===1&&(c+=c<<4),a[l/o]=c}return a[3]=a[3]/255,a}ki(i)}const t=af();t.fillStyle="#abcdef";let e=t.fillStyle;t.fillStyle=i,t.fillStyle===e&&(t.fillStyle="#fedcba",e=t.fillStyle,t.fillStyle=i,t.fillStyle===e&&ki(i));const n=t.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return sh(n);t.clearRect(0,0,1,1),t.fillRect(0,0,1,1);const s=Array.from(t.getImageData(0,0,1,1).data);return s[3]=Bn(s[3]/255,3),s}function Ue(i){return typeof i=="string"?i:xo(i)}const df=1024,Ni={};let fo=0;function ff(i){if(i.length===4)return i;const t=i.slice();return t[3]=1,t}function go(i){return i>.0031308?Math.pow(i,.4166666666666667)*269.025-14.025:i*3294.6}function _o(i){return i>.2068965?Math.pow(i,3):(i-.13793103448275862)*.12841854934601665}function mo(i){return i>10.314724?Math.pow((i+14.025)/269.025,2.4):i/3294.6}function po(i){return i>.0088564?Math.pow(i,.3333333333333333):i/.12841854934601665+.13793103448275862}function rh(i){const t=mo(i[0]),e=mo(i[1]),n=mo(i[2]),s=po(t*.222488403+e*.716873169+n*.06060791),r=500*(po(t*.452247074+e*.399439023+n*.148375274)-s),o=200*(s-po(t*.016863605+e*.117638439+n*.865350722)),a=Math.atan2(o,r)*(180/Math.PI);return[116*s-16,Math.sqrt(r*r+o*o),a<0?a+360:a,i[3]]}function gf(i){const t=(i[0]+16)/116,e=i[1],n=i[2]*Math.PI/180,s=_o(t),r=_o(t+e/500*Math.cos(n)),o=_o(t-e/200*Math.sin(n)),a=go(r*3.021973625-s*1.617392459-o*.404875592),l=go(r*-.943766287+s*1.916279586+o*.027607165),h=go(r*.069407491-s*.22898585+o*1.159737864);return[rt(a+.5|0,0,255),rt(l+.5|0,0,255),rt(h+.5|0,0,255),i[3]]}function yo(i){if(i==="none")return co;if(Ni.hasOwnProperty(i))return Ni[i];if(fo>=df){let e=0;for(const n in Ni)e++&3||(delete Ni[n],--fo)}const t=sh(i);t.length!==4&&ki(i);for(const e of t)isNaN(e)&&ki(i);return Ni[i]=t,++fo,t}function Kn(i){return Array.isArray(i)?i:yo(i)}function xo(i){let t=i[0];t!=(t|0)&&(t=t+.5|0);let e=i[1];e!=(e|0)&&(e=e+.5|0);let n=i[2];n!=(n|0)&&(n=n+.5|0);const s=i[3]===void 0?1:Math.round(i[3]*1e3)/1e3;return"rgba("+t+","+e+","+n+","+s+")"}const z={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};class _f{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}const Gs=_f;function $n(){return!0}function Zn(){return!1}function Gi(){}function oh(i){let t,e,n;return function(){const s=Array.prototype.slice.call(arguments);return(!e||this!==n||!Be(s,e))&&(n=this,e=s,t=i.apply(this,arguments)),t}}function ah(i){function t(){let e;try{e=i()}catch(n){return Promise.reject(n)}return e instanceof Promise?e:Promise.resolve(e)}return t()}class mf{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}const se=mf;class pf extends Gs{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const n=this.listeners_||(this.listeners_={}),s=n[t]||(n[t]=[]);s.includes(e)||s.push(e)}dispatchEvent(t){const e=typeof t=="string",n=e?t:t.type,s=this.listeners_&&this.listeners_[n];if(!s)return;const r=e?new se(t):t;r.target||(r.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});n in o||(o[n]=0,a[n]=0),++o[n];let l;for(let h=0,c=s.length;h<c;++h)if("handleEvent"in s[h]?l=s[h].handleEvent(r):l=s[h].call(this,r),l===!1||r.propagationStopped){l=!1;break}if(--o[n]===0){let h=a[n];for(delete a[n];h--;)this.removeEventListener(n,Gi);delete o[n]}return l}disposeInternal(){this.listeners_&&Oi(this.listeners_)}getListeners(t){return this.listeners_&&this.listeners_[t]||void 0}hasListener(t){return this.listeners_?t?t in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(t,e){if(!this.listeners_)return;const n=this.listeners_[t];if(!n)return;const s=n.indexOf(e);s!==-1&&(this.pendingRemovals_&&t in this.pendingRemovals_?(n[s]=Gi,++this.pendingRemovals_[t]):(n.splice(s,1),n.length===0&&delete this.listeners_[t]))}}const zi=pf;function $(i,t,e,n,s){if(s){const o=e;e=function(a){return i.removeEventListener(t,e),o.call(n??this,a)}}else n&&n!==i&&(e=e.bind(n));const r={target:i,type:t,listener:e};return i.addEventListener(t,e),r}function zs(i,t,e,n){return $(i,t,e,n,!0)}function it(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),Oi(i))}class Eo extends zi{constructor(t,e,n,s){super(),this.extent=t,this.pixelRatio_=n,this.resolution=e,this.state=typeof s=="function"?M.IDLE:s,this.image_=null,this.loader=typeof s=="function"?s:null}changed(){this.dispatchEvent(z.CHANGE)}getExtent(){return this.extent}getImage(){return this.image_}getPixelRatio(){return this.pixelRatio_}getResolution(){return this.resolution}getState(){return this.state}load(){if(this.state==M.IDLE&&this.loader){this.state=M.LOADING,this.changed();const t=this.getResolution(),e=Array.isArray(t)?t[0]:t;ah(()=>this.loader(this.getExtent(),e,this.getPixelRatio())).then(n=>{"image"in n&&(this.image_=n.image),"extent"in n&&(this.extent=n.extent),"resolution"in n&&(this.resolution=n.resolution),"pixelRatio"in n&&(this.pixelRatio_=n.pixelRatio),(n instanceof HTMLImageElement||wd&&n instanceof ImageBitmap||n instanceof HTMLCanvasElement||n instanceof HTMLVideoElement)&&(this.image_=n),this.state=M.LOADED}).catch(n=>{this.state=M.ERROR,console.error(n)}).finally(()=>this.changed())}}setImage(t){this.image_=t}setResolution(t){this.resolution=t}}function yf(i,t,e){const n=i;let s=!0,r=!1,o=!1;const a=[zs(n,z.LOAD,function(){o=!0,r||t()})];return n.src&&Fl?(r=!0,n.decode().then(function(){s&&t()}).catch(function(l){s&&(o?t():e())})):a.push(zs(n,z.ERROR,e)),function(){s=!1,a.forEach(it)}}function xf(i,t){return new Promise((e,n)=>{function s(){o(),e(i)}function r(){o(),n(new Error("Image load error"))}function o(){i.removeEventListener("load",s),i.removeEventListener("error",r)}i.addEventListener("load",s),i.addEventListener("error",r),t&&(i.src=t)})}function Ef(i,t){return t&&(i.src=t),i.src&&Fl?new Promise((e,n)=>i.decode().then(()=>e(i)).catch(s=>i.complete&&i.width?e(i):n(s))):xf(i)}class Cf{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 n=this.cache_[e];!(t++&3)&&!n.hasListener()&&(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e,n){const s=Co(t,e,n);return s in this.cache_?this.cache_[s]:null}getPattern(t,e,n){const s=Co(t,e,n);return s in this.patternCache_?this.patternCache_[s]:null}set(t,e,n,s,r){const o=Co(t,e,n),a=o in this.cache_;this.cache_[o]=s,r&&(s.getImageState()===M.IDLE&&s.load(),s.getImageState()===M.LOADING?s.ready().then(()=>{this.patternCache_[o]=Ps().createPattern(s.getImage(1),"repeat")}):this.patternCache_[o]=Ps().createPattern(s.getImage(1),"repeat")),a||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function Co(i,t,e){const n=e?Kn(e):"null";return t+":"+i+":"+n}const Ut=new Cf;let ji=null;class lh extends zi{constructor(t,e,n,s,r){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=n,this.canvas_={},this.color_=r,this.imageState_=s===void 0?M.IDLE:s,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,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===M.LOADED){ji||(ji=ft(1,1,void 0,{willReadFrequently:!0})),ji.drawImage(this.image_,0,0);try{ji.getImageData(0,0,1,1),this.tainted_=!1}catch{ji=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(z.CHANGE)}handleImageError_(){this.imageState_=M.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=M.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],n=ft(t,e);n.fillRect(0,0,t,e),this.hitDetectionImage_=n.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===M.IDLE){this.image_||this.initializeImage_(),this.imageState_=M.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&Ef(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_!==M.LOADED)return;const e=this.image_,n=ft(Math.ceil(e.width*t),Math.ceil(e.height*t)),s=n.canvas;n.scale(t,t),n.drawImage(e,0,0),n.globalCompositeOperation="multiply",n.fillStyle=Ue(this.color_),n.fillRect(0,0,s.width/t,s.height/t),n.globalCompositeOperation="destination-in",n.drawImage(e,0,0),this.canvas_[t]=s}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(this.imageState_===M.LOADED||this.imageState_===M.ERROR)t();else{const e=()=>{(this.imageState_===M.LOADED||this.imageState_===M.ERROR)&&(this.removeEventListener(z.CHANGE,e),t())};this.addEventListener(z.CHANGE,e)}})),this.ready_}}function js(i,t,e,n,s,r){let o=t===void 0?void 0:Ut.get(t,e,s);return o||(o=new lh(i,i&&"src"in i?i.src||void 0:t,e,n,s),Ut.set(t,e,s,o,r)),r&&o&&!Ut.getPattern(t,e,s)&&Ut.set(t,e,s,o,r),o}function me(i){return i?Array.isArray(i)?xo(i):typeof i=="object"&&"src"in i?wf(i):i:null}function wf(i){if(!i.offset||!i.size)return Ut.getPattern(i.src,"anonymous",i.color);const t=i.src+":"+i.offset,e=Ut.getPattern(t,void 0,i.color);if(e)return e;const n=Ut.get(i.src,"anonymous",null);if(n.getImageState()!==M.LOADED)return null;const s=ft(i.size[0],i.size[1]);return s.drawImage(n.getImage(1),i.offset[0],i.offset[1],i.size[0],i.size[1],0,0,i.size[0],i.size[1]),js(s.canvas,t,void 0,M.LOADED,i.color,!0),Ut.getPattern(t,void 0,i.color)}function Ke(i,t,e,n,s){s=s!==void 0?s:[];let r=0;for(let o=t;o<e;o+=n)s[r++]=i.slice(o,o+n);return s.length=r,s}function Xi(i,t,e,n,s){s=s!==void 0?s:[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];s[r++]=Ke(i,t,l,n,s[r]),t=l}return s.length=r,s}function wo(i,t,e,n,s){s=s!==void 0?s:[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];s[r++]=l.length===1&&l[0]===t?[]:Xi(i,t,l,n,s[r]),t=l[l.length-1]}return s.length=r,s}class vf{drawCustom(t,e,n,s,r){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,n){}drawFeature(t,e,n){}drawGeometryCollection(t,e,n){}drawLineString(t,e,n){}drawMultiLineString(t,e,n){}drawMultiPoint(t,e,n){}drawMultiPolygon(t,e,n){}drawPoint(t,e,n){}drawPolygon(t,e,n){}drawText(t,e,n){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}}const hh=vf,Hn={PROPERTYCHANGE:"propertychange"};class Bi extends zi{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(z.CHANGE)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const n=t.length,s=new Array(n);for(let r=0;r<n;++r)s[r]=$(this,t[r],e);return s}return $(this,t,e)}onceInternal(t,e){let n;if(Array.isArray(t)){const s=t.length;n=new Array(s);for(let r=0;r<s;++r)n[r]=zs(this,t[r],e)}else n=zs(this,t,e);return e.ol_key=n,n}unInternal(t,e){const n=e.ol_key;if(n)ch(n);else if(Array.isArray(t))for(let s=0,r=t.length;s<r;++s)this.removeEventListener(t[s],e);else this.removeEventListener(t,e)}}Bi.prototype.on,Bi.prototype.once,Bi.prototype.un;function ch(i){if(Array.isArray(i))for(let t=0,e=i.length;t<e;++t)it(i[t]);else it(i)}function j(){throw new Error("Unimplemented abstract method.")}let Rf=0;function q(i){return i.ol_uid||(i.ol_uid=String(++Rf))}class uh extends se{constructor(t,e,n){super(t),this.key=e,this.oldValue=n}}class Tf extends Bi{constructor(t){super(),this.on,this.once,this.un,q(this),this.values_=null,t!==void 0&&this.setProperties(t)}get(t){let e;return this.values_&&this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,e){let n;n=`change:${t}`,this.hasListener(n)&&this.dispatchEvent(new uh(n,t,e)),n=Hn.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new uh(n,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,n){const s=this.values_||(this.values_={});if(n)s[t]=e;else{const r=s[t];s[t]=e,r!==e&&this.notify(t,r)}}setProperties(t,e){for(const n in t)this.set(n,t[n],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const n=this.values_[t];delete this.values_[t],gn(this.values_)&&(this.values_=null),e||this.notify(t,n)}}}const Kt=Tf,Xs="ol-hidden",Sf="ol-selectable",Bs="ol-unselectable",vo="ol-control",dh="ol-collapsed",If=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z0-9]+?)\\s*$`].join(""),"i"),fh=["style","variant","weight","size","lineHeight","family"],Ro={normal:400,bold:700},To=function(i){const t=i.match(If);if(!t)return null;const e={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let n=0,s=fh.length;n<s;++n){const r=t[n+1];r!==void 0&&(e[fh[n]]=typeof r=="string"?r.trim():r)}return isNaN(Number(e.weight))&&e.weight in Ro&&(e.weight=Ro[e.weight]),e.families=e.family.split(/,\s?/).map(n=>n.trim().replace(/^['"]|['"]$/g,"")),e},gh="10px sans-serif",At="#000",qn="round",Le=[],Pe=0,Jn="round",Yi=10,Wi="#000",Vi="center",Ys="middle",pn=[0,0,0,0],Ui=1,Qn=new Kt;let Ki=null,_h;const So={},Lf=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function Pf(i,t,e){return`${i} ${t} 16px "${e}"`}const bf=function(){let t,e;async function n(r){await e.ready;const o=await e.load(r);if(o.length===0)return!1;const a=To(r),l=a.families[0].toLowerCase(),h=a.weight;return o.some(c=>{const u=c.family.replace(/^['"]|['"]$/g,"").toLowerCase(),d=Ro[c.weight]||c.weight;return u===l&&c.style===a.style&&d==h})}async function s(){await e.ready;let r=!0;const o=Qn.getProperties(),a=Object.keys(o).filter(l=>o[l]<100);for(let l=a.length-1;l>=0;--l){const h=a[l];let c=o[h];c<100&&(await n(h)?(Oi(So),Qn.set(h,100)):(c+=10,Qn.set(h,c,!0),c<100&&(r=!1)))}t=void 0,r||(t=setTimeout(s,100))}return async function(r){e||(e=Bt?self.fonts:document.fonts);const o=To(r);if(!o)return;const a=o.families;let l=!1;for(const h of a){if(Lf.has(h))continue;const c=Pf(o.style,o.weight,h);Qn.get(c)===void 0&&(Qn.set(c,0,!0),l=!0)}l&&(clearTimeout(t),t=setTimeout(s,100))}}(),Mf=function(){let i;return function(t){let e=So[t];if(e==null){if(Bt){const n=To(t),s=mh(t,"Žg");e=(isNaN(Number(n.lineHeight))?1.2:Number(n.lineHeight))*(s.actualBoundingBoxAscent+s.actualBoundingBoxDescent)}else i||(i=document.createElement("div"),i.innerHTML="M",i.style.minHeight="0",i.style.maxHeight="none",i.style.height="auto",i.style.padding="0",i.style.border="none",i.style.position="absolute",i.style.display="block",i.style.left="-99999px"),i.style.font=t,document.body.appendChild(i),e=i.offsetHeight,document.body.removeChild(i);So[t]=e}return e}}();function mh(i,t){return Ki||(Ki=ft(1,1)),i!=_h&&(Ki.font=i,_h=Ki.font),Ki.measureText(t)}function ph(i,t){return mh(i,t).width}function yh(i,t,e){if(t in e)return e[t];const n=t.split(`
2
- `).reduce((s,r)=>Math.max(s,ph(i,r)),0);return e[t]=n,n}function Af(i,t){const e=[],n=[],s=[];let r=0,o=0,a=0,l=0;for(let h=0,c=t.length;h<=c;h+=2){const u=t[h];if(u===`
3
- `||h===c){r=Math.max(r,o),s.push(o),o=0,a+=l,l=0;continue}const d=t[h+1]||i.font,f=ph(d,u);e.push(f),o+=f;const g=Mf(d);n.push(g),l=Math.max(l,g)}return{width:r,height:a,widths:e,heights:n,lineWidths:s}}function Of(i,t,e,n,s,r,o,a,l,h,c){i.save(),e!==1&&(i.globalAlpha===void 0?i.globalAlpha=u=>u.globalAlpha*=e:i.globalAlpha*=e),t&&i.transform.apply(i,t),n.contextInstructions?(i.translate(l,h),i.scale(c[0],c[1]),Df(n,i)):c[0]<0||c[1]<0?(i.translate(l,h),i.scale(c[0],c[1]),i.drawImage(n,s,r,o,a,0,0,o,a)):i.drawImage(n,s,r,o,a,l,h,o*c[0],a*c[1]),i.restore()}function Df(i,t){const e=i.contextInstructions;for(let n=0,s=e.length;n<s;n+=2)Array.isArray(e[n+1])?t[e[n]].apply(t,e[n+1]):t[e[n]]=e[n+1]}const $i={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},Ws=[$i.FILL],$e=[$i.STROKE],yn=[$i.BEGIN_PATH],xh=[$i.CLOSE_PATH],G=$i;class Ff extends hh{constructor(t,e,n,s){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=s,this.maxLineWidth=0,this.resolution=n,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 e==1?t:t.map(function(n){return n*e})}appendFlatPointCoordinates(t,e){const n=this.getBufferedMaxExtent(),s=this.tmpCoordinate_,r=this.coordinates;let o=r.length;for(let a=0,l=t.length;a<l;a+=e)s[0]=t[a],s[1]=t[a+1],cn(n,s)&&(r[o++]=s[0],r[o++]=s[1]);return o}appendFlatLineCoordinates(t,e,n,s,r,o){const a=this.coordinates;let l=a.length;const h=this.getBufferedMaxExtent();o&&(e+=s);let c=t[e],u=t[e+1];const d=this.tmpCoordinate_;let f=!0,g,_,m;for(g=e+s;g<n;g+=s)d[0]=t[g],d[1]=t[g+1],m=Yr(h,d),m!==_?(f&&(a[l++]=c,a[l++]=u,f=!1),a[l++]=d[0],a[l++]=d[1]):m===pt.INTERSECTING?(a[l++]=d[0],a[l++]=d[1],f=!1):f=!0,c=d[0],u=d[1],_=m;return(r&&f||g===e+s)&&(a[l++]=c,a[l++]=u),l}drawCustomCoordinates_(t,e,n,s,r){for(let o=0,a=n.length;o<a;++o){const l=n[o],h=this.appendFlatLineCoordinates(t,e,l,s,!1,!1);r.push(h),e=l}return e}drawCustom(t,e,n,s,r){this.beginGeometry(t,e,r);const o=t.getType(),a=t.getStride(),l=this.coordinates.length;let h,c,u,d,f;switch(o){case"MultiPolygon":h=t.getOrientedFlatCoordinates(),d=[];const g=t.getEndss();f=0;for(let _=0,m=g.length;_<m;++_){const p=[];f=this.drawCustomCoordinates_(h,f,g[_],a,p),d.push(p)}this.instructions.push([G.CUSTOM,l,d,t,n,wo,r]),this.hitDetectionInstructions.push([G.CUSTOM,l,d,t,s||n,wo,r]);break;case"Polygon":case"MultiLineString":u=[],h=o=="Polygon"?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),f=this.drawCustomCoordinates_(h,0,t.getEnds(),a,u),this.instructions.push([G.CUSTOM,l,u,t,n,Xi,r]),this.hitDetectionInstructions.push([G.CUSTOM,l,u,t,s||n,Xi,r]);break;case"LineString":case"Circle":h=t.getFlatCoordinates(),c=this.appendFlatLineCoordinates(h,0,h.length,a,!1,!1),this.instructions.push([G.CUSTOM,l,c,t,n,Ke,r]),this.hitDetectionInstructions.push([G.CUSTOM,l,c,t,s||n,Ke,r]);break;case"MultiPoint":h=t.getFlatCoordinates(),c=this.appendFlatPointCoordinates(h,a),c>l&&(this.instructions.push([G.CUSTOM,l,c,t,n,Ke,r]),this.hitDetectionInstructions.push([G.CUSTOM,l,c,t,s||n,Ke,r]));break;case"Point":h=t.getFlatCoordinates(),this.coordinates.push(h[0],h[1]),c=this.coordinates.length,this.instructions.push([G.CUSTOM,l,c,t,n,void 0,r]),this.hitDetectionInstructions.push([G.CUSTOM,l,c,t,s||n,void 0,r]);break}this.endGeometry(e)}beginGeometry(t,e,n){this.beginGeometryInstruction1_=[G.BEGIN_GEOMETRY,e,0,t,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[G.BEGIN_GEOMETRY,e,0,t,n],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;t.reverse();let e;const n=t.length;let s,r,o=-1;for(e=0;e<n;++e)s=t[e],r=s[0],r==G.END_GEOMETRY?o=e:r==G.BEGIN_GEOMETRY&&(s[2]=e,cd(this.hitDetectionInstructions,o,e),o=-1)}fillStyleToState(t,e={}){if(t){const n=t.getColor();e.fillPatternScale=n&&typeof n=="object"&&"src"in n?this.pixelRatio:1,e.fillStyle=me(n||At)}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){const n=t.getColor();e.strokeStyle=me(n||Wi);const s=t.getLineCap();e.lineCap=s!==void 0?s:qn;const r=t.getLineDash();e.lineDash=r?r.slice():Le;const o=t.getLineDashOffset();e.lineDashOffset=o||Pe;const a=t.getLineJoin();e.lineJoin=a!==void 0?a:Jn;const l=t.getWidth();e.lineWidth=l!==void 0?l:Ui;const h=t.getMiterLimit();e.miterLimit=h!==void 0?h:Yi,e.lineWidth>this.maxLineWidth&&(this.maxLineWidth=e.lineWidth,this.bufferedMaxExtent_=null)}else e.strokeStyle=void 0,e.lineCap=void 0,e.lineDash=null,e.lineDashOffset=void 0,e.lineJoin=void 0,e.lineWidth=void 0,e.miterLimit=void 0;return e}setFillStrokeStyle(t,e){const n=this.state;this.fillStyleToState(t,n),this.strokeStyleToState(e,n)}createFill(t){const e=t.fillStyle,n=[G.SET_FILL_STYLE,e];return typeof e!="string"&&n.push(t.fillPatternScale),n}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[G.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,t.lineDash?this.applyPixelRatio(t.lineDash):null,t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const n=t.fillStyle;(typeof n!="string"||t.currentFillStyle!=n)&&(this.instructions.push(e.call(this,t)),t.currentFillStyle=n)}updateStrokeStyle(t,e){const n=t.strokeStyle,s=t.lineCap,r=t.lineDash,o=t.lineDashOffset,a=t.lineJoin,l=t.lineWidth,h=t.miterLimit;(t.currentStrokeStyle!=n||t.currentLineCap!=s||r!=t.currentLineDash&&!Be(t.currentLineDash,r)||t.currentLineDashOffset!=o||t.currentLineJoin!=a||t.currentLineWidth!=l||t.currentMiterLimit!=h)&&(e.call(this,t),t.currentStrokeStyle=n,t.currentLineCap=s,t.currentLineDash=r,t.currentLineDashOffset=o,t.currentLineJoin=a,t.currentLineWidth=l,t.currentMiterLimit=h)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[G.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Cl(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;Gn(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}const Zi=Ff;class kf extends Zi{constructor(t,e,n,s){super(t,e,n,s),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e,n){if(!this.image_||this.maxExtent&&!cn(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,n);const s=t.getFlatCoordinates(),r=t.getStride(),o=this.coordinates.length,a=this.appendFlatPointCoordinates(s,r);this.instructions.push([G.DRAW_IMAGE,o,a,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([G.DRAW_IMAGE,o,a,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,n){if(!this.image_)return;this.beginGeometry(t,e,n);const s=t.getFlatCoordinates(),r=[];for(let l=0,h=s.length;l<h;l+=t.getStride())(!this.maxExtent||cn(this.maxExtent,s.slice(l,l+2)))&&r.push(s[l],s[l+1]);const o=this.coordinates.length,a=this.appendFlatPointCoordinates(r,2);this.instructions.push([G.DRAW_IMAGE,o,a,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([G.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,e){const n=t.getAnchor(),s=t.getSize(),r=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=n[0],this.anchorY_=n[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=s[1],this.opacity_=t.getOpacity(),this.originX_=r[0],this.originY_=r[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=s[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}const Nf=kf;class Gf extends Zi{constructor(t,e,n,s){super(t,e,n,s)}drawFlatCoordinates_(t,e,n,s){const r=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,n,s,!1,!1),a=[G.MOVE_TO_LINE_TO,r,o];return this.instructions.push(a),this.hitDetectionInstructions.push(a),n}drawLineString(t,e,n){const s=this.state,r=s.strokeStyle,o=s.lineWidth;if(r===void 0||o===void 0)return;this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(t,e,n),this.hitDetectionInstructions.push([G.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Le,Pe],yn);const a=t.getFlatCoordinates(),l=t.getStride();this.drawFlatCoordinates_(a,0,a.length,l),this.hitDetectionInstructions.push($e),this.endGeometry(e)}drawMultiLineString(t,e,n){const s=this.state,r=s.strokeStyle,o=s.lineWidth;if(r===void 0||o===void 0)return;this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(t,e,n),this.hitDetectionInstructions.push([G.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Le,Pe],yn);const a=t.getEnds(),l=t.getFlatCoordinates(),h=t.getStride();let c=0;for(let u=0,d=a.length;u<d;++u)c=this.drawFlatCoordinates_(l,c,a[u],h);this.hitDetectionInstructions.push($e),this.endGeometry(e)}finish(){const t=this.state;return t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&this.instructions.push($e),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&(this.instructions.push($e),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(yn)}}const zf=Gf;function Vs(i,t,e,n,s,r,o){const a=(e-t)/n;if(a<3){for(;t<e;t+=n)r[o++]=i[t],r[o++]=i[t+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const h=[t,e-n];let c=0;for(;h.length>0;){const u=h.pop(),d=h.pop();let f=0;const g=i[d],_=i[d+1],m=i[u],p=i[u+1];for(let y=d+n;y<u;y+=n){const C=i[y],E=i[y+1],w=pd(C,E,g,_,m,p);w>f&&(c=y,f=w)}f>s&&(l[(c-t)/n]=1,d+n<c&&h.push(d,c),c+n<u&&h.push(c,u))}for(let u=0;u<a;++u)l[u]&&(r[o++]=i[t+u*n],r[o++]=i[t+u*n+1]);return o}function Eh(i,t,e,n,s,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l];o=Vs(i,t,c,n,s,r,o),a.push(o),t=c}return o}function xn(i,t){return t*Math.round(i/t)}function jf(i,t,e,n,s,r,o){if(t==e)return o;let a=xn(i[t],s),l=xn(i[t+1],s);t+=n,r[o++]=a,r[o++]=l;let h,c;do if(h=xn(i[t],s),c=xn(i[t+1],s),t+=n,t==e)return r[o++]=h,r[o++]=c,o;while(h==a&&c==l);for(;t<e;){const u=xn(i[t],s),d=xn(i[t+1],s);if(t+=n,u==h&&d==c)continue;const f=h-a,g=c-l,_=u-a,m=d-l;if(f*m==g*_&&(f<0&&_<f||f==_||f>0&&_>f)&&(g<0&&m<g||g==m||g>0&&m>g)){h=u,c=d;continue}r[o++]=h,r[o++]=c,a=h,l=c,h=u,c=d}return r[o++]=h,r[o++]=c,o}function Io(i,t,e,n,s,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l];o=jf(i,t,c,n,s,r,o),a.push(o),t=c}return o}function Xf(i,t,e,n,s,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l],u=[];o=Io(i,t,c,n,s,r,o,u),a.push(u),t=c[c.length-1]}return o}class Bf extends Zi{constructor(t,e,n,s){super(t,e,n,s)}drawFlatCoordinatess_(t,e,n,s){const r=this.state,o=r.fillStyle!==void 0,a=r.strokeStyle!==void 0,l=n.length;this.instructions.push(yn),this.hitDetectionInstructions.push(yn);for(let h=0;h<l;++h){const c=n[h],u=this.coordinates.length,d=this.appendFlatLineCoordinates(t,e,c,s,!0,!a),f=[G.MOVE_TO_LINE_TO,u,d];this.instructions.push(f),this.hitDetectionInstructions.push(f),a&&(this.instructions.push(xh),this.hitDetectionInstructions.push(xh)),e=c}return o&&(this.instructions.push(Ws),this.hitDetectionInstructions.push(Ws)),a&&(this.instructions.push($e),this.hitDetectionInstructions.push($e)),e}drawCircle(t,e,n){const s=this.state,r=s.fillStyle,o=s.strokeStyle;if(r===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,n),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([G.SET_FILL_STYLE,At]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([G.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Le,Pe]);const a=t.getFlatCoordinates(),l=t.getStride(),h=this.coordinates.length;this.appendFlatLineCoordinates(a,0,a.length,l,!1,!1);const c=[G.CIRCLE,h];this.instructions.push(yn,c),this.hitDetectionInstructions.push(yn,c),s.fillStyle!==void 0&&(this.instructions.push(Ws),this.hitDetectionInstructions.push(Ws)),s.strokeStyle!==void 0&&(this.instructions.push($e),this.hitDetectionInstructions.push($e)),this.endGeometry(e)}drawPolygon(t,e,n){const s=this.state,r=s.fillStyle,o=s.strokeStyle;if(r===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,n),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([G.SET_FILL_STYLE,At]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([G.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Le,Pe]);const a=t.getEnds(),l=t.getOrientedFlatCoordinates(),h=t.getStride();this.drawFlatCoordinatess_(l,0,a,h),this.endGeometry(e)}drawMultiPolygon(t,e,n){const s=this.state,r=s.fillStyle,o=s.strokeStyle;if(r===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,n),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([G.SET_FILL_STYLE,At]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([G.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Le,Pe]);const a=t.getEndss(),l=t.getOrientedFlatCoordinates(),h=t.getStride();let c=0;for(let u=0,d=a.length;u<d;++u)c=this.drawFlatCoordinatess_(l,c,a[u],h);this.endGeometry(e)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const t=this.tolerance;if(t!==0){const e=this.coordinates;for(let n=0,s=e.length;n<s;++n)e[n]=xn(e[n],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;this.updateFillStyle(t,this.createFill),this.updateStrokeStyle(t,this.applyStroke)}}const Ch=Bf;function Yf(i,t,e,n,s){const r=[];let o=e,a=0,l=t.slice(e,2);for(;a<i&&o+s<n;){const[h,c]=l.slice(-2),u=t[o+s],d=t[o+s+1],f=Math.sqrt((u-h)*(u-h)+(d-c)*(d-c));if(a+=f,a>=i){const g=(i-a+f)/f,_=Gt(h,u,g),m=Gt(c,d,g);l.push(_,m),r.push(l),l=[_,m],a==i&&(o+=s),a=0}else if(a<i)l.push(t[o+s],t[o+s+1]),o+=s;else{const g=f-a,_=Gt(h,u,g/f),m=Gt(c,d,g/f);l.push(_,m),r.push(l),l=[_,m],a=0,o+=s}}return a>0&&r.push(l),r}function Wf(i,t,e,n,s){let r=e,o=e,a=0,l=0,h=e,c,u,d,f,g,_,m,p,y,C;for(u=e;u<n;u+=s){const E=t[u],w=t[u+1];g!==void 0&&(y=E-g,C=w-_,f=Math.sqrt(y*y+C*C),m!==void 0&&(l+=d,c=Math.acos((m*y+p*C)/(d*f)),c>i&&(l>a&&(a=l,r=h,o=u),l=0,h=u-s)),d=f,m=y,p=C),g=E,_=w}return l+=f,l>a?[h,u]:[r,o]}const Us={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class Vf extends Zi{constructor(t,e,n,s){super(t,e,n,s),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[At]={fillStyle:At},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e,n){const s=this.textFillState_,r=this.textStrokeState_,o=this.textState_;if(this.text_===""||!o||!s&&!r)return;const a=this.coordinates;let l=a.length;const h=t.getType();let c=null,u=t.getStride();if(o.placement==="line"&&(h=="LineString"||h=="MultiLineString"||h=="Polygon"||h=="MultiPolygon")){if(!Ct(this.maxExtent,t.getExtent()))return;let d;if(c=t.getFlatCoordinates(),h=="LineString")d=[c.length];else if(h=="MultiLineString")d=t.getEnds();else if(h=="Polygon")d=t.getEnds().slice(0,1);else if(h=="MultiPolygon"){const m=t.getEndss();d=[];for(let p=0,y=m.length;p<y;++p)d.push(m[p][0])}this.beginGeometry(t,e,n);const f=o.repeat,g=f?void 0:o.textAlign;let _=0;for(let m=0,p=d.length;m<p;++m){let y;f?y=Yf(f*this.resolution,c,_,d[m],u):y=[c.slice(_,d[m])];for(let C=0,E=y.length;C<E;++C){const w=y[C];let T=0,v=w.length;if(g==null){const I=Wf(o.maxAngle,w,0,w.length,2);T=I[0],v=I[1]}for(let I=T;I<v;I+=u)a.push(w[I],w[I+1]);const R=a.length;_=d[m],this.drawChars_(l,R),l=R}}this.endGeometry(e)}else{let d=o.overflow?null:[];switch(h){case"Point":case"MultiPoint":c=t.getFlatCoordinates();break;case"LineString":c=t.getFlatMidpoint();break;case"Circle":c=t.getCenter();break;case"MultiLineString":c=t.getFlatMidpoints(),u=2;break;case"Polygon":c=t.getFlatInteriorPoint(),o.overflow||d.push(c[2]/this.resolution),u=3;break;case"MultiPolygon":const E=t.getFlatInteriorPoints();c=[];for(let w=0,T=E.length;w<T;w+=3)o.overflow||d.push(E[w+2]/this.resolution),c.push(E[w],E[w+1]);if(c.length===0)return;u=2;break}const f=this.appendFlatPointCoordinates(c,u);if(f===l)return;if(d&&(f-l)/2!==c.length/u){let E=l/2;d=d.filter((w,T)=>{const v=a[(E+T)*2]===c[T*u]&&a[(E+T)*2+1]===c[T*u+1];return v||--E,v})}this.saveTextStates_();const g=o.backgroundFill?this.createFill(this.fillStyleToState(o.backgroundFill)):null,_=o.backgroundStroke?this.createStroke(this.strokeStyleToState(o.backgroundStroke)):null;this.beginGeometry(t,e,n);let m=o.padding;if(m!=pn&&(o.scale[0]<0||o.scale[1]<0)){let E=o.padding[0],w=o.padding[1],T=o.padding[2],v=o.padding[3];o.scale[0]<0&&(w=-w,v=-v),o.scale[1]<0&&(E=-E,T=-T),m=[E,w,T,v]}const p=this.pixelRatio;this.instructions.push([G.DRAW_IMAGE,l,f,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,m==pn?pn:m.map(function(E){return E*p}),g,_,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]);const y=1/p,C=g?g.slice(0):null;C&&(C[1]=At),this.hitDetectionInstructions.push([G.DRAW_IMAGE,l,f,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[y,y],NaN,this.declutterMode_,this.declutterImageWithText_,m,C,_,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?At:this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]),this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,n=this.textFillState_,s=this.strokeKey_;t&&(s in this.strokeStates||(this.strokeStates[s]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const r=this.textKey_;r in this.textStates||(this.textStates[r]={font:e.font,textAlign:e.textAlign||Vi,justify:e.justify,textBaseline:e.textBaseline||Ys,scale:e.scale});const o=this.fillKey_;n&&(o in this.fillStates||(this.fillStates[o]={fillStyle:n.fillStyle}))}drawChars_(t,e){const n=this.textStrokeState_,s=this.textState_,r=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();const l=this.pixelRatio,h=Us[s.textBaseline],c=this.textOffsetY_*l,u=this.text_,d=n?n.lineWidth*Math.abs(s.scale[0])/2:0;this.instructions.push([G.DRAW_CHARS,t,e,h,s.overflow,a,s.maxAngle,l,c,r,d*l,u,o,1,this.declutterMode_,this.textKeepUpright_]),this.hitDetectionInstructions.push([G.DRAW_CHARS,t,e,h,s.overflow,a&&At,s.maxAngle,l,c,r,d*l,u,o,1/l,this.declutterMode_,this.textKeepUpright_])}setTextStyle(t,e){let n,s,r;if(!t)this.text_="";else{const o=t.getFill();o?(s=this.textFillState_,s||(s={},this.textFillState_=s),s.fillStyle=me(o.getColor()||At)):(s=null,this.textFillState_=s);const a=t.getStroke();if(!a)r=null,this.textStrokeState_=r;else{r=this.textStrokeState_,r||(r={},this.textStrokeState_=r);const _=a.getLineDash(),m=a.getLineDashOffset(),p=a.getWidth(),y=a.getMiterLimit();r.lineCap=a.getLineCap()||qn,r.lineDash=_?_.slice():Le,r.lineDashOffset=m===void 0?Pe:m,r.lineJoin=a.getLineJoin()||Jn,r.lineWidth=p===void 0?Ui:p,r.miterLimit=y===void 0?Yi:y,r.strokeStyle=me(a.getColor()||Wi)}n=this.textState_;const l=t.getFont()||gh;bf(l);const h=t.getScaleArray();n.overflow=t.getOverflow(),n.font=l,n.maxAngle=t.getMaxAngle(),n.placement=t.getPlacement(),n.textAlign=t.getTextAlign(),n.repeat=t.getRepeat(),n.justify=t.getJustify(),n.textBaseline=t.getTextBaseline()||Ys,n.backgroundFill=t.getBackgroundFill(),n.backgroundStroke=t.getBackgroundStroke(),n.padding=t.getPadding()||pn,n.scale=h===void 0?[1,1]:h;const c=t.getOffsetX(),u=t.getOffsetY(),d=t.getRotateWithView(),f=t.getKeepUpright(),g=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=c===void 0?0:c,this.textOffsetY_=u===void 0?0:u,this.textRotateWithView_=d===void 0?!1:d,this.textKeepUpright_=f===void 0?!0:f,this.textRotation_=g===void 0?0:g,this.strokeKey_=r?(typeof r.strokeStyle=="string"?r.strokeStyle:q(r.strokeStyle))+r.lineCap+r.lineDashOffset+"|"+r.lineWidth+r.lineJoin+r.miterLimit+"["+r.lineDash.join()+"]":"",this.textKey_=n.font+n.scale+(n.textAlign||"?")+(n.repeat||"?")+(n.justify||"?")+(n.textBaseline||"?"),this.fillKey_=s&&s.fillStyle?typeof s.fillStyle=="string"?s.fillStyle:"|"+q(s.fillStyle):""}this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}const Uf={Circle:Ch,Default:Zi,Image:Nf,LineString:zf,Polygon:Ch,Text:Vf};class Kf{constructor(t,e,n,s){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=s,this.resolution_=n,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const n=this.buildersByZIndex_[e];for(const s in n){const r=n[s].finish();t[e][s]=r}}return t}getBuilder(t,e){const n=t!==void 0?t.toString():"0";let s=this.buildersByZIndex_[n];s===void 0&&(s={},this.buildersByZIndex_[n]=s);let r=s[e];if(r===void 0){const o=Uf[e];r=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),s[e]=r}return r}}const $f=Kf;function Ze(i,t,e,n,s,r,o){r=r||[],o=o||2;let a=0;for(let l=t;l<e;l+=n){const h=i[l],c=i[l+1];r[a++]=s[0]*h+s[2]*c+s[4],r[a++]=s[1]*h+s[3]*c+s[5];for(let u=2;u<o;u++)r[a++]=i[l+u]}return r&&r.length!=a&&(r.length=a),r}function Lo(i,t,e,n,s,r,o){o=o||[];const a=Math.cos(s),l=Math.sin(s),h=r[0],c=r[1];let u=0;for(let d=t;d<e;d+=n){const f=i[d]-h,g=i[d+1]-c;o[u++]=h+f*a-g*l,o[u++]=c+f*l+g*a;for(let _=d+2;_<d+n;++_)o[u++]=i[_]}return o&&o.length!=u&&(o.length=u),o}function Zf(i,t,e,n,s,r,o,a){a=a||[];const l=o[0],h=o[1];let c=0;for(let u=t;u<e;u+=n){const d=i[u]-l,f=i[u+1]-h;a[c++]=l+s*d,a[c++]=h+r*f;for(let g=u+2;g<u+n;++g)a[c++]=i[g]}return a&&a.length!=c&&(a.length=c),a}function Hf(i,t,e,n,s,r,o){o=o||[];let a=0;for(let l=t;l<e;l+=n){o[a++]=i[l]+s,o[a++]=i[l+1]+r;for(let h=l+2;h<l+n;++h)o[a++]=i[h]}return o&&o.length!=a&&(o.length=a),o}function J(i,t){if(!i)throw new Error(t)}new Array(6);function re(){return[1,0,0,1,0,0]}function qf(i,t){return i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i[4]=t[4],i[5]=t[5],i}function gt(i,t){const e=t[0],n=t[1];return t[0]=i[0]*e+i[2]*n+i[4],t[1]=i[1]*e+i[3]*n+i[5],t}function pe(i,t,e,n,s,r,o,a){const l=Math.sin(r),h=Math.cos(r);return i[0]=n*h,i[1]=s*l,i[2]=-n*l,i[3]=s*h,i[4]=o*n*h-a*n*l+t,i[5]=o*s*l+a*s*h+e,i}function wh(i,t){const e=Jf(t);J(e!==0,"Transformation matrix cannot be inverted");const n=t[0],s=t[1],r=t[2],o=t[3],a=t[4],l=t[5];return i[0]=o/e,i[1]=-s/e,i[2]=-r/e,i[3]=n/e,i[4]=(r*l-o*a)/e,i[5]=-(n*l-s*a)/e,i}function Jf(i){return i[0]*i[3]-i[1]*i[2]}const Qf=[1e5,1e5,1e5,1e5,2,2];function tg(i){return"matrix("+i.join(", ")+")"}function Po(i){return i.substring(7,i.length-1).split(",").map(parseFloat)}function eg(i,t){const e=Po(i),n=Po(t);for(let s=0;s<6;++s)if(Math.round((e[s]-n[s])*Qf[s])!==0)return!1;return!0}function bo(i,t,e,n){let s=i[t],r=i[t+1],o=0;for(let a=t+n;a<e;a+=n){const l=i[a],h=i[a+1];o+=Math.sqrt((l-s)*(l-s)+(h-r)*(h-r)),s=l,r=h}return o}function ng(i,t,e,n,s,r,o,a,l,h,c,u,d=!0){let f=i[t],g=i[t+1],_=0,m=0,p=0,y=0;function C(){_=f,m=g,t+=n,f=i[t],g=i[t+1],y+=p,p=Math.sqrt((f-_)*(f-_)+(g-m)*(g-m))}do C();while(t<e-n&&y+p<r);let E=p===0?0:(r-y)/p;const w=Gt(_,f,E),T=Gt(m,g,E),v=t-n,R=y,I=r+a*l(h,s,c);for(;t<e-n&&y+p<I;)C();E=p===0?0:(I-y)/p;const b=Gt(_,f,E),O=Gt(m,g,E);let D=!1;if(d)if(u){const B=[w,T,b,O];Lo(B,0,4,2,u,B,B),D=B[0]>B[2]}else D=w>b;const P=Math.PI,A=[],W=v+n===t;t=v,p=0,y=R,f=i[t],g=i[t+1];let N;if(W){C(),N=Math.atan2(g-m,f-_),D&&(N+=N>0?-P:P);const B=(b+w)/2,k=(O+T)/2;return A[0]=[B,k,(I-r)/2,N,s],A}s=s.replace(/\n/g," ");for(let B=0,k=s.length;B<k;){C();let U=Math.atan2(g-m,f-_);if(D&&(U+=U>0?-P:P),N!==void 0){let ut=U-N;if(ut+=ut>P?-2*P:ut<-P?2*P:0,Math.abs(ut)>o)return null}N=U;const H=B;let nt=0;for(;B<k;++B){const ut=D?k-B-1:B,jt=a*l(h,s[ut],c);if(t+n<e&&y+p<r+nt+jt/2)break;nt+=jt}if(B===H)continue;const L=D?s.substring(k-H,k-B):s.substring(H,B);E=p===0?0:(r+nt/2-y)/p;const It=Gt(_,f,E),yt=Gt(m,g,E);A.push([It,yt,nt/2,U,L]),r+=nt}return A}class ig{constructor(){El(this,"pushMethodArgs_",(...t)=>(this.push_(t),this));this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(Ps(),{get:(t,e)=>{if(typeof Ps()[e]=="function")return this.push_(e),this.pushMethodArgs_},set:(t,e,n)=>(this.push_(e,n),!0)})}push_(...t){const e=this.instructions_,n=this.zIndex+this.offset_;e[n]||(e[n]=[]),e[n].push(...t)}pushFunction(t){this.push_(t)}getContext(){return this.context_}draw(t){this.instructions_.forEach(e=>{for(let n=0,s=e.length;n<s;++n){const r=e[n];if(typeof r=="function"){r(t);continue}const o=e[++n];if(typeof t[r]=="function")t[r](...o);else{if(typeof o=="function"){t[r]=o(t);continue}t[r]=o}}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}}const vh=ig,ti=Mt(),He=[],be=[],Me=[],qe=[];function Rh(i){return i[3].declutterBox}const Th=new RegExp("["+String.fromCharCode(1425)+"-"+String.fromCharCode(2303)+String.fromCharCode(64285)+"-"+String.fromCharCode(65023)+String.fromCharCode(65136)+"-"+String.fromCharCode(65276)+String.fromCharCode(67584)+"-"+String.fromCharCode(69631)+String.fromCharCode(124928)+"-"+String.fromCharCode(126975)+"]");function Mo(i,t){return t==="start"?t=Th.test(i)?"right":"left":t==="end"&&(t=Th.test(i)?"left":"right"),Us[t]}function sg(i,t,e){return e>0&&i.push(`
4
- `,""),i.push(t,""),i}function rg(i,t,e){return e%2===0&&(i+=t),i}class og{constructor(t,e,n,s,r){this.overlaps=n,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=s.instructions,this.coordinates=s.coordinates,this.coordinateCache_={},this.renderedTransform_=re(),this.hitDetectionInstructions=s.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=s.fillStates||{},this.strokeStates=s.strokeStates||{},this.textStates=s.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=r?new vh:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,n,s){const r=t+e+n+s;if(this.labels_[r])return this.labels_[r];const o=s?this.strokeStates[s]:null,a=n?this.fillStates[n]:null,l=this.textStates[e],h=this.pixelRatio,c=[l.scale[0]*h,l.scale[1]*h],u=l.justify?Us[l.justify]:Mo(Array.isArray(t)?t[0]:t,l.textAlign||Vi),d=s&&o.lineWidth?o.lineWidth:0,f=Array.isArray(t)?t:String(t).split(`
5
- `).reduce(sg,[]),{width:g,height:_,widths:m,heights:p,lineWidths:y}=Af(l,f),C=g+d,E=[],w=(C+2)*c[0],T=(_+d)*c[1],v={width:w<0?Math.floor(w):Math.ceil(w),height:T<0?Math.floor(T):Math.ceil(T),contextInstructions:E};(c[0]!=1||c[1]!=1)&&E.push("scale",c),s&&(E.push("strokeStyle",o.strokeStyle),E.push("lineWidth",d),E.push("lineCap",o.lineCap),E.push("lineJoin",o.lineJoin),E.push("miterLimit",o.miterLimit),E.push("setLineDash",[o.lineDash]),E.push("lineDashOffset",o.lineDashOffset)),n&&E.push("fillStyle",a.fillStyle),E.push("textBaseline","middle"),E.push("textAlign","center");const R=.5-u;let I=u*C+R*d;const b=[],O=[];let D=0,P=0,A=0,W=0,N;for(let B=0,k=f.length;B<k;B+=2){const U=f[B];if(U===`
6
- `){P+=D,D=0,I=u*C+R*d,++W;continue}const H=f[B+1]||l.font;H!==N&&(s&&b.push("font",H),n&&O.push("font",H),N=H),D=Math.max(D,p[A]);const nt=[U,I+R*m[A]+u*(m[A]-y[W]),.5*(d+D)+P];I+=m[A],s&&b.push("strokeText",nt),n&&O.push("fillText",nt),++A}return Array.prototype.push.apply(E,b),Array.prototype.push.apply(E,O),this.labels_[r]=v,v}replayTextBackground_(t,e,n,s,r,o,a){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,n),t.lineTo.apply(t,s),t.lineTo.apply(t,r),t.lineTo.apply(t,e),o&&(this.alignAndScaleFill_=o[2],t.fillStyle=o[1],this.fill_(t)),a&&(this.setStrokeStyle_(t,a),t.stroke())}calculateImageOrLabelDimensions_(t,e,n,s,r,o,a,l,h,c,u,d,f,g,_,m){a*=d[0],l*=d[1];let p=n-a,y=s-l;const C=r+h>t?t-h:r,E=o+c>e?e-c:o,w=g[3]+C*d[0]+g[1],T=g[0]+E*d[1]+g[2],v=p-g[3],R=y-g[0];(_||u!==0)&&(He[0]=v,qe[0]=v,He[1]=R,be[1]=R,be[0]=v+w,Me[0]=be[0],Me[1]=R+T,qe[1]=Me[1]);let I;return u!==0?(I=pe(re(),n,s,1,1,u,-n,-s),gt(I,He),gt(I,be),gt(I,Me),gt(I,qe),Te(Math.min(He[0],be[0],Me[0],qe[0]),Math.min(He[1],be[1],Me[1],qe[1]),Math.max(He[0],be[0],Me[0],qe[0]),Math.max(He[1],be[1],Me[1],qe[1]),ti)):Te(Math.min(v,v+w),Math.min(R,R+T),Math.max(v,v+w),Math.max(R,R+T),ti),f&&(p=Math.round(p),y=Math.round(y)),{drawImageX:p,drawImageY:y,drawImageW:C,drawImageH:E,originX:h,originY:c,declutterBox:{minX:ti[0],minY:ti[1],maxX:ti[2],maxY:ti[3],value:m},canvasTransform:I,scale:d}}replayImageOrLabel_(t,e,n,s,r,o,a){const l=!!(o||a),h=s.declutterBox,c=a?a[2]*s.scale[0]/2:0;return h.minX-c<=e[0]&&h.maxX+c>=0&&h.minY-c<=e[1]&&h.maxY+c>=0&&(l&&this.replayTextBackground_(t,He,be,Me,qe,o,a),Of(t,s.canvasTransform,r,n,s.originX,s.originY,s.drawImageW,s.drawImageH,s.drawImageX,s.drawImageY,s.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const n=gt(this.renderedTransform_,[0,0]),s=512*this.pixelRatio;t.save(),t.translate(n[0]%s,n[1]%s),e!==1&&t.scale(e,e),t.rotate(this.viewRotation_)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],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,n,s){const r=this.textStates[e],o=this.createLabel(t,e,s,n),a=this.strokeStates[n],l=this.pixelRatio,h=Mo(Array.isArray(t)?t[0]:t,r.textAlign||Vi),c=Us[r.textBaseline||Ys],u=a&&a.lineWidth?a.lineWidth:0,d=o.width/l-2*r.scale[0],f=h*d+2*(.5-h)*u,g=c*o.height/l+2*(.5-c)*u;return{label:o,anchorX:f,anchorY:g}}execute_(t,e,n,s,r,o,a,l){const h=this.zIndexContext_;let c;this.pixelCoordinates_&&Be(n,this.renderedTransform_)?c=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),c=Ze(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),qf(this.renderedTransform_,n));let u=0;const d=s.length;let f=0,g,_,m,p,y,C,E,w,T,v,R,I,b,O=0,D=0;const P=this.coordinateCache_,A=this.viewRotation_,W=Math.round(Math.atan2(-n[1],n[0])*1e12)/1e12,N={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:A},B=this.instructions!=s||this.overlaps?0:200;let k,U,H,nt;for(;u<d;){const L=s[u];switch(L[0]){case G.BEGIN_GEOMETRY:k=L[1],nt=L[3],k.getGeometry()?a!==void 0&&!Ct(a,nt.getExtent())?u=L[2]+1:++u:u=L[2],h&&(h.zIndex=L[4]);break;case G.BEGIN_PATH:O>B&&(this.fill_(t),O=0),D>B&&(t.stroke(),D=0),!O&&!D&&(t.beginPath(),y=NaN,C=NaN),++u;break;case G.CIRCLE:f=L[1];const yt=c[f],ut=c[f+1],jt=c[f+2],Lt=c[f+3],Ce=jt-yt,de=Lt-ut,Xt=Math.sqrt(Ce*Ce+de*de);t.moveTo(yt+Xt,ut),t.arc(yt,ut,Xt,0,2*Math.PI,!0),++u;break;case G.CLOSE_PATH:t.closePath(),++u;break;case G.CUSTOM:f=L[1],g=L[2];const zr=L[3],gl=L[4],ys=L[5];N.geometry=zr,N.feature=k,u in P||(P[u]=[]);const Fn=P[u];ys?ys(c,f,g,2,Fn):(Fn[0]=c[f],Fn[1]=c[f+1],Fn.length=2),h&&(h.zIndex=L[6]),gl(Fn,N),++u;break;case G.DRAW_IMAGE:f=L[1],g=L[2],T=L[3],_=L[4],m=L[5];let Jt=L[6];const we=L[7],vi=L[8],Ri=L[9],xs=L[10];let kn=L[11];const Ti=L[12];let Si=L[13];p=L[14]||"declutter";const xt=L[15];if(!T&&L.length>=20){v=L[19],R=L[20],I=L[21],b=L[22];const Qt=this.drawLabelWithPointPlacement_(v,R,I,b);T=Qt.label,L[3]=T;const Nn=L[23];_=(Qt.anchorX-Nn)*this.pixelRatio,L[4]=_;const te=L[24];m=(Qt.anchorY-te)*this.pixelRatio,L[5]=m,Jt=T.height,L[6]=Jt,Si=T.width,L[13]=Si}let _l;L.length>25&&(_l=L[25]);let ml,jr,Xr;L.length>17?(ml=L[16],jr=L[17],Xr=L[18]):(ml=pn,jr=null,Xr=null),xs&&W?kn+=A:!xs&&!W&&(kn-=A);let vC=0;for(;f<g;f+=2){if(_l&&_l[vC++]<Si/this.pixelRatio)continue;const Qt=this.calculateImageOrLabelDimensions_(T.width,T.height,c[f],c[f+1],Si,Jt,_,m,vi,Ri,kn,Ti,r,ml,!!jr||!!Xr,k),Nn=[t,e,T,Qt,we,jr,Xr];if(l){let te,ve,ee;if(xt){const ht=g-f;if(!xt[ht]){xt[ht]={args:Nn,declutterMode:p};continue}const bt=xt[ht];te=bt.args,ve=bt.declutterMode,delete xt[ht],ee=Rh(te)}let ze,je;if(te&&(ve!=="declutter"||!l.collides(ee))&&(ze=!0),(p!=="declutter"||!l.collides(Qt.declutterBox))&&(je=!0),ve==="declutter"&&p==="declutter"){const ht=ze&&je;ze=ht,je=ht}ze&&(ve!=="none"&&l.insert(ee),this.replayImageOrLabel_.apply(this,te)),je&&(p!=="none"&&l.insert(Qt.declutterBox),this.replayImageOrLabel_.apply(this,Nn))}else this.replayImageOrLabel_.apply(this,Nn)}++u;break;case G.DRAW_CHARS:const td=L[1],ed=L[2],pl=L[3],RC=L[4];b=L[5];const TC=L[6],nd=L[7],id=L[8];I=L[9];const yl=L[10];v=L[11],Array.isArray(v)&&(v=v.reduce(rg,"")),R=L[12];const sd=[L[13],L[13]];p=L[14]||"declutter";const SC=L[15],xl=this.textStates[R],Es=xl.font,Cs=[xl.scale[0]*nd,xl.scale[1]*nd];let ws;Es in this.widths_?ws=this.widths_[Es]:(ws={},this.widths_[Es]=ws);const rd=bo(c,td,ed,2),od=Math.abs(Cs[0])*yh(Es,v,ws);if(RC||od<=rd){const Qt=this.textStates[R].textAlign,Nn=(rd-od)*Mo(v,Qt),te=ng(c,td,ed,2,v,Nn,TC,Math.abs(Cs[0]),yh,Es,ws,W?0:this.viewRotation_,SC);t:if(te){const ve=[];let ee,ze,je,ht,bt;if(I)for(ee=0,ze=te.length;ee<ze;++ee){bt=te[ee],je=bt[4],ht=this.createLabel(je,R,"",I),_=bt[2]+(Cs[0]<0?-yl:yl),m=pl*ht.height+(.5-pl)*2*yl*Cs[1]/Cs[0]-id;const Xe=this.calculateImageOrLabelDimensions_(ht.width,ht.height,bt[0],bt[1],ht.width,ht.height,_,m,0,0,bt[3],sd,!1,pn,!1,k);if(l&&p==="declutter"&&l.collides(Xe.declutterBox))break t;ve.push([t,e,ht,Xe,1,null,null])}if(b)for(ee=0,ze=te.length;ee<ze;++ee){bt=te[ee],je=bt[4],ht=this.createLabel(je,R,b,""),_=bt[2],m=pl*ht.height-id;const Xe=this.calculateImageOrLabelDimensions_(ht.width,ht.height,bt[0],bt[1],ht.width,ht.height,_,m,0,0,bt[3],sd,!1,pn,!1,k);if(l&&p==="declutter"&&l.collides(Xe.declutterBox))break t;ve.push([t,e,ht,Xe,1,null,null])}l&&p!=="none"&&l.load(ve.map(Rh));for(let Xe=0,IC=ve.length;Xe<IC;++Xe)this.replayImageOrLabel_.apply(this,ve[Xe])}}++u;break;case G.END_GEOMETRY:if(o!==void 0){k=L[1];const Qt=o(k,nt,p);if(Qt)return Qt}++u;break;case G.FILL:B?O++:this.fill_(t),++u;break;case G.MOVE_TO_LINE_TO:for(f=L[1],g=L[2],U=c[f],H=c[f+1],t.moveTo(U,H),y=U+.5|0,C=H+.5|0,f+=2;f<g;f+=2)U=c[f],H=c[f+1],E=U+.5|0,w=H+.5|0,(f==g-2||E!==y||w!==C)&&(t.lineTo(U,H),y=E,C=w);++u;break;case G.SET_FILL_STYLE:this.alignAndScaleFill_=L[2],O&&(this.fill_(t),O=0,D&&(t.stroke(),D=0)),t.fillStyle=L[1],++u;break;case G.SET_STROKE_STYLE:D&&(t.stroke(),D=0),this.setStrokeStyle_(t,L),++u;break;case G.STROKE:B?D++:t.stroke(),++u;break;default:++u;break}}O&&this.fill_(t),D&&t.stroke()}execute(t,e,n,s,r,o){this.viewRotation_=s,this.execute_(t,e,n,this.instructions,r,void 0,void 0,o)}executeHitDetection(t,e,n,s,r){return this.viewRotation_=n,this.execute_(t,[t.canvas.width,t.canvas.height],e,this.hitDetectionInstructions,!0,s,r)}}const ag=og,En=["Polygon","Circle","LineString","Image","Text","Default"],Sh=["Image","Text"],lg=En.filter(i=>!Sh.includes(i));class hg{constructor(t,e,n,s,r,o,a){this.maxExtent_=t,this.overlaps_=s,this.pixelRatio_=n,this.resolution_=e,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=re(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(r,a)}clip(t,e){const n=this.getClipCoords(e);t.beginPath(),t.moveTo(n[0],n[1]),t.lineTo(n[2],n[3]),t.lineTo(n[4],n[5]),t.lineTo(n[6],n[7]),t.clip()}createExecutors_(t,e){for(const n in t){let s=this.executorsByZIndex_[n];s===void 0&&(s={},this.executorsByZIndex_[n]=s);const r=t[n];for(const o in r){const a=r[o];s[o]=new ag(this.resolution_,this.pixelRatio_,this.overlaps_,a,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const n=this.executorsByZIndex_[e];for(let s=0,r=t.length;s<r;++s)if(t[s]in n)return!0}return!1}forEachFeatureAtCoordinate(t,e,n,s,r,o){s=Math.round(s);const a=s*2+1,l=pe(this.hitDetectionTransform_,s+.5,s+.5,1/e,-1/e,-n,-t[0],-t[1]),h=!this.hitDetectionContext_;h&&(this.hitDetectionContext_=ft(a,a));const c=this.hitDetectionContext_;c.canvas.width!==a||c.canvas.height!==a?(c.canvas.width=a,c.canvas.height=a):h||c.clearRect(0,0,a,a);let u;this.renderBuffer_!==void 0&&(u=Mt(),Li(u,t),Gn(u,e*(this.renderBuffer_+s),u));const d=cg(s);let f;function g(w,T,v){const R=c.getImageData(0,0,a,a).data;for(let I=0,b=d.length;I<b;I++)if(R[d[I]]>0){if(!o||v==="none"||f!=="Image"&&f!=="Text"||o.includes(w)){const O=(d[I]-3)/4,D=s-O%a,P=s-(O/a|0),A=r(w,T,D*D+P*P);if(A)return A}c.clearRect(0,0,a,a);break}}const _=Object.keys(this.executorsByZIndex_).map(Number);_.sort(Re);let m,p,y,C,E;for(m=_.length-1;m>=0;--m){const w=_[m].toString();for(y=this.executorsByZIndex_[w],p=En.length-1;p>=0;--p)if(f=En[p],C=y[f],C!==void 0&&(E=C.executeHitDetection(c,l,n,g,u),E))return E}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const n=e[0],s=e[1],r=e[2],o=e[3],a=[n,s,n,o,r,o,r,s];return Ze(a,0,8,2,t,a),a}isEmpty(){return gn(this.executorsByZIndex_)}execute(t,e,n,s,r,o,a){const l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?hd:Re),o=o||En;const h=En.length;for(let c=0,u=l.length;c<u;++c){const d=l[c].toString(),f=this.executorsByZIndex_[d];for(let g=0,_=o.length;g<_;++g){const m=o[g],p=f[m];if(p!==void 0){const y=a===null?void 0:p.getZIndexContext(),C=y?y.getContext():t,E=this.maxExtent_&&m!=="Image"&&m!=="Text";if(E&&(C.save(),this.clip(C,n)),!y||m==="Text"||m==="Image"?p.execute(C,e,n,s,r,a):y.pushFunction(w=>p.execute(w,e,n,s,r,a)),E&&C.restore(),y){y.offset();const w=l[c]*h+En.indexOf(m);this.deferredZIndexContexts_[w]||(this.deferredZIndexContexts_[w]=[]),this.deferredZIndexContexts_[w].push(y)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(Re);for(let n=0,s=e.length;n<s;++n)t[e[n]].forEach(r=>{r.draw(this.renderedContext_),r.clear()}),t[e[n]].length=0}}const Ao={};function cg(i){if(Ao[i]!==void 0)return Ao[i];const t=i*2+1,e=i*i,n=new Array(e+1);for(let r=0;r<=i;++r)for(let o=0;o<=i;++o){const a=r*r+o*o;if(a>e)break;let l=n[a];l||(l=[],n[a]=l),l.push(((i+r)*t+(i+o))*4+3),r>0&&l.push(((i-r)*t+(i+o))*4+3),o>0&&(l.push(((i+r)*t+(i-o))*4+3),r>0&&l.push(((i-r)*t+(i-o))*4+3))}const s=[];for(let r=0,o=n.length;r<o;++r)n[r]&&s.push(...n[r]);return Ao[i]=s,s}const ug=hg;function Ih(i){return i[0]>0&&i[1]>0}function dg(i,t,e){return e===void 0&&(e=[0,0]),e[0]=i[0]*t+.5|0,e[1]=i[1]*t+.5|0,e}function Ot(i,t){return Array.isArray(i)?i:(t===void 0?t=[i,i]:(t[0]=i,t[1]=i),t)}class Oo{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=Ot(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new Oo({opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return j()}getImage(t){return j()}getHitDetectionImage(){return j()}getPixelRatio(t){return 1}getImageState(){return j()}getImageSize(){return j()}getOrigin(){return j()}getSize(){return j()}setDisplacement(t){this.displacement_=t}setOpacity(t){this.opacity_=t}setRotateWithView(t){this.rotateWithView_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=Ot(t)}listenImageChange(t){j()}load(){j()}unlistenImageChange(t){j()}ready(){return Promise.resolve()}}const Lh=Oo;class Do extends Lh{constructor(t){super({opacity:1,rotateWithView:t.rotateWithView!==void 0?t.rotateWithView:!1,rotation:t.rotation!==void 0?t.rotation:0,scale:t.scale!==void 0?t.scale:1,displacement:t.displacement!==void 0?t.displacement:[0,0],declutterMode:t.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=t.fill!==void 0?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius=t.radius,this.radius2_=t.radius2,this.angle_=t.angle!==void 0?t.angle:0,this.stroke_=t.stroke!==void 0?t.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?M.LOADING:M.LOADED,this.imageState_===M.LOADING&&this.ready().then(()=>this.imageState_=M.LOADED),this.render()}clone(){const t=this.getScale(),e=new Do({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(),n=this.getScaleArray();return[t[0]/2-e[0]/n[0],t[1]/2+e[1]/n[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){var r,o;const e=(r=this.fill_)==null?void 0:r.getKey(),n=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(",");let s=(o=Ut.get(n,null,null))==null?void 0:o.getImage(1);if(!s){const a=this.renderOptions_,l=Math.ceil(a.size*t),h=ft(l,l);this.draw_(a,h,t),s=h.canvas,Ut.set(n,null,null,new lh(s,void 0,null,M.LOADED,null))}return s}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,n){if(e===0||this.points_===1/0||t!=="bevel"&&t!=="miter")return e;let s=this.radius,r=this.radius2_===void 0?s:this.radius2_;if(s<r){const T=s;s=r,r=T}const o=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/o,l=r*Math.sin(a),h=Math.sqrt(r*r-l*l),c=s-h,u=Math.sqrt(l*l+c*c),d=u/l;if(t==="miter"&&d<=n)return d*e;const f=e/2/d,g=e/2*(c/u),m=Math.sqrt((s+f)*(s+f)+g*g)-s;if(this.radius2_===void 0||t==="bevel")return m*2;const p=s*Math.sin(a),y=Math.sqrt(s*s-p*p),C=r-y,w=Math.sqrt(p*p+C*C)/p;if(w<=n){const T=w*e/2-r-s;return 2*Math.max(m,T)}return m*2}createRenderOptions(){let t=qn,e=Jn,n=0,s=null,r=0,o,a=0;this.stroke_&&(o=me(this.stroke_.getColor()??Wi),a=this.stroke_.getWidth()??Ui,s=this.stroke_.getLineDash(),r=this.stroke_.getLineDashOffset()??0,e=this.stroke_.getLineJoin()??Jn,t=this.stroke_.getLineCap()??qn,n=this.stroke_.getMiterLimit()??Yi);const l=this.calculateLineJoinSize_(e,a,n),h=Math.max(this.radius,this.radius2_||0),c=Math.ceil(2*h+l);return{strokeStyle:o,strokeWidth:a,size:c,lineCap:t,lineDash:s,lineDashOffset:r,lineJoin:e,miterLimit:n}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,e,n){if(e.scale(n,n),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let s=this.fill_.getColor();s===null&&(s=At),e.fillStyle=me(s),e.fill()}t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}createHitDetectionCanvas_(t){let e;if(this.fill_){let n=this.fill_.getColor(),s=0;typeof n=="string"&&(n=Kn(n)),n===null?s=1:Array.isArray(n)&&(s=n.length===4?n[3]:1),s===0&&(e=ft(t.size,t.size),this.drawHitDetectionCanvas_(t,e))}return e?e.canvas:this.getImage(1)}createPath_(t){let e=this.points_;const n=this.radius;if(e===1/0)t.arc(0,0,n,0,2*Math.PI);else{const s=this.radius2_===void 0?n:this.radius2_;this.radius2_!==void 0&&(e*=2);const r=this.angle_-Math.PI/2,o=2*Math.PI/e;for(let a=0;a<e;a++){const l=r+a*o,h=a%2===0?n:s;t.lineTo(h*Math.cos(l),h*Math.sin(l))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle=At,e.fill(),t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}}const Ph=Do;class Fo extends Ph{constructor(t){t=t||{radius:5},super({points:1/0,fill:t.fill,radius:t.radius,stroke:t.stroke,scale:t.scale!==void 0?t.scale:1,rotation:t.rotation!==void 0?t.rotation:0,rotateWithView:t.rotateWithView!==void 0?t.rotateWithView:!1,displacement:t.displacement!==void 0?t.displacement:[0,0],declutterMode:t.declutterMode})}clone(){const t=this.getScale(),e=new Fo({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}setRadius(t){this.radius=t,this.render()}}const Ks=Fo;class ko{constructor(t){t=t||{},this.patternImage_=null,this.color_=null,t.color!==void 0&&this.setColor(t.color)}clone(){const t=this.getColor();return new ko({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(t){if(t!==null&&typeof t=="object"&&"src"in t){const e=js(null,t.src,"anonymous",void 0,t.offset?null:t.color?t.color:null,!(t.offset&&t.size));e.ready().then(()=>{this.patternImage_=null}),e.getImageState()===M.IDLE&&e.load(),e.getImageState()===M.LOADING&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?q(t):typeof t=="object"&&"src"in t?t.src+":"+t.offset:Kn(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}const wt=ko;function bh(i,t,e,n){return e!==void 0&&n!==void 0?[e/i,n/t]:e!==void 0?e/i:n!==void 0?n/t:1}const No=class ad extends Lh{constructor(t){t=t||{};const e=t.opacity!==void 0?t.opacity:1,n=t.rotation!==void 0?t.rotation:0,s=t.scale!==void 0?t.scale:1,r=t.rotateWithView!==void 0?t.rotateWithView:!1;super({opacity:e,rotation:n,scale:s,displacement:t.displacement!==void 0?t.displacement:[0,0],rotateWithView:r,declutterMode:t.declutterMode}),this.anchor_=t.anchor!==void 0?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=t.anchorOrigin!==void 0?t.anchorOrigin:"top-left",this.anchorXUnits_=t.anchorXUnits!==void 0?t.anchorXUnits:"fraction",this.anchorYUnits_=t.anchorYUnits!==void 0?t.anchorYUnits:"fraction",this.crossOrigin_=t.crossOrigin!==void 0?t.crossOrigin:null;const o=t.img!==void 0?t.img:null;let a=t.src;J(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||q(o)),J(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),J(!((t.width!==void 0||t.height!==void 0)&&t.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let l;if(t.src!==void 0?l=M.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?M.LOADED:M.IDLE:l=M.LOADING:l=M.LOADED),this.color_=t.color!==void 0?Kn(t.color):null,this.iconImage_=js(o,a,this.crossOrigin_,l,this.color_),this.offset_=t.offset!==void 0?t.offset:[0,0],this.offsetOrigin_=t.offsetOrigin!==void 0?t.offsetOrigin:"top-left",this.origin_=null,this.size_=t.size!==void 0?t.size:null,this.initialOptions_,t.width!==void 0||t.height!==void 0){let h,c;if(t.size)[h,c]=t.size;else{const u=this.getImage(1);if(u.width&&u.height)h=u.width,c=u.height;else if(u instanceof HTMLImageElement){this.initialOptions_=t;const d=()=>{if(this.unlistenImageChange(d),!this.initialOptions_)return;const f=this.iconImage_.getSize();this.setScale(bh(f[0],f[1],t.width,t.height))};this.listenImageChange(d);return}}h!==void 0&&this.setScale(bh(h,c,t.width,t.height))}}clone(){let t,e,n;return this.initialOptions_?(e=this.initialOptions_.width,n=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new ad({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:n,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const s=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!s)return null;t=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(t[0]*=s[0]),this.anchorYUnits_=="fraction"&&(t[1]*=s[1])}if(this.anchorOrigin_!="top-left"){if(!s)return null;t===this.anchor_&&(t=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(t[0]=-t[0]+s[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(t[1]=-t[1]+s[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),n=this.getScaleArray();return[t[0]-e[0]/n[0],t[1]+e[1]/n[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if(this.offsetOrigin_!="top-left"){const e=this.getSize(),n=this.iconImage_.getSize();if(!e||!n)return null;t=t.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(t[0]=n[0]-e[0]-t[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(t[1]=n[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(t){this.iconImage_=js(null,t,this.crossOrigin_,M.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();if(this.size_)return this.size_[0]*t[0];if(this.iconImage_.getImageState()==M.LOADED)return this.iconImage_.getSize()[0]*t[0]}getHeight(){const t=this.getScaleArray();if(this.size_)return this.size_[1]*t[1];if(this.iconImage_.getImageState()==M.LOADED)return this.iconImage_.getSize()[1]*t[1]}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(z.CHANGE,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(z.CHANGE,t)}ready(){return this.iconImage_.ready()}};class Go{constructor(t){t=t||{},this.color_=t.color!==void 0?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=t.lineDash!==void 0?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 Go({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}}const Ae=Go;class Je{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=Ah,t.geometry!==void 0&&this.setGeometry(t.geometry),this.fill_=t.fill!==void 0?t.fill:null,this.image_=t.image!==void 0?t.image:null,this.renderer_=t.renderer!==void 0?t.renderer:null,this.hitDetectionRenderer_=t.hitDetectionRenderer!==void 0?t.hitDetectionRenderer:null,this.stroke_=t.stroke!==void 0?t.stroke:null,this.text_=t.text!==void 0?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&typeof t=="object"&&(t=t.clone()),new Je({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){typeof t=="function"?this.geometryFunction_=t:typeof t=="string"?this.geometryFunction_=function(e){return e.get(t)}:t?t!==void 0&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=Ah,this.geometry_=t}setZIndex(t){this.zIndex_=t}}function fg(i){let t;if(typeof i=="function")t=i;else{let e;Array.isArray(i)?e=i:(J(typeof i.getZIndex=="function","Expected an `Style` or an array of `Style`"),e=[i]),t=function(){return e}}return t}let zo=null;function Mh(i,t){if(!zo){const e=new wt({color:"rgba(255,255,255,0.4)"}),n=new Ae({color:"#3399CC",width:1.25});zo=[new Je({image:new Ks({fill:e,stroke:n,radius:5}),fill:e,stroke:n})]}return zo}function gg(){const i={},t=[255,255,255,1],e=[0,153,255,1],n=3;return i.Polygon=[new Je({fill:new wt({color:[255,255,255,.5]})})],i.MultiPolygon=i.Polygon,i.LineString=[new Je({stroke:new Ae({color:t,width:n+2})}),new Je({stroke:new Ae({color:e,width:n})})],i.MultiLineString=i.LineString,i.Circle=i.Polygon.concat(i.LineString),i.Point=[new Je({image:new Ks({radius:n*2,fill:new wt({color:e}),stroke:new Ae({color:t,width:n/2})}),zIndex:1/0})],i.MultiPoint=i.Point,i.GeometryCollection=i.Polygon.concat(i.LineString,i.Point),i}function Ah(i){return i.getGeometry()}const $t=Je,_g="#333";class jo{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_=Ot(t.scale!==void 0?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_=t.fill!==void 0?t.fill:new wt({color:_g}),this.maxAngle_=t.maxAngle!==void 0?t.maxAngle:Math.PI/4,this.placement_=t.placement!==void 0?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=t.stroke!==void 0?t.stroke:null,this.offsetX_=t.offsetX!==void 0?t.offsetX:0,this.offsetY_=t.offsetY!==void 0?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=t.padding===void 0?null:t.padding,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new jo({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()instanceof wt?this.getFill().clone():this.getFill(),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_=Ot(t!==void 0?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}}const Oh=jo,Dh=re(),mg=[NaN,NaN];class pg extends Kt{constructor(){super(),this.extent_=Mt(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=oh((t,e,n)=>{if(!n)return this.getSimplifiedGeometry(e);const s=this.clone();return s.applyTransform(n),s.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return j()}closestPointXY(t,e,n,s){return j()}containsXY(t,e){return this.closestPointXY(t,e,mg,Number.MIN_VALUE)===0}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 j()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&Ii(e),this.extentRevision_=this.getRevision()}return gd(this.extent_,t)}rotate(t,e){j()}scale(t,e,n){j()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return j()}getType(){return j()}applyTransform(t){j()}intersectsExtent(t){return j()}translate(t,e){j()}transform(t,e){const n=at(t),s=n.getUnits()=="tile-pixels"?function(r,o,a){const l=n.getExtent(),h=n.getWorldExtent(),c=ct(h)/ct(l);pe(Dh,h[0],h[3],c,-c,0,0,0);const u=Ze(r,0,r.length,a,Dh,o),d=Fi(n,e);return d?d(u,u,a):u}:Fi(n,e);return this.applyTransform(s),this}}const Fh=pg;class yg extends Fh{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return Vr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return j()}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||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length<this.flatCoordinates.length?e:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getSimplifiedGeometryInternal(t){return this}getStride(){return this.stride}setFlatCoordinates(t,e){this.stride=$s(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){j()}setLayout(t,e,n){let s;if(t)s=$s(t);else{for(let r=0;r<n;++r){if(e.length===0){this.layout="XY",this.stride=2;return}e=e[0]}s=e.length,t=Cn(s)}this.layout=t,this.stride=s}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(t,e){const n=this.getFlatCoordinates();if(n){const s=this.getStride();Lo(n,0,n.length,s,t,e,n),this.changed()}}scale(t,e,n){e===void 0&&(e=t),n||(n=ie(this.getExtent()));const s=this.getFlatCoordinates();if(s){const r=this.getStride();Zf(s,0,s.length,r,t,e,n,s),this.changed()}}translate(t,e){const n=this.getFlatCoordinates();if(n){const s=this.getStride();Hf(n,0,n.length,s,t,e,n),this.changed()}}}function Cn(i){let t;return i==2?t="XY":i==3?t="XYZ":i==4&&(t="XYZM"),t}function $s(i){let t;return i=="XY"?t=2:i=="XYZ"||i=="XYM"?t=3:i=="XYZM"&&(t=4),t}function xg(i,t,e){const n=i.getFlatCoordinates();if(!n)return null;const s=i.getStride();return Ze(n,0,n.length,s,t,e)}const Qe=yg;class Eg extends hh{constructor(t,e,n,s,r,o,a){super(),this.context_=t,this.pixelRatio_=e,this.extent_=n,this.transform_=s,this.transformRotation_=s?Bn(Math.atan2(s[1],s[0]),10):0,this.viewRotation_=r,this.squaredTolerance_=o,this.userTransform_=a,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_=re()}drawImages_(t,e,n,s){if(!this.image_)return;const r=Ze(t,e,n,s,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.tmpLocalTransform_,l=o.globalAlpha;this.imageOpacity_!=1&&(o.globalAlpha=l*this.imageOpacity_);let h=this.imageRotation_;this.transformRotation_===0&&(h-=this.viewRotation_),this.imageRotateWithView_&&(h+=this.viewRotation_);for(let c=0,u=r.length;c<u;c+=2){const d=r[c]-this.imageAnchorX_,f=r[c+1]-this.imageAnchorY_;if(h!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){const g=d+this.imageAnchorX_,_=f+this.imageAnchorY_;pe(a,g,_,1,1,h,-g,-_),o.save(),o.transform.apply(o,a),o.translate(g,_),o.scale(this.imageScale_[0],this.imageScale_[1]),o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),o.restore()}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,d,f,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(o.globalAlpha=l)}drawText_(t,e,n,s){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const r=Ze(t,e,n,s,this.transform_,this.pixelCoordinates_),o=this.context_;let a=this.textRotation_;for(this.transformRotation_===0&&(a-=this.viewRotation_),this.textRotateWithView_&&(a+=this.viewRotation_);e<n;e+=s){const l=r[e]+this.textOffsetX_,h=r[e+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(o.save(),o.translate(l-this.textOffsetX_,h-this.textOffsetY_),o.rotate(a),o.translate(this.textOffsetX_,this.textOffsetY_),o.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&o.strokeText(this.text_,0,0),this.textFillState_&&o.fillText(this.text_,0,0),o.restore()):(this.textStrokeState_&&o.strokeText(this.text_,l,h),this.textFillState_&&o.fillText(this.text_,l,h))}}moveToLineTo_(t,e,n,s,r){const o=this.context_,a=Ze(t,e,n,s,this.transform_,this.pixelCoordinates_);o.moveTo(a[0],a[1]);let l=a.length;r&&(l-=2);for(let h=2;h<l;h+=2)o.lineTo(a[h],a[h+1]);return r&&o.closePath(),n}drawRings_(t,e,n,s){for(let r=0,o=n.length;r<o;++r)e=this.moveToLineTo_(t,e,n[r],s,!0);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ct(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=xg(t,this.transform_,this.pixelCoordinates_),n=e[2]-e[0],s=e[3]-e[1],r=Math.sqrt(n*n+s*s),o=this.context_;o.beginPath(),o.arc(e[0],e[1],r,0,2*Math.PI),this.fillState_&&o.fill(),this.strokeState_&&o.stroke()}this.text_!==""&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.transform_=t}drawGeometry(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t);break}}drawFeature(t,e){const n=e.getGeometryFunction()(t);n&&(this.setStyle(e),this.drawGeometry(n))}drawGeometryCollection(t){const e=t.getGeometriesArray();for(let n=0,s=e.length;n<s;++n)this.drawGeometry(e[n])}drawPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),n=t.getStride();this.image_&&this.drawImages_(e,0,e.length,n),this.text_!==""&&this.drawText_(e,0,e.length,n)}drawMultiPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),n=t.getStride();this.image_&&this.drawImages_(e,0,e.length,n),this.text_!==""&&this.drawText_(e,0,e.length,n)}drawLineString(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ct(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,n=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(n,0,n.length,t.getStride(),!1),e.stroke()}if(this.text_!==""){const e=t.getFlatMidpoint();this.drawText_(e,0,2,2)}}}drawMultiLineString(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getExtent();if(Ct(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const n=this.context_,s=t.getFlatCoordinates();let r=0;const o=t.getEnds(),a=t.getStride();n.beginPath();for(let l=0,h=o.length;l<h;++l)r=this.moveToLineTo_(s,r,o[l],a,!1);n.stroke()}if(this.text_!==""){const n=t.getFlatMidpoints();this.drawText_(n,0,n.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ct(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_;e.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride()),this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(this.text_!==""){const e=t.getFlatInteriorPoint();this.drawText_(e,0,2,2)}}}drawMultiPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ct(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_,n=t.getOrientedFlatCoordinates();let s=0;const r=t.getEndss(),o=t.getStride();e.beginPath();for(let a=0,l=r.length;a<l;++a){const h=r[a];s=this.drawRings_(n,s,h,o)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(this.text_!==""){const e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){const e=this.context_,n=this.contextFillState_;n?n.fillStyle!=t.fillStyle&&(n.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){const e=this.context_,n=this.contextStrokeState_;n?(n.lineCap!=t.lineCap&&(n.lineCap=t.lineCap,e.lineCap=t.lineCap),Be(n.lineDash,t.lineDash)||e.setLineDash(n.lineDash=t.lineDash),n.lineDashOffset!=t.lineDashOffset&&(n.lineDashOffset=t.lineDashOffset,e.lineDashOffset=t.lineDashOffset),n.lineJoin!=t.lineJoin&&(n.lineJoin=t.lineJoin,e.lineJoin=t.lineJoin),n.lineWidth!=t.lineWidth&&(n.lineWidth=t.lineWidth,e.lineWidth=t.lineWidth),n.miterLimit!=t.miterLimit&&(n.miterLimit=t.miterLimit,e.miterLimit=t.miterLimit),n.strokeStyle!=t.strokeStyle&&(n.strokeStyle=t.strokeStyle,e.strokeStyle=t.strokeStyle)):(e.lineCap=t.lineCap,e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset,e.lineJoin=t.lineJoin,e.lineWidth=t.lineWidth,e.miterLimit=t.miterLimit,e.strokeStyle=t.strokeStyle,this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})}setContextTextState_(t){const e=this.context_,n=this.contextTextState_,s=t.textAlign?t.textAlign:Vi;n?(n.font!=t.font&&(n.font=t.font,e.font=t.font),n.textAlign!=s&&(n.textAlign=s,e.textAlign=s),n.textBaseline!=t.textBaseline&&(n.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=s,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:s,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(!t)this.fillState_=null;else{const n=t.getColor();this.fillState_={fillStyle:me(n||At)}}if(!e)this.strokeState_=null;else{const n=e.getColor(),s=e.getLineCap(),r=e.getLineDash(),o=e.getLineDashOffset(),a=e.getLineJoin(),l=e.getWidth(),h=e.getMiterLimit(),c=r||Le;this.strokeState_={lineCap:s!==void 0?s:qn,lineDash:this.pixelRatio_===1?c:c.map(u=>u*this.pixelRatio_),lineDashOffset:(o||Pe)*this.pixelRatio_,lineJoin:a!==void 0?a:Jn,lineWidth:(l!==void 0?l:Ui)*this.pixelRatio_,miterLimit:h!==void 0?h:Yi,strokeStyle:me(n||Wi)}}}setImageStyle(t){let e;if(!t||!(e=t.getSize())){this.image_=null;return}const n=t.getPixelRatio(this.pixelRatio_),s=t.getAnchor(),r=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=s[0]*n,this.imageAnchorY_=s[1]*n,this.imageHeight_=e[1]*n,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=r[0],this.imageOriginY_=r[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const o=t.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/n,o[1]*this.pixelRatio_/n],this.imageWidth_=e[0]*n}setTextStyle(t){if(!t)this.text_="";else{const e=t.getFill();if(!e)this.textFillState_=null;else{const f=e.getColor();this.textFillState_={fillStyle:me(f||At)}}const n=t.getStroke();if(!n)this.textStrokeState_=null;else{const f=n.getColor(),g=n.getLineCap(),_=n.getLineDash(),m=n.getLineDashOffset(),p=n.getLineJoin(),y=n.getWidth(),C=n.getMiterLimit();this.textStrokeState_={lineCap:g!==void 0?g:qn,lineDash:_||Le,lineDashOffset:m||Pe,lineJoin:p!==void 0?p:Jn,lineWidth:y!==void 0?y:Ui,miterLimit:C!==void 0?C:Yi,strokeStyle:me(f||Wi)}}const s=t.getFont(),r=t.getOffsetX(),o=t.getOffsetY(),a=t.getRotateWithView(),l=t.getRotation(),h=t.getScaleArray(),c=t.getText(),u=t.getTextAlign(),d=t.getTextBaseline();this.textState_={font:s!==void 0?s:gh,textAlign:u!==void 0?u:Vi,textBaseline:d!==void 0?d:Ys},this.text_=c!==void 0?Array.isArray(c)?c.reduce((f,g,_)=>f+=_%2?" ":g,""):c:"",this.textOffsetX_=r!==void 0?this.pixelRatio_*r:0,this.textOffsetY_=o!==void 0?this.pixelRatio_*o:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*h[0],this.pixelRatio_*h[1]]}}}const Cg=Eg,ye=.5;function wg(i,t,e,n,s,r,o,a,l){const h=l?ho(s):s,c=i[0]*ye,u=i[1]*ye,d=ft(c,u);d.imageSmoothingEnabled=!1;const f=d.canvas,g=new Cg(d,ye,s,null,o,a,l?ks(rf(),l):null),_=e.length,m=Math.floor((256*256*256-1)/_),p={};for(let C=1;C<=_;++C){const E=e[C-1],w=E.getStyleFunction()||n;if(!w)continue;let T=w(E,r);if(!T)continue;Array.isArray(T)||(T=[T]);const R=(C*m).toString(16).padStart(7,"#00000");for(let I=0,b=T.length;I<b;++I){const O=T[I],D=O.getGeometryFunction()(E);if(!D||!Ct(h,D.getExtent()))continue;const P=O.clone(),A=P.getFill();A&&A.setColor(R);const W=P.getStroke();W&&(W.setColor(R),W.setLineDash(null)),P.setText(void 0);const N=O.getImage();if(N){const H=N.getImageSize();if(!H)continue;const nt=ft(H[0],H[1],void 0,{alpha:!1}),L=nt.canvas;nt.fillStyle=R,nt.fillRect(0,0,L.width,L.height),P.setImage(new No({img:L,anchor:N.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:N.getOrigin(),opacity:1,size:N.getSize(),scale:N.getScale(),rotation:N.getRotation(),rotateWithView:N.getRotateWithView()}))}const B=P.getZIndex()||0;let k=p[B];k||(k={},p[B]=k,k.Polygon=[],k.Circle=[],k.LineString=[],k.Point=[]);const U=D.getType();if(U==="GeometryCollection"){const H=D.getGeometriesArrayRecursive();for(let nt=0,L=H.length;nt<L;++nt){const It=H[nt];k[It.getType().replace("Multi","")].push(It,P)}}else k[U.replace("Multi","")].push(D,P)}}const y=Object.keys(p).map(Number).sort(Re);for(let C=0,E=y.length;C<E;++C){const w=p[y[C]];for(const T in w){const v=w[T];for(let R=0,I=v.length;R<I;R+=2){g.setStyle(v[R+1]);for(let b=0,O=t.length;b<O;++b)g.setTransform(t[b]),g.drawGeometry(v[R])}}}return d.getImageData(0,0,f.width,f.height)}function vg(i,t,e){const n=[];if(e){const s=Math.floor(Math.round(i[0])*ye),r=Math.floor(Math.round(i[1])*ye),o=(rt(s,0,e.width-1)+rt(r,0,e.height-1)*e.width)*4,a=e.data[o],l=e.data[o+1],c=e.data[o+2]+256*(l+256*a),u=Math.floor((256*256*256-1)/t.length);c&&c%u===0&&n.push(t[c/u-1])}return n}const Rg=.5,kh={Point:Ag,LineString:Pg,Polygon:Dg,MultiPoint:Og,MultiLineString:bg,MultiPolygon:Mg,GeometryCollection:Lg,Circle:Sg};function Tg(i,t){return parseInt(q(i),10)-parseInt(q(t),10)}function Nh(i,t){const e=Gh(i,t);return e*e}function Gh(i,t){return Rg*i/t}function Sg(i,t,e,n,s){const r=e.getFill(),o=e.getStroke();if(r||o){const l=i.getBuilder(e.getZIndex(),"Circle");l.setFillStrokeStyle(r,o),l.drawCircle(t,n,s)}const a=e.getText();if(a&&a.getText()){const l=i.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,n)}}function zh(i,t,e,n,s,r,o,a){const l=[],h=e.getImage();if(h){let d=!0;const f=h.getImageState();f==M.LOADED||f==M.ERROR?d=!1:f==M.IDLE&&h.load(),d&&l.push(h.ready())}const c=e.getFill();c&&c.loading()&&l.push(c.ready());const u=l.length>0;return u&&Promise.all(l).then(()=>s(null)),Ig(i,t,e,n,r,o,a),u}function Ig(i,t,e,n,s,r,o){const a=e.getGeometryFunction()(t);if(!a)return;const l=a.simplifyTransformed(n,s);if(e.getRenderer())jh(i,l,e,t,o);else{const c=kh[l.getType()];c(i,l,e,t,o,r)}}function jh(i,t,e,n,s){if(t.getType()=="GeometryCollection"){const o=t.getGeometries();for(let a=0,l=o.length;a<l;++a)jh(i,o[a],e,n,s);return}i.getBuilder(e.getZIndex(),"Default").drawCustom(t,n,e.getRenderer(),e.getHitDetectionRenderer(),s)}function Lg(i,t,e,n,s,r){const o=t.getGeometriesArray();let a,l;for(a=0,l=o.length;a<l;++a){const h=kh[o[a].getType()];h(i,o[a],e,n,s,r)}}function Pg(i,t,e,n,s){const r=e.getStroke();if(r){const a=i.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,r),a.drawLineString(t,n,s)}const o=e.getText();if(o&&o.getText()){const a=i.getBuilder(e.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,n,s)}}function bg(i,t,e,n,s){const r=e.getStroke();if(r){const a=i.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,r),a.drawMultiLineString(t,n,s)}const o=e.getText();if(o&&o.getText()){const a=i.getBuilder(e.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,n,s)}}function Mg(i,t,e,n,s){const r=e.getFill(),o=e.getStroke();if(o||r){const l=i.getBuilder(e.getZIndex(),"Polygon");l.setFillStrokeStyle(r,o),l.drawMultiPolygon(t,n,s)}const a=e.getText();if(a&&a.getText()){const l=i.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,n,s)}}function Ag(i,t,e,n,s,r){const o=e.getImage(),a=e.getText(),l=a&&a.getText(),h=r&&o&&l?{}:void 0;if(o){if(o.getImageState()!=M.LOADED)return;const c=i.getBuilder(e.getZIndex(),"Image");c.setImageStyle(o,h),c.drawPoint(t,n,s)}if(l){const c=i.getBuilder(e.getZIndex(),"Text");c.setTextStyle(a,h),c.drawText(t,n,s)}}function Og(i,t,e,n,s,r){const o=e.getImage(),a=o&&o.getOpacity()!==0,l=e.getText(),h=l&&l.getText(),c=r&&a&&h?{}:void 0;if(a){if(o.getImageState()!=M.LOADED)return;const u=i.getBuilder(e.getZIndex(),"Image");u.setImageStyle(o,c),u.drawMultiPoint(t,n,s)}if(h){const u=i.getBuilder(e.getZIndex(),"Text");u.setTextStyle(l,c),u.drawText(t,n,s)}}function Dg(i,t,e,n,s){const r=e.getFill(),o=e.getStroke();if(r||o){const l=i.getBuilder(e.getZIndex(),"Polygon");l.setFillStrokeStyle(r,o),l.drawPolygon(t,n,s)}const a=e.getText();if(a&&a.getText()){const l=i.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,n,s)}}class Fg extends se{constructor(t,e,n,s){super(t),this.inversePixelTransform=e,this.frameState=n,this.context=s}}const Xh=Fg,kg=5;class Ng extends Bi{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.staleKeys_=new Array,this.maxStaleKeys=kg}getStaleKeys(){return this.staleKeys_}prependStaleKey(t){this.staleKeys_.unshift(t),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(t){return j()}getData(t){return null}prepareFrame(t){return j()}renderFrame(t,e){return j()}forEachFeatureAtCoordinate(t,e,n,s,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;(e.getState()===M.LOADED||e.getState()===M.ERROR)&&this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=M.LOADED&&e!=M.ERROR&&t.addEventListener(z.CHANGE,this.boundHandleImageChange_),e==M.IDLE&&(t.load(),e=t.getState()),e==M.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&t.getSourceState()==="ready"&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}}const Gg=Ng,Bh=[];let ei=null;function zg(){ei=ft(1,1,void 0,{willReadFrequently:!0})}class jg extends Gg{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=re(),this.pixelTransform=re(),this.inversePixelTransform=re(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,n){ei||zg(),ei.clearRect(0,0,1,1);let s;try{ei.drawImage(t,e,n,1,1,0,0,1,1),s=ei.getImageData(0,0,1,1).data}catch{return ei=null,null}return s}getBackground(t){let n=this.getLayer().getBackground();return typeof n=="function"&&(n=n(t.viewState.resolution)),n||void 0}useContainer(t,e,n){const s=this.getLayer().getClassName();let r,o;if(t&&t.className===s&&(!n||t&&t.style.backgroundColor&&Be(Kn(t.style.backgroundColor),Kn(n)))){const a=t.firstElementChild;Ve(a)&&(o=a.getContext("2d"))}if(o&&eg(o.canvas.style.transform,e)?(this.container=t,this.context=o,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){r=Bt?zl():document.createElement("div"),r.className=s;let a=r.style;a.position="absolute",a.width="100%",a.height="100%",o=ft();const l=o.canvas;r.appendChild(l),a=l.style,a.position="absolute",a.left="0",a.transformOrigin="top left",this.container=r,this.context=o}!this.containerReused&&n&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=n)}clipUnrotated(t,e,n){const s=Ye(n),r=bi(n),o=Pi(n),a=jn(n);gt(e.coordinateToPixelTransform,s),gt(e.coordinateToPixelTransform,r),gt(e.coordinateToPixelTransform,o),gt(e.coordinateToPixelTransform,a);const l=this.inversePixelTransform;gt(l,s),gt(l,r),gt(l,o),gt(l,a),t.save(),t.beginPath(),t.moveTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.lineTo(Math.round(a[0]),Math.round(a[1])),t.clip()}prepareContainer(t,e){const n=t.extent,s=t.viewState.resolution,r=t.viewState.rotation,o=t.pixelRatio,a=Math.round(K(n)/s*o),l=Math.round(ct(n)/s*o);pe(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/o,1/o,r,-a/2,-l/2),wh(this.inversePixelTransform,this.pixelTransform);const h=tg(this.pixelTransform);if(this.useContainer(e,h,this.getBackground(t)),!this.containerReused){const c=this.context.canvas;c.width!=a||c.height!=l?(c.width=a,c.height=l):this.context.clearRect(0,0,a,l),h!==c.style.transform&&(c.style.transform=h)}}dispatchRenderEvent_(t,e,n){const s=this.getLayer();if(s.hasListener(t)){const r=new Xh(t,this.inversePixelTransform,n,e);s.dispatchEvent(r)}}preRender(t,e){this.frameState=e,!e.declutter&&this.dispatchRenderEvent_(Vt.PRERENDER,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(Vt.POSTRENDER,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new vh),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(Vt.PRERENDER,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(Vt.POSTRENDER,this.context,t))}getRenderTransform(t,e,n,s,r,o,a){const l=r/2,h=o/2,c=s/e,u=-c,d=-t[0]+a,f=-t[1];return pe(this.tempTransform,l,h,c,u,-n,d,f)}disposeInternal(){delete this.frameState,super.disposeInternal()}}const Xo=jg;class Xg extends Xo{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipped_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=Mt(),this.wrappedRenderedExtent_=Mt(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(t,e,n){const s=e.extent,r=e.viewState,o=r.center,a=r.resolution,l=r.projection,h=r.rotation,c=l.getExtent(),u=this.getLayer().getSource(),d=this.getLayer().getDeclutter(),f=e.pixelRatio,g=e.viewHints,_=!(g[st.ANIMATING]||g[st.INTERACTING]),m=this.context,p=Math.round(K(s)/a*f),y=Math.round(ct(s)/a*f),C=u.getWrapX()&&l.canWrapX(),E=C?K(c):null,w=C?Math.ceil((s[2]-c[2])/E)+1:1;let T=C?Math.floor((s[0]-c[0])/E):0;do{let v=this.getRenderTransform(o,a,0,f,p,y,T*E);e.declutter&&(v=v.slice(0)),t.execute(m,[m.canvas.width,m.canvas.height],v,h,_,n===void 0?En:n?Sh:lg,n?d&&e.declutter[d]:void 0)}while(++T<w)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=ft(this.context.canvas.width,this.context.canvas.height,Bh))}resetDrawContext_(){if(this.opacity_!==1&&this.targetContext_){const t=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=t,bs(this.context),Bh.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(t){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,t,!0)}renderDeferredInternal(t){this.replayGroup_&&(this.replayGroup_.renderDeferred(),this.clipped_&&this.context.restore(),this.resetDrawContext_())}renderFrame(t,e){const n=t.layerStatesArray[t.layerIndex];this.opacity_=n.opacity;const s=t.viewState;this.prepareContainer(t,e);const r=this.context,o=this.replayGroup_;let a=o&&!o.isEmpty();if(!a&&!(this.getLayer().hasListener(Vt.PRERENDER)||this.getLayer().hasListener(Vt.POSTRENDER)))return this.container;if(this.setDrawContext_(),this.preRender(r,t),s.projection,this.clipped_=!1,a&&n.extent&&this.clipping){const l=_e(n.extent);a=Ct(l,t.extent),this.clipped_=a&&!fe(l,t.extent),this.clipped_&&this.clipUnrotated(r,t,l)}return a&&this.renderWorlds(o,t,this.getLayer().getDeclutter()?!1:void 0),!t.declutter&&this.clipped_&&r.restore(),this.postRender(r,t),this.renderedRotation_!==s.rotation&&(this.renderedRotation_=s.rotation,this.hitDetectionImageData_=null),t.declutter||this.resetDrawContext_(),this.container}getFeatures(t){return new Promise(e=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const n=this.frameState.size.slice(),s=this.renderedCenter_,r=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,h=this.getLayer(),c=[],u=n[0]*ye,d=n[1]*ye;c.push(this.getRenderTransform(s,r,o,ye,u,d,0).slice());const f=h.getSource(),g=a.getExtent();if(f.getWrapX()&&a.canWrapX()&&!fe(g,l)){let _=l[0];const m=K(g);let p=0,y;for(;_<g[0];)--p,y=m*p,c.push(this.getRenderTransform(s,r,o,ye,u,d,y).slice()),_+=m;for(p=0,_=l[2];_>g[2];)++p,y=m*p,c.push(this.getRenderTransform(s,r,o,ye,u,d,y).slice()),_-=m}this.hitDetectionImageData_=wg(n,c,this.renderedFeatures_,h.getStyleFunction(),l,r,o,Nh(r,this.renderedPixelRatio_),null)}e(vg(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,n,s,r){var d,f;if(!this.replayGroup_)return;const o=e.viewState.resolution,a=e.viewState.rotation,l=this.getLayer(),h={},c=function(g,_,m){const p=q(g),y=h[p];if(y){if(y!==!0&&m<y.distanceSq){if(m===0)return h[p]=!0,r.splice(r.lastIndexOf(y),1),s(g,l,_);y.geometry=_,y.distanceSq=m}}else{if(m===0)return h[p]=!0,s(g,l,_);r.push(h[p]={feature:g,layer:l,geometry:_,distanceSq:m,callback:s})}},u=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,o,a,n,c,u?(f=(d=e.declutter)==null?void 0:d[u])==null?void 0:f.all().map(g=>g.value):null)}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),n=e.getSource();if(!n)return!1;const s=t.viewHints[st.ANIMATING],r=t.viewHints[st.INTERACTING],o=e.getUpdateWhileAnimating(),a=e.getUpdateWhileInteracting();if(this.ready&&!o&&s||!a&&r)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const l=t.extent,h=t.viewState,c=h.projection,u=h.resolution,d=t.pixelRatio,f=e.getRevision(),g=e.getRenderBuffer();let _=e.getRenderOrder();_===void 0&&(_=Tg);const m=h.center.slice(),p=Gn(l,g*u),y=p.slice(),C=[p.slice()],E=c.getExtent();if(n.getWrapX()&&c.canWrapX()&&!fe(E,t.extent)){const A=K(E),W=Math.max(K(p)/2,A);p[0]=E[0]-W,p[2]=E[2]+W,Ol(m,c);const N=Tl(C[0],c);N[0]<E[0]&&N[2]<E[2]?C.push([N[0]+A,N[1],N[2]+A,N[3]]):N[0]>E[0]&&N[2]>E[2]&&C.push([N[0]-A,N[1],N[2]-A,N[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedRevision_==f&&this.renderedRenderOrder_==_&&this.renderedFrameDeclutter_===!!t.declutter&&fe(this.wrappedRenderedExtent_,p))return Be(this.renderedExtent_,y)||(this.hitDetectionImageData_=null,this.renderedExtent_=y),this.renderedCenter_=m,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const w=new $f(Gh(u,d),p,u,d);let T;for(let A=0,W=C.length;A<W;++A)n.loadFeatures(C[A],u,c);const v=Nh(u,d);let R=!0;const I=(A,W)=>{let N;const B=A.getStyleFunction()||e.getStyleFunction();if(B&&(N=B(A,u)),N){const k=this.renderFeature(A,v,N,w,T,this.getLayer().getDeclutter(),W);R=R&&!k}},b=ho(p),O=n.getFeaturesInExtent(b);_&&O.sort(_);for(let A=0,W=O.length;A<W;++A)I(O[A],A);this.renderedFeatures_=O,this.ready=R;const D=w.finish(),P=new ug(p,u,d,n.getOverlaps(),D,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=u,this.renderedRevision_=f,this.renderedRenderOrder_=_,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=y,this.wrappedRenderedExtent_=p,this.renderedCenter_=m,this.renderedProjection_=c,this.renderedPixelRatio_=d,this.replayGroup_=P,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,n,s,r,o,a){if(!n)return!1;let l=!1;if(Array.isArray(n))for(let h=0,c=n.length;h<c;++h)l=zh(s,t,n[h],e,this.boundHandleStyleImageChange_,r,o,a)||l;else l=zh(s,t,n,e,this.boundHandleStyleImageChange_,r,o,a);return l}}const Bg=Xg;function Yh(i,t,e=0,n=i.length-1,s=Yg){for(;n>e;){if(n-e>600){const l=n-e+1,h=t-e+1,c=Math.log(l),u=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*u*(l-u)/l)*(h-l/2<0?-1:1),f=Math.max(e,Math.floor(t-h*u/l+d)),g=Math.min(n,Math.floor(t+(l-h)*u/l+d));Yh(i,t,f,g,s)}const r=i[t];let o=e,a=n;for(Hi(i,e,t),s(i[n],r)>0&&Hi(i,e,n);o<a;){for(Hi(i,o,a),o++,a--;s(i[o],r)<0;)o++;for(;s(i[a],r)>0;)a--}s(i[e],r)===0?Hi(i,e,a):(a++,Hi(i,a,n)),a<=t&&(e=a+1),t<=a&&(n=a-1)}}function Hi(i,t,e){const n=i[t];i[t]=i[e],i[e]=n}function Yg(i,t){return i<t?-1:i>t?1:0}let Wh=class{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const n=[];if(!Hs(t,e))return n;const s=this.toBBox,r=[];for(;e;){for(let o=0;o<e.children.length;o++){const a=e.children[o],l=e.leaf?s(a):a;Hs(t,l)&&(e.leaf?n.push(a):Yo(t,l)?this._all(a,n):r.push(a))}e=r.pop()}return n}collides(t){let e=this.data;if(!Hs(t,e))return!1;const n=[];for(;e;){for(let s=0;s<e.children.length;s++){const r=e.children[s],o=e.leaf?this.toBBox(r):r;if(Hs(t,o)){if(e.leaf||Yo(t,o))return!0;n.push(r)}}e=n.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let n=0;n<t.length;n++)this.insert(t[n]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=e;else if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const n=this.data;this.data=e,e=n}this._insert(e,this.data.height-e.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=ii([]),this}remove(t,e){if(!t)return this;let n=this.data;const s=this.toBBox(t),r=[],o=[];let a,l,h;for(;n||r.length;){if(n||(n=r.pop(),l=r[r.length-1],a=o.pop(),h=!0),n.leaf){const c=Wg(t,n.children,e);if(c!==-1)return n.children.splice(c,1),r.push(n),this._condense(r),this}!h&&!n.leaf&&Yo(n,s)?(r.push(n),o.push(a),a=0,l=n,n=n.children[0]):l?(a++,n=l.children[a],h=!1):n=null}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const n=[];for(;t;)t.leaf?e.push(...t.children):n.push(...t.children),t=n.pop();return e}_build(t,e,n,s){const r=n-e+1;let o=this._maxEntries,a;if(r<=o)return a=ii(t.slice(e,n+1)),ni(a,this.toBBox),a;s||(s=Math.ceil(Math.log(r)/Math.log(o)),o=Math.ceil(r/Math.pow(o,s-1))),a=ii([]),a.leaf=!1,a.height=s;const l=Math.ceil(r/o),h=l*Math.ceil(Math.sqrt(o));Vh(t,e,n,h,this.compareMinX);for(let c=e;c<=n;c+=h){const u=Math.min(c+h-1,n);Vh(t,c,u,l,this.compareMinY);for(let d=c;d<=u;d+=l){const f=Math.min(d+l-1,u);a.children.push(this._build(t,d,f,s-1))}}return ni(a,this.toBBox),a}_chooseSubtree(t,e,n,s){for(;s.push(e),!(e.leaf||s.length-1===n);){let r=1/0,o=1/0,a;for(let l=0;l<e.children.length;l++){const h=e.children[l],c=Bo(h),u=Kg(t,h)-c;u<o?(o=u,r=c<r?c:r,a=h):u===o&&c<r&&(r=c,a=h)}e=a||e.children[0]}return e}_insert(t,e,n){const s=n?t:this.toBBox(t),r=[],o=this._chooseSubtree(s,this.data,e,r);for(o.children.push(t),Ji(o,s);e>=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(s,r,e)}_split(t,e){const n=t[e],s=n.children.length,r=this._minEntries;this._chooseSplitAxis(n,r,s);const o=this._chooseSplitIndex(n,r,s),a=ii(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,ni(n,this.toBBox),ni(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(n,a)}_splitRoot(t,e){this.data=ii([t,e]),this.data.height=t.height+1,this.data.leaf=!1,ni(this.data,this.toBBox)}_chooseSplitIndex(t,e,n){let s,r=1/0,o=1/0;for(let a=e;a<=n-e;a++){const l=qi(t,0,a,this.toBBox),h=qi(t,a,n,this.toBBox),c=$g(l,h),u=Bo(l)+Bo(h);c<r?(r=c,s=a,o=u<o?u:o):c===r&&u<o&&(o=u,s=a)}return s||n-e}_chooseSplitAxis(t,e,n){const s=t.leaf?this.compareMinX:Vg,r=t.leaf?this.compareMinY:Ug,o=this._allDistMargin(t,e,n,s),a=this._allDistMargin(t,e,n,r);o<a&&t.children.sort(s)}_allDistMargin(t,e,n,s){t.children.sort(s);const r=this.toBBox,o=qi(t,0,e,r),a=qi(t,n-e,n,r);let l=Zs(o)+Zs(a);for(let h=e;h<n-e;h++){const c=t.children[h];Ji(o,t.leaf?r(c):c),l+=Zs(o)}for(let h=n-e-1;h>=e;h--){const c=t.children[h];Ji(a,t.leaf?r(c):c),l+=Zs(a)}return l}_adjustParentBBoxes(t,e,n){for(let s=n;s>=0;s--)Ji(e[s],t)}_condense(t){for(let e=t.length-1,n;e>=0;e--)t[e].children.length===0?e>0?(n=t[e-1].children,n.splice(n.indexOf(t[e]),1)):this.clear():ni(t[e],this.toBBox)}};function Wg(i,t,e){if(!e)return t.indexOf(i);for(let n=0;n<t.length;n++)if(e(i,t[n]))return n;return-1}function ni(i,t){qi(i,0,i.children.length,t,i)}function qi(i,t,e,n,s){s||(s=ii(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(let r=t;r<e;r++){const o=i.children[r];Ji(s,i.leaf?n(o):o)}return s}function Ji(i,t){return i.minX=Math.min(i.minX,t.minX),i.minY=Math.min(i.minY,t.minY),i.maxX=Math.max(i.maxX,t.maxX),i.maxY=Math.max(i.maxY,t.maxY),i}function Vg(i,t){return i.minX-t.minX}function Ug(i,t){return i.minY-t.minY}function Bo(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function Zs(i){return i.maxX-i.minX+(i.maxY-i.minY)}function Kg(i,t){return(Math.max(t.maxX,i.maxX)-Math.min(t.minX,i.minX))*(Math.max(t.maxY,i.maxY)-Math.min(t.minY,i.minY))}function $g(i,t){const e=Math.max(i.minX,t.minX),n=Math.max(i.minY,t.minY),s=Math.min(i.maxX,t.maxX),r=Math.min(i.maxY,t.maxY);return Math.max(0,s-e)*Math.max(0,r-n)}function Yo(i,t){return i.minX<=t.minX&&i.minY<=t.minY&&t.maxX<=i.maxX&&t.maxY<=i.maxY}function Hs(i,t){return t.minX<=i.maxX&&t.minY<=i.maxY&&t.maxX>=i.minX&&t.maxY>=i.minY}function ii(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Vh(i,t,e,n,s){const r=[t,e];for(;r.length;){if(e=r.pop(),t=r.pop(),e-t<=n)continue;const o=t+Math.ceil((e-t)/n/2)*n;Yh(i,o,t,e,s),r.push(t,o,o,e)}}let wn=0;const Pt=1<<wn++,Z=1<<wn++,Dt=1<<wn++,oe=1<<wn++,vn=1<<wn++,Qi=1<<wn++,qs=Math.pow(2,wn)-1,Wo={[Pt]:"boolean",[Z]:"number",[Dt]:"string",[oe]:"color",[vn]:"number[]",[Qi]:"size"},Zg=Object.keys(Wo).map(Number).sort(Re);function Hg(i){return i in Wo}function ts(i){const t=[];for(const e of Zg)es(i,e)&&t.push(Wo[e]);return t.length===0?"untyped":t.length<3?t.join(" or "):t.slice(0,-1).join(", ")+", or "+t[t.length-1]}function es(i,t){return(i&t)===t}function tn(i,t){return i===t}class _t{constructor(t,e){if(!Hg(t))throw new Error(`literal expressions must have a specific type, got ${ts(t)}`);this.type=t,this.value=e}}class qg{constructor(t,e,...n){this.type=t,this.operator=e,this.args=n}}function Uh(){return{variables:new Set,properties:new Set,featureId:!1,geometryType:!1,mapState:!1}}function Et(i,t,e){switch(typeof i){case"boolean":{if(tn(t,Dt))return new _t(Dt,i?"true":"false");if(!es(t,Pt))throw new Error(`got a boolean, but expected ${ts(t)}`);return new _t(Pt,i)}case"number":{if(tn(t,Qi))return new _t(Qi,Ot(i));if(tn(t,Pt))return new _t(Pt,!!i);if(tn(t,Dt))return new _t(Dt,i.toString());if(!es(t,Z))throw new Error(`got a number, but expected ${ts(t)}`);return new _t(Z,i)}case"string":{if(tn(t,oe))return new _t(oe,yo(i));if(tn(t,Pt))return new _t(Pt,!!i);if(!es(t,Dt))throw new Error(`got a string, but expected ${ts(t)}`);return new _t(Dt,i)}}if(!Array.isArray(i))throw new Error("expression must be an array or a primitive value");if(i.length===0)throw new Error("empty expression");if(typeof i[0]=="string")return l_(i,t,e);for(const n of i)if(typeof n!="number")throw new Error("expected an array of numbers");if(tn(t,Qi)){if(i.length!==2)throw new Error(`expected an array of two values for a size, got ${i.length}`);return new _t(Qi,i)}if(tn(t,oe)){if(i.length===3)return new _t(oe,[...i,1]);if(i.length===4)return new _t(oe,i);throw new Error(`expected an array of 3 or 4 values for a color, got ${i.length}`)}if(!es(t,vn))throw new Error(`got an array of numbers, but expected ${ts(t)}`);return new _t(vn,i)}const S={Get:"get",Var:"var",Concat:"concat",GeometryType:"geometry-type",LineMetric:"line-metric",Any:"any",All:"all",Not:"!",Resolution:"resolution",Zoom:"zoom",Time:"time",Equal:"==",NotEqual:"!=",GreaterThan:">",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"},Jg={[S.Get]:X(Y(1,1/0),Kh),[S.Var]:X(Y(1,1),Qg),[S.Has]:X(Y(1,1/0),Kh),[S.Id]:X(t_,si),[S.Concat]:X(Y(2,1/0),Q(Dt)),[S.GeometryType]:X(e_,si),[S.LineMetric]:X(si),[S.Resolution]:X(Vo,si),[S.Zoom]:X(Vo,si),[S.Time]:X(Vo,si),[S.Any]:X(Y(2,1/0),Q(Pt)),[S.All]:X(Y(2,1/0),Q(Pt)),[S.Not]:X(Y(1,1),Q(Pt)),[S.Equal]:X(Y(2,2),Q(qs)),[S.NotEqual]:X(Y(2,2),Q(qs)),[S.GreaterThan]:X(Y(2,2),Q(Z)),[S.GreaterThanOrEqualTo]:X(Y(2,2),Q(Z)),[S.LessThan]:X(Y(2,2),Q(Z)),[S.LessThanOrEqualTo]:X(Y(2,2),Q(Z)),[S.Multiply]:X(Y(2,1/0),$h),[S.Coalesce]:X(Y(2,1/0),$h),[S.Divide]:X(Y(2,2),Q(Z)),[S.Add]:X(Y(2,1/0),Q(Z)),[S.Subtract]:X(Y(2,2),Q(Z)),[S.Clamp]:X(Y(3,3),Q(Z)),[S.Mod]:X(Y(2,2),Q(Z)),[S.Pow]:X(Y(2,2),Q(Z)),[S.Abs]:X(Y(1,1),Q(Z)),[S.Floor]:X(Y(1,1),Q(Z)),[S.Ceil]:X(Y(1,1),Q(Z)),[S.Round]:X(Y(1,1),Q(Z)),[S.Sin]:X(Y(1,1),Q(Z)),[S.Cos]:X(Y(1,1),Q(Z)),[S.Atan]:X(Y(1,2),Q(Z)),[S.Sqrt]:X(Y(1,1),Q(Z)),[S.Match]:X(Y(4,1/0),Zh,i_),[S.Between]:X(Y(3,3),Q(Z)),[S.Interpolate]:X(Y(6,1/0),Zh,s_),[S.Case]:X(Y(3,1/0),n_,r_),[S.In]:X(Y(2,2),o_),[S.Number]:X(Y(1,1/0),Q(qs)),[S.String]:X(Y(1,1/0),Q(qs)),[S.Array]:X(Y(1,1/0),Q(Z)),[S.Color]:X(Y(1,4),Q(Z)),[S.Band]:X(Y(1,3),Q(Z)),[S.Palette]:X(Y(2,2),a_),[S.ToString]:X(Y(1,1),Q(Pt|Z|Dt|oe))};function Kh(i,t,e){const n=i.length-1,s=new Array(n);for(let r=0;r<n;++r){const o=i[r+1];switch(typeof o){case"number":{s[r]=new _t(Z,o);break}case"string":{s[r]=new _t(Dt,o);break}default:throw new Error(`expected a string key or numeric array index for a get operation, got ${o}`)}r===0&&e.properties.add(String(o))}return s}function Qg(i,t,e){const n=i[1];if(typeof n!="string")throw new Error("expected a string argument for var operation");return e.variables.add(n),[new _t(Dt,n)]}function t_(i,t,e){e.featureId=!0}function e_(i,t,e){e.geometryType=!0}function Vo(i,t,e){e.mapState=!0}function si(i,t,e){const n=i[0];if(i.length!==1)throw new Error(`expected no arguments for ${n} operation`);return[]}function Y(i,t){return function(e,n,s){const r=e[0],o=e.length-1;if(i===t){if(o!==i){const a=i===1?"":"s";throw new Error(`expected ${i} argument${a} for ${r}, got ${o}`)}}else if(o<i||o>t){const a=t===1/0?`${i} or more`:`${i} to ${t}`;throw new Error(`expected ${a} arguments for ${r}, got ${o}`)}}}function $h(i,t,e){const n=i.length-1,s=new Array(n);for(let r=0;r<n;++r){const o=Et(i[r+1],t,e);s[r]=o}return s}function Q(i){return function(t,e,n){const s=t.length-1,r=new Array(s);for(let o=0;o<s;++o){const a=Et(t[o+1],i,n);r[o]=a}return r}}function n_(i,t,e){const n=i[0],s=i.length-1;if(s%2===0)throw new Error(`expected an odd number of arguments for ${n}, got ${s} instead`)}function Zh(i,t,e){const n=i[0],s=i.length-1;if(s%2===1)throw new Error(`expected an even number of arguments for operation ${n}, got ${s} instead`)}function i_(i,t,e){const n=i.length-1,s=Dt|Z|Pt,r=Et(i[1],s,e),o=Et(i[i.length-1],t,e),a=new Array(n-2);for(let l=0;l<n-2;l+=2){try{const h=Et(i[l+2],r.type,e);a[l]=h}catch(h){throw new Error(`failed to parse argument ${l+1} of match expression: ${h.message}`)}try{const h=Et(i[l+3],o.type,e);a[l+1]=h}catch(h){throw new Error(`failed to parse argument ${l+2} of match expression: ${h.message}`)}}return[r,...a,o]}function s_(i,t,e){const n=i[1];let s;switch(n[0]){case"linear":s=1;break;case"exponential":const l=n[1];if(typeof l!="number"||l<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(l)} instead`);s=l;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(n)}`)}const r=new _t(Z,s);let o;try{o=Et(i[2],Z,e)}catch(l){throw new Error(`failed to parse argument 1 in interpolate expression: ${l.message}`)}const a=new Array(i.length-3);for(let l=0;l<a.length;l+=2){try{const h=Et(i[l+3],Z,e);a[l]=h}catch(h){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${h.message}`)}try{const h=Et(i[l+4],t,e);a[l+1]=h}catch(h){throw new Error(`failed to parse argument ${l+3} for interpolate expression: ${h.message}`)}}return[r,o,...a]}function r_(i,t,e){const n=Et(i[i.length-1],t,e),s=new Array(i.length-1);for(let r=0;r<s.length-1;r+=2){try{const o=Et(i[r+1],Pt,e);s[r]=o}catch(o){throw new Error(`failed to parse argument ${r} of case expression: ${o.message}`)}try{const o=Et(i[r+2],n.type,e);s[r+1]=o}catch(o){throw new Error(`failed to parse argument ${r+1} of case expression: ${o.message}`)}}return s[s.length-1]=n,s}function o_(i,t,e){let n=i[2];if(!Array.isArray(n))throw new Error('the second argument for the "in" operator must be an array');let s;if(typeof n[0]=="string"){if(n[0]!=="literal")throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');if(!Array.isArray(n[1]))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array');n=n[1],s=Dt}else s=Z;const r=new Array(n.length);for(let a=0;a<r.length;a++)try{const l=Et(n[a],s,e);r[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[Et(i[1],s,e),...r]}function a_(i,t,e){let n;try{n=Et(i[1],Z,e)}catch(o){throw new Error(`failed to parse first argument in palette expression: ${o.message}`)}const s=i[2];if(!Array.isArray(s))throw new Error("the second argument of palette must be an array");const r=new Array(s.length);for(let o=0;o<r.length;o++){let a;try{a=Et(s[o],oe,e)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof _t))throw new Error(`the palette color at index ${o} must be a literal value`);r[o]=a}return[n,...r]}function X(...i){return function(t,e,n){const s=t[0];let r;for(let o=0;o<i.length;o++){const a=i[o](t,e,n);if(o==i.length-1){if(!a)throw new Error("expected last argument validator to return the parsed args");r=a}}return new qg(e,s,...r)}}function l_(i,t,e){const n=i[0],s=Jg[n];if(!s)throw new Error(`unknown operator: ${n}`);return s(i,t,e)}function Hh(i){if(!i)return"";const t=i.getType();switch(t){case"Point":case"LineString":case"Polygon":return t;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return t.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return Hh(i.getGeometries()[0]);default:return""}}function qh(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function Oe(i,t,e){const n=Et(i,t,e);return ae(n)}function ae(i,t){if(i instanceof _t){if(i.type===oe&&typeof i.value=="string"){const n=yo(i.value);return function(){return n}}return function(){return i.value}}const e=i.operator;switch(e){case S.Number:case S.String:case S.Coalesce:return h_(i);case S.Get:case S.Var:case S.Has:return c_(i);case S.Id:return n=>n.featureId;case S.GeometryType:return n=>n.geometryType;case S.Concat:{const n=i.args.map(s=>ae(s));return s=>"".concat(...n.map(r=>r(s).toString()))}case S.Resolution:return n=>n.resolution;case S.Any:case S.All:case S.Between:case S.In:case S.Not:return d_(i);case S.Equal:case S.NotEqual:case S.LessThan:case S.LessThanOrEqualTo:case S.GreaterThan:case S.GreaterThanOrEqualTo:return u_(i);case S.Multiply:case S.Divide:case S.Add:case S.Subtract:case S.Clamp:case S.Mod:case S.Pow:case S.Abs:case S.Floor:case S.Ceil:case S.Round:case S.Sin:case S.Cos:case S.Atan:case S.Sqrt:return f_(i);case S.Case:return g_(i);case S.Match:return __(i);case S.Interpolate:return m_(i);case S.ToString:return p_(i);default:throw new Error(`Unsupported operator ${e}`)}}function h_(i,t){const e=i.operator,n=i.args.length,s=new Array(n);for(let r=0;r<n;++r)s[r]=ae(i.args[r]);switch(e){case S.Coalesce:return r=>{for(let o=0;o<n;++o){const a=s[o](r);if(typeof a<"u"&&a!==null)return a}throw new Error("Expected one of the values to be non-null")};case S.Number:case S.String:return r=>{for(let o=0;o<n;++o){const a=s[o](r);if(typeof a===e)return a}throw new Error(`Expected one of the values to be a ${e}`)};default:throw new Error(`Unsupported assertion operator ${e}`)}}function c_(i,t){const n=i.args[0].value;switch(i.operator){case S.Get:return s=>{const r=i.args;let o=s.properties[n];for(let a=1,l=r.length;a<l;++a){const c=r[a].value;o=o[c]}return o};case S.Var:return s=>s.variables[n];case S.Has:return s=>{const r=i.args;if(!(n in s.properties))return!1;let o=s.properties[n];for(let a=1,l=r.length;a<l;++a){const c=r[a].value;if(!o||!Object.hasOwn(o,c))return!1;o=o[c]}return!0};default:throw new Error(`Unsupported accessor operator ${i.operator}`)}}function u_(i,t){const e=i.operator,n=ae(i.args[0]),s=ae(i.args[1]);switch(e){case S.Equal:return r=>n(r)===s(r);case S.NotEqual:return r=>n(r)!==s(r);case S.LessThan:return r=>n(r)<s(r);case S.LessThanOrEqualTo:return r=>n(r)<=s(r);case S.GreaterThan:return r=>n(r)>s(r);case S.GreaterThanOrEqualTo:return r=>n(r)>=s(r);default:throw new Error(`Unsupported comparison operator ${e}`)}}function d_(i,t){const e=i.operator,n=i.args.length,s=new Array(n);for(let r=0;r<n;++r)s[r]=ae(i.args[r]);switch(e){case S.Any:return r=>{for(let o=0;o<n;++o)if(s[o](r))return!0;return!1};case S.All:return r=>{for(let o=0;o<n;++o)if(!s[o](r))return!1;return!0};case S.Between:return r=>{const o=s[0](r),a=s[1](r),l=s[2](r);return o>=a&&o<=l};case S.In:return r=>{const o=s[0](r);for(let a=1;a<n;++a)if(o===s[a](r))return!0;return!1};case S.Not:return r=>!s[0](r);default:throw new Error(`Unsupported logical operator ${e}`)}}function f_(i,t){const e=i.operator,n=i.args.length,s=new Array(n);for(let r=0;r<n;++r)s[r]=ae(i.args[r]);switch(e){case S.Multiply:return r=>{let o=1;for(let a=0;a<n;++a)o*=s[a](r);return o};case S.Divide:return r=>s[0](r)/s[1](r);case S.Add:return r=>{let o=0;for(let a=0;a<n;++a)o+=s[a](r);return o};case S.Subtract:return r=>s[0](r)-s[1](r);case S.Clamp:return r=>{const o=s[0](r),a=s[1](r);if(o<a)return a;const l=s[2](r);return o>l?l:o};case S.Mod:return r=>s[0](r)%s[1](r);case S.Pow:return r=>Math.pow(s[0](r),s[1](r));case S.Abs:return r=>Math.abs(s[0](r));case S.Floor:return r=>Math.floor(s[0](r));case S.Ceil:return r=>Math.ceil(s[0](r));case S.Round:return r=>Math.round(s[0](r));case S.Sin:return r=>Math.sin(s[0](r));case S.Cos:return r=>Math.cos(s[0](r));case S.Atan:return n===2?r=>Math.atan2(s[0](r),s[1](r)):r=>Math.atan(s[0](r));case S.Sqrt:return r=>Math.sqrt(s[0](r));default:throw new Error(`Unsupported numeric operator ${e}`)}}function g_(i,t){const e=i.args.length,n=new Array(e);for(let s=0;s<e;++s)n[s]=ae(i.args[s]);return s=>{for(let r=0;r<e-1;r+=2)if(n[r](s))return n[r+1](s);return n[e-1](s)}}function __(i,t){const e=i.args.length,n=new Array(e);for(let s=0;s<e;++s)n[s]=ae(i.args[s]);return s=>{const r=n[0](s);for(let o=1;o<e-1;o+=2)if(r===n[o](s))return n[o+1](s);return n[e-1](s)}}function m_(i,t){const e=i.args.length,n=new Array(e);for(let s=0;s<e;++s)n[s]=ae(i.args[s]);return s=>{const r=n[0](s),o=n[1](s);let a,l;for(let h=2;h<e;h+=2){const c=n[h](s);let u=n[h+1](s);const d=Array.isArray(u);if(d&&(u=ff(u)),c>=o)return h===2?u:d?y_(r,o,a,l,c,u):ns(r,o,a,l,c,u);a=c,l=u}return l}}function p_(i,t){const e=i.operator,n=i.args.length,s=new Array(n);for(let r=0;r<n;++r)s[r]=ae(i.args[r]);switch(e){case S.ToString:return r=>{const o=s[0](r);return i.args[0].type===oe?xo(o):o.toString()};default:throw new Error(`Unsupported convert operator ${e}`)}}function ns(i,t,e,n,s,r){const o=s-e;if(o===0)return n;const a=t-e,l=i===1?a/o:(Math.pow(i,a)-1)/(Math.pow(i,o)-1);return n+l*(r-n)}function y_(i,t,e,n,s,r){if(s-e===0)return n;const a=rh(n),l=rh(r);let h=l[2]-a[2];h>180?h-=360:h<-180&&(h+=360);const c=[ns(i,t,e,a[0],s,l[0]),ns(i,t,e,a[1],s,l[1]),a[2]+ns(i,t,e,0,s,h),ns(i,t,e,n[3],s,r[3])];return gf(c)}function x_(i){return!0}function E_(i){const t=Uh(),e=C_(i,t),n=qh();return function(s,r){if(n.properties=s.getPropertiesInternal(),n.resolution=r,t.featureId){const o=s.getId();o!==void 0?n.featureId=o:n.featureId=null}return t.geometryType&&(n.geometryType=Hh(s.getGeometry())),e(n)}}function Jh(i){const t=Uh(),e=i.length,n=new Array(e);for(let o=0;o<e;++o)n[o]=Uo(i[o],t);const s=qh(),r=new Array(e);return function(o,a){if(s.properties=o.getPropertiesInternal(),s.resolution=a,t.featureId){const h=o.getId();h!==void 0?s.featureId=h:s.featureId=null}let l=0;for(let h=0;h<e;++h){const c=n[h](s);c&&(r[l]=c,l+=1)}return r.length=l,r}}function C_(i,t){const e=i.length,n=new Array(e);for(let s=0;s<e;++s){const r=i[s],o="filter"in r?Oe(r.filter,Pt,t):x_;let a;if(Array.isArray(r.style)){const l=r.style.length;a=new Array(l);for(let h=0;h<l;++h)a[h]=Uo(r.style[h],t)}else a=[Uo(r.style,t)];n[s]={filter:o,styles:a}}return function(s){const r=[];let o=!1;for(let a=0;a<e;++a){const l=n[a].filter;if(l(s)&&!(i[a].else&&o)){o=!0;for(const h of n[a].styles){const c=h(s);c&&r.push(c)}}}return r}}function Uo(i,t){const e=is(i,"",t),n=ss(i,"",t),s=w_(i,t),r=v_(i,t),o=Ft(i,"z-index",t);if(!e&&!n&&!s&&!r&&!gn(i))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(i));const a=new $t;return function(l){let h=!0;if(e){const c=e(l);c&&(h=!1),a.setFill(c)}if(n){const c=n(l);c&&(h=!1),a.setStroke(c)}if(s){const c=s(l);c&&(h=!1),a.setText(c)}if(r){const c=r(l);c&&(h=!1),a.setImage(c)}return o&&a.setZIndex(o(l)),h?null:a}}function is(i,t,e){let n;if(t+"fill-pattern-src"in i)n=I_(i,t+"fill-",e);else{if(i[t+"fill-color"]==="none")return r=>null;n=Ko(i,t+"fill-color",e)}if(!n)return null;const s=new wt;return function(r){const o=n(r);return o===co?null:(s.setColor(o),s)}}function ss(i,t,e){const n=Ft(i,t+"stroke-width",e),s=Ko(i,t+"stroke-color",e);if(!n&&!s)return null;const r=De(i,t+"stroke-line-cap",e),o=De(i,t+"stroke-line-join",e),a=Qh(i,t+"stroke-line-dash",e),l=Ft(i,t+"stroke-line-dash-offset",e),h=Ft(i,t+"stroke-miter-limit",e),c=new Ae;return function(u){if(s){const d=s(u);if(d===co)return null;c.setColor(d)}if(n&&c.setWidth(n(u)),r){const d=r(u);if(d!=="butt"&&d!=="round"&&d!=="square")throw new Error("Expected butt, round, or square line cap");c.setLineCap(d)}if(o){const d=o(u);if(d!=="bevel"&&d!=="round"&&d!=="miter")throw new Error("Expected bevel, round, or miter line join");c.setLineJoin(d)}return a&&c.setLineDash(a(u)),l&&c.setLineDashOffset(l(u)),h&&c.setMiterLimit(h(u)),c}}function w_(i,t){const e="text-",n=De(i,e+"value",t);if(!n)return null;const s=is(i,e,t),r=is(i,e+"background-",t),o=ss(i,e,t),a=ss(i,e+"background-",t),l=De(i,e+"font",t),h=Ft(i,e+"max-angle",t),c=Ft(i,e+"offset-x",t),u=Ft(i,e+"offset-y",t),d=ri(i,e+"overflow",t),f=De(i,e+"placement",t),g=Ft(i,e+"repeat",t),_=Qs(i,e+"scale",t),m=ri(i,e+"rotate-with-view",t),p=Ft(i,e+"rotation",t),y=De(i,e+"align",t),C=De(i,e+"justify",t),E=De(i,e+"baseline",t),w=ri(i,e+"keep-upright",t),T=Qh(i,e+"padding",t),v=er(i,e+"declutter-mode"),R=new Oh({declutterMode:v});return function(I){if(R.setText(n(I)),s&&R.setFill(s(I)),r&&R.setBackgroundFill(r(I)),o&&R.setStroke(o(I)),a&&R.setBackgroundStroke(a(I)),l&&R.setFont(l(I)),h&&R.setMaxAngle(h(I)),c&&R.setOffsetX(c(I)),u&&R.setOffsetY(u(I)),d&&R.setOverflow(d(I)),f){const b=f(I);if(b!=="point"&&b!=="line")throw new Error("Expected point or line for text-placement");R.setPlacement(b)}if(g&&R.setRepeat(g(I)),_&&R.setScale(_(I)),m&&R.setRotateWithView(m(I)),p&&R.setRotation(p(I)),y){const b=y(I);if(b!=="left"&&b!=="center"&&b!=="right"&&b!=="end"&&b!=="start")throw new Error("Expected left, right, center, start, or end for text-align");R.setTextAlign(b)}if(C){const b=C(I);if(b!=="left"&&b!=="right"&&b!=="center")throw new Error("Expected left, right, or center for text-justify");R.setJustify(b)}if(E){const b=E(I);if(b!=="bottom"&&b!=="top"&&b!=="middle"&&b!=="alphabetic"&&b!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");R.setTextBaseline(b)}return T&&R.setPadding(T(I)),w&&R.setKeepUpright(w(I)),R}}function v_(i,t){return"icon-src"in i?R_(i,t):"shape-points"in i?T_(i,t):"circle-radius"in i?S_(i,t):null}function R_(i,t){const e="icon-",n=e+"src",s=ic(i[n],n),r=Js(i,e+"anchor",t),o=Qs(i,e+"scale",t),a=Ft(i,e+"opacity",t),l=Js(i,e+"displacement",t),h=Ft(i,e+"rotation",t),c=ri(i,e+"rotate-with-view",t),u=ec(i,e+"anchor-origin"),d=nc(i,e+"anchor-x-units"),f=nc(i,e+"anchor-y-units"),g=M_(i,e+"color"),_=P_(i,e+"cross-origin"),m=b_(i,e+"offset"),p=ec(i,e+"offset-origin"),y=tr(i,e+"width"),C=tr(i,e+"height"),E=L_(i,e+"size"),w=er(i,e+"declutter-mode"),T=new No({src:s,anchorOrigin:u,anchorXUnits:d,anchorYUnits:f,color:g,crossOrigin:_,offset:m,offsetOrigin:p,height:C,width:y,size:E,declutterMode:w});return function(v){return a&&T.setOpacity(a(v)),l&&T.setDisplacement(l(v)),h&&T.setRotation(h(v)),c&&T.setRotateWithView(c(v)),o&&T.setScale(o(v)),r&&T.setAnchor(r(v)),T}}function T_(i,t){const e="shape-",n=e+"points",s=e+"radius",r=$o(i[n],n),o=$o(i[s],s),a=is(i,e,t),l=ss(i,e,t),h=Qs(i,e+"scale",t),c=Js(i,e+"displacement",t),u=Ft(i,e+"rotation",t),d=ri(i,e+"rotate-with-view",t),f=tr(i,e+"radius2"),g=tr(i,e+"angle"),_=er(i,e+"declutter-mode"),m=new Ph({points:r,radius:o,radius2:f,angle:g,declutterMode:_});return function(p){return a&&m.setFill(a(p)),l&&m.setStroke(l(p)),c&&m.setDisplacement(c(p)),u&&m.setRotation(u(p)),d&&m.setRotateWithView(d(p)),h&&m.setScale(h(p)),m}}function S_(i,t){const e="circle-",n=is(i,e,t),s=ss(i,e,t),r=Ft(i,e+"radius",t),o=Qs(i,e+"scale",t),a=Js(i,e+"displacement",t),l=Ft(i,e+"rotation",t),h=ri(i,e+"rotate-with-view",t),c=er(i,e+"declutter-mode"),u=new Ks({radius:5,declutterMode:c});return function(d){return r&&u.setRadius(r(d)),n&&u.setFill(n(d)),s&&u.setStroke(s(d)),a&&u.setDisplacement(a(d)),l&&u.setRotation(l(d)),h&&u.setRotateWithView(h(d)),o&&u.setScale(o(d)),u}}function Ft(i,t,e){if(!(t in i))return;const n=Oe(i[t],Z,e);return function(s){return $o(n(s),t)}}function De(i,t,e){if(!(t in i))return null;const n=Oe(i[t],Dt,e);return function(s){return ic(n(s),t)}}function I_(i,t,e){const n=De(i,t+"pattern-src",e),s=tc(i,t+"pattern-offset",e),r=tc(i,t+"pattern-size",e),o=Ko(i,t+"color",e);return function(a){return{src:n(a),offset:s&&s(a),size:r&&r(a),color:o&&o(a)}}}function ri(i,t,e){if(!(t in i))return null;const n=Oe(i[t],Pt,e);return function(s){const r=n(s);if(typeof r!="boolean")throw new Error(`Expected a boolean for ${t}`);return r}}function Ko(i,t,e){if(!(t in i))return null;const n=Oe(i[t],oe,e);return function(s){return sc(n(s),t)}}function Qh(i,t,e){if(!(t in i))return null;const n=Oe(i[t],vn,e);return function(s){return rs(n(s),t)}}function Js(i,t,e){if(!(t in i))return null;const n=Oe(i[t],vn,e);return function(s){const r=rs(n(s),t);if(r.length!==2)throw new Error(`Expected two numbers for ${t}`);return r}}function tc(i,t,e){if(!(t in i))return null;const n=Oe(i[t],vn,e);return function(s){return rc(n(s),t)}}function Qs(i,t,e){if(!(t in i))return null;const n=Oe(i[t],vn|Z,e);return function(s){return A_(n(s),t)}}function tr(i,t){const e=i[t];if(e!==void 0){if(typeof e!="number")throw new Error(`Expected a number for ${t}`);return e}}function L_(i,t){const e=i[t];if(e!==void 0){if(typeof e=="number")return Ot(e);if(!Array.isArray(e))throw new Error(`Expected a number or size array for ${t}`);if(e.length!==2||typeof e[0]!="number"||typeof e[1]!="number")throw new Error(`Expected a number or size array for ${t}`);return e}}function P_(i,t){const e=i[t];if(e!==void 0){if(typeof e!="string")throw new Error(`Expected a string for ${t}`);return e}}function ec(i,t){const e=i[t];if(e!==void 0){if(e!=="bottom-left"&&e!=="bottom-right"&&e!=="top-left"&&e!=="top-right")throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${t}`);return e}}function nc(i,t){const e=i[t];if(e!==void 0){if(e!=="pixels"&&e!=="fraction")throw new Error(`Expected pixels or fraction for ${t}`);return e}}function b_(i,t){const e=i[t];if(e!==void 0)return rs(e,t)}function er(i,t){const e=i[t];if(e!==void 0){if(typeof e!="string")throw new Error(`Expected a string for ${t}`);if(e!=="declutter"&&e!=="obstacle"&&e!=="none")throw new Error(`Expected declutter, obstacle, or none for ${t}`);return e}}function M_(i,t){const e=i[t];if(e!==void 0)return sc(e,t)}function rs(i,t){if(!Array.isArray(i))throw new Error(`Expected an array for ${t}`);const e=i.length;for(let n=0;n<e;++n)if(typeof i[n]!="number")throw new Error(`Expected an array of numbers for ${t}`);return i}function ic(i,t){if(typeof i!="string")throw new Error(`Expected a string for ${t}`);return i}function $o(i,t){if(typeof i!="number")throw new Error(`Expected a number for ${t}`);return i}function sc(i,t){if(typeof i=="string")return i;const e=rs(i,t),n=e.length;if(n<3||n>4)throw new Error(`Expected a color with 3 or 4 values for ${t}`);return e}function rc(i,t){const e=rs(i,t);if(e.length!==2)throw new Error(`Expected an array of two numbers for ${t}`);return e}function A_(i,t){return typeof i=="number"?i:rc(i,t)}const le={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function oc(i,t,e){return function(n,s,r,o,a){if(!n)return;if(!s&&!t)return n;const l=t?0:r[0]*s,h=t?0:r[1]*s,c=a?a[0]:0,u=a?a[1]:0;let d=i[0]+l/2+c,f=i[2]-l/2+c,g=i[1]+h/2+u,_=i[3]-h/2+u;d>f&&(d=(f+d)/2,f=d),g>_&&(g=(_+g)/2,_=g);let m=rt(n[0],d,f),p=rt(n[1],g,_);if(o&&e&&s){const y=30*s;m+=-y*Math.log(1+Math.max(0,d-n[0])/y)+y*Math.log(1+Math.max(0,n[0]-f)/y),p+=-y*Math.log(1+Math.max(0,g-n[1])/y)+y*Math.log(1+Math.max(0,n[1]-_)/y)}return[m,p]}}function O_(i){return i}function ac(i){return Math.pow(i,3)}function Rn(i){return 1-ac(1-i)}function Zo(i){return 3*i*i-2*i*i*i}function D_(i){return i}function lc(i,t,e,n){let s=0;const r=i[e-n],o=i[e-n+1];let a=0,l=0;for(;t<e;t+=n){const h=i[t]-r,c=i[t+1]-o;s+=l*h-a*c,a=h,l=c}return s/2}function hc(i,t,e,n){let s=0;for(let r=0,o=e.length;r<o;++r){const a=e[r];s+=lc(i,t,a,n),t=a}return s}function F_(i,t,e,n){let s=0;for(let r=0,o=e.length;r<o;++r){const a=e[r];s+=hc(i,t,a,n),t=a[a.length-1]}return s}function cc(i,t,e,n,s,r,o){const a=i[t],l=i[t+1],h=i[e]-a,c=i[e+1]-l;let u;if(h===0&&c===0)u=t;else{const d=((s-a)*h+(r-l)*c)/(h*h+c*c);if(d>1)u=e;else if(d>0){for(let f=0;f<n;++f)o[f]=Gt(i[t+f],i[e+f],d);o.length=n;return}else u=t}for(let d=0;d<n;++d)o[d]=i[u+d];o.length=n}function Ho(i,t,e,n,s){let r=i[t],o=i[t+1];for(t+=n;t<e;t+=n){const a=i[t],l=i[t+1],h=Ie(r,o,a,l);h>s&&(s=h),r=a,o=l}return s}function qo(i,t,e,n,s){for(let r=0,o=e.length;r<o;++r){const a=e[r];s=Ho(i,t,a,n,s),t=a}return s}function k_(i,t,e,n,s){for(let r=0,o=e.length;r<o;++r){const a=e[r];s=qo(i,t,a,n,s),t=a[a.length-1]}return s}function Jo(i,t,e,n,s,r,o,a,l,h,c){if(t==e)return h;let u,d;if(s===0){if(d=Ie(o,a,i[t],i[t+1]),d<h){for(u=0;u<n;++u)l[u]=i[t+u];return l.length=n,d}return h}c=c||[NaN,NaN];let f=t+n;for(;f<e;)if(cc(i,f-n,f,n,o,a,c),d=Ie(o,a,c[0],c[1]),d<h){for(h=d,u=0;u<n;++u)l[u]=c[u];l.length=n,f+=n}else f+=n*Math.max((Math.sqrt(d)-Math.sqrt(h))/s|0,1);if(r&&(cc(i,e-n,t,n,o,a,c),d=Ie(o,a,c[0],c[1]),d<h)){for(h=d,u=0;u<n;++u)l[u]=c[u];l.length=n}return h}function Qo(i,t,e,n,s,r,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,d=e.length;u<d;++u){const f=e[u];h=Jo(i,t,f,n,s,r,o,a,l,h,c),t=f}return h}function N_(i,t,e,n,s,r,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,d=e.length;u<d;++u){const f=e[u];h=Qo(i,t,f,n,s,r,o,a,l,h,c),t=f[f.length-1]}return h}function uc(i,t,e,n){for(let s=0,r=e.length;s<r;++s)i[t++]=e[s];return t}function nr(i,t,e,n){for(let s=0,r=e.length;s<r;++s){const o=e[s];for(let a=0;a<n;++a)i[t++]=o[a]}return t}function os(i,t,e,n,s){s=s||[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=nr(i,t,e[o],n);s[r++]=l,t=l}return s.length=r,s}function dc(i,t,e,n,s){s=s||[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=os(i,t,e[o],n,s[r]);l.length===0&&(l[0]=t),s[r++]=l,t=l[l.length-1]}return s.length=r,s}class ir extends Qe{constructor(t,e){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,e!==void 0&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}clone(){return new ir(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,n,s){return s<hn(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Ho(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Jo(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,n,s))}getArea(){return lc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Ke(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=Vs(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new ir(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=nr(this.flatCoordinates,0,t,this.stride),this.changed()}}const fc=ir;class ta extends Qe{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new ta(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,n,s){const r=this.flatCoordinates,o=Ie(t,e,r[0],r[1]);if(o<s){const a=this.stride;for(let l=0;l<a;++l)n[l]=r[l];return n.length=a,o}return s}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return Wr(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return Br(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=uc(this.flatCoordinates,0,t,this.stride),this.changed()}}const he=ta;function G_(i,t,e,n,s){return!Ur(s,function(o){return!Tn(i,t,e,n,o[0],o[1])})}function Tn(i,t,e,n,s,r){let o=0,a=i[e-n],l=i[e-n+1];for(;t<e;t+=n){const h=i[t],c=i[t+1];l<=r?c>r&&(h-a)*(r-l)-(s-a)*(c-l)>0&&o++:c<=r&&(h-a)*(r-l)-(s-a)*(c-l)<0&&o--,a=h,l=c}return o!==0}function ea(i,t,e,n,s,r){if(e.length===0||!Tn(i,t,e[0],n,s,r))return!1;for(let o=1,a=e.length;o<a;++o)if(Tn(i,e[o-1],e[o],n,s,r))return!1;return!0}function z_(i,t,e,n,s,r){if(e.length===0)return!1;for(let o=0,a=e.length;o<a;++o){const l=e[o];if(ea(i,t,l,n,s,r))return!0;t=l[l.length-1]}return!1}function na(i,t,e,n,s,r,o){let a,l,h,c,u,d,f;const g=s[r+1],_=[];for(let y=0,C=e.length;y<C;++y){const E=e[y];for(c=i[E-n],d=i[E-n+1],a=t;a<E;a+=n)u=i[a],f=i[a+1],(g<=d&&f<=g||d<=g&&g<=f)&&(h=(g-d)/(f-d)*(u-c)+c,_.push(h)),c=u,d=f}let m=NaN,p=-1/0;for(_.sort(Re),c=_[0],a=1,l=_.length;a<l;++a){u=_[a];const y=Math.abs(u-c);y>p&&(h=(c+u)/2,ea(i,t,e,n,h,g)&&(m=h,p=y)),c=u}return isNaN(m)&&(m=s[r]),o?(o.push(m,g,p),o):[m,g,p]}function gc(i,t,e,n,s){let r=[];for(let o=0,a=e.length;o<a;++o){const l=e[o];r=na(i,t,l,n,s,2*o,r),t=l[l.length-1]}return r}function _c(i,t,e,n,s){let r;for(t+=n;t<e;t+=n)if(r=s(i.slice(t-n,t),i.slice(t,t+n)),r)return r;return!1}function sr(i,t,e,n,s,r){return r=r??vl(Mt(),i,t,e,n),Ct(s,r)?r[0]>=s[0]&&r[2]<=s[2]||r[1]>=s[1]&&r[3]<=s[3]?!0:_c(i,t,e,n,function(o,a){return md(s,o,a)}):!1}function j_(i,t,e,n,s){for(let r=0,o=e.length;r<o;++r){if(sr(i,t,e[r],n,s))return!0;t=e[r]}return!1}function mc(i,t,e,n,s){return!!(sr(i,t,e,n,s)||Tn(i,t,e,n,s[0],s[1])||Tn(i,t,e,n,s[0],s[3])||Tn(i,t,e,n,s[2],s[1])||Tn(i,t,e,n,s[2],s[3]))}function pc(i,t,e,n,s){if(!mc(i,t,e[0],n,s))return!1;if(e.length===1)return!0;for(let r=1,o=e.length;r<o;++r)if(G_(i,e[r-1],e[r],n,s)&&!sr(i,e[r-1],e[r],n,s))return!1;return!0}function X_(i,t,e,n,s){for(let r=0,o=e.length;r<o;++r){const a=e[r];if(pc(i,t,a,n,s))return!0;t=a[a.length-1]}return!1}function B_(i,t,e,n){for(;t<e-n;){for(let s=0;s<n;++s){const r=i[t+s];i[t+s]=i[e-n+s],i[e-n+s]=r}t+=n,e-=n}}function ia(i,t,e,n){let s=0,r=i[e-n],o=i[e-n+1];for(;t<e;t+=n){const a=i[t],l=i[t+1];s+=(a-r)*(l+o),r=a,o=l}return s===0?void 0:s>0}function sa(i,t,e,n,s){s=s!==void 0?s:!1;for(let r=0,o=e.length;r<o;++r){const a=e[r],l=ia(i,t,a,n);if(r===0){if(s&&l||!s&&!l)return!1}else if(s&&!l||!s&&l)return!1;t=a}return!0}function yc(i,t,e,n,s){for(let r=0,o=e.length;r<o;++r){const a=e[r];if(!sa(i,t,a,n,s))return!1;a.length&&(t=a[a.length-1])}return!0}function rr(i,t,e,n,s){s=s!==void 0?s:!1;for(let r=0,o=e.length;r<o;++r){const a=e[r],l=ia(i,t,a,n);(r===0?s&&l||!s&&!l:s&&!l||!s&&l)&&B_(i,t,a,n),t=a}return t}function ra(i,t,e,n,s){for(let r=0,o=e.length;r<o;++r)t=rr(i,t,e[r],n,s);return t}function Y_(i,t){const e=[];let n=0,s=0,r;for(let o=0,a=t.length;o<a;++o){const l=t[o],h=ia(i,n,l,2);if(r===void 0&&(r=h),h===r)e.push(t.slice(s,o+1));else{if(e.length===0)continue;e[e.length-1].push(t[s])}s=o+1,n=l}return e}class Zt extends Qe{constructor(t,e,n){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,e!==void 0&&n?(this.setFlatCoordinates(e,t),this.ends_=n):this.setCoordinates(t,e)}appendLinearRing(t){this.flatCoordinates?ne(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Zt(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,n,s){return s<hn(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(qo(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Qo(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,n,s))}containsXY(t,e){return ea(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return hc(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),rr(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,Xi(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=ie(this.getExtent());this.flatInteriorPoint_=na(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new he(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new fc(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,n=this.ends_,s=[];let r=0;for(let o=0,a=n.length;o<a;++o){const l=n[o],h=new fc(e.slice(r,l),t);s.push(h),r=l}return s}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;sa(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=rr(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],n=[];return e.length=Io(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,n),new Zt(e,"XY",n)}getType(){return"Polygon"}intersectsExtent(t){return pc(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const n=os(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}}function W_(i,t,e,n){e=e||32;const s=[];for(let r=0;r<e;++r)ne(s,Hd(i,t,2*Math.PI*r/e,n));return s.push(s[0],s[1]),new Zt(s,"XY",[s.length])}function xc(i){if(Xn(i))throw new Error("Cannot create polygon from empty extent");const t=i[0],e=i[1],n=i[2],s=i[3],r=[t,e,t,s,n,s,n,e,t,e];return new Zt(r,"XY",[r.length])}function oa(i,t,e,n){const s=K(t)/e[0],r=ct(t)/e[1];return n?Math.min(i,Math.max(s,r)):Math.min(i,Math.min(s,r))}function aa(i,t,e){let n=Math.min(i,t);const s=50;return n*=Math.log(1+s*Math.max(0,i/t-1))/s+1,e&&(n=Math.max(n,e),n/=Math.log(1+s*Math.max(0,e/i-1))/s+1),rt(n,e/2,t*2)}function V_(i,t,e,n){return t=t!==void 0?t:!0,function(s,r,o,a){if(s!==void 0){const l=i[0],h=i[i.length-1],c=e?oa(l,e,o,n):l;if(a)return t?aa(s,c,h):rt(s,h,c);const u=Math.min(c,s),d=Math.floor(vs(i,u,r));return i[d]>c&&d<i.length-1?i[d+1]:i[d]}}}function U_(i,t,e,n,s,r){return n=n!==void 0?n:!0,e=e!==void 0?e:0,function(o,a,l,h){if(o!==void 0){const c=s?oa(t,s,l,r):t;if(h)return n?aa(o,c,e):rt(o,e,c);const u=1e-9,d=Math.ceil(Math.log(t/c)/Math.log(i)-u),f=-a*(.5-u)+.5,g=Math.min(c,o),_=Math.floor(Math.log(t/g)/Math.log(i)+f),m=Math.max(d,_),p=t/Math.pow(i,m);return rt(p,e,c)}}}function Ec(i,t,e,n,s){return e=e!==void 0?e:!0,function(r,o,a,l){if(r!==void 0){const h=n?oa(i,n,a,s):i;return!e||!l?rt(r,t,h):aa(r,h,t)}}}function la(i){if(i!==void 0)return 0}function Cc(i){if(i!==void 0)return i}function K_(i){const t=2*Math.PI/i;return function(e,n){if(n)return e;if(e!==void 0)return e=Math.floor(e/t+.5)*t,e}}function $_(i){const t=i===void 0?ge(5):i;return function(e,n){return n||e===void 0?e:Math.abs(e)<=t?0:e}}const Z_=42,ha=256,ca=0;class H_ extends Kt{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=ro(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&&Qd(),t.center&&(t.center=Wt(t.center,this.projection_)),t.extent&&(t.extent=_e(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const a in le)delete e[a];this.setProperties(e,!0);const n=J_(t);this.maxResolution_=n.maxResolution,this.minResolution_=n.minResolution,this.zoomFactor_=n.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=n.minZoom;const s=q_(t),r=n.constraint,o=Q_(t);this.constraints_={center:s,resolution:r,rotation:o},this.setRotation(t.rotation!==void 0?t.rotation:0),this.setCenterInternal(t.center!==void 0?t.center:null),t.resolution!==void 0?this.setResolution(t.resolution):t.zoom!==void 0&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;const n=this.getCenterInternal();if(n){const s=t||[0,0,0,0];e=e||[0,0,0,0];const r=this.getResolution(),o=r/2*(s[3]-e[3]+e[1]-s[1]),a=r/2*(s[0]-e[0]+e[2]-s[2]);this.setCenterInternal([n[0]+o,n[1]-a])}}getUpdatedOptions_(t){const e=this.getProperties();return e.resolution!==void 0?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const e=new Array(arguments.length);for(let n=0;n<e.length;++n){let s=arguments[n];s.center&&(s=Object.assign({},s),s.center=Wt(s.center,this.getProjection())),s.anchor&&(s=Object.assign({},s),s.anchor=Wt(s.anchor,this.getProjection())),e[n]=s}this.animateInternal.apply(this,e)}animateInternal(t){let e=arguments.length,n;e>1&&typeof arguments[e-1]=="function"&&(n=arguments[e-1],--e);let s=0;for(;s<e&&!this.isDef();++s){const c=arguments[s];c.center&&this.setCenterInternal(c.center),c.zoom!==void 0?this.setZoom(c.zoom):c.resolution&&this.setResolution(c.resolution),c.rotation!==void 0&&this.setRotation(c.rotation)}if(s===e){n&&or(n,!0);return}let r=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_;const h=[];for(;s<e;++s){const c=arguments[s],u={start:r,complete:!1,anchor:c.anchor,duration:c.duration!==void 0?c.duration:1e3,easing:c.easing||Zo,callback:n};if(c.center&&(u.sourceCenter=o,u.targetCenter=c.center.slice(),o=u.targetCenter),c.zoom!==void 0?(u.sourceResolution=a,u.targetResolution=this.getResolutionForZoom(c.zoom),a=u.targetResolution):c.resolution&&(u.sourceResolution=a,u.targetResolution=c.resolution,a=u.targetResolution),c.rotation!==void 0){u.sourceRotation=l;const d=un(c.rotation-l+Math.PI,2*Math.PI)-Math.PI;u.targetRotation=l+d,l=u.targetRotation}tm(u)?u.complete=!0:r+=u.duration,h.push(u)}this.animations_.push(h),this.setHint(st.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[st.ANIMATING]>0}getInteracting(){return this.hints_[st.INTERACTING]>0}cancelAnimations(){this.setHint(st.ANIMATING,-this.hints_[st.ANIMATING]);let t;for(let e=0,n=this.animations_.length;e<n;++e){const s=this.animations_[e];if(s[0].callback&&or(s[0].callback,!1),!t)for(let r=0,o=s.length;r<o;++r){const a=s[r];if(!a.complete){t=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const t=Date.now();let e=!1;for(let n=this.animations_.length-1;n>=0;--n){const s=this.animations_[n];let r=!0;for(let o=0,a=s.length;o<a;++o){const l=s[o];if(l.complete)continue;const h=t-l.start;let c=l.duration>0?h/l.duration:1;c>=1?(l.complete=!0,c=1):r=!1;const u=l.easing(c);if(l.sourceCenter){const d=l.sourceCenter[0],f=l.sourceCenter[1],g=l.targetCenter[0],_=l.targetCenter[1];this.nextCenter_=l.targetCenter;const m=d+u*(g-d),p=f+u*(_-f);this.targetCenter_=[m,p]}if(l.sourceResolution&&l.targetResolution){const d=u===1?l.targetResolution:l.sourceResolution+u*(l.targetResolution-l.sourceResolution);if(l.anchor){const f=this.getViewportSize_(this.getRotation()),g=this.constraints_.resolution(d,0,f,!0);this.targetCenter_=this.calculateCenterZoom(g,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=d,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){const d=u===1?un(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+u*(l.targetRotation-l.sourceRotation);if(l.anchor){const f=this.constraints_.rotation(d,!0);this.targetCenter_=this.calculateCenterRotate(f,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=d}if(this.applyTargetState_(!0),e=!0,!l.complete)break}if(r){this.animations_[n]=null,this.setHint(st.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const o=s[0].callback;o&&or(o,!0)}}this.animations_=this.animations_.filter(Boolean),e&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let n;const s=this.getCenterInternal();return s!==void 0&&(n=[s[0]-e[0],s[1]-e[1]],Zr(n,t-this.getRotation()),Pl(n,e)),n}calculateCenterZoom(t,e){let n;const s=this.getCenterInternal(),r=this.getResolution();if(s!==void 0&&r!==void 0){const o=e[0]-t*(e[0]-s[0])/r,a=e[1]-t*(e[1]-s[1])/r;n=[o,a]}return n}getViewportSize_(t){const e=this.viewportSize_;if(t){const n=e[0],s=e[1];return[Math.abs(n*Math.cos(t))+Math.abs(s*Math.sin(t)),Math.abs(n*Math.sin(t))+Math.abs(s*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&&lo(t,this.getProjection())}getCenterInternal(){return this.get(le.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return t!==void 0?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){const e=this.calculateExtentInternal(t);return ho(e,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();J(e,"The view center is not defined");const n=this.getResolution();J(n!==void 0,"The view resolution is not defined");const s=this.getRotation();return J(s!==void 0,"The view rotation is not defined"),Ts(e,n,s,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(le.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(_e(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const n=K(t)/e[0],s=ct(t)/e[1];return Math.max(n,s)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,s=Math.log(e/n)/Math.log(t);return function(r){return e/Math.pow(t,r*s)}}getRotation(){return this.get(le.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),n=this.getConstrainedResolution(this.maxResolution_),s=this.minResolution_,r=Math.log(n/s)/e;return function(o){return Math.log(n/o)/e/r}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const n=this.padding_;return n&&(e=[e[0]-n[1]-n[3],e[1]-n[0]-n[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),n=this.getRotation();let s=this.getCenterInternal();const r=this.padding_;if(r){const o=this.getViewportSizeMinusPadding_();s=ua(s,this.getViewportSize_(),[o[0]/2+r[3],o[1]/2+r[0]],e,n)}return{center:s.slice(0),projection:t!==void 0?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:n,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return e!==void 0&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e=this.minZoom_||0,n,s;if(this.resolutions_){const r=vs(this.resolutions_,t,1);e=r,n=this.resolutions_[r],r==this.resolutions_.length-1?s=2:s=n/this.resolutions_[r+1]}else n=this.maxResolution_,s=this.zoomFactor_;return e+Math.log(n/t)/Math.log(s)}getResolutionForZoom(t){var e;if((e=this.resolutions_)!=null&&e.length){if(this.resolutions_.length===1)return this.resolutions_[0];const n=rt(Math.floor(t),0,this.resolutions_.length-2),s=this.resolutions_[n]/this.resolutions_[n+1];return this.resolutions_[n]/Math.pow(s,rt(t-n,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let n;if(J(Array.isArray(t)||typeof t.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){J(!Xn(t),"Cannot fit empty extent provided as `geometry`");const s=_e(t,this.getProjection());n=xc(s)}else if(t.getType()==="Circle"){const s=_e(t.getExtent(),this.getProjection());n=xc(s),n.rotate(this.getRotation(),ie(s))}else n=t;this.fitInternal(n,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),n=Math.cos(e),s=Math.sin(-e),r=t.getFlatCoordinates(),o=t.getStride();let a=1/0,l=1/0,h=-1/0,c=-1/0;for(let u=0,d=r.length;u<d;u+=o){const f=r[u]*n-r[u+1]*s,g=r[u]*s+r[u+1]*n;a=Math.min(a,f),l=Math.min(l,g),h=Math.max(h,f),c=Math.max(c,g)}return[a,l,h,c]}fitInternal(t,e){e=e||{};let n=e.size;n||(n=this.getViewportSizeMinusPadding_());const s=e.padding!==void 0?e.padding:[0,0,0,0],r=e.nearest!==void 0?e.nearest:!1;let o;e.minResolution!==void 0?o=e.minResolution:e.maxZoom!==void 0?o=this.getResolutionForZoom(e.maxZoom):o=0;const a=this.rotatedExtentForGeometry(t);let l=this.getResolutionForExtentInternal(a,[n[0]-s[1]-s[3],n[1]-s[0]-s[2]]);l=isNaN(l)?o:Math.max(l,o),l=this.getConstrainedResolution(l,r?0:1);const h=this.getRotation(),c=Math.sin(h),u=Math.cos(h),d=ie(a);d[0]+=(s[1]-s[3])/2*l,d[1]+=(s[0]-s[2])/2*l;const f=d[0]*u-d[1]*c,g=d[1]*u+d[0]*c,_=this.getConstrainedCenter([f,g],l),m=e.callback?e.callback:Gi;e.duration!==void 0?this.animateInternal({resolution:l,center:_,duration:e.duration,easing:e.easing},m):(this.targetResolution_=l,this.targetCenter_=_,this.applyTargetState_(!1,!0),or(m,!0))}centerOn(t,e,n){this.centerOnInternal(Wt(t,this.getProjection()),e,n)}centerOnInternal(t,e,n){this.setCenterInternal(ua(t,e,n,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,n,s){let r;const o=this.padding_;if(o&&t){const a=this.getViewportSizeMinusPadding_(-n),l=ua(t,s,[a[0]/2+o[3],a[1]/2+o[0]],e,n);r=[t[0]-l[0],t[1]-l[1]]}return r}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(t){const e=lo(this.targetCenter_,this.getProjection());this.setCenter([e[0]+t[0],e[1]+t[1]])}adjustCenterInternal(t){const e=this.targetCenter_;this.setCenterInternal([e[0]+t[0],e[1]+t[1]])}adjustResolution(t,e){e=e&&Wt(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const n=this.getAnimating()||this.getInteracting(),s=this.getViewportSize_(this.getRotation()),r=this.constraints_.resolution(this.targetResolution_*t,0,s,n);e&&(this.targetCenter_=this.calculateCenterZoom(r,e)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=Wt(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const n=this.getAnimating()||this.getInteracting(),s=this.constraints_.rotation(this.targetRotation_+t,n);e&&(this.targetCenter_=this.calculateCenterRotate(s,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t&&Wt(t,this.getProjection()))}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){const n=this.getAnimating()||this.getInteracting()||e,s=this.constraints_.rotation(this.targetRotation_,n),r=this.getViewportSize_(s),o=this.constraints_.resolution(this.targetResolution_,0,r,n),a=this.constraints_.center(this.targetCenter_,o,r,n,this.calculateCenterShift(this.targetCenter_,o,s,r));this.get(le.ROTATION)!==s&&this.set(le.ROTATION,s),this.get(le.RESOLUTION)!==o&&(this.set(le.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(le.CENTER)||!Ls(this.get(le.CENTER),a))&&this.set(le.CENTER,a),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,n){t=t!==void 0?t:200;const s=e||0,r=this.constraints_.rotation(this.targetRotation_),o=this.getViewportSize_(r),a=this.constraints_.resolution(this.targetResolution_,s,o),l=this.constraints_.center(this.targetCenter_,a,o,!1,this.calculateCenterShift(this.targetCenter_,a,r,o));if(t===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=r,this.targetCenter_=l,this.applyTargetState_();return}n=n||(t===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==r||!this.getCenterInternal()||!Ls(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:r,center:l,resolution:a,duration:t,easing:Rn,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(st.INTERACTING,1)}endInteraction(t,e,n){n=n&&Wt(n,this.getProjection()),this.endInteractionInternal(t,e,n)}endInteractionInternal(t,e,n){this.getInteracting()&&(this.setHint(st.INTERACTING,-1),this.resolveConstraints(t,e,n))}getConstrainedCenter(t,e){const n=this.getViewportSize_(this.getRotation());return this.constraints_.center(t,e||this.getResolution(),n)}getConstrainedZoom(t,e){const n=this.getResolutionForZoom(t);return this.getZoomForResolution(this.getConstrainedResolution(n,e))}getConstrainedResolution(t,e){e=e||0;const n=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(t,e,n)}}function or(i,t){setTimeout(function(){i(t)},0)}function q_(i){if(i.extent!==void 0){const e=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return oc(i.extent,i.constrainOnlyCenter,e)}const t=ro(i.projection,"EPSG:3857");if(i.multiWorld!==!0&&t.isGlobal()){const e=t.getExtent().slice();return e[0]=-1/0,e[2]=1/0,oc(e,!1,!1)}return O_}function J_(i){let t,e,n,o=i.minZoom!==void 0?i.minZoom:ca,a=i.maxZoom!==void 0?i.maxZoom:28;const l=i.zoomFactor!==void 0?i.zoomFactor:2,h=i.multiWorld!==void 0?i.multiWorld:!1,c=i.smoothResolutionConstraint!==void 0?i.smoothResolutionConstraint:!0,u=i.showFullExtent!==void 0?i.showFullExtent:!1,d=ro(i.projection,"EPSG:3857"),f=d.getExtent();let g=i.constrainOnlyCenter,_=i.extent;if(!h&&!_&&d.isGlobal()&&(g=!1,_=f),i.resolutions!==void 0){const m=i.resolutions;e=m[o],n=m[a]!==void 0?m[a]:m[m.length-1],i.constrainResolution?t=V_(m,c,!g&&_,u):t=Ec(e,n,c,!g&&_,u)}else{const p=(f?Math.max(K(f),ct(f)):360*Mi.degrees/d.getMetersPerUnit())/ha/Math.pow(2,ca),y=p/Math.pow(2,28-ca);e=i.maxResolution,e!==void 0?o=0:e=p/Math.pow(l,o),n=i.minResolution,n===void 0&&(i.maxZoom!==void 0?i.maxResolution!==void 0?n=e/Math.pow(l,a):n=p/Math.pow(l,a):n=y),a=o+Math.floor(Math.log(e/n)/Math.log(l)),n=e/Math.pow(l,a-o),i.constrainResolution?t=U_(l,e,n,c,!g&&_,u):t=Ec(e,n,c,!g&&_,u)}return{constraint:t,maxResolution:e,minResolution:n,minZoom:o,zoomFactor:l}}function Q_(i){if(i.enableRotation!==void 0?i.enableRotation:!0){const e=i.constrainRotation;return e===void 0||e===!0?$_():e===!1?Cc:typeof e=="number"?K_(e):Cc}return la}function tm(i){return!(i.sourceCenter&&i.targetCenter&&!Ls(i.sourceCenter,i.targetCenter)||i.sourceResolution!==i.targetResolution||i.sourceRotation!==i.targetRotation)}function ua(i,t,e,n,s){const r=Math.cos(-s);let o=Math.sin(-s),a=i[0]*r-i[1]*o,l=i[1]*r+i[0]*o;a+=(t[0]/2-e[0])*n,l+=(e[1]-t[1]/2)*n,o=-o;const h=a*r-l*o,c=l*r+a*o;return[h,c]}const xe=H_,et={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};class em extends Kt{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);typeof t.properties=="object"&&(delete e.properties,Object.assign(e,t.properties)),e[et.OPACITY]=t.opacity!==void 0?t.opacity:1,J(typeof e[et.OPACITY]=="number","Layer opacity must be a number"),e[et.VISIBLE]=t.visible!==void 0?t.visible:!0,e[et.Z_INDEX]=t.zIndex,e[et.MAX_RESOLUTION]=t.maxResolution!==void 0?t.maxResolution:1/0,e[et.MIN_RESOLUTION]=t.minResolution!==void 0?t.minResolution:0,e[et.MIN_ZOOM]=t.minZoom!==void 0?t.minZoom:-1/0,e[et.MAX_ZOOM]=t.maxZoom!==void 0?t.maxZoom:1/0,this.className_=e.className!==void 0?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:t===void 0?!0:t},n=this.getZIndex();return e.opacity=rt(Math.round(this.getOpacity()*100)/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=n===void 0&&!e.managed?1/0:n,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return j()}getLayerStatesArray(t){return j()}getExtent(){return this.get(et.EXTENT)}getMaxResolution(){return this.get(et.MAX_RESOLUTION)}getMinResolution(){return this.get(et.MIN_RESOLUTION)}getMinZoom(){return this.get(et.MIN_ZOOM)}getMaxZoom(){return this.get(et.MAX_ZOOM)}getOpacity(){return this.get(et.OPACITY)}getSourceState(){return j()}getVisible(){return this.get(et.VISIBLE)}getZIndex(){return this.get(et.Z_INDEX)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(et.EXTENT,t)}setMaxResolution(t){this.set(et.MAX_RESOLUTION,t)}setMinResolution(t){this.set(et.MIN_RESOLUTION,t)}setMaxZoom(t){this.set(et.MAX_ZOOM,t)}setMinZoom(t){this.set(et.MIN_ZOOM,t)}setOpacity(t){J(typeof t=="number","Layer opacity must be a number"),this.set(et.OPACITY,t)}setVisible(t){this.set(et.VISIBLE,t)}setZIndex(t){this.set(et.Z_INDEX,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}const as=em;class nm 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(et.SOURCE,this.handleSourcePropertyChange_);const n=t.source?t.source:null;this.setSource(n)}getLayersArray(t){return t=t||[],t.push(this),t}getLayerStatesArray(t){return t=t||[],t.push(this.getLayerState()),t}getSource(){return this.get(et.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(it(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=$(t,z.CHANGE,this.handleSourceChange_,this),t.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return!this.renderer_||!this.rendered?null:this.renderer_.getData(t)}isVisible(t){let e;const n=this.getMapInternal();!t&&n&&(t=n.getView()),t instanceof xe?e={viewState:t.getState(),extent:t.calculateExtent()}:e=t,!e.layerStatesArray&&n&&(e.layerStatesArray=n.getLayerGroup().getLayerStatesArray());let s;if(e.layerStatesArray){if(s=e.layerStatesArray.find(o=>o.layer===this),!s)return!1}else s=this.getLayerState();const r=this.getExtent();return da(s,e.viewState)&&(!r||Ct(r,e.extent))}getAttributions(t){var r;if(!this.isVisible(t))return[];const e=(r=this.getSource())==null?void 0:r.getAttributions();if(!e)return[];const n=t instanceof xe?t.getViewStateAndExtent():t;let s=e(n);return Array.isArray(s)||(s=[s]),s}render(t,e){const n=this.getRenderer();return n.prepareFrame(t)?(this.rendered=!0,n.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(et.MAP,t)}getMapInternal(){return this.get(et.MAP)}setMap(t){this.mapPrecomposeKey_&&(it(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(it(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=$(t,Vt.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=$(this,z.CHANGE,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState.layerStatesArray,n=this.getLayerState(!1);J(!e.some(s=>s.layer===n.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(n)}setSource(t){this.set(et.SOURCE,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()}}function da(i,t){if(!i.visible)return!1;const e=t.resolution;if(e<i.minResolution||e>=i.maxResolution)return!1;const n=t.zoom;return n>i.minZoom&&n<=i.maxZoom}const ls=nm,wc={RENDER_ORDER:"renderOrder"};class im extends ls{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_=t.renderBuffer!==void 0?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=t.updateWhileAnimating!==void 0?t.updateWhileAnimating:!1,this.updateWhileInteracting_=t.updateWhileInteracting!==void 0?t.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(wc.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){const n=this.getDeclutter();n in t.declutter||(t.declutter[n]=new Wh(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(wc.RENDER_ORDER,t)}setStyle(t){this.style_=t===void 0?Mh:t;const e=sm(t);this.styleFunction_=t===null?void 0:fg(e),this.changed()}setDeclutter(t){this.declutter_=t?String(t):void 0,this.changed()}}function sm(i){if(i===void 0)return Mh;if(!i)return null;if(typeof i=="function"||i instanceof $t)return i;if(!Array.isArray(i))return Jh([i]);if(i.length===0)return[];const t=i.length,e=i[0];if(e instanceof $t){const s=new Array(t);for(let r=0;r<t;++r){const o=i[r];if(!(o instanceof $t))throw new Error("Expected a list of style instances");s[r]=o}return s}if("style"in e){const s=new Array(t);for(let r=0;r<t;++r){const o=i[r];if(!("style"in o))throw new Error("Expected a list of rules with a style property");s[r]=o}return E_(s)}return Jh(i)}const vc=im;class rm extends vc{constructor(t){super(t)}createRenderer(){return new Bg(this)}}const Fe=rm,kt={ADD:"add",REMOVE:"remove"},Rc={LENGTH:"length"};class ar extends se{constructor(t,e,n){super(t),this.element=e,this.index=n}}class om extends Kt{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t??[],this.unique_)for(let n=1,s=this.array_.length;n<s;++n)this.assertUnique_(this.array_[n],n);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(t){for(let e=0,n=t.length;e<n;++e)this.push(t[e]);return this}forEach(t){const e=this.array_;for(let n=0,s=e.length;n<s;++n)t(e[n],n,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(Rc.LENGTH)}insertAt(t,e){if(t<0||t>this.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new ar(kt.ADD,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let n=0,s=e.length;n<s;++n)if(e[n]===t)return this.removeAt(n)}removeAt(t){if(t<0||t>=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new ar(kt.REMOVE,e,t)),e}setAt(t,e){const n=this.getLength();if(t>=n){this.insertAt(t,e);return}if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const s=this.array_[t];this.array_[t]=e,this.dispatchEvent(new ar(kt.REMOVE,s,t)),this.dispatchEvent(new ar(kt.ADD,e,t))}updateLength_(){this.set(Rc.LENGTH,this.array_.length)}assertUnique_(t,e){const n=this.array_;for(let s=0,r=n.length;s<r;++s)if(n[s]===t&&s!==e)throw new Error("Duplicate item added to a unique collection")}}const Ht=om;let am=!1;function lm(i,t,e,n,s,r,o){const a=new XMLHttpRequest;a.open("GET",typeof i=="function"?i(e,n,s):i,!0),t.getType()=="arraybuffer"&&(a.responseType="arraybuffer"),a.withCredentials=am,a.onload=function(l){if(!a.status||a.status>=200&&a.status<300){const h=t.getType();try{let c;h=="text"||h=="json"?c=a.responseText:h=="xml"?c=a.responseXML||a.responseText:h=="arraybuffer"&&(c=a.response),c?r(t.readFeatures(c,{extent:e,featureProjection:s}),t.readProjection(c)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function Tc(i,t){return function(e,n,s,r,o){lm(i,t,e,n,s,(a,l)=>{this.addFeatures(a),r!==void 0&&r(a)},()=>{this.changed(),o!==void 0&&o()})}}function hm(i,t){return[[-1/0,-1/0,1/0,1/0]]}class fa extends Kt{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(typeof t.getSimplifiedGeometry=="function"){const e=t;this.setGeometry(e)}else{const e=t;this.setProperties(e)}}clone(){const t=new fa(this.hasProperties()?this.getProperties():null);t.setGeometryName(this.getGeometryName());const e=this.getGeometry();e&&t.setGeometry(e.clone());const n=this.getStyle();return n&&t.setStyle(n),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_&&(it(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=$(t,z.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?cm(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}}function cm(i){if(typeof i=="function")return i;let t;return Array.isArray(i)?t=i:(J(typeof i.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),t=[i]),function(){return t}}const zt=fa;function Sc(i,t,e,n){const s=[];let r=Mt();for(let o=0,a=e.length;o<a;++o){const l=e[o];r=Vr(i,t,l[0],n),s.push((r[0]+r[2])/2,(r[1]+r[3])/2),t=l[l.length-1]}return s}function lr(i,t,e,n,s,r,o){let a,l;const h=(e-t)/n;if(h===1)a=t;else if(h===2)a=t,l=s;else if(h!==0){let c=i[t],u=i[t+1],d=0;const f=[0];for(let m=t+n;m<e;m+=n){const p=i[m],y=i[m+1];d+=Math.sqrt((p-c)*(p-c)+(y-u)*(y-u)),f.push(d),c=p,u=y}const g=s*d,_=ld(f,g);_<0?(l=(g-f[-_-2])/(f[-_-1]-f[-_-2]),a=t+(-_-2)*n):a=t+_*n}o=o>1?o:2,r=r||new Array(o);for(let c=0;c<o;++c)r[c]=a===void 0?NaN:l===void 0?i[a+c]:Gt(i[a+c],i[a+n+c],l);return r}function ga(i,t,e,n,s,r){if(e==t)return null;let o;if(s<i[t+n-1])return r?(o=i.slice(t,t+n),o[n-1]=s,o):null;if(i[e-1]<s)return r?(o=i.slice(e-n,e),o[n-1]=s,o):null;if(s==i[t+n-1])return i.slice(t,t+n);let a=t/n,l=e/n;for(;a<l;){const d=a+l>>1;s<i[(d+1)*n-1]?l=d:a=d+1}const h=i[a*n-1];if(s==h)return i.slice((a-1)*n,(a-1)*n+n);const c=i[(a+1)*n-1],u=(s-h)/(c-h);o=[];for(let d=0;d<n-1;++d)o.push(Gt(i[(a-1)*n+d],i[a*n+d],u));return o.push(s),o}function um(i,t,e,n,s,r,o){if(o)return ga(i,t,e[e.length-1],n,s,r);let a;if(s<i[n-1])return r?(a=i.slice(0,n),a[n-1]=s,a):null;if(i[i.length-1]<s)return r?(a=i.slice(i.length-n),a[n-1]=s,a):null;for(let l=0,h=e.length;l<h;++l){const c=e[l];if(t!=c){if(s<i[t+n-1])return null;if(s<=i[c-1])return ga(i,t,c,n,s,!1);t=c}}return null}class hr extends Qe{constructor(t,e,n){super(),n!==void 0&&e===void 0?this.setFlatCoordinates(n,t):(e=e||0,this.setCenterAndRadius(t,e,n))}clone(){const t=new hr(this.flatCoordinates.slice(),void 0,this.layout);return t.applyProperties(this),t}closestPointXY(t,e,n,s){const r=this.flatCoordinates,o=t-r[0],a=e-r[1],l=o*o+a*a;if(l<s){if(l===0)for(let h=0;h<this.stride;++h)n[h]=r[h];else{const h=this.getRadius()/Math.sqrt(l);n[0]=r[0]+h*o,n[1]=r[1]+h*a;for(let c=2;c<this.stride;++c)n[c]=r[c]}return n.length=this.stride,l}return s}containsXY(t,e){const n=this.flatCoordinates,s=t-n[0],r=e-n[1];return s*s+r*r<=this.getRadiusSquared_()}getCenter(){return this.flatCoordinates.slice(0,this.stride)}computeExtent(t){const e=this.flatCoordinates,n=e[this.stride]-e[0];return Te(e[0]-n,e[1]-n,e[0]+n,e[1]+n,t)}getRadius(){return Math.sqrt(this.getRadiusSquared_())}getRadiusSquared_(){const t=this.flatCoordinates[this.stride]-this.flatCoordinates[0],e=this.flatCoordinates[this.stride+1]-this.flatCoordinates[1];return t*t+e*e}getType(){return"Circle"}intersectsExtent(t){const e=this.getExtent();if(Ct(t,e)){const n=this.getCenter();return t[0]<=n[0]&&t[2]>=n[0]||t[1]<=n[1]&&t[3]>=n[1]?!0:Ur(t,this.intersectsCoordinate.bind(this))}return!1}setCenter(t){const e=this.stride,n=this.flatCoordinates[e]-this.flatCoordinates[0],s=t.slice();s[e]=s[0]+n;for(let r=1;r<e;++r)s[e+r]=t[r];this.setFlatCoordinates(this.layout,s),this.changed()}setCenterAndRadius(t,e,n){this.setLayout(n,t,0),this.flatCoordinates||(this.flatCoordinates=[]);const s=this.flatCoordinates;let r=uc(s,0,t,this.stride);s[r++]=s[0]+e;for(let o=1,a=this.stride;o<a;++o)s[r++]=s[o];s.length=r,this.changed()}getCoordinates(){return null}setCoordinates(t,e){}setRadius(t){this.flatCoordinates[this.stride]=this.flatCoordinates[0]+t,this.changed()}rotate(t,e){const n=this.getCenter(),s=this.getStride();this.setCenter(Lo(n,0,n.length,s,t,e,n)),this.changed()}}hr.prototype.transform;const dm=hr;class cr extends Fh{constructor(t){super(),this.geometries_=t,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(it),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const t=this.geometries_;for(let e=0,n=t.length;e<n;++e)this.changeEventsKeys_.push($(t[e],z.CHANGE,this.changed,this))}clone(){const t=new cr(_a(this.geometries_));return t.applyProperties(this),t}closestPointXY(t,e,n,s){if(s<hn(this.getExtent(),t,e))return s;const r=this.geometries_;for(let o=0,a=r.length;o<a;++o)s=r[o].closestPointXY(t,e,n,s);return s}containsXY(t,e){const n=this.geometries_;for(let s=0,r=n.length;s<r;++s)if(n[s].containsXY(t,e))return!0;return!1}computeExtent(t){Ii(t);const e=this.geometries_;for(let n=0,s=e.length;n<s;++n)wl(t,e[n].getExtent());return t}getGeometries(){return _a(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let t=[];const e=this.geometries_;for(let n=0,s=e.length;n<s;++n)e[n].getType()===this.getType()?t=t.concat(e[n].getGeometriesArrayRecursive()):t.push(e[n]);return t}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&t<this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=[],n=this.geometries_;let s=!1;for(let r=0,o=n.length;r<o;++r){const a=n[r],l=a.getSimplifiedGeometry(t);e.push(l),l!==a&&(s=!0)}return s?new cr(e):(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getType(){return"GeometryCollection"}intersectsExtent(t){const e=this.geometries_;for(let n=0,s=e.length;n<s;++n)if(e[n].intersectsExtent(t))return!0;return!1}isEmpty(){return this.geometries_.length===0}rotate(t,e){const n=this.geometries_;for(let s=0,r=n.length;s<r;++s)n[s].rotate(t,e);this.changed()}scale(t,e,n){n||(n=ie(this.getExtent()));const s=this.geometries_;for(let r=0,o=s.length;r<o;++r)s[r].scale(t,e,n);this.changed()}setGeometries(t){this.setGeometriesArray(_a(t))}setGeometriesArray(t){this.unlistenGeometriesChange_(),this.geometries_=t,this.listenGeometriesChange_(),this.changed()}applyTransform(t){const e=this.geometries_;for(let n=0,s=e.length;n<s;++n)e[n].applyTransform(t);this.changed()}translate(t,e){const n=this.geometries_;for(let s=0,r=n.length;s<r;++s)n[s].translate(t,e);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}}function _a(i){return i.map(t=>t.clone())}const Ic=cr;class ur extends Qe{constructor(t,e){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,e!==void 0&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendCoordinate(t){ne(this.flatCoordinates,t),this.changed()}clone(){const t=new ur(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,n,s){return s<hn(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Ho(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Jo(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,e,n,s))}forEachSegment(t){return _c(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinateAtM(t,e){return this.layout!="XYM"&&this.layout!="XYZM"?null:(e=e!==void 0?e:!1,ga(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e))}getCoordinates(){return Ke(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return lr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return bo(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(t){const e=[];return e.length=Vs(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new ur(e,"XY")}getType(){return"LineString"}intersectsExtent(t){return sr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,this.getExtent())}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=nr(this.flatCoordinates,0,t,this.stride),this.changed()}}const Sn=ur;class dr extends Qe{constructor(t,e,n){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(t[0]))this.setCoordinates(t,e);else if(e!==void 0&&n)this.setFlatCoordinates(e,t),this.ends_=n;else{const s=t,r=[],o=[];for(let l=0,h=s.length;l<h;++l){const c=s[l];ne(r,c.getFlatCoordinates()),o.push(r.length)}const a=s.length===0?this.getLayout():s[0].getLayout();this.setFlatCoordinates(a,r),this.ends_=o}}appendLineString(t){ne(this.flatCoordinates,t.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new dr(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,n,s){return s<hn(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(qo(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Qo(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,t,e,n,s))}getCoordinateAtM(t,e,n){return this.layout!="XYM"&&this.layout!="XYZM"||this.flatCoordinates.length===0?null:(e=e!==void 0?e:!1,n=n!==void 0?n:!1,um(this.flatCoordinates,0,this.ends_,this.stride,t,e,n))}getCoordinates(){return Xi(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(t){return t<0||this.ends_.length<=t?null:new Sn(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLineStrings(){const t=this.flatCoordinates,e=this.ends_,n=this.layout,s=[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o],h=new Sn(t.slice(r,l),n);s.push(h),r=l}return s}getLength(){const t=this.ends_;let e=0,n=0;for(let s=0,r=t.length;s<r;++s)n+=bo(this.flatCoordinates,e,t[s],this.stride),e=t[s];return n}getFlatMidpoints(){const t=[],e=this.flatCoordinates;let n=0;const s=this.ends_,r=this.stride;for(let o=0,a=s.length;o<a;++o){const l=s[o],h=lr(e,n,l,r,.5);ne(t,h),n=l}return t}getSimplifiedGeometryInternal(t){const e=[],n=[];return e.length=Eh(this.flatCoordinates,0,this.ends_,this.stride,t,e,0,n),new dr(e,"XY",n)}getType(){return"MultiLineString"}intersectsExtent(t){return j_(this.flatCoordinates,0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const n=os(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}}const ma=dr;class pa extends Qe{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){ne(this.flatCoordinates,t.getFlatCoordinates()),this.changed()}clone(){const t=new pa(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,n,s){if(s<hn(this.getExtent(),t,e))return s;const r=this.flatCoordinates,o=this.stride;for(let a=0,l=r.length;a<l;a+=o){const h=Ie(t,e,r[a],r[a+1]);if(h<s){s=h;for(let c=0;c<o;++c)n[c]=r[a+c];n.length=o}}return s}getCoordinates(){return Ke(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){const e=this.flatCoordinates.length/this.stride;return t<0||e<=t?null:new he(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)}getPoints(){const t=this.flatCoordinates,e=this.layout,n=this.stride,s=[];for(let r=0,o=t.length;r<o;r+=n){const a=new he(t.slice(r,r+n),e);s.push(a)}return s}getType(){return"MultiPoint"}intersectsExtent(t){const e=this.flatCoordinates,n=this.stride;for(let s=0,r=e.length;s<r;s+=n){const o=e[s],a=e[s+1];if(Br(t,o,a))return!0}return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=nr(this.flatCoordinates,0,t,this.stride),this.changed()}}const ya=pa;class fr extends Qe{constructor(t,e,n){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!n&&!Array.isArray(t[0])){const s=t,r=[],o=[];for(let a=0,l=s.length;a<l;++a){const h=s[a],c=r.length,u=h.getEnds();for(let d=0,f=u.length;d<f;++d)u[d]+=c;ne(r,h.getFlatCoordinates()),o.push(u)}e=s.length===0?this.getLayout():s[0].getLayout(),t=r,n=o}e!==void 0&&n?(this.setFlatCoordinates(e,t),this.endss_=n):this.setCoordinates(t,e)}appendPolygon(t){let e;if(!this.flatCoordinates)this.flatCoordinates=t.getFlatCoordinates().slice(),e=t.getEnds().slice(),this.endss_.push();else{const n=this.flatCoordinates.length;ne(this.flatCoordinates,t.getFlatCoordinates()),e=t.getEnds().slice();for(let s=0,r=e.length;s<r;++s)e[s]+=n}this.endss_.push(e),this.changed()}clone(){const t=this.endss_.length,e=new Array(t);for(let s=0;s<t;++s)e[s]=this.endss_[s].slice();const n=new fr(this.flatCoordinates.slice(),this.layout,e);return n.applyProperties(this),n}closestPointXY(t,e,n,s){return s<hn(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(k_(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),N_(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,t,e,n,s))}containsXY(t,e){return z_(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t,e)}getArea(){return F_(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),ra(e,0,this.endss_,this.stride,t)):e=this.flatCoordinates,wo(e,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const t=Sc(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=gc(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new ya(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;yc(t,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=ra(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],n=[];return e.length=Xf(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),e,0,n),new fr(e,"XY",n)}getPolygon(t){if(t<0||this.endss_.length<=t)return null;let e;if(t===0)e=0;else{const r=this.endss_[t-1];e=r[r.length-1]}const n=this.endss_[t].slice(),s=n[n.length-1];if(e!==0)for(let r=0,o=n.length;r<o;++r)n[r]-=e;return new Zt(this.flatCoordinates.slice(e,s),this.layout,n)}getPolygons(){const t=this.layout,e=this.flatCoordinates,n=this.endss_,s=[];let r=0;for(let o=0,a=n.length;o<a;++o){const l=n[o].slice(),h=l[l.length-1];if(r!==0)for(let u=0,d=l.length;u<d;++u)l[u]-=r;const c=new Zt(e.slice(r,h),t,l);s.push(c),r=h}return s}getType(){return"MultiPolygon"}intersectsExtent(t){return X_(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,3),this.flatCoordinates||(this.flatCoordinates=[]);const n=dc(this.flatCoordinates,0,t,this.stride,this.endss_);if(n.length===0)this.flatCoordinates.length=0;else{const s=n[n.length-1];this.flatCoordinates.length=s.length===0?0:s[s.length-1]}this.changed()}}const xa=fr,Lc=re();class oi{constructor(t,e,n,s,r,o){this.styleFunction,this.extent_,this.id_=o,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=n||null,this.properties_=r,this.squaredTolerance_,this.stride_=s,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?Wr(this.flatCoordinates_):Vr(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=ie(this.getExtent());this.flatInteriorPoints_=na(this.flatCoordinates_,0,this.ends_,2,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=Y_(this.flatCoordinates_,this.ends_),e=Sc(this.flatCoordinates_,0,t,2);this.flatInteriorPoints_=gc(this.flatCoordinates_,0,t,2,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=lr(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const t=this.flatCoordinates_;let e=0;const n=this.ends_;for(let s=0,r=n.length;s<r;++s){const o=n[s],a=lr(t,e,o,2,.5);ne(this.flatMidpoints_,a),e=o}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(t){return this}simplifyTransformed(t,e){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(t){t=at(t);const e=t.getExtent(),n=t.getWorldExtent();if(e&&n){const s=ct(n)/ct(e);pe(Lc,n[0],n[3],s,-s,0,0,0),Ze(this.flatCoordinates_,0,this.flatCoordinates_.length,2,Lc,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){var t;return new oi(this.type_,this.flatCoordinates_.slice(),(t=this.ends_)==null?void 0:t.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=oh((t,e)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);const n=this.simplifiedGeometry_.getFlatCoordinates();let s;switch(this.type_){case"LineString":n.length=Vs(n,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,n,0),s=[n.length];break;case"MultiLineString":s=[],n.length=Eh(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,n,0,s);break;case"Polygon":s=[],n.length=Io(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),n,0,s);break}return s&&(this.simplifiedGeometry_=new oi(this.type_,n,s,2,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}}oi.prototype.getFlatCoordinates=oi.prototype.getOrientedFlatCoordinates;const en=oi;class fm{constructor(t){this.rbush_=new Wh(t),this.items_={}}insert(t,e){const n={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(n),this.items_[q(e)]=n}load(t,e){const n=new Array(e.length);for(let s=0,r=e.length;s<r;s++){const o=t[s],a=e[s],l={minX:o[0],minY:o[1],maxX:o[2],maxY:o[3],value:a};n[s]=l,this.items_[q(a)]=l}this.rbush_.load(n)}remove(t){const e=q(t),n=this.items_[e];return delete this.items_[e],this.rbush_.remove(n)!==null}update(t,e){const n=this.items_[q(e)],s=[n.minX,n.minY,n.maxX,n.maxY];zn(s,t)||(this.remove(e),this.insert(t,e))}getAll(){return this.rbush_.all().map(function(e){return e.value})}getInExtent(t){const e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.rbush_.search(e).map(function(s){return s.value})}forEach(t){return this.forEach_(this.getAll(),t)}forEachInExtent(t,e){return this.forEach_(this.getInExtent(t),e)}forEach_(t,e){let n;for(let s=0,r=t.length;s<r;s++)if(n=e(t[s]),n)return n;return n}isEmpty(){return gn(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return Te(e.minX,e.minY,e.maxX,e.maxY,t)}concat(t){this.rbush_.load(t.rbush_.all());for(const e in t.items_)this.items_[e]=t.items_[e]}}const Pc=fm;class gm extends Kt{constructor(t){super(),this.projection=at(t.projection),this.attributions_=bc(t.attributions),this.attributionsCollapsible_=t.attributionsCollapsible??!0,this.loading=!1,this.state_=t.state!==void 0?t.state:"ready",this.wrapX_=t.wrapX!==void 0?t.wrapX:!1,this.interpolate_=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;const e=this;this.viewPromise_=new Promise(function(n,s){e.viewResolver=n,e.viewRejector=s})}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_=bc(t),this.changed()}setState(t){this.state_=t,this.changed()}}function bc(i){return i?typeof i=="function"?i:(Array.isArray(i)||(i=[i]),t=>i):null}const Ea=gm,qt={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};class nn extends se{constructor(t,e,n){super(t),this.feature=e,this.features=n}}class _m extends Ea{constructor(t){t=t||{},super({attributions:t.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:t.wrapX!==void 0?t.wrapX:!0}),this.on,this.once,this.un,this.loader_=Gi,this.format_=t.format||null,this.overlaps_=t.overlaps===void 0?!0:t.overlaps,this.url_=t.url,t.loader!==void 0?this.loader_=t.loader:this.url_!==void 0&&(J(this.format_,"`format` must be set when `url` is set"),this.loader_=Tc(this.url_,this.format_)),this.strategy_=t.strategy!==void 0?t.strategy:hm;const e=t.useSpatialIndex!==void 0?t.useSpatialIndex:!0;this.featuresRtree_=e?new Pc:null,this.loadedExtentsRtree_=new Pc,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let n,s;Array.isArray(t.features)?s=t.features:t.features&&(n=t.features,s=n.getArray()),!e&&n===void 0&&(n=new Ht(s)),s!==void 0&&this.addFeaturesInternal(s),n!==void 0&&this.bindFeaturesCollection_(n)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=q(t);if(!this.addToIndex_(e,t)){this.featuresCollection_&&this.featuresCollection_.remove(t);return}this.setupChangeEvents_(e,t);const n=t.getGeometry();if(n){const s=n.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(s,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new nn(qt.ADDFEATURE,t))}setupChangeEvents_(t,e){e instanceof en||(this.featureChangeKeys_[t]=[$(e,z.CHANGE,this.handleFeatureChange_,this),$(e,Hn.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(t,e){let n=!0;if(e.getId()!==void 0){const s=String(e.getId());if(!(s in this.idIndex_))this.idIndex_[s]=e;else if(e instanceof en){const r=this.idIndex_[s];r instanceof en?Array.isArray(r)?r.push(e):this.idIndex_[s]=[r,e]:n=!1}else n=!1}return n&&(J(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=e),n}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],n=[],s=[];for(let r=0,o=t.length;r<o;r++){const a=t[r],l=q(a);this.addToIndex_(l,a)&&n.push(a)}for(let r=0,o=n.length;r<o;r++){const a=n[r],l=q(a);this.setupChangeEvents_(l,a);const h=a.getGeometry();if(h){const c=h.getExtent();e.push(c),s.push(a)}else this.nullGeometryFeatures_[l]=a}if(this.featuresRtree_&&this.featuresRtree_.load(e,s),this.hasListener(qt.ADDFEATURE))for(let r=0,o=n.length;r<o;r++)this.dispatchEvent(new nn(qt.ADDFEATURE,n[r]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(qt.ADDFEATURE,function(n){e||(e=!0,t.push(n.feature),e=!1)}),this.addEventListener(qt.REMOVEFEATURE,function(n){e||(e=!0,t.remove(n.feature),e=!1)}),t.addEventListener(kt.ADD,n=>{e||(e=!0,this.addFeature(n.element),e=!1)}),t.addEventListener(kt.REMOVE,n=>{e||(e=!0,this.removeFeature(n.element),e=!1)}),this.featuresCollection_=t}clear(t){if(t){for(const n in this.featureChangeKeys_)this.featureChangeKeys_[n].forEach(it);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(n=>{this.removeFeatureInternal(n)});for(const n in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[n])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new nn(qt.CLEAR);this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){const n=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(n,function(s){const r=s.getGeometry();if(r instanceof en||r.intersectsCoordinate(t))return e(s)})}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,function(n){const s=n.getGeometry();if(s instanceof en||s.intersectsExtent(t)){const r=e(n);if(r)return r}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),gn(this.nullGeometryFeatures_)||ne(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,function(n){e.push(n)}),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);const s=Sl(t,e);return[].concat(...s.map(r=>this.featuresRtree_.getInExtent(r)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const n=t[0],s=t[1];let r=null;const o=[NaN,NaN];let a=1/0;const l=[-1/0,-1/0,1/0,1/0];return e=e||$n,this.featuresRtree_.forEachInExtent(l,function(h){if(e(h)){const c=h.getGeometry(),u=a;if(a=c instanceof en?0:c.closestPointXY(n,s,o,a),a<u){r=h;const d=Math.sqrt(a);l[0]=n-d,l[1]=s-d,l[2]=n+d,l[3]=s+d}}}),r}getExtent(t){return this.featuresRtree_.getExtent(t)}getFeatureById(t){const e=this.idIndex_[t.toString()];return e!==void 0?e:null}getFeatureByUid(t){const e=this.uidIndex_[t];return e!==void 0?e:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(t){const e=t.target,n=q(e),s=e.getGeometry();if(!s)n in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(e),this.nullGeometryFeatures_[n]=e);else{const o=s.getExtent();n in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[n],this.featuresRtree_&&this.featuresRtree_.insert(o,e)):this.featuresRtree_&&this.featuresRtree_.update(o,e)}const r=e.getId();if(r!==void 0){const o=r.toString();this.idIndex_[o]!==e&&(this.removeFromIdIndex_(e),this.idIndex_[o]=e)}else this.removeFromIdIndex_(e),this.uidIndex_[n]=e;this.changed(),this.dispatchEvent(new nn(qt.CHANGEFEATURE,e))}hasFeature(t){const e=t.getId();return e!==void 0?e in this.idIndex_:q(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&gn(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(t,e,n){const s=this.loadedExtentsRtree_,r=this.strategy_(t,e,n);for(let o=0,a=r.length;o<a;++o){const l=r[o];s.forEachInExtent(l,function(c){return fe(c.extent,l)})||(++this.loadingExtentsCount_,this.dispatchEvent(new nn(qt.FEATURESLOADSTART)),this.loader_.call(this,l,e,n,c=>{--this.loadingExtentsCount_,this.dispatchEvent(new nn(qt.FEATURESLOADEND,void 0,c))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new nn(qt.FEATURESLOADERROR))}),s.insert(l,{extent:l.slice()}))}this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_,n=e.forEachInExtent(t,function(s){if(zn(s.extent,t))return s});n&&e.remove(n)}removeFeatures(t){let e=!1;for(let n=0,s=t.length;n<s;++n)e=this.removeFeatureInternal(t[n])||e;e&&this.changed()}removeFeature(t){if(!t)return;this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=q(t);if(!(e in this.uidIndex_))return!1;e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t);const n=this.featureChangeKeys_[e];n==null||n.forEach(it),delete this.featureChangeKeys_[e];const s=t.getId();if(s!==void 0){const r=s.toString(),o=this.idIndex_[r];o===t?delete this.idIndex_[r]:Array.isArray(o)&&(o.splice(o.indexOf(t),1),o.length===1&&(this.idIndex_[r]=o[0]))}return delete this.uidIndex_[e],this.hasListener(qt.REMOVEFEATURE)&&this.dispatchEvent(new nn(qt.REMOVEFEATURE,t)),!0}removeFromIdIndex_(t){for(const e in this.idIndex_)if(this.idIndex_[e]===t){delete this.idIndex_[e];break}}setLoader(t){this.loader_=t}setUrl(t){J(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader(Tc(t,this.format_))}setOverlaps(t){this.overlaps_=t,this.changed()}}const ke=_m;class mm extends se{constructor(t,e,n){super(t),this.map=e,this.frameState=n!==void 0?n:null}}const ai=mm;class pm extends ai{constructor(t,e,n,s,r,o){super(t,e,r),this.originalEvent=n,this.pixel_=null,this.coordinate_=null,this.dragging=s!==void 0?s:!1,this.activePointers=o}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(t){this.pixel_=t}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(t){this.coordinate_=t}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}}const Ne=pm,tt={SINGLECLICK:"singleclick",CLICK:z.CLICK,DBLCLICK:z.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},Ca={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};class ym extends zi{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=e===void 0?1:e,this.down_=null;const n=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=n,this.pointerdownListenerKey_=$(n,Ca.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=$(n,Ca.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(z.TOUCHMOVE,this.boundHandleTouchMove_,kl?{passive:!1}:!1)}emulateClick_(t){let e=new Ne(tt.CLICK,this.map_,t);this.dispatchEvent(e),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new Ne(tt.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const n=new Ne(tt.SINGLECLICK,this.map_,t);this.dispatchEvent(n)},250)}updateActivePointers_(t){const e=t,n=e.pointerId;if(e.type==tt.POINTERUP||e.type==tt.POINTERCANCEL){delete this.trackedTouches_[n];for(const s in this.trackedTouches_)if(this.trackedTouches_[s].target!==e.target){delete this.trackedTouches_[s];break}}else(e.type==tt.POINTERDOWN||e.type==tt.POINTERMOVE)&&(this.trackedTouches_[n]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new Ne(tt.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(it),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return t.button===0}handlePointerDown_(t){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(t);const e=new Ne(tt.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),this.dragListenerKeys_.length===0){const n=this.map_.getOwnerDocument();this.dragListenerKeys_.push($(n,tt.POINTERMOVE,this.handlePointerMove_,this),$(n,tt.POINTERUP,this.handlePointerUp_,this),$(this.element_,tt.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==n&&this.dragListenerKeys_.push($(this.element_.getRootNode(),tt.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new Ne(tt.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;const e=!!(this.down_&&this.isMoving_(t));this.dispatchEvent(new Ne(tt.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;(!e||e.defaultPrevented)&&(typeof t.cancelable!="boolean"||t.cancelable===!0)&&t.preventDefault()}isMoving_(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(it(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(z.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(it(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(it),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const xm=ym,Ge={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},vt={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},F={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4},gr=1/0;class Em{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,Oi(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,n=t[0];t.length==1?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const s=this.keyFunction_(n);return delete this.queuedElements_[s],n}enqueue(t){J(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const e=this.priorityFunction_(t);return e!=gr?(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(t){return t*2+1}getRightChildIndex_(t){return t*2+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return this.elements_.length===0}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,n=this.priorities_,s=e.length,r=e[t],o=n[t],a=t;for(;t<s>>1;){const l=this.getLeftChildIndex_(t),h=this.getRightChildIndex_(t),c=h<s&&n[h]<n[l]?h:l;e[t]=e[c],n[t]=n[c],t=c}e[t]=r,n[t]=o,this.siftDown_(a,t)}siftDown_(t,e){const n=this.elements_,s=this.priorities_,r=n[e],o=s[e];for(;e>t;){const a=this.getParentIndex_(e);if(s[a]>o)n[e]=n[a],s[e]=s[a],e=a;else break}n[e]=r,s[e]=o}reprioritize(){const t=this.priorityFunction_,e=this.elements_,n=this.priorities_;let s=0;const r=e.length;let o,a,l;for(a=0;a<r;++a)o=e[a],l=t(o),l==gr?delete this.queuedElements_[this.keyFunction_(o)]:(n[s]=l,e[s++]=o);e.length=s,n.length=s,this.heapify_()}}const Cm=Em;class wm extends Cm{constructor(t,e){super(n=>t.apply(null,n),n=>n[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){const e=super.enqueue(t);return e&&t[0].addEventListener(z.CHANGE,this.boundHandleTileChange_),e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,n=e.getState();if(n===F.LOADED||n===F.ERROR||n===F.EMPTY){n!==F.ERROR&&e.removeEventListener(z.CHANGE,this.boundHandleTileChange_);const s=e.getKey();s in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[s],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let n=0;for(;this.tilesLoading_<t&&n<e&&this.getCount()>0;){const s=this.dequeue()[0],r=s.getKey();s.getState()===F.IDLE&&!(r in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[r]=!0,++this.tilesLoading_,++n,s.load())}}}const vm=wm;function Rm(i,t,e,n,s){if(!i||!(e in i.wantedTiles)||!i.wantedTiles[e][t.getKey()])return gr;const r=i.viewState.center,o=n[0]-r[0],a=n[1]-r[1];return 65536*Math.log(s)+Math.sqrt(o*o+a*a)/s}class Tm extends Kt{constructor(t){super();const e=t.element;e&&!t.target&&!e.style.pointerEvents&&(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){var t;(t=this.element)==null||t.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(t){var e;this.map_&&((e=this.element)==null||e.remove());for(let n=0,s=this.listenerKeys.length;n<s;++n)it(this.listenerKeys[n]);if(this.listenerKeys.length=0,this.map_=t,t){const n=this.target_??t.getOverlayContainerStopEvent();this.element&&n.appendChild(this.element),this.render!==Gi&&this.listenerKeys.push($(t,Ge.POSTRENDER,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_=typeof t=="string"?document.getElementById(t):t}}const wa=Tm;class Sm extends wa{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=t.collapsed!==void 0?t.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=t.collapsible!==void 0,this.collapsible_=t.collapsible!==void 0?t.collapsible:!0,this.collapsible_||(this.collapsed_=!1),this.attributions_=t.attributions;const e=t.className!==void 0?t.className:"ol-attribution",n=t.tipLabel!==void 0?t.tipLabel:"Attributions",s=t.expandClassName!==void 0?t.expandClassName:e+"-expand",r=t.collapseLabel!==void 0?t.collapseLabel:"›",o=t.collapseClassName!==void 0?t.collapseClassName:e+"-collapse";typeof r=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=r,this.collapseLabel_.className=o):this.collapseLabel_=r;const a=t.label!==void 0?t.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=s):this.label_=a;const l=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=n,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener(z.CLICK,this.handleClick_.bind(this),!1);const h=e+" "+Bs+" "+vo+(this.collapsed_&&this.collapsible_?" "+dh:"")+(this.collapsible_?"":" ol-uncollapsible"),c=this.element;c.className=h,c.appendChild(this.toggleButton_),c.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){const e=this.getMap().getAllLayers(),n=new Set(e.flatMap(s=>s.getAttributions(t)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(s=>n.add(s)):n.add(this.attributions_)),!this.overrideCollapsible_){const s=!e.some(r=>{var o;return((o=r.getSource())==null?void 0:o.getAttributionsCollapsible())===!1});this.setCollapsible(s)}return Array.from(n)}async updateElement_(t){if(!t){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}const e=await Promise.all(this.collectSourceAttributions_(t).map(s=>ah(()=>s))),n=e.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!Be(e,this.renderedAttributions_)){Gl(this.ulElement_);for(let s=0,r=e.length;s<r;++s){const o=document.createElement("li");o.innerHTML=e[s],this.ulElement_.appendChild(o)}this.renderedAttributions_=e}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(dh),this.collapsed_?Nl(this.collapseLabel_,this.label_):Nl(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(t){this.userCollapsed_=t,!(!this.collapsible_||this.collapsed_===t)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(t){this.updateElement_(t.frameState)}}const Im=Sm;class Lm extends wa{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target});const e=t.className!==void 0?t.className:"ol-rotate",n=t.label!==void 0?t.label:"⇧",s=t.compassClassName!==void 0?t.compassClassName:"ol-compass";this.label_=null,typeof n=="string"?(this.label_=document.createElement("span"),this.label_.className=s,this.label_.textContent=n):(this.label_=n,this.label_.classList.add(s));const r=t.tipLabel?t.tipLabel:"Reset rotation",o=document.createElement("button");o.className=e+"-reset",o.setAttribute("type","button"),o.title=r,o.appendChild(this.label_),o.addEventListener(z.CLICK,this.handleClick_.bind(this),!1);const a=e+" "+Bs+" "+vo,l=this.element;l.className=a,l.appendChild(o),this.callResetNorth_=t.resetNorth?t.resetNorth:void 0,this.duration_=t.duration!==void 0?t.duration:250,this.autoHide_=t.autoHide!==void 0?t.autoHide:!0,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Xs)}handleClick_(t){t.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const e=this.getMap().getView();if(!e)return;const n=e.getRotation();n!==void 0&&(this.duration_>0&&n%(2*Math.PI)!==0?e.animate({rotation:0,duration:this.duration_,easing:Rn}):e.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const n=e.viewState.rotation;if(n!=this.rotation_){const s="rotate("+n+"rad)";if(this.autoHide_){const r=this.element.classList.contains(Xs);!r&&n===0?this.element.classList.add(Xs):r&&n!==0&&this.element.classList.remove(Xs)}this.label_.style.transform=s}this.rotation_=n}}const Pm=Lm;class bm extends wa{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=t.className!==void 0?t.className:"ol-zoom",n=t.delta!==void 0?t.delta:1,s=t.zoomInClassName!==void 0?t.zoomInClassName:e+"-in",r=t.zoomOutClassName!==void 0?t.zoomOutClassName:e+"-out",o=t.zoomInLabel!==void 0?t.zoomInLabel:"+",a=t.zoomOutLabel!==void 0?t.zoomOutLabel:"–",l=t.zoomInTipLabel!==void 0?t.zoomInTipLabel:"Zoom in",h=t.zoomOutTipLabel!==void 0?t.zoomOutTipLabel:"Zoom out",c=document.createElement("button");c.className=s,c.setAttribute("type","button"),c.title=l,c.appendChild(typeof o=="string"?document.createTextNode(o):o),c.addEventListener(z.CLICK,this.handleClick_.bind(this,n),!1);const u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=h,u.appendChild(typeof a=="string"?document.createTextNode(a):a),u.addEventListener(z.CLICK,this.handleClick_.bind(this,-n),!1);const d=e+" "+Bs+" "+vo,f=this.element;f.className=d,f.appendChild(c),f.appendChild(u),this.duration_=t.duration!==void 0?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const n=this.getMap().getView();if(!n)return;const s=n.getZoom();if(s!==void 0){const r=n.getConstrainedZoom(s+t);this.duration_>0?(n.getAnimating()&&n.cancelAnimations(),n.animate({zoom:r,duration:this.duration_,easing:Rn})):n.setZoom(r)}}}const Mm=bm;function Mc(i){i=i||{};const t=new Ht;return(i.zoom!==void 0?i.zoom:!0)&&t.push(new Mm(i.zoomOptions)),(i.rotate!==void 0?i.rotate:!0)&&t.push(new Pm(i.rotateOptions)),(i.attribution!==void 0?i.attribution:!0)&&t.push(new Im(i.attributionOptions)),t}class Am{constructor(t,e,n){this.decay_=t,this.minVelocity_=e,this.delay_=n,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]<t)return!1;let n=e-3;for(;n>0&&this.points_[n+2]>t;)n-=3;const s=this.points_[e+2]-this.points_[n+2];if(s<16.666666666666668)return!1;const r=this.points_[e]-this.points_[n],o=this.points_[e+1]-this.points_[n+1];return this.angle_=Math.atan2(o,r),this.initialVelocity_=Math.sqrt(r*r+o*o)/s,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}const Om=Am,va={ACTIVE:"active"};class Dm extends Kt{constructor(t){super(),this.on,this.once,this.un,t&&t.handleEvent&&(this.handleEvent=t.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(va.ACTIVE)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(va.ACTIVE,t)}setMap(t){this.map_=t}}function Fm(i,t,e){const n=i.getCenterInternal();if(n){const s=[n[0]+t[0],n[1]+t[1]];i.animateInternal({duration:e!==void 0?e:250,easing:D_,center:i.getConstrainedCenter(s)})}}function Ra(i,t,e,n){const s=i.getZoom();if(s===void 0)return;const r=i.getConstrainedZoom(s+t),o=i.getResolutionForZoom(r);i.getAnimating()&&i.cancelAnimations(),i.animate({resolution:o,anchor:e,duration:n!==void 0?n:250,easing:Rn})}const hs=Dm;class km extends hs{constructor(t){super(),t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=t.duration!==void 0?t.duration:250}handleEvent(t){let e=!1;if(t.type==tt.DBLCLICK){const n=t.originalEvent,s=t.map,r=t.coordinate,o=n.shiftKey?-this.delta_:this.delta_,a=s.getView();Ra(a,o,r,this.duration_),n.preventDefault(),e=!0}return!e}}const Nm=km;function Ta(i){const t=arguments;return function(e){let n=!0;for(let s=0,r=t.length;s<r&&(n=n&&t[s](e),!!n);++s);return n}}const Gm=function(i){const t=i.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey},zm=function(i){const t=i.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},jm=function(i){const t=i.map.getTargetElement(),e=t.getRootNode(),n=i.map.getOwnerDocument().activeElement;return e instanceof ShadowRoot?e.host.contains(n):t.contains(n)},Ac=function(i){const t=i.map.getTargetElement(),e=t.getRootNode();return(e instanceof ShadowRoot?e.host:t).hasAttribute("tabindex")?jm(i):!0},_r=$n,Oc=function(i){const t=i.originalEvent;return"pointerId"in t&&t.button==0&&!(Ed&&Dl&&t.ctrlKey)},Xm=Zn,Sa=function(i){const t=i.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey},Bm=function(i){const t=i.originalEvent;return Dl?t.metaKey:t.ctrlKey},Ia=function(i){const t=i.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},Dc=function(i){const t=i.originalEvent,e=t.target.tagName;return e!=="INPUT"&&e!=="SELECT"&&e!=="TEXTAREA"&&!t.target.isContentEditable},La=function(i){const t=i.originalEvent;return"pointerId"in t&&t.pointerType=="mouse"},Ym=function(i){const t=i.originalEvent;return"pointerId"in t&&t.isPrimary&&t.button===0};class Wm extends hs{constructor(t){t=t||{},super(t),t.handleDownEvent&&(this.handleDownEvent=t.handleDownEvent),t.handleDragEvent&&(this.handleDragEvent=t.handleDragEvent),t.handleMoveEvent&&(this.handleMoveEvent=t.handleMoveEvent),t.handleUpEvent&&(this.handleUpEvent=t.handleUpEvent),t.stopDown&&(this.stopDown=t.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(t){return!1}handleDragEvent(t){}handleEvent(t){if(!t.originalEvent)return!0;let e=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence){if(t.type==tt.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==tt.POINTERUP){const n=this.handleUpEvent(t);this.handlingDownUpSequence=n&&this.targetPointers.length>0}}else if(t.type==tt.POINTERDOWN){const n=this.handleDownEvent(t);this.handlingDownUpSequence=n,e=this.stopDown(n)}else t.type==tt.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}}function Pa(i){const t=i.length;let e=0,n=0;for(let s=0;s<t;s++)e+=i[s].clientX,n+=i[s].clientY;return{clientX:e/t,clientY:n/t}}const li=Wm;class Vm extends li{constructor(t){super({stopDown:Zn}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:Ta(Sa,Ym);this.condition_=t.onFocusOnly?Ta(Ac,e):e,this.noKinetic_=!1}handleDragEvent(t){const e=t.map;this.panning_||(this.panning_=!0,e.getView().beginInteraction());const n=this.targetPointers,s=e.getEventPixel(Pa(n));if(n.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(s[0],s[1]),this.lastCentroid){const r=[this.lastCentroid[0]-s[0],s[1]-this.lastCentroid[1]],a=t.map.getView();bl(r,a.getResolution()),Zr(r,a.getRotation()),a.adjustCenterInternal(r)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=s,this.lastPointersCount_=n.length,t.originalEvent.preventDefault()}handleUpEvent(t){const e=t.map,n=e.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const s=this.kinetic_.getDistance(),r=this.kinetic_.getAngle(),o=n.getCenterInternal(),a=e.getPixelFromCoordinateInternal(o),l=e.getCoordinateFromPixelInternal([a[0]-s*Math.cos(r),a[1]-s*Math.sin(r)]);n.animateInternal({center:n.getConstrainedCenter(l),duration:500,easing:Rn})}return this.panning_&&(this.panning_=!1,n.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(t){if(this.targetPointers.length>0&&this.condition_(t)){const n=t.map.getView();return this.lastCentroid=null,n.getAnimating()&&n.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}}const Um=Vm;class Km extends li{constructor(t){t=t||{},super({stopDown:Zn}),this.condition_=t.condition?t.condition:zm,this.lastAngle_=void 0,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){if(!La(t))return;const e=t.map,n=e.getView();if(n.getConstraints().rotation===la)return;const s=e.getSize(),r=t.pixel,o=Math.atan2(s[1]/2-r[1],r[0]-s[0]/2);if(this.lastAngle_!==void 0){const a=o-this.lastAngle_;n.adjustRotationInternal(-a)}this.lastAngle_=o}handleUpEvent(t){return La(t)?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){return La(t)&&Oc(t)&&this.condition_(t)?(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}}const $m=Km;class Zm extends Gs{constructor(t){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const t=this.startPixel_,e=this.endPixel_,n="px",s=this.element_.style;s.left=Math.min(t[0],e[0])+n,s.top=Math.min(t[1],e[1])+n,s.width=Math.abs(e[0]-t[0])+n,s.height=Math.abs(e[1]-t[1])+n}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const e=this.element_.style;e.left="inherit",e.top="inherit",e.width="inherit",e.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;const t=this.startPixel_,e=this.endPixel_,s=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);s[4]=s[0].slice(),this.geometry_?this.geometry_.setCoordinates([s]):this.geometry_=new Zt([s])}getGeometry(){return this.geometry_}}const Hm=Zm,hi={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"};class cs extends se{constructor(t,e,n){super(t),this.coordinate=e,this.mapBrowserEvent=n}}class qm extends li{constructor(t){super(),this.on,this.once,this.un,t=t??{},this.box_=new Hm(t.className||"ol-dragbox"),this.minArea_=t.minArea??64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition??Oc,this.boxEndCondition_=t.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,n){const s=n[0]-e[0],r=n[1]-e[1];return s*s+r*r>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.startPixel_&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new cs(hi.BOXDRAG,t.coordinate,t)))}handleUpEvent(t){if(!this.startPixel_)return!1;const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new cs(e?hi.BOXEND:hi.BOXCANCEL,t.coordinate,t)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(t){return this.condition_(t)?(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new cs(hi.BOXSTART,t.coordinate,t)),!0):!1}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new cs(hi.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}setMap(t){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new cs(hi.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(t)}}const Jm=qm;class Qm extends Jm{constructor(t){t=t||{};const e=t.condition?t.condition:Ia;super({condition:e,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=t.duration!==void 0?t.duration:200,this.out_=t.out!==void 0?t.out:!1}onBoxEnd(t){const n=this.getMap().getView();let s=this.getGeometry();if(this.out_){const r=n.rotatedExtentForGeometry(s),o=n.getResolutionForExtentInternal(r),a=n.getResolution()/o;s=s.clone(),s.scale(a*a)}n.fitInternal(s,{duration:this.duration_,easing:Rn})}}const tp=Qm,In={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};class ep extends hs{constructor(t){super(),t=t||{},this.defaultCondition_=function(e){return Sa(e)&&Dc(e)},this.condition_=t.condition!==void 0?t.condition:this.defaultCondition_,this.duration_=t.duration!==void 0?t.duration:100,this.pixelDelta_=t.pixelDelta!==void 0?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==z.KEYDOWN){const n=t.originalEvent,s=n.key;if(this.condition_(t)&&(s==In.DOWN||s==In.LEFT||s==In.RIGHT||s==In.UP)){const o=t.map.getView(),a=o.getResolution()*this.pixelDelta_;let l=0,h=0;s==In.DOWN?h=-a:s==In.LEFT?l=-a:s==In.RIGHT?l=a:h=a;const c=[l,h];Zr(c,o.getRotation()),Fm(o,c,this.duration_),n.preventDefault(),e=!0}}return!e}}const np=ep;class ip extends hs{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(e){return!Bm(e)&&Dc(e)},this.delta_=t.delta?t.delta:1,this.duration_=t.duration!==void 0?t.duration:100}handleEvent(t){let e=!1;if(t.type==z.KEYDOWN||t.type==z.KEYPRESS){const n=t.originalEvent,s=n.key;if(this.condition_(t)&&(s==="+"||s==="-")){const r=t.map,o=s==="+"?this.delta_:-this.delta_,a=r.getView();Ra(a,o,void 0,this.duration_),n.preventDefault(),e=!0}}return!e}}const sp=ip,rp=40,op=300;class ap extends hs{constructor(t){t=t||{},super(t),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=t.maxDelta!==void 0?t.maxDelta:1,this.duration_=t.duration!==void 0?t.duration:250,this.timeout_=t.timeout!==void 0?t.timeout:80,this.useAnchor_=t.useAnchor!==void 0?t.useAnchor:!0,this.constrainResolution_=t.constrainResolution!==void 0?t.constrainResolution:!1;const e=t.condition?t.condition:_r;this.condition_=t.onFocusOnly?Ta(Ac,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();if(!t)return;t.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(t){if(!this.condition_(t)||t.type!==z.WHEEL)return!0;const n=t.map,s=t.originalEvent;s.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.pixel);let r=s.deltaY;switch(s.deltaMode){case WheelEvent.DOM_DELTA_LINE:r*=rp;break;case WheelEvent.DOM_DELTA_PAGE:r*=op;break}if(r===0)return!1;this.lastDelta_=r;const o=Date.now();this.startTime_===void 0&&(this.startTime_=o),(!this.mode_||o-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(r)<4?"trackpad":"wheel");const a=n.getView();if(this.mode_==="trackpad"&&!(a.getConstrainResolution()||this.constrainResolution_))return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(a.getAnimating()&&a.cancelAnimations(),a.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),a.adjustZoom(-r/this.deltaPerZoom_,this.lastAnchor_?n.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=o,!1;this.totalDelta_+=r;const l=Math.max(this.timeout_-(o-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,n),l),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let n=-rt(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),Ra(e,n,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}}const lp=ap;class hp extends li{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=Zn),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=t.threshold!==void 0?t.threshold:.3,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){let e=0;const n=this.targetPointers[0],s=this.targetPointers[1],r=Math.atan2(s.clientY-n.clientY,s.clientX-n.clientX);if(this.lastAngle_!==void 0){const l=r-this.lastAngle_;this.rotationDelta_+=l,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=l}this.lastAngle_=r;const o=t.map,a=o.getView();a.getConstraints().rotation!==la&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(Pa(this.targetPointers))),this.rotating_&&(o.render(),a.adjustRotationInternal(e,this.anchor_)))}handleUpEvent(t){return this.targetPointers.length<2?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}const cp=hp;class up extends li{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=Zn),super(e),this.anchor_=null,this.duration_=t.duration!==void 0?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const n=this.targetPointers[0],s=this.targetPointers[1],r=n.clientX-s.clientX,o=n.clientY-s.clientY,a=Math.sqrt(r*r+o*o);this.lastDistance_!==void 0&&(e=this.lastDistance_/a),this.lastDistance_=a;const l=t.map,h=l.getView();e!=1&&(this.lastScaleDelta_=e),this.anchor_=l.getCoordinateFromPixelInternal(l.getEventPixel(Pa(this.targetPointers))),l.render(),h.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const n=t.map.getView(),s=this.lastScaleDelta_>1?1:-1;return n.endInteraction(this.duration_,s),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}const dp=up;function fp(i){i=i||{};const t=new Ht,e=new Om(-.005,.05,100);return(i.altShiftDragRotate!==void 0?i.altShiftDragRotate:!0)&&t.push(new $m),(i.doubleClickZoom!==void 0?i.doubleClickZoom:!0)&&t.push(new Nm({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan!==void 0?i.dragPan:!0)&&t.push(new Um({onFocusOnly:i.onFocusOnly,kinetic:e})),(i.pinchRotate!==void 0?i.pinchRotate:!0)&&t.push(new cp),(i.pinchZoom!==void 0?i.pinchZoom:!0)&&t.push(new dp({duration:i.zoomDuration})),(i.keyboard!==void 0?i.keyboard:!0)&&(t.push(new np),t.push(new sp({delta:i.zoomDelta,duration:i.zoomDuration}))),(i.mouseWheelZoom!==void 0?i.mouseWheelZoom:!0)&&t.push(new lp({onFocusOnly:i.onFocusOnly,duration:i.zoomDuration})),(i.shiftDragZoom!==void 0?i.shiftDragZoom:!0)&&t.push(new tp({duration:i.zoomDuration})),t}const sn={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"};class rn extends se{constructor(t,e){super(t),this.layer=e}}const ba={LAYERS:"layers"};class Ma extends as{constructor(t){t=t||{};const e=Object.assign({},t);delete e.layers;let n=t.layers;super(e),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(ba.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new Ht(n.slice(),{unique:!0}):J(typeof n.getArray=="function","Expected `layers` to be an array or a `Collection`"):n=new Ht(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(it),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push($(t,kt.ADD,this.handleLayersAdd_,this),$(t,kt.REMOVE,this.handleLayersRemove_,this));for(const n in this.listenerKeys_)this.listenerKeys_[n].forEach(it);Oi(this.listenerKeys_);const e=t.getArray();for(let n=0,s=e.length;n<s;n++){const r=e[n];this.registerLayerListeners_(r),this.dispatchEvent(new rn(sn.ADDLAYER,r))}this.changed()}registerLayerListeners_(t){const e=[$(t,Hn.PROPERTYCHANGE,this.handleLayerChange_,this),$(t,z.CHANGE,this.handleLayerChange_,this)];t instanceof Ma&&e.push($(t,sn.ADDLAYER,this.handleLayerGroupAdd_,this),$(t,sn.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[q(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new rn(sn.ADDLAYER,t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new rn(sn.REMOVELAYER,t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new rn(sn.ADDLAYER,e)),this.changed()}handleLayersRemove_(t){const e=t.element,n=q(e);this.listenerKeys_[n].forEach(it),delete this.listenerKeys_[n],this.dispatchEvent(new rn(sn.REMOVELAYER,e)),this.changed()}getLayers(){return this.get(ba.LAYERS)}setLayers(t){const e=this.getLayers();if(e){const n=e.getArray();for(let s=0,r=n.length;s<r;++s)this.dispatchEvent(new rn(sn.REMOVELAYER,n[s]))}this.set(ba.LAYERS,t)}getLayersArray(t){return t=t!==void 0?t:[],this.getLayers().forEach(function(e){e.getLayersArray(t)}),t}getLayerStatesArray(t){const e=t!==void 0?t:[],n=e.length;this.getLayers().forEach(function(o){o.getLayerStatesArray(e)});const s=this.getLayerState();let r=s.zIndex;!t&&s.zIndex===void 0&&(r=0);for(let o=n,a=e.length;o<a;o++){const l=e[o];l.opacity*=s.opacity,l.visible=l.visible&&s.visible,l.maxResolution=Math.min(l.maxResolution,s.maxResolution),l.minResolution=Math.max(l.minResolution,s.minResolution),l.minZoom=Math.max(l.minZoom,s.minZoom),l.maxZoom=Math.min(l.maxZoom,s.maxZoom),s.extent!==void 0&&(l.extent!==void 0?l.extent=Se(l.extent,s.extent):l.extent=s.extent),l.zIndex===void 0&&(l.zIndex=r)}return e}getSourceState(){return"ready"}}const mr=Ma;class gp extends Gs{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){j()}calculateMatrices2D(t){const e=t.viewState,n=t.coordinateToPixelTransform,s=t.pixelToCoordinateTransform;pe(n,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),wh(s,n)}forEachFeatureAtCoordinate(t,e,n,s,r,o,a,l){let h;const c=e.viewState;function u(E,w,T,v){return r.call(o,w,E?T:null,v)}const d=c.projection,f=Ol(t.slice(),d),g=[[0,0]];if(d.canWrapX()&&s){const E=d.getExtent(),w=K(E);g.push([-w,0],[w,0])}const _=e.layerStatesArray,m=_.length,p=[],y=[];for(let E=0;E<g.length;E++)for(let w=m-1;w>=0;--w){const T=_[w],v=T.layer;if(v.hasRenderer()&&da(T,c)&&a.call(l,v)){const R=v.getRenderer(),I=v.getSource();if(R&&I){const b=I.getWrapX()?f:t,O=u.bind(null,T.managed);y[0]=b[0]+g[E][0],y[1]=b[1]+g[E][1],h=R.forEachFeatureAtCoordinate(y,e,n,O,p)}if(h)return h}}if(p.length===0)return;const C=1/p.length;return p.forEach((E,w)=>E.distanceSq+=w*C),p.sort((E,w)=>E.distanceSq-w.distanceSq),p.some(E=>h=E.callback(E.feature,E.layer,E.geometry)),h}hasFeatureAtCoordinate(t,e,n,s,r,o){return this.forEachFeatureAtCoordinate(t,e,n,s,$n,this,r,o)!==void 0}getMap(){return this.map_}renderFrame(t){j()}scheduleExpireIconCache(t){Ut.canExpireCache()&&t.postRenderFunctions.push(_p)}}function _p(i,t){Ut.expire()}const mp=gp;class pp extends mp{constructor(t){super(t),this.fontChangeListenerKey_=$(Qn,Hn.PROPERTYCHANGE,t.redrawText,t),this.element_=Bt?zl():document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=Bs+" ol-layers";const n=t.getViewport();n&&n.insertBefore(this.element_,n.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(t,e){const n=this.getMap();if(n.hasListener(t)){const s=new Xh(t,void 0,e);n.dispatchEvent(s)}}disposeInternal(){it(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(t){if(!t){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(t),this.dispatchRenderEvent(Vt.PRECOMPOSE,t);const e=t.layerStatesArray.sort((h,c)=>h.zIndex-c.zIndex);e.some(h=>h.layer instanceof vc&&h.layer.getDeclutter())&&(t.declutter={});const s=t.viewState;this.children_.length=0;const r=[];let o=null;for(let h=0,c=e.length;h<c;++h){const u=e[h];t.layerIndex=h;const d=u.layer,f=d.getSourceState();if(!da(u,s)||f!="ready"&&f!="undefined"){d.unrender();continue}const g=d.render(t,o);g&&(g!==o&&(this.children_.push(g),o=g),r.push(u))}this.declutter(t,r),Td(this.element_,this.children_);const l=this.getMap().getTargetElement();if(Ve(l)){const h=l.getContext("2d");for(const c of this.children_){const u=c.firstElementChild||c,d=c.style.backgroundColor;if(d&&(!Ve(u)||u.width>0)&&(h.fillStyle=d,h.fillRect(0,0,l.width,l.height)),Ve(u)&&u.width>0){const f=c.style.opacity||u.style.opacity;h.globalAlpha=f===""?1:Number(f);const g=u.style.transform;if(g)h.setTransform(...Po(g));else{const _=parseFloat(u.style.width)/u.width,m=parseFloat(u.style.height)/u.height;h.setTransform(_,0,0,m,0,0)}h.drawImage(u,0,0)}}h.globalAlpha=1,h.setTransform(1,0,0,1,0,0)}this.dispatchRenderEvent(Vt.POSTCOMPOSE,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}declutter(t,e){if(t.declutter){for(let n=e.length-1;n>=0;--n){const s=e[n],r=s.layer;r.getDeclutter()&&r.renderDeclutter(t,s)}e.forEach(n=>n.layer.renderDeferred(t))}}}const yp=pp;function Fc(i){if(i instanceof ls){i.setMapInternal(null);return}i instanceof mr&&i.getLayers().forEach(Fc)}function kc(i,t){if(i instanceof ls){i.setMapInternal(t);return}if(i instanceof mr){const e=i.getLayers().getArray();for(let n=0,s=e.length;n<s;++n)kc(e[n],t)}}let xp=class extends Kt{constructor(t){super(),t=t||{},this.on,this.once,this.un;const e=Ep(t);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=t.maxTilesLoading!==void 0?t.maxTilesLoading:16,this.pixelRatio_=t.pixelRatio!==void 0?t.pixelRatio:Cd,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=re(),this.pixelToCoordinateTransform_=re(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,Bt||(this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_)),this.mapBrowserEventHandler_=null,this.moveTolerance_=t.moveTolerance,this.keyboardEventTarget_=e.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,Bt||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=e.controls||(Bt?new Ht:Mc()),this.interactions=e.interactions||(Bt?new Ht:fp({onFocusOnly:!0})),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new vm(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(vt.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(vt.VIEW,this.handleViewChanged_),this.addChangeListener(vt.SIZE,this.handleSizeChanged_),this.addChangeListener(vt.TARGET,this.handleTargetChanged_),this.setProperties(e.values);const n=this;t.view&&!(t.view instanceof xe)&&t.view.then(function(s){n.setView(new xe(s))}),this.controls.addEventListener(kt.ADD,s=>{s.element.setMap(this)}),this.controls.addEventListener(kt.REMOVE,s=>{s.element.setMap(null)}),this.interactions.addEventListener(kt.ADD,s=>{s.element.setMap(this)}),this.interactions.addEventListener(kt.REMOVE,s=>{s.element.setMap(null)}),this.overlays_.addEventListener(kt.ADD,s=>{this.addOverlayInternal_(s.element)}),this.overlays_.addEventListener(kt.REMOVE,s=>{const r=s.element.getId();r!==void 0&&delete this.overlayIdIndex_[r.toString()],s.element.setMap(null)}),this.controls.forEach(s=>{s.setMap(this)}),this.interactions.forEach(s=>{s.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}handleLayerAdd_(t){kc(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();e!==void 0&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){var t;this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),(t=this.resizeObserver_)==null||t.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,n){if(!this.frameState_||!this.renderer_)return;const s=this.getCoordinateFromPixelInternal(t);n=n!==void 0?n:{};const r=n.hitTolerance!==void 0?n.hitTolerance:0,o=n.layerFilter!==void 0?n.layerFilter:$n,a=n.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(s,this.frameState_,r,a,e,null,o,null)}getFeaturesAtPixel(t,e){const n=[];return this.forEachFeatureAtPixel(t,function(s){n.push(s)},e),n}getAllLayers(){const t=[];function e(n){n.forEach(function(s){s instanceof mr?e(s.getLayers()):t.push(s)})}return e(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const n=this.getCoordinateFromPixelInternal(t);e=e!==void 0?e:{};const s=e.layerFilter!==void 0?e.layerFilter:$n,r=e.hitTolerance!==void 0?e.hitTolerance:0,o=e.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(n,this.frameState_,r,o,s,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const n=this.viewport_.getBoundingClientRect(),s=this.getSize(),r=n.width/s[0],o=n.height/s[1],a="changedTouches"in t?t.changedTouches[0]:t;return[(a.clientX-n.left)/r,(a.clientY-n.top)/o]}getTarget(){return this.get(vt.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return lo(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?gt(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){const e=this.overlayIdIndex_[t.toString()];return e!==void 0?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(vt.LAYERGROUP)}setLayers(t){const e=this.getLayerGroup();if(t instanceof Ht){e.setLayers(t);return}const n=e.getLayers();n.clear(),n.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,n=t.length;e<n;++e){const s=t[e];if(!s.visible)continue;const r=s.layer.getRenderer();if(r&&!r.ready)return!0;const o=s.layer.getSource();if(o&&o.loading)return!0}return!1}getPixelFromCoordinate(t){const e=Wt(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?gt(e.coordinateToPixelTransform,t.slice(0,2)):null}getRenderer(){return this.renderer_}getSize(){return this.get(vt.SIZE)}getView(){return this.get(vt.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const t=this.getTargetElement();return t?t.ownerDocument:document}getTilePriority(t,e,n,s){return Rm(this.frameState_,t,e,n,s)}handleBrowserEvent(t,e){e=e||t.type;const n=new Ne(e,this,t);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(t){if(!this.frameState_)return;const e=t.originalEvent,n=e.type;if(n===Ca.POINTERDOWN||n===z.WHEEL||n===z.KEYDOWN){const s=this.getOwnerDocument(),r=this.viewport_.getRootNode?this.viewport_.getRootNode():s,o=e.target,a=r instanceof ShadowRoot?r.host===o?r.host.ownerDocument:r:r===s?s.documentElement:r;if(this.overlayContainerStopEvent_.contains(o)||!a.contains(o))return}if(t.frameState=this.frameState_,this.dispatchEvent(t)!==!1){const s=this.getInteractions().getArray().slice();for(let r=s.length-1;r>=0;r--){const o=s[r];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(t)||t.propagationStopped)break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let s=this.maxTilesLoading_,r=s;if(t){const o=t.viewHints;if(o[st.ANIMATING]||o[st.INTERACTING]){const a=Date.now()-t.time>8;s=a?0:8,r=a?0:2}}e.getTilesLoading()<s&&(e.reprioritize(),e.loadMoreTiles(s,r))}t&&this.renderer_&&!t.animate&&(this.renderComplete_?(this.hasListener(Vt.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(Vt.RENDERCOMPLETE,t),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new ai(Ge.LOADEND,this,t)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new ai(Ge.LOADSTART,this,t))));const n=this.postRenderFunctions_;if(t)for(let s=0,r=n.length;s<r;++s)n[s](this,t);n.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){var n,s;if(this.mapBrowserEventHandler_){for(let r=0,o=this.targetChangeHandlerKeys_.length;r<o;++r)it(this.targetChangeHandlerKeys_[r]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(z.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(z.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!Ve(this.targetElement_)){(n=this.resizeObserver_)==null||n.unobserve(this.targetElement_);const r=this.targetElement_.getRootNode();r instanceof ShadowRoot&&this.resizeObserver_.unobserve(r.host),this.setSize(void 0)}const t=this.getTarget(),e=typeof t=="string"?document.getElementById(t):t;if(this.targetElement_=e,!e)this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0);else{if(Ve(e)||e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new yp(this)),!Ve(e)){this.mapBrowserEventHandler_=new xm(this,this.moveTolerance_);for(const o in tt)this.mapBrowserEventHandler_.addEventListener(tt[o],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(z.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(z.WHEEL,this.boundHandleBrowserEvent_,kl?{passive:!1}:!1);let r;if(this.keyboardEventTarget_)r=this.keyboardEventTarget_;else{const o=e.getRootNode();r=o instanceof ShadowRoot?o.host:e}if(this.targetChangeHandlerKeys_=[$(r,z.KEYDOWN,this.handleBrowserEvent,this),$(r,z.KEYPRESS,this.handleBrowserEvent,this)],e instanceof HTMLElement){const o=e.getRootNode();o instanceof ShadowRoot&&this.resizeObserver_.observe(o.host),(s=this.resizeObserver_)==null||s.observe(e)}}this.updateSize()}}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(it(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(it(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=$(t,Hn.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=$(t,z.CHANGE,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(it),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new rn("addlayer",t)),this.layerGroupPropertyListenerKeys_=[$(t,Hn.PROPERTYCHANGE,this.render,this),$(t,z.CHANGE,this.render,this),$(t,"addlayer",this.handleLayerAdd_,this),$(t,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;const t=this.frameState_.layerStatesArray;for(let e=0,n=t.length;e<n;++e){const s=t[e].layer;s.hasRenderer()&&s.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(t){return this.getControls().remove(t)}removeInteraction(t){return this.getInteractions().remove(t)}removeLayer(t){return this.getLayerGroup().getLayers().remove(t)}handleLayerRemove_(t){Fc(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){const e=this.getSize(),n=this.getView(),s=this.frameState_;let r=null;if(e!==void 0&&Ih(e)&&n&&n.isDef()){const o=n.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=n.getState();if(r={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:Ts(a.center,a.resolution,a.rotation,e),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:e,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{},mapId:q(this),renderTargets:{}},a.nextCenter&&a.nextResolution){const l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;r.nextExtent=Ts(a.nextCenter,a.nextResolution,l,e)}}this.frameState_=r,this.renderer_.renderFrame(r),r&&(r.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,r.postRenderFunctions),s&&(!this.previousExtent_||!Xn(this.previousExtent_)&&!zn(r.extent,this.previousExtent_))&&(this.dispatchEvent(new ai(Ge.MOVESTART,this,s)),this.previousExtent_=Ii(this.previousExtent_)),this.previousExtent_&&!r.viewHints[st.ANIMATING]&&!r.viewHints[st.INTERACTING]&&!zn(r.extent,this.previousExtent_)&&(this.dispatchEvent(new ai(Ge.MOVEEND,this,r)),Cl(r.extent,this.previousExtent_))),this.dispatchEvent(new ai(Ge.POSTRENDER,this,r)),this.renderComplete_=(this.hasListener(Ge.LOADSTART)||this.hasListener(Ge.LOADEND)||this.hasListener(Vt.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new rn("removelayer",e)),this.set(vt.LAYERGROUP,t)}setSize(t){this.set(vt.SIZE,t)}setTarget(t){this.set(vt.TARGET,t)}setView(t){if(!t||t instanceof xe){this.set(vt.VIEW,t);return}this.set(vt.VIEW,new xe);const e=this;t.then(function(n){e.setView(new xe(n))})}updateSize(){const t=this.getTargetElement();let e;if(t){let s,r;if(Ve(t))s=t.width,r=t.height;else{const o=getComputedStyle(t);s=t.offsetWidth-parseFloat(o.borderLeftWidth)-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight)-parseFloat(o.borderRightWidth),r=t.offsetHeight-parseFloat(o.borderTopWidth)-parseFloat(o.paddingTop)-parseFloat(o.paddingBottom)-parseFloat(o.borderBottomWidth)}!isNaN(s)&&!isNaN(r)&&(e=[Math.max(0,s),Math.max(0,r)],!Ih(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&Xl("No map visible because the map container's width or height are 0."))}const n=this.getSize();e&&(!n||!Be(e,n))&&(this.setSize(e),this.updateViewportSize_(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}};function Ep(i){let t=null;i.keyboardEventTarget!==void 0&&(t=typeof i.keyboardEventTarget=="string"?document.getElementById(i.keyboardEventTarget):i.keyboardEventTarget);const e={},n=i.layers&&typeof i.layers.getLayers=="function"?i.layers:new mr({layers:i.layers});e[vt.LAYERGROUP]=n,e[vt.TARGET]=i.target,e[vt.VIEW]=i.view instanceof xe?i.view:new xe;let s;i.controls!==void 0&&(Array.isArray(i.controls)?s=new Ht(i.controls.slice()):(J(typeof i.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),s=i.controls));let r;i.interactions!==void 0&&(Array.isArray(i.interactions)?r=new Ht(i.interactions.slice()):(J(typeof i.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),r=i.interactions));let o;return i.overlays!==void 0?Array.isArray(i.overlays)?o=new Ht(i.overlays.slice()):(J(typeof i.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=i.overlays):o=new Ht,{controls:s,interactions:r,keyboardEventTarget:t,overlays:o,values:e}}const ci=xp;class Cp extends zi{constructor(t,e,n){super(),n=n||{},this.tileCoord=t,this.state=e,this.key="",this.transition_=n.transition===void 0?250:n.transition,this.transitionStarts_={},this.interpolate=!!n.interpolate}changed(){this.dispatchEvent(z.CHANGE)}release(){this.setState(F.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==F.EMPTY){if(this.state!==F.ERROR&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}}load(){j()}getAlpha(t,e){if(!this.transition_)return 1;let n=this.transitionStarts_[t];if(!n)n=e,this.transitionStarts_[t]=n;else if(n===-1)return 1;const s=e-n+1e3/60;return s>=this.transition_?1:ac(s/this.transition_)}inTransition(t){return this.transition_?this.transitionStarts_[t]!==-1:!1}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}disposeInternal(){this.release(),super.disposeInternal()}}const Aa=Cp;function Oa(i){return i instanceof Image||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageBitmap?i:null}const wp=new Error("disposed"),vp=[256,256];class Rp extends Aa{constructor(t){const e=F.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=Oa(this.data_);return t?[t.width,t.height]:vp}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==F.IDLE&&this.state!==F.ERROR)return;this.state=F.LOADING,this.changed();const t=this;this.loader_().then(function(e){t.data_=e,t.state=F.LOADED,t.changed()}).catch(function(e){t.error_=e,t.state=F.ERROR,t.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(wp),this.controller_=null),super.disposeInternal()}}const Nc=Rp;class Tp extends Aa{constructor(t,e,n,s,r,o){super(t,e,o),this.crossOrigin_=s,this.src_=n,this.key=n,this.image_,Bt?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,s!==null&&(this.image_.crossOrigin=s)),this.unlisten_=null,this.tileLoadFunction_=r}getImage(){return this.image_}setImage(t){this.image_=t,this.state=F.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}handleImageError_(){this.state=F.ERROR,this.unlistenImage_(),this.image_=Sp(),this.changed()}handleImageLoad_(){if(Bt)this.state=F.LOADED;else{const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=F.LOADED:this.state=F.EMPTY}this.unlistenImage_(),this.changed()}load(){this.state==F.ERROR&&(this.state=F.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==F.IDLE&&(this.state=F.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=yf(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}}function Sp(){const i=ft(1,1);return i.fillStyle="rgba(0,0,0,0)",i.fillRect(0,0,1,1),i.canvas}const Gc=Tp;class zc{constructor(t,e,n,s){this.minX=t,this.maxX=e,this.minY=n,this.maxY=s}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.minX<this.minX&&(this.minX=t.minX),t.maxX>this.maxX&&(this.maxX=t.maxX),t.minY<this.minY&&(this.minY=t.minY),t.maxY>this.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 ui(i,t,e,n,s){return s!==void 0?(s.minX=i,s.maxX=t,s.minY=e,s.maxY=n,s):new zc(i,t,e,n)}const jc=zc;let Da;const di=[];function Xc(i,t,e,n,s){i.beginPath(),i.moveTo(0,0),i.lineTo(t,e),i.lineTo(n,s),i.closePath(),i.save(),i.clip(),i.fillRect(0,0,Math.max(t,n)+1,Math.max(e,s)),i.restore()}function Fa(i,t){return Math.abs(i[t*4]-210)>2||Math.abs(i[t*4+3]-191.25)>2}function Ip(){if(Da===void 0){const i=ft(6,6,di);i.globalCompositeOperation="lighter",i.fillStyle="rgba(210, 0, 0, 0.75)",Xc(i,4,5,4,0),Xc(i,4,5,0,5);const t=i.getImageData(0,0,3,3).data;Da=Fa(t,0)||Fa(t,4)||Fa(t,8),bs(i),di.push(i.canvas)}return Da}function pr(i,t,e,n){const s=ao(e,t,i);let r=nh(t,n,e);const o=t.getMetersPerUnit();o!==void 0&&(r*=o);const a=i.getMetersPerUnit();a!==void 0&&(r/=a);const l=i.getExtent();if(!l||cn(l,s)){const h=nh(i,r,s)/r;isFinite(h)&&h>0&&(r/=h)}return r}function Lp(i,t,e,n){const s=ie(e);let r=pr(i,t,s,n);return(!isFinite(r)||r<=0)&&Ur(e,function(o){return r=pr(i,t,o,n),isFinite(r)&&r>0}),r}function Bc(i,t,e,n,s,r,o,a,l,h,c,u,d,f){const g=ft(Math.round(e*i),Math.round(e*t),di);if(u||(g.imageSmoothingEnabled=!1),l.length===0)return g.canvas;g.scale(e,e);function _(w){return Math.round(w*e)/e}g.globalCompositeOperation="lighter";const m=Mt();l.forEach(function(w,T,v){wl(m,w.extent)});let p;const y=e/n,C=(u?1:1+Math.pow(2,-24))/y;if(!d||l.length!==1||h!==0){if(p=ft(Math.round(K(m)*y),Math.round(ct(m)*y),di),u||(p.imageSmoothingEnabled=!1),s&&f){const w=(s[0]-m[0])*y,T=-(s[3]-m[3])*y,v=K(s)*y,R=ct(s)*y;p.rect(w,T,v,R),p.clip()}l.forEach(function(w,T,v){if(w.image.width>0&&w.image.height>0){if(w.clipExtent){p.save();const D=(w.clipExtent[0]-m[0])*y,P=-(w.clipExtent[3]-m[3])*y,A=K(w.clipExtent)*y,W=ct(w.clipExtent)*y;p.rect(u?D:Math.round(D),u?P:Math.round(P),u?A:Math.round(D+A)-Math.round(D),u?W:Math.round(P+W)-Math.round(P)),p.clip()}const R=(w.extent[0]-m[0])*y,I=-(w.extent[3]-m[3])*y,b=K(w.extent)*y,O=ct(w.extent)*y;p.drawImage(w.image,h,h,w.image.width-2*h,w.image.height-2*h,u?R:Math.round(R),u?I:Math.round(I),u?b:Math.round(R+b)-Math.round(R),u?O:Math.round(I+O)-Math.round(I)),w.clipExtent&&p.restore()}})}const E=Ye(o);return a.getTriangles().forEach(function(w,T,v){const R=w.source,I=w.target;let b=R[0][0],O=R[0][1],D=R[1][0],P=R[1][1],A=R[2][0],W=R[2][1];const N=_((I[0][0]-E[0])/r),B=_(-(I[0][1]-E[1])/r),k=_((I[1][0]-E[0])/r),U=_(-(I[1][1]-E[1])/r),H=_((I[2][0]-E[0])/r),nt=_(-(I[2][1]-E[1])/r),L=b,It=O;b=0,O=0,D-=L,P-=It,A-=L,W-=It;const yt=[[D,P,0,0,k-N],[A,W,0,0,H-N],[0,0,D,P,U-B],[0,0,A,W,nt-B]],ut=yd(yt);if(!ut)return;if(g.save(),g.beginPath(),Ip()||!u){g.moveTo(k,U);const Lt=4,Ce=N-k,de=B-U;for(let Xt=0;Xt<Lt;Xt++)g.lineTo(k+_((Xt+1)*Ce/Lt),U+_(Xt*de/(Lt-1))),Xt!=Lt-1&&g.lineTo(k+_((Xt+1)*Ce/Lt),U+_((Xt+1)*de/(Lt-1)));g.lineTo(H,nt)}else g.moveTo(k,U),g.lineTo(N,B),g.lineTo(H,nt);g.clip(),g.transform(ut[0],ut[2],ut[1],ut[3],N,B),g.translate(m[0]-L,m[3]-It);let jt;if(p)jt=p.canvas,g.scale(C,-C);else{const Lt=l[0],Ce=Lt.extent;jt=Lt.image,g.scale(K(Ce)/jt.width,-ct(Ce)/jt.height)}g.drawImage(jt,0,0),g.restore()}),p&&(bs(p),di.push(p.canvas)),c&&(g.save(),g.globalCompositeOperation="source-over",g.strokeStyle="black",g.lineWidth=1,a.getTriangles().forEach(function(w,T,v){const R=w.target,I=(R[0][0]-E[0])/r,b=-(R[0][1]-E[1])/r,O=(R[1][0]-E[0])/r,D=-(R[1][1]-E[1])/r,P=(R[2][0]-E[0])/r,A=-(R[2][1]-E[1])/r;g.beginPath(),g.moveTo(O,D),g.lineTo(I,b),g.lineTo(P,A),g.closePath(),g.stroke()}),g.restore()),g.canvas}const Pp=10,Yc=.25;class bp{constructor(t,e,n,s,r,o,a){this.sourceProj_=t,this.targetProj_=e;let l={};const h=a?nf(C=>gt(a,ao(C,this.targetProj_,this.sourceProj_))):Fi(this.targetProj_,this.sourceProj_);this.transformInv_=function(C){const E=C[0]+"/"+C[1];return l[E]||(l[E]=h(C)),l[E]},this.maxSourceExtent_=s,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!s&&!!this.sourceProj_.getExtent()&&K(s)>=K(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?K(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?K(this.targetProj_.getExtent()):null;const c=Ye(n),u=bi(n),d=Pi(n),f=jn(n),g=this.transformInv_(c),_=this.transformInv_(u),m=this.transformInv_(d),p=this.transformInv_(f),y=Pp+(o?Math.max(0,Math.ceil(Math.log2(Kr(n)/(o*o*256*256)))):0);if(this.addQuad_(c,u,d,f,g,_,m,p,y),this.wrapsXInSource_){let C=1/0;this.triangles_.forEach(function(E,w,T){C=Math.min(C,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])-C>this.sourceWorldWidth_/2){const w=[[E.source[0][0],E.source[0][1]],[E.source[1][0],E.source[1][1]],[E.source[2][0],E.source[2][1]]];w[0][0]-C>this.sourceWorldWidth_/2&&(w[0][0]-=this.sourceWorldWidth_),w[1][0]-C>this.sourceWorldWidth_/2&&(w[1][0]-=this.sourceWorldWidth_),w[2][0]-C>this.sourceWorldWidth_/2&&(w[2][0]-=this.sourceWorldWidth_);const T=Math.min(w[0][0],w[1][0],w[2][0]);Math.max(w[0][0],w[1][0],w[2][0])-T<this.sourceWorldWidth_/2&&(E.source=w)}})}l={}}addTriangle_(t,e,n,s,r,o){this.triangles_.push({source:[s,r,o],target:[t,e,n]})}addQuad_(t,e,n,s,r,o,a,l,h){const c=Rs([r,o,a,l]),u=this.sourceWorldWidth_?K(c)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,f=this.sourceProj_.canWrapX()&&u>.5&&u<1;let g=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const m=Rs([t,e,n,s]);g=K(m)/this.targetWorldWidth_>Yc||g}!f&&this.sourceProj_.isGlobal()&&u&&(g=u>Yc||g)}if(!g&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!Ct(c,this.maxSourceExtent_))return;let _=0;if(!g&&(!isFinite(r[0])||!isFinite(r[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(h>0)g=!0;else if(_=(!isFinite(r[0])||!isFinite(r[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),_!=1&&_!=2&&_!=4&&_!=8)return}if(h>0){if(!g){const m=[(t[0]+n[0])/2,(t[1]+n[1])/2],p=this.transformInv_(m);let y;f?y=(un(r[0],d)+un(a[0],d))/2-un(p[0],d):y=(r[0]+a[0])/2-p[0];const C=(r[1]+a[1])/2-p[1];g=y*y+C*C>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-n[0])<=Math.abs(t[1]-n[1])){const m=[(e[0]+n[0])/2,(e[1]+n[1])/2],p=this.transformInv_(m),y=[(s[0]+t[0])/2,(s[1]+t[1])/2],C=this.transformInv_(y);this.addQuad_(t,e,m,y,r,o,p,C,h-1),this.addQuad_(y,m,n,s,C,p,a,l,h-1)}else{const m=[(t[0]+e[0])/2,(t[1]+e[1])/2],p=this.transformInv_(m),y=[(n[0]+s[0])/2,(n[1]+s[1])/2],C=this.transformInv_(y);this.addQuad_(t,m,y,s,r,p,C,l,h-1),this.addQuad_(m,e,n,y,p,o,a,C,h-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}_&11||this.addTriangle_(t,n,s,r,a,l),_&14||this.addTriangle_(t,n,e,r,a,o),_&&(_&13||this.addTriangle_(e,s,t,o,l,r),_&7||this.addTriangle_(e,s,n,o,l,a))}calculateSourceExtent(){const t=Mt();return this.triangles_.forEach(function(e,n,s){const r=e.source;Li(t,r[0]),Li(t,r[1]),Li(t,r[2])}),t}getTriangles(){return this.triangles_}}const Wc=bp,Vc=.5;class Mp extends Aa{constructor(t,e,n,s,r,o,a,l,h,c,u,d){super(r,F.IDLE,d),this.renderEdges_=u!==void 0?u:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=s,this.wrappedTileCoord_=o||r,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()?t.getExtent():void 0;const f=s.getTileCoordExtent(this.wrappedTileCoord_),g=this.targetTileGrid_.getExtent();let _=this.sourceTileGrid_.getExtent();const m=g?Se(f,g):f;if(Kr(m)===0){this.state=F.EMPTY;return}const p=t.getExtent();p&&(_?_=Se(_,p):_=p);const y=s.getResolution(this.wrappedTileCoord_[0]),C=Lp(t,n,m,y);if(!isFinite(C)||C<=0){this.state=F.EMPTY;return}const E=c!==void 0?c:Vc;if(this.triangulation_=new Wc(t,n,m,_,C*E,y),this.triangulation_.getTriangles().length===0){this.state=F.EMPTY;return}this.sourceZ_=e.getZForResolution(C);let w=this.triangulation_.calculateSourceExtent();if(_&&(t.canWrapX()?(w[1]=rt(w[1],_[1],_[3]),w[3]=rt(w[3],_[1],_[3])):w=Se(w,_)),!Kr(w))this.state=F.EMPTY;else{let T=0,v=0;t.canWrapX()&&(T=K(p),v=Math.floor((w[0]-p[0])/T)),Sl(w.slice(),t,!0).forEach(I=>{const b=e.getTileRangeForExtentAndZ(I,this.sourceZ_);for(let O=b.minX;O<=b.maxX;O++)for(let D=b.minY;D<=b.maxY;D++){const P=h(this.sourceZ_,O,D,a);if(P){const A=v*T;this.sourceTiles_.push({tile:P,offset:A})}}++v}),this.sourceTiles_.length===0&&(this.state=F.EMPTY)}}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{var s;const n=e.tile;if(n&&n.getState()==F.LOADED){const r=this.sourceTileGrid_.getTileCoordExtent(n.tileCoord);r[0]+=e.offset,r[2]+=e.offset;const o=(s=this.clipExtent_)==null?void 0:s.slice();o&&(o[0]+=e.offset,o[2]+=e.offset),t.push({extent:r,clipExtent:o,image:n.getImage()})}}),this.sourceTiles_.length=0,t.length===0)this.state=F.ERROR;else{const e=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(e),s=typeof n=="number"?n:n[0],r=typeof n=="number"?n:n[1],o=this.targetTileGrid_.getResolution(e),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Bc(s,r,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=F.LOADED}this.changed()}load(){if(this.state==F.IDLE){this.state=F.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:e})=>{const n=e.getState();if(n==F.IDLE||n==F.LOADING){t++;const s=$(e,z.CHANGE,r=>{const o=e.getState();(o==F.LOADED||o==F.ERROR||o==F.EMPTY)&&(it(s),t--,t===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(s)}}),t===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:e},n,s){e.getState()==F.IDLE&&e.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(it),this.sourcesListenerKeys_=null}release(){this.canvas_&&(bs(this.canvas_.getContext("2d")),di.push(this.canvas_),this.canvas_=null),super.release()}}const Uc=Mp;class Ap{constructor(t){this.highWaterMark=t!==void 0?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){const t=this.pop();t instanceof Gs&&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 n=this.entries_[t];return J(n!==void 0,"Tried to get a value for a key that does not exist in the cache"),n===this.newest_||(n===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(n.newer.older=n.older,n.older.newer=n.newer),n.newer=null,n.older=this.newest_,this.newest_.newer=n,this.newest_=n),n.value_}remove(t){const e=this.entries_[t];return J(e!==void 0,"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=0,n;for(n=this.newest_;n;n=n.older)t[e++]=n.key_;return t}getValues(){const t=new Array(this.count_);let e=0,n;for(n=this.newest_;n;n=n.older)t[e++]=n.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){var e;return(e=this.entries_[t])==null?void 0:e.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){J(!(t in this.entries_),"Tried to set a value for a key that is used already");const n={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[t]=n,++this.count_}setSize(t){this.highWaterMark=t}}const Kc=Ap;function yr(i,t,e,n){return n!==void 0?(n[0]=i,n[1]=t,n[2]=e,n):[i,t,e]}function Op(i,t,e){return i+"/"+t+"/"+e}function xr(i,t,e,n,s){return`${q(i)},${t},${Op(e,n,s)}`}function $c(i){return Dp(i[0],i[1],i[2])}function Dp(i,t,e){return(t<<i)+e}function Fp(i,t){const e=i[0],n=i[1],s=i[2];if(t.getMinZoom()>e||e>t.getMaxZoom())return!1;const r=t.getFullTileRange(e);return r?r.containsXY(n,s):!0}function ka(i,t,e){if(!(e in i))return i[e]=new Set([t]),!0;const n=i[e],s=n.has(t);return s||n.add(t),!s}function kp(i,t,e){const n=i[e];return n?n.delete(t):!1}function Zc(i,t){const e=i.layerStatesArray[i.layerIndex];e.extent&&(t=Se(t,_e(e.extent,i.viewState.projection)));const n=e.layer.getRenderSource();if(!n.getWrapX()){const s=n.getTileGridForProjection(i.viewState.projection).getExtent();s&&(t=Se(t,s))}return t}class Np extends Xo{constructor(t,e){super(t),e=e||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceKey_,this.renderedSourceRevision_,this.tempExtent=Mt(),this.tempTileRange_=new jc(0,0,0,0),this.tempTileCoord_=yr(0,0,0);const n=e.cacheSize!==void 0?e.cacheSize:512;this.tileCache_=new Kc(n),this.sourceTileCache_=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new Kc(512)),this.sourceTileCache_}getOrCreateTile(t,e,n,s){const r=this.tileCache_,a=this.getLayer().getSource(),l=xr(a,a.getKey(),t,e,n);let h;if(r.containsKey(l))h=r.get(l);else{const c=s.viewState.projection,u=a.getProjection();if(h=a.getTile(t,e,n,s.pixelRatio,c,!u||mn(u,c)?void 0:this.getSourceTileCache()),!h)return null;r.set(l,h)}return h}getTile(t,e,n,s){const r=this.getOrCreateTile(t,e,n,s);return r||null}getData(t){const e=this.frameState;if(!e)return null;const n=this.getLayer(),s=gt(e.pixelToCoordinateTransform,t.slice()),r=n.getExtent();if(r&&!cn(r,s))return null;const o=e.viewState,a=n.getRenderSource(),l=a.getTileGridForProjection(o.projection),h=a.getTilePixelRatio(e.pixelRatio);for(let c=l.getZForResolution(o.resolution);c>=l.getMinZoom();--c){const u=l.getTileCoordForCoordAndZ(s,c),d=this.getTile(c,u[1],u[2],e);if(!d||d.getState()!==F.LOADED)continue;const f=l.getOrigin(c),g=Ot(l.getTileSize(c)),_=l.getResolution(c);let m;if(d instanceof Gc||d instanceof Uc)m=d.getImage();else if(d instanceof Nc){if(m=Oa(d.getData()),!m)continue}else continue;const p=Math.floor(h*((s[0]-f[0])/_-u[1]*g[0])),y=Math.floor(h*((f[1]-s[1])/_-u[2]*g[1])),C=Math.round(h*a.getGutterForProjection(o.projection));return this.getImageData(m,p+C,y+C)}return null}prepareFrame(t){var s;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 n=e.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==n&&(this.renderedSourceRevision_=n,this.renderedSourceKey_===e.getKey()&&(this.tileCache_.clear(),(s=this.sourceTileCache_)==null||s.clear())):this.renderedSourceRevision_=n,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(t,e,n,s,r){const o=t.viewState,a=this.getLayer(),l=a.getRenderSource(),h=l.getTileGridForProjection(o.projection),c=q(l);c in t.wantedTiles||(t.wantedTiles[c]={});const u=t.wantedTiles[c],d=a.getMapInternal(),f=Math.max(n-r,h.getMinZoom(),h.getZForResolution(Math.min(a.getMaxResolution(),d?d.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):h.getResolution(0)),l.zDirection)),g=o.rotation,_=g?Rl(o.center,o.resolution,g,t.size):void 0;for(let m=n;m>=f;--m){const p=h.getTileRangeForExtentAndZ(e,m,this.tempTileRange_),y=h.getResolution(m);for(let C=p.minX;C<=p.maxX;++C)for(let E=p.minY;E<=p.maxY;++E){if(g&&!h.tileCoordIntersectsViewport([m,C,E],_))continue;const w=this.getTile(m,C,E,t);if(!w||!ka(s,w,m))continue;const v=w.getKey();if(u[v]=!0,w.getState()===F.IDLE&&!t.tileQueue.isKeyQueued(v)){const R=yr(m,C,E,this.tempTileCoord_);t.tileQueue.enqueue([w,c,h.getTileCoordCenter(R),y])}}}}findStaleTile_(t,e){const n=this.tileCache_,s=t[0],r=t[1],o=t[2],a=this.getStaleKeys();for(let l=0;l<a.length;++l){const h=xr(this.getLayer().getSource(),a[l],s,r,o);if(n.containsKey(h)){const c=n.peek(h);if(c.getState()===F.LOADED)return c.endTransition(q(this)),ka(e,c,s),!0}}return!1}findAltTiles_(t,e,n,s){const r=t.getTileRangeForTileCoordAndZ(e,n,this.tempTileRange_);if(!r)return!1;let o=!0;const a=this.tileCache_,l=this.getLayer().getRenderSource(),h=l.getKey();for(let c=r.minX;c<=r.maxX;++c)for(let u=r.minY;u<=r.maxY;++u){const d=xr(l,h,n,c,u);let f=!1;if(a.containsKey(d)){const g=a.peek(d);g.getState()===F.LOADED&&(ka(s,g,n),f=!0)}f||(o=!1)}return o}renderFrame(t,e){this.renderComplete=!0;const n=t.layerStatesArray[t.layerIndex],s=t.viewState,r=s.projection,o=s.resolution,a=s.center,l=t.pixelRatio,h=this.getLayer(),c=h.getSource(),u=c.getTileGridForProjection(r),d=u.getZForResolution(o,c.zDirection),f=u.getResolution(d),g=c.getKey();this.renderedSourceKey_?this.renderedSourceKey_!==g&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=g):this.renderedSourceKey_=g;let _=t.extent;const m=c.getTilePixelRatio(l);this.prepareContainer(t,e);const p=this.context.canvas.width,y=this.context.canvas.height,C=n.extent&&_e(n.extent);C&&(_=Se(_,_e(n.extent)));const E=f*p/2/m,w=f*y/2/m,T=[a[0]-E,a[1]-w,a[0]+E,a[1]+w],v={};this.renderedTiles.length=0;const R=h.getPreload();if(t.nextExtent&&this.enqueueTilesForNextExtent()){const k=u.getZForResolution(s.nextResolution,c.zDirection),U=Zc(t,t.nextExtent);this.enqueueTiles(t,U,k,v,R)}const I=Zc(t,_);if(this.enqueueTiles(t,I,d,v,0),R>0&&setTimeout(()=>{this.enqueueTiles(t,I,d-1,v,R-1)},0),!(d in v))return this.container;const b=q(this),O=t.time;for(const k of v[d]){const U=k.getState();if(U===F.EMPTY)continue;const H=k.tileCoord;if(U===F.LOADED&&k.getAlpha(b,O)===1){k.endTransition(b);continue}if(U!==F.ERROR&&(this.renderComplete=!1),this.findStaleTile_(H,v)){kp(v,k,d),t.animate=!0;continue}if(this.findAltTiles_(u,H,d+1,v))continue;const It=u.getMinZoom();for(let yt=d-1;yt>=It&&!this.findAltTiles_(u,H,yt,v);--yt);}const D=f/o*l/m,P=this.getRenderContext(t);pe(this.tempTransform,p/2,y/2,D,D,0,-p/2,-y/2),n.extent&&this.clipUnrotated(P,t,C),c.getInterpolate()||(P.imageSmoothingEnabled=!1),this.preRender(P,t);const A=Object.keys(v).map(Number);A.sort(Re);let W;const N=[],B=[];for(let k=A.length-1;k>=0;--k){const U=A[k],H=c.getTilePixelSize(U,l,r),L=u.getResolution(U)/f,It=H[0]*L*D,yt=H[1]*L*D,ut=u.getTileCoordForCoordAndZ(Ye(T),U),jt=u.getTileCoordExtent(ut),Lt=gt(this.tempTransform,[m*(jt[0]-T[0])/f,m*(T[3]-jt[3])/f]),Ce=m*c.getGutterForProjection(r);for(const de of v[U]){if(de.getState()!==F.LOADED)continue;const Xt=de.tileCoord,zr=ut[1]-Xt[1],gl=Math.round(Lt[0]-(zr-1)*It),ys=ut[2]-Xt[2],Fn=Math.round(Lt[1]-(ys-1)*yt),Jt=Math.round(Lt[0]-zr*It),we=Math.round(Lt[1]-ys*yt),vi=gl-Jt,Ri=Fn-we,xs=A.length===1;let kn=!1;W=[Jt,we,Jt+vi,we,Jt+vi,we+Ri,Jt,we+Ri];for(let Ti=0,Si=N.length;Ti<Si;++Ti)if(!xs&&U<B[Ti]){const xt=N[Ti];Ct([Jt,we,Jt+vi,we+Ri],[xt[0],xt[3],xt[4],xt[7]])&&(kn||(P.save(),kn=!0),P.beginPath(),P.moveTo(W[0],W[1]),P.lineTo(W[2],W[3]),P.lineTo(W[4],W[5]),P.lineTo(W[6],W[7]),P.moveTo(xt[6],xt[7]),P.lineTo(xt[4],xt[5]),P.lineTo(xt[2],xt[3]),P.lineTo(xt[0],xt[1]),P.clip())}N.push(W),B.push(U),this.drawTile(de,t,Jt,we,vi,Ri,Ce,xs),kn&&P.restore(),this.renderedTiles.unshift(de),this.updateUsedTiles(t.usedTiles,c,de)}}if(this.renderedResolution=f,this.extentChanged=!this.renderedExtent_||!zn(this.renderedExtent_,T),this.renderedExtent_=T,this.renderedPixelRatio=l,this.postRender(this.context,t),n.extent&&P.restore(),P.imageSmoothingEnabled=!0,this.renderComplete){const k=(U,H)=>{var yt;const nt=q(c),L=H.wantedTiles[nt],It=L?Object.keys(L).length:0;this.updateCacheSize(It),this.tileCache_.expireCache(),(yt=this.sourceTileCache_)==null||yt.expireCache()};t.postRenderFunctions.push(k)}return this.container}updateCacheSize(t){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,t*2)}drawTile(t,e,n,s,r,o,a,l){let h;if(t instanceof Nc){if(h=Oa(t.getData()),!h)throw new Error("Rendering array data is not yet supported")}else h=this.getTileImage(t);if(!h)return;const c=this.getRenderContext(e),u=q(this),d=e.layerStatesArray[e.layerIndex],f=d.opacity*(l?t.getAlpha(u,e.time):1),g=f!==c.globalAlpha;g&&(c.save(),c.globalAlpha=f),c.drawImage(h,a,a,h.width-2*a,h.height-2*a,n,s,r,o),g&&c.restore(),f!==d.opacity?e.animate=!0:l&&t.endTransition(u)}getImage(){const t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}updateUsedTiles(t,e,n){const s=q(e);s in t||(t[s]={}),t[s][n.getKey()]=!0}}const Gp=Np,Er={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class zp extends ls{constructor(t){t=t||{};const e=Object.assign({},t),n=t.cacheSize;delete t.cacheSize,delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=n,this.setPreload(t.preload!==void 0?t.preload:0),this.setUseInterimTilesOnError(t.useInterimTilesOnError!==void 0?t.useInterimTilesOnError:!0)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(Er.PRELOAD)}setPreload(t){this.set(Er.PRELOAD,t)}getUseInterimTilesOnError(){return this.get(Er.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(t){this.set(Er.USE_INTERIM_TILES_ON_ERROR,t)}getData(t){return super.getData(t)}}const jp=zp;class Xp extends jp{constructor(t){super(t)}createRenderer(){return new Gp(this,{cacheSize:this.getCacheSize()})}}const on=Xp,fi=[0,0,0],an=5;class Bp{constructor(t){this.minZoom=t.minZoom!==void 0?t.minZoom:0,this.resolutions_=t.resolutions,J(ud(this.resolutions_,(s,r)=>r-s,!0),"`resolutions` must be sorted in descending order");let e;if(!t.origins){for(let s=0,r=this.resolutions_.length-1;s<r;++s)if(!e)e=this.resolutions_[s]/this.resolutions_[s+1];else if(this.resolutions_[s]/this.resolutions_[s+1]!==e){e=void 0;break}}this.zoomFactor_=e,this.maxZoom=this.resolutions_.length-1,this.origin_=t.origin!==void 0?t.origin:null,this.origins_=null,t.origins!==void 0&&(this.origins_=t.origins,J(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const n=t.extent;n!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=Ye(n)),J(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,t.tileSizes!==void 0&&(this.tileSizes_=t.tileSizes,J(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=t.tileSize!==void 0?t.tileSize:this.tileSizes_?null:ha,J(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=n!==void 0?n:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],t.sizes!==void 0?this.fullTileRanges_=t.sizes.map((s,r)=>{const o=new jc(Math.min(0,s[0]),Math.max(s[0]-1,-1),Math.min(0,s[1]),Math.max(s[1]-1,-1));if(n){const a=this.getTileRangeForExtentAndZ(n,r);o.minX=Math.max(a.minX,o.minX),o.maxX=Math.min(a.maxX,o.maxX),o.minY=Math.max(a.minY,o.minY),o.maxY=Math.min(a.maxY,o.maxY)}return o}):n&&this.calculateTileRanges_(n)}forEachTileCoord(t,e,n){const s=this.getTileRangeForExtentAndZ(t,e);for(let r=s.minX,o=s.maxX;r<=o;++r)for(let a=s.minY,l=s.maxY;a<=l;++a)n([e,r,a])}forEachTileCoordParentTileRange(t,e,n,s){let r,o,a,l=null,h=t[0]-1;for(this.zoomFactor_===2?(o=t[1],a=t[2]):l=this.getTileCoordExtent(t,s);h>=this.minZoom;){if(o!==void 0&&a!==void 0?(o=Math.floor(o/2),a=Math.floor(a/2),r=ui(o,o,a,a,n)):r=this.getTileRangeForExtentAndZ(l,h,n),e(h,r))return!0;--h}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,n){if(t[0]<this.maxZoom){if(this.zoomFactor_===2){const r=t[1]*2,o=t[2]*2;return ui(r,r+1,o,o+1,e)}const s=this.getTileCoordExtent(t,n||this.tmpExtent_);return this.getTileRangeForExtentAndZ(s,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,n){if(e>this.maxZoom||e<this.minZoom)return null;const s=t[0],r=t[1],o=t[2];if(e===s)return ui(r,o,r,o,n);if(this.zoomFactor_){const l=Math.pow(this.zoomFactor_,e-s),h=Math.floor(r*l),c=Math.floor(o*l);if(e<s)return ui(h,h,c,c,n);const u=Math.floor(l*(r+1))-1,d=Math.floor(l*(o+1))-1;return ui(h,u,c,d,n)}const a=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,e,n)}getTileRangeForExtentAndZ(t,e,n){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,fi);const s=fi[1],r=fi[2];this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,fi);const o=fi[1],a=fi[2];return ui(s,o,r,a,n)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),n=this.getResolution(t[0]),s=Ot(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*s[0]*n,e[1]-(t[2]+.5)*s[1]*n]}getTileCoordExtent(t,e){const n=this.getOrigin(t[0]),s=this.getResolution(t[0]),r=Ot(this.getTileSize(t[0]),this.tmpSize_),o=n[0]+t[1]*r[0]*s,a=n[1]-(t[2]+1)*r[1]*s,l=o+r[0]*s,h=a+r[1]*s;return Te(o,a,l,h,e)}getTileCoordForCoordAndResolution(t,e,n){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,n)}getTileCoordForXYAndResolution_(t,e,n,s,r){const o=this.getZForResolution(n),a=n/this.getResolution(o),l=this.getOrigin(o),h=Ot(this.getTileSize(o),this.tmpSize_);let c=a*(t-l[0])/n/h[0],u=a*(l[1]-e)/n/h[1];return s?(c=We(c,an)-1,u=We(u,an)-1):(c=Is(c,an),u=Is(u,an)),yr(o,c,u,r)}getTileCoordForXYAndZ_(t,e,n,s,r){const o=this.getOrigin(n),a=this.getResolution(n),l=Ot(this.getTileSize(n),this.tmpSize_);let h=(t-o[0])/a/l[0],c=(o[1]-e)/a/l[1];return s?(h=We(h,an)-1,c=We(c,an)-1):(h=Is(h,an),c=Is(c,an)),yr(n,h,c,r)}getTileCoordForCoordAndZ(t,e,n){return this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,n)}getTileCoordResolution(t){return this.resolutions_[t[0]]}getTileSize(t){return this.tileSize_?this.tileSize_:this.tileSizes_[t]}getFullTileRange(t){return this.fullTileRanges_?this.fullTileRanges_[t]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,t):null}getZForResolution(t,e){const n=vs(this.resolutions_,t,e||0);return rt(n,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return mc(e,0,e.length,2,this.getTileCoordExtent(t))}calculateTileRanges_(t){const e=this.resolutions_.length,n=new Array(e);for(let s=this.minZoom;s<e;++s)n[s]=this.getTileRangeForExtentAndZ(t,s);this.fullTileRanges_=n}}const Hc=Bp;function qc(i){let t=i.getDefaultTileGrid();return t||(t=Up(i),i.setDefaultTileGrid(t)),t}function Yp(i,t,e){const n=t[0],s=i.getTileCoordCenter(t),r=Na(e);if(!cn(r,s)){const o=K(r),a=Math.ceil((r[0]-s[0])/o);return s[0]+=o*a,i.getTileCoordForCoordAndZ(s,n)}return t}function Wp(i,t,e,n){n=n!==void 0?n:"top-left";const s=Jc(i,t,e);return new Hc({extent:i,origin:fd(i,n),resolutions:s,tileSize:e})}function Vp(i){const t=i||{},e=t.extent||at("EPSG:3857").getExtent(),n={extent:e,minZoom:t.minZoom,tileSize:t.tileSize,resolutions:Jc(e,t.maxZoom,t.tileSize,t.maxResolution)};return new Hc(n)}function Jc(i,t,e,n){t=t!==void 0?t:Z_,e=Ot(e!==void 0?e:ha);const s=ct(i),r=K(i);n=n>0?n:Math.max(r/e[0],s/e[1]);const o=t+1,a=new Array(o);for(let l=0;l<o;++l)a[l]=n/Math.pow(2,l);return a}function Up(i,t,e,n){const s=Na(i);return Wp(s,t,e,n)}function Na(i){i=at(i);let t=i.getExtent();if(!t){const e=180*Mi.degrees/i.getMetersPerUnit();t=Te(-e,-e,e,e)}return t}function Qc(i,t){const e=[];Object.keys(t).forEach(function(s){t[s]!==null&&t[s]!==void 0&&e.push(s+"="+encodeURIComponent(t[s]))});const n=e.join("&");return i=i.replace(/[?&]$/,""),i+=i.includes("?")?"&":"?",i+n}const Kp=/\{z\}/g,$p=/\{x\}/g,Zp=/\{y\}/g,Hp=/\{-y\}/g;function qp(i,t,e,n,s){return i.replace(Kp,t.toString()).replace($p,e.toString()).replace(Zp,n.toString()).replace(Hp,function(){if(s===void 0)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(s-n).toString()})}function Jp(i){const t=[];let e=/\{([a-z])-([a-z])\}/.exec(i);if(e){const n=e[1].charCodeAt(0),s=e[2].charCodeAt(0);let r;for(r=n;r<=s;++r)t.push(i.replace(e[0],String.fromCharCode(r)));return t}if(e=/\{(\d+)-(\d+)\}/.exec(i),e){const n=parseInt(e[2],10);for(let s=parseInt(e[1],10);s<=n;s++)t.push(i.replace(e[0],s.toString()));return t}return t.push(i),t}function Qp(i,t){return function(e,n,s){if(!e)return;let r;const o=e[0];if(t){const a=t.getFullTileRange(o);a&&(r=a.getHeight()-1)}return qp(i,o,e[1],e[2],r)}}function ty(i,t){const e=i.length,n=new Array(e);for(let s=0;s<e;++s)n[s]=Qp(i[s],t);return ey(n)}function ey(i){return i.length===1?i[0]:function(t,e,n){if(!t)return;const s=$c(t),r=un(s,i.length);return i[r](t,e,n)}}class ny extends Ea{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_=t.tilePixelRatio!==void 0?t.tilePixelRatio:1,this.tileGrid=t.tileGrid!==void 0?t.tileGrid:null;const e=[256,256];this.tileGrid&&Ot(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tmpSize=[0,0],this.key_=t.key||q(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,n,s,r,o){return j()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:qc(t)}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,n){const s=this.getTileGridForProjection(n),r=this.getTilePixelRatio(e),o=Ot(s.getTileSize(t),this.tmpSize);return r==1?o:dg(o,r,this.tmpSize)}getTileCoordForTileUrlFunction(t,e){const n=e!==void 0?e:this.getProjection(),s=e!==void 0?this.getTileGridForProjection(n):this.tileGrid||this.getTileGridForProjection(n);return this.getWrapX()&&n.isGlobal()&&(t=Yp(s,t,n)),Fp(t,s)?t:null}clear(){}refresh(){this.clear(),super.refresh()}}class iy extends se{constructor(t,e){super(t),this.tile=e}}const sy=ny,Ga={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};class za extends sy{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===za.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,n=q(e),s=e.getState();let r;s==F.LOADING?(this.tileLoadingKeys_[n]=!0,r=Ga.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],r=s==F.ERROR?Ga.TILELOADERROR:s==F.LOADED?Ga.TILELOADEND:void 0),r!=null&&this.dispatchEvent(new iy(r,e))}setTileLoadFunction(t){this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,typeof e<"u"?this.setKey(e):this.changed()}setUrl(t){const e=Jp(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join(`
7
- `);this.generateTileUrlFunction_?this.setTileUrlFunction(ty(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,n){}}const ry=za;class oy extends ry{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:ay,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate!==void 0?t.interpolate:!0,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.crossOrigin=t.crossOrigin!==void 0?t.crossOrigin:null,this.tileClass=t.tileClass!==void 0?t.tileClass:Gc,this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(t){return this.getProjection()&&t&&!mn(this.getProjection(),t)?0:this.getGutter()}getGutter(){return 0}getKey(){let t=super.getKey();return this.getInterpolate()||(t+=":disable-interpolation"),t}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||mn(e,t)))return this.tileGrid;const n=q(t);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=qc(t)),this.tileGridForProjection[n]}createTile_(t,e,n,s,r,o){const a=[t,e,n],l=this.getTileCoordForTileUrlFunction(a,r),h=l?this.tileUrlFunction(l,s,r):void 0,c=new this.tileClass(a,h!==void 0?F.IDLE:F.EMPTY,h!==void 0?h:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return c.key=o,c.addEventListener(z.CHANGE,this.handleTileChange.bind(this)),c}getTile(t,e,n,s,r,o){const a=this.getProjection();if(!a||!r||mn(a,r))return this.getTileInternal(t,e,n,s,a||r);const l=[t,e,n],h=this.getKey(),c=this.getTileGridForProjection(a),u=this.getTileGridForProjection(r),d=this.getTileCoordForTileUrlFunction(l,r),f=new Uc(a,c,r,u,l,d,this.getTilePixelRatio(s),this.getGutter(),(g,_,m,p)=>this.getTileInternal(g,_,m,p,a,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return f.key=h,f}getTileInternal(t,e,n,s,r,o){const a=this.getKey(),l=xr(this,a,t,e,n);if(o&&o.containsKey(l))return o.get(l);const h=this.createTile_(t,e,n,s,r,a);return o==null||o.set(l,h),h}setRenderReprojectionEdges(t){this.renderReprojectionEdges_!=t&&(this.renderReprojectionEdges_=t,this.changed())}setTileGridForProjection(t,e){const n=at(t);if(n){const s=q(n);s in this.tileGridForProjection||(this.tileGridForProjection[s]=e)}}}function ay(i,t){if(Bt){const e=i.getCrossOrigin();let n="same-origin",s="same-origin";e==="anonymous"||e===""?(n="cors",s="omit"):e==="use-credentials"&&(n="cors",s="include"),fetch(t,{mode:n,credentials:s}).then(r=>{if(!r.ok)throw new Error(`HTTP ${r.status}`);return r.blob()}).then(r=>createImageBitmap(r)).then(r=>{var l;const o=i.getImage();o.width=r.width,o.height=r.height,o.getContext("2d").drawImage(r,0,0),(l=r.close)==null||l.call(r),o.dispatchEvent(new Event("load"))}).catch(()=>{i.getImage().dispatchEvent(new Event("error"))});return}i.getImage().src=t}const tu=oy;class ly extends tu{constructor(t){t=t||{};const e=t.projection!==void 0?t.projection:"EPSG:3857",n=t.tileGrid!==void 0?t.tileGrid:Vp({extent:Na(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize});super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:e,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:n,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX!==void 0?t.wrapX:!0,transition:t.transition,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.gutter_=t.gutter!==void 0?t.gutter:0}getGutter(){return this.gutter_}}const Ln=ly;var V={};V.create=function(i,t){t=t||{};var e;if(i==="TEXT")e=document.createTextNode(t.html||""),t.parent&&t.parent.appendChild(e);else{e=document.createElement(i),/button/i.test(i)&&e.setAttribute("type","button");for(var n in t)switch(n){case"className":{t.className&&t.className.trim&&e.setAttribute("class",t.className.trim());break}case"text":{e.innerText=t.text;break}case"html":{t.html instanceof Element?e.appendChild(t.html):t.html!==void 0&&(e.innerHTML=t.html);break}case"parent":{t.parent&&t.parent.appendChild(e);break}case"options":{if(/select/i.test(i))for(var s in t.options)V.create("OPTION",{html:s,value:t.options[s],parent:e});break}case"style":{V.setStyle(e,t.style);break}case"change":case"click":{V.addListener(e,n,t[n]);break}case"on":{for(var r in t.on)V.addListener(e,r,t.on[r]);break}case"checked":{e.checked=!!t.checked;break}default:{e.setAttribute(n,t[n]);break}}}return e},V.createSwitch=function(i){var t=V.create("INPUT",{type:"checkbox",on:i.on,click:i.click,change:i.change,parent:i.parent});return Object.assign({input:t},i||{}),t},V.createCheck=function(i){var t=V.create("INPUT",{name:i.name,type:i.type==="radio"?"radio":"checkbox",on:i.on,parent:i.parent});return Object.assign({input:t},i||{}),i.type,t},V.setHTML=function(i,t){t instanceof Element?i.appendChild(t):t!==void 0&&(i.innerHTML=t)},V.appendText=function(i,t){i.appendChild(document.createTextNode(t||""))},V.addListener=function(i,t,e,n){typeof t=="string"&&(t=t.split(" ")),t.forEach(function(s){i.addEventListener(s,e,n)})},V.removeListener=function(i,t,e){typeof t=="string"&&(t=t.split(" ")),t.forEach(function(n){i.removeEventListener(n,e)})},V.show=function(i){i.style.display=""},V.hide=function(i){i.style.display="none"},V.hidden=function(i){return V.getStyle(i,"display")==="none"},V.toggle=function(i){i.style.display=i.style.display==="none"?"":"none"},V.setStyle=function(i,t){for(var e in t)switch(e){case"top":case"left":case"bottom":case"right":case"minWidth":case"maxWidth":case"width":case"height":{typeof t[e]=="number"?i.style[e]=t[e]+"px":i.style[e]=t[e];break}default:i.style[e]=t[e]}},V.getStyle=function(i,t){var e,n=(i.ownerDocument||document).defaultView;if(n&&n.getComputedStyle)t=t.replace(/([A-Z])/g,"-$1").toLowerCase(),e=n.getComputedStyle(i,null).getPropertyValue(t);else if(i.currentStyle&&(t=t.replace(/-(\w)/g,function(s,r){return r.toUpperCase()}),e=i.currentStyle[t],/^\d+(em|pt|%|ex)?$/i.test(e)))return function(s){var r=i.style.left,o=i.runtimeStyle.left;return i.runtimeStyle.left=i.currentStyle.left,i.style.left=s||0,s=i.style.pixelLeft+"px",i.style.left=r,i.runtimeStyle.left=o,s}(e);return/px$/.test(e)?parseInt(e):e},V.outerHeight=function(i){return i.offsetHeight+V.getStyle(i,"marginBottom")},V.outerWidth=function(i){return i.offsetWidth+V.getStyle(i,"marginLeft")},V.offsetRect=function(i){var t=i.getBoundingClientRect();return{top:t.top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0),left:t.left+(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0),height:t.height||t.bottom-t.top,width:t.width||t.right-t.left}},V.getFixedOffset=function(i){var t={left:0,top:0},e=function(n){if(!n)return t;if(V.getStyle(n,"position")==="absolute"&&V.getStyle(n,"transform")!=="none"){var s=n.getBoundingClientRect();return t.left+=s.left,t.top+=s.top,t}return e(n.offsetParent)};return e(i.offsetParent)},V.positionRect=function(i,t){var e=0,n=0,s=function(r){if(r)return e+=r.offsetLeft,n+=r.offsetTop,s(r.offsetParent);var o={top:i.offsetTop+n,left:i.offsetLeft+e};return t&&(o.top-=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,o.left-=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0),o.bottom=o.top+i.offsetHeight,o.right=o.top+i.offsetWidth,o};return s(i.offsetParent)},V.scrollDiv=function(i,t){t=t||{};var e=!1,n=0,s,r=0,o=typeof t.onmove=="function"?t.onmove:function(){},a=t.vertical?"screenY":"screenX",l=t.vertical?"scrollTop":"scrollLeft",h=!1,c,u,d=0,f=function(){C&&(d++,setTimeout(g))},g=function(){if(C){if(d--,d)return;var v=i.clientHeight,R=i.scrollHeight;c=v/R,C.style.height=c*100+"%",C.style.top=i.scrollTop/R*100+"%",y.style.height=v+"px",v>R-.5?y.classList.add("ol-100pc"):y.classList.remove("ol-100pc")}},_=function(v){v.target.classList.contains("ol-noscroll")||(h=!1,e=v[a],r=new Date,i.classList.add("ol-move"),v.preventDefault(),window.addEventListener("pointermove",m),V.addListener(window,["pointerup","pointercancel"],w))},m=function(v){if(e!==!1){var R=(u?-1/c:1)*(e-v[a]);h=h||Math.round(R),i[l]+=R,s=new Date,s-r&&(n=(n+R/(s-r))/2),e=v[a],r=s,R&&o(!0)}else h=!0},p=function(v){var R=v>0?Math.min(100,v/2):Math.max(-100,v/2);v-=R,i[l]+=R,-1<v&&v<1?(h?setTimeout(function(){i.classList.remove("ol-move")}):i.classList.remove("ol-move"),h=!1,o(!1)):setTimeout(function(){p(v)},40)},y,C;if(t.vertical&&t.minibar){var E=function(v){i.removeEventListener("pointermove",E),i.parentNode.classList.add("ol-miniscroll"),C=V.create("DIV"),y=V.create("DIV",{className:"ol-scroll",html:C}),i.parentNode.insertBefore(y,i),C.addEventListener("pointerdown",function(R){u=!0,_(R)}),t.mousewheel&&(V.addListener(y,["mousewheel","DOMMouseScroll","onmousewheel"],function(R){T(R)}),V.addListener(C,["mousewheel","DOMMouseScroll","onmousewheel"],function(R){T(R)})),i.parentNode.addEventListener("pointerenter",f),window.addEventListener("resize",f),v!==!1&&f()};i.parentNode?E(!1):i.addEventListener("pointermove",E),i.addEventListener("scroll",function(){f()})}i.style["touch-action"]="none",i.style.overflow="hidden",i.classList.add("ol-scrolldiv"),V.addListener(i,["pointerdown"],function(v){u=!1,_(v)}),i.addEventListener("click",function(v){i.classList.contains("ol-move")&&(v.preventDefault(),v.stopPropagation())},!0);var w=function(v){r=new Date-r,r>100||u?n=0:r>0&&(n=((n||0)+(e-v[a])/r)/2),p(t.animate===!1?0:n*200),e=!1,n=0,r=0,i.classList.contains("ol-move")?i.classList.remove("ol-hasClick"):(i.classList.add("ol-hasClick"),setTimeout(function(){i.classList.remove("ol-hasClick")},500)),u=!1,window.removeEventListener("pointermove",m),V.removeListener(window,["pointerup","pointercancel"],w)},T=function(v){var R=Math.max(-1,Math.min(1,v.wheelDelta||-v.detail));return i.classList.add("ol-move"),i[l]-=R*30,i.classList.remove("ol-move"),!1};return t.mousewheel&&V.addListener(i,["mousewheel","DOMMouseScroll","onmousewheel"],T),{refresh:f}},V.dispatchEvent=function(i,t){var e;try{e=new CustomEvent(i)}catch{e=document.createEvent("CustomEvent"),e.initCustomEvent(i,!0,!0,{})}t.dispatchEvent(e)};const Rt={ELEMENT:"element",MAP:"map",OFFSET:"offset",POSITION:"position",POSITIONING:"positioning"};class hy extends Kt{constructor(t){super(),this.on,this.once,this.un,this.options=t,this.id=t.id,this.insertFirst=t.insertFirst!==void 0?t.insertFirst:!0,this.stopEvent=t.stopEvent!==void 0?t.stopEvent:!0,this.element=document.createElement("div"),this.element.className=t.className!==void 0?t.className:"ol-overlay-container "+Sf,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=t.autoPan===!0?{}:t.autoPan||void 0,this.rendered={transform_:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(Rt.ELEMENT,this.handleElementChanged),this.addChangeListener(Rt.MAP,this.handleMapChanged),this.addChangeListener(Rt.OFFSET,this.handleOffsetChanged),this.addChangeListener(Rt.POSITION,this.handlePositionChanged),this.addChangeListener(Rt.POSITIONING,this.handlePositioningChanged),t.element!==void 0&&this.setElement(t.element),this.setOffset(t.offset!==void 0?t.offset:[0,0]),this.setPositioning(t.positioning||"top-left"),t.position!==void 0&&this.setPosition(t.position)}getElement(){return this.get(Rt.ELEMENT)}getId(){return this.id}getMap(){return this.get(Rt.MAP)||null}getOffset(){return this.get(Rt.OFFSET)}getPosition(){return this.get(Rt.POSITION)}getPositioning(){return this.get(Rt.POSITIONING)}handleElementChanged(){Gl(this.element);const t=this.getElement();t&&this.element.appendChild(t)}handleMapChanged(){var e;this.mapPostrenderListenerKey&&((e=this.element)==null||e.remove(),it(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const t=this.getMap();if(t){this.mapPostrenderListenerKey=$(t,Ge.POSTRENDER,this.render,this),this.updatePixelPosition();const n=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();this.insertFirst?n.insertBefore(this.element,n.childNodes[0]||null):n.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(t){this.set(Rt.ELEMENT,t)}setMap(t){this.set(Rt.MAP,t)}setOffset(t){this.set(Rt.OFFSET,t)}setPosition(t){this.set(Rt.POSITION,t)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(t){const e=this.getMap();if(!e||!e.getTargetElement()||!this.get(Rt.POSITION))return;const n=this.getRect(e.getTargetElement(),e.getSize()),s=this.getElement(),r=this.getRect(s,[vd(s),Rd(s)]);t=t||{};const o=t.margin===void 0?20:t.margin;if(!fe(n,r)){const a=r[0]-n[0],l=n[2]-r[2],h=r[1]-n[1],c=n[3]-r[3],u=[0,0];if(a<0?u[0]=a-o:l<0&&(u[0]=Math.abs(l)+o),h<0?u[1]=h-o:c<0&&(u[1]=Math.abs(c)+o),u[0]!==0||u[1]!==0){const d=e.getView().getCenterInternal(),f=e.getPixelFromCoordinateInternal(d);if(!f)return;const g=[f[0]+u[0],f[1]+u[1]],_=t.animation||{};e.getView().animateInternal({center:e.getCoordinateFromPixelInternal(g),duration:_.duration,easing:_.easing})}}}getRect(t,e){const n=t.getBoundingClientRect(),s=n.left+window.pageXOffset,r=n.top+window.pageYOffset;return[s,r,s+e[0],r+e[1]]}setPositioning(t){this.set(Rt.POSITIONING,t)}setVisible(t){this.rendered.visible!==t&&(this.element.style.display=t?"":"none",this.rendered.visible=t)}updatePixelPosition(){const t=this.getMap(),e=this.getPosition();if(!t||!t.isRendered()||!e){this.setVisible(!1);return}const n=t.getPixelFromCoordinate(e),s=t.getSize();this.updateRenderedPosition(n,s)}updateRenderedPosition(t,e){const n=this.element.style,s=this.getOffset(),r=this.getPositioning();this.setVisible(!0);const o=`${t[0]+s[0]}px`,a=`${t[1]+s[1]}px`;let l="0%",h="0%";r=="bottom-right"||r=="center-right"||r=="top-right"?l="-100%":(r=="bottom-center"||r=="center-center"||r=="top-center")&&(l="-50%"),r=="bottom-left"||r=="bottom-center"||r=="bottom-right"?h="-100%":(r=="center-left"||r=="center-center"||r=="center-right")&&(h="-50%");const c=`translate(${l}, ${h}) translate(${o}, ${a})`;this.rendered.transform_!=c&&(this.rendered.transform_=c,n.transform=c)}getOptions(){return this.options}}const ja=hy;var lt={};lt.getTransform=function(i){var t=window.getComputedStyle(i,null),e=t.getPropertyValue("-webkit-transform")||t.getPropertyValue("-moz-transform")||t.getPropertyValue("-ms-transform")||t.getPropertyValue("-o-transform")||t.getPropertyValue("transform"),n=e.split("(")[1].split(")")[0].split(","),s=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],r,o;if(n.length===16)for(r=0;r<4;++r)for(o=0;o<4;++o)s[o][r]=+n[r*4+o];else for(r=0;r<3;++r)for(o=0;o<2;++o)s[o][r]=+n[r*2+o];return s},lt.getTransformOrigin=function(i){for(var t=window.getComputedStyle(i,null),e=t.getPropertyValue("-webkit-transform-origin")||t.getPropertyValue("-moz-transform-origin")||t.getPropertyValue("-ms-transform-origin")||t.getPropertyValue("-o-transform-origin")||t.getPropertyValue("transform-origin"),n=e.split(" "),s=[0,0,0,1],r=0;r<n.length;++r)s[r]=parseInt(n[r]);return s},lt.translateMatrix=function(i,t,e){return[[1,0,0,i],[0,1,0,t],[0,0,1,e],[0,0,0,1]]},lt.identity=function(){return[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]},lt.roundTo=function(i,t){t||(t=1e-10);for(var e=[[],[],[],[]],n=0;n<4;n++)for(var s=0;s<4;s++)e[n][s]=Math.round(i[n][s]/t)*t;return e},lt.multiply=function(i,t){for(var e=[[],[],[],[]],n=0;n<4;++n)for(var s=0;s<4;++s){for(var r=0,o=0;o<4;++o)r+=i[o][n]*t[s][o];e[s][n]=r}return e},lt.computeTransformMatrix=function(i,t){var e=lt.translateMatrix(-t[0],-t[1],-t[2]),n=lt.translateMatrix(t[0],t[1],t[2]),s=lt.multiply(e,i);return lt.multiply(s,n)},lt.transformVertex=function(i,t){for(var e=[t[0],t[1],0,1],n=[],s=0;s<4;++s){n[s]=0;for(var r=0;r<4;++r)n[s]+=+i[s][r]*e[r]}return n},lt.projectVertex=function(i){for(var t=[],e=0;e<4;++e)t[e]=i[e]/i[3];return t},lt.inverse=function(i){var t=i[0][0]*i[1][1]-i[1][0]*i[0][1],e=i[0][0]*i[1][2]-i[1][0]*i[0][2],n=i[0][0]*i[1][3]-i[1][0]*i[0][3],s=i[0][1]*i[1][2]-i[1][1]*i[0][2],r=i[0][1]*i[1][3]-i[1][1]*i[0][3],o=i[0][2]*i[1][3]-i[1][2]*i[0][3],a=i[2][2]*i[3][3]-i[3][2]*i[2][3],l=i[2][1]*i[3][3]-i[3][1]*i[2][3],h=i[2][1]*i[3][2]-i[3][1]*i[2][2],c=i[2][0]*i[3][3]-i[3][0]*i[2][3],u=i[2][0]*i[3][2]-i[3][0]*i[2][2],d=i[2][0]*i[3][1]-i[3][0]*i[2][1],f=1/(t*a-e*l+n*h+s*c-r*u+o*d);if(isNaN(f)||f===1/0)throw new Error("Inverse determinant attempted to divide by zero.");return[[(i[1][1]*a-i[1][2]*l+i[1][3]*h)*f,(-i[0][1]*a+i[0][2]*l-i[0][3]*h)*f,(i[3][1]*o-i[3][2]*r+i[3][3]*s)*f,(-i[2][1]*o+i[2][2]*r-i[2][3]*s)*f],[(-i[1][0]*a+i[1][2]*c-i[1][3]*u)*f,(i[0][0]*a-i[0][2]*c+i[0][3]*u)*f,(-i[3][0]*o+i[3][2]*n-i[3][3]*e)*f,(i[2][0]*o-i[2][2]*n+i[2][3]*e)*f],[(i[1][0]*l-i[1][1]*c+i[1][3]*d)*f,(-i[0][0]*l+i[0][1]*c-i[0][3]*d)*f,(i[3][0]*r-i[3][1]*n+i[3][3]*t)*f,(-i[2][0]*r+i[2][1]*n-i[2][3]*t)*f],[(-i[1][0]*h+i[1][1]*u-i[1][2]*d)*f,(i[0][0]*h-i[0][1]*u+i[0][2]*d)*f,(-i[3][0]*s+i[3][1]*e-i[3][2]*t)*f,(i[2][0]*s-i[2][1]*e+i[2][2]*t)*f]]};var cy=class extends ci{constructor(t){var e=t.target instanceof Element?t.target:document.getElementById(t.target);window.getComputedStyle(e).position!=="absolute"&&(e.style.position="relative"),e.style.overflow="hidden";var n=V.create("DIV",{className:"ol-perspective-map",parent:e}),s={};Object.assign(s,t),s.target=n,super(s),this._tiltCondition=t.tiltCondition||Gm}getPixelRatio(){return window.devicePixelRatio}setPerspective(t,e){e=e||{},t>30?t=30:t<0&&(t=0);var n=this._angle||0,s=Math.round(t*10)/10,r=this.getTarget().querySelector(".ol-layers").style;cancelAnimationFrame(this._animatedPerspective),requestAnimationFrame((function(o){this._animatePerpective(o,o,r,n,s,e.duration,e.easing||Zo)}).bind(this))}_animatePerpective(t,e,n,s,r,o,a){var l,h;o===0?(l=1,h=!0):(l=(e-t)/(o||500),h=l>=1),l=a(l);var c;h?c=this._angle=r:c=this._angle=s+(r-s)*l;var u=c/30;n.transform="translateY(-"+17*u+"%) perspective(200px) rotateX("+c+"deg) scaleY("+(1-u/2)+")",this.getMatrix3D(!0),this.render(),h||requestAnimationFrame((function(d){this._animatePerpective(t,d,n,s,r,o||500,a||Zo)}).bind(this)),this.dispatchEvent({type:"change:perspective",angle:c,animating:!h})}handleMapBrowserEvent(t){if(t.pixel=[t.originalEvent.offsetX/this.getPixelRatio(),t.originalEvent.offsetY/this.getPixelRatio()],t.coordinate=this.getCoordinateFromPixel(t.pixel),ci.prototype.handleMapBrowserEvent.call(this,t),this._tiltCondition(t))switch(t.type){case"pointerdown":{this._dragging=t.originalEvent.offsetY;break}case"pointerup":{this._dragging=!1;break}case"pointerdrag":{if(this._dragging!==!1){var e=t.originalEvent.offsetY>this._dragging?.5:-.5;e&&this.setPerspective((this._angle||0)+e,{duration:0}),this._dragging=t.originalEvent.offsetY}break}}else this._dragging=!1}getMatrix3D(t){if(t){var e=this.getTarget().querySelector(".ol-layers"),n=lt.getTransform(e),s=lt.getTransformOrigin(e);this._matrixTransform=lt.computeTransformMatrix(n,s)}return this._matrixTransform||(this._matrixTransform=lt.identity()),this._matrixTransform}getPixelScreenFromCoordinate(t){var e=this.getPixelFromCoordinate(t),n=this.getMatrix3D(),s=lt.transformVertex(n,e);return s=lt.projectVertex(s),[s[0],s[1]]}getPixelFromPixelScreen(t){var e=lt.inverse(this.getMatrix3D()),n=lt.transformVertex(e,t);return n=lt.projectVertex(n),[n[0],n[1]]}};(function(){var i=ja.prototype.updatePixelPosition;ja.prototype.updatePixelPosition=function(){var t=this.getMap();if(t&&t instanceof cy){var e=this.getPosition();if(!t||!t.isRendered()||!e){this.setVisible(!1);return}var n=t.getPixelScreenFromCoordinate(e),s=t.getSize();n[0]-=s[0]/4,n[1]-=s[1]/4,this.updateRenderedPosition(n,s)}else i.call(this)}})();let gi="0711195325a7623fc91fa85aa075b7d4";const eu="/sky/map?token=nszx_sk_img&x={x}&y={y}&l={z}",nu="/sky/map?token=nszx_sk_label&x={x}&y={y}&l={z}",iu=`https://t0.tianditu.gov.cn/img_w/wmts?tk=${gi}&service=wmts&request=gettile&version=1.0.0&layer=img&style=default&format=tiles&tilematrixset=w&width=256&height=256&tilematrix={z}&tilerow={y}&tilecol={x}`,su=`https://t0.tianditu.gov.cn/cia_w/wmts?tk=${gi}&service=wmts&request=gettile&version=1.0.0&layer=cia&style=default&format=tiles&tilematrixset=w&width=256&height=256&tilematrix={z}&tilerow={y}&tilecol={x}`,ru=`https://t0.tianditu.gov.cn/vec_w/wmts?tk=${gi}&service=wmts&request=gettile&version=1.0.0&layer=vec&style=default&format=tiles&tilematrixset=w&width=256&height=256&tilematrix={z}&tilerow={y}&tilecol={x}`,ou=`https://t0.tianditu.gov.cn/cva_w/wmts?tk=${gi}&service=wmts&request=gettile&version=1.0.0&layer=cva&style=default&format=tiles&tilematrixset=w&width=256&height=256&tilematrix={z}&tilerow={y}&tilecol={x}`,uy=(i,t)=>{const e=i.getImage();fetch(t).then(n=>{if(console.log(`天地图请求状态码: ${n.status}`),n.status===429){console.error("⚠️ 天地图请求过多,已达到速率限制!"),gi="9ecb10975f45744bbf807e0ad0644816",dy(),e.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";return}if(!n.ok)throw new Error(`HTTP错误,状态码: ${n.status}`);return n.blob().then(s=>{const r=URL.createObjectURL(s);e.src=r})}).catch(n=>{console.error("瓦片加载错误:",n),e.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"})};function dy(){const i=t=>`https://t0.tianditu.gov.cn/${t}_w/wmts?tk=${gi}&service=wmts&request=gettile&version=1.0.0&layer=${t}&style=default&format=tiles&tilematrixset=w&width=256&height=256&tilematrix={z}&tilerow={y}&tilecol={x}`;ot.tdt_img.getSource().setUrl(i("img")),ot.tdt_cia.getSource().setUrl(i("cia")),ot.tdt_vec.getSource().setUrl(i("vec")),ot.tdt_cva.getSource().setUrl(i("cva"))}const ot={sky_map:new on({source:new Ln({url:eu}),visible:!1}),sky_note:new on({source:new Ln({url:nu}),visible:!1,zIndex:2}),tdt_img:new on({source:new Ln({url:iu,crossOrigin:"anonymous",tileLoadFunction:uy})}),tdt_cia:new on({source:new Ln({url:su}),zIndex:2}),tdt_vec:new on({source:new Ln({url:ru}),visible:!1}),tdt_cva:new on({source:new Ln({url:ou}),visible:!1,zIndex:2})},fy=()=>window.xmMap;let Cr=!1,Xa=!0;const gy=i=>{console.log(i,"laaa"),i==="tdt_img"?Cr||(ot.sky_map.setVisible(!0),ot.sky_note.setVisible(!0),ot.tdt_img.setVisible(!1),ot.tdt_cia.setVisible(!1),Cr=!0,Xa=!1):Xa||(ot.sky_map.setVisible(!1),ot.sky_note.setVisible(!1),ot.tdt_img.setVisible(!0),ot.tdt_cia.setVisible(!0),Xa=!0,Cr=!1)},_y=i=>{i?(ot.sky_map.setVisible(!1),ot.sky_note.setVisible(!1),ot.tdt_img.setVisible(!1),ot.tdt_cia.setVisible(!1)):Cr?(ot.sky_map.setVisible(!0),ot.sky_note.setVisible(!0)):(ot.tdt_img.setVisible(!0),ot.tdt_cia.setVisible(!0))};let my={layers:[ot.sky_map,ot.sky_note,ot.tdt_img,ot.tdt_cia],target:"olMap",view:new xe({projection:"EPSG:4326",center:[102.836837,30.38723],zoom:7}),controls:Mc({zoom:!1,rotate:!1,attribution:!1}).extend([])};const py=()=>{let i=new ci(my);return window.xmMap=i,i},us={},yy=i=>{const{listenType:t,callback:e,removeListener:n,data:s}=i,r=window.xmMap;if(n){const a=us[t];a&&(a.forEach(l=>r.un([t],l)),delete us[t]);return}const o=a=>{e&&e(a,s)};r.on([t],o),us[t]||(us[t]=[]),us[t].push(o)},xy=()=>{window.xmMap?(Gr(!0),window.xmMap.dispose(),console.warn("地图摧毁完成"),window.xmMap=null,window.xmglobalLayer=null):console.warn("地图实例不存在")};class Ey{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=zt,this.supportedMediaTypes=null}getReadOptions(t,e){if(e){let n=e.dataProjection?at(e.dataProjection):this.readProjection(t);e.extent&&n&&n.getUnits()==="tile-pixels"&&(n=at(n),n.setWorldExtent(e.extent)),e={dataProjection:n,featureProjection:e.featureProjection}}return this.adaptOptions(e)}adaptOptions(t){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},t)}getType(){return j()}readFeature(t,e){return j()}readFeatures(t,e){return j()}readGeometry(t,e){return j()}readProjection(t){return j()}writeFeature(t,e){return j()}writeFeatures(t,e){return j()}writeGeometry(t,e){return j()}}function Ba(i,t,e){const n=e?at(e.featureProjection):null,s=e?at(e.dataProjection):null;let r=i;if(n&&s&&!mn(n,s)){t&&(r=i.clone());const o=t?n:s,a=t?s:n;o.getUnits()==="tile-pixels"?r.transform(o,a):r.applyTransform(Fi(o,a))}if(t&&e&&e.decimals!==void 0){const o=Math.pow(10,e.decimals),a=function(l){for(let h=0,c=l.length;h<c;++h)l[h]=Math.round(l[h]*o)/o;return l};r===i&&(r=i.clone()),r.applyTransform(a)}return r}const Cy={Point:he,LineString:Sn,Polygon:Zt,MultiPoint:ya,MultiLineString:ma,MultiPolygon:xa};function wy(i,t,e){return Array.isArray(t[0])?(yc(i,0,t,e)||(i=i.slice(),ra(i,0,t,e)),i):(sa(i,0,t,e)||(i=i.slice(),rr(i,0,t,e)),i)}function au(i,t){var r;const e=i.geometry;if(!e)return[];if(Array.isArray(e))return e.map(o=>au({...i,geometry:o})).flat();const n=e.type==="MultiPolygon"?"Polygon":e.type;if(n==="GeometryCollection"||n==="Circle")throw new Error("Unsupported geometry type: "+n);const s=e.layout.length;return Ba(new en(n,n==="Polygon"?wy(e.flatCoordinates,e.ends,s):e.flatCoordinates,(r=e.ends)==null?void 0:r.flat(),s,i.properties||{},i.id).enableSimplifyTransformed(),!1,t)}function Ya(i,t){if(!i)return null;if(Array.isArray(i)){const n=i.map(s=>Ya(s,t));return new Ic(n)}const e=Cy[i.type];return Ba(new e(i.flatCoordinates,i.layout||"XY",i.ends),!1,t)}class vy extends Ey{constructor(){super()}getType(){return"json"}readFeature(t,e){return this.readFeatureFromObject(wr(t),this.getReadOptions(t,e))}readFeatures(t,e){return this.readFeaturesFromObject(wr(t),this.getReadOptions(t,e))}readFeatureFromObject(t,e){return j()}readFeaturesFromObject(t,e){return j()}readGeometry(t,e){return this.readGeometryFromObject(wr(t),this.getReadOptions(t,e))}readGeometryFromObject(t,e){return j()}readProjection(t){return this.readProjectionFromObject(wr(t))}readProjectionFromObject(t){return j()}writeFeature(t,e){return JSON.stringify(this.writeFeatureObject(t,e))}writeFeatureObject(t,e){return j()}writeFeatures(t,e){return JSON.stringify(this.writeFeaturesObject(t,e))}writeFeaturesObject(t,e){return j()}writeGeometry(t,e){return JSON.stringify(this.writeGeometryObject(t,e))}writeGeometryObject(t,e){return j()}}function wr(i){if(typeof i=="string"){const t=JSON.parse(i);return t||null}return i!==null?i:null}const Ry=vy;class Ty extends Ry{constructor(t){t=t||{},super(),this.dataProjection=at(t.dataProjection?t.dataProjection:"EPSG:4326"),t.featureProjection&&(this.defaultFeatureProjection=at(t.featureProjection)),t.featureClass&&(this.featureClass=t.featureClass),this.geometryName_=t.geometryName,this.extractGeometryName_=t.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(t,e){let n=null;t.type==="Feature"?n=t:n={type:"Feature",geometry:t,properties:null};const s=Wa(n.geometry);if(this.featureClass===en)return au({geometry:s,id:n.id,properties:n.properties},e);const r=new zt;return this.geometryName_?r.setGeometryName(this.geometryName_):this.extractGeometryName_&&n.geometry_name&&r.setGeometryName(n.geometry_name),r.setGeometry(Ya(s,e)),"id"in n&&r.setId(n.id),n.properties&&r.setProperties(n.properties,!0),r}readFeaturesFromObject(t,e){const n=t;let s=null;if(n.type==="FeatureCollection"){const r=t;s=[];const o=r.features;for(let a=0,l=o.length;a<l;++a){const h=this.readFeatureFromObject(o[a],e);h&&s.push(h)}}else s=[this.readFeatureFromObject(t,e)];return s.flat()}readGeometryFromObject(t,e){return Sy(t,e)}readProjectionFromObject(t){const e=t.crs;let n;if(e)if(e.type=="name")n=at(e.properties.name);else if(e.type==="EPSG")n=at("EPSG:"+e.properties.code);else throw new Error("Unknown SRS type");else n=this.dataProjection;return n}writeFeatureObject(t,e){e=this.adaptOptions(e);const n={type:"Feature",geometry:null,properties:null},s=t.getId();if(s!==void 0&&(n.id=s),!t.hasProperties())return n;const r=t.getProperties(),o=t.getGeometry();return o&&(n.geometry=Va(o,e),delete r[t.getGeometryName()]),gn(r)||(n.properties=r),n}writeFeaturesObject(t,e){e=this.adaptOptions(e);const n=[];for(let s=0,r=t.length;s<r;++s)n.push(this.writeFeatureObject(t[s],e));return{type:"FeatureCollection",features:n}}writeGeometryObject(t,e){return Va(t,this.adaptOptions(e))}}function Wa(i,t){if(!i)return null;let e;switch(i.type){case"Point":{e=Ly(i);break}case"LineString":{e=Py(i);break}case"Polygon":{e=Oy(i);break}case"MultiPoint":{e=My(i);break}case"MultiLineString":{e=by(i);break}case"MultiPolygon":{e=Ay(i);break}case"GeometryCollection":{e=Iy(i);break}default:throw new Error("Unsupported GeoJSON type: "+i.type)}return e}function Sy(i,t){const e=Wa(i);return Ya(e,t)}function Iy(i,t){return i.geometries.map(function(n){return Wa(n)})}function Ly(i){const t=i.coordinates;return{type:"Point",flatCoordinates:t,layout:Cn(t.length)}}function Py(i){var n;const t=i.coordinates,e=t.flat();return{type:"LineString",flatCoordinates:e,ends:[e.length],layout:Cn(((n=t[0])==null?void 0:n.length)||2)}}function by(i){var r,o;const t=i.coordinates,e=((o=(r=t[0])==null?void 0:r[0])==null?void 0:o.length)||2,n=[],s=os(n,0,t,e);return{type:"MultiLineString",flatCoordinates:n,ends:s,layout:Cn(e)}}function My(i){var e;const t=i.coordinates;return{type:"MultiPoint",flatCoordinates:t.flat(),layout:Cn(((e=t[0])==null?void 0:e.length)||2)}}function Ay(i){var r,o;const t=i.coordinates,e=[],n=((o=(r=t[0])==null?void 0:r[0])==null?void 0:o[0].length)||2,s=dc(e,0,t,n);return{type:"MultiPolygon",flatCoordinates:e,ends:s,layout:Cn(n)}}function Oy(i){var r,o;const t=i.coordinates,e=[],n=(o=(r=t[0])==null?void 0:r[0])==null?void 0:o.length,s=os(e,0,t,n);return{type:"Polygon",flatCoordinates:e,ends:s,layout:Cn(n)}}function Va(i,t){i=Ba(i,!0,t);const e=i.getType();let n;switch(e){case"Point":{n=zy(i);break}case"LineString":{n=Fy(i);break}case"Polygon":{n=jy(i,t);break}case"MultiPoint":{n=Ny(i);break}case"MultiLineString":{n=ky(i);break}case"MultiPolygon":{n=Gy(i,t);break}case"GeometryCollection":{n=Dy(i,t);break}case"Circle":{n={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+e)}return n}function Dy(i,t){return t=Object.assign({},t),delete t.featureProjection,{type:"GeometryCollection",geometries:i.getGeometriesArray().map(function(n){return Va(n,t)})}}function Fy(i,t){return{type:"LineString",coordinates:i.getCoordinates()}}function ky(i,t){return{type:"MultiLineString",coordinates:i.getCoordinates()}}function Ny(i,t){return{type:"MultiPoint",coordinates:i.getCoordinates()}}function Gy(i,t){let e;return t&&(e=t.rightHanded),{type:"MultiPolygon",coordinates:i.getCoordinates(e)}}function zy(i,t){return{type:"Point",coordinates:i.getCoordinates()}}function jy(i,t){let e;return t&&(e=t.rightHanded),{type:"Polygon",coordinates:i.getCoordinates(e)}}const vr=Ty;var Xy=class extends Kt{constructor(t){super(t),this._listener=[],t&&t.active===!1?this.set("active",!1):this.set("active",!0)}setActive(t){this.set("active",t===!0)}getActive(){return this.get("active")}};(function(){function i(r){this.get("active")&&r.context&&this.precompose(r)}function t(r){this.get("active")&&r.context&&this.postcompose(r)}function e(){if(this.renderSync)try{this.renderSync()}catch{}else this.changed()}function n(r){this.filters_||(this.filters_=[]),this.filters_.push(r),r.addToLayer&&r.addToLayer(this),r.precompose&&r._listener.push({listener:this.on(["precompose","prerender"],i.bind(r)),target:this}),r.postcompose&&r._listener.push({listener:this.on(["postcompose","postrender"],t.bind(r)),target:this}),r._listener.push({listener:r.on("propertychange",e.bind(this)),target:this}),e.call(this)}function s(r){var o;if(this.filters_||(this.filters_=[]),!r){this.filters_.forEach((function(a){this.removeFilter(a)}).bind(this));return}for(o=this.filters_.length-1;o>=0;o--)this.filters_[o]===r&&this.filters_.splice(o,1);for(o=r._listener.length-1;o>=0;o--)r._listener[o].target===this&&(r.removeFromLayer&&r.removeFromLayer(this),ch(r._listener[o].listener),r._listener.splice(o,1));e.call(this)}ci.prototype.addFilter=function(r){console.warn("[OL-EXT] addFilter deprecated on map."),n.call(this,r)},ci.prototype.removeFilter=function(r){s.call(this,r)},ci.prototype.getFilters=function(){return this.filters_||[]},as.prototype.addFilter=function(r){n.call(this,r)},as.prototype.removeFilter=function(r){s.call(this,r)},as.prototype.getFilters=function(){return this.filters_||[]}})();var By=class extends Xy{constructor(t){if(t=t||{},super(t),t.feature)switch(t.feature.getGeometry().getType()){case"Polygon":case"MultiPolygon":this.feature_=t.feature;break}this.set("inner",t.inner),this._fillColor=t.fill&&Ue(t.fill.getColor())||"rgba(0,0,0,0.2)",this._shadowColor=t.shadowColor&&Ue(t.shadowColor)||"rgba(0,0,0,0.5)",this.set("shadowWidth",t.shadowWidth||0),this.set("shadowMapUnits",t.shadowMapUnits===!0)}setFillColor(t){this._fillColor=t&&Ue(t)||"rgba(0,0,0,0.2)"}setShadowColor(t){this._shadowColor=t&&Ue(t)||"rgba(0,0,0,0.5)"}drawFeaturePath_(t,e){var n=t.context,s=n.canvas,r=t.frameState.pixelRatio,o;if(t.frameState.coordinateToPixelTransform){var a=t.frameState.coordinateToPixelTransform;if(t.inversePixelTransform){var l=t.inversePixelTransform;o=function(C){return C=[C[0]*a[0]+C[1]*a[1]+a[4],C[0]*a[2]+C[1]*a[3]+a[5]],[C[0]*l[0]-C[1]*l[1]+l[4],-C[0]*l[2]+C[1]*l[3]+l[5]]}}else o=function(C){return[(C[0]*a[0]+C[1]*a[1]+a[4])*r,(C[0]*a[2]+C[1]*a[3]+a[5])*r]}}else a=t.frameState.coordinateToPixelMatrix,o=function(C){return[(C[0]*a[0]+C[1]*a[1]+a[12])*r,(C[0]*a[4]+C[1]*a[5]+a[13])*r]};var h=this.feature_.getGeometry().getCoordinates();this.feature_.getGeometry().getType()==="Polygon"&&(h=[h]);function c(C){for(var E=0;E<h.length;E++)for(var w=h[E],T=0;T<w.length;T++){var v=o([w[T][0][0]+C,w[T][0][1]]);n.moveTo(v[0],v[1]);for(var R=1;R<w[T].length;R++)v=o([w[T][R][0]+C,w[T][R][1]]),n.lineTo(v[0],v[1])}}if(n.beginPath(),e&&(n.moveTo(-100,-100),n.lineTo(s.width+100,-100),n.lineTo(s.width+100,s.height+100),n.lineTo(-100,s.height+100),n.lineTo(-100,-100)),this.get("wrapX")){var u=t.frameState.viewState.projection.getExtent(),d=u[2]-u[0],f=t.frameState.extent,g=this.feature_.getGeometry().getExtent(),_=g[2]-g[1],m=Math.floor((f[0]-_-u[0])/d),p=Math.floor((f[2]+_-u[2])/d)+1;m>p&&([m,p]=[p,m]);for(var y=m;y<=p;y++)c(y*d)}else c(0)}postcompose(t){if(this.feature_){var e=t.context;if(e.save(),this.drawFeaturePath_(t,!this.get("inner")),e.fillStyle=this._fillColor,e.fill("evenodd"),this.get("shadowWidth")){var n=this.get("shadowWidth")*t.frameState.pixelRatio;this.get("shadowMapUnits")&&(n/=t.frameState.viewState.resolution),e.clip("evenodd"),e.filter="blur("+n+"px)",e.strokeStyle=this._shadowColor,e.lineCap="round",e.lineJoin="round",e.lineWidth=n,e.stroke()}e.restore()}}};const Yy=i=>{const{layerId:t,data:e,innerStyle:n,zIndex:s=3,maskFillColor:r,shadowColor:o,shadowWidth:a}=i,h=new vr().readFeatures(e),c=new zt(h[0].getGeometry());n?c.setStyle(n):c.setStyle(new $t({fill:new wt({color:"rgba(0, 0, 0, 0)"})}));const u=new By({feature:c,fill:new wt({color:r||"rgba(67, 100, 116, 0.61)"}),shadowWidth:a||0,shadowMapUnits:!0,shadowColor:o||"rgba(0,0,0,0)",wrapX:!0}),d=new ke({features:[c]}),f=new Fe({source:d,zIndex:s,renderBuffer:100});return f.addFilter(u),Ee(t,f),window.xmMap.addLayer(f),{layer:f,source:d}};class Wy extends Xo{constructor(t){super(t),this.image=null}getImage(){return this.image?this.image.getImage():null}prepareFrame(t){const e=t.layerStatesArray[t.layerIndex],n=t.pixelRatio,s=t.viewState,r=s.resolution,o=this.getLayer().getSource(),a=t.viewHints;let l=t.extent;if(e.extent!==void 0&&(l=Se(l,_e(e.extent,s.projection))),!a[st.ANIMATING]&&!a[st.INTERACTING]&&!Xn(l))if(o){const h=s.projection,c=o.getImage(l,r,n,h);c&&(this.loadImage(c)?this.image=c:c.getState()===M.EMPTY&&(this.image=null))}else this.image=null;return!!this.image}getData(t){const e=this.frameState;if(!e)return null;const n=this.getLayer(),s=gt(e.pixelToCoordinateTransform,t.slice()),r=n.getExtent();if(r&&!cn(r,s))return null;const o=this.image.getExtent(),a=this.image.getImage(),l=K(o),h=Math.floor(a.width*((s[0]-o[0])/l));if(h<0||h>=a.width)return null;const c=ct(o),u=Math.floor(a.height*((o[3]-s[1])/c));return u<0||u>=a.height?null:this.getImageData(a,h,u)}renderFrame(t,e){const n=this.image,s=n.getExtent(),r=n.getResolution(),[o,a]=Array.isArray(r)?r:[r,r],l=n.getPixelRatio(),h=t.layerStatesArray[t.layerIndex],c=t.pixelRatio,u=t.viewState,d=u.center,f=u.resolution,g=c*o/(f*l),_=c*a/(f*l);this.prepareContainer(t,e);const m=this.context.canvas.width,p=this.context.canvas.height,y=this.getRenderContext(t);let C=!1,E=!0;if(h.extent){const I=_e(h.extent,u.projection);E=Ct(I,t.extent),C=E&&!fe(I,t.extent),C&&this.clipUnrotated(y,t,I)}const w=n.getImage(),T=pe(this.tempTransform,m/2,p/2,g,_,0,l*(s[0]-d[0])/o,l*(d[1]-s[3])/a);this.renderedResolution=a*c/l;const v=w.width*T[0],R=w.height*T[3];if(this.getLayer().getSource().getInterpolate()||(y.imageSmoothingEnabled=!1),this.preRender(y,t),E&&v>=.5&&R>=.5){const I=T[4],b=T[5],O=h.opacity;O!==1&&(y.save(),y.globalAlpha=O),y.drawImage(w,0,0,+w.width,+w.height,I,b,v,R),O!==1&&y.restore()}return this.postRender(this.context,t),C&&y.restore(),y.imageSmoothingEnabled=!0,this.container}}const Vy=Wy;class Uy extends ls{constructor(t){t=t||{},super(t)}}const Ky=Uy;class $y extends Ky{constructor(t){super(t)}createRenderer(){return new Vy(this)}getData(t){return super.getData(t)}}const Zy=$y;class Hy extends Eo{constructor(t,e,n,s,r){const o=r!==void 0?M.IDLE:M.LOADED;super(t,e,n,o),this.loader_=r!==void 0?r:null,this.canvas_=s,this.error_=null}getError(){return this.error_}handleLoad_(t){t?(this.error_=t,this.state=M.ERROR):this.state=M.LOADED,this.changed()}load(){this.state==M.IDLE&&(this.state=M.LOADING,this.changed(),this.loader_(this.handleLoad_.bind(this)))}getImage(){return this.canvas_}}const qy=Hy;function Ua(i){return Array.isArray(i)?Math.min(...i):i}class Jy extends Eo{constructor(t,e,n,s,r,o,a){let l=t.getExtent();l&&t.canWrapX()&&(l=l.slice(),l[0]=-1/0,l[2]=1/0);let h=e.getExtent();h&&e.canWrapX()&&(h=h.slice(),h[0]=-1/0,h[2]=1/0);const c=h?Se(n,h):n,u=ie(c),d=pr(t,e,u,s),f=Vc,g=new Wc(t,e,c,l,d*f,s),_=g.calculateSourceExtent(),m=Xn(_)?null:o(_,d,r),p=m?M.IDLE:M.EMPTY,y=m?m.getPixelRatio():1;super(n,s,y,p),this.targetProj_=e,this.maxSourceExtent_=l,this.triangulation_=g,this.targetResolution_=s,this.targetExtent_=n,this.sourceImage_=m,this.sourcePixelRatio_=y,this.interpolate_=a,this.canvas_=null,this.sourceListenerKey_=null}disposeInternal(){this.state==M.LOADING&&this.unlistenSource_(),super.disposeInternal()}getImage(){return this.canvas_}getProjection(){return this.targetProj_}reproject_(){const t=this.sourceImage_.getState();if(t==M.LOADED){const e=K(this.targetExtent_)/this.targetResolution_,n=ct(this.targetExtent_)/this.targetResolution_;this.canvas_=Bc(e,n,this.sourcePixelRatio_,Ua(this.sourceImage_.getResolution()),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0,void 0,this.interpolate_,!0)}this.state=t,this.changed()}load(){if(this.state==M.IDLE){this.state=M.LOADING,this.changed();const t=this.sourceImage_.getState();t==M.LOADED||t==M.ERROR?this.reproject_():(this.sourceListenerKey_=$(this.sourceImage_,z.CHANGE,e=>{const n=this.sourceImage_.getState();(n==M.LOADED||n==M.ERROR)&&(this.unlistenSource_(),this.reproject_())}),this.sourceImage_.load())}}unlistenSource_(){it(this.sourceListenerKey_),this.sourceListenerKey_=null}}const Qy=Jy,_i=4,Ka={IMAGELOADSTART:"imageloadstart",IMAGELOADEND:"imageloadend",IMAGELOADERROR:"imageloaderror"};class t0 extends se{constructor(t,e){super(t),this.image=e}}class e0 extends Ea{constructor(t){super({attributions:t.attributions,projection:t.projection,state:t.state,interpolate:t.interpolate!==void 0?t.interpolate:!0}),this.on,this.once,this.un,this.loader=t.loader||null,this.resolutions_=t.resolutions!==void 0?t.resolutions:null,this.reprojectedImage_=null,this.reprojectedRevision_=0,this.image=null,this.wantedExtent_,this.wantedResolution_,this.static_=t.loader?t.loader.length===0:!1,this.wantedProjection_=null}getResolutions(){return this.resolutions_}setResolutions(t){this.resolutions_=t}findNearestResolution(t){const e=this.getResolutions();if(e){const n=vs(e,t,0);t=e[n]}return t}getImage(t,e,n,s){const r=this.getProjection();if(!r||!s||mn(r,s))return r&&(s=r),this.getImageInternal(t,e,n,s);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&mn(this.reprojectedImage_.getProjection(),s)&&this.reprojectedImage_.getResolution()==e&&zn(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new Qy(r,s,t,e,n,(o,a,l)=>this.getImageInternal(o,a,l,r),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(t,e,n,s){if(this.loader){const r=n0(t,e,n,1),o=this.findNearestResolution(e);if(this.image&&(this.static_||this.wantedProjection_===s&&(this.wantedExtent_&&fe(this.wantedExtent_,r)||fe(this.image.getExtent(),r))&&(this.wantedResolution_&&Ua(this.wantedResolution_)===o||Ua(this.image.getResolution())===o)))return this.image;this.wantedProjection_=s,this.wantedExtent_=r,this.wantedResolution_=o,this.image=new Eo(r,o,n,this.loader),this.image.addEventListener(z.CHANGE,this.handleImageChange.bind(this))}return this.image}handleImageChange(t){const e=t.target;let n;switch(e.getState()){case M.LOADING:this.loading=!0,n=Ka.IMAGELOADSTART;break;case M.LOADED:this.loading=!1,n=Ka.IMAGELOADEND;break;case M.ERROR:this.loading=!1,n=Ka.IMAGELOADERROR;break;default:return}this.hasListener(n)&&this.dispatchEvent(new t0(n,e))}}function n0(i,t,e,n){const s=t/e,r=ie(i),o=We(K(i)/s,_i),a=We(ct(i)/s,_i),l=We((n-1)*o/2,_i),h=o+2*l,c=We((n-1)*a/2,_i),u=a+2*c;return Ts(r,s,0,[h,u])}const i0=e0;class s0 extends i0{constructor(t){t=t||{},super({attributions:t.attributions,interpolate:t.interpolate,projection:t.projection,resolutions:t.resolutions,state:t.state}),this.canvasFunction_=t.canvasFunction,this.canvas_=null,this.renderedRevision_=0,this.ratio_=t.ratio!==void 0?t.ratio:1.5}getImageInternal(t,e,n,s){e=this.findNearestResolution(e);let r=this.canvas_;if(r&&this.renderedRevision_==this.getRevision()&&r.getResolution()==e&&r.getPixelRatio()==n&&fe(r.getExtent(),t))return r;t=t.slice(),_d(t,this.ratio_);const o=K(t)/e,a=ct(t)/e,l=[o*n,a*n],h=this.canvasFunction_.call(this,t,e,n,l,s);return h&&(r=new qy(t,e,n,h)),this.canvas_=r,this.renderedRevision_=this.getRevision(),r}}const r0=s0;var o0=class extends Zy{constructor(t){t=t||{};var e=document.createElement("canvas");super({source:new r0({canvasFunction:function(n,s,r,o){return e.width=o[0],e.height=o[1],e}}),center:t.center||[.5,1],defaultHeight:t.defaultHeight||0,maxResolution:t.maxResolution||1/0}),this._source=t.source,this.height_=this.getHfn(t.height),this.setStyle(t.style),this.on(["postcompose","postrender"],this.onPostcompose_.bind(this))}setStyle(t){if(t instanceof $t?this._style=t:this._style=new $t,this._style.getStroke()||this._style.setStroke(new Ae({width:1,color:"red"})),this._style.getFill()||this._style.setFill(new wt({color:"rgba(0,0,255,0.5)"})),this._style.getText()||this._style.setText(new wt({color:"red"})),t&&t.getGeometry()){var e=t.getGeometry();typeof e=="function"?this.set("geometry",e):this.set("geometry",function(){return e})}else this.set("geometry",function(n){return n.getGeometry()})}getStyle(){return this._style}onPostcompose_(t){var e=t.frameState.viewState.resolution;if(!(e>this.get("maxResolution"))){if(this.res_=e*400,this.animate_){var n=t.frameState.time-this.animate_;n<this.animateDuration_?(this.elapsedRatio_=this.easing_(n/this.animateDuration_),t.frameState.animate=!0):(this.animate_=!1,this.height_=this.toHeight_)}var s=t.frameState.pixelRatio,r=t.context,o=this.matrix_=t.frameState.coordinateToPixelTransform;o||(o=t.frameState.coordinateToPixelMatrix,o[2]=o[4],o[3]=o[5],o[4]=o[12],o[5]=o[13]),this.center_=[r.canvas.width*this.get("center")[0]/s,r.canvas.height*this.get("center")[1]/s];var a=this._source.getFeaturesInExtent(t.frameState.extent);r.save(),r.scale(s,s);var l=this.getStyle();r.lineWidth=l.getStroke().getWidth(),r.lineCap=l.getStroke().getLineCap(),r.strokeStyle=Ue(l.getStroke().getColor()),r.fillStyle=Ue(l.getFill().getColor());for(var h=[],c=0;c<a.length;c++)h.push(this.getFeature3D_(a[c],this._getFeatureHeight(a[c])));this.drawFeature3D_(r,h),r.restore()}}getHfn(t){switch(typeof t){case"function":return t;case"string":{var e=this.get("defaultHeight");return function(n){return Number(n.get(t))||e}}case"number":return function(){return t};default:return function(){return 10}}}animate(t){t=t||{},this.toHeight_=this.getHfn(t.height),this.animate_=new Date().getTime(),this.animateDuration_=t.duration||1e3,this.easing_=t.easing||Rn,this.changed()}animating(){return this.animate_&&new Date().getTime()-this.animate_>this.animateDuration_&&(this.animate_=!1),!!this.animate_}_getFeatureHeight(t){if(this.animate_){var e=this.height_(t),n=this.toHeight_(t);return e*(1-this.elapsedRatio_)+this.elapsedRatio_*n}else return this.height_(t)}hvector_(t,e){var n=[t[0]*this.matrix_[0]+t[1]*this.matrix_[1]+this.matrix_[4],t[0]*this.matrix_[2]+t[1]*this.matrix_[3]+this.matrix_[5]];return{p0:n,p1:[n[0]+e/this.res_*(n[0]-this.center_[0]),n[1]+e/this.res_*(n[1]-this.center_[1])]}}getFeature3D_(t,e){var n=this.get("geometry")(t),s=n.getCoordinates();switch(n.getType()){case"Polygon":s=[s];case"MultiPolygon":for(var r=[],o=0;o<s.length;o++)for(var a=0;a<s[o].length;a++){for(var l=[],h=0;h<s[o][a].length;h++)l.push(this.hvector_(s[o][a][h],e));r.push(l)}return{type:"MultiPolygon",feature:t,geom:r};case"Point":return{type:"Point",feature:t,geom:this.hvector_(s,e)};default:return{}}}drawFeature3D_(t,e){var n,s,r,o;for(n=0;n<e.length;n++)switch(e[n].type){case"MultiPolygon":{for(s=0;s<e[n].geom.length;s++)for(r=e[n].geom[s],o=0;o<r.length;o++)t.beginPath(),t.moveTo(r[o].p0[0],r[o].p0[1]),t.lineTo(r[o].p1[0],r[o].p1[1]),t.stroke();break}case"Point":{var a=e[n].geom;t.beginPath(),t.moveTo(a.p0[0],a.p0[1]),t.lineTo(a.p1[0],a.p1[1]),t.stroke();break}}for(n=0;n<e.length;n++)switch(e[n].type){case"MultiPolygon":{for(t.beginPath(),s=0;s<e[n].geom.length;s++){if(r=e[n].geom[s],s==0)for(t.moveTo(r[0].p1[0],r[0].p1[1]),o=1;o<r.length;o++)t.lineTo(r[o].p1[0],r[o].p1[1]);else for(t.moveTo(r[0].p1[0],r[0].p1[1]),o=r.length-2;o>=0;o--)t.lineTo(r[o].p1[0],r[o].p1[1]);t.closePath()}t.fill("evenodd"),t.stroke();break}case"Point":{r=e[n];var l=r.feature.get("label");if(l){var h=r.geom.p1,c=t.measureText(l),u=Number(t.font.match(/\d+(\.\d+)?/g).join([]));t.fillRect(h[0]-c.width/2-5,h[1]-u-5,c.width+10,u+10),t.strokeRect(h[0]-c.width/2-5,h[1]-u-5,c.width+10,u+10),t.save(),t.fillStyle=Ue(this._style.getText().getFill().getColor()),t.textAlign="center",t.textBaseline="bottom",t.fillText(l,h[0],h[1]),t.restore()}break}}}};const a0=i=>{const{layerId:t,data:e}=i,s=new vr().readFeatures(e),r=new zt(s[0].getGeometry()),o=new ke({features:[r]}),a=new o0({source:o,style:new $t({fill:new wt({color:"rgba(255, 255, 255, 0)"}),stroke:new Ae({color:"blue",width:1})}),defaultHeight:-1e-4,maxResolution:10,height:1e-4,center:[102.836837,30.38723]});return window.xmMap.addLayer(a),Ee(t,a),a};class l0 extends ke{constructor(t){t=t||{},super({attributions:t.attributions,wrapX:t.wrapX}),this.resolution=void 0,this.distance=t.distance!==void 0?t.distance:20,this.minDistance=t.minDistance||0,this.interpolationRatio=0,this.features=[],this.geometryFunction=t.geometryFunction||function(e){const n=e.getGeometry();return J(!n||n.getType()==="Point","The default `geometryFunction` can only handle `Point` or null geometries"),n},this.createCustomCluster_=t.createCluster,this.source=null,this.boundRefresh_=this.refresh.bind(this),this.updateDistance(this.distance,this.minDistance),this.setSource(t.source||null)}clear(t){this.features.length=0,super.clear(t)}getDistance(){return this.distance}getSource(){return this.source}loadFeatures(t,e,n){var s;(s=this.source)==null||s.loadFeatures(t,e,n),e!==this.resolution&&(this.resolution=e,this.refresh())}setDistance(t){this.updateDistance(t,this.minDistance)}setMinDistance(t){this.updateDistance(this.distance,t)}getMinDistance(){return this.minDistance}setSource(t){this.source&&this.source.removeEventListener(z.CHANGE,this.boundRefresh_),this.source=t,t&&t.addEventListener(z.CHANGE,this.boundRefresh_),this.refresh()}refresh(){this.clear(),this.cluster(),this.addFeatures(this.features)}updateDistance(t,e){const n=t===0?0:Math.min(e,t)/t,s=t!==this.distance||this.interpolationRatio!==n;this.distance=t,this.minDistance=e,this.interpolationRatio=n,s&&this.refresh()}cluster(){if(this.resolution===void 0||!this.source)return;const t=Mt(),e=this.distance*this.resolution,n=this.source.getFeatures(),s={};for(let r=0,o=n.length;r<o;r++){const a=n[r];if(!(q(a)in s)){const l=this.geometryFunction(a);if(l){const h=l.getCoordinates();Wr(h,t),Gn(t,e,t);const c=this.source.getFeaturesInExtent(t).filter(function(u){const d=q(u);return d in s?!1:(s[d]=!0,!0)});this.features.push(this.createCluster(c,t))}}}}createCluster(t,e){const n=[0,0];for(let a=t.length-1;a>=0;--a){const l=this.geometryFunction(t[a]);l?Pl(n,l.getCoordinates()):t.splice(a,1)}bl(n,1/t.length);const s=ie(e),r=this.interpolationRatio,o=new he([n[0]*(1-r)+s[0]*r,n[1]*(1-r)+s[1]*r]);return this.createCustomCluster_?this.createCustomCluster_(o,t):new zt({geometry:o,features:t})}}const h0=l0,$a="1.3.0";function c0(i,t,e,n,s){s.WIDTH=e[0],s.HEIGHT=e[1];const r=n.getAxisOrientation(),o=Ll(s.VERSION,"1.3")>=0;s[o?"CRS":"SRS"]=n.getCode();const a=o&&r.startsWith("ne")?[t[1],t[0],t[3],t[2]]:t;return s.BBOX=a.join(","),Qc(i,s)}function u0(i,t,e,n,s,r,o){r=Object.assign({REQUEST:"GetMap"},r);const a=t/e,l=[Il(K(i)/a,_i),Il(ct(i)/a,_i)];if(e!=1)switch(o){case"geoserver":const c=90*e+.5|0;"FORMAT_OPTIONS"in r?r.FORMAT_OPTIONS+=";dpi:"+c:r.FORMAT_OPTIONS="dpi:"+c;break;case"mapserver":r.MAP_RESOLUTION=90*e;break;case"carmentaserver":case"qgis":r.DPI=90*e;break;default:throw new Error("Unknown `serverType` configured")}return c0(s,i,l,n,r)}function lu(i,t){return Object.assign({REQUEST:t,SERVICE:"WMS",VERSION:$a,FORMAT:"image/png",STYLES:"",TRANSPARENT:"TRUE"},i)}class d0 extends tu{constructor(t){t=t||{};const e=Object.assign({},t.params);super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileClass:t.tileClass,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction,url:t.url,urls:t.urls,wrapX:t.wrapX!==void 0?t.wrapX:!0,transition:t.transition,zDirection:t.zDirection}),this.gutter_=t.gutter!==void 0?t.gutter:0,this.params_=e,this.v13_=!0,this.serverType_=t.serverType,this.hidpi_=t.hidpi!==void 0?t.hidpi:!0,this.tmpExtent_=Mt(),this.updateV13_(),this.setKey(this.getKeyForParams_())}getFeatureInfoUrl(t,e,n,s){const r=at(n),o=this.getProjection()||r;let a=this.getTileGrid();a||(a=this.getTileGridForProjection(o));const l=ao(t,r,o),h=pr(o,r,t,e),c=a.getZForResolution(h,this.zDirection),u=a.getResolution(c),d=a.getTileCoordForCoordAndZ(l,c);if(a.getResolutions().length<=d[0])return;let f=a.getTileCoordExtent(d,this.tmpExtent_);const g=this.gutter_;g!==0&&(f=Gn(f,u*g,f));const _={QUERY_LAYERS:this.params_.LAYERS};Object.assign(_,lu(this.params_,"GetFeatureInfo"),s);const m=Math.floor((l[0]-f[0])/u),p=Math.floor((f[3]-l[1])/u);return _[this.v13_?"I":"X"]=m,_[this.v13_?"J":"Y"]=p,this.getRequestUrl_(d,f,1,o||r,_)}getLegendUrl(t,e){if(this.urls[0]===void 0)return;const n={SERVICE:"WMS",VERSION:$a,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(e===void 0||e.LAYER===void 0){const s=this.params_.LAYERS;if(!(!Array.isArray(s)||s.length===1))return;n.LAYER=s}if(t!==void 0){const s=this.getProjection()?this.getProjection().getMetersPerUnit():1,r=28e-5;n.SCALE=t*s/r}return Object.assign(n,e),Qc(this.urls[0],n)}getGutter(){return this.gutter_}getParams(){return this.params_}getRequestUrl_(t,e,n,s,r){const o=this.urls;if(!o)return;let a;if(o.length==1)a=o[0];else{const l=un($c(t),o.length);a=o[l]}return u0(e,(this.tileGrid||this.getTileGridForProjection(s)).getResolution(t[0]),n,s,a,r,this.serverType_)}getTilePixelRatio(t){return!this.hidpi_||this.serverType_===void 0?1:t}getKeyForParams_(){let t=0;const e=[];for(const n in this.params_)e[t++]=n+"-"+this.params_[n];return e.join("/")}setParams_(t){this.params_=t,this.updateV13_(),this.setKey(this.getKeyForParams_())}setParams(t){this.setParams_(Object.assign({},t))}updateParams(t){this.setParams_(Object.assign(this.params_,t))}updateV13_(){const t=this.params_.VERSION||$a;this.v13_=Ll(t,"1.3")>=0}tileUrlFunction(t,e,n){let s=this.getTileGrid();if(s||(s=this.getTileGridForProjection(n)),s.getResolutions().length<=t[0])return;e!=1&&(!this.hidpi_||this.serverType_===void 0)&&(e=1);const r=s.getResolution(t[0]);let o=s.getTileCoordExtent(t,this.tmpExtent_);const a=this.gutter_;a!==0&&(o=Gn(o,r*a,o));const l=Object.assign({},lu(this.params_,"GetMap"));return this.getRequestUrl_(t,o,e,n,l)}}const f0=d0,g0=i=>{let t;typeof i=="string"?t=JSON.parse(i):t=i;const n=new vr().readFeatures(t),s=[];return n.forEach(r=>{s.push(new zt(r.getGeometry()))}),s},_0=i=>{const{layerId:t,data:e,customStyle:n,zIndex:s=3}=i;let r=g0(e);const o=new ke({features:r}),a=new Fe({source:o,style:n,zIndex:s});return a.setVisible(!0),Ee(t,a),window.xmMap.addLayer(a),{layer:a,source:o}},m0=i=>{const{layerId:t,url:e,zIndex:n=3}=i,s=new on({source:new Ln({url:e}),zIndex:n});return Ee(t,s),window.xmMap.addLayer(s),s},p0=i=>{const{layerId:t,url:e,zIndex:n=3,LAYERS:s}=i,r=new on({source:new f0({url:e,params:{SERVICE:"WMS",VERSION:"1.1.1",REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0,LAYERS:s,exceptions:"application/vnd.ogc.se_inimage",SRS:"EPSG:4326",STYLES:"",WIDTH:"768",HEIGHT:"567",BBOX:"94.50439453125,23.961181640625,111.37939453125,36.419677734375"}}),zIndex:n});return Ee(t,r),window.xmMap.addLayer(r),r};let y0=new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAACN1JREFUeF7NWwuMXFUZ/v47c+9sN9RIYnmUnTtt6Pbe2WrRCk2gxVKf0Wgp0VAiUmjA8OgD0QSKjwDxQSEBlbeCtioY8RFra3xWW1SoKdhAsTsz3W3cubNuxappoCk7Z2bub+7ujOzOzL33nHtndr3JZpM93//6zn9e/zlLmKFvMKMvI6Y1xNQH4j4C+hhIe+YJKDEwCqZRJvZ+dg0UKwdnwjXqlpGhRUi5ZWMta/QuMH8IwAJFWyMg+gW5/ActJXb2D6OsKC8F7zgB+UzPQsC9EoxPALCkvAgHFUB4EtCesovjfwuHyyM6RsDQWZhXS6XuArMX+Fx5F5SQr4HoyUS5fEf/P3BcSdIH3BECcn3JS6BpjxOwqBNOhelgYBiu+8nsaHVfGDasPTYBhbR+ExM9HGaoG+3EvNEqVR6JozsWAQVTX8+g78RxIK4sga+2nMp3o+qJTICX9qRpe6Ma7qQcu+7qqMMhEgFDGX1ZjWk/AEMhkBMg7HOZniGqHai6iVe08fIrnrzbkzozqdXOZE4s14hXgXEJgDcr6BYJ4gv7I+wdlAnw1veaMJ4DsEzSQcGMB4Sb+Pp5f399VEbmpXPm9Bla7WYibFEg+WDCEBep7heUCSiYxlYG7pYJBMABl/jGqLs6b/eoMT0KYLmMPQJutxyxTQbbwCgRMJROnVuDux9E8ySM7LYdsUYCFwrJm8YuAB8JBTIfT0C7sL9UPhqKrQOUCMin9YdBdFOYcgbuyjrizjCcSnvONO4k4I5QGeZH7FJlYyhOlYDcgp4FmuvmGOgJVk6P2U75RlkHVHB5M/UowDcEyRAw7mpaNjsyPiKjWzoDJHvgxdc1sfodIzjhZ7yQ0a8Daxcwu4sBLKnjDhNpR0Du81ax8oSf7PC5p51RrYg/A1gYFJxKBkoTkM8YBTA8p30/l3HZQEnsbAfIW5iLU/ouEHlLnP/HvA+9lTV2Aa+11WOmbgb4a4E6CEfsopA6iEkRILPpIeBpyxFXtHNs4qBkGP+USckGJiHEGX4Hnrxp5MNOmrKbIykC8mnjUhDa9mzD4aB9ecHUf8ug96oQQOA9llN5X/ssMO4BcGtwJmGtXRI/C7MpRcCgqa/XQvb8fj0W57DkR+rQOXP6aolaKXA4gq8ekDgjSBGQM1ObCfxAgMF/2454S7v2gmn8ld+Y7MI6ZFo7AYctR7y1nVDONP5DwOl+Chm0JeuUHwwzKEVAPmN8HowvBih72XbE0uZ2b+kk141VwWFNW9huSSuYxiADWV+fCF+wi+JLHSGgkEltYuYgNp+zHbGi2dhg2linEX4Q5kRgKjOuGCiJp5sx+bS+N2hFIaLNVrH8UJhtqQzIZYyPEuPHfsoIOGo5oqUaNGimPqWBvxrmRPBYplsGnHLLspdPG16d0HdZZsLHskXxkzDbcgT0GW8jDYcClJ20HdFSByyk9QuY6ECYE0HtxLzcKlWeb8kA03g1qPbILpZmR8XLYbalCPCU5E3DG8u+pe2kS/2LRsvDUw3uBZJnm4ZXvFQ5209VceKYI+atBqpT/zhkGgM14HBAcCO2IwJ3iw1ZeQLSqSdAfK2fUQ20ZXGbWTdnGrtI5iTXRjEDu7NtTpSh23Kmb9ml8nVhve+1yxNgGpcDaJmM/meE8Uu7JLwLkGlfwUyuZGh/lHGmGUNwL7ac6p9adYYuretsR/xQxqY0AfV0HgTQ76uY+Fq7WPl2c3suo99HTJ+WcaiBYeL7s8XKZ1rHfuhZYOiYIwaah42fbWkC6vOAV225LSCQAlXFSmsM/2ohwTTuJmCrDAkMbMs64vZmrORp8B7bEVJ2lIaAB5aZ1Qn0TcspX98u0JypvxPANvI5FzB4D4CtWafyl3byedPwyt9XBZHot2p0JAPqWfBrAO8P7km6xW6zdjdkhvtSi2oJ9BNP3iQxYThRw1DzKjLVRujENwn+je2ID8hkWQOjNAQ8oZypX0+gxySMXG474kcSuFCIzHF8gkjwDVmn8o1QhVMAygQcPAvzeg3jRQDzJQzFJiGf1jeAqGVibWN77JQQb1+meGmqTMBkFkgWKCe9vM12xL0SZE2DDM+fk64lqrcy0SYZWZUy2FR9kQgYyfSePc7VFySzwNtuPAvGvbW55V8tGYQICsirHlVTqXXE7BU8Jl6QSHxjPZQ8f0Hx1DEJ7DRIJAIiZEHDqLd/389Ee+DiUCqZfMlrKFer50HDUmL3gwBdDEBXCSRq73s2IhOgngUqISlhI/d+LAJiZIFSdGHgOL0fm4D/gyyI1fuxCZjtLIjb+x0h4PA8nJboNbxZvqUmGJa+sdoJh2qnxIolx3Eyjp7Ik+BUowVTv4pBkZ+pRAmAwOstp/K9KLKx9wHtjOYzxk/BWBvXISl5wk67KC6TwoaAOpIBno28mVwBaC3Fi0442arDXWk71Wc7obtjBHjOFDL6faxY+FANgojvt9oUSlT1NPAdJaC+LHrvh1TfBcv6P9JDyYuibHn9DHSUgMksSG1k5tALCdmIp01YRJusYrmjjzI7TkB9b7CbgA9HCdJPhoGfZx0R/k5I0WhXCCj06ctZo2cQ+pxG2ttxcnmVNVqJdcnSzlpXCJgYCmnjs0z4snSIAUBifM4qia90Qlezjq4RMLE0hlxgSgXEvM8uVVZLYSOAuktApufdYPd3Efx6Q4S099jF8d/H0hGUXd1S3NCbU7gPaPbF736gkz53NQM8R8fmo/fVpOFNiOcrOv7Cm6pi1fwxnFKUU4J3nYDJuSC1BsShD5amec50qV0qe09ku/rNCAFeBLm0/iDJVniZH8qWKpu7Gnld+YwRUL/X84aCHRJYPqkbqxYdPan0rjAqWTNGgOfgkYzxcZfxVJCzGuHKxUXx/agBqcrNKAETQ8E0thNwTTtHGdiRdcQG1SDi4GeegMmnc97/GjWfGEdY01bLvvKOE/RU2RknoD4hXkNE26c6wswbsqXKjk4FJqtnVgjwnCuYxnauDwUCdlgznPoNgmaNgPor0ol/u5uN1J91AhpDwfs9G6nfIOC/gAk7bjiR6jcAAAAASUVORK5CYII=",self.location);const hu=i=>{const{style:t,title:e,customStyle:n}=i;let s=null,r=null;if(t!=null&&t.gradient){r=document.createElement("canvas"),s=r.getContext("2d");const a=s.createLinearGradient(0,0,r.width,0);a.addColorStop(0,t.gradient[0]),a.addColorStop(1,t.gradient[t.gradient.length-1]),s.fillStyle=a,s.fillRect(0,0,r.width,r.height)}let o;return n?o=n:o=new $t({image:new No({anchor:[.5,.5],anchorXUnits:"fraction",anchorYUnits:"pixels",width:t!=null&&t.iconSrc&&typeof(t==null?void 0:t.width)=="number"&&!Number.isNaN(t.width)?t.width:30,height:t!=null&&t.iconSrc&&typeof(t==null?void 0:t.height)=="number"&&!Number.isNaN(t.height)?t.height:30,src:(t==null?void 0:t.iconSrc)||y0.pathname}),text:new Oh({text:e||"默认点",fill:new wt({color:(t==null?void 0:t.textColor)||"#FFF"}),offsetY:t!=null&&t.iconSrc?t==null?void 0:t.offsetY:50,offsetX:t!=null&&t.iconSrc?t==null?void 0:t.offsetX:-35,textAlign:(t==null?void 0:t.textAlign)||"left",padding:(t==null?void 0:t.padding)||[5,5,5,5],font:t!=null&&t.textFont?`${t==null?void 0:t.textFont} MicrosoftYaHei`:"16px MicrosoftYaHei",backgroundFill:new wt({color:(t==null?void 0:t.textbackground)||(s?s.createPattern(r,"repeat"):"rgba(0, 0, 0, 0)")}),stroke:new Ae({color:(t==null?void 0:t.textStrokeColor)||"",width:(t==null?void 0:t.textStrokeWidth)||0}),backgroundStroke:new Ae({color:(t==null?void 0:t.backgroundStrokeColor)||"rgba(0, 0, 0, 0)",width:(t==null?void 0:t.backgroundStrokeWidth)||0})})}),o},x0=i=>{const{id:t,className:e,style:n}=i;let s=null,r=null;if(t&&(s=document.getElementById(t)),!s){s=document.createElement("div"),s.id="popupContain",e&&(s.className=e),n&&Object.assign(s.style,n),r=document.createElement("div"),r.id="popupContent";const a={position:"absolute",width:"13rem",backgroundColor:"#fff",borderRadius:"10px",zIndex:"50",padding:"0.625rem",border:"1px solid #ddd",paddingLeft:"1.5rem",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24)"};Object.assign(s.style,a),s.appendChild(r),r.innerHTML="<p>这个是示例信息</p>"}const o=new ja({element:s,positioning:"bottom-center",stopEvent:!1,offset:[10,10]});return window.xmMap.addOverlay(o),{overlay:o,contentElement:r}},cu=(i,t)=>{const{data:e,style:n,iconOutStyle:s,setStyleCallBack:r,customStyle:o,noStyle:a,overlay:l,HoverBack:h,ClickBack:c}=i;if(console.log(i,"接收的参数option"),e.length===0)return[];const u=window.xmMap.getTargetElement(),d=e.map(f=>{let g=Number(f.lng),_=Number(f.lat);!g&&!_&&console.warn("坐标格式错误");const m=[g,_],p=new he(m);var y=new zt({geometry:p,properties:{...f}});let C=[];if(!a){if(s&&typeof s=="boolean"?C.push(new $t({image:new Ks({radius:9,fill:new wt({color:"#fff"})})})):s&&typeof s=="function"&&C.push(s(f)),r&&typeof r=="function")C.push(r(f));else{let E=hu({style:n,title:f.rsnm,customStyle:o});C.push(E)}y.setStyle(C)}return mt.xmMapListener({listenType:"pointermove",removeListener:!0}),l&&h&&mt.xmMapListener({listenType:"pointermove",callback:async E=>{var v;const w=E.pixel,T=window.xmMap.forEachFeatureAtPixel(w,R=>R);if(T&&T.getGeometry()instanceof he){const R=(v=T==null?void 0:T.getGeometry())==null?void 0:v.getCoordinates();u.style.cursor="pointer",await h(E,T.getProperties()),l.setPosition(R)}else u.style.cursor="",l.setPosition(void 0)}}),y});return c&&(mt.xmMapListener({listenType:"click",removeListener:!0}),mt.xmMapListener({listenType:"click",callback:f=>{var m;const g=f.pixel,_=window.xmMap.forEachFeatureAtPixel(g,p=>p);_&&_.getGeometry()instanceof he&&((m=_==null?void 0:_.getGeometry())==null||m.getCoordinates(),l&&h&&(u.style.cursor="",l.setPosition(void 0)),c(f,_.getProperties()))}})),t&&(mt.xmMapListener({...t,removeListener:!0}),mt.xmMapListener({...t,data:d})),d},E0=i=>{let t=cu(i);return new ke({features:t})},C0=i=>{const{layerId:t,features:e,zIndex:n=3,style:s}=i,r=new ke({features:e});let o;return s?o=new Fe({source:r,zIndex:n,style:s}):o=new Fe({source:r,zIndex:n}),Ee(t,o),window.xmMap.addLayer(o),o},w0=i=>{const{data:t,distance:e}=i;let n=mt.xmPointSource({data:t,noStyle:!0});return new h0({distance:e,minDistance:100,source:n})},v0=i=>{const{layerId:t,source:e,zIndex:n=3,styleCallBack:s}=i,r=new Fe({source:e,zIndex:n,style:s});return Ee(t,r),window.xmMap.addLayer(r),r};function mi(i,t){const e=i.length;return t<0?i[t+e]:t>=e?i[t-e]:i[t]}function pi(i,t){const e=i.length;let n=Math.floor(t);const s=t-n;n>=e?n-=e:n<0&&(n+=e);let r=n+1;r>=e&&(r-=e);const o=i[n],a=o[0],l=o[1],h=i[r],c=h[0]-a,u=h[1]-l;return[a+c*s,l+u*s]}const Rr={index:-1,endIndex:NaN,closestTargetDistance:1/0};function R0(i,t,e,n){const s=i[0],r=i[1];let o=1/0,a=-1,l=NaN;for(let u=0;u<t.targets.length;++u){const d=t.targets[u],f=d.coordinates;let g=1/0,_;for(let m=0;m<f.length-1;++m){const p=f[m],y=f[m+1],C=du(s,r,p,y);C.squaredDistance<g&&(g=C.squaredDistance,_=m+C.along)}g<o&&(o=g,d.ring&&t.targetIndex===u&&(d.endIndex>d.startIndex?_<d.startIndex&&(_+=f.length):d.endIndex<d.startIndex&&_>d.startIndex&&(_-=f.length)),l=_,a=u)}const h=t.targets[a];let c=h.ring;if(t.targetIndex===a&&c){const u=pi(h.coordinates,l),d=e.getPixelFromCoordinate(u),f=e.getPixelFromCoordinate(t.startCoord);Al(d,f)>n&&(c=!1)}if(c){const u=h.coordinates,d=u.length,f=h.startIndex,g=l;if(f<g){const _=Ir(u,f,g);Ir(u,f,g-d)<_&&(l-=d)}else{const _=Ir(u,f,g);Ir(u,f,g+d)<_&&(l+=d)}}return Rr.index=a,Rr.endIndex=l,Rr.closestTargetDistance=o,Rr}function T0(i,t){const e=[];for(let n=0;n<t.length;++n){const r=t[n].getGeometry();uu(i,r,e)}return e}function uu(i,t,e){if(t instanceof Sn){Tr(i,t.getCoordinates(),!1,e);return}if(t instanceof ma){const n=t.getCoordinates();for(let s=0,r=n.length;s<r;++s)Tr(i,n[s],!1,e);return}if(t instanceof Zt){const n=t.getCoordinates();for(let s=0,r=n.length;s<r;++s)Tr(i,n[s],!0,e);return}if(t instanceof xa){const n=t.getCoordinates();for(let s=0,r=n.length;s<r;++s){const o=n[s];for(let a=0,l=o.length;a<l;++a)Tr(i,o[a],!0,e)}return}if(t instanceof Ic){const n=t.getGeometries();for(let s=0;s<n.length;++s)uu(i,n[s],e);return}}function Tr(i,t,e,n){const s=i[0],r=i[1];for(let o=0,a=t.length-1;o<a;++o){const l=t[o],h=t[o+1],c=du(s,r,l,h);if(c.squaredDistance===0){const u=o+c.along;n.push({coordinates:t,ring:e,startIndex:u,endIndex:u});return}}}function Sr(i,t){return Ie(i[0],i[1],t[0],t[1])}function Ir(i,t,e){let n,s;t<e?(n=t,s=e):(n=e,s=t);const r=Math.ceil(n),o=Math.floor(s);if(r>o){const l=pi(i,n),h=pi(i,s);return Sr(l,h)}let a=0;if(n<r){const l=pi(i,n),h=mi(i,r);a+=Sr(l,h)}if(o<s){const l=mi(i,o),h=pi(i,s);a+=Sr(l,h)}for(let l=r;l<o-1;++l){const h=mi(i,l),c=mi(i,l+1);a+=Sr(h,c)}return a}const Za={along:0,squaredDistance:0};function du(i,t,e,n){const s=e[0],r=e[1],o=n[0],a=n[1],l=o-s,h=a-r;let c=0,u=s,d=r;return(l!==0||h!==0)&&(c=rt(((i-s)*l+(t-r)*h)/(l*l+h*h),0,1),u+=l*c,d+=h*c),Za.along=c,Za.squaredDistance=Bn(Ie(i,t,u,d),10),Za}const Lr={DRAWSTART:"drawstart",DRAWEND:"drawend",DRAWABORT:"drawabort"};class Pr extends se{constructor(t,e){super(t),this.feature=e}}class S0 extends li{constructor(t){const e=t;e.stopDown||(e.stopDown=Zn),super(e),this.on,this.once,this.un,this.options_=t,this.shouldHandle_=!1,this.downPx_=null,this.downTimeout_,this.lastDragTime_,this.pointerType_,this.freehand_=!1,this.source_=t.source?t.source:null,this.features_=t.features?t.features:null,this.snapTolerance_=t.snapTolerance?t.snapTolerance:12,this.type_=t.type,this.mode_=P0(this.type_),this.stopClick_=!!t.stopClick,this.ignoreNextUpEvent_=!1,this.minPoints_=t.minPoints?t.minPoints:this.mode_==="Polygon"?3:2,this.maxPoints_=this.mode_==="Circle"?2:t.maxPoints?t.maxPoints:1/0,this.finishCondition_=t.finishCondition?t.finishCondition:$n,this.geometryLayout_=t.geometryLayout?t.geometryLayout:"XY";let n=t.geometryFunction;if(!n){const s=this.mode_;if(s==="Circle")n=(r,o,a)=>{const l=o||new dm([NaN,NaN]),h=Wt(r[0]),c=Ml(h,Wt(r[r.length-1]));return l.setCenterAndRadius(h,Math.sqrt(c),this.geometryLayout_),l};else{let r;s==="Point"?r=he:s==="LineString"?r=Sn:s==="Polygon"&&(r=Zt),n=(o,a,l)=>(a?s==="Polygon"?o[0].length?a.setCoordinates([o[0].concat([o[0][0]])],this.geometryLayout_):a.setCoordinates([],this.geometryLayout_):a.setCoordinates(o,this.geometryLayout_):a=new r(o,this.geometryLayout_),a)}}this.geometryFunction_=n,this.dragVertexDelay_=t.dragVertexDelay!==void 0?t.dragVertexDelay:500,this.finishCoordinate_=null,this.sketchFeature_=null,this.sketchPoint_=null,this.sketchCoords_=null,this.sketchLine_=null,this.sketchLineCoords_=null,this.squaredClickTolerance_=t.clickTolerance?t.clickTolerance*t.clickTolerance:36,this.overlay_=new Fe({source:new ke({useSpatialIndex:!1,wrapX:t.wrapX?t.wrapX:!1}),style:t.style?t.style:I0(),updateWhileInteracting:!0}),this.geometryName_=t.geometryName,this.condition_=t.condition?t.condition:Sa,this.freehandCondition_,t.freehand?this.freehandCondition_=_r:this.freehandCondition_=t.freehandCondition?t.freehandCondition:Ia,this.traceCondition_,this.setTrace(t.trace||!1),this.traceState_={active:!1},this.traceSource_=t.traceSource||t.source||null,this.addChangeListener(va.ACTIVE,this.updateState_)}setTrace(t){let e;t?t===!0?e=_r:e=t:e=Xm,this.traceCondition_=e}setMap(t){super.setMap(t),this.updateState_()}setFreehand(t){this.freehand_=t,this.freehand_?this.freehandCondition_=_r:this.freehandCondition_=this.options_&&this.options_.freehandCondition?this.options_.freehandCondition:Ia}getOverlay(){return this.overlay_}getFreehand(){return this.freehand_}handleEvent(t){t.originalEvent.type===z.CONTEXTMENU&&t.originalEvent.preventDefault(),this.freehand_=this.mode_!=="Point"&&this.freehandCondition_(t);let e=t.type===tt.POINTERMOVE,n=!0;return!this.freehand_&&this.lastDragTime_&&t.type===tt.POINTERDRAG&&(Date.now()-this.lastDragTime_>=this.dragVertexDelay_?(this.downPx_=t.pixel,this.shouldHandle_=!this.freehand_,e=!0):this.lastDragTime_=void 0,this.shouldHandle_&&this.downTimeout_!==void 0&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0)),this.freehand_&&t.type===tt.POINTERDRAG&&this.sketchFeature_!==null?(this.addToDrawing_(t.coordinate),n=!1):this.freehand_&&t.type===tt.POINTERDOWN?n=!1:e&&this.getPointerCount()<2?(n=t.type===tt.POINTERMOVE,n&&this.freehand_?(this.handlePointerMove_(t),this.shouldHandle_&&t.originalEvent.preventDefault()):(t.originalEvent.pointerType==="mouse"||t.type===tt.POINTERDRAG&&this.downTimeout_===void 0)&&this.handlePointerMove_(t)):t.type===tt.DBLCLICK&&(n=!1),super.handleEvent(t)&&n}handleDownEvent(t){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=t.pixel,this.finishCoordinate_||this.startDrawing_(t.coordinate),!0):this.condition_(t)?(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout(()=>{this.handlePointerMove_(new Ne(tt.POINTERMOVE,t.map,t.originalEvent,!1,t.frameState))},this.dragVertexDelay_),this.downPx_=t.pixel,!0):(this.lastDragTime_=void 0,!1)}deactivateTrace_(){this.traceState_={active:!1}}toggleTraceState_(t){if(!this.traceSource_||!this.traceCondition_(t))return;if(this.traceState_.active){this.deactivateTrace_();return}const e=this.getMap(),n=e.getCoordinateFromPixel([t.pixel[0]-this.snapTolerance_,t.pixel[1]+this.snapTolerance_]),s=e.getCoordinateFromPixel([t.pixel[0]+this.snapTolerance_,t.pixel[1]-this.snapTolerance_]),r=Rs([n,s]),o=this.traceSource_.getFeaturesInExtent(r);if(o.length===0)return;const a=T0(t.coordinate,o);a.length&&(this.traceState_={active:!0,startCoord:t.coordinate.slice(),targets:a,targetIndex:-1})}addOrRemoveTracedCoordinates_(t,e){const n=t.startIndex<=t.endIndex,s=t.startIndex<=e;n===s?n&&e>t.endIndex||!n&&e<t.endIndex?this.addTracedCoordinates_(t,t.endIndex,e):(n&&e<t.endIndex||!n&&e>t.endIndex)&&this.removeTracedCoordinates_(e,t.endIndex):(this.removeTracedCoordinates_(t.startIndex,t.endIndex),this.addTracedCoordinates_(t,t.startIndex,e))}removeTracedCoordinates_(t,e){if(t===e)return;let n=0;if(t<e){const s=Math.ceil(t);let r=Math.floor(e);r===e&&(r-=1),n=r-s+1}else{const s=Math.floor(t);let r=Math.ceil(e);r===e&&(r+=1),n=s-r+1}n>0&&this.removeLastPoints_(n)}addTracedCoordinates_(t,e,n){if(e===n)return;const s=[];if(e<n){const r=Math.ceil(e);let o=Math.floor(n);o===n&&(o-=1);for(let a=r;a<=o;++a)s.push(mi(t.coordinates,a))}else{const r=Math.floor(e);let o=Math.ceil(n);o===n&&(o+=1);for(let a=r;a>=o;--a)s.push(mi(t.coordinates,a))}s.length&&this.appendCoordinates(s)}updateTrace_(t){const e=this.traceState_;if(!e.active)return;if(e.targetIndex===-1){const a=t.map.getPixelFromCoordinate(e.startCoord);if(Al(a,t.pixel)<this.snapTolerance_)return}const n=R0(t.coordinate,e,this.getMap(),this.snapTolerance_);if(e.targetIndex!==n.index){if(e.targetIndex!==-1){const l=e.targets[e.targetIndex];this.removeTracedCoordinates_(l.startIndex,l.endIndex)}const a=e.targets[n.index];this.addTracedCoordinates_(a,a.startIndex,n.endIndex)}else{const a=e.targets[e.targetIndex];this.addOrRemoveTracedCoordinates_(a,n.endIndex)}e.targetIndex=n.index;const s=e.targets[e.targetIndex];s.endIndex=n.endIndex;const r=pi(s.coordinates,s.endIndex),o=this.getMap().getPixelFromCoordinate(r);t.coordinate=r,t.pixel=[Math.round(o[0]),Math.round(o[1])]}handleDragEvent(t){this.ignoreNextUpEvent_=!0,super.handleDragEvent(t)}handleUpEvent(t){let e=!0;if(this.getPointerCount()===0){this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0),this.handlePointerMove_(t);const n=this.traceState_.active;if(this.ignoreNextUpEvent_||this.toggleTraceState_(t),this.shouldHandle_){const s=!this.finishCoordinate_;s&&this.startDrawing_(t.coordinate),!s&&this.freehand_?this.finishDrawing():!this.freehand_&&(!s||this.mode_==="Point")&&(this.atFinish_(t.pixel,n)?this.finishCondition_(t)&&this.finishDrawing():this.addToDrawing_(t.coordinate)),e=!1}else this.freehand_&&this.abortDrawing()}return this.ignoreNextUpEvent_=!1,!e&&this.stopClick_&&t.preventDefault(),e}handlePointerMove_(t){if(this.pointerType_=t.originalEvent.pointerType,this.downPx_&&(!this.freehand_&&this.shouldHandle_||this.freehand_&&!this.shouldHandle_)){const e=this.downPx_,n=t.pixel,s=e[0]-n[0],r=e[1]-n[1],o=s*s+r*r;if(this.shouldHandle_=this.freehand_?o>this.squaredClickTolerance_:o<=this.squaredClickTolerance_,!this.shouldHandle_)return}if(!this.finishCoordinate_){this.createOrUpdateSketchPoint_(t.coordinate.slice());return}this.updateTrace_(t),this.modifyDrawing_(t.coordinate)}atFinish_(t,e){let n=!1;if(this.sketchFeature_){let s=!1,r=[this.finishCoordinate_];const o=this.mode_;if(o==="Point")n=!0;else if(o==="Circle")n=this.sketchCoords_.length===2;else if(o==="LineString")s=!e&&this.sketchCoords_.length>this.minPoints_;else if(o==="Polygon"){const a=this.sketchCoords_;s=a[0].length>this.minPoints_,r=[a[0][0],a[0][a[0].length-2]],e?r=[a[0][0]]:r=[a[0][0],a[0][a[0].length-2]]}if(s){const a=this.getMap();for(let l=0,h=r.length;l<h;l++){const c=r[l],u=a.getPixelFromCoordinate(c),d=t[0]-u[0],f=t[1]-u[1],g=this.freehand_?1:this.snapTolerance_;if(n=Math.sqrt(d*d+f*f)<=g,n){this.finishCoordinate_=c;break}}}}return n}createOrUpdateSketchPoint_(t){this.sketchPoint_?this.sketchPoint_.getGeometry().setCoordinates(t):(this.sketchPoint_=new zt(new he(t)),this.updateSketchFeatures_())}createOrUpdateCustomSketchLine_(t){this.sketchLine_||(this.sketchLine_=new zt);const e=t.getLinearRing(0);let n=this.sketchLine_.getGeometry();n?(n.setFlatCoordinates(e.getLayout(),e.getFlatCoordinates()),n.changed()):(n=new Sn(e.getFlatCoordinates(),e.getLayout()),this.sketchLine_.setGeometry(n))}startDrawing_(t){const e=this.getMap().getView().getProjection(),n=$s(this.geometryLayout_);for(;t.length<n;)t.push(0);this.finishCoordinate_=t,this.mode_==="Point"?this.sketchCoords_=t.slice():this.mode_==="Polygon"?(this.sketchCoords_=[[t.slice(),t.slice()]],this.sketchLineCoords_=this.sketchCoords_[0]):this.sketchCoords_=[t.slice(),t.slice()],this.sketchLineCoords_&&(this.sketchLine_=new zt(new Sn(this.sketchLineCoords_)));const s=this.geometryFunction_(this.sketchCoords_,void 0,e);this.sketchFeature_=new zt,this.geometryName_&&this.sketchFeature_.setGeometryName(this.geometryName_),this.sketchFeature_.setGeometry(s),this.updateSketchFeatures_(),this.dispatchEvent(new Pr(Lr.DRAWSTART,this.sketchFeature_))}modifyDrawing_(t){const e=this.getMap(),n=this.sketchFeature_.getGeometry(),s=e.getView().getProjection(),r=$s(this.geometryLayout_);let o,a;for(;t.length<r;)t.push(0);this.mode_==="Point"?a=this.sketchCoords_:this.mode_==="Polygon"?(o=this.sketchCoords_[0],a=o[o.length-1],this.atFinish_(e.getPixelFromCoordinate(t))&&(t=this.finishCoordinate_.slice())):(o=this.sketchCoords_,a=o[o.length-1]),a[0]=t[0],a[1]=t[1],this.geometryFunction_(this.sketchCoords_,n,s),this.sketchPoint_&&this.sketchPoint_.getGeometry().setCoordinates(t),n.getType()==="Polygon"&&this.mode_!=="Polygon"?this.createOrUpdateCustomSketchLine_(n):this.sketchLineCoords_&&this.sketchLine_.getGeometry().setCoordinates(this.sketchLineCoords_),this.updateSketchFeatures_()}addToDrawing_(t){const e=this.sketchFeature_.getGeometry(),n=this.getMap().getView().getProjection();let s,r;const o=this.mode_;return o==="LineString"||o==="Circle"?(this.finishCoordinate_=t.slice(),r=this.sketchCoords_,r.length>=this.maxPoints_&&(this.freehand_?r.pop():s=!0),r.push(t.slice()),this.geometryFunction_(r,e,n)):o==="Polygon"&&(r=this.sketchCoords_[0],r.length>=this.maxPoints_&&(this.freehand_?r.pop():s=!0),r.push(t.slice()),s&&(this.finishCoordinate_=r[0]),this.geometryFunction_(this.sketchCoords_,e,n)),this.createOrUpdateSketchPoint_(t.slice()),this.updateSketchFeatures_(),s?this.finishDrawing():this.sketchFeature_}removeLastPoints_(t){if(!this.sketchFeature_)return;const e=this.sketchFeature_.getGeometry(),n=this.getMap().getView().getProjection(),s=this.mode_;for(let r=0;r<t;++r){let o;if(s==="LineString"||s==="Circle"){if(o=this.sketchCoords_,o.splice(-2,1),o.length>=2){this.finishCoordinate_=o[o.length-2].slice();const a=this.finishCoordinate_.slice();o[o.length-1]=a,this.createOrUpdateSketchPoint_(a)}this.geometryFunction_(o,e,n),e.getType()==="Polygon"&&this.sketchLine_&&this.createOrUpdateCustomSketchLine_(e)}else if(s==="Polygon"){o=this.sketchCoords_[0],o.splice(-2,1);const a=this.sketchLine_.getGeometry();if(o.length>=2){const l=o[o.length-2].slice();o[o.length-1]=l,this.createOrUpdateSketchPoint_(l)}a.setCoordinates(o),this.geometryFunction_(this.sketchCoords_,e,n)}if(o.length===1){this.abortDrawing();break}}this.updateSketchFeatures_()}removeLastPoint(){this.removeLastPoints_(1)}finishDrawing(){const t=this.abortDrawing_();if(!t)return null;let e=this.sketchCoords_;const n=t.getGeometry(),s=this.getMap().getView().getProjection();return this.mode_==="LineString"?(e.pop(),this.geometryFunction_(e,n,s)):this.mode_==="Polygon"&&(e[0].pop(),this.geometryFunction_(e,n,s),e=n.getCoordinates()),this.type_==="MultiPoint"?t.setGeometry(new ya([e])):this.type_==="MultiLineString"?t.setGeometry(new ma([e])):this.type_==="MultiPolygon"&&t.setGeometry(new xa([e])),this.dispatchEvent(new Pr(Lr.DRAWEND,t)),this.features_&&this.features_.push(t),this.source_&&this.source_.addFeature(t),t}abortDrawing_(){this.finishCoordinate_=null;const t=this.sketchFeature_;return this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0),this.deactivateTrace_(),t}abortDrawing(){const t=this.abortDrawing_();t&&this.dispatchEvent(new Pr(Lr.DRAWABORT,t))}appendCoordinates(t){const e=this.mode_,n=!this.sketchFeature_;n&&this.startDrawing_(t[0]);let s;if(e==="LineString"||e==="Circle")s=this.sketchCoords_;else if(e==="Polygon")s=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[];else return;n&&s.shift(),s.pop();for(let o=0;o<t.length;o++)this.addToDrawing_(t[o]);const r=t[t.length-1];this.sketchFeature_=this.addToDrawing_(r),this.modifyDrawing_(r)}extend(t){const n=t.getGeometry();this.sketchFeature_=t,this.sketchCoords_=n.getCoordinates();const s=this.sketchCoords_[this.sketchCoords_.length-1];this.finishCoordinate_=s.slice(),this.sketchCoords_.push(s.slice()),this.sketchPoint_=new zt(new he(s)),this.updateSketchFeatures_(),this.dispatchEvent(new Pr(Lr.DRAWSTART,this.sketchFeature_))}updateSketchFeatures_(){const t=[];this.sketchFeature_&&t.push(this.sketchFeature_),this.sketchLine_&&t.push(this.sketchLine_),this.sketchPoint_&&t.push(this.sketchPoint_);const e=this.overlay_.getSource();e.clear(!0),e.addFeatures(t)}updateState_(){const t=this.getMap(),e=this.getActive();(!t||!e)&&this.abortDrawing(),this.overlay_.setMap(e?t:null)}}function I0(){const i=gg();return function(t,e){return i[t.getGeometry().getType()]}}function L0(){return function(i,t,e){const n=Rs([i[0],i[i.length-1]].map(function(r){return Wt(r)})),s=[[jn(n),Pi(n),bi(n),Ye(n),jn(n)]];return t?t.setCoordinates(s):t=new Zt(s),t}}function P0(i){switch(i){case"Point":case"MultiPoint":return"Point";case"LineString":case"MultiLineString":return"LineString";case"Polygon":case"MultiPolygon":return"Polygon";case"Circle":return"Circle";default:throw new Error("Invalid type: "+i)}}const fu=S0,gu=Symbol(),br="el",b0="is-",Pn=(i,t,e,n,s)=>{let r=`${i}-${t}`;return e&&(r+=`-${e}`),n&&(r+=`__${n}`),s&&(r+=`--${s}`),r},_u=Symbol("namespaceContextKey"),M0=i=>{const t=i||(x.getCurrentInstance()?x.inject(_u,x.ref(br)):x.ref(br));return x.computed(()=>x.unref(t)||br)},Ha=(i,t)=>{const e=M0(t);return{namespace:e,b:(_="")=>Pn(e.value,i,_,"",""),e:_=>_?Pn(e.value,i,"",_,""):"",m:_=>_?Pn(e.value,i,"","",_):"",be:(_,m)=>_&&m?Pn(e.value,i,_,m,""):"",em:(_,m)=>_&&m?Pn(e.value,i,"",_,m):"",bm:(_,m)=>_&&m?Pn(e.value,i,_,"",m):"",bem:(_,m,p)=>_&&m&&p?Pn(e.value,i,_,m,p):"",is:(_,...m)=>{const p=m.length>=1?m[0]:!0;return _&&p?`${b0}${_}`:""},cssVar:_=>{const m={};for(const p in _)_[p]&&(m[`--${e.value}-${p}`]=_[p]);return m},cssVarName:_=>`--${e.value}-${_}`,cssVarBlock:_=>{const m={};for(const p in _)_[p]&&(m[`--${e.value}-${i}-${p}`]=_[p]);return m},cssVarBlockName:_=>`--${e.value}-${i}-${_}`}};/**
1
+ var xiaominMap=function(ct,x){"use strict";var bC=Object.defineProperty;var MC=(ct,x,rt)=>x in ct?bC(ct,x,{enumerable:!0,configurable:!0,writable:!0,value:rt}):ct[x]=rt;var El=(ct,x,rt)=>(MC(ct,typeof x!="symbol"?x+"":x,rt),rt);const rt={ANIMATING:0,INTERACTING:1};function hd(i,t,e){let n,s;e=e||Re;let r=0,o=i.length,a=!1;for(;r<o;)n=r+(o-r>>1),s=+e(i[n],t),s<0?r=n+1:(o=n,a=!s);return a?r:~r}function Re(i,t){return i>t?1:i<t?-1:0}function cd(i,t){return i<t?1:i>t?-1:0}function vs(i,t,e){if(i[0]<=t)return 0;const n=i.length;if(t<=i[n-1])return n-1;if(typeof e=="function"){for(let s=1;s<n;++s){const r=i[s];if(r===t)return s;if(r<t)return e(t,i[s-1],r)>0?s-1:s}return n-1}if(e>0){for(let s=1;s<n;++s)if(i[s]<t)return s-1;return n-1}if(e<0){for(let s=1;s<n;++s)if(i[s]<=t)return s;return n-1}for(let s=1;s<n;++s){if(i[s]==t)return s;if(i[s]<t)return i[s-1]-t<t-i[s]?s-1:s}return n-1}function ud(i,t,e){for(;t<e;){const n=i[t];i[t]=i[e],i[e]=n,++t,--e}}function ne(i,t){const e=Array.isArray(t)?t:[t],n=e.length;for(let s=0;s<n;s++)i[i.length]=e[s]}function Be(i,t){const e=i.length;if(e!==t.length)return!1;for(let n=0;n<e;n++)if(i[n]!==t[n])return!1;return!0}function dd(i,t,e){const n=t||Re;return i.every(function(s,r){if(r===0)return!0;const o=n(i[r-1],s);return!(o>0||e&&o===0)})}const pt={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function Rs(i){const t=Mt();for(let e=0,n=i.length;e<n;++e)Li(t,i[e]);return t}function zn(i,t,e){return e?(e[0]=i[0]-t,e[1]=i[1]-t,e[2]=i[2]+t,e[3]=i[3]+t,e):[i[0]-t,i[1]-t,i[2]+t,i[3]+t]}function Cl(i,t){return t?(t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t):i.slice()}function hn(i,t,e){let n,s;return t<i[0]?n=i[0]-t:i[2]<t?n=t-i[2]:n=0,e<i[1]?s=i[1]-e:i[3]<e?s=e-i[3]:s=0,n*n+s*s}function cn(i,t){return Br(i,t[0],t[1])}function ge(i,t){return i[0]<=t[0]&&t[2]<=i[2]&&i[1]<=t[1]&&t[3]<=i[3]}function Br(i,t,e){return i[0]<=t&&t<=i[2]&&i[1]<=e&&e<=i[3]}function Yr(i,t){const e=i[0],n=i[1],s=i[2],r=i[3],o=t[0],a=t[1];let l=pt.UNKNOWN;return o<e?l=l|pt.LEFT:o>s&&(l=l|pt.RIGHT),a<n?l=l|pt.BELOW:a>r&&(l=l|pt.ABOVE),l===pt.UNKNOWN&&(l=pt.INTERSECTING),l}function Mt(){return[1/0,1/0,-1/0,-1/0]}function Te(i,t,e,n,s){return s?(s[0]=i,s[1]=t,s[2]=e,s[3]=n,s):[i,t,e,n]}function Ii(i){return Te(1/0,1/0,-1/0,-1/0,i)}function Wr(i,t){const e=i[0],n=i[1];return Te(e,n,e,n,t)}function Vr(i,t,e,n,s){const r=Ii(s);return vl(r,i,t,e,n)}function jn(i,t){return i[0]==t[0]&&i[2]==t[2]&&i[1]==t[1]&&i[3]==t[3]}function wl(i,t){return t[0]<i[0]&&(i[0]=t[0]),t[2]>i[2]&&(i[2]=t[2]),t[1]<i[1]&&(i[1]=t[1]),t[3]>i[3]&&(i[3]=t[3]),i}function Li(i,t){t[0]<i[0]&&(i[0]=t[0]),t[0]>i[2]&&(i[2]=t[0]),t[1]<i[1]&&(i[1]=t[1]),t[1]>i[3]&&(i[3]=t[1])}function vl(i,t,e,n,s){for(;e<n;e+=s)fd(i,t[e],t[e+1]);return i}function fd(i,t,e){i[0]=Math.min(i[0],t),i[1]=Math.min(i[1],e),i[2]=Math.max(i[2],t),i[3]=Math.max(i[3],e)}function Ur(i,t){let e;return e=t(Xn(i)),e||(e=t(Pi(i)),e)||(e=t(bi(i)),e)||(e=t(Ye(i)),e)?e:!1}function Kr(i){let t=0;return Bn(i)||(t=K(i)*ut(i)),t}function Xn(i){return[i[0],i[1]]}function Pi(i){return[i[2],i[1]]}function ie(i){return[(i[0]+i[2])/2,(i[1]+i[3])/2]}function gd(i,t){let e;if(t==="bottom-left")e=Xn(i);else if(t==="bottom-right")e=Pi(i);else if(t==="top-left")e=Ye(i);else if(t==="top-right")e=bi(i);else throw new Error("Invalid corner");return e}function Ts(i,t,e,n,s){const[r,o,a,l,h,c,u,d]=Rl(i,t,e,n);return Te(Math.min(r,a,h,u),Math.min(o,l,c,d),Math.max(r,a,h,u),Math.max(o,l,c,d),s)}function Rl(i,t,e,n){const s=t*n[0]/2,r=t*n[1]/2,o=Math.cos(e),a=Math.sin(e),l=s*o,h=s*a,c=r*o,u=r*a,d=i[0],f=i[1];return[d-l+u,f-h-c,d-l-u,f-h+c,d+l-u,f+h+c,d+l+u,f+h-c,d-l+u,f-h-c]}function ut(i){return i[3]-i[1]}function Se(i,t,e){const n=e||Mt();return Ct(i,t)?(i[0]>t[0]?n[0]=i[0]:n[0]=t[0],i[1]>t[1]?n[1]=i[1]:n[1]=t[1],i[2]<t[2]?n[2]=i[2]:n[2]=t[2],i[3]<t[3]?n[3]=i[3]:n[3]=t[3]):Ii(n),n}function Ye(i){return[i[0],i[3]]}function bi(i){return[i[2],i[3]]}function K(i){return i[2]-i[0]}function Ct(i,t){return i[0]<=t[2]&&i[2]>=t[0]&&i[1]<=t[3]&&i[3]>=t[1]}function Bn(i){return i[2]<i[0]||i[3]<i[1]}function _d(i,t){return t?(t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t):i}function md(i,t){const e=(i[2]-i[0])/2*(t-1),n=(i[3]-i[1])/2*(t-1);i[0]-=e,i[2]+=e,i[1]-=n,i[3]+=n}function pd(i,t,e){let n=!1;const s=Yr(i,t),r=Yr(i,e);if(s===pt.INTERSECTING||r===pt.INTERSECTING)n=!0;else{const o=i[0],a=i[1],l=i[2],h=i[3],c=t[0],u=t[1],d=e[0],f=e[1],g=(f-u)/(d-c);let _,m;r&pt.ABOVE&&!(s&pt.ABOVE)&&(_=d-(f-h)/g,n=_>=o&&_<=l),!n&&r&pt.RIGHT&&!(s&pt.RIGHT)&&(m=f-(d-l)*g,n=m>=a&&m<=h),!n&&r&pt.BELOW&&!(s&pt.BELOW)&&(_=d-(f-a)/g,n=_>=o&&_<=l),!n&&r&pt.LEFT&&!(s&pt.LEFT)&&(m=f-(d-o)*g,n=m>=a&&m<=h)}return n}function Tl(i,t){const e=t.getExtent(),n=ie(i);if(t.canWrapX()&&(n[0]<e[0]||n[0]>=e[2])){const s=K(e),o=Math.floor((n[0]-e[0])/s)*s;i[0]-=o,i[2]-=o}return i}function Sl(i,t,e){if(t.canWrapX()){const n=t.getExtent();if(!isFinite(i[0])||!isFinite(i[2]))return[[n[0],i[1],n[2],i[3]]];Tl(i,t);const s=K(n);if(K(i)>s&&!e)return[[n[0],i[1],n[2],i[3]]];if(i[0]<n[0])return[[i[0]+s,i[1],n[2],i[3]],[n[0],i[1],i[2],i[3]]];if(i[2]>n[2])return[[i[0],i[1],n[2],i[3]],[n[0],i[1],i[2]-s,i[3]]]}return[i]}function ot(i,t,e){return Math.min(Math.max(i,t),e)}function yd(i,t,e,n,s,r){const o=s-e,a=r-n;if(o!==0||a!==0){const l=((i-e)*o+(t-n)*a)/(o*o+a*a);l>1?(e=s,n=r):l>0&&(e+=o*l,n+=a*l)}return Ie(i,t,e,n)}function Ie(i,t,e,n){const s=e-i,r=n-t;return s*s+r*r}function xd(i){const t=i.length;for(let n=0;n<t;n++){let s=n,r=Math.abs(i[n][n]);for(let a=n+1;a<t;a++){const l=Math.abs(i[a][n]);l>r&&(r=l,s=a)}if(r===0)return null;const o=i[s];i[s]=i[n],i[n]=o;for(let a=n+1;a<t;a++){const l=-i[a][n]/i[n][n];for(let h=n;h<t+1;h++)n==h?i[a][h]=0:i[a][h]+=l*i[n][h]}}const e=new Array(t);for(let n=t-1;n>=0;n--){e[n]=i[n][t]/i[n][n];for(let s=n-1;s>=0;s--)i[s][t]-=i[s][n]*e[n]}return e}function Ss(i){return i*180/Math.PI}function _e(i){return i*Math.PI/180}function un(i,t){const e=i%t;return e*t<0?e+t:e}function Gt(i,t,e){return i+e*(t-i)}function Yn(i,t){const e=Math.pow(10,t);return Math.round(i*e)/e}function Il(i,t){return Math.round(Yn(i,t))}function Is(i,t){return Math.floor(Yn(i,t))}function We(i,t){return Math.ceil(Yn(i,t))}function $r(i,t,e){if(i>=t&&i<e)return i;const n=e-t;return((i-t)%n+n)%n+t}function Ll(i,t){const e=(""+i).split("."),n=(""+t).split(".");for(let s=0;s<Math.max(e.length,n.length);s++){const r=parseInt(e[s]||"0",10),o=parseInt(n[s]||"0",10);if(r>o)return 1;if(o>r)return-1}return 0}function Pl(i,t){return i[0]+=+t[0],i[1]+=+t[1],i}function Ls(i,t){let e=!0;for(let n=i.length-1;n>=0;--n)if(i[n]!=t[n]){e=!1;break}return e}function Zr(i,t){const e=Math.cos(t),n=Math.sin(t),s=i[0]*e-i[1]*n,r=i[1]*e+i[0]*n;return i[0]=s,i[1]=r,i}function bl(i,t){return i[0]*=t,i[1]*=t,i}function Ml(i,t){const e=i[0]-t[0],n=i[1]-t[1];return e*e+n*n}function Al(i,t){return Math.sqrt(Ml(i,t))}function Ol(i,t){if(t.canWrapX()){const e=K(t.getExtent()),n=Ed(i,t,e);n&&(i[0]-=n*e)}return i}function Ed(i,t,e){const n=t.getExtent();let s=0;return t.canWrapX()&&(i[0]<n[0]||i[0]>n[2])&&(e=e||K(n),s=Math.floor((i[0]-n[0])/e)),s}const dn=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"";dn.includes("safari")&&!dn.includes("chrom")&&(dn.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(dn));const Cd=dn.includes("webkit")&&!dn.includes("edge"),Dl=dn.includes("macintosh"),wd=typeof devicePixelRatio<"u"?devicePixelRatio:1,Bt=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,Fl=typeof Image<"u"&&Image.prototype.decode,vd=typeof createImageBitmap=="function",kl=function(){let i=!1;try{const t=Object.defineProperty({},"passive",{get:function(){i=!0}});window.addEventListener("_",null,t),window.removeEventListener("_",null,t)}catch{}return i}();function ft(i,t,e,n){let s;return e&&e.length?s=e.shift():Bt?s=new class extends OffscreenCanvas{constructor(){super(...arguments);El(this,"style",{})}}(i??300,t??150):s=document.createElement("canvas"),i&&(s.width=i),t&&(s.height=t),s.getContext("2d",n)}let Hr;function Ps(){return Hr||(Hr=ft(1,1)),Hr}function bs(i){const t=i.canvas;t.width=1,t.height=1,i.clearRect(0,0,1,1)}function Rd(i){let t=i.offsetWidth;const e=getComputedStyle(i);return t+=parseInt(e.marginLeft,10)+parseInt(e.marginRight,10),t}function Td(i){let t=i.offsetHeight;const e=getComputedStyle(i);return t+=parseInt(e.marginTop,10)+parseInt(e.marginBottom,10),t}function Nl(i,t){const e=t.parentNode;e&&e.replaceChild(i,t)}function Gl(i){for(;i.lastChild;)i.lastChild.remove()}function Sd(i,t){const e=i.childNodes;for(let n=0;;++n){const s=e[n],r=t[n];if(!s&&!r)break;if(s!==r){if(!s){i.appendChild(r);continue}if(!r){i.removeChild(s),--n;continue}i.insertBefore(r,s)}}}function zl(){return new Proxy({childNodes:[],appendChild:function(t){return this.childNodes.push(t),t},remove:function(){},removeChild:function(t){const e=this.childNodes.indexOf(t);if(e===-1)throw new Error("Node to remove was not found");return this.childNodes.splice(e,1),t},insertBefore:function(t,e){const n=this.childNodes.indexOf(e);if(n===-1)throw new Error("Reference node not found");return this.childNodes.splice(n,0,t),t},style:{}},{get(t,e,n){return e==="firstElementChild"?t.childNodes.length>0?t.childNodes[0]:null:Reflect.get(t,e,n)}})}function Ve(i){return typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas}const jl={info:1,warn:2,error:3,none:4};let Id=jl.info;function Xl(...i){Id>jl.warn||console.warn(...i)}const Mi={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class Ld{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=t.extent!==void 0?t.extent:null,this.worldExtent_=t.worldExtent!==void 0?t.worldExtent:null,this.axisOrientation_=t.axisOrientation!==void 0?t.axisOrientation:"enu",this.global_=t.global!==void 0?t.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||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 qr=Ld,Ai=6378137,Wn=Math.PI*Ai,Pd=[-Wn,-Wn,Wn,Wn],bd=[-180,-85,180,85],Ms=Ai*Math.log(Math.tan(Math.PI/2));class Vn extends qr{constructor(t){super({code:t,units:"m",extent:Pd,global:!0,worldExtent:bd,getPointResolution:function(e,n){return e/Math.cosh(n[1]/Ai)}})}}const Bl=[new Vn("EPSG:3857"),new Vn("EPSG:102100"),new Vn("EPSG:102113"),new Vn("EPSG:900913"),new Vn("http://www.opengis.net/def/crs/EPSG/0/3857"),new Vn("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Md(i,t,e,n){const s=i.length;e=e>1?e:2,n=n??e,t===void 0&&(e>2?t=i.slice():t=new Array(s));for(let r=0;r<s;r+=n){t[r]=Wn*i[r]/180;let o=Ai*Math.log(Math.tan(Math.PI*(+i[r+1]+90)/360));o>Ms?o=Ms:o<-Ms&&(o=-Ms),t[r+1]=o}return t}function Ad(i,t,e,n){const s=i.length;e=e>1?e:2,n=n??e,t===void 0&&(e>2?t=i.slice():t=new Array(s));for(let r=0;r<s;r+=n)t[r]=180*i[r]/Wn,t[r+1]=360*Math.atan(Math.exp(i[r+1]/Ai))/Math.PI-90;return t}const Od=6378137,Yl=[-180,-90,180,90],Dd=Math.PI*Od/180;class fn extends qr{constructor(t,e){super({code:t,units:"degrees",extent:Yl,axisOrientation:e,global:!0,metersPerUnit:Dd,worldExtent:Yl})}}const Wl=[new fn("CRS:84"),new fn("EPSG:4326","neu"),new fn("urn:ogc:def:crs:OGC:1.3:CRS84"),new fn("urn:ogc:def:crs:OGC:2:84"),new fn("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new fn("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new fn("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Jr={};function Fd(i){return Jr[i]||Jr[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function kd(i,t){Jr[i]=t}function Oi(i){for(const t in i)delete i[t]}function gn(i){let t;for(t in i)return!1;return!t}let Un={};function Di(i,t,e){const n=i.getCode(),s=t.getCode();n in Un||(Un[n]={}),Un[n][s]=e}function Qr(i,t){return i in Un&&t in Un[i]?Un[i][t]:null}const As=.9996,Yt=.00669438,Os=Yt*Yt,Ds=Os*Yt,_n=Yt/(1-Yt),Vl=Math.sqrt(1-Yt),Kn=(1-Vl)/(1+Vl),Ul=Kn*Kn,to=Ul*Kn,eo=to*Kn,Kl=eo*Kn,$l=1-Yt/4-3*Os/64-5*Ds/256,Nd=3*Yt/8+3*Os/32+45*Ds/1024,Gd=15*Os/256+45*Ds/1024,zd=35*Ds/3072,jd=3/2*Kn-27/32*to+269/512*Kl,Xd=21/16*Ul-55/32*eo,Bd=151/96*to-417/128*Kl,Yd=1097/512*eo,Fs=6378137;function Wd(i,t,e){const n=i-5e5,o=(e.north?t:t-1e7)/As/(Fs*$l),a=o+jd*Math.sin(2*o)+Xd*Math.sin(4*o)+Bd*Math.sin(6*o)+Yd*Math.sin(8*o),l=Math.sin(a),h=l*l,c=Math.cos(a),u=l/c,d=u*u,f=d*d,g=1-Yt*h,_=Math.sqrt(1-Yt*h),m=Fs/_,p=(1-Yt)/g,y=_n*c**2,C=y*y,E=n/(m*As),w=E*E,T=w*E,v=T*E,R=v*E,I=R*E,b=a-u/p*(w/2-v/24*(5+3*d+10*y-4*C-9*_n))+I/720*(61+90*d+298*y+45*f-252*_n-3*C);let O=(E-T/6*(1+2*d+y)+R/120*(5-2*y+28*d-3*C+8*_n+24*f))/c;return O=$r(O+_e(ql(e.number)),-Math.PI,Math.PI),[Ss(O),Ss(b)]}const Zl=-80,Hl=84,Vd=-180,Ud=180;function Kd(i,t,e){i=$r(i,Vd,Ud),t<Zl?t=Zl:t>Hl&&(t=Hl);const n=_e(t),s=Math.sin(n),r=Math.cos(n),o=s/r,a=o*o,l=a*a,h=_e(i),c=ql(e.number),u=_e(c),d=Fs/Math.sqrt(1-Yt*s**2),f=_n*r**2,g=r*$r(h-u,-Math.PI,Math.PI),_=g*g,m=_*g,p=m*g,y=p*g,C=y*g,E=Fs*($l*n-Nd*Math.sin(2*n)+Gd*Math.sin(4*n)-zd*Math.sin(6*n)),w=As*d*(g+m/6*(1-a+f)+y/120*(5-18*a+l+72*f-58*_n))+5e5;let T=As*(E+d*o*(_/2+p/24*(5-a+9*f+4*f**2)+C/720*(61-58*a+l+600*f-330*_n)));return e.north||(T+=1e7),[w,T]}function ql(i){return(i-1)*6-180+3}const $d=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function Jl(i){let t=0;for(const s of $d){const r=i.match(s);if(r){t=parseInt(r[1]);break}}if(!t)return null;let e=0,n=!1;return t>32700&&t<32761?e=t-32700:t>32600&&t<32661&&(n=!0,e=t-32600),e?{number:e,north:n}:null}function Ql(i,t){return function(e,n,s,r){const o=e.length;s=s>1?s:2,r=r??s,n||(s>2?n=e.slice():n=new Array(o));for(let a=0;a<o;a+=r){const l=e[a],h=e[a+1],c=i(l,h,t);n[a]=c[0],n[a+1]=c[1]}return n}}function Zd(i){return Jl(i)?new qr({code:i,units:"m"}):null}function Hd(i){const t=Jl(i.getCode());return t?{forward:Ql(Kd,t),inverse:Ql(Wd,t)}:null}const th=63710088e-1;function eh(i,t,e){e=e||th;const n=_e(i[1]),s=_e(t[1]),r=(s-n)/2,o=_e(t[0]-i[0])/2,a=Math.sin(r)*Math.sin(r)+Math.sin(o)*Math.sin(o)*Math.cos(n)*Math.cos(s);return 2*e*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}function qd(i,t,e,n){n=n||th;const s=_e(i[1]),r=_e(i[0]),o=t/n,a=Math.asin(Math.sin(s)*Math.cos(o)+Math.cos(s)*Math.sin(o)*Math.cos(e)),l=r+Math.atan2(Math.sin(e)*Math.sin(o)*Math.cos(s),Math.cos(o)-Math.sin(s)*Math.sin(a));return[Ss(l),Ss(a)]}const Jd=[Hd],Qd=[Zd];let no=!0;function tf(i){no=!(i===void 0?!0:i)}function io(i,t){if(t!==void 0){for(let e=0,n=i.length;e<n;++e)t[e]=i[e];t=t}else t=i.slice();return t}function so(i){kd(i.getCode(),i),Di(i,i,io)}function ef(i){i.forEach(so)}function at(i){if(typeof i!="string")return i;const t=Fd(i);if(t)return t;for(const e of Qd){const n=e(i);if(n)return n}return null}function nh(i,t,e,n){i=at(i);let s;const r=i.getPointResolutionFunc();if(r){if(s=r(t,e),n&&n!==i.getUnits()){const o=i.getMetersPerUnit();o&&(s=s*o/Mi[n])}}else{const o=i.getUnits();if(o=="degrees"&&!n||n=="degrees")s=t;else{const a=ks(i,at("EPSG:4326"));if(!a&&o!=="degrees")s=t*i.getMetersPerUnit();else{let h=[e[0]-t/2,e[1],e[0]+t/2,e[1],e[0],e[1]-t/2,e[0],e[1]+t/2];h=a(h,h,2);const c=eh(h.slice(0,2),h.slice(2,4)),u=eh(h.slice(4,6),h.slice(6,8));s=(c+u)/2}const l=n?Mi[n]:i.getMetersPerUnit();l!==void 0&&(s/=l)}}return s}function ih(i){ef(i),i.forEach(function(t){i.forEach(function(e){t!==e&&Di(t,e,io)})})}function nf(i,t,e,n){i.forEach(function(s){t.forEach(function(r){Di(s,r,e),Di(r,s,n)})})}function ro(i,t){return i?typeof i=="string"?at(i):i:at(t)}function sf(i){return function(t,e,n,s){const r=t.length;n=n!==void 0?n:2,s=s??n,e=e!==void 0?e:new Array(r);for(let o=0;o<r;o+=s){const a=i(t.slice(o,o+n)),l=a.length;for(let h=0,c=s;h<c;++h)e[o+h]=h>=l?t[o+h]:a[h]}return e}}function mn(i,t){if(i===t)return!0;const e=i.getUnits()===t.getUnits();return(i.getCode()===t.getCode()||ks(i,t)===io)&&e}function ks(i,t){const e=i.getCode(),n=t.getCode();let s=Qr(e,n);if(s)return s;let r=null,o=null;for(const l of Jd)r||(r=l(i)),o||(o=l(t));if(!r&&!o)return null;const a="EPSG:4326";if(o)if(r)s=oo(r.inverse,o.forward);else{const l=Qr(e,a);l&&(s=oo(l,o.forward))}else{const l=Qr(a,n);l&&(s=oo(r.inverse,l))}return s&&(so(i),so(t),Di(i,t,s)),s}function oo(i,t){return function(e,n,s,r){return n=i(e,n,s,r),t(n,n,s,r)}}function Fi(i,t){const e=at(i),n=at(t);return ks(e,n)}function ao(i,t,e){const n=Fi(t,e);if(!n){const s=at(t).getCode(),r=at(e).getCode();throw new Error(`No transform available between ${s} and ${r}`)}return n(i,void 0,i.length)}let rf=null;function of(){return rf}function lo(i,t){return i}function Wt(i,t){return no&&!Ls(i,[0,0])&&i[0]>=-180&&i[0]<=180&&i[1]>=-90&&i[1]<=90&&(no=!1,Xl("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),i}function ho(i,t){return i}function me(i,t){return i}function af(){ih(Bl),ih(Wl),nf(Wl,Bl,Md,Ad)}af();const Vt={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"},M={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4},co=[NaN,NaN,NaN,0];let uo;function lf(){return uo||(uo=ft(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),uo}const hf=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,cf=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,uf=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,df=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function Ns(i,t){return i.endsWith("%")?Number(i.substring(0,i.length-1))/t:Number(i)}function ki(i){throw new Error('failed to parse "'+i+'" as color')}function sh(i){if(i.toLowerCase().startsWith("rgb")){const r=i.match(cf)||i.match(hf)||i.match(uf);if(r){const o=r[4],a=100/255;return[ot(Ns(r[1],a)+.5|0,0,255),ot(Ns(r[2],a)+.5|0,0,255),ot(Ns(r[3],a)+.5|0,0,255),o!==void 0?ot(Ns(o,100),0,1):1]}ki(i)}if(i.startsWith("#")){if(df.test(i)){const r=i.substring(1),o=r.length<=4?1:2,a=[0,0,0,255];for(let l=0,h=r.length;l<h;l+=o){let c=parseInt(r.substring(l,l+o),16);o===1&&(c+=c<<4),a[l/o]=c}return a[3]=a[3]/255,a}ki(i)}const t=lf();t.fillStyle="#abcdef";let e=t.fillStyle;t.fillStyle=i,t.fillStyle===e&&(t.fillStyle="#fedcba",e=t.fillStyle,t.fillStyle=i,t.fillStyle===e&&ki(i));const n=t.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return sh(n);t.clearRect(0,0,1,1),t.fillRect(0,0,1,1);const s=Array.from(t.getImageData(0,0,1,1).data);return s[3]=Yn(s[3]/255,3),s}function Ue(i){return typeof i=="string"?i:xo(i)}const ff=1024,Ni={};let fo=0;function gf(i){if(i.length===4)return i;const t=i.slice();return t[3]=1,t}function go(i){return i>.0031308?Math.pow(i,.4166666666666667)*269.025-14.025:i*3294.6}function _o(i){return i>.2068965?Math.pow(i,3):(i-.13793103448275862)*.12841854934601665}function mo(i){return i>10.314724?Math.pow((i+14.025)/269.025,2.4):i/3294.6}function po(i){return i>.0088564?Math.pow(i,.3333333333333333):i/.12841854934601665+.13793103448275862}function rh(i){const t=mo(i[0]),e=mo(i[1]),n=mo(i[2]),s=po(t*.222488403+e*.716873169+n*.06060791),r=500*(po(t*.452247074+e*.399439023+n*.148375274)-s),o=200*(s-po(t*.016863605+e*.117638439+n*.865350722)),a=Math.atan2(o,r)*(180/Math.PI);return[116*s-16,Math.sqrt(r*r+o*o),a<0?a+360:a,i[3]]}function _f(i){const t=(i[0]+16)/116,e=i[1],n=i[2]*Math.PI/180,s=_o(t),r=_o(t+e/500*Math.cos(n)),o=_o(t-e/200*Math.sin(n)),a=go(r*3.021973625-s*1.617392459-o*.404875592),l=go(r*-.943766287+s*1.916279586+o*.027607165),h=go(r*.069407491-s*.22898585+o*1.159737864);return[ot(a+.5|0,0,255),ot(l+.5|0,0,255),ot(h+.5|0,0,255),i[3]]}function yo(i){if(i==="none")return co;if(Ni.hasOwnProperty(i))return Ni[i];if(fo>=ff){let e=0;for(const n in Ni)e++&3||(delete Ni[n],--fo)}const t=sh(i);t.length!==4&&ki(i);for(const e of t)isNaN(e)&&ki(i);return Ni[i]=t,++fo,t}function $n(i){return Array.isArray(i)?i:yo(i)}function xo(i){let t=i[0];t!=(t|0)&&(t=t+.5|0);let e=i[1];e!=(e|0)&&(e=e+.5|0);let n=i[2];n!=(n|0)&&(n=n+.5|0);const s=i[3]===void 0?1:Math.round(i[3]*1e3)/1e3;return"rgba("+t+","+e+","+n+","+s+")"}const z={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};class mf{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}const Gs=mf;function Zn(){return!0}function Hn(){return!1}function Gi(){}function oh(i){let t,e,n;return function(){const s=Array.prototype.slice.call(arguments);return(!e||this!==n||!Be(s,e))&&(n=this,e=s,t=i.apply(this,arguments)),t}}function ah(i){function t(){let e;try{e=i()}catch(n){return Promise.reject(n)}return e instanceof Promise?e:Promise.resolve(e)}return t()}class pf{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}const se=pf;class yf extends Gs{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const n=this.listeners_||(this.listeners_={}),s=n[t]||(n[t]=[]);s.includes(e)||s.push(e)}dispatchEvent(t){const e=typeof t=="string",n=e?t:t.type,s=this.listeners_&&this.listeners_[n];if(!s)return;const r=e?new se(t):t;r.target||(r.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});n in o||(o[n]=0,a[n]=0),++o[n];let l;for(let h=0,c=s.length;h<c;++h)if("handleEvent"in s[h]?l=s[h].handleEvent(r):l=s[h].call(this,r),l===!1||r.propagationStopped){l=!1;break}if(--o[n]===0){let h=a[n];for(delete a[n];h--;)this.removeEventListener(n,Gi);delete o[n]}return l}disposeInternal(){this.listeners_&&Oi(this.listeners_)}getListeners(t){return this.listeners_&&this.listeners_[t]||void 0}hasListener(t){return this.listeners_?t?t in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(t,e){if(!this.listeners_)return;const n=this.listeners_[t];if(!n)return;const s=n.indexOf(e);s!==-1&&(this.pendingRemovals_&&t in this.pendingRemovals_?(n[s]=Gi,++this.pendingRemovals_[t]):(n.splice(s,1),n.length===0&&delete this.listeners_[t]))}}const zi=yf;function $(i,t,e,n,s){if(s){const o=e;e=function(a){return i.removeEventListener(t,e),o.call(n??this,a)}}else n&&n!==i&&(e=e.bind(n));const r={target:i,type:t,listener:e};return i.addEventListener(t,e),r}function zs(i,t,e,n){return $(i,t,e,n,!0)}function it(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),Oi(i))}class Eo extends zi{constructor(t,e,n,s){super(),this.extent=t,this.pixelRatio_=n,this.resolution=e,this.state=typeof s=="function"?M.IDLE:s,this.image_=null,this.loader=typeof s=="function"?s:null}changed(){this.dispatchEvent(z.CHANGE)}getExtent(){return this.extent}getImage(){return this.image_}getPixelRatio(){return this.pixelRatio_}getResolution(){return this.resolution}getState(){return this.state}load(){if(this.state==M.IDLE&&this.loader){this.state=M.LOADING,this.changed();const t=this.getResolution(),e=Array.isArray(t)?t[0]:t;ah(()=>this.loader(this.getExtent(),e,this.getPixelRatio())).then(n=>{"image"in n&&(this.image_=n.image),"extent"in n&&(this.extent=n.extent),"resolution"in n&&(this.resolution=n.resolution),"pixelRatio"in n&&(this.pixelRatio_=n.pixelRatio),(n instanceof HTMLImageElement||vd&&n instanceof ImageBitmap||n instanceof HTMLCanvasElement||n instanceof HTMLVideoElement)&&(this.image_=n),this.state=M.LOADED}).catch(n=>{this.state=M.ERROR,console.error(n)}).finally(()=>this.changed())}}setImage(t){this.image_=t}setResolution(t){this.resolution=t}}function xf(i,t,e){const n=i;let s=!0,r=!1,o=!1;const a=[zs(n,z.LOAD,function(){o=!0,r||t()})];return n.src&&Fl?(r=!0,n.decode().then(function(){s&&t()}).catch(function(l){s&&(o?t():e())})):a.push(zs(n,z.ERROR,e)),function(){s=!1,a.forEach(it)}}function Ef(i,t){return new Promise((e,n)=>{function s(){o(),e(i)}function r(){o(),n(new Error("Image load error"))}function o(){i.removeEventListener("load",s),i.removeEventListener("error",r)}i.addEventListener("load",s),i.addEventListener("error",r),t&&(i.src=t)})}function Cf(i,t){return t&&(i.src=t),i.src&&Fl?new Promise((e,n)=>i.decode().then(()=>e(i)).catch(s=>i.complete&&i.width?e(i):n(s))):Ef(i)}class wf{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 n=this.cache_[e];!(t++&3)&&!n.hasListener()&&(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e,n){const s=Co(t,e,n);return s in this.cache_?this.cache_[s]:null}getPattern(t,e,n){const s=Co(t,e,n);return s in this.patternCache_?this.patternCache_[s]:null}set(t,e,n,s,r){const o=Co(t,e,n),a=o in this.cache_;this.cache_[o]=s,r&&(s.getImageState()===M.IDLE&&s.load(),s.getImageState()===M.LOADING?s.ready().then(()=>{this.patternCache_[o]=Ps().createPattern(s.getImage(1),"repeat")}):this.patternCache_[o]=Ps().createPattern(s.getImage(1),"repeat")),a||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function Co(i,t,e){const n=e?$n(e):"null";return t+":"+i+":"+n}const Ut=new wf;let ji=null;class lh extends zi{constructor(t,e,n,s,r){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=n,this.canvas_={},this.color_=r,this.imageState_=s===void 0?M.IDLE:s,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,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===M.LOADED){ji||(ji=ft(1,1,void 0,{willReadFrequently:!0})),ji.drawImage(this.image_,0,0);try{ji.getImageData(0,0,1,1),this.tainted_=!1}catch{ji=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(z.CHANGE)}handleImageError_(){this.imageState_=M.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=M.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],n=ft(t,e);n.fillRect(0,0,t,e),this.hitDetectionImage_=n.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===M.IDLE){this.image_||this.initializeImage_(),this.imageState_=M.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&Cf(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_!==M.LOADED)return;const e=this.image_,n=ft(Math.ceil(e.width*t),Math.ceil(e.height*t)),s=n.canvas;n.scale(t,t),n.drawImage(e,0,0),n.globalCompositeOperation="multiply",n.fillStyle=Ue(this.color_),n.fillRect(0,0,s.width/t,s.height/t),n.globalCompositeOperation="destination-in",n.drawImage(e,0,0),this.canvas_[t]=s}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(this.imageState_===M.LOADED||this.imageState_===M.ERROR)t();else{const e=()=>{(this.imageState_===M.LOADED||this.imageState_===M.ERROR)&&(this.removeEventListener(z.CHANGE,e),t())};this.addEventListener(z.CHANGE,e)}})),this.ready_}}function js(i,t,e,n,s,r){let o=t===void 0?void 0:Ut.get(t,e,s);return o||(o=new lh(i,i&&"src"in i?i.src||void 0:t,e,n,s),Ut.set(t,e,s,o,r)),r&&o&&!Ut.getPattern(t,e,s)&&Ut.set(t,e,s,o,r),o}function pe(i){return i?Array.isArray(i)?xo(i):typeof i=="object"&&"src"in i?vf(i):i:null}function vf(i){if(!i.offset||!i.size)return Ut.getPattern(i.src,"anonymous",i.color);const t=i.src+":"+i.offset,e=Ut.getPattern(t,void 0,i.color);if(e)return e;const n=Ut.get(i.src,"anonymous",null);if(n.getImageState()!==M.LOADED)return null;const s=ft(i.size[0],i.size[1]);return s.drawImage(n.getImage(1),i.offset[0],i.offset[1],i.size[0],i.size[1],0,0,i.size[0],i.size[1]),js(s.canvas,t,void 0,M.LOADED,i.color,!0),Ut.getPattern(t,void 0,i.color)}function Ke(i,t,e,n,s){s=s!==void 0?s:[];let r=0;for(let o=t;o<e;o+=n)s[r++]=i.slice(o,o+n);return s.length=r,s}function Xi(i,t,e,n,s){s=s!==void 0?s:[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];s[r++]=Ke(i,t,l,n,s[r]),t=l}return s.length=r,s}function wo(i,t,e,n,s){s=s!==void 0?s:[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];s[r++]=l.length===1&&l[0]===t?[]:Xi(i,t,l,n,s[r]),t=l[l.length-1]}return s.length=r,s}class Rf{drawCustom(t,e,n,s,r){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,n){}drawFeature(t,e,n){}drawGeometryCollection(t,e,n){}drawLineString(t,e,n){}drawMultiLineString(t,e,n){}drawMultiPoint(t,e,n){}drawMultiPolygon(t,e,n){}drawPoint(t,e,n){}drawPolygon(t,e,n){}drawText(t,e,n){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}}const hh=Rf,qn={PROPERTYCHANGE:"propertychange"};class Bi extends zi{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(z.CHANGE)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const n=t.length,s=new Array(n);for(let r=0;r<n;++r)s[r]=$(this,t[r],e);return s}return $(this,t,e)}onceInternal(t,e){let n;if(Array.isArray(t)){const s=t.length;n=new Array(s);for(let r=0;r<s;++r)n[r]=zs(this,t[r],e)}else n=zs(this,t,e);return e.ol_key=n,n}unInternal(t,e){const n=e.ol_key;if(n)ch(n);else if(Array.isArray(t))for(let s=0,r=t.length;s<r;++s)this.removeEventListener(t[s],e);else this.removeEventListener(t,e)}}Bi.prototype.on,Bi.prototype.once,Bi.prototype.un;function ch(i){if(Array.isArray(i))for(let t=0,e=i.length;t<e;++t)it(i[t]);else it(i)}function j(){throw new Error("Unimplemented abstract method.")}let Tf=0;function q(i){return i.ol_uid||(i.ol_uid=String(++Tf))}class uh extends se{constructor(t,e,n){super(t),this.key=e,this.oldValue=n}}class Sf extends Bi{constructor(t){super(),this.on,this.once,this.un,q(this),this.values_=null,t!==void 0&&this.setProperties(t)}get(t){let e;return this.values_&&this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,e){let n;n=`change:${t}`,this.hasListener(n)&&this.dispatchEvent(new uh(n,t,e)),n=qn.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new uh(n,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,n){const s=this.values_||(this.values_={});if(n)s[t]=e;else{const r=s[t];s[t]=e,r!==e&&this.notify(t,r)}}setProperties(t,e){for(const n in t)this.set(n,t[n],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const n=this.values_[t];delete this.values_[t],gn(this.values_)&&(this.values_=null),e||this.notify(t,n)}}}const Kt=Sf,Xs="ol-hidden",If="ol-selectable",Bs="ol-unselectable",vo="ol-control",dh="ol-collapsed",Lf=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z0-9]+?)\\s*$`].join(""),"i"),fh=["style","variant","weight","size","lineHeight","family"],Ro={normal:400,bold:700},To=function(i){const t=i.match(Lf);if(!t)return null;const e={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let n=0,s=fh.length;n<s;++n){const r=t[n+1];r!==void 0&&(e[fh[n]]=typeof r=="string"?r.trim():r)}return isNaN(Number(e.weight))&&e.weight in Ro&&(e.weight=Ro[e.weight]),e.families=e.family.split(/,\s?/).map(n=>n.trim().replace(/^['"]|['"]$/g,"")),e},gh="10px sans-serif",At="#000",Jn="round",Le=[],Pe=0,Qn="round",Yi=10,Wi="#000",Vi="center",Ys="middle",pn=[0,0,0,0],Ui=1,ti=new Kt;let Ki=null,_h;const So={},Pf=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function bf(i,t,e){return`${i} ${t} 16px "${e}"`}const Mf=function(){let t,e;async function n(r){await e.ready;const o=await e.load(r);if(o.length===0)return!1;const a=To(r),l=a.families[0].toLowerCase(),h=a.weight;return o.some(c=>{const u=c.family.replace(/^['"]|['"]$/g,"").toLowerCase(),d=Ro[c.weight]||c.weight;return u===l&&c.style===a.style&&d==h})}async function s(){await e.ready;let r=!0;const o=ti.getProperties(),a=Object.keys(o).filter(l=>o[l]<100);for(let l=a.length-1;l>=0;--l){const h=a[l];let c=o[h];c<100&&(await n(h)?(Oi(So),ti.set(h,100)):(c+=10,ti.set(h,c,!0),c<100&&(r=!1)))}t=void 0,r||(t=setTimeout(s,100))}return async function(r){e||(e=Bt?self.fonts:document.fonts);const o=To(r);if(!o)return;const a=o.families;let l=!1;for(const h of a){if(Pf.has(h))continue;const c=bf(o.style,o.weight,h);ti.get(c)===void 0&&(ti.set(c,0,!0),l=!0)}l&&(clearTimeout(t),t=setTimeout(s,100))}}(),Af=function(){let i;return function(t){let e=So[t];if(e==null){if(Bt){const n=To(t),s=mh(t,"Žg");e=(isNaN(Number(n.lineHeight))?1.2:Number(n.lineHeight))*(s.actualBoundingBoxAscent+s.actualBoundingBoxDescent)}else i||(i=document.createElement("div"),i.innerHTML="M",i.style.minHeight="0",i.style.maxHeight="none",i.style.height="auto",i.style.padding="0",i.style.border="none",i.style.position="absolute",i.style.display="block",i.style.left="-99999px"),i.style.font=t,document.body.appendChild(i),e=i.offsetHeight,document.body.removeChild(i);So[t]=e}return e}}();function mh(i,t){return Ki||(Ki=ft(1,1)),i!=_h&&(Ki.font=i,_h=Ki.font),Ki.measureText(t)}function ph(i,t){return mh(i,t).width}function yh(i,t,e){if(t in e)return e[t];const n=t.split(`
2
+ `).reduce((s,r)=>Math.max(s,ph(i,r)),0);return e[t]=n,n}function Of(i,t){const e=[],n=[],s=[];let r=0,o=0,a=0,l=0;for(let h=0,c=t.length;h<=c;h+=2){const u=t[h];if(u===`
3
+ `||h===c){r=Math.max(r,o),s.push(o),o=0,a+=l,l=0;continue}const d=t[h+1]||i.font,f=ph(d,u);e.push(f),o+=f;const g=Af(d);n.push(g),l=Math.max(l,g)}return{width:r,height:a,widths:e,heights:n,lineWidths:s}}function Df(i,t,e,n,s,r,o,a,l,h,c){i.save(),e!==1&&(i.globalAlpha===void 0?i.globalAlpha=u=>u.globalAlpha*=e:i.globalAlpha*=e),t&&i.transform.apply(i,t),n.contextInstructions?(i.translate(l,h),i.scale(c[0],c[1]),Ff(n,i)):c[0]<0||c[1]<0?(i.translate(l,h),i.scale(c[0],c[1]),i.drawImage(n,s,r,o,a,0,0,o,a)):i.drawImage(n,s,r,o,a,l,h,o*c[0],a*c[1]),i.restore()}function Ff(i,t){const e=i.contextInstructions;for(let n=0,s=e.length;n<s;n+=2)Array.isArray(e[n+1])?t[e[n]].apply(t,e[n+1]):t[e[n]]=e[n+1]}const $i={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},Ws=[$i.FILL],$e=[$i.STROKE],yn=[$i.BEGIN_PATH],xh=[$i.CLOSE_PATH],G=$i;class kf extends hh{constructor(t,e,n,s){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=s,this.maxLineWidth=0,this.resolution=n,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 e==1?t:t.map(function(n){return n*e})}appendFlatPointCoordinates(t,e){const n=this.getBufferedMaxExtent(),s=this.tmpCoordinate_,r=this.coordinates;let o=r.length;for(let a=0,l=t.length;a<l;a+=e)s[0]=t[a],s[1]=t[a+1],cn(n,s)&&(r[o++]=s[0],r[o++]=s[1]);return o}appendFlatLineCoordinates(t,e,n,s,r,o){const a=this.coordinates;let l=a.length;const h=this.getBufferedMaxExtent();o&&(e+=s);let c=t[e],u=t[e+1];const d=this.tmpCoordinate_;let f=!0,g,_,m;for(g=e+s;g<n;g+=s)d[0]=t[g],d[1]=t[g+1],m=Yr(h,d),m!==_?(f&&(a[l++]=c,a[l++]=u,f=!1),a[l++]=d[0],a[l++]=d[1]):m===pt.INTERSECTING?(a[l++]=d[0],a[l++]=d[1],f=!1):f=!0,c=d[0],u=d[1],_=m;return(r&&f||g===e+s)&&(a[l++]=c,a[l++]=u),l}drawCustomCoordinates_(t,e,n,s,r){for(let o=0,a=n.length;o<a;++o){const l=n[o],h=this.appendFlatLineCoordinates(t,e,l,s,!1,!1);r.push(h),e=l}return e}drawCustom(t,e,n,s,r){this.beginGeometry(t,e,r);const o=t.getType(),a=t.getStride(),l=this.coordinates.length;let h,c,u,d,f;switch(o){case"MultiPolygon":h=t.getOrientedFlatCoordinates(),d=[];const g=t.getEndss();f=0;for(let _=0,m=g.length;_<m;++_){const p=[];f=this.drawCustomCoordinates_(h,f,g[_],a,p),d.push(p)}this.instructions.push([G.CUSTOM,l,d,t,n,wo,r]),this.hitDetectionInstructions.push([G.CUSTOM,l,d,t,s||n,wo,r]);break;case"Polygon":case"MultiLineString":u=[],h=o=="Polygon"?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),f=this.drawCustomCoordinates_(h,0,t.getEnds(),a,u),this.instructions.push([G.CUSTOM,l,u,t,n,Xi,r]),this.hitDetectionInstructions.push([G.CUSTOM,l,u,t,s||n,Xi,r]);break;case"LineString":case"Circle":h=t.getFlatCoordinates(),c=this.appendFlatLineCoordinates(h,0,h.length,a,!1,!1),this.instructions.push([G.CUSTOM,l,c,t,n,Ke,r]),this.hitDetectionInstructions.push([G.CUSTOM,l,c,t,s||n,Ke,r]);break;case"MultiPoint":h=t.getFlatCoordinates(),c=this.appendFlatPointCoordinates(h,a),c>l&&(this.instructions.push([G.CUSTOM,l,c,t,n,Ke,r]),this.hitDetectionInstructions.push([G.CUSTOM,l,c,t,s||n,Ke,r]));break;case"Point":h=t.getFlatCoordinates(),this.coordinates.push(h[0],h[1]),c=this.coordinates.length,this.instructions.push([G.CUSTOM,l,c,t,n,void 0,r]),this.hitDetectionInstructions.push([G.CUSTOM,l,c,t,s||n,void 0,r]);break}this.endGeometry(e)}beginGeometry(t,e,n){this.beginGeometryInstruction1_=[G.BEGIN_GEOMETRY,e,0,t,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[G.BEGIN_GEOMETRY,e,0,t,n],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;t.reverse();let e;const n=t.length;let s,r,o=-1;for(e=0;e<n;++e)s=t[e],r=s[0],r==G.END_GEOMETRY?o=e:r==G.BEGIN_GEOMETRY&&(s[2]=e,ud(this.hitDetectionInstructions,o,e),o=-1)}fillStyleToState(t,e={}){if(t){const n=t.getColor();e.fillPatternScale=n&&typeof n=="object"&&"src"in n?this.pixelRatio:1,e.fillStyle=pe(n||At)}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){const n=t.getColor();e.strokeStyle=pe(n||Wi);const s=t.getLineCap();e.lineCap=s!==void 0?s:Jn;const r=t.getLineDash();e.lineDash=r?r.slice():Le;const o=t.getLineDashOffset();e.lineDashOffset=o||Pe;const a=t.getLineJoin();e.lineJoin=a!==void 0?a:Qn;const l=t.getWidth();e.lineWidth=l!==void 0?l:Ui;const h=t.getMiterLimit();e.miterLimit=h!==void 0?h:Yi,e.lineWidth>this.maxLineWidth&&(this.maxLineWidth=e.lineWidth,this.bufferedMaxExtent_=null)}else e.strokeStyle=void 0,e.lineCap=void 0,e.lineDash=null,e.lineDashOffset=void 0,e.lineJoin=void 0,e.lineWidth=void 0,e.miterLimit=void 0;return e}setFillStrokeStyle(t,e){const n=this.state;this.fillStyleToState(t,n),this.strokeStyleToState(e,n)}createFill(t){const e=t.fillStyle,n=[G.SET_FILL_STYLE,e];return typeof e!="string"&&n.push(t.fillPatternScale),n}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[G.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,t.lineDash?this.applyPixelRatio(t.lineDash):null,t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const n=t.fillStyle;(typeof n!="string"||t.currentFillStyle!=n)&&(this.instructions.push(e.call(this,t)),t.currentFillStyle=n)}updateStrokeStyle(t,e){const n=t.strokeStyle,s=t.lineCap,r=t.lineDash,o=t.lineDashOffset,a=t.lineJoin,l=t.lineWidth,h=t.miterLimit;(t.currentStrokeStyle!=n||t.currentLineCap!=s||r!=t.currentLineDash&&!Be(t.currentLineDash,r)||t.currentLineDashOffset!=o||t.currentLineJoin!=a||t.currentLineWidth!=l||t.currentMiterLimit!=h)&&(e.call(this,t),t.currentStrokeStyle=n,t.currentLineCap=s,t.currentLineDash=r,t.currentLineDashOffset=o,t.currentLineJoin=a,t.currentLineWidth=l,t.currentMiterLimit=h)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[G.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Cl(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;zn(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}const Zi=kf;class Nf extends Zi{constructor(t,e,n,s){super(t,e,n,s),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e,n){if(!this.image_||this.maxExtent&&!cn(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,n);const s=t.getFlatCoordinates(),r=t.getStride(),o=this.coordinates.length,a=this.appendFlatPointCoordinates(s,r);this.instructions.push([G.DRAW_IMAGE,o,a,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([G.DRAW_IMAGE,o,a,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,n){if(!this.image_)return;this.beginGeometry(t,e,n);const s=t.getFlatCoordinates(),r=[];for(let l=0,h=s.length;l<h;l+=t.getStride())(!this.maxExtent||cn(this.maxExtent,s.slice(l,l+2)))&&r.push(s[l],s[l+1]);const o=this.coordinates.length,a=this.appendFlatPointCoordinates(r,2);this.instructions.push([G.DRAW_IMAGE,o,a,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([G.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,e){const n=t.getAnchor(),s=t.getSize(),r=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=n[0],this.anchorY_=n[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=s[1],this.opacity_=t.getOpacity(),this.originX_=r[0],this.originY_=r[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=s[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}const Gf=Nf;class zf extends Zi{constructor(t,e,n,s){super(t,e,n,s)}drawFlatCoordinates_(t,e,n,s){const r=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,n,s,!1,!1),a=[G.MOVE_TO_LINE_TO,r,o];return this.instructions.push(a),this.hitDetectionInstructions.push(a),n}drawLineString(t,e,n){const s=this.state,r=s.strokeStyle,o=s.lineWidth;if(r===void 0||o===void 0)return;this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(t,e,n),this.hitDetectionInstructions.push([G.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Le,Pe],yn);const a=t.getFlatCoordinates(),l=t.getStride();this.drawFlatCoordinates_(a,0,a.length,l),this.hitDetectionInstructions.push($e),this.endGeometry(e)}drawMultiLineString(t,e,n){const s=this.state,r=s.strokeStyle,o=s.lineWidth;if(r===void 0||o===void 0)return;this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(t,e,n),this.hitDetectionInstructions.push([G.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Le,Pe],yn);const a=t.getEnds(),l=t.getFlatCoordinates(),h=t.getStride();let c=0;for(let u=0,d=a.length;u<d;++u)c=this.drawFlatCoordinates_(l,c,a[u],h);this.hitDetectionInstructions.push($e),this.endGeometry(e)}finish(){const t=this.state;return t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&this.instructions.push($e),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&(this.instructions.push($e),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(yn)}}const jf=zf;function Vs(i,t,e,n,s,r,o){const a=(e-t)/n;if(a<3){for(;t<e;t+=n)r[o++]=i[t],r[o++]=i[t+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const h=[t,e-n];let c=0;for(;h.length>0;){const u=h.pop(),d=h.pop();let f=0;const g=i[d],_=i[d+1],m=i[u],p=i[u+1];for(let y=d+n;y<u;y+=n){const C=i[y],E=i[y+1],w=yd(C,E,g,_,m,p);w>f&&(c=y,f=w)}f>s&&(l[(c-t)/n]=1,d+n<c&&h.push(d,c),c+n<u&&h.push(c,u))}for(let u=0;u<a;++u)l[u]&&(r[o++]=i[t+u*n],r[o++]=i[t+u*n+1]);return o}function Eh(i,t,e,n,s,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l];o=Vs(i,t,c,n,s,r,o),a.push(o),t=c}return o}function xn(i,t){return t*Math.round(i/t)}function Xf(i,t,e,n,s,r,o){if(t==e)return o;let a=xn(i[t],s),l=xn(i[t+1],s);t+=n,r[o++]=a,r[o++]=l;let h,c;do if(h=xn(i[t],s),c=xn(i[t+1],s),t+=n,t==e)return r[o++]=h,r[o++]=c,o;while(h==a&&c==l);for(;t<e;){const u=xn(i[t],s),d=xn(i[t+1],s);if(t+=n,u==h&&d==c)continue;const f=h-a,g=c-l,_=u-a,m=d-l;if(f*m==g*_&&(f<0&&_<f||f==_||f>0&&_>f)&&(g<0&&m<g||g==m||g>0&&m>g)){h=u,c=d;continue}r[o++]=h,r[o++]=c,a=h,l=c,h=u,c=d}return r[o++]=h,r[o++]=c,o}function Io(i,t,e,n,s,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l];o=Xf(i,t,c,n,s,r,o),a.push(o),t=c}return o}function Bf(i,t,e,n,s,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l],u=[];o=Io(i,t,c,n,s,r,o,u),a.push(u),t=c[c.length-1]}return o}class Yf extends Zi{constructor(t,e,n,s){super(t,e,n,s)}drawFlatCoordinatess_(t,e,n,s){const r=this.state,o=r.fillStyle!==void 0,a=r.strokeStyle!==void 0,l=n.length;this.instructions.push(yn),this.hitDetectionInstructions.push(yn);for(let h=0;h<l;++h){const c=n[h],u=this.coordinates.length,d=this.appendFlatLineCoordinates(t,e,c,s,!0,!a),f=[G.MOVE_TO_LINE_TO,u,d];this.instructions.push(f),this.hitDetectionInstructions.push(f),a&&(this.instructions.push(xh),this.hitDetectionInstructions.push(xh)),e=c}return o&&(this.instructions.push(Ws),this.hitDetectionInstructions.push(Ws)),a&&(this.instructions.push($e),this.hitDetectionInstructions.push($e)),e}drawCircle(t,e,n){const s=this.state,r=s.fillStyle,o=s.strokeStyle;if(r===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,n),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([G.SET_FILL_STYLE,At]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([G.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Le,Pe]);const a=t.getFlatCoordinates(),l=t.getStride(),h=this.coordinates.length;this.appendFlatLineCoordinates(a,0,a.length,l,!1,!1);const c=[G.CIRCLE,h];this.instructions.push(yn,c),this.hitDetectionInstructions.push(yn,c),s.fillStyle!==void 0&&(this.instructions.push(Ws),this.hitDetectionInstructions.push(Ws)),s.strokeStyle!==void 0&&(this.instructions.push($e),this.hitDetectionInstructions.push($e)),this.endGeometry(e)}drawPolygon(t,e,n){const s=this.state,r=s.fillStyle,o=s.strokeStyle;if(r===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,n),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([G.SET_FILL_STYLE,At]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([G.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Le,Pe]);const a=t.getEnds(),l=t.getOrientedFlatCoordinates(),h=t.getStride();this.drawFlatCoordinatess_(l,0,a,h),this.endGeometry(e)}drawMultiPolygon(t,e,n){const s=this.state,r=s.fillStyle,o=s.strokeStyle;if(r===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,n),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([G.SET_FILL_STYLE,At]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([G.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Le,Pe]);const a=t.getEndss(),l=t.getOrientedFlatCoordinates(),h=t.getStride();let c=0;for(let u=0,d=a.length;u<d;++u)c=this.drawFlatCoordinatess_(l,c,a[u],h);this.endGeometry(e)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const t=this.tolerance;if(t!==0){const e=this.coordinates;for(let n=0,s=e.length;n<s;++n)e[n]=xn(e[n],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;this.updateFillStyle(t,this.createFill),this.updateStrokeStyle(t,this.applyStroke)}}const Ch=Yf;function Wf(i,t,e,n,s){const r=[];let o=e,a=0,l=t.slice(e,2);for(;a<i&&o+s<n;){const[h,c]=l.slice(-2),u=t[o+s],d=t[o+s+1],f=Math.sqrt((u-h)*(u-h)+(d-c)*(d-c));if(a+=f,a>=i){const g=(i-a+f)/f,_=Gt(h,u,g),m=Gt(c,d,g);l.push(_,m),r.push(l),l=[_,m],a==i&&(o+=s),a=0}else if(a<i)l.push(t[o+s],t[o+s+1]),o+=s;else{const g=f-a,_=Gt(h,u,g/f),m=Gt(c,d,g/f);l.push(_,m),r.push(l),l=[_,m],a=0,o+=s}}return a>0&&r.push(l),r}function Vf(i,t,e,n,s){let r=e,o=e,a=0,l=0,h=e,c,u,d,f,g,_,m,p,y,C;for(u=e;u<n;u+=s){const E=t[u],w=t[u+1];g!==void 0&&(y=E-g,C=w-_,f=Math.sqrt(y*y+C*C),m!==void 0&&(l+=d,c=Math.acos((m*y+p*C)/(d*f)),c>i&&(l>a&&(a=l,r=h,o=u),l=0,h=u-s)),d=f,m=y,p=C),g=E,_=w}return l+=f,l>a?[h,u]:[r,o]}const Us={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class Uf extends Zi{constructor(t,e,n,s){super(t,e,n,s),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[At]={fillStyle:At},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e,n){const s=this.textFillState_,r=this.textStrokeState_,o=this.textState_;if(this.text_===""||!o||!s&&!r)return;const a=this.coordinates;let l=a.length;const h=t.getType();let c=null,u=t.getStride();if(o.placement==="line"&&(h=="LineString"||h=="MultiLineString"||h=="Polygon"||h=="MultiPolygon")){if(!Ct(this.maxExtent,t.getExtent()))return;let d;if(c=t.getFlatCoordinates(),h=="LineString")d=[c.length];else if(h=="MultiLineString")d=t.getEnds();else if(h=="Polygon")d=t.getEnds().slice(0,1);else if(h=="MultiPolygon"){const m=t.getEndss();d=[];for(let p=0,y=m.length;p<y;++p)d.push(m[p][0])}this.beginGeometry(t,e,n);const f=o.repeat,g=f?void 0:o.textAlign;let _=0;for(let m=0,p=d.length;m<p;++m){let y;f?y=Wf(f*this.resolution,c,_,d[m],u):y=[c.slice(_,d[m])];for(let C=0,E=y.length;C<E;++C){const w=y[C];let T=0,v=w.length;if(g==null){const I=Vf(o.maxAngle,w,0,w.length,2);T=I[0],v=I[1]}for(let I=T;I<v;I+=u)a.push(w[I],w[I+1]);const R=a.length;_=d[m],this.drawChars_(l,R),l=R}}this.endGeometry(e)}else{let d=o.overflow?null:[];switch(h){case"Point":case"MultiPoint":c=t.getFlatCoordinates();break;case"LineString":c=t.getFlatMidpoint();break;case"Circle":c=t.getCenter();break;case"MultiLineString":c=t.getFlatMidpoints(),u=2;break;case"Polygon":c=t.getFlatInteriorPoint(),o.overflow||d.push(c[2]/this.resolution),u=3;break;case"MultiPolygon":const E=t.getFlatInteriorPoints();c=[];for(let w=0,T=E.length;w<T;w+=3)o.overflow||d.push(E[w+2]/this.resolution),c.push(E[w],E[w+1]);if(c.length===0)return;u=2;break}const f=this.appendFlatPointCoordinates(c,u);if(f===l)return;if(d&&(f-l)/2!==c.length/u){let E=l/2;d=d.filter((w,T)=>{const v=a[(E+T)*2]===c[T*u]&&a[(E+T)*2+1]===c[T*u+1];return v||--E,v})}this.saveTextStates_();const g=o.backgroundFill?this.createFill(this.fillStyleToState(o.backgroundFill)):null,_=o.backgroundStroke?this.createStroke(this.strokeStyleToState(o.backgroundStroke)):null;this.beginGeometry(t,e,n);let m=o.padding;if(m!=pn&&(o.scale[0]<0||o.scale[1]<0)){let E=o.padding[0],w=o.padding[1],T=o.padding[2],v=o.padding[3];o.scale[0]<0&&(w=-w,v=-v),o.scale[1]<0&&(E=-E,T=-T),m=[E,w,T,v]}const p=this.pixelRatio;this.instructions.push([G.DRAW_IMAGE,l,f,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,m==pn?pn:m.map(function(E){return E*p}),g,_,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]);const y=1/p,C=g?g.slice(0):null;C&&(C[1]=At),this.hitDetectionInstructions.push([G.DRAW_IMAGE,l,f,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[y,y],NaN,this.declutterMode_,this.declutterImageWithText_,m,C,_,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?At:this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]),this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,n=this.textFillState_,s=this.strokeKey_;t&&(s in this.strokeStates||(this.strokeStates[s]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const r=this.textKey_;r in this.textStates||(this.textStates[r]={font:e.font,textAlign:e.textAlign||Vi,justify:e.justify,textBaseline:e.textBaseline||Ys,scale:e.scale});const o=this.fillKey_;n&&(o in this.fillStates||(this.fillStates[o]={fillStyle:n.fillStyle}))}drawChars_(t,e){const n=this.textStrokeState_,s=this.textState_,r=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();const l=this.pixelRatio,h=Us[s.textBaseline],c=this.textOffsetY_*l,u=this.text_,d=n?n.lineWidth*Math.abs(s.scale[0])/2:0;this.instructions.push([G.DRAW_CHARS,t,e,h,s.overflow,a,s.maxAngle,l,c,r,d*l,u,o,1,this.declutterMode_,this.textKeepUpright_]),this.hitDetectionInstructions.push([G.DRAW_CHARS,t,e,h,s.overflow,a&&At,s.maxAngle,l,c,r,d*l,u,o,1/l,this.declutterMode_,this.textKeepUpright_])}setTextStyle(t,e){let n,s,r;if(!t)this.text_="";else{const o=t.getFill();o?(s=this.textFillState_,s||(s={},this.textFillState_=s),s.fillStyle=pe(o.getColor()||At)):(s=null,this.textFillState_=s);const a=t.getStroke();if(!a)r=null,this.textStrokeState_=r;else{r=this.textStrokeState_,r||(r={},this.textStrokeState_=r);const _=a.getLineDash(),m=a.getLineDashOffset(),p=a.getWidth(),y=a.getMiterLimit();r.lineCap=a.getLineCap()||Jn,r.lineDash=_?_.slice():Le,r.lineDashOffset=m===void 0?Pe:m,r.lineJoin=a.getLineJoin()||Qn,r.lineWidth=p===void 0?Ui:p,r.miterLimit=y===void 0?Yi:y,r.strokeStyle=pe(a.getColor()||Wi)}n=this.textState_;const l=t.getFont()||gh;Mf(l);const h=t.getScaleArray();n.overflow=t.getOverflow(),n.font=l,n.maxAngle=t.getMaxAngle(),n.placement=t.getPlacement(),n.textAlign=t.getTextAlign(),n.repeat=t.getRepeat(),n.justify=t.getJustify(),n.textBaseline=t.getTextBaseline()||Ys,n.backgroundFill=t.getBackgroundFill(),n.backgroundStroke=t.getBackgroundStroke(),n.padding=t.getPadding()||pn,n.scale=h===void 0?[1,1]:h;const c=t.getOffsetX(),u=t.getOffsetY(),d=t.getRotateWithView(),f=t.getKeepUpright(),g=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=c===void 0?0:c,this.textOffsetY_=u===void 0?0:u,this.textRotateWithView_=d===void 0?!1:d,this.textKeepUpright_=f===void 0?!0:f,this.textRotation_=g===void 0?0:g,this.strokeKey_=r?(typeof r.strokeStyle=="string"?r.strokeStyle:q(r.strokeStyle))+r.lineCap+r.lineDashOffset+"|"+r.lineWidth+r.lineJoin+r.miterLimit+"["+r.lineDash.join()+"]":"",this.textKey_=n.font+n.scale+(n.textAlign||"?")+(n.repeat||"?")+(n.justify||"?")+(n.textBaseline||"?"),this.fillKey_=s&&s.fillStyle?typeof s.fillStyle=="string"?s.fillStyle:"|"+q(s.fillStyle):""}this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}const Kf={Circle:Ch,Default:Zi,Image:Gf,LineString:jf,Polygon:Ch,Text:Uf};class $f{constructor(t,e,n,s){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=s,this.resolution_=n,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const n=this.buildersByZIndex_[e];for(const s in n){const r=n[s].finish();t[e][s]=r}}return t}getBuilder(t,e){const n=t!==void 0?t.toString():"0";let s=this.buildersByZIndex_[n];s===void 0&&(s={},this.buildersByZIndex_[n]=s);let r=s[e];if(r===void 0){const o=Kf[e];r=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),s[e]=r}return r}}const Zf=$f;function Ze(i,t,e,n,s,r,o){r=r||[],o=o||2;let a=0;for(let l=t;l<e;l+=n){const h=i[l],c=i[l+1];r[a++]=s[0]*h+s[2]*c+s[4],r[a++]=s[1]*h+s[3]*c+s[5];for(let u=2;u<o;u++)r[a++]=i[l+u]}return r&&r.length!=a&&(r.length=a),r}function Lo(i,t,e,n,s,r,o){o=o||[];const a=Math.cos(s),l=Math.sin(s),h=r[0],c=r[1];let u=0;for(let d=t;d<e;d+=n){const f=i[d]-h,g=i[d+1]-c;o[u++]=h+f*a-g*l,o[u++]=c+f*l+g*a;for(let _=d+2;_<d+n;++_)o[u++]=i[_]}return o&&o.length!=u&&(o.length=u),o}function Hf(i,t,e,n,s,r,o,a){a=a||[];const l=o[0],h=o[1];let c=0;for(let u=t;u<e;u+=n){const d=i[u]-l,f=i[u+1]-h;a[c++]=l+s*d,a[c++]=h+r*f;for(let g=u+2;g<u+n;++g)a[c++]=i[g]}return a&&a.length!=c&&(a.length=c),a}function qf(i,t,e,n,s,r,o){o=o||[];let a=0;for(let l=t;l<e;l+=n){o[a++]=i[l]+s,o[a++]=i[l+1]+r;for(let h=l+2;h<l+n;++h)o[a++]=i[h]}return o&&o.length!=a&&(o.length=a),o}function J(i,t){if(!i)throw new Error(t)}new Array(6);function re(){return[1,0,0,1,0,0]}function Jf(i,t){return i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i[4]=t[4],i[5]=t[5],i}function gt(i,t){const e=t[0],n=t[1];return t[0]=i[0]*e+i[2]*n+i[4],t[1]=i[1]*e+i[3]*n+i[5],t}function ye(i,t,e,n,s,r,o,a){const l=Math.sin(r),h=Math.cos(r);return i[0]=n*h,i[1]=s*l,i[2]=-n*l,i[3]=s*h,i[4]=o*n*h-a*n*l+t,i[5]=o*s*l+a*s*h+e,i}function wh(i,t){const e=Qf(t);J(e!==0,"Transformation matrix cannot be inverted");const n=t[0],s=t[1],r=t[2],o=t[3],a=t[4],l=t[5];return i[0]=o/e,i[1]=-s/e,i[2]=-r/e,i[3]=n/e,i[4]=(r*l-o*a)/e,i[5]=-(n*l-s*a)/e,i}function Qf(i){return i[0]*i[3]-i[1]*i[2]}const tg=[1e5,1e5,1e5,1e5,2,2];function eg(i){return"matrix("+i.join(", ")+")"}function Po(i){return i.substring(7,i.length-1).split(",").map(parseFloat)}function ng(i,t){const e=Po(i),n=Po(t);for(let s=0;s<6;++s)if(Math.round((e[s]-n[s])*tg[s])!==0)return!1;return!0}function bo(i,t,e,n){let s=i[t],r=i[t+1],o=0;for(let a=t+n;a<e;a+=n){const l=i[a],h=i[a+1];o+=Math.sqrt((l-s)*(l-s)+(h-r)*(h-r)),s=l,r=h}return o}function ig(i,t,e,n,s,r,o,a,l,h,c,u,d=!0){let f=i[t],g=i[t+1],_=0,m=0,p=0,y=0;function C(){_=f,m=g,t+=n,f=i[t],g=i[t+1],y+=p,p=Math.sqrt((f-_)*(f-_)+(g-m)*(g-m))}do C();while(t<e-n&&y+p<r);let E=p===0?0:(r-y)/p;const w=Gt(_,f,E),T=Gt(m,g,E),v=t-n,R=y,I=r+a*l(h,s,c);for(;t<e-n&&y+p<I;)C();E=p===0?0:(I-y)/p;const b=Gt(_,f,E),O=Gt(m,g,E);let D=!1;if(d)if(u){const B=[w,T,b,O];Lo(B,0,4,2,u,B,B),D=B[0]>B[2]}else D=w>b;const P=Math.PI,A=[],W=v+n===t;t=v,p=0,y=R,f=i[t],g=i[t+1];let N;if(W){C(),N=Math.atan2(g-m,f-_),D&&(N+=N>0?-P:P);const B=(b+w)/2,k=(O+T)/2;return A[0]=[B,k,(I-r)/2,N,s],A}s=s.replace(/\n/g," ");for(let B=0,k=s.length;B<k;){C();let U=Math.atan2(g-m,f-_);if(D&&(U+=U>0?-P:P),N!==void 0){let dt=U-N;if(dt+=dt>P?-2*P:dt<-P?2*P:0,Math.abs(dt)>o)return null}N=U;const H=B;let nt=0;for(;B<k;++B){const dt=D?k-B-1:B,jt=a*l(h,s[dt],c);if(t+n<e&&y+p<r+nt+jt/2)break;nt+=jt}if(B===H)continue;const L=D?s.substring(k-H,k-B):s.substring(H,B);E=p===0?0:(r+nt/2-y)/p;const It=Gt(_,f,E),yt=Gt(m,g,E);A.push([It,yt,nt/2,U,L]),r+=nt}return A}class sg{constructor(){El(this,"pushMethodArgs_",(...t)=>(this.push_(t),this));this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(Ps(),{get:(t,e)=>{if(typeof Ps()[e]=="function")return this.push_(e),this.pushMethodArgs_},set:(t,e,n)=>(this.push_(e,n),!0)})}push_(...t){const e=this.instructions_,n=this.zIndex+this.offset_;e[n]||(e[n]=[]),e[n].push(...t)}pushFunction(t){this.push_(t)}getContext(){return this.context_}draw(t){this.instructions_.forEach(e=>{for(let n=0,s=e.length;n<s;++n){const r=e[n];if(typeof r=="function"){r(t);continue}const o=e[++n];if(typeof t[r]=="function")t[r](...o);else{if(typeof o=="function"){t[r]=o(t);continue}t[r]=o}}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}}const vh=sg,ei=Mt(),He=[],be=[],Me=[],qe=[];function Rh(i){return i[3].declutterBox}const Th=new RegExp("["+String.fromCharCode(1425)+"-"+String.fromCharCode(2303)+String.fromCharCode(64285)+"-"+String.fromCharCode(65023)+String.fromCharCode(65136)+"-"+String.fromCharCode(65276)+String.fromCharCode(67584)+"-"+String.fromCharCode(69631)+String.fromCharCode(124928)+"-"+String.fromCharCode(126975)+"]");function Mo(i,t){return t==="start"?t=Th.test(i)?"right":"left":t==="end"&&(t=Th.test(i)?"left":"right"),Us[t]}function rg(i,t,e){return e>0&&i.push(`
4
+ `,""),i.push(t,""),i}function og(i,t,e){return e%2===0&&(i+=t),i}class ag{constructor(t,e,n,s,r){this.overlaps=n,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=s.instructions,this.coordinates=s.coordinates,this.coordinateCache_={},this.renderedTransform_=re(),this.hitDetectionInstructions=s.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=s.fillStates||{},this.strokeStates=s.strokeStates||{},this.textStates=s.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=r?new vh:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,n,s){const r=t+e+n+s;if(this.labels_[r])return this.labels_[r];const o=s?this.strokeStates[s]:null,a=n?this.fillStates[n]:null,l=this.textStates[e],h=this.pixelRatio,c=[l.scale[0]*h,l.scale[1]*h],u=l.justify?Us[l.justify]:Mo(Array.isArray(t)?t[0]:t,l.textAlign||Vi),d=s&&o.lineWidth?o.lineWidth:0,f=Array.isArray(t)?t:String(t).split(`
5
+ `).reduce(rg,[]),{width:g,height:_,widths:m,heights:p,lineWidths:y}=Of(l,f),C=g+d,E=[],w=(C+2)*c[0],T=(_+d)*c[1],v={width:w<0?Math.floor(w):Math.ceil(w),height:T<0?Math.floor(T):Math.ceil(T),contextInstructions:E};(c[0]!=1||c[1]!=1)&&E.push("scale",c),s&&(E.push("strokeStyle",o.strokeStyle),E.push("lineWidth",d),E.push("lineCap",o.lineCap),E.push("lineJoin",o.lineJoin),E.push("miterLimit",o.miterLimit),E.push("setLineDash",[o.lineDash]),E.push("lineDashOffset",o.lineDashOffset)),n&&E.push("fillStyle",a.fillStyle),E.push("textBaseline","middle"),E.push("textAlign","center");const R=.5-u;let I=u*C+R*d;const b=[],O=[];let D=0,P=0,A=0,W=0,N;for(let B=0,k=f.length;B<k;B+=2){const U=f[B];if(U===`
6
+ `){P+=D,D=0,I=u*C+R*d,++W;continue}const H=f[B+1]||l.font;H!==N&&(s&&b.push("font",H),n&&O.push("font",H),N=H),D=Math.max(D,p[A]);const nt=[U,I+R*m[A]+u*(m[A]-y[W]),.5*(d+D)+P];I+=m[A],s&&b.push("strokeText",nt),n&&O.push("fillText",nt),++A}return Array.prototype.push.apply(E,b),Array.prototype.push.apply(E,O),this.labels_[r]=v,v}replayTextBackground_(t,e,n,s,r,o,a){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,n),t.lineTo.apply(t,s),t.lineTo.apply(t,r),t.lineTo.apply(t,e),o&&(this.alignAndScaleFill_=o[2],t.fillStyle=o[1],this.fill_(t)),a&&(this.setStrokeStyle_(t,a),t.stroke())}calculateImageOrLabelDimensions_(t,e,n,s,r,o,a,l,h,c,u,d,f,g,_,m){a*=d[0],l*=d[1];let p=n-a,y=s-l;const C=r+h>t?t-h:r,E=o+c>e?e-c:o,w=g[3]+C*d[0]+g[1],T=g[0]+E*d[1]+g[2],v=p-g[3],R=y-g[0];(_||u!==0)&&(He[0]=v,qe[0]=v,He[1]=R,be[1]=R,be[0]=v+w,Me[0]=be[0],Me[1]=R+T,qe[1]=Me[1]);let I;return u!==0?(I=ye(re(),n,s,1,1,u,-n,-s),gt(I,He),gt(I,be),gt(I,Me),gt(I,qe),Te(Math.min(He[0],be[0],Me[0],qe[0]),Math.min(He[1],be[1],Me[1],qe[1]),Math.max(He[0],be[0],Me[0],qe[0]),Math.max(He[1],be[1],Me[1],qe[1]),ei)):Te(Math.min(v,v+w),Math.min(R,R+T),Math.max(v,v+w),Math.max(R,R+T),ei),f&&(p=Math.round(p),y=Math.round(y)),{drawImageX:p,drawImageY:y,drawImageW:C,drawImageH:E,originX:h,originY:c,declutterBox:{minX:ei[0],minY:ei[1],maxX:ei[2],maxY:ei[3],value:m},canvasTransform:I,scale:d}}replayImageOrLabel_(t,e,n,s,r,o,a){const l=!!(o||a),h=s.declutterBox,c=a?a[2]*s.scale[0]/2:0;return h.minX-c<=e[0]&&h.maxX+c>=0&&h.minY-c<=e[1]&&h.maxY+c>=0&&(l&&this.replayTextBackground_(t,He,be,Me,qe,o,a),Df(t,s.canvasTransform,r,n,s.originX,s.originY,s.drawImageW,s.drawImageH,s.drawImageX,s.drawImageY,s.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const n=gt(this.renderedTransform_,[0,0]),s=512*this.pixelRatio;t.save(),t.translate(n[0]%s,n[1]%s),e!==1&&t.scale(e,e),t.rotate(this.viewRotation_)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],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,n,s){const r=this.textStates[e],o=this.createLabel(t,e,s,n),a=this.strokeStates[n],l=this.pixelRatio,h=Mo(Array.isArray(t)?t[0]:t,r.textAlign||Vi),c=Us[r.textBaseline||Ys],u=a&&a.lineWidth?a.lineWidth:0,d=o.width/l-2*r.scale[0],f=h*d+2*(.5-h)*u,g=c*o.height/l+2*(.5-c)*u;return{label:o,anchorX:f,anchorY:g}}execute_(t,e,n,s,r,o,a,l){const h=this.zIndexContext_;let c;this.pixelCoordinates_&&Be(n,this.renderedTransform_)?c=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),c=Ze(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),Jf(this.renderedTransform_,n));let u=0;const d=s.length;let f=0,g,_,m,p,y,C,E,w,T,v,R,I,b,O=0,D=0;const P=this.coordinateCache_,A=this.viewRotation_,W=Math.round(Math.atan2(-n[1],n[0])*1e12)/1e12,N={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:A},B=this.instructions!=s||this.overlaps?0:200;let k,U,H,nt;for(;u<d;){const L=s[u];switch(L[0]){case G.BEGIN_GEOMETRY:k=L[1],nt=L[3],k.getGeometry()?a!==void 0&&!Ct(a,nt.getExtent())?u=L[2]+1:++u:u=L[2],h&&(h.zIndex=L[4]);break;case G.BEGIN_PATH:O>B&&(this.fill_(t),O=0),D>B&&(t.stroke(),D=0),!O&&!D&&(t.beginPath(),y=NaN,C=NaN),++u;break;case G.CIRCLE:f=L[1];const yt=c[f],dt=c[f+1],jt=c[f+2],Lt=c[f+3],Ce=jt-yt,fe=Lt-dt,Xt=Math.sqrt(Ce*Ce+fe*fe);t.moveTo(yt+Xt,dt),t.arc(yt,dt,Xt,0,2*Math.PI,!0),++u;break;case G.CLOSE_PATH:t.closePath(),++u;break;case G.CUSTOM:f=L[1],g=L[2];const zr=L[3],gl=L[4],ys=L[5];N.geometry=zr,N.feature=k,u in P||(P[u]=[]);const kn=P[u];ys?ys(c,f,g,2,kn):(kn[0]=c[f],kn[1]=c[f+1],kn.length=2),h&&(h.zIndex=L[6]),gl(kn,N),++u;break;case G.DRAW_IMAGE:f=L[1],g=L[2],T=L[3],_=L[4],m=L[5];let Jt=L[6];const we=L[7],vi=L[8],Ri=L[9],xs=L[10];let Nn=L[11];const Ti=L[12];let Si=L[13];p=L[14]||"declutter";const xt=L[15];if(!T&&L.length>=20){v=L[19],R=L[20],I=L[21],b=L[22];const Qt=this.drawLabelWithPointPlacement_(v,R,I,b);T=Qt.label,L[3]=T;const Gn=L[23];_=(Qt.anchorX-Gn)*this.pixelRatio,L[4]=_;const te=L[24];m=(Qt.anchorY-te)*this.pixelRatio,L[5]=m,Jt=T.height,L[6]=Jt,Si=T.width,L[13]=Si}let _l;L.length>25&&(_l=L[25]);let ml,jr,Xr;L.length>17?(ml=L[16],jr=L[17],Xr=L[18]):(ml=pn,jr=null,Xr=null),xs&&W?Nn+=A:!xs&&!W&&(Nn-=A);let TC=0;for(;f<g;f+=2){if(_l&&_l[TC++]<Si/this.pixelRatio)continue;const Qt=this.calculateImageOrLabelDimensions_(T.width,T.height,c[f],c[f+1],Si,Jt,_,m,vi,Ri,Nn,Ti,r,ml,!!jr||!!Xr,k),Gn=[t,e,T,Qt,we,jr,Xr];if(l){let te,ve,ee;if(xt){const ht=g-f;if(!xt[ht]){xt[ht]={args:Gn,declutterMode:p};continue}const bt=xt[ht];te=bt.args,ve=bt.declutterMode,delete xt[ht],ee=Rh(te)}let ze,je;if(te&&(ve!=="declutter"||!l.collides(ee))&&(ze=!0),(p!=="declutter"||!l.collides(Qt.declutterBox))&&(je=!0),ve==="declutter"&&p==="declutter"){const ht=ze&&je;ze=ht,je=ht}ze&&(ve!=="none"&&l.insert(ee),this.replayImageOrLabel_.apply(this,te)),je&&(p!=="none"&&l.insert(Qt.declutterBox),this.replayImageOrLabel_.apply(this,Gn))}else this.replayImageOrLabel_.apply(this,Gn)}++u;break;case G.DRAW_CHARS:const ed=L[1],nd=L[2],pl=L[3],SC=L[4];b=L[5];const IC=L[6],id=L[7],sd=L[8];I=L[9];const yl=L[10];v=L[11],Array.isArray(v)&&(v=v.reduce(og,"")),R=L[12];const rd=[L[13],L[13]];p=L[14]||"declutter";const LC=L[15],xl=this.textStates[R],Es=xl.font,Cs=[xl.scale[0]*id,xl.scale[1]*id];let ws;Es in this.widths_?ws=this.widths_[Es]:(ws={},this.widths_[Es]=ws);const od=bo(c,ed,nd,2),ad=Math.abs(Cs[0])*yh(Es,v,ws);if(SC||ad<=od){const Qt=this.textStates[R].textAlign,Gn=(od-ad)*Mo(v,Qt),te=ig(c,ed,nd,2,v,Gn,IC,Math.abs(Cs[0]),yh,Es,ws,W?0:this.viewRotation_,LC);t:if(te){const ve=[];let ee,ze,je,ht,bt;if(I)for(ee=0,ze=te.length;ee<ze;++ee){bt=te[ee],je=bt[4],ht=this.createLabel(je,R,"",I),_=bt[2]+(Cs[0]<0?-yl:yl),m=pl*ht.height+(.5-pl)*2*yl*Cs[1]/Cs[0]-sd;const Xe=this.calculateImageOrLabelDimensions_(ht.width,ht.height,bt[0],bt[1],ht.width,ht.height,_,m,0,0,bt[3],rd,!1,pn,!1,k);if(l&&p==="declutter"&&l.collides(Xe.declutterBox))break t;ve.push([t,e,ht,Xe,1,null,null])}if(b)for(ee=0,ze=te.length;ee<ze;++ee){bt=te[ee],je=bt[4],ht=this.createLabel(je,R,b,""),_=bt[2],m=pl*ht.height-sd;const Xe=this.calculateImageOrLabelDimensions_(ht.width,ht.height,bt[0],bt[1],ht.width,ht.height,_,m,0,0,bt[3],rd,!1,pn,!1,k);if(l&&p==="declutter"&&l.collides(Xe.declutterBox))break t;ve.push([t,e,ht,Xe,1,null,null])}l&&p!=="none"&&l.load(ve.map(Rh));for(let Xe=0,PC=ve.length;Xe<PC;++Xe)this.replayImageOrLabel_.apply(this,ve[Xe])}}++u;break;case G.END_GEOMETRY:if(o!==void 0){k=L[1];const Qt=o(k,nt,p);if(Qt)return Qt}++u;break;case G.FILL:B?O++:this.fill_(t),++u;break;case G.MOVE_TO_LINE_TO:for(f=L[1],g=L[2],U=c[f],H=c[f+1],t.moveTo(U,H),y=U+.5|0,C=H+.5|0,f+=2;f<g;f+=2)U=c[f],H=c[f+1],E=U+.5|0,w=H+.5|0,(f==g-2||E!==y||w!==C)&&(t.lineTo(U,H),y=E,C=w);++u;break;case G.SET_FILL_STYLE:this.alignAndScaleFill_=L[2],O&&(this.fill_(t),O=0,D&&(t.stroke(),D=0)),t.fillStyle=L[1],++u;break;case G.SET_STROKE_STYLE:D&&(t.stroke(),D=0),this.setStrokeStyle_(t,L),++u;break;case G.STROKE:B?D++:t.stroke(),++u;break;default:++u;break}}O&&this.fill_(t),D&&t.stroke()}execute(t,e,n,s,r,o){this.viewRotation_=s,this.execute_(t,e,n,this.instructions,r,void 0,void 0,o)}executeHitDetection(t,e,n,s,r){return this.viewRotation_=n,this.execute_(t,[t.canvas.width,t.canvas.height],e,this.hitDetectionInstructions,!0,s,r)}}const lg=ag,En=["Polygon","Circle","LineString","Image","Text","Default"],Sh=["Image","Text"],hg=En.filter(i=>!Sh.includes(i));class cg{constructor(t,e,n,s,r,o,a){this.maxExtent_=t,this.overlaps_=s,this.pixelRatio_=n,this.resolution_=e,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=re(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(r,a)}clip(t,e){const n=this.getClipCoords(e);t.beginPath(),t.moveTo(n[0],n[1]),t.lineTo(n[2],n[3]),t.lineTo(n[4],n[5]),t.lineTo(n[6],n[7]),t.clip()}createExecutors_(t,e){for(const n in t){let s=this.executorsByZIndex_[n];s===void 0&&(s={},this.executorsByZIndex_[n]=s);const r=t[n];for(const o in r){const a=r[o];s[o]=new lg(this.resolution_,this.pixelRatio_,this.overlaps_,a,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const n=this.executorsByZIndex_[e];for(let s=0,r=t.length;s<r;++s)if(t[s]in n)return!0}return!1}forEachFeatureAtCoordinate(t,e,n,s,r,o){s=Math.round(s);const a=s*2+1,l=ye(this.hitDetectionTransform_,s+.5,s+.5,1/e,-1/e,-n,-t[0],-t[1]),h=!this.hitDetectionContext_;h&&(this.hitDetectionContext_=ft(a,a));const c=this.hitDetectionContext_;c.canvas.width!==a||c.canvas.height!==a?(c.canvas.width=a,c.canvas.height=a):h||c.clearRect(0,0,a,a);let u;this.renderBuffer_!==void 0&&(u=Mt(),Li(u,t),zn(u,e*(this.renderBuffer_+s),u));const d=ug(s);let f;function g(w,T,v){const R=c.getImageData(0,0,a,a).data;for(let I=0,b=d.length;I<b;I++)if(R[d[I]]>0){if(!o||v==="none"||f!=="Image"&&f!=="Text"||o.includes(w)){const O=(d[I]-3)/4,D=s-O%a,P=s-(O/a|0),A=r(w,T,D*D+P*P);if(A)return A}c.clearRect(0,0,a,a);break}}const _=Object.keys(this.executorsByZIndex_).map(Number);_.sort(Re);let m,p,y,C,E;for(m=_.length-1;m>=0;--m){const w=_[m].toString();for(y=this.executorsByZIndex_[w],p=En.length-1;p>=0;--p)if(f=En[p],C=y[f],C!==void 0&&(E=C.executeHitDetection(c,l,n,g,u),E))return E}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const n=e[0],s=e[1],r=e[2],o=e[3],a=[n,s,n,o,r,o,r,s];return Ze(a,0,8,2,t,a),a}isEmpty(){return gn(this.executorsByZIndex_)}execute(t,e,n,s,r,o,a){const l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?cd:Re),o=o||En;const h=En.length;for(let c=0,u=l.length;c<u;++c){const d=l[c].toString(),f=this.executorsByZIndex_[d];for(let g=0,_=o.length;g<_;++g){const m=o[g],p=f[m];if(p!==void 0){const y=a===null?void 0:p.getZIndexContext(),C=y?y.getContext():t,E=this.maxExtent_&&m!=="Image"&&m!=="Text";if(E&&(C.save(),this.clip(C,n)),!y||m==="Text"||m==="Image"?p.execute(C,e,n,s,r,a):y.pushFunction(w=>p.execute(w,e,n,s,r,a)),E&&C.restore(),y){y.offset();const w=l[c]*h+En.indexOf(m);this.deferredZIndexContexts_[w]||(this.deferredZIndexContexts_[w]=[]),this.deferredZIndexContexts_[w].push(y)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(Re);for(let n=0,s=e.length;n<s;++n)t[e[n]].forEach(r=>{r.draw(this.renderedContext_),r.clear()}),t[e[n]].length=0}}const Ao={};function ug(i){if(Ao[i]!==void 0)return Ao[i];const t=i*2+1,e=i*i,n=new Array(e+1);for(let r=0;r<=i;++r)for(let o=0;o<=i;++o){const a=r*r+o*o;if(a>e)break;let l=n[a];l||(l=[],n[a]=l),l.push(((i+r)*t+(i+o))*4+3),r>0&&l.push(((i-r)*t+(i+o))*4+3),o>0&&(l.push(((i+r)*t+(i-o))*4+3),r>0&&l.push(((i-r)*t+(i-o))*4+3))}const s=[];for(let r=0,o=n.length;r<o;++r)n[r]&&s.push(...n[r]);return Ao[i]=s,s}const dg=cg;function Ih(i){return i[0]>0&&i[1]>0}function fg(i,t,e){return e===void 0&&(e=[0,0]),e[0]=i[0]*t+.5|0,e[1]=i[1]*t+.5|0,e}function Ot(i,t){return Array.isArray(i)?i:(t===void 0?t=[i,i]:(t[0]=i,t[1]=i),t)}class Oo{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=Ot(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new Oo({opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return j()}getImage(t){return j()}getHitDetectionImage(){return j()}getPixelRatio(t){return 1}getImageState(){return j()}getImageSize(){return j()}getOrigin(){return j()}getSize(){return j()}setDisplacement(t){this.displacement_=t}setOpacity(t){this.opacity_=t}setRotateWithView(t){this.rotateWithView_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=Ot(t)}listenImageChange(t){j()}load(){j()}unlistenImageChange(t){j()}ready(){return Promise.resolve()}}const Lh=Oo;class Do extends Lh{constructor(t){super({opacity:1,rotateWithView:t.rotateWithView!==void 0?t.rotateWithView:!1,rotation:t.rotation!==void 0?t.rotation:0,scale:t.scale!==void 0?t.scale:1,displacement:t.displacement!==void 0?t.displacement:[0,0],declutterMode:t.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=t.fill!==void 0?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius=t.radius,this.radius2_=t.radius2,this.angle_=t.angle!==void 0?t.angle:0,this.stroke_=t.stroke!==void 0?t.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?M.LOADING:M.LOADED,this.imageState_===M.LOADING&&this.ready().then(()=>this.imageState_=M.LOADED),this.render()}clone(){const t=this.getScale(),e=new Do({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(),n=this.getScaleArray();return[t[0]/2-e[0]/n[0],t[1]/2+e[1]/n[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){var r,o;const e=(r=this.fill_)==null?void 0:r.getKey(),n=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(",");let s=(o=Ut.get(n,null,null))==null?void 0:o.getImage(1);if(!s){const a=this.renderOptions_,l=Math.ceil(a.size*t),h=ft(l,l);this.draw_(a,h,t),s=h.canvas,Ut.set(n,null,null,new lh(s,void 0,null,M.LOADED,null))}return s}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,n){if(e===0||this.points_===1/0||t!=="bevel"&&t!=="miter")return e;let s=this.radius,r=this.radius2_===void 0?s:this.radius2_;if(s<r){const T=s;s=r,r=T}const o=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/o,l=r*Math.sin(a),h=Math.sqrt(r*r-l*l),c=s-h,u=Math.sqrt(l*l+c*c),d=u/l;if(t==="miter"&&d<=n)return d*e;const f=e/2/d,g=e/2*(c/u),m=Math.sqrt((s+f)*(s+f)+g*g)-s;if(this.radius2_===void 0||t==="bevel")return m*2;const p=s*Math.sin(a),y=Math.sqrt(s*s-p*p),C=r-y,w=Math.sqrt(p*p+C*C)/p;if(w<=n){const T=w*e/2-r-s;return 2*Math.max(m,T)}return m*2}createRenderOptions(){let t=Jn,e=Qn,n=0,s=null,r=0,o,a=0;this.stroke_&&(o=pe(this.stroke_.getColor()??Wi),a=this.stroke_.getWidth()??Ui,s=this.stroke_.getLineDash(),r=this.stroke_.getLineDashOffset()??0,e=this.stroke_.getLineJoin()??Qn,t=this.stroke_.getLineCap()??Jn,n=this.stroke_.getMiterLimit()??Yi);const l=this.calculateLineJoinSize_(e,a,n),h=Math.max(this.radius,this.radius2_||0),c=Math.ceil(2*h+l);return{strokeStyle:o,strokeWidth:a,size:c,lineCap:t,lineDash:s,lineDashOffset:r,lineJoin:e,miterLimit:n}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,e,n){if(e.scale(n,n),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let s=this.fill_.getColor();s===null&&(s=At),e.fillStyle=pe(s),e.fill()}t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}createHitDetectionCanvas_(t){let e;if(this.fill_){let n=this.fill_.getColor(),s=0;typeof n=="string"&&(n=$n(n)),n===null?s=1:Array.isArray(n)&&(s=n.length===4?n[3]:1),s===0&&(e=ft(t.size,t.size),this.drawHitDetectionCanvas_(t,e))}return e?e.canvas:this.getImage(1)}createPath_(t){let e=this.points_;const n=this.radius;if(e===1/0)t.arc(0,0,n,0,2*Math.PI);else{const s=this.radius2_===void 0?n:this.radius2_;this.radius2_!==void 0&&(e*=2);const r=this.angle_-Math.PI/2,o=2*Math.PI/e;for(let a=0;a<e;a++){const l=r+a*o,h=a%2===0?n:s;t.lineTo(h*Math.cos(l),h*Math.sin(l))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle=At,e.fill(),t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}}const Ph=Do;class Fo extends Ph{constructor(t){t=t||{radius:5},super({points:1/0,fill:t.fill,radius:t.radius,stroke:t.stroke,scale:t.scale!==void 0?t.scale:1,rotation:t.rotation!==void 0?t.rotation:0,rotateWithView:t.rotateWithView!==void 0?t.rotateWithView:!1,displacement:t.displacement!==void 0?t.displacement:[0,0],declutterMode:t.declutterMode})}clone(){const t=this.getScale(),e=new Fo({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}setRadius(t){this.radius=t,this.render()}}const Ks=Fo;class ko{constructor(t){t=t||{},this.patternImage_=null,this.color_=null,t.color!==void 0&&this.setColor(t.color)}clone(){const t=this.getColor();return new ko({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(t){if(t!==null&&typeof t=="object"&&"src"in t){const e=js(null,t.src,"anonymous",void 0,t.offset?null:t.color?t.color:null,!(t.offset&&t.size));e.ready().then(()=>{this.patternImage_=null}),e.getImageState()===M.IDLE&&e.load(),e.getImageState()===M.LOADING&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?q(t):typeof t=="object"&&"src"in t?t.src+":"+t.offset:$n(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}const wt=ko;function bh(i,t,e,n){return e!==void 0&&n!==void 0?[e/i,n/t]:e!==void 0?e/i:n!==void 0?n/t:1}const No=class ld extends Lh{constructor(t){t=t||{};const e=t.opacity!==void 0?t.opacity:1,n=t.rotation!==void 0?t.rotation:0,s=t.scale!==void 0?t.scale:1,r=t.rotateWithView!==void 0?t.rotateWithView:!1;super({opacity:e,rotation:n,scale:s,displacement:t.displacement!==void 0?t.displacement:[0,0],rotateWithView:r,declutterMode:t.declutterMode}),this.anchor_=t.anchor!==void 0?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=t.anchorOrigin!==void 0?t.anchorOrigin:"top-left",this.anchorXUnits_=t.anchorXUnits!==void 0?t.anchorXUnits:"fraction",this.anchorYUnits_=t.anchorYUnits!==void 0?t.anchorYUnits:"fraction",this.crossOrigin_=t.crossOrigin!==void 0?t.crossOrigin:null;const o=t.img!==void 0?t.img:null;let a=t.src;J(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||q(o)),J(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),J(!((t.width!==void 0||t.height!==void 0)&&t.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let l;if(t.src!==void 0?l=M.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?M.LOADED:M.IDLE:l=M.LOADING:l=M.LOADED),this.color_=t.color!==void 0?$n(t.color):null,this.iconImage_=js(o,a,this.crossOrigin_,l,this.color_),this.offset_=t.offset!==void 0?t.offset:[0,0],this.offsetOrigin_=t.offsetOrigin!==void 0?t.offsetOrigin:"top-left",this.origin_=null,this.size_=t.size!==void 0?t.size:null,this.initialOptions_,t.width!==void 0||t.height!==void 0){let h,c;if(t.size)[h,c]=t.size;else{const u=this.getImage(1);if(u.width&&u.height)h=u.width,c=u.height;else if(u instanceof HTMLImageElement){this.initialOptions_=t;const d=()=>{if(this.unlistenImageChange(d),!this.initialOptions_)return;const f=this.iconImage_.getSize();this.setScale(bh(f[0],f[1],t.width,t.height))};this.listenImageChange(d);return}}h!==void 0&&this.setScale(bh(h,c,t.width,t.height))}}clone(){let t,e,n;return this.initialOptions_?(e=this.initialOptions_.width,n=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new ld({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:n,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const s=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!s)return null;t=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(t[0]*=s[0]),this.anchorYUnits_=="fraction"&&(t[1]*=s[1])}if(this.anchorOrigin_!="top-left"){if(!s)return null;t===this.anchor_&&(t=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(t[0]=-t[0]+s[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(t[1]=-t[1]+s[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),n=this.getScaleArray();return[t[0]-e[0]/n[0],t[1]+e[1]/n[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if(this.offsetOrigin_!="top-left"){const e=this.getSize(),n=this.iconImage_.getSize();if(!e||!n)return null;t=t.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(t[0]=n[0]-e[0]-t[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(t[1]=n[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(t){this.iconImage_=js(null,t,this.crossOrigin_,M.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();if(this.size_)return this.size_[0]*t[0];if(this.iconImage_.getImageState()==M.LOADED)return this.iconImage_.getSize()[0]*t[0]}getHeight(){const t=this.getScaleArray();if(this.size_)return this.size_[1]*t[1];if(this.iconImage_.getImageState()==M.LOADED)return this.iconImage_.getSize()[1]*t[1]}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(z.CHANGE,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(z.CHANGE,t)}ready(){return this.iconImage_.ready()}};class Go{constructor(t){t=t||{},this.color_=t.color!==void 0?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=t.lineDash!==void 0?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 Go({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}}const Ae=Go;class Je{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=Ah,t.geometry!==void 0&&this.setGeometry(t.geometry),this.fill_=t.fill!==void 0?t.fill:null,this.image_=t.image!==void 0?t.image:null,this.renderer_=t.renderer!==void 0?t.renderer:null,this.hitDetectionRenderer_=t.hitDetectionRenderer!==void 0?t.hitDetectionRenderer:null,this.stroke_=t.stroke!==void 0?t.stroke:null,this.text_=t.text!==void 0?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&typeof t=="object"&&(t=t.clone()),new Je({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){typeof t=="function"?this.geometryFunction_=t:typeof t=="string"?this.geometryFunction_=function(e){return e.get(t)}:t?t!==void 0&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=Ah,this.geometry_=t}setZIndex(t){this.zIndex_=t}}function gg(i){let t;if(typeof i=="function")t=i;else{let e;Array.isArray(i)?e=i:(J(typeof i.getZIndex=="function","Expected an `Style` or an array of `Style`"),e=[i]),t=function(){return e}}return t}let zo=null;function Mh(i,t){if(!zo){const e=new wt({color:"rgba(255,255,255,0.4)"}),n=new Ae({color:"#3399CC",width:1.25});zo=[new Je({image:new Ks({fill:e,stroke:n,radius:5}),fill:e,stroke:n})]}return zo}function _g(){const i={},t=[255,255,255,1],e=[0,153,255,1],n=3;return i.Polygon=[new Je({fill:new wt({color:[255,255,255,.5]})})],i.MultiPolygon=i.Polygon,i.LineString=[new Je({stroke:new Ae({color:t,width:n+2})}),new Je({stroke:new Ae({color:e,width:n})})],i.MultiLineString=i.LineString,i.Circle=i.Polygon.concat(i.LineString),i.Point=[new Je({image:new Ks({radius:n*2,fill:new wt({color:e}),stroke:new Ae({color:t,width:n/2})}),zIndex:1/0})],i.MultiPoint=i.Point,i.GeometryCollection=i.Polygon.concat(i.LineString,i.Point),i}function Ah(i){return i.getGeometry()}const $t=Je,mg="#333";class jo{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_=Ot(t.scale!==void 0?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_=t.fill!==void 0?t.fill:new wt({color:mg}),this.maxAngle_=t.maxAngle!==void 0?t.maxAngle:Math.PI/4,this.placement_=t.placement!==void 0?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=t.stroke!==void 0?t.stroke:null,this.offsetX_=t.offsetX!==void 0?t.offsetX:0,this.offsetY_=t.offsetY!==void 0?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=t.padding===void 0?null:t.padding,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new jo({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()instanceof wt?this.getFill().clone():this.getFill(),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_=Ot(t!==void 0?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}}const Oh=jo,Dh=re(),pg=[NaN,NaN];class yg extends Kt{constructor(){super(),this.extent_=Mt(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=oh((t,e,n)=>{if(!n)return this.getSimplifiedGeometry(e);const s=this.clone();return s.applyTransform(n),s.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return j()}closestPointXY(t,e,n,s){return j()}containsXY(t,e){return this.closestPointXY(t,e,pg,Number.MIN_VALUE)===0}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 j()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&Ii(e),this.extentRevision_=this.getRevision()}return _d(this.extent_,t)}rotate(t,e){j()}scale(t,e,n){j()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return j()}getType(){return j()}applyTransform(t){j()}intersectsExtent(t){return j()}translate(t,e){j()}transform(t,e){const n=at(t),s=n.getUnits()=="tile-pixels"?function(r,o,a){const l=n.getExtent(),h=n.getWorldExtent(),c=ut(h)/ut(l);ye(Dh,h[0],h[3],c,-c,0,0,0);const u=Ze(r,0,r.length,a,Dh,o),d=Fi(n,e);return d?d(u,u,a):u}:Fi(n,e);return this.applyTransform(s),this}}const Fh=yg;class xg extends Fh{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return Vr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return j()}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||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length<this.flatCoordinates.length?e:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getSimplifiedGeometryInternal(t){return this}getStride(){return this.stride}setFlatCoordinates(t,e){this.stride=$s(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){j()}setLayout(t,e,n){let s;if(t)s=$s(t);else{for(let r=0;r<n;++r){if(e.length===0){this.layout="XY",this.stride=2;return}e=e[0]}s=e.length,t=Cn(s)}this.layout=t,this.stride=s}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(t,e){const n=this.getFlatCoordinates();if(n){const s=this.getStride();Lo(n,0,n.length,s,t,e,n),this.changed()}}scale(t,e,n){e===void 0&&(e=t),n||(n=ie(this.getExtent()));const s=this.getFlatCoordinates();if(s){const r=this.getStride();Hf(s,0,s.length,r,t,e,n,s),this.changed()}}translate(t,e){const n=this.getFlatCoordinates();if(n){const s=this.getStride();qf(n,0,n.length,s,t,e,n),this.changed()}}}function Cn(i){let t;return i==2?t="XY":i==3?t="XYZ":i==4&&(t="XYZM"),t}function $s(i){let t;return i=="XY"?t=2:i=="XYZ"||i=="XYM"?t=3:i=="XYZM"&&(t=4),t}function Eg(i,t,e){const n=i.getFlatCoordinates();if(!n)return null;const s=i.getStride();return Ze(n,0,n.length,s,t,e)}const Qe=xg;class Cg extends hh{constructor(t,e,n,s,r,o,a){super(),this.context_=t,this.pixelRatio_=e,this.extent_=n,this.transform_=s,this.transformRotation_=s?Yn(Math.atan2(s[1],s[0]),10):0,this.viewRotation_=r,this.squaredTolerance_=o,this.userTransform_=a,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_=re()}drawImages_(t,e,n,s){if(!this.image_)return;const r=Ze(t,e,n,s,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.tmpLocalTransform_,l=o.globalAlpha;this.imageOpacity_!=1&&(o.globalAlpha=l*this.imageOpacity_);let h=this.imageRotation_;this.transformRotation_===0&&(h-=this.viewRotation_),this.imageRotateWithView_&&(h+=this.viewRotation_);for(let c=0,u=r.length;c<u;c+=2){const d=r[c]-this.imageAnchorX_,f=r[c+1]-this.imageAnchorY_;if(h!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){const g=d+this.imageAnchorX_,_=f+this.imageAnchorY_;ye(a,g,_,1,1,h,-g,-_),o.save(),o.transform.apply(o,a),o.translate(g,_),o.scale(this.imageScale_[0],this.imageScale_[1]),o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),o.restore()}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,d,f,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(o.globalAlpha=l)}drawText_(t,e,n,s){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const r=Ze(t,e,n,s,this.transform_,this.pixelCoordinates_),o=this.context_;let a=this.textRotation_;for(this.transformRotation_===0&&(a-=this.viewRotation_),this.textRotateWithView_&&(a+=this.viewRotation_);e<n;e+=s){const l=r[e]+this.textOffsetX_,h=r[e+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(o.save(),o.translate(l-this.textOffsetX_,h-this.textOffsetY_),o.rotate(a),o.translate(this.textOffsetX_,this.textOffsetY_),o.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&o.strokeText(this.text_,0,0),this.textFillState_&&o.fillText(this.text_,0,0),o.restore()):(this.textStrokeState_&&o.strokeText(this.text_,l,h),this.textFillState_&&o.fillText(this.text_,l,h))}}moveToLineTo_(t,e,n,s,r){const o=this.context_,a=Ze(t,e,n,s,this.transform_,this.pixelCoordinates_);o.moveTo(a[0],a[1]);let l=a.length;r&&(l-=2);for(let h=2;h<l;h+=2)o.lineTo(a[h],a[h+1]);return r&&o.closePath(),n}drawRings_(t,e,n,s){for(let r=0,o=n.length;r<o;++r)e=this.moveToLineTo_(t,e,n[r],s,!0);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ct(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=Eg(t,this.transform_,this.pixelCoordinates_),n=e[2]-e[0],s=e[3]-e[1],r=Math.sqrt(n*n+s*s),o=this.context_;o.beginPath(),o.arc(e[0],e[1],r,0,2*Math.PI),this.fillState_&&o.fill(),this.strokeState_&&o.stroke()}this.text_!==""&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.transform_=t}drawGeometry(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t);break}}drawFeature(t,e){const n=e.getGeometryFunction()(t);n&&(this.setStyle(e),this.drawGeometry(n))}drawGeometryCollection(t){const e=t.getGeometriesArray();for(let n=0,s=e.length;n<s;++n)this.drawGeometry(e[n])}drawPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),n=t.getStride();this.image_&&this.drawImages_(e,0,e.length,n),this.text_!==""&&this.drawText_(e,0,e.length,n)}drawMultiPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),n=t.getStride();this.image_&&this.drawImages_(e,0,e.length,n),this.text_!==""&&this.drawText_(e,0,e.length,n)}drawLineString(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ct(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,n=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(n,0,n.length,t.getStride(),!1),e.stroke()}if(this.text_!==""){const e=t.getFlatMidpoint();this.drawText_(e,0,2,2)}}}drawMultiLineString(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getExtent();if(Ct(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const n=this.context_,s=t.getFlatCoordinates();let r=0;const o=t.getEnds(),a=t.getStride();n.beginPath();for(let l=0,h=o.length;l<h;++l)r=this.moveToLineTo_(s,r,o[l],a,!1);n.stroke()}if(this.text_!==""){const n=t.getFlatMidpoints();this.drawText_(n,0,n.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ct(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_;e.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride()),this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(this.text_!==""){const e=t.getFlatInteriorPoint();this.drawText_(e,0,2,2)}}}drawMultiPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ct(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_,n=t.getOrientedFlatCoordinates();let s=0;const r=t.getEndss(),o=t.getStride();e.beginPath();for(let a=0,l=r.length;a<l;++a){const h=r[a];s=this.drawRings_(n,s,h,o)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(this.text_!==""){const e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){const e=this.context_,n=this.contextFillState_;n?n.fillStyle!=t.fillStyle&&(n.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){const e=this.context_,n=this.contextStrokeState_;n?(n.lineCap!=t.lineCap&&(n.lineCap=t.lineCap,e.lineCap=t.lineCap),Be(n.lineDash,t.lineDash)||e.setLineDash(n.lineDash=t.lineDash),n.lineDashOffset!=t.lineDashOffset&&(n.lineDashOffset=t.lineDashOffset,e.lineDashOffset=t.lineDashOffset),n.lineJoin!=t.lineJoin&&(n.lineJoin=t.lineJoin,e.lineJoin=t.lineJoin),n.lineWidth!=t.lineWidth&&(n.lineWidth=t.lineWidth,e.lineWidth=t.lineWidth),n.miterLimit!=t.miterLimit&&(n.miterLimit=t.miterLimit,e.miterLimit=t.miterLimit),n.strokeStyle!=t.strokeStyle&&(n.strokeStyle=t.strokeStyle,e.strokeStyle=t.strokeStyle)):(e.lineCap=t.lineCap,e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset,e.lineJoin=t.lineJoin,e.lineWidth=t.lineWidth,e.miterLimit=t.miterLimit,e.strokeStyle=t.strokeStyle,this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})}setContextTextState_(t){const e=this.context_,n=this.contextTextState_,s=t.textAlign?t.textAlign:Vi;n?(n.font!=t.font&&(n.font=t.font,e.font=t.font),n.textAlign!=s&&(n.textAlign=s,e.textAlign=s),n.textBaseline!=t.textBaseline&&(n.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=s,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:s,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(!t)this.fillState_=null;else{const n=t.getColor();this.fillState_={fillStyle:pe(n||At)}}if(!e)this.strokeState_=null;else{const n=e.getColor(),s=e.getLineCap(),r=e.getLineDash(),o=e.getLineDashOffset(),a=e.getLineJoin(),l=e.getWidth(),h=e.getMiterLimit(),c=r||Le;this.strokeState_={lineCap:s!==void 0?s:Jn,lineDash:this.pixelRatio_===1?c:c.map(u=>u*this.pixelRatio_),lineDashOffset:(o||Pe)*this.pixelRatio_,lineJoin:a!==void 0?a:Qn,lineWidth:(l!==void 0?l:Ui)*this.pixelRatio_,miterLimit:h!==void 0?h:Yi,strokeStyle:pe(n||Wi)}}}setImageStyle(t){let e;if(!t||!(e=t.getSize())){this.image_=null;return}const n=t.getPixelRatio(this.pixelRatio_),s=t.getAnchor(),r=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=s[0]*n,this.imageAnchorY_=s[1]*n,this.imageHeight_=e[1]*n,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=r[0],this.imageOriginY_=r[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const o=t.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/n,o[1]*this.pixelRatio_/n],this.imageWidth_=e[0]*n}setTextStyle(t){if(!t)this.text_="";else{const e=t.getFill();if(!e)this.textFillState_=null;else{const f=e.getColor();this.textFillState_={fillStyle:pe(f||At)}}const n=t.getStroke();if(!n)this.textStrokeState_=null;else{const f=n.getColor(),g=n.getLineCap(),_=n.getLineDash(),m=n.getLineDashOffset(),p=n.getLineJoin(),y=n.getWidth(),C=n.getMiterLimit();this.textStrokeState_={lineCap:g!==void 0?g:Jn,lineDash:_||Le,lineDashOffset:m||Pe,lineJoin:p!==void 0?p:Qn,lineWidth:y!==void 0?y:Ui,miterLimit:C!==void 0?C:Yi,strokeStyle:pe(f||Wi)}}const s=t.getFont(),r=t.getOffsetX(),o=t.getOffsetY(),a=t.getRotateWithView(),l=t.getRotation(),h=t.getScaleArray(),c=t.getText(),u=t.getTextAlign(),d=t.getTextBaseline();this.textState_={font:s!==void 0?s:gh,textAlign:u!==void 0?u:Vi,textBaseline:d!==void 0?d:Ys},this.text_=c!==void 0?Array.isArray(c)?c.reduce((f,g,_)=>f+=_%2?" ":g,""):c:"",this.textOffsetX_=r!==void 0?this.pixelRatio_*r:0,this.textOffsetY_=o!==void 0?this.pixelRatio_*o:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*h[0],this.pixelRatio_*h[1]]}}}const wg=Cg,xe=.5;function vg(i,t,e,n,s,r,o,a,l){const h=l?ho(s):s,c=i[0]*xe,u=i[1]*xe,d=ft(c,u);d.imageSmoothingEnabled=!1;const f=d.canvas,g=new wg(d,xe,s,null,o,a,l?ks(of(),l):null),_=e.length,m=Math.floor((256*256*256-1)/_),p={};for(let C=1;C<=_;++C){const E=e[C-1],w=E.getStyleFunction()||n;if(!w)continue;let T=w(E,r);if(!T)continue;Array.isArray(T)||(T=[T]);const R=(C*m).toString(16).padStart(7,"#00000");for(let I=0,b=T.length;I<b;++I){const O=T[I],D=O.getGeometryFunction()(E);if(!D||!Ct(h,D.getExtent()))continue;const P=O.clone(),A=P.getFill();A&&A.setColor(R);const W=P.getStroke();W&&(W.setColor(R),W.setLineDash(null)),P.setText(void 0);const N=O.getImage();if(N){const H=N.getImageSize();if(!H)continue;const nt=ft(H[0],H[1],void 0,{alpha:!1}),L=nt.canvas;nt.fillStyle=R,nt.fillRect(0,0,L.width,L.height),P.setImage(new No({img:L,anchor:N.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:N.getOrigin(),opacity:1,size:N.getSize(),scale:N.getScale(),rotation:N.getRotation(),rotateWithView:N.getRotateWithView()}))}const B=P.getZIndex()||0;let k=p[B];k||(k={},p[B]=k,k.Polygon=[],k.Circle=[],k.LineString=[],k.Point=[]);const U=D.getType();if(U==="GeometryCollection"){const H=D.getGeometriesArrayRecursive();for(let nt=0,L=H.length;nt<L;++nt){const It=H[nt];k[It.getType().replace("Multi","")].push(It,P)}}else k[U.replace("Multi","")].push(D,P)}}const y=Object.keys(p).map(Number).sort(Re);for(let C=0,E=y.length;C<E;++C){const w=p[y[C]];for(const T in w){const v=w[T];for(let R=0,I=v.length;R<I;R+=2){g.setStyle(v[R+1]);for(let b=0,O=t.length;b<O;++b)g.setTransform(t[b]),g.drawGeometry(v[R])}}}return d.getImageData(0,0,f.width,f.height)}function Rg(i,t,e){const n=[];if(e){const s=Math.floor(Math.round(i[0])*xe),r=Math.floor(Math.round(i[1])*xe),o=(ot(s,0,e.width-1)+ot(r,0,e.height-1)*e.width)*4,a=e.data[o],l=e.data[o+1],c=e.data[o+2]+256*(l+256*a),u=Math.floor((256*256*256-1)/t.length);c&&c%u===0&&n.push(t[c/u-1])}return n}const Tg=.5,kh={Point:Og,LineString:bg,Polygon:Fg,MultiPoint:Dg,MultiLineString:Mg,MultiPolygon:Ag,GeometryCollection:Pg,Circle:Ig};function Sg(i,t){return parseInt(q(i),10)-parseInt(q(t),10)}function Nh(i,t){const e=Gh(i,t);return e*e}function Gh(i,t){return Tg*i/t}function Ig(i,t,e,n,s){const r=e.getFill(),o=e.getStroke();if(r||o){const l=i.getBuilder(e.getZIndex(),"Circle");l.setFillStrokeStyle(r,o),l.drawCircle(t,n,s)}const a=e.getText();if(a&&a.getText()){const l=i.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,n)}}function zh(i,t,e,n,s,r,o,a){const l=[],h=e.getImage();if(h){let d=!0;const f=h.getImageState();f==M.LOADED||f==M.ERROR?d=!1:f==M.IDLE&&h.load(),d&&l.push(h.ready())}const c=e.getFill();c&&c.loading()&&l.push(c.ready());const u=l.length>0;return u&&Promise.all(l).then(()=>s(null)),Lg(i,t,e,n,r,o,a),u}function Lg(i,t,e,n,s,r,o){const a=e.getGeometryFunction()(t);if(!a)return;const l=a.simplifyTransformed(n,s);if(e.getRenderer())jh(i,l,e,t,o);else{const c=kh[l.getType()];c(i,l,e,t,o,r)}}function jh(i,t,e,n,s){if(t.getType()=="GeometryCollection"){const o=t.getGeometries();for(let a=0,l=o.length;a<l;++a)jh(i,o[a],e,n,s);return}i.getBuilder(e.getZIndex(),"Default").drawCustom(t,n,e.getRenderer(),e.getHitDetectionRenderer(),s)}function Pg(i,t,e,n,s,r){const o=t.getGeometriesArray();let a,l;for(a=0,l=o.length;a<l;++a){const h=kh[o[a].getType()];h(i,o[a],e,n,s,r)}}function bg(i,t,e,n,s){const r=e.getStroke();if(r){const a=i.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,r),a.drawLineString(t,n,s)}const o=e.getText();if(o&&o.getText()){const a=i.getBuilder(e.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,n,s)}}function Mg(i,t,e,n,s){const r=e.getStroke();if(r){const a=i.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,r),a.drawMultiLineString(t,n,s)}const o=e.getText();if(o&&o.getText()){const a=i.getBuilder(e.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,n,s)}}function Ag(i,t,e,n,s){const r=e.getFill(),o=e.getStroke();if(o||r){const l=i.getBuilder(e.getZIndex(),"Polygon");l.setFillStrokeStyle(r,o),l.drawMultiPolygon(t,n,s)}const a=e.getText();if(a&&a.getText()){const l=i.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,n,s)}}function Og(i,t,e,n,s,r){const o=e.getImage(),a=e.getText(),l=a&&a.getText(),h=r&&o&&l?{}:void 0;if(o){if(o.getImageState()!=M.LOADED)return;const c=i.getBuilder(e.getZIndex(),"Image");c.setImageStyle(o,h),c.drawPoint(t,n,s)}if(l){const c=i.getBuilder(e.getZIndex(),"Text");c.setTextStyle(a,h),c.drawText(t,n,s)}}function Dg(i,t,e,n,s,r){const o=e.getImage(),a=o&&o.getOpacity()!==0,l=e.getText(),h=l&&l.getText(),c=r&&a&&h?{}:void 0;if(a){if(o.getImageState()!=M.LOADED)return;const u=i.getBuilder(e.getZIndex(),"Image");u.setImageStyle(o,c),u.drawMultiPoint(t,n,s)}if(h){const u=i.getBuilder(e.getZIndex(),"Text");u.setTextStyle(l,c),u.drawText(t,n,s)}}function Fg(i,t,e,n,s){const r=e.getFill(),o=e.getStroke();if(r||o){const l=i.getBuilder(e.getZIndex(),"Polygon");l.setFillStrokeStyle(r,o),l.drawPolygon(t,n,s)}const a=e.getText();if(a&&a.getText()){const l=i.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,n,s)}}class kg extends se{constructor(t,e,n,s){super(t),this.inversePixelTransform=e,this.frameState=n,this.context=s}}const Xh=kg,Ng=5;class Gg extends Bi{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.staleKeys_=new Array,this.maxStaleKeys=Ng}getStaleKeys(){return this.staleKeys_}prependStaleKey(t){this.staleKeys_.unshift(t),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(t){return j()}getData(t){return null}prepareFrame(t){return j()}renderFrame(t,e){return j()}forEachFeatureAtCoordinate(t,e,n,s,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;(e.getState()===M.LOADED||e.getState()===M.ERROR)&&this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=M.LOADED&&e!=M.ERROR&&t.addEventListener(z.CHANGE,this.boundHandleImageChange_),e==M.IDLE&&(t.load(),e=t.getState()),e==M.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&t.getSourceState()==="ready"&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}}const zg=Gg,Bh=[];let ni=null;function jg(){ni=ft(1,1,void 0,{willReadFrequently:!0})}class Xg extends zg{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=re(),this.pixelTransform=re(),this.inversePixelTransform=re(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,n){ni||jg(),ni.clearRect(0,0,1,1);let s;try{ni.drawImage(t,e,n,1,1,0,0,1,1),s=ni.getImageData(0,0,1,1).data}catch{return ni=null,null}return s}getBackground(t){let n=this.getLayer().getBackground();return typeof n=="function"&&(n=n(t.viewState.resolution)),n||void 0}useContainer(t,e,n){const s=this.getLayer().getClassName();let r,o;if(t&&t.className===s&&(!n||t&&t.style.backgroundColor&&Be($n(t.style.backgroundColor),$n(n)))){const a=t.firstElementChild;Ve(a)&&(o=a.getContext("2d"))}if(o&&ng(o.canvas.style.transform,e)?(this.container=t,this.context=o,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){r=Bt?zl():document.createElement("div"),r.className=s;let a=r.style;a.position="absolute",a.width="100%",a.height="100%",o=ft();const l=o.canvas;r.appendChild(l),a=l.style,a.position="absolute",a.left="0",a.transformOrigin="top left",this.container=r,this.context=o}!this.containerReused&&n&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=n)}clipUnrotated(t,e,n){const s=Ye(n),r=bi(n),o=Pi(n),a=Xn(n);gt(e.coordinateToPixelTransform,s),gt(e.coordinateToPixelTransform,r),gt(e.coordinateToPixelTransform,o),gt(e.coordinateToPixelTransform,a);const l=this.inversePixelTransform;gt(l,s),gt(l,r),gt(l,o),gt(l,a),t.save(),t.beginPath(),t.moveTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.lineTo(Math.round(a[0]),Math.round(a[1])),t.clip()}prepareContainer(t,e){const n=t.extent,s=t.viewState.resolution,r=t.viewState.rotation,o=t.pixelRatio,a=Math.round(K(n)/s*o),l=Math.round(ut(n)/s*o);ye(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/o,1/o,r,-a/2,-l/2),wh(this.inversePixelTransform,this.pixelTransform);const h=eg(this.pixelTransform);if(this.useContainer(e,h,this.getBackground(t)),!this.containerReused){const c=this.context.canvas;c.width!=a||c.height!=l?(c.width=a,c.height=l):this.context.clearRect(0,0,a,l),h!==c.style.transform&&(c.style.transform=h)}}dispatchRenderEvent_(t,e,n){const s=this.getLayer();if(s.hasListener(t)){const r=new Xh(t,this.inversePixelTransform,n,e);s.dispatchEvent(r)}}preRender(t,e){this.frameState=e,!e.declutter&&this.dispatchRenderEvent_(Vt.PRERENDER,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(Vt.POSTRENDER,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new vh),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(Vt.PRERENDER,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(Vt.POSTRENDER,this.context,t))}getRenderTransform(t,e,n,s,r,o,a){const l=r/2,h=o/2,c=s/e,u=-c,d=-t[0]+a,f=-t[1];return ye(this.tempTransform,l,h,c,u,-n,d,f)}disposeInternal(){delete this.frameState,super.disposeInternal()}}const Xo=Xg;class Bg extends Xo{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipped_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=Mt(),this.wrappedRenderedExtent_=Mt(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(t,e,n){const s=e.extent,r=e.viewState,o=r.center,a=r.resolution,l=r.projection,h=r.rotation,c=l.getExtent(),u=this.getLayer().getSource(),d=this.getLayer().getDeclutter(),f=e.pixelRatio,g=e.viewHints,_=!(g[rt.ANIMATING]||g[rt.INTERACTING]),m=this.context,p=Math.round(K(s)/a*f),y=Math.round(ut(s)/a*f),C=u.getWrapX()&&l.canWrapX(),E=C?K(c):null,w=C?Math.ceil((s[2]-c[2])/E)+1:1;let T=C?Math.floor((s[0]-c[0])/E):0;do{let v=this.getRenderTransform(o,a,0,f,p,y,T*E);e.declutter&&(v=v.slice(0)),t.execute(m,[m.canvas.width,m.canvas.height],v,h,_,n===void 0?En:n?Sh:hg,n?d&&e.declutter[d]:void 0)}while(++T<w)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=ft(this.context.canvas.width,this.context.canvas.height,Bh))}resetDrawContext_(){if(this.opacity_!==1&&this.targetContext_){const t=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=t,bs(this.context),Bh.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(t){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,t,!0)}renderDeferredInternal(t){this.replayGroup_&&(this.replayGroup_.renderDeferred(),this.clipped_&&this.context.restore(),this.resetDrawContext_())}renderFrame(t,e){const n=t.layerStatesArray[t.layerIndex];this.opacity_=n.opacity;const s=t.viewState;this.prepareContainer(t,e);const r=this.context,o=this.replayGroup_;let a=o&&!o.isEmpty();if(!a&&!(this.getLayer().hasListener(Vt.PRERENDER)||this.getLayer().hasListener(Vt.POSTRENDER)))return this.container;if(this.setDrawContext_(),this.preRender(r,t),s.projection,this.clipped_=!1,a&&n.extent&&this.clipping){const l=me(n.extent);a=Ct(l,t.extent),this.clipped_=a&&!ge(l,t.extent),this.clipped_&&this.clipUnrotated(r,t,l)}return a&&this.renderWorlds(o,t,this.getLayer().getDeclutter()?!1:void 0),!t.declutter&&this.clipped_&&r.restore(),this.postRender(r,t),this.renderedRotation_!==s.rotation&&(this.renderedRotation_=s.rotation,this.hitDetectionImageData_=null),t.declutter||this.resetDrawContext_(),this.container}getFeatures(t){return new Promise(e=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const n=this.frameState.size.slice(),s=this.renderedCenter_,r=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,h=this.getLayer(),c=[],u=n[0]*xe,d=n[1]*xe;c.push(this.getRenderTransform(s,r,o,xe,u,d,0).slice());const f=h.getSource(),g=a.getExtent();if(f.getWrapX()&&a.canWrapX()&&!ge(g,l)){let _=l[0];const m=K(g);let p=0,y;for(;_<g[0];)--p,y=m*p,c.push(this.getRenderTransform(s,r,o,xe,u,d,y).slice()),_+=m;for(p=0,_=l[2];_>g[2];)++p,y=m*p,c.push(this.getRenderTransform(s,r,o,xe,u,d,y).slice()),_-=m}this.hitDetectionImageData_=vg(n,c,this.renderedFeatures_,h.getStyleFunction(),l,r,o,Nh(r,this.renderedPixelRatio_),null)}e(Rg(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,n,s,r){var d,f;if(!this.replayGroup_)return;const o=e.viewState.resolution,a=e.viewState.rotation,l=this.getLayer(),h={},c=function(g,_,m){const p=q(g),y=h[p];if(y){if(y!==!0&&m<y.distanceSq){if(m===0)return h[p]=!0,r.splice(r.lastIndexOf(y),1),s(g,l,_);y.geometry=_,y.distanceSq=m}}else{if(m===0)return h[p]=!0,s(g,l,_);r.push(h[p]={feature:g,layer:l,geometry:_,distanceSq:m,callback:s})}},u=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,o,a,n,c,u?(f=(d=e.declutter)==null?void 0:d[u])==null?void 0:f.all().map(g=>g.value):null)}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),n=e.getSource();if(!n)return!1;const s=t.viewHints[rt.ANIMATING],r=t.viewHints[rt.INTERACTING],o=e.getUpdateWhileAnimating(),a=e.getUpdateWhileInteracting();if(this.ready&&!o&&s||!a&&r)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const l=t.extent,h=t.viewState,c=h.projection,u=h.resolution,d=t.pixelRatio,f=e.getRevision(),g=e.getRenderBuffer();let _=e.getRenderOrder();_===void 0&&(_=Sg);const m=h.center.slice(),p=zn(l,g*u),y=p.slice(),C=[p.slice()],E=c.getExtent();if(n.getWrapX()&&c.canWrapX()&&!ge(E,t.extent)){const A=K(E),W=Math.max(K(p)/2,A);p[0]=E[0]-W,p[2]=E[2]+W,Ol(m,c);const N=Tl(C[0],c);N[0]<E[0]&&N[2]<E[2]?C.push([N[0]+A,N[1],N[2]+A,N[3]]):N[0]>E[0]&&N[2]>E[2]&&C.push([N[0]-A,N[1],N[2]-A,N[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedRevision_==f&&this.renderedRenderOrder_==_&&this.renderedFrameDeclutter_===!!t.declutter&&ge(this.wrappedRenderedExtent_,p))return Be(this.renderedExtent_,y)||(this.hitDetectionImageData_=null,this.renderedExtent_=y),this.renderedCenter_=m,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const w=new Zf(Gh(u,d),p,u,d);let T;for(let A=0,W=C.length;A<W;++A)n.loadFeatures(C[A],u,c);const v=Nh(u,d);let R=!0;const I=(A,W)=>{let N;const B=A.getStyleFunction()||e.getStyleFunction();if(B&&(N=B(A,u)),N){const k=this.renderFeature(A,v,N,w,T,this.getLayer().getDeclutter(),W);R=R&&!k}},b=ho(p),O=n.getFeaturesInExtent(b);_&&O.sort(_);for(let A=0,W=O.length;A<W;++A)I(O[A],A);this.renderedFeatures_=O,this.ready=R;const D=w.finish(),P=new dg(p,u,d,n.getOverlaps(),D,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=u,this.renderedRevision_=f,this.renderedRenderOrder_=_,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=y,this.wrappedRenderedExtent_=p,this.renderedCenter_=m,this.renderedProjection_=c,this.renderedPixelRatio_=d,this.replayGroup_=P,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,n,s,r,o,a){if(!n)return!1;let l=!1;if(Array.isArray(n))for(let h=0,c=n.length;h<c;++h)l=zh(s,t,n[h],e,this.boundHandleStyleImageChange_,r,o,a)||l;else l=zh(s,t,n,e,this.boundHandleStyleImageChange_,r,o,a);return l}}const Yg=Bg;function Yh(i,t,e=0,n=i.length-1,s=Wg){for(;n>e;){if(n-e>600){const l=n-e+1,h=t-e+1,c=Math.log(l),u=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*u*(l-u)/l)*(h-l/2<0?-1:1),f=Math.max(e,Math.floor(t-h*u/l+d)),g=Math.min(n,Math.floor(t+(l-h)*u/l+d));Yh(i,t,f,g,s)}const r=i[t];let o=e,a=n;for(Hi(i,e,t),s(i[n],r)>0&&Hi(i,e,n);o<a;){for(Hi(i,o,a),o++,a--;s(i[o],r)<0;)o++;for(;s(i[a],r)>0;)a--}s(i[e],r)===0?Hi(i,e,a):(a++,Hi(i,a,n)),a<=t&&(e=a+1),t<=a&&(n=a-1)}}function Hi(i,t,e){const n=i[t];i[t]=i[e],i[e]=n}function Wg(i,t){return i<t?-1:i>t?1:0}let Wh=class{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const n=[];if(!Hs(t,e))return n;const s=this.toBBox,r=[];for(;e;){for(let o=0;o<e.children.length;o++){const a=e.children[o],l=e.leaf?s(a):a;Hs(t,l)&&(e.leaf?n.push(a):Yo(t,l)?this._all(a,n):r.push(a))}e=r.pop()}return n}collides(t){let e=this.data;if(!Hs(t,e))return!1;const n=[];for(;e;){for(let s=0;s<e.children.length;s++){const r=e.children[s],o=e.leaf?this.toBBox(r):r;if(Hs(t,o)){if(e.leaf||Yo(t,o))return!0;n.push(r)}}e=n.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let n=0;n<t.length;n++)this.insert(t[n]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=e;else if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const n=this.data;this.data=e,e=n}this._insert(e,this.data.height-e.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=si([]),this}remove(t,e){if(!t)return this;let n=this.data;const s=this.toBBox(t),r=[],o=[];let a,l,h;for(;n||r.length;){if(n||(n=r.pop(),l=r[r.length-1],a=o.pop(),h=!0),n.leaf){const c=Vg(t,n.children,e);if(c!==-1)return n.children.splice(c,1),r.push(n),this._condense(r),this}!h&&!n.leaf&&Yo(n,s)?(r.push(n),o.push(a),a=0,l=n,n=n.children[0]):l?(a++,n=l.children[a],h=!1):n=null}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const n=[];for(;t;)t.leaf?e.push(...t.children):n.push(...t.children),t=n.pop();return e}_build(t,e,n,s){const r=n-e+1;let o=this._maxEntries,a;if(r<=o)return a=si(t.slice(e,n+1)),ii(a,this.toBBox),a;s||(s=Math.ceil(Math.log(r)/Math.log(o)),o=Math.ceil(r/Math.pow(o,s-1))),a=si([]),a.leaf=!1,a.height=s;const l=Math.ceil(r/o),h=l*Math.ceil(Math.sqrt(o));Vh(t,e,n,h,this.compareMinX);for(let c=e;c<=n;c+=h){const u=Math.min(c+h-1,n);Vh(t,c,u,l,this.compareMinY);for(let d=c;d<=u;d+=l){const f=Math.min(d+l-1,u);a.children.push(this._build(t,d,f,s-1))}}return ii(a,this.toBBox),a}_chooseSubtree(t,e,n,s){for(;s.push(e),!(e.leaf||s.length-1===n);){let r=1/0,o=1/0,a;for(let l=0;l<e.children.length;l++){const h=e.children[l],c=Bo(h),u=$g(t,h)-c;u<o?(o=u,r=c<r?c:r,a=h):u===o&&c<r&&(r=c,a=h)}e=a||e.children[0]}return e}_insert(t,e,n){const s=n?t:this.toBBox(t),r=[],o=this._chooseSubtree(s,this.data,e,r);for(o.children.push(t),Ji(o,s);e>=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(s,r,e)}_split(t,e){const n=t[e],s=n.children.length,r=this._minEntries;this._chooseSplitAxis(n,r,s);const o=this._chooseSplitIndex(n,r,s),a=si(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,ii(n,this.toBBox),ii(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(n,a)}_splitRoot(t,e){this.data=si([t,e]),this.data.height=t.height+1,this.data.leaf=!1,ii(this.data,this.toBBox)}_chooseSplitIndex(t,e,n){let s,r=1/0,o=1/0;for(let a=e;a<=n-e;a++){const l=qi(t,0,a,this.toBBox),h=qi(t,a,n,this.toBBox),c=Zg(l,h),u=Bo(l)+Bo(h);c<r?(r=c,s=a,o=u<o?u:o):c===r&&u<o&&(o=u,s=a)}return s||n-e}_chooseSplitAxis(t,e,n){const s=t.leaf?this.compareMinX:Ug,r=t.leaf?this.compareMinY:Kg,o=this._allDistMargin(t,e,n,s),a=this._allDistMargin(t,e,n,r);o<a&&t.children.sort(s)}_allDistMargin(t,e,n,s){t.children.sort(s);const r=this.toBBox,o=qi(t,0,e,r),a=qi(t,n-e,n,r);let l=Zs(o)+Zs(a);for(let h=e;h<n-e;h++){const c=t.children[h];Ji(o,t.leaf?r(c):c),l+=Zs(o)}for(let h=n-e-1;h>=e;h--){const c=t.children[h];Ji(a,t.leaf?r(c):c),l+=Zs(a)}return l}_adjustParentBBoxes(t,e,n){for(let s=n;s>=0;s--)Ji(e[s],t)}_condense(t){for(let e=t.length-1,n;e>=0;e--)t[e].children.length===0?e>0?(n=t[e-1].children,n.splice(n.indexOf(t[e]),1)):this.clear():ii(t[e],this.toBBox)}};function Vg(i,t,e){if(!e)return t.indexOf(i);for(let n=0;n<t.length;n++)if(e(i,t[n]))return n;return-1}function ii(i,t){qi(i,0,i.children.length,t,i)}function qi(i,t,e,n,s){s||(s=si(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(let r=t;r<e;r++){const o=i.children[r];Ji(s,i.leaf?n(o):o)}return s}function Ji(i,t){return i.minX=Math.min(i.minX,t.minX),i.minY=Math.min(i.minY,t.minY),i.maxX=Math.max(i.maxX,t.maxX),i.maxY=Math.max(i.maxY,t.maxY),i}function Ug(i,t){return i.minX-t.minX}function Kg(i,t){return i.minY-t.minY}function Bo(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function Zs(i){return i.maxX-i.minX+(i.maxY-i.minY)}function $g(i,t){return(Math.max(t.maxX,i.maxX)-Math.min(t.minX,i.minX))*(Math.max(t.maxY,i.maxY)-Math.min(t.minY,i.minY))}function Zg(i,t){const e=Math.max(i.minX,t.minX),n=Math.max(i.minY,t.minY),s=Math.min(i.maxX,t.maxX),r=Math.min(i.maxY,t.maxY);return Math.max(0,s-e)*Math.max(0,r-n)}function Yo(i,t){return i.minX<=t.minX&&i.minY<=t.minY&&t.maxX<=i.maxX&&t.maxY<=i.maxY}function Hs(i,t){return t.minX<=i.maxX&&t.minY<=i.maxY&&t.maxX>=i.minX&&t.maxY>=i.minY}function si(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Vh(i,t,e,n,s){const r=[t,e];for(;r.length;){if(e=r.pop(),t=r.pop(),e-t<=n)continue;const o=t+Math.ceil((e-t)/n/2)*n;Yh(i,o,t,e,s),r.push(t,o,o,e)}}let wn=0;const Pt=1<<wn++,Z=1<<wn++,Dt=1<<wn++,oe=1<<wn++,vn=1<<wn++,Qi=1<<wn++,qs=Math.pow(2,wn)-1,Wo={[Pt]:"boolean",[Z]:"number",[Dt]:"string",[oe]:"color",[vn]:"number[]",[Qi]:"size"},Hg=Object.keys(Wo).map(Number).sort(Re);function qg(i){return i in Wo}function ts(i){const t=[];for(const e of Hg)es(i,e)&&t.push(Wo[e]);return t.length===0?"untyped":t.length<3?t.join(" or "):t.slice(0,-1).join(", ")+", or "+t[t.length-1]}function es(i,t){return(i&t)===t}function tn(i,t){return i===t}class _t{constructor(t,e){if(!qg(t))throw new Error(`literal expressions must have a specific type, got ${ts(t)}`);this.type=t,this.value=e}}class Jg{constructor(t,e,...n){this.type=t,this.operator=e,this.args=n}}function Uh(){return{variables:new Set,properties:new Set,featureId:!1,geometryType:!1,mapState:!1}}function Et(i,t,e){switch(typeof i){case"boolean":{if(tn(t,Dt))return new _t(Dt,i?"true":"false");if(!es(t,Pt))throw new Error(`got a boolean, but expected ${ts(t)}`);return new _t(Pt,i)}case"number":{if(tn(t,Qi))return new _t(Qi,Ot(i));if(tn(t,Pt))return new _t(Pt,!!i);if(tn(t,Dt))return new _t(Dt,i.toString());if(!es(t,Z))throw new Error(`got a number, but expected ${ts(t)}`);return new _t(Z,i)}case"string":{if(tn(t,oe))return new _t(oe,yo(i));if(tn(t,Pt))return new _t(Pt,!!i);if(!es(t,Dt))throw new Error(`got a string, but expected ${ts(t)}`);return new _t(Dt,i)}}if(!Array.isArray(i))throw new Error("expression must be an array or a primitive value");if(i.length===0)throw new Error("empty expression");if(typeof i[0]=="string")return h_(i,t,e);for(const n of i)if(typeof n!="number")throw new Error("expected an array of numbers");if(tn(t,Qi)){if(i.length!==2)throw new Error(`expected an array of two values for a size, got ${i.length}`);return new _t(Qi,i)}if(tn(t,oe)){if(i.length===3)return new _t(oe,[...i,1]);if(i.length===4)return new _t(oe,i);throw new Error(`expected an array of 3 or 4 values for a color, got ${i.length}`)}if(!es(t,vn))throw new Error(`got an array of numbers, but expected ${ts(t)}`);return new _t(vn,i)}const S={Get:"get",Var:"var",Concat:"concat",GeometryType:"geometry-type",LineMetric:"line-metric",Any:"any",All:"all",Not:"!",Resolution:"resolution",Zoom:"zoom",Time:"time",Equal:"==",NotEqual:"!=",GreaterThan:">",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"},Qg={[S.Get]:X(Y(1,1/0),Kh),[S.Var]:X(Y(1,1),t_),[S.Has]:X(Y(1,1/0),Kh),[S.Id]:X(e_,ri),[S.Concat]:X(Y(2,1/0),Q(Dt)),[S.GeometryType]:X(n_,ri),[S.LineMetric]:X(ri),[S.Resolution]:X(Vo,ri),[S.Zoom]:X(Vo,ri),[S.Time]:X(Vo,ri),[S.Any]:X(Y(2,1/0),Q(Pt)),[S.All]:X(Y(2,1/0),Q(Pt)),[S.Not]:X(Y(1,1),Q(Pt)),[S.Equal]:X(Y(2,2),Q(qs)),[S.NotEqual]:X(Y(2,2),Q(qs)),[S.GreaterThan]:X(Y(2,2),Q(Z)),[S.GreaterThanOrEqualTo]:X(Y(2,2),Q(Z)),[S.LessThan]:X(Y(2,2),Q(Z)),[S.LessThanOrEqualTo]:X(Y(2,2),Q(Z)),[S.Multiply]:X(Y(2,1/0),$h),[S.Coalesce]:X(Y(2,1/0),$h),[S.Divide]:X(Y(2,2),Q(Z)),[S.Add]:X(Y(2,1/0),Q(Z)),[S.Subtract]:X(Y(2,2),Q(Z)),[S.Clamp]:X(Y(3,3),Q(Z)),[S.Mod]:X(Y(2,2),Q(Z)),[S.Pow]:X(Y(2,2),Q(Z)),[S.Abs]:X(Y(1,1),Q(Z)),[S.Floor]:X(Y(1,1),Q(Z)),[S.Ceil]:X(Y(1,1),Q(Z)),[S.Round]:X(Y(1,1),Q(Z)),[S.Sin]:X(Y(1,1),Q(Z)),[S.Cos]:X(Y(1,1),Q(Z)),[S.Atan]:X(Y(1,2),Q(Z)),[S.Sqrt]:X(Y(1,1),Q(Z)),[S.Match]:X(Y(4,1/0),Zh,s_),[S.Between]:X(Y(3,3),Q(Z)),[S.Interpolate]:X(Y(6,1/0),Zh,r_),[S.Case]:X(Y(3,1/0),i_,o_),[S.In]:X(Y(2,2),a_),[S.Number]:X(Y(1,1/0),Q(qs)),[S.String]:X(Y(1,1/0),Q(qs)),[S.Array]:X(Y(1,1/0),Q(Z)),[S.Color]:X(Y(1,4),Q(Z)),[S.Band]:X(Y(1,3),Q(Z)),[S.Palette]:X(Y(2,2),l_),[S.ToString]:X(Y(1,1),Q(Pt|Z|Dt|oe))};function Kh(i,t,e){const n=i.length-1,s=new Array(n);for(let r=0;r<n;++r){const o=i[r+1];switch(typeof o){case"number":{s[r]=new _t(Z,o);break}case"string":{s[r]=new _t(Dt,o);break}default:throw new Error(`expected a string key or numeric array index for a get operation, got ${o}`)}r===0&&e.properties.add(String(o))}return s}function t_(i,t,e){const n=i[1];if(typeof n!="string")throw new Error("expected a string argument for var operation");return e.variables.add(n),[new _t(Dt,n)]}function e_(i,t,e){e.featureId=!0}function n_(i,t,e){e.geometryType=!0}function Vo(i,t,e){e.mapState=!0}function ri(i,t,e){const n=i[0];if(i.length!==1)throw new Error(`expected no arguments for ${n} operation`);return[]}function Y(i,t){return function(e,n,s){const r=e[0],o=e.length-1;if(i===t){if(o!==i){const a=i===1?"":"s";throw new Error(`expected ${i} argument${a} for ${r}, got ${o}`)}}else if(o<i||o>t){const a=t===1/0?`${i} or more`:`${i} to ${t}`;throw new Error(`expected ${a} arguments for ${r}, got ${o}`)}}}function $h(i,t,e){const n=i.length-1,s=new Array(n);for(let r=0;r<n;++r){const o=Et(i[r+1],t,e);s[r]=o}return s}function Q(i){return function(t,e,n){const s=t.length-1,r=new Array(s);for(let o=0;o<s;++o){const a=Et(t[o+1],i,n);r[o]=a}return r}}function i_(i,t,e){const n=i[0],s=i.length-1;if(s%2===0)throw new Error(`expected an odd number of arguments for ${n}, got ${s} instead`)}function Zh(i,t,e){const n=i[0],s=i.length-1;if(s%2===1)throw new Error(`expected an even number of arguments for operation ${n}, got ${s} instead`)}function s_(i,t,e){const n=i.length-1,s=Dt|Z|Pt,r=Et(i[1],s,e),o=Et(i[i.length-1],t,e),a=new Array(n-2);for(let l=0;l<n-2;l+=2){try{const h=Et(i[l+2],r.type,e);a[l]=h}catch(h){throw new Error(`failed to parse argument ${l+1} of match expression: ${h.message}`)}try{const h=Et(i[l+3],o.type,e);a[l+1]=h}catch(h){throw new Error(`failed to parse argument ${l+2} of match expression: ${h.message}`)}}return[r,...a,o]}function r_(i,t,e){const n=i[1];let s;switch(n[0]){case"linear":s=1;break;case"exponential":const l=n[1];if(typeof l!="number"||l<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(l)} instead`);s=l;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(n)}`)}const r=new _t(Z,s);let o;try{o=Et(i[2],Z,e)}catch(l){throw new Error(`failed to parse argument 1 in interpolate expression: ${l.message}`)}const a=new Array(i.length-3);for(let l=0;l<a.length;l+=2){try{const h=Et(i[l+3],Z,e);a[l]=h}catch(h){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${h.message}`)}try{const h=Et(i[l+4],t,e);a[l+1]=h}catch(h){throw new Error(`failed to parse argument ${l+3} for interpolate expression: ${h.message}`)}}return[r,o,...a]}function o_(i,t,e){const n=Et(i[i.length-1],t,e),s=new Array(i.length-1);for(let r=0;r<s.length-1;r+=2){try{const o=Et(i[r+1],Pt,e);s[r]=o}catch(o){throw new Error(`failed to parse argument ${r} of case expression: ${o.message}`)}try{const o=Et(i[r+2],n.type,e);s[r+1]=o}catch(o){throw new Error(`failed to parse argument ${r+1} of case expression: ${o.message}`)}}return s[s.length-1]=n,s}function a_(i,t,e){let n=i[2];if(!Array.isArray(n))throw new Error('the second argument for the "in" operator must be an array');let s;if(typeof n[0]=="string"){if(n[0]!=="literal")throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');if(!Array.isArray(n[1]))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array');n=n[1],s=Dt}else s=Z;const r=new Array(n.length);for(let a=0;a<r.length;a++)try{const l=Et(n[a],s,e);r[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[Et(i[1],s,e),...r]}function l_(i,t,e){let n;try{n=Et(i[1],Z,e)}catch(o){throw new Error(`failed to parse first argument in palette expression: ${o.message}`)}const s=i[2];if(!Array.isArray(s))throw new Error("the second argument of palette must be an array");const r=new Array(s.length);for(let o=0;o<r.length;o++){let a;try{a=Et(s[o],oe,e)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof _t))throw new Error(`the palette color at index ${o} must be a literal value`);r[o]=a}return[n,...r]}function X(...i){return function(t,e,n){const s=t[0];let r;for(let o=0;o<i.length;o++){const a=i[o](t,e,n);if(o==i.length-1){if(!a)throw new Error("expected last argument validator to return the parsed args");r=a}}return new Jg(e,s,...r)}}function h_(i,t,e){const n=i[0],s=Qg[n];if(!s)throw new Error(`unknown operator: ${n}`);return s(i,t,e)}function Hh(i){if(!i)return"";const t=i.getType();switch(t){case"Point":case"LineString":case"Polygon":return t;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return t.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return Hh(i.getGeometries()[0]);default:return""}}function qh(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function Oe(i,t,e){const n=Et(i,t,e);return ae(n)}function ae(i,t){if(i instanceof _t){if(i.type===oe&&typeof i.value=="string"){const n=yo(i.value);return function(){return n}}return function(){return i.value}}const e=i.operator;switch(e){case S.Number:case S.String:case S.Coalesce:return c_(i);case S.Get:case S.Var:case S.Has:return u_(i);case S.Id:return n=>n.featureId;case S.GeometryType:return n=>n.geometryType;case S.Concat:{const n=i.args.map(s=>ae(s));return s=>"".concat(...n.map(r=>r(s).toString()))}case S.Resolution:return n=>n.resolution;case S.Any:case S.All:case S.Between:case S.In:case S.Not:return f_(i);case S.Equal:case S.NotEqual:case S.LessThan:case S.LessThanOrEqualTo:case S.GreaterThan:case S.GreaterThanOrEqualTo:return d_(i);case S.Multiply:case S.Divide:case S.Add:case S.Subtract:case S.Clamp:case S.Mod:case S.Pow:case S.Abs:case S.Floor:case S.Ceil:case S.Round:case S.Sin:case S.Cos:case S.Atan:case S.Sqrt:return g_(i);case S.Case:return __(i);case S.Match:return m_(i);case S.Interpolate:return p_(i);case S.ToString:return y_(i);default:throw new Error(`Unsupported operator ${e}`)}}function c_(i,t){const e=i.operator,n=i.args.length,s=new Array(n);for(let r=0;r<n;++r)s[r]=ae(i.args[r]);switch(e){case S.Coalesce:return r=>{for(let o=0;o<n;++o){const a=s[o](r);if(typeof a<"u"&&a!==null)return a}throw new Error("Expected one of the values to be non-null")};case S.Number:case S.String:return r=>{for(let o=0;o<n;++o){const a=s[o](r);if(typeof a===e)return a}throw new Error(`Expected one of the values to be a ${e}`)};default:throw new Error(`Unsupported assertion operator ${e}`)}}function u_(i,t){const n=i.args[0].value;switch(i.operator){case S.Get:return s=>{const r=i.args;let o=s.properties[n];for(let a=1,l=r.length;a<l;++a){const c=r[a].value;o=o[c]}return o};case S.Var:return s=>s.variables[n];case S.Has:return s=>{const r=i.args;if(!(n in s.properties))return!1;let o=s.properties[n];for(let a=1,l=r.length;a<l;++a){const c=r[a].value;if(!o||!Object.hasOwn(o,c))return!1;o=o[c]}return!0};default:throw new Error(`Unsupported accessor operator ${i.operator}`)}}function d_(i,t){const e=i.operator,n=ae(i.args[0]),s=ae(i.args[1]);switch(e){case S.Equal:return r=>n(r)===s(r);case S.NotEqual:return r=>n(r)!==s(r);case S.LessThan:return r=>n(r)<s(r);case S.LessThanOrEqualTo:return r=>n(r)<=s(r);case S.GreaterThan:return r=>n(r)>s(r);case S.GreaterThanOrEqualTo:return r=>n(r)>=s(r);default:throw new Error(`Unsupported comparison operator ${e}`)}}function f_(i,t){const e=i.operator,n=i.args.length,s=new Array(n);for(let r=0;r<n;++r)s[r]=ae(i.args[r]);switch(e){case S.Any:return r=>{for(let o=0;o<n;++o)if(s[o](r))return!0;return!1};case S.All:return r=>{for(let o=0;o<n;++o)if(!s[o](r))return!1;return!0};case S.Between:return r=>{const o=s[0](r),a=s[1](r),l=s[2](r);return o>=a&&o<=l};case S.In:return r=>{const o=s[0](r);for(let a=1;a<n;++a)if(o===s[a](r))return!0;return!1};case S.Not:return r=>!s[0](r);default:throw new Error(`Unsupported logical operator ${e}`)}}function g_(i,t){const e=i.operator,n=i.args.length,s=new Array(n);for(let r=0;r<n;++r)s[r]=ae(i.args[r]);switch(e){case S.Multiply:return r=>{let o=1;for(let a=0;a<n;++a)o*=s[a](r);return o};case S.Divide:return r=>s[0](r)/s[1](r);case S.Add:return r=>{let o=0;for(let a=0;a<n;++a)o+=s[a](r);return o};case S.Subtract:return r=>s[0](r)-s[1](r);case S.Clamp:return r=>{const o=s[0](r),a=s[1](r);if(o<a)return a;const l=s[2](r);return o>l?l:o};case S.Mod:return r=>s[0](r)%s[1](r);case S.Pow:return r=>Math.pow(s[0](r),s[1](r));case S.Abs:return r=>Math.abs(s[0](r));case S.Floor:return r=>Math.floor(s[0](r));case S.Ceil:return r=>Math.ceil(s[0](r));case S.Round:return r=>Math.round(s[0](r));case S.Sin:return r=>Math.sin(s[0](r));case S.Cos:return r=>Math.cos(s[0](r));case S.Atan:return n===2?r=>Math.atan2(s[0](r),s[1](r)):r=>Math.atan(s[0](r));case S.Sqrt:return r=>Math.sqrt(s[0](r));default:throw new Error(`Unsupported numeric operator ${e}`)}}function __(i,t){const e=i.args.length,n=new Array(e);for(let s=0;s<e;++s)n[s]=ae(i.args[s]);return s=>{for(let r=0;r<e-1;r+=2)if(n[r](s))return n[r+1](s);return n[e-1](s)}}function m_(i,t){const e=i.args.length,n=new Array(e);for(let s=0;s<e;++s)n[s]=ae(i.args[s]);return s=>{const r=n[0](s);for(let o=1;o<e-1;o+=2)if(r===n[o](s))return n[o+1](s);return n[e-1](s)}}function p_(i,t){const e=i.args.length,n=new Array(e);for(let s=0;s<e;++s)n[s]=ae(i.args[s]);return s=>{const r=n[0](s),o=n[1](s);let a,l;for(let h=2;h<e;h+=2){const c=n[h](s);let u=n[h+1](s);const d=Array.isArray(u);if(d&&(u=gf(u)),c>=o)return h===2?u:d?x_(r,o,a,l,c,u):ns(r,o,a,l,c,u);a=c,l=u}return l}}function y_(i,t){const e=i.operator,n=i.args.length,s=new Array(n);for(let r=0;r<n;++r)s[r]=ae(i.args[r]);switch(e){case S.ToString:return r=>{const o=s[0](r);return i.args[0].type===oe?xo(o):o.toString()};default:throw new Error(`Unsupported convert operator ${e}`)}}function ns(i,t,e,n,s,r){const o=s-e;if(o===0)return n;const a=t-e,l=i===1?a/o:(Math.pow(i,a)-1)/(Math.pow(i,o)-1);return n+l*(r-n)}function x_(i,t,e,n,s,r){if(s-e===0)return n;const a=rh(n),l=rh(r);let h=l[2]-a[2];h>180?h-=360:h<-180&&(h+=360);const c=[ns(i,t,e,a[0],s,l[0]),ns(i,t,e,a[1],s,l[1]),a[2]+ns(i,t,e,0,s,h),ns(i,t,e,n[3],s,r[3])];return _f(c)}function E_(i){return!0}function C_(i){const t=Uh(),e=w_(i,t),n=qh();return function(s,r){if(n.properties=s.getPropertiesInternal(),n.resolution=r,t.featureId){const o=s.getId();o!==void 0?n.featureId=o:n.featureId=null}return t.geometryType&&(n.geometryType=Hh(s.getGeometry())),e(n)}}function Jh(i){const t=Uh(),e=i.length,n=new Array(e);for(let o=0;o<e;++o)n[o]=Uo(i[o],t);const s=qh(),r=new Array(e);return function(o,a){if(s.properties=o.getPropertiesInternal(),s.resolution=a,t.featureId){const h=o.getId();h!==void 0?s.featureId=h:s.featureId=null}let l=0;for(let h=0;h<e;++h){const c=n[h](s);c&&(r[l]=c,l+=1)}return r.length=l,r}}function w_(i,t){const e=i.length,n=new Array(e);for(let s=0;s<e;++s){const r=i[s],o="filter"in r?Oe(r.filter,Pt,t):E_;let a;if(Array.isArray(r.style)){const l=r.style.length;a=new Array(l);for(let h=0;h<l;++h)a[h]=Uo(r.style[h],t)}else a=[Uo(r.style,t)];n[s]={filter:o,styles:a}}return function(s){const r=[];let o=!1;for(let a=0;a<e;++a){const l=n[a].filter;if(l(s)&&!(i[a].else&&o)){o=!0;for(const h of n[a].styles){const c=h(s);c&&r.push(c)}}}return r}}function Uo(i,t){const e=is(i,"",t),n=ss(i,"",t),s=v_(i,t),r=R_(i,t),o=Ft(i,"z-index",t);if(!e&&!n&&!s&&!r&&!gn(i))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(i));const a=new $t;return function(l){let h=!0;if(e){const c=e(l);c&&(h=!1),a.setFill(c)}if(n){const c=n(l);c&&(h=!1),a.setStroke(c)}if(s){const c=s(l);c&&(h=!1),a.setText(c)}if(r){const c=r(l);c&&(h=!1),a.setImage(c)}return o&&a.setZIndex(o(l)),h?null:a}}function is(i,t,e){let n;if(t+"fill-pattern-src"in i)n=L_(i,t+"fill-",e);else{if(i[t+"fill-color"]==="none")return r=>null;n=Ko(i,t+"fill-color",e)}if(!n)return null;const s=new wt;return function(r){const o=n(r);return o===co?null:(s.setColor(o),s)}}function ss(i,t,e){const n=Ft(i,t+"stroke-width",e),s=Ko(i,t+"stroke-color",e);if(!n&&!s)return null;const r=De(i,t+"stroke-line-cap",e),o=De(i,t+"stroke-line-join",e),a=Qh(i,t+"stroke-line-dash",e),l=Ft(i,t+"stroke-line-dash-offset",e),h=Ft(i,t+"stroke-miter-limit",e),c=new Ae;return function(u){if(s){const d=s(u);if(d===co)return null;c.setColor(d)}if(n&&c.setWidth(n(u)),r){const d=r(u);if(d!=="butt"&&d!=="round"&&d!=="square")throw new Error("Expected butt, round, or square line cap");c.setLineCap(d)}if(o){const d=o(u);if(d!=="bevel"&&d!=="round"&&d!=="miter")throw new Error("Expected bevel, round, or miter line join");c.setLineJoin(d)}return a&&c.setLineDash(a(u)),l&&c.setLineDashOffset(l(u)),h&&c.setMiterLimit(h(u)),c}}function v_(i,t){const e="text-",n=De(i,e+"value",t);if(!n)return null;const s=is(i,e,t),r=is(i,e+"background-",t),o=ss(i,e,t),a=ss(i,e+"background-",t),l=De(i,e+"font",t),h=Ft(i,e+"max-angle",t),c=Ft(i,e+"offset-x",t),u=Ft(i,e+"offset-y",t),d=oi(i,e+"overflow",t),f=De(i,e+"placement",t),g=Ft(i,e+"repeat",t),_=Qs(i,e+"scale",t),m=oi(i,e+"rotate-with-view",t),p=Ft(i,e+"rotation",t),y=De(i,e+"align",t),C=De(i,e+"justify",t),E=De(i,e+"baseline",t),w=oi(i,e+"keep-upright",t),T=Qh(i,e+"padding",t),v=er(i,e+"declutter-mode"),R=new Oh({declutterMode:v});return function(I){if(R.setText(n(I)),s&&R.setFill(s(I)),r&&R.setBackgroundFill(r(I)),o&&R.setStroke(o(I)),a&&R.setBackgroundStroke(a(I)),l&&R.setFont(l(I)),h&&R.setMaxAngle(h(I)),c&&R.setOffsetX(c(I)),u&&R.setOffsetY(u(I)),d&&R.setOverflow(d(I)),f){const b=f(I);if(b!=="point"&&b!=="line")throw new Error("Expected point or line for text-placement");R.setPlacement(b)}if(g&&R.setRepeat(g(I)),_&&R.setScale(_(I)),m&&R.setRotateWithView(m(I)),p&&R.setRotation(p(I)),y){const b=y(I);if(b!=="left"&&b!=="center"&&b!=="right"&&b!=="end"&&b!=="start")throw new Error("Expected left, right, center, start, or end for text-align");R.setTextAlign(b)}if(C){const b=C(I);if(b!=="left"&&b!=="right"&&b!=="center")throw new Error("Expected left, right, or center for text-justify");R.setJustify(b)}if(E){const b=E(I);if(b!=="bottom"&&b!=="top"&&b!=="middle"&&b!=="alphabetic"&&b!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");R.setTextBaseline(b)}return T&&R.setPadding(T(I)),w&&R.setKeepUpright(w(I)),R}}function R_(i,t){return"icon-src"in i?T_(i,t):"shape-points"in i?S_(i,t):"circle-radius"in i?I_(i,t):null}function T_(i,t){const e="icon-",n=e+"src",s=ic(i[n],n),r=Js(i,e+"anchor",t),o=Qs(i,e+"scale",t),a=Ft(i,e+"opacity",t),l=Js(i,e+"displacement",t),h=Ft(i,e+"rotation",t),c=oi(i,e+"rotate-with-view",t),u=ec(i,e+"anchor-origin"),d=nc(i,e+"anchor-x-units"),f=nc(i,e+"anchor-y-units"),g=A_(i,e+"color"),_=b_(i,e+"cross-origin"),m=M_(i,e+"offset"),p=ec(i,e+"offset-origin"),y=tr(i,e+"width"),C=tr(i,e+"height"),E=P_(i,e+"size"),w=er(i,e+"declutter-mode"),T=new No({src:s,anchorOrigin:u,anchorXUnits:d,anchorYUnits:f,color:g,crossOrigin:_,offset:m,offsetOrigin:p,height:C,width:y,size:E,declutterMode:w});return function(v){return a&&T.setOpacity(a(v)),l&&T.setDisplacement(l(v)),h&&T.setRotation(h(v)),c&&T.setRotateWithView(c(v)),o&&T.setScale(o(v)),r&&T.setAnchor(r(v)),T}}function S_(i,t){const e="shape-",n=e+"points",s=e+"radius",r=$o(i[n],n),o=$o(i[s],s),a=is(i,e,t),l=ss(i,e,t),h=Qs(i,e+"scale",t),c=Js(i,e+"displacement",t),u=Ft(i,e+"rotation",t),d=oi(i,e+"rotate-with-view",t),f=tr(i,e+"radius2"),g=tr(i,e+"angle"),_=er(i,e+"declutter-mode"),m=new Ph({points:r,radius:o,radius2:f,angle:g,declutterMode:_});return function(p){return a&&m.setFill(a(p)),l&&m.setStroke(l(p)),c&&m.setDisplacement(c(p)),u&&m.setRotation(u(p)),d&&m.setRotateWithView(d(p)),h&&m.setScale(h(p)),m}}function I_(i,t){const e="circle-",n=is(i,e,t),s=ss(i,e,t),r=Ft(i,e+"radius",t),o=Qs(i,e+"scale",t),a=Js(i,e+"displacement",t),l=Ft(i,e+"rotation",t),h=oi(i,e+"rotate-with-view",t),c=er(i,e+"declutter-mode"),u=new Ks({radius:5,declutterMode:c});return function(d){return r&&u.setRadius(r(d)),n&&u.setFill(n(d)),s&&u.setStroke(s(d)),a&&u.setDisplacement(a(d)),l&&u.setRotation(l(d)),h&&u.setRotateWithView(h(d)),o&&u.setScale(o(d)),u}}function Ft(i,t,e){if(!(t in i))return;const n=Oe(i[t],Z,e);return function(s){return $o(n(s),t)}}function De(i,t,e){if(!(t in i))return null;const n=Oe(i[t],Dt,e);return function(s){return ic(n(s),t)}}function L_(i,t,e){const n=De(i,t+"pattern-src",e),s=tc(i,t+"pattern-offset",e),r=tc(i,t+"pattern-size",e),o=Ko(i,t+"color",e);return function(a){return{src:n(a),offset:s&&s(a),size:r&&r(a),color:o&&o(a)}}}function oi(i,t,e){if(!(t in i))return null;const n=Oe(i[t],Pt,e);return function(s){const r=n(s);if(typeof r!="boolean")throw new Error(`Expected a boolean for ${t}`);return r}}function Ko(i,t,e){if(!(t in i))return null;const n=Oe(i[t],oe,e);return function(s){return sc(n(s),t)}}function Qh(i,t,e){if(!(t in i))return null;const n=Oe(i[t],vn,e);return function(s){return rs(n(s),t)}}function Js(i,t,e){if(!(t in i))return null;const n=Oe(i[t],vn,e);return function(s){const r=rs(n(s),t);if(r.length!==2)throw new Error(`Expected two numbers for ${t}`);return r}}function tc(i,t,e){if(!(t in i))return null;const n=Oe(i[t],vn,e);return function(s){return rc(n(s),t)}}function Qs(i,t,e){if(!(t in i))return null;const n=Oe(i[t],vn|Z,e);return function(s){return O_(n(s),t)}}function tr(i,t){const e=i[t];if(e!==void 0){if(typeof e!="number")throw new Error(`Expected a number for ${t}`);return e}}function P_(i,t){const e=i[t];if(e!==void 0){if(typeof e=="number")return Ot(e);if(!Array.isArray(e))throw new Error(`Expected a number or size array for ${t}`);if(e.length!==2||typeof e[0]!="number"||typeof e[1]!="number")throw new Error(`Expected a number or size array for ${t}`);return e}}function b_(i,t){const e=i[t];if(e!==void 0){if(typeof e!="string")throw new Error(`Expected a string for ${t}`);return e}}function ec(i,t){const e=i[t];if(e!==void 0){if(e!=="bottom-left"&&e!=="bottom-right"&&e!=="top-left"&&e!=="top-right")throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${t}`);return e}}function nc(i,t){const e=i[t];if(e!==void 0){if(e!=="pixels"&&e!=="fraction")throw new Error(`Expected pixels or fraction for ${t}`);return e}}function M_(i,t){const e=i[t];if(e!==void 0)return rs(e,t)}function er(i,t){const e=i[t];if(e!==void 0){if(typeof e!="string")throw new Error(`Expected a string for ${t}`);if(e!=="declutter"&&e!=="obstacle"&&e!=="none")throw new Error(`Expected declutter, obstacle, or none for ${t}`);return e}}function A_(i,t){const e=i[t];if(e!==void 0)return sc(e,t)}function rs(i,t){if(!Array.isArray(i))throw new Error(`Expected an array for ${t}`);const e=i.length;for(let n=0;n<e;++n)if(typeof i[n]!="number")throw new Error(`Expected an array of numbers for ${t}`);return i}function ic(i,t){if(typeof i!="string")throw new Error(`Expected a string for ${t}`);return i}function $o(i,t){if(typeof i!="number")throw new Error(`Expected a number for ${t}`);return i}function sc(i,t){if(typeof i=="string")return i;const e=rs(i,t),n=e.length;if(n<3||n>4)throw new Error(`Expected a color with 3 or 4 values for ${t}`);return e}function rc(i,t){const e=rs(i,t);if(e.length!==2)throw new Error(`Expected an array of two numbers for ${t}`);return e}function O_(i,t){return typeof i=="number"?i:rc(i,t)}const le={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function oc(i,t,e){return function(n,s,r,o,a){if(!n)return;if(!s&&!t)return n;const l=t?0:r[0]*s,h=t?0:r[1]*s,c=a?a[0]:0,u=a?a[1]:0;let d=i[0]+l/2+c,f=i[2]-l/2+c,g=i[1]+h/2+u,_=i[3]-h/2+u;d>f&&(d=(f+d)/2,f=d),g>_&&(g=(_+g)/2,_=g);let m=ot(n[0],d,f),p=ot(n[1],g,_);if(o&&e&&s){const y=30*s;m+=-y*Math.log(1+Math.max(0,d-n[0])/y)+y*Math.log(1+Math.max(0,n[0]-f)/y),p+=-y*Math.log(1+Math.max(0,g-n[1])/y)+y*Math.log(1+Math.max(0,n[1]-_)/y)}return[m,p]}}function D_(i){return i}function ac(i){return Math.pow(i,3)}function Rn(i){return 1-ac(1-i)}function Zo(i){return 3*i*i-2*i*i*i}function F_(i){return i}function lc(i,t,e,n){let s=0;const r=i[e-n],o=i[e-n+1];let a=0,l=0;for(;t<e;t+=n){const h=i[t]-r,c=i[t+1]-o;s+=l*h-a*c,a=h,l=c}return s/2}function hc(i,t,e,n){let s=0;for(let r=0,o=e.length;r<o;++r){const a=e[r];s+=lc(i,t,a,n),t=a}return s}function k_(i,t,e,n){let s=0;for(let r=0,o=e.length;r<o;++r){const a=e[r];s+=hc(i,t,a,n),t=a[a.length-1]}return s}function cc(i,t,e,n,s,r,o){const a=i[t],l=i[t+1],h=i[e]-a,c=i[e+1]-l;let u;if(h===0&&c===0)u=t;else{const d=((s-a)*h+(r-l)*c)/(h*h+c*c);if(d>1)u=e;else if(d>0){for(let f=0;f<n;++f)o[f]=Gt(i[t+f],i[e+f],d);o.length=n;return}else u=t}for(let d=0;d<n;++d)o[d]=i[u+d];o.length=n}function Ho(i,t,e,n,s){let r=i[t],o=i[t+1];for(t+=n;t<e;t+=n){const a=i[t],l=i[t+1],h=Ie(r,o,a,l);h>s&&(s=h),r=a,o=l}return s}function qo(i,t,e,n,s){for(let r=0,o=e.length;r<o;++r){const a=e[r];s=Ho(i,t,a,n,s),t=a}return s}function N_(i,t,e,n,s){for(let r=0,o=e.length;r<o;++r){const a=e[r];s=qo(i,t,a,n,s),t=a[a.length-1]}return s}function Jo(i,t,e,n,s,r,o,a,l,h,c){if(t==e)return h;let u,d;if(s===0){if(d=Ie(o,a,i[t],i[t+1]),d<h){for(u=0;u<n;++u)l[u]=i[t+u];return l.length=n,d}return h}c=c||[NaN,NaN];let f=t+n;for(;f<e;)if(cc(i,f-n,f,n,o,a,c),d=Ie(o,a,c[0],c[1]),d<h){for(h=d,u=0;u<n;++u)l[u]=c[u];l.length=n,f+=n}else f+=n*Math.max((Math.sqrt(d)-Math.sqrt(h))/s|0,1);if(r&&(cc(i,e-n,t,n,o,a,c),d=Ie(o,a,c[0],c[1]),d<h)){for(h=d,u=0;u<n;++u)l[u]=c[u];l.length=n}return h}function Qo(i,t,e,n,s,r,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,d=e.length;u<d;++u){const f=e[u];h=Jo(i,t,f,n,s,r,o,a,l,h,c),t=f}return h}function G_(i,t,e,n,s,r,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,d=e.length;u<d;++u){const f=e[u];h=Qo(i,t,f,n,s,r,o,a,l,h,c),t=f[f.length-1]}return h}function uc(i,t,e,n){for(let s=0,r=e.length;s<r;++s)i[t++]=e[s];return t}function nr(i,t,e,n){for(let s=0,r=e.length;s<r;++s){const o=e[s];for(let a=0;a<n;++a)i[t++]=o[a]}return t}function os(i,t,e,n,s){s=s||[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=nr(i,t,e[o],n);s[r++]=l,t=l}return s.length=r,s}function dc(i,t,e,n,s){s=s||[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=os(i,t,e[o],n,s[r]);l.length===0&&(l[0]=t),s[r++]=l,t=l[l.length-1]}return s.length=r,s}class ir extends Qe{constructor(t,e){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,e!==void 0&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}clone(){return new ir(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,n,s){return s<hn(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Ho(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Jo(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,n,s))}getArea(){return lc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Ke(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=Vs(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new ir(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=nr(this.flatCoordinates,0,t,this.stride),this.changed()}}const fc=ir;class ta extends Qe{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new ta(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,n,s){const r=this.flatCoordinates,o=Ie(t,e,r[0],r[1]);if(o<s){const a=this.stride;for(let l=0;l<a;++l)n[l]=r[l];return n.length=a,o}return s}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return Wr(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return Br(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=uc(this.flatCoordinates,0,t,this.stride),this.changed()}}const he=ta;function z_(i,t,e,n,s){return!Ur(s,function(o){return!Tn(i,t,e,n,o[0],o[1])})}function Tn(i,t,e,n,s,r){let o=0,a=i[e-n],l=i[e-n+1];for(;t<e;t+=n){const h=i[t],c=i[t+1];l<=r?c>r&&(h-a)*(r-l)-(s-a)*(c-l)>0&&o++:c<=r&&(h-a)*(r-l)-(s-a)*(c-l)<0&&o--,a=h,l=c}return o!==0}function ea(i,t,e,n,s,r){if(e.length===0||!Tn(i,t,e[0],n,s,r))return!1;for(let o=1,a=e.length;o<a;++o)if(Tn(i,e[o-1],e[o],n,s,r))return!1;return!0}function j_(i,t,e,n,s,r){if(e.length===0)return!1;for(let o=0,a=e.length;o<a;++o){const l=e[o];if(ea(i,t,l,n,s,r))return!0;t=l[l.length-1]}return!1}function na(i,t,e,n,s,r,o){let a,l,h,c,u,d,f;const g=s[r+1],_=[];for(let y=0,C=e.length;y<C;++y){const E=e[y];for(c=i[E-n],d=i[E-n+1],a=t;a<E;a+=n)u=i[a],f=i[a+1],(g<=d&&f<=g||d<=g&&g<=f)&&(h=(g-d)/(f-d)*(u-c)+c,_.push(h)),c=u,d=f}let m=NaN,p=-1/0;for(_.sort(Re),c=_[0],a=1,l=_.length;a<l;++a){u=_[a];const y=Math.abs(u-c);y>p&&(h=(c+u)/2,ea(i,t,e,n,h,g)&&(m=h,p=y)),c=u}return isNaN(m)&&(m=s[r]),o?(o.push(m,g,p),o):[m,g,p]}function gc(i,t,e,n,s){let r=[];for(let o=0,a=e.length;o<a;++o){const l=e[o];r=na(i,t,l,n,s,2*o,r),t=l[l.length-1]}return r}function _c(i,t,e,n,s){let r;for(t+=n;t<e;t+=n)if(r=s(i.slice(t-n,t),i.slice(t,t+n)),r)return r;return!1}function sr(i,t,e,n,s,r){return r=r??vl(Mt(),i,t,e,n),Ct(s,r)?r[0]>=s[0]&&r[2]<=s[2]||r[1]>=s[1]&&r[3]<=s[3]?!0:_c(i,t,e,n,function(o,a){return pd(s,o,a)}):!1}function X_(i,t,e,n,s){for(let r=0,o=e.length;r<o;++r){if(sr(i,t,e[r],n,s))return!0;t=e[r]}return!1}function mc(i,t,e,n,s){return!!(sr(i,t,e,n,s)||Tn(i,t,e,n,s[0],s[1])||Tn(i,t,e,n,s[0],s[3])||Tn(i,t,e,n,s[2],s[1])||Tn(i,t,e,n,s[2],s[3]))}function pc(i,t,e,n,s){if(!mc(i,t,e[0],n,s))return!1;if(e.length===1)return!0;for(let r=1,o=e.length;r<o;++r)if(z_(i,e[r-1],e[r],n,s)&&!sr(i,e[r-1],e[r],n,s))return!1;return!0}function B_(i,t,e,n,s){for(let r=0,o=e.length;r<o;++r){const a=e[r];if(pc(i,t,a,n,s))return!0;t=a[a.length-1]}return!1}function Y_(i,t,e,n){for(;t<e-n;){for(let s=0;s<n;++s){const r=i[t+s];i[t+s]=i[e-n+s],i[e-n+s]=r}t+=n,e-=n}}function ia(i,t,e,n){let s=0,r=i[e-n],o=i[e-n+1];for(;t<e;t+=n){const a=i[t],l=i[t+1];s+=(a-r)*(l+o),r=a,o=l}return s===0?void 0:s>0}function sa(i,t,e,n,s){s=s!==void 0?s:!1;for(let r=0,o=e.length;r<o;++r){const a=e[r],l=ia(i,t,a,n);if(r===0){if(s&&l||!s&&!l)return!1}else if(s&&!l||!s&&l)return!1;t=a}return!0}function yc(i,t,e,n,s){for(let r=0,o=e.length;r<o;++r){const a=e[r];if(!sa(i,t,a,n,s))return!1;a.length&&(t=a[a.length-1])}return!0}function rr(i,t,e,n,s){s=s!==void 0?s:!1;for(let r=0,o=e.length;r<o;++r){const a=e[r],l=ia(i,t,a,n);(r===0?s&&l||!s&&!l:s&&!l||!s&&l)&&Y_(i,t,a,n),t=a}return t}function ra(i,t,e,n,s){for(let r=0,o=e.length;r<o;++r)t=rr(i,t,e[r],n,s);return t}function W_(i,t){const e=[];let n=0,s=0,r;for(let o=0,a=t.length;o<a;++o){const l=t[o],h=ia(i,n,l,2);if(r===void 0&&(r=h),h===r)e.push(t.slice(s,o+1));else{if(e.length===0)continue;e[e.length-1].push(t[s])}s=o+1,n=l}return e}class Zt extends Qe{constructor(t,e,n){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,e!==void 0&&n?(this.setFlatCoordinates(e,t),this.ends_=n):this.setCoordinates(t,e)}appendLinearRing(t){this.flatCoordinates?ne(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Zt(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,n,s){return s<hn(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(qo(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Qo(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,n,s))}containsXY(t,e){return ea(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return hc(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),rr(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,Xi(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=ie(this.getExtent());this.flatInteriorPoint_=na(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new he(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new fc(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,n=this.ends_,s=[];let r=0;for(let o=0,a=n.length;o<a;++o){const l=n[o],h=new fc(e.slice(r,l),t);s.push(h),r=l}return s}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;sa(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=rr(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],n=[];return e.length=Io(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,n),new Zt(e,"XY",n)}getType(){return"Polygon"}intersectsExtent(t){return pc(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const n=os(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}}function V_(i,t,e,n){e=e||32;const s=[];for(let r=0;r<e;++r)ne(s,qd(i,t,2*Math.PI*r/e,n));return s.push(s[0],s[1]),new Zt(s,"XY",[s.length])}function xc(i){if(Bn(i))throw new Error("Cannot create polygon from empty extent");const t=i[0],e=i[1],n=i[2],s=i[3],r=[t,e,t,s,n,s,n,e,t,e];return new Zt(r,"XY",[r.length])}function oa(i,t,e,n){const s=K(t)/e[0],r=ut(t)/e[1];return n?Math.min(i,Math.max(s,r)):Math.min(i,Math.min(s,r))}function aa(i,t,e){let n=Math.min(i,t);const s=50;return n*=Math.log(1+s*Math.max(0,i/t-1))/s+1,e&&(n=Math.max(n,e),n/=Math.log(1+s*Math.max(0,e/i-1))/s+1),ot(n,e/2,t*2)}function U_(i,t,e,n){return t=t!==void 0?t:!0,function(s,r,o,a){if(s!==void 0){const l=i[0],h=i[i.length-1],c=e?oa(l,e,o,n):l;if(a)return t?aa(s,c,h):ot(s,h,c);const u=Math.min(c,s),d=Math.floor(vs(i,u,r));return i[d]>c&&d<i.length-1?i[d+1]:i[d]}}}function K_(i,t,e,n,s,r){return n=n!==void 0?n:!0,e=e!==void 0?e:0,function(o,a,l,h){if(o!==void 0){const c=s?oa(t,s,l,r):t;if(h)return n?aa(o,c,e):ot(o,e,c);const u=1e-9,d=Math.ceil(Math.log(t/c)/Math.log(i)-u),f=-a*(.5-u)+.5,g=Math.min(c,o),_=Math.floor(Math.log(t/g)/Math.log(i)+f),m=Math.max(d,_),p=t/Math.pow(i,m);return ot(p,e,c)}}}function Ec(i,t,e,n,s){return e=e!==void 0?e:!0,function(r,o,a,l){if(r!==void 0){const h=n?oa(i,n,a,s):i;return!e||!l?ot(r,t,h):aa(r,h,t)}}}function la(i){if(i!==void 0)return 0}function Cc(i){if(i!==void 0)return i}function $_(i){const t=2*Math.PI/i;return function(e,n){if(n)return e;if(e!==void 0)return e=Math.floor(e/t+.5)*t,e}}function Z_(i){const t=i===void 0?_e(5):i;return function(e,n){return n||e===void 0?e:Math.abs(e)<=t?0:e}}const H_=42,ha=256,ca=0;class q_ extends Kt{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=ro(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&&tf(),t.center&&(t.center=Wt(t.center,this.projection_)),t.extent&&(t.extent=me(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const a in le)delete e[a];this.setProperties(e,!0);const n=Q_(t);this.maxResolution_=n.maxResolution,this.minResolution_=n.minResolution,this.zoomFactor_=n.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=n.minZoom;const s=J_(t),r=n.constraint,o=tm(t);this.constraints_={center:s,resolution:r,rotation:o},this.setRotation(t.rotation!==void 0?t.rotation:0),this.setCenterInternal(t.center!==void 0?t.center:null),t.resolution!==void 0?this.setResolution(t.resolution):t.zoom!==void 0&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;const n=this.getCenterInternal();if(n){const s=t||[0,0,0,0];e=e||[0,0,0,0];const r=this.getResolution(),o=r/2*(s[3]-e[3]+e[1]-s[1]),a=r/2*(s[0]-e[0]+e[2]-s[2]);this.setCenterInternal([n[0]+o,n[1]-a])}}getUpdatedOptions_(t){const e=this.getProperties();return e.resolution!==void 0?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const e=new Array(arguments.length);for(let n=0;n<e.length;++n){let s=arguments[n];s.center&&(s=Object.assign({},s),s.center=Wt(s.center,this.getProjection())),s.anchor&&(s=Object.assign({},s),s.anchor=Wt(s.anchor,this.getProjection())),e[n]=s}this.animateInternal.apply(this,e)}animateInternal(t){let e=arguments.length,n;e>1&&typeof arguments[e-1]=="function"&&(n=arguments[e-1],--e);let s=0;for(;s<e&&!this.isDef();++s){const c=arguments[s];c.center&&this.setCenterInternal(c.center),c.zoom!==void 0?this.setZoom(c.zoom):c.resolution&&this.setResolution(c.resolution),c.rotation!==void 0&&this.setRotation(c.rotation)}if(s===e){n&&or(n,!0);return}let r=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_;const h=[];for(;s<e;++s){const c=arguments[s],u={start:r,complete:!1,anchor:c.anchor,duration:c.duration!==void 0?c.duration:1e3,easing:c.easing||Zo,callback:n};if(c.center&&(u.sourceCenter=o,u.targetCenter=c.center.slice(),o=u.targetCenter),c.zoom!==void 0?(u.sourceResolution=a,u.targetResolution=this.getResolutionForZoom(c.zoom),a=u.targetResolution):c.resolution&&(u.sourceResolution=a,u.targetResolution=c.resolution,a=u.targetResolution),c.rotation!==void 0){u.sourceRotation=l;const d=un(c.rotation-l+Math.PI,2*Math.PI)-Math.PI;u.targetRotation=l+d,l=u.targetRotation}em(u)?u.complete=!0:r+=u.duration,h.push(u)}this.animations_.push(h),this.setHint(rt.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[rt.ANIMATING]>0}getInteracting(){return this.hints_[rt.INTERACTING]>0}cancelAnimations(){this.setHint(rt.ANIMATING,-this.hints_[rt.ANIMATING]);let t;for(let e=0,n=this.animations_.length;e<n;++e){const s=this.animations_[e];if(s[0].callback&&or(s[0].callback,!1),!t)for(let r=0,o=s.length;r<o;++r){const a=s[r];if(!a.complete){t=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const t=Date.now();let e=!1;for(let n=this.animations_.length-1;n>=0;--n){const s=this.animations_[n];let r=!0;for(let o=0,a=s.length;o<a;++o){const l=s[o];if(l.complete)continue;const h=t-l.start;let c=l.duration>0?h/l.duration:1;c>=1?(l.complete=!0,c=1):r=!1;const u=l.easing(c);if(l.sourceCenter){const d=l.sourceCenter[0],f=l.sourceCenter[1],g=l.targetCenter[0],_=l.targetCenter[1];this.nextCenter_=l.targetCenter;const m=d+u*(g-d),p=f+u*(_-f);this.targetCenter_=[m,p]}if(l.sourceResolution&&l.targetResolution){const d=u===1?l.targetResolution:l.sourceResolution+u*(l.targetResolution-l.sourceResolution);if(l.anchor){const f=this.getViewportSize_(this.getRotation()),g=this.constraints_.resolution(d,0,f,!0);this.targetCenter_=this.calculateCenterZoom(g,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=d,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){const d=u===1?un(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+u*(l.targetRotation-l.sourceRotation);if(l.anchor){const f=this.constraints_.rotation(d,!0);this.targetCenter_=this.calculateCenterRotate(f,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=d}if(this.applyTargetState_(!0),e=!0,!l.complete)break}if(r){this.animations_[n]=null,this.setHint(rt.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const o=s[0].callback;o&&or(o,!0)}}this.animations_=this.animations_.filter(Boolean),e&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let n;const s=this.getCenterInternal();return s!==void 0&&(n=[s[0]-e[0],s[1]-e[1]],Zr(n,t-this.getRotation()),Pl(n,e)),n}calculateCenterZoom(t,e){let n;const s=this.getCenterInternal(),r=this.getResolution();if(s!==void 0&&r!==void 0){const o=e[0]-t*(e[0]-s[0])/r,a=e[1]-t*(e[1]-s[1])/r;n=[o,a]}return n}getViewportSize_(t){const e=this.viewportSize_;if(t){const n=e[0],s=e[1];return[Math.abs(n*Math.cos(t))+Math.abs(s*Math.sin(t)),Math.abs(n*Math.sin(t))+Math.abs(s*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&&lo(t,this.getProjection())}getCenterInternal(){return this.get(le.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return t!==void 0?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){const e=this.calculateExtentInternal(t);return ho(e,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();J(e,"The view center is not defined");const n=this.getResolution();J(n!==void 0,"The view resolution is not defined");const s=this.getRotation();return J(s!==void 0,"The view rotation is not defined"),Ts(e,n,s,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(le.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(me(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const n=K(t)/e[0],s=ut(t)/e[1];return Math.max(n,s)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,s=Math.log(e/n)/Math.log(t);return function(r){return e/Math.pow(t,r*s)}}getRotation(){return this.get(le.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),n=this.getConstrainedResolution(this.maxResolution_),s=this.minResolution_,r=Math.log(n/s)/e;return function(o){return Math.log(n/o)/e/r}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const n=this.padding_;return n&&(e=[e[0]-n[1]-n[3],e[1]-n[0]-n[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),n=this.getRotation();let s=this.getCenterInternal();const r=this.padding_;if(r){const o=this.getViewportSizeMinusPadding_();s=ua(s,this.getViewportSize_(),[o[0]/2+r[3],o[1]/2+r[0]],e,n)}return{center:s.slice(0),projection:t!==void 0?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:n,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return e!==void 0&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e=this.minZoom_||0,n,s;if(this.resolutions_){const r=vs(this.resolutions_,t,1);e=r,n=this.resolutions_[r],r==this.resolutions_.length-1?s=2:s=n/this.resolutions_[r+1]}else n=this.maxResolution_,s=this.zoomFactor_;return e+Math.log(n/t)/Math.log(s)}getResolutionForZoom(t){var e;if((e=this.resolutions_)!=null&&e.length){if(this.resolutions_.length===1)return this.resolutions_[0];const n=ot(Math.floor(t),0,this.resolutions_.length-2),s=this.resolutions_[n]/this.resolutions_[n+1];return this.resolutions_[n]/Math.pow(s,ot(t-n,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let n;if(J(Array.isArray(t)||typeof t.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){J(!Bn(t),"Cannot fit empty extent provided as `geometry`");const s=me(t,this.getProjection());n=xc(s)}else if(t.getType()==="Circle"){const s=me(t.getExtent(),this.getProjection());n=xc(s),n.rotate(this.getRotation(),ie(s))}else n=t;this.fitInternal(n,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),n=Math.cos(e),s=Math.sin(-e),r=t.getFlatCoordinates(),o=t.getStride();let a=1/0,l=1/0,h=-1/0,c=-1/0;for(let u=0,d=r.length;u<d;u+=o){const f=r[u]*n-r[u+1]*s,g=r[u]*s+r[u+1]*n;a=Math.min(a,f),l=Math.min(l,g),h=Math.max(h,f),c=Math.max(c,g)}return[a,l,h,c]}fitInternal(t,e){e=e||{};let n=e.size;n||(n=this.getViewportSizeMinusPadding_());const s=e.padding!==void 0?e.padding:[0,0,0,0],r=e.nearest!==void 0?e.nearest:!1;let o;e.minResolution!==void 0?o=e.minResolution:e.maxZoom!==void 0?o=this.getResolutionForZoom(e.maxZoom):o=0;const a=this.rotatedExtentForGeometry(t);let l=this.getResolutionForExtentInternal(a,[n[0]-s[1]-s[3],n[1]-s[0]-s[2]]);l=isNaN(l)?o:Math.max(l,o),l=this.getConstrainedResolution(l,r?0:1);const h=this.getRotation(),c=Math.sin(h),u=Math.cos(h),d=ie(a);d[0]+=(s[1]-s[3])/2*l,d[1]+=(s[0]-s[2])/2*l;const f=d[0]*u-d[1]*c,g=d[1]*u+d[0]*c,_=this.getConstrainedCenter([f,g],l),m=e.callback?e.callback:Gi;e.duration!==void 0?this.animateInternal({resolution:l,center:_,duration:e.duration,easing:e.easing},m):(this.targetResolution_=l,this.targetCenter_=_,this.applyTargetState_(!1,!0),or(m,!0))}centerOn(t,e,n){this.centerOnInternal(Wt(t,this.getProjection()),e,n)}centerOnInternal(t,e,n){this.setCenterInternal(ua(t,e,n,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,n,s){let r;const o=this.padding_;if(o&&t){const a=this.getViewportSizeMinusPadding_(-n),l=ua(t,s,[a[0]/2+o[3],a[1]/2+o[0]],e,n);r=[t[0]-l[0],t[1]-l[1]]}return r}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(t){const e=lo(this.targetCenter_,this.getProjection());this.setCenter([e[0]+t[0],e[1]+t[1]])}adjustCenterInternal(t){const e=this.targetCenter_;this.setCenterInternal([e[0]+t[0],e[1]+t[1]])}adjustResolution(t,e){e=e&&Wt(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const n=this.getAnimating()||this.getInteracting(),s=this.getViewportSize_(this.getRotation()),r=this.constraints_.resolution(this.targetResolution_*t,0,s,n);e&&(this.targetCenter_=this.calculateCenterZoom(r,e)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=Wt(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const n=this.getAnimating()||this.getInteracting(),s=this.constraints_.rotation(this.targetRotation_+t,n);e&&(this.targetCenter_=this.calculateCenterRotate(s,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t&&Wt(t,this.getProjection()))}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){const n=this.getAnimating()||this.getInteracting()||e,s=this.constraints_.rotation(this.targetRotation_,n),r=this.getViewportSize_(s),o=this.constraints_.resolution(this.targetResolution_,0,r,n),a=this.constraints_.center(this.targetCenter_,o,r,n,this.calculateCenterShift(this.targetCenter_,o,s,r));this.get(le.ROTATION)!==s&&this.set(le.ROTATION,s),this.get(le.RESOLUTION)!==o&&(this.set(le.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(le.CENTER)||!Ls(this.get(le.CENTER),a))&&this.set(le.CENTER,a),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,n){t=t!==void 0?t:200;const s=e||0,r=this.constraints_.rotation(this.targetRotation_),o=this.getViewportSize_(r),a=this.constraints_.resolution(this.targetResolution_,s,o),l=this.constraints_.center(this.targetCenter_,a,o,!1,this.calculateCenterShift(this.targetCenter_,a,r,o));if(t===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=r,this.targetCenter_=l,this.applyTargetState_();return}n=n||(t===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==r||!this.getCenterInternal()||!Ls(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:r,center:l,resolution:a,duration:t,easing:Rn,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(rt.INTERACTING,1)}endInteraction(t,e,n){n=n&&Wt(n,this.getProjection()),this.endInteractionInternal(t,e,n)}endInteractionInternal(t,e,n){this.getInteracting()&&(this.setHint(rt.INTERACTING,-1),this.resolveConstraints(t,e,n))}getConstrainedCenter(t,e){const n=this.getViewportSize_(this.getRotation());return this.constraints_.center(t,e||this.getResolution(),n)}getConstrainedZoom(t,e){const n=this.getResolutionForZoom(t);return this.getZoomForResolution(this.getConstrainedResolution(n,e))}getConstrainedResolution(t,e){e=e||0;const n=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(t,e,n)}}function or(i,t){setTimeout(function(){i(t)},0)}function J_(i){if(i.extent!==void 0){const e=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return oc(i.extent,i.constrainOnlyCenter,e)}const t=ro(i.projection,"EPSG:3857");if(i.multiWorld!==!0&&t.isGlobal()){const e=t.getExtent().slice();return e[0]=-1/0,e[2]=1/0,oc(e,!1,!1)}return D_}function Q_(i){let t,e,n,o=i.minZoom!==void 0?i.minZoom:ca,a=i.maxZoom!==void 0?i.maxZoom:28;const l=i.zoomFactor!==void 0?i.zoomFactor:2,h=i.multiWorld!==void 0?i.multiWorld:!1,c=i.smoothResolutionConstraint!==void 0?i.smoothResolutionConstraint:!0,u=i.showFullExtent!==void 0?i.showFullExtent:!1,d=ro(i.projection,"EPSG:3857"),f=d.getExtent();let g=i.constrainOnlyCenter,_=i.extent;if(!h&&!_&&d.isGlobal()&&(g=!1,_=f),i.resolutions!==void 0){const m=i.resolutions;e=m[o],n=m[a]!==void 0?m[a]:m[m.length-1],i.constrainResolution?t=U_(m,c,!g&&_,u):t=Ec(e,n,c,!g&&_,u)}else{const p=(f?Math.max(K(f),ut(f)):360*Mi.degrees/d.getMetersPerUnit())/ha/Math.pow(2,ca),y=p/Math.pow(2,28-ca);e=i.maxResolution,e!==void 0?o=0:e=p/Math.pow(l,o),n=i.minResolution,n===void 0&&(i.maxZoom!==void 0?i.maxResolution!==void 0?n=e/Math.pow(l,a):n=p/Math.pow(l,a):n=y),a=o+Math.floor(Math.log(e/n)/Math.log(l)),n=e/Math.pow(l,a-o),i.constrainResolution?t=K_(l,e,n,c,!g&&_,u):t=Ec(e,n,c,!g&&_,u)}return{constraint:t,maxResolution:e,minResolution:n,minZoom:o,zoomFactor:l}}function tm(i){if(i.enableRotation!==void 0?i.enableRotation:!0){const e=i.constrainRotation;return e===void 0||e===!0?Z_():e===!1?Cc:typeof e=="number"?$_(e):Cc}return la}function em(i){return!(i.sourceCenter&&i.targetCenter&&!Ls(i.sourceCenter,i.targetCenter)||i.sourceResolution!==i.targetResolution||i.sourceRotation!==i.targetRotation)}function ua(i,t,e,n,s){const r=Math.cos(-s);let o=Math.sin(-s),a=i[0]*r-i[1]*o,l=i[1]*r+i[0]*o;a+=(t[0]/2-e[0])*n,l+=(e[1]-t[1]/2)*n,o=-o;const h=a*r-l*o,c=l*r+a*o;return[h,c]}const ce=q_,et={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};class nm extends Kt{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);typeof t.properties=="object"&&(delete e.properties,Object.assign(e,t.properties)),e[et.OPACITY]=t.opacity!==void 0?t.opacity:1,J(typeof e[et.OPACITY]=="number","Layer opacity must be a number"),e[et.VISIBLE]=t.visible!==void 0?t.visible:!0,e[et.Z_INDEX]=t.zIndex,e[et.MAX_RESOLUTION]=t.maxResolution!==void 0?t.maxResolution:1/0,e[et.MIN_RESOLUTION]=t.minResolution!==void 0?t.minResolution:0,e[et.MIN_ZOOM]=t.minZoom!==void 0?t.minZoom:-1/0,e[et.MAX_ZOOM]=t.maxZoom!==void 0?t.maxZoom:1/0,this.className_=e.className!==void 0?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:t===void 0?!0:t},n=this.getZIndex();return e.opacity=ot(Math.round(this.getOpacity()*100)/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=n===void 0&&!e.managed?1/0:n,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return j()}getLayerStatesArray(t){return j()}getExtent(){return this.get(et.EXTENT)}getMaxResolution(){return this.get(et.MAX_RESOLUTION)}getMinResolution(){return this.get(et.MIN_RESOLUTION)}getMinZoom(){return this.get(et.MIN_ZOOM)}getMaxZoom(){return this.get(et.MAX_ZOOM)}getOpacity(){return this.get(et.OPACITY)}getSourceState(){return j()}getVisible(){return this.get(et.VISIBLE)}getZIndex(){return this.get(et.Z_INDEX)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(et.EXTENT,t)}setMaxResolution(t){this.set(et.MAX_RESOLUTION,t)}setMinResolution(t){this.set(et.MIN_RESOLUTION,t)}setMaxZoom(t){this.set(et.MAX_ZOOM,t)}setMinZoom(t){this.set(et.MIN_ZOOM,t)}setOpacity(t){J(typeof t=="number","Layer opacity must be a number"),this.set(et.OPACITY,t)}setVisible(t){this.set(et.VISIBLE,t)}setZIndex(t){this.set(et.Z_INDEX,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}const as=nm;class im 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(et.SOURCE,this.handleSourcePropertyChange_);const n=t.source?t.source:null;this.setSource(n)}getLayersArray(t){return t=t||[],t.push(this),t}getLayerStatesArray(t){return t=t||[],t.push(this.getLayerState()),t}getSource(){return this.get(et.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(it(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=$(t,z.CHANGE,this.handleSourceChange_,this),t.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return!this.renderer_||!this.rendered?null:this.renderer_.getData(t)}isVisible(t){let e;const n=this.getMapInternal();!t&&n&&(t=n.getView()),t instanceof ce?e={viewState:t.getState(),extent:t.calculateExtent()}:e=t,!e.layerStatesArray&&n&&(e.layerStatesArray=n.getLayerGroup().getLayerStatesArray());let s;if(e.layerStatesArray){if(s=e.layerStatesArray.find(o=>o.layer===this),!s)return!1}else s=this.getLayerState();const r=this.getExtent();return da(s,e.viewState)&&(!r||Ct(r,e.extent))}getAttributions(t){var r;if(!this.isVisible(t))return[];const e=(r=this.getSource())==null?void 0:r.getAttributions();if(!e)return[];const n=t instanceof ce?t.getViewStateAndExtent():t;let s=e(n);return Array.isArray(s)||(s=[s]),s}render(t,e){const n=this.getRenderer();return n.prepareFrame(t)?(this.rendered=!0,n.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(et.MAP,t)}getMapInternal(){return this.get(et.MAP)}setMap(t){this.mapPrecomposeKey_&&(it(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(it(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=$(t,Vt.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=$(this,z.CHANGE,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState.layerStatesArray,n=this.getLayerState(!1);J(!e.some(s=>s.layer===n.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(n)}setSource(t){this.set(et.SOURCE,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()}}function da(i,t){if(!i.visible)return!1;const e=t.resolution;if(e<i.minResolution||e>=i.maxResolution)return!1;const n=t.zoom;return n>i.minZoom&&n<=i.maxZoom}const ls=im,wc={RENDER_ORDER:"renderOrder"};class sm extends ls{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_=t.renderBuffer!==void 0?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=t.updateWhileAnimating!==void 0?t.updateWhileAnimating:!1,this.updateWhileInteracting_=t.updateWhileInteracting!==void 0?t.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(wc.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){const n=this.getDeclutter();n in t.declutter||(t.declutter[n]=new Wh(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(wc.RENDER_ORDER,t)}setStyle(t){this.style_=t===void 0?Mh:t;const e=rm(t);this.styleFunction_=t===null?void 0:gg(e),this.changed()}setDeclutter(t){this.declutter_=t?String(t):void 0,this.changed()}}function rm(i){if(i===void 0)return Mh;if(!i)return null;if(typeof i=="function"||i instanceof $t)return i;if(!Array.isArray(i))return Jh([i]);if(i.length===0)return[];const t=i.length,e=i[0];if(e instanceof $t){const s=new Array(t);for(let r=0;r<t;++r){const o=i[r];if(!(o instanceof $t))throw new Error("Expected a list of style instances");s[r]=o}return s}if("style"in e){const s=new Array(t);for(let r=0;r<t;++r){const o=i[r];if(!("style"in o))throw new Error("Expected a list of rules with a style property");s[r]=o}return C_(s)}return Jh(i)}const vc=sm;class om extends vc{constructor(t){super(t)}createRenderer(){return new Yg(this)}}const Fe=om,kt={ADD:"add",REMOVE:"remove"},Rc={LENGTH:"length"};class ar extends se{constructor(t,e,n){super(t),this.element=e,this.index=n}}class am extends Kt{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t??[],this.unique_)for(let n=1,s=this.array_.length;n<s;++n)this.assertUnique_(this.array_[n],n);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(t){for(let e=0,n=t.length;e<n;++e)this.push(t[e]);return this}forEach(t){const e=this.array_;for(let n=0,s=e.length;n<s;++n)t(e[n],n,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(Rc.LENGTH)}insertAt(t,e){if(t<0||t>this.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new ar(kt.ADD,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let n=0,s=e.length;n<s;++n)if(e[n]===t)return this.removeAt(n)}removeAt(t){if(t<0||t>=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new ar(kt.REMOVE,e,t)),e}setAt(t,e){const n=this.getLength();if(t>=n){this.insertAt(t,e);return}if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const s=this.array_[t];this.array_[t]=e,this.dispatchEvent(new ar(kt.REMOVE,s,t)),this.dispatchEvent(new ar(kt.ADD,e,t))}updateLength_(){this.set(Rc.LENGTH,this.array_.length)}assertUnique_(t,e){const n=this.array_;for(let s=0,r=n.length;s<r;++s)if(n[s]===t&&s!==e)throw new Error("Duplicate item added to a unique collection")}}const Ht=am;let lm=!1;function hm(i,t,e,n,s,r,o){const a=new XMLHttpRequest;a.open("GET",typeof i=="function"?i(e,n,s):i,!0),t.getType()=="arraybuffer"&&(a.responseType="arraybuffer"),a.withCredentials=lm,a.onload=function(l){if(!a.status||a.status>=200&&a.status<300){const h=t.getType();try{let c;h=="text"||h=="json"?c=a.responseText:h=="xml"?c=a.responseXML||a.responseText:h=="arraybuffer"&&(c=a.response),c?r(t.readFeatures(c,{extent:e,featureProjection:s}),t.readProjection(c)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function Tc(i,t){return function(e,n,s,r,o){hm(i,t,e,n,s,(a,l)=>{this.addFeatures(a),r!==void 0&&r(a)},()=>{this.changed(),o!==void 0&&o()})}}function cm(i,t){return[[-1/0,-1/0,1/0,1/0]]}class fa extends Kt{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(typeof t.getSimplifiedGeometry=="function"){const e=t;this.setGeometry(e)}else{const e=t;this.setProperties(e)}}clone(){const t=new fa(this.hasProperties()?this.getProperties():null);t.setGeometryName(this.getGeometryName());const e=this.getGeometry();e&&t.setGeometry(e.clone());const n=this.getStyle();return n&&t.setStyle(n),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_&&(it(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=$(t,z.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?um(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}}function um(i){if(typeof i=="function")return i;let t;return Array.isArray(i)?t=i:(J(typeof i.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),t=[i]),function(){return t}}const zt=fa;function Sc(i,t,e,n){const s=[];let r=Mt();for(let o=0,a=e.length;o<a;++o){const l=e[o];r=Vr(i,t,l[0],n),s.push((r[0]+r[2])/2,(r[1]+r[3])/2),t=l[l.length-1]}return s}function lr(i,t,e,n,s,r,o){let a,l;const h=(e-t)/n;if(h===1)a=t;else if(h===2)a=t,l=s;else if(h!==0){let c=i[t],u=i[t+1],d=0;const f=[0];for(let m=t+n;m<e;m+=n){const p=i[m],y=i[m+1];d+=Math.sqrt((p-c)*(p-c)+(y-u)*(y-u)),f.push(d),c=p,u=y}const g=s*d,_=hd(f,g);_<0?(l=(g-f[-_-2])/(f[-_-1]-f[-_-2]),a=t+(-_-2)*n):a=t+_*n}o=o>1?o:2,r=r||new Array(o);for(let c=0;c<o;++c)r[c]=a===void 0?NaN:l===void 0?i[a+c]:Gt(i[a+c],i[a+n+c],l);return r}function ga(i,t,e,n,s,r){if(e==t)return null;let o;if(s<i[t+n-1])return r?(o=i.slice(t,t+n),o[n-1]=s,o):null;if(i[e-1]<s)return r?(o=i.slice(e-n,e),o[n-1]=s,o):null;if(s==i[t+n-1])return i.slice(t,t+n);let a=t/n,l=e/n;for(;a<l;){const d=a+l>>1;s<i[(d+1)*n-1]?l=d:a=d+1}const h=i[a*n-1];if(s==h)return i.slice((a-1)*n,(a-1)*n+n);const c=i[(a+1)*n-1],u=(s-h)/(c-h);o=[];for(let d=0;d<n-1;++d)o.push(Gt(i[(a-1)*n+d],i[a*n+d],u));return o.push(s),o}function dm(i,t,e,n,s,r,o){if(o)return ga(i,t,e[e.length-1],n,s,r);let a;if(s<i[n-1])return r?(a=i.slice(0,n),a[n-1]=s,a):null;if(i[i.length-1]<s)return r?(a=i.slice(i.length-n),a[n-1]=s,a):null;for(let l=0,h=e.length;l<h;++l){const c=e[l];if(t!=c){if(s<i[t+n-1])return null;if(s<=i[c-1])return ga(i,t,c,n,s,!1);t=c}}return null}class hr extends Qe{constructor(t,e,n){super(),n!==void 0&&e===void 0?this.setFlatCoordinates(n,t):(e=e||0,this.setCenterAndRadius(t,e,n))}clone(){const t=new hr(this.flatCoordinates.slice(),void 0,this.layout);return t.applyProperties(this),t}closestPointXY(t,e,n,s){const r=this.flatCoordinates,o=t-r[0],a=e-r[1],l=o*o+a*a;if(l<s){if(l===0)for(let h=0;h<this.stride;++h)n[h]=r[h];else{const h=this.getRadius()/Math.sqrt(l);n[0]=r[0]+h*o,n[1]=r[1]+h*a;for(let c=2;c<this.stride;++c)n[c]=r[c]}return n.length=this.stride,l}return s}containsXY(t,e){const n=this.flatCoordinates,s=t-n[0],r=e-n[1];return s*s+r*r<=this.getRadiusSquared_()}getCenter(){return this.flatCoordinates.slice(0,this.stride)}computeExtent(t){const e=this.flatCoordinates,n=e[this.stride]-e[0];return Te(e[0]-n,e[1]-n,e[0]+n,e[1]+n,t)}getRadius(){return Math.sqrt(this.getRadiusSquared_())}getRadiusSquared_(){const t=this.flatCoordinates[this.stride]-this.flatCoordinates[0],e=this.flatCoordinates[this.stride+1]-this.flatCoordinates[1];return t*t+e*e}getType(){return"Circle"}intersectsExtent(t){const e=this.getExtent();if(Ct(t,e)){const n=this.getCenter();return t[0]<=n[0]&&t[2]>=n[0]||t[1]<=n[1]&&t[3]>=n[1]?!0:Ur(t,this.intersectsCoordinate.bind(this))}return!1}setCenter(t){const e=this.stride,n=this.flatCoordinates[e]-this.flatCoordinates[0],s=t.slice();s[e]=s[0]+n;for(let r=1;r<e;++r)s[e+r]=t[r];this.setFlatCoordinates(this.layout,s),this.changed()}setCenterAndRadius(t,e,n){this.setLayout(n,t,0),this.flatCoordinates||(this.flatCoordinates=[]);const s=this.flatCoordinates;let r=uc(s,0,t,this.stride);s[r++]=s[0]+e;for(let o=1,a=this.stride;o<a;++o)s[r++]=s[o];s.length=r,this.changed()}getCoordinates(){return null}setCoordinates(t,e){}setRadius(t){this.flatCoordinates[this.stride]=this.flatCoordinates[0]+t,this.changed()}rotate(t,e){const n=this.getCenter(),s=this.getStride();this.setCenter(Lo(n,0,n.length,s,t,e,n)),this.changed()}}hr.prototype.transform;const fm=hr;class cr extends Fh{constructor(t){super(),this.geometries_=t,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(it),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const t=this.geometries_;for(let e=0,n=t.length;e<n;++e)this.changeEventsKeys_.push($(t[e],z.CHANGE,this.changed,this))}clone(){const t=new cr(_a(this.geometries_));return t.applyProperties(this),t}closestPointXY(t,e,n,s){if(s<hn(this.getExtent(),t,e))return s;const r=this.geometries_;for(let o=0,a=r.length;o<a;++o)s=r[o].closestPointXY(t,e,n,s);return s}containsXY(t,e){const n=this.geometries_;for(let s=0,r=n.length;s<r;++s)if(n[s].containsXY(t,e))return!0;return!1}computeExtent(t){Ii(t);const e=this.geometries_;for(let n=0,s=e.length;n<s;++n)wl(t,e[n].getExtent());return t}getGeometries(){return _a(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let t=[];const e=this.geometries_;for(let n=0,s=e.length;n<s;++n)e[n].getType()===this.getType()?t=t.concat(e[n].getGeometriesArrayRecursive()):t.push(e[n]);return t}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&t<this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=[],n=this.geometries_;let s=!1;for(let r=0,o=n.length;r<o;++r){const a=n[r],l=a.getSimplifiedGeometry(t);e.push(l),l!==a&&(s=!0)}return s?new cr(e):(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getType(){return"GeometryCollection"}intersectsExtent(t){const e=this.geometries_;for(let n=0,s=e.length;n<s;++n)if(e[n].intersectsExtent(t))return!0;return!1}isEmpty(){return this.geometries_.length===0}rotate(t,e){const n=this.geometries_;for(let s=0,r=n.length;s<r;++s)n[s].rotate(t,e);this.changed()}scale(t,e,n){n||(n=ie(this.getExtent()));const s=this.geometries_;for(let r=0,o=s.length;r<o;++r)s[r].scale(t,e,n);this.changed()}setGeometries(t){this.setGeometriesArray(_a(t))}setGeometriesArray(t){this.unlistenGeometriesChange_(),this.geometries_=t,this.listenGeometriesChange_(),this.changed()}applyTransform(t){const e=this.geometries_;for(let n=0,s=e.length;n<s;++n)e[n].applyTransform(t);this.changed()}translate(t,e){const n=this.geometries_;for(let s=0,r=n.length;s<r;++s)n[s].translate(t,e);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}}function _a(i){return i.map(t=>t.clone())}const Ic=cr;class ur extends Qe{constructor(t,e){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,e!==void 0&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendCoordinate(t){ne(this.flatCoordinates,t),this.changed()}clone(){const t=new ur(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,n,s){return s<hn(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Ho(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Jo(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,e,n,s))}forEachSegment(t){return _c(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinateAtM(t,e){return this.layout!="XYM"&&this.layout!="XYZM"?null:(e=e!==void 0?e:!1,ga(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e))}getCoordinates(){return Ke(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return lr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return bo(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(t){const e=[];return e.length=Vs(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new ur(e,"XY")}getType(){return"LineString"}intersectsExtent(t){return sr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,this.getExtent())}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=nr(this.flatCoordinates,0,t,this.stride),this.changed()}}const Sn=ur;class dr extends Qe{constructor(t,e,n){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(t[0]))this.setCoordinates(t,e);else if(e!==void 0&&n)this.setFlatCoordinates(e,t),this.ends_=n;else{const s=t,r=[],o=[];for(let l=0,h=s.length;l<h;++l){const c=s[l];ne(r,c.getFlatCoordinates()),o.push(r.length)}const a=s.length===0?this.getLayout():s[0].getLayout();this.setFlatCoordinates(a,r),this.ends_=o}}appendLineString(t){ne(this.flatCoordinates,t.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new dr(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,n,s){return s<hn(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(qo(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Qo(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,t,e,n,s))}getCoordinateAtM(t,e,n){return this.layout!="XYM"&&this.layout!="XYZM"||this.flatCoordinates.length===0?null:(e=e!==void 0?e:!1,n=n!==void 0?n:!1,dm(this.flatCoordinates,0,this.ends_,this.stride,t,e,n))}getCoordinates(){return Xi(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(t){return t<0||this.ends_.length<=t?null:new Sn(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLineStrings(){const t=this.flatCoordinates,e=this.ends_,n=this.layout,s=[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o],h=new Sn(t.slice(r,l),n);s.push(h),r=l}return s}getLength(){const t=this.ends_;let e=0,n=0;for(let s=0,r=t.length;s<r;++s)n+=bo(this.flatCoordinates,e,t[s],this.stride),e=t[s];return n}getFlatMidpoints(){const t=[],e=this.flatCoordinates;let n=0;const s=this.ends_,r=this.stride;for(let o=0,a=s.length;o<a;++o){const l=s[o],h=lr(e,n,l,r,.5);ne(t,h),n=l}return t}getSimplifiedGeometryInternal(t){const e=[],n=[];return e.length=Eh(this.flatCoordinates,0,this.ends_,this.stride,t,e,0,n),new dr(e,"XY",n)}getType(){return"MultiLineString"}intersectsExtent(t){return X_(this.flatCoordinates,0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const n=os(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}}const ma=dr;class pa extends Qe{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){ne(this.flatCoordinates,t.getFlatCoordinates()),this.changed()}clone(){const t=new pa(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,n,s){if(s<hn(this.getExtent(),t,e))return s;const r=this.flatCoordinates,o=this.stride;for(let a=0,l=r.length;a<l;a+=o){const h=Ie(t,e,r[a],r[a+1]);if(h<s){s=h;for(let c=0;c<o;++c)n[c]=r[a+c];n.length=o}}return s}getCoordinates(){return Ke(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){const e=this.flatCoordinates.length/this.stride;return t<0||e<=t?null:new he(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)}getPoints(){const t=this.flatCoordinates,e=this.layout,n=this.stride,s=[];for(let r=0,o=t.length;r<o;r+=n){const a=new he(t.slice(r,r+n),e);s.push(a)}return s}getType(){return"MultiPoint"}intersectsExtent(t){const e=this.flatCoordinates,n=this.stride;for(let s=0,r=e.length;s<r;s+=n){const o=e[s],a=e[s+1];if(Br(t,o,a))return!0}return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=nr(this.flatCoordinates,0,t,this.stride),this.changed()}}const ya=pa;class fr extends Qe{constructor(t,e,n){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!n&&!Array.isArray(t[0])){const s=t,r=[],o=[];for(let a=0,l=s.length;a<l;++a){const h=s[a],c=r.length,u=h.getEnds();for(let d=0,f=u.length;d<f;++d)u[d]+=c;ne(r,h.getFlatCoordinates()),o.push(u)}e=s.length===0?this.getLayout():s[0].getLayout(),t=r,n=o}e!==void 0&&n?(this.setFlatCoordinates(e,t),this.endss_=n):this.setCoordinates(t,e)}appendPolygon(t){let e;if(!this.flatCoordinates)this.flatCoordinates=t.getFlatCoordinates().slice(),e=t.getEnds().slice(),this.endss_.push();else{const n=this.flatCoordinates.length;ne(this.flatCoordinates,t.getFlatCoordinates()),e=t.getEnds().slice();for(let s=0,r=e.length;s<r;++s)e[s]+=n}this.endss_.push(e),this.changed()}clone(){const t=this.endss_.length,e=new Array(t);for(let s=0;s<t;++s)e[s]=this.endss_[s].slice();const n=new fr(this.flatCoordinates.slice(),this.layout,e);return n.applyProperties(this),n}closestPointXY(t,e,n,s){return s<hn(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(N_(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),G_(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,t,e,n,s))}containsXY(t,e){return j_(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t,e)}getArea(){return k_(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),ra(e,0,this.endss_,this.stride,t)):e=this.flatCoordinates,wo(e,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const t=Sc(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=gc(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new ya(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;yc(t,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=ra(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],n=[];return e.length=Bf(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),e,0,n),new fr(e,"XY",n)}getPolygon(t){if(t<0||this.endss_.length<=t)return null;let e;if(t===0)e=0;else{const r=this.endss_[t-1];e=r[r.length-1]}const n=this.endss_[t].slice(),s=n[n.length-1];if(e!==0)for(let r=0,o=n.length;r<o;++r)n[r]-=e;return new Zt(this.flatCoordinates.slice(e,s),this.layout,n)}getPolygons(){const t=this.layout,e=this.flatCoordinates,n=this.endss_,s=[];let r=0;for(let o=0,a=n.length;o<a;++o){const l=n[o].slice(),h=l[l.length-1];if(r!==0)for(let u=0,d=l.length;u<d;++u)l[u]-=r;const c=new Zt(e.slice(r,h),t,l);s.push(c),r=h}return s}getType(){return"MultiPolygon"}intersectsExtent(t){return B_(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,3),this.flatCoordinates||(this.flatCoordinates=[]);const n=dc(this.flatCoordinates,0,t,this.stride,this.endss_);if(n.length===0)this.flatCoordinates.length=0;else{const s=n[n.length-1];this.flatCoordinates.length=s.length===0?0:s[s.length-1]}this.changed()}}const xa=fr,Lc=re();class ai{constructor(t,e,n,s,r,o){this.styleFunction,this.extent_,this.id_=o,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=n||null,this.properties_=r,this.squaredTolerance_,this.stride_=s,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?Wr(this.flatCoordinates_):Vr(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=ie(this.getExtent());this.flatInteriorPoints_=na(this.flatCoordinates_,0,this.ends_,2,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=W_(this.flatCoordinates_,this.ends_),e=Sc(this.flatCoordinates_,0,t,2);this.flatInteriorPoints_=gc(this.flatCoordinates_,0,t,2,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=lr(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const t=this.flatCoordinates_;let e=0;const n=this.ends_;for(let s=0,r=n.length;s<r;++s){const o=n[s],a=lr(t,e,o,2,.5);ne(this.flatMidpoints_,a),e=o}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(t){return this}simplifyTransformed(t,e){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(t){t=at(t);const e=t.getExtent(),n=t.getWorldExtent();if(e&&n){const s=ut(n)/ut(e);ye(Lc,n[0],n[3],s,-s,0,0,0),Ze(this.flatCoordinates_,0,this.flatCoordinates_.length,2,Lc,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){var t;return new ai(this.type_,this.flatCoordinates_.slice(),(t=this.ends_)==null?void 0:t.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=oh((t,e)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);const n=this.simplifiedGeometry_.getFlatCoordinates();let s;switch(this.type_){case"LineString":n.length=Vs(n,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,n,0),s=[n.length];break;case"MultiLineString":s=[],n.length=Eh(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,n,0,s);break;case"Polygon":s=[],n.length=Io(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),n,0,s);break}return s&&(this.simplifiedGeometry_=new ai(this.type_,n,s,2,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}}ai.prototype.getFlatCoordinates=ai.prototype.getOrientedFlatCoordinates;const en=ai;class gm{constructor(t){this.rbush_=new Wh(t),this.items_={}}insert(t,e){const n={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(n),this.items_[q(e)]=n}load(t,e){const n=new Array(e.length);for(let s=0,r=e.length;s<r;s++){const o=t[s],a=e[s],l={minX:o[0],minY:o[1],maxX:o[2],maxY:o[3],value:a};n[s]=l,this.items_[q(a)]=l}this.rbush_.load(n)}remove(t){const e=q(t),n=this.items_[e];return delete this.items_[e],this.rbush_.remove(n)!==null}update(t,e){const n=this.items_[q(e)],s=[n.minX,n.minY,n.maxX,n.maxY];jn(s,t)||(this.remove(e),this.insert(t,e))}getAll(){return this.rbush_.all().map(function(e){return e.value})}getInExtent(t){const e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.rbush_.search(e).map(function(s){return s.value})}forEach(t){return this.forEach_(this.getAll(),t)}forEachInExtent(t,e){return this.forEach_(this.getInExtent(t),e)}forEach_(t,e){let n;for(let s=0,r=t.length;s<r;s++)if(n=e(t[s]),n)return n;return n}isEmpty(){return gn(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return Te(e.minX,e.minY,e.maxX,e.maxY,t)}concat(t){this.rbush_.load(t.rbush_.all());for(const e in t.items_)this.items_[e]=t.items_[e]}}const Pc=gm;class _m extends Kt{constructor(t){super(),this.projection=at(t.projection),this.attributions_=bc(t.attributions),this.attributionsCollapsible_=t.attributionsCollapsible??!0,this.loading=!1,this.state_=t.state!==void 0?t.state:"ready",this.wrapX_=t.wrapX!==void 0?t.wrapX:!1,this.interpolate_=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;const e=this;this.viewPromise_=new Promise(function(n,s){e.viewResolver=n,e.viewRejector=s})}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_=bc(t),this.changed()}setState(t){this.state_=t,this.changed()}}function bc(i){return i?typeof i=="function"?i:(Array.isArray(i)||(i=[i]),t=>i):null}const Ea=_m,qt={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};class nn extends se{constructor(t,e,n){super(t),this.feature=e,this.features=n}}class mm extends Ea{constructor(t){t=t||{},super({attributions:t.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:t.wrapX!==void 0?t.wrapX:!0}),this.on,this.once,this.un,this.loader_=Gi,this.format_=t.format||null,this.overlaps_=t.overlaps===void 0?!0:t.overlaps,this.url_=t.url,t.loader!==void 0?this.loader_=t.loader:this.url_!==void 0&&(J(this.format_,"`format` must be set when `url` is set"),this.loader_=Tc(this.url_,this.format_)),this.strategy_=t.strategy!==void 0?t.strategy:cm;const e=t.useSpatialIndex!==void 0?t.useSpatialIndex:!0;this.featuresRtree_=e?new Pc:null,this.loadedExtentsRtree_=new Pc,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let n,s;Array.isArray(t.features)?s=t.features:t.features&&(n=t.features,s=n.getArray()),!e&&n===void 0&&(n=new Ht(s)),s!==void 0&&this.addFeaturesInternal(s),n!==void 0&&this.bindFeaturesCollection_(n)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=q(t);if(!this.addToIndex_(e,t)){this.featuresCollection_&&this.featuresCollection_.remove(t);return}this.setupChangeEvents_(e,t);const n=t.getGeometry();if(n){const s=n.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(s,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new nn(qt.ADDFEATURE,t))}setupChangeEvents_(t,e){e instanceof en||(this.featureChangeKeys_[t]=[$(e,z.CHANGE,this.handleFeatureChange_,this),$(e,qn.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(t,e){let n=!0;if(e.getId()!==void 0){const s=String(e.getId());if(!(s in this.idIndex_))this.idIndex_[s]=e;else if(e instanceof en){const r=this.idIndex_[s];r instanceof en?Array.isArray(r)?r.push(e):this.idIndex_[s]=[r,e]:n=!1}else n=!1}return n&&(J(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=e),n}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],n=[],s=[];for(let r=0,o=t.length;r<o;r++){const a=t[r],l=q(a);this.addToIndex_(l,a)&&n.push(a)}for(let r=0,o=n.length;r<o;r++){const a=n[r],l=q(a);this.setupChangeEvents_(l,a);const h=a.getGeometry();if(h){const c=h.getExtent();e.push(c),s.push(a)}else this.nullGeometryFeatures_[l]=a}if(this.featuresRtree_&&this.featuresRtree_.load(e,s),this.hasListener(qt.ADDFEATURE))for(let r=0,o=n.length;r<o;r++)this.dispatchEvent(new nn(qt.ADDFEATURE,n[r]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(qt.ADDFEATURE,function(n){e||(e=!0,t.push(n.feature),e=!1)}),this.addEventListener(qt.REMOVEFEATURE,function(n){e||(e=!0,t.remove(n.feature),e=!1)}),t.addEventListener(kt.ADD,n=>{e||(e=!0,this.addFeature(n.element),e=!1)}),t.addEventListener(kt.REMOVE,n=>{e||(e=!0,this.removeFeature(n.element),e=!1)}),this.featuresCollection_=t}clear(t){if(t){for(const n in this.featureChangeKeys_)this.featureChangeKeys_[n].forEach(it);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(n=>{this.removeFeatureInternal(n)});for(const n in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[n])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new nn(qt.CLEAR);this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){const n=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(n,function(s){const r=s.getGeometry();if(r instanceof en||r.intersectsCoordinate(t))return e(s)})}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,function(n){const s=n.getGeometry();if(s instanceof en||s.intersectsExtent(t)){const r=e(n);if(r)return r}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),gn(this.nullGeometryFeatures_)||ne(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,function(n){e.push(n)}),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);const s=Sl(t,e);return[].concat(...s.map(r=>this.featuresRtree_.getInExtent(r)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const n=t[0],s=t[1];let r=null;const o=[NaN,NaN];let a=1/0;const l=[-1/0,-1/0,1/0,1/0];return e=e||Zn,this.featuresRtree_.forEachInExtent(l,function(h){if(e(h)){const c=h.getGeometry(),u=a;if(a=c instanceof en?0:c.closestPointXY(n,s,o,a),a<u){r=h;const d=Math.sqrt(a);l[0]=n-d,l[1]=s-d,l[2]=n+d,l[3]=s+d}}}),r}getExtent(t){return this.featuresRtree_.getExtent(t)}getFeatureById(t){const e=this.idIndex_[t.toString()];return e!==void 0?e:null}getFeatureByUid(t){const e=this.uidIndex_[t];return e!==void 0?e:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(t){const e=t.target,n=q(e),s=e.getGeometry();if(!s)n in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(e),this.nullGeometryFeatures_[n]=e);else{const o=s.getExtent();n in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[n],this.featuresRtree_&&this.featuresRtree_.insert(o,e)):this.featuresRtree_&&this.featuresRtree_.update(o,e)}const r=e.getId();if(r!==void 0){const o=r.toString();this.idIndex_[o]!==e&&(this.removeFromIdIndex_(e),this.idIndex_[o]=e)}else this.removeFromIdIndex_(e),this.uidIndex_[n]=e;this.changed(),this.dispatchEvent(new nn(qt.CHANGEFEATURE,e))}hasFeature(t){const e=t.getId();return e!==void 0?e in this.idIndex_:q(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&gn(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(t,e,n){const s=this.loadedExtentsRtree_,r=this.strategy_(t,e,n);for(let o=0,a=r.length;o<a;++o){const l=r[o];s.forEachInExtent(l,function(c){return ge(c.extent,l)})||(++this.loadingExtentsCount_,this.dispatchEvent(new nn(qt.FEATURESLOADSTART)),this.loader_.call(this,l,e,n,c=>{--this.loadingExtentsCount_,this.dispatchEvent(new nn(qt.FEATURESLOADEND,void 0,c))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new nn(qt.FEATURESLOADERROR))}),s.insert(l,{extent:l.slice()}))}this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_,n=e.forEachInExtent(t,function(s){if(jn(s.extent,t))return s});n&&e.remove(n)}removeFeatures(t){let e=!1;for(let n=0,s=t.length;n<s;++n)e=this.removeFeatureInternal(t[n])||e;e&&this.changed()}removeFeature(t){if(!t)return;this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=q(t);if(!(e in this.uidIndex_))return!1;e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t);const n=this.featureChangeKeys_[e];n==null||n.forEach(it),delete this.featureChangeKeys_[e];const s=t.getId();if(s!==void 0){const r=s.toString(),o=this.idIndex_[r];o===t?delete this.idIndex_[r]:Array.isArray(o)&&(o.splice(o.indexOf(t),1),o.length===1&&(this.idIndex_[r]=o[0]))}return delete this.uidIndex_[e],this.hasListener(qt.REMOVEFEATURE)&&this.dispatchEvent(new nn(qt.REMOVEFEATURE,t)),!0}removeFromIdIndex_(t){for(const e in this.idIndex_)if(this.idIndex_[e]===t){delete this.idIndex_[e];break}}setLoader(t){this.loader_=t}setUrl(t){J(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader(Tc(t,this.format_))}setOverlaps(t){this.overlaps_=t,this.changed()}}const ke=mm;class pm extends se{constructor(t,e,n){super(t),this.map=e,this.frameState=n!==void 0?n:null}}const li=pm;class ym extends li{constructor(t,e,n,s,r,o){super(t,e,r),this.originalEvent=n,this.pixel_=null,this.coordinate_=null,this.dragging=s!==void 0?s:!1,this.activePointers=o}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(t){this.pixel_=t}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(t){this.coordinate_=t}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}}const Ne=ym,tt={SINGLECLICK:"singleclick",CLICK:z.CLICK,DBLCLICK:z.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},Ca={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};class xm extends zi{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=e===void 0?1:e,this.down_=null;const n=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=n,this.pointerdownListenerKey_=$(n,Ca.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=$(n,Ca.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(z.TOUCHMOVE,this.boundHandleTouchMove_,kl?{passive:!1}:!1)}emulateClick_(t){let e=new Ne(tt.CLICK,this.map_,t);this.dispatchEvent(e),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new Ne(tt.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const n=new Ne(tt.SINGLECLICK,this.map_,t);this.dispatchEvent(n)},250)}updateActivePointers_(t){const e=t,n=e.pointerId;if(e.type==tt.POINTERUP||e.type==tt.POINTERCANCEL){delete this.trackedTouches_[n];for(const s in this.trackedTouches_)if(this.trackedTouches_[s].target!==e.target){delete this.trackedTouches_[s];break}}else(e.type==tt.POINTERDOWN||e.type==tt.POINTERMOVE)&&(this.trackedTouches_[n]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new Ne(tt.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(it),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return t.button===0}handlePointerDown_(t){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(t);const e=new Ne(tt.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),this.dragListenerKeys_.length===0){const n=this.map_.getOwnerDocument();this.dragListenerKeys_.push($(n,tt.POINTERMOVE,this.handlePointerMove_,this),$(n,tt.POINTERUP,this.handlePointerUp_,this),$(this.element_,tt.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==n&&this.dragListenerKeys_.push($(this.element_.getRootNode(),tt.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new Ne(tt.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;const e=!!(this.down_&&this.isMoving_(t));this.dispatchEvent(new Ne(tt.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;(!e||e.defaultPrevented)&&(typeof t.cancelable!="boolean"||t.cancelable===!0)&&t.preventDefault()}isMoving_(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(it(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(z.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(it(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(it),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const Em=xm,Ge={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},vt={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},F={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4},gr=1/0;class Cm{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,Oi(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,n=t[0];t.length==1?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const s=this.keyFunction_(n);return delete this.queuedElements_[s],n}enqueue(t){J(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const e=this.priorityFunction_(t);return e!=gr?(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(t){return t*2+1}getRightChildIndex_(t){return t*2+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return this.elements_.length===0}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,n=this.priorities_,s=e.length,r=e[t],o=n[t],a=t;for(;t<s>>1;){const l=this.getLeftChildIndex_(t),h=this.getRightChildIndex_(t),c=h<s&&n[h]<n[l]?h:l;e[t]=e[c],n[t]=n[c],t=c}e[t]=r,n[t]=o,this.siftDown_(a,t)}siftDown_(t,e){const n=this.elements_,s=this.priorities_,r=n[e],o=s[e];for(;e>t;){const a=this.getParentIndex_(e);if(s[a]>o)n[e]=n[a],s[e]=s[a],e=a;else break}n[e]=r,s[e]=o}reprioritize(){const t=this.priorityFunction_,e=this.elements_,n=this.priorities_;let s=0;const r=e.length;let o,a,l;for(a=0;a<r;++a)o=e[a],l=t(o),l==gr?delete this.queuedElements_[this.keyFunction_(o)]:(n[s]=l,e[s++]=o);e.length=s,n.length=s,this.heapify_()}}const wm=Cm;class vm extends wm{constructor(t,e){super(n=>t.apply(null,n),n=>n[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){const e=super.enqueue(t);return e&&t[0].addEventListener(z.CHANGE,this.boundHandleTileChange_),e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,n=e.getState();if(n===F.LOADED||n===F.ERROR||n===F.EMPTY){n!==F.ERROR&&e.removeEventListener(z.CHANGE,this.boundHandleTileChange_);const s=e.getKey();s in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[s],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let n=0;for(;this.tilesLoading_<t&&n<e&&this.getCount()>0;){const s=this.dequeue()[0],r=s.getKey();s.getState()===F.IDLE&&!(r in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[r]=!0,++this.tilesLoading_,++n,s.load())}}}const Rm=vm;function Tm(i,t,e,n,s){if(!i||!(e in i.wantedTiles)||!i.wantedTiles[e][t.getKey()])return gr;const r=i.viewState.center,o=n[0]-r[0],a=n[1]-r[1];return 65536*Math.log(s)+Math.sqrt(o*o+a*a)/s}class Sm extends Kt{constructor(t){super();const e=t.element;e&&!t.target&&!e.style.pointerEvents&&(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){var t;(t=this.element)==null||t.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(t){var e;this.map_&&((e=this.element)==null||e.remove());for(let n=0,s=this.listenerKeys.length;n<s;++n)it(this.listenerKeys[n]);if(this.listenerKeys.length=0,this.map_=t,t){const n=this.target_??t.getOverlayContainerStopEvent();this.element&&n.appendChild(this.element),this.render!==Gi&&this.listenerKeys.push($(t,Ge.POSTRENDER,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_=typeof t=="string"?document.getElementById(t):t}}const wa=Sm;class Im extends wa{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=t.collapsed!==void 0?t.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=t.collapsible!==void 0,this.collapsible_=t.collapsible!==void 0?t.collapsible:!0,this.collapsible_||(this.collapsed_=!1),this.attributions_=t.attributions;const e=t.className!==void 0?t.className:"ol-attribution",n=t.tipLabel!==void 0?t.tipLabel:"Attributions",s=t.expandClassName!==void 0?t.expandClassName:e+"-expand",r=t.collapseLabel!==void 0?t.collapseLabel:"›",o=t.collapseClassName!==void 0?t.collapseClassName:e+"-collapse";typeof r=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=r,this.collapseLabel_.className=o):this.collapseLabel_=r;const a=t.label!==void 0?t.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=s):this.label_=a;const l=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=n,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener(z.CLICK,this.handleClick_.bind(this),!1);const h=e+" "+Bs+" "+vo+(this.collapsed_&&this.collapsible_?" "+dh:"")+(this.collapsible_?"":" ol-uncollapsible"),c=this.element;c.className=h,c.appendChild(this.toggleButton_),c.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){const e=this.getMap().getAllLayers(),n=new Set(e.flatMap(s=>s.getAttributions(t)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(s=>n.add(s)):n.add(this.attributions_)),!this.overrideCollapsible_){const s=!e.some(r=>{var o;return((o=r.getSource())==null?void 0:o.getAttributionsCollapsible())===!1});this.setCollapsible(s)}return Array.from(n)}async updateElement_(t){if(!t){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}const e=await Promise.all(this.collectSourceAttributions_(t).map(s=>ah(()=>s))),n=e.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!Be(e,this.renderedAttributions_)){Gl(this.ulElement_);for(let s=0,r=e.length;s<r;++s){const o=document.createElement("li");o.innerHTML=e[s],this.ulElement_.appendChild(o)}this.renderedAttributions_=e}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(dh),this.collapsed_?Nl(this.collapseLabel_,this.label_):Nl(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(t){this.userCollapsed_=t,!(!this.collapsible_||this.collapsed_===t)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(t){this.updateElement_(t.frameState)}}const Lm=Im;class Pm extends wa{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target});const e=t.className!==void 0?t.className:"ol-rotate",n=t.label!==void 0?t.label:"⇧",s=t.compassClassName!==void 0?t.compassClassName:"ol-compass";this.label_=null,typeof n=="string"?(this.label_=document.createElement("span"),this.label_.className=s,this.label_.textContent=n):(this.label_=n,this.label_.classList.add(s));const r=t.tipLabel?t.tipLabel:"Reset rotation",o=document.createElement("button");o.className=e+"-reset",o.setAttribute("type","button"),o.title=r,o.appendChild(this.label_),o.addEventListener(z.CLICK,this.handleClick_.bind(this),!1);const a=e+" "+Bs+" "+vo,l=this.element;l.className=a,l.appendChild(o),this.callResetNorth_=t.resetNorth?t.resetNorth:void 0,this.duration_=t.duration!==void 0?t.duration:250,this.autoHide_=t.autoHide!==void 0?t.autoHide:!0,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Xs)}handleClick_(t){t.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const e=this.getMap().getView();if(!e)return;const n=e.getRotation();n!==void 0&&(this.duration_>0&&n%(2*Math.PI)!==0?e.animate({rotation:0,duration:this.duration_,easing:Rn}):e.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const n=e.viewState.rotation;if(n!=this.rotation_){const s="rotate("+n+"rad)";if(this.autoHide_){const r=this.element.classList.contains(Xs);!r&&n===0?this.element.classList.add(Xs):r&&n!==0&&this.element.classList.remove(Xs)}this.label_.style.transform=s}this.rotation_=n}}const bm=Pm;class Mm extends wa{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=t.className!==void 0?t.className:"ol-zoom",n=t.delta!==void 0?t.delta:1,s=t.zoomInClassName!==void 0?t.zoomInClassName:e+"-in",r=t.zoomOutClassName!==void 0?t.zoomOutClassName:e+"-out",o=t.zoomInLabel!==void 0?t.zoomInLabel:"+",a=t.zoomOutLabel!==void 0?t.zoomOutLabel:"–",l=t.zoomInTipLabel!==void 0?t.zoomInTipLabel:"Zoom in",h=t.zoomOutTipLabel!==void 0?t.zoomOutTipLabel:"Zoom out",c=document.createElement("button");c.className=s,c.setAttribute("type","button"),c.title=l,c.appendChild(typeof o=="string"?document.createTextNode(o):o),c.addEventListener(z.CLICK,this.handleClick_.bind(this,n),!1);const u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=h,u.appendChild(typeof a=="string"?document.createTextNode(a):a),u.addEventListener(z.CLICK,this.handleClick_.bind(this,-n),!1);const d=e+" "+Bs+" "+vo,f=this.element;f.className=d,f.appendChild(c),f.appendChild(u),this.duration_=t.duration!==void 0?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const n=this.getMap().getView();if(!n)return;const s=n.getZoom();if(s!==void 0){const r=n.getConstrainedZoom(s+t);this.duration_>0?(n.getAnimating()&&n.cancelAnimations(),n.animate({zoom:r,duration:this.duration_,easing:Rn})):n.setZoom(r)}}}const Am=Mm;function Mc(i){i=i||{};const t=new Ht;return(i.zoom!==void 0?i.zoom:!0)&&t.push(new Am(i.zoomOptions)),(i.rotate!==void 0?i.rotate:!0)&&t.push(new bm(i.rotateOptions)),(i.attribution!==void 0?i.attribution:!0)&&t.push(new Lm(i.attributionOptions)),t}class Om{constructor(t,e,n){this.decay_=t,this.minVelocity_=e,this.delay_=n,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]<t)return!1;let n=e-3;for(;n>0&&this.points_[n+2]>t;)n-=3;const s=this.points_[e+2]-this.points_[n+2];if(s<16.666666666666668)return!1;const r=this.points_[e]-this.points_[n],o=this.points_[e+1]-this.points_[n+1];return this.angle_=Math.atan2(o,r),this.initialVelocity_=Math.sqrt(r*r+o*o)/s,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}const Dm=Om,va={ACTIVE:"active"};class Fm extends Kt{constructor(t){super(),this.on,this.once,this.un,t&&t.handleEvent&&(this.handleEvent=t.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(va.ACTIVE)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(va.ACTIVE,t)}setMap(t){this.map_=t}}function km(i,t,e){const n=i.getCenterInternal();if(n){const s=[n[0]+t[0],n[1]+t[1]];i.animateInternal({duration:e!==void 0?e:250,easing:F_,center:i.getConstrainedCenter(s)})}}function Ra(i,t,e,n){const s=i.getZoom();if(s===void 0)return;const r=i.getConstrainedZoom(s+t),o=i.getResolutionForZoom(r);i.getAnimating()&&i.cancelAnimations(),i.animate({resolution:o,anchor:e,duration:n!==void 0?n:250,easing:Rn})}const hs=Fm;class Nm extends hs{constructor(t){super(),t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=t.duration!==void 0?t.duration:250}handleEvent(t){let e=!1;if(t.type==tt.DBLCLICK){const n=t.originalEvent,s=t.map,r=t.coordinate,o=n.shiftKey?-this.delta_:this.delta_,a=s.getView();Ra(a,o,r,this.duration_),n.preventDefault(),e=!0}return!e}}const Gm=Nm;function Ta(i){const t=arguments;return function(e){let n=!0;for(let s=0,r=t.length;s<r&&(n=n&&t[s](e),!!n);++s);return n}}const zm=function(i){const t=i.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey},jm=function(i){const t=i.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},Xm=function(i){const t=i.map.getTargetElement(),e=t.getRootNode(),n=i.map.getOwnerDocument().activeElement;return e instanceof ShadowRoot?e.host.contains(n):t.contains(n)},Ac=function(i){const t=i.map.getTargetElement(),e=t.getRootNode();return(e instanceof ShadowRoot?e.host:t).hasAttribute("tabindex")?Xm(i):!0},_r=Zn,Oc=function(i){const t=i.originalEvent;return"pointerId"in t&&t.button==0&&!(Cd&&Dl&&t.ctrlKey)},Bm=Hn,Sa=function(i){const t=i.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey},Ym=function(i){const t=i.originalEvent;return Dl?t.metaKey:t.ctrlKey},Ia=function(i){const t=i.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},Dc=function(i){const t=i.originalEvent,e=t.target.tagName;return e!=="INPUT"&&e!=="SELECT"&&e!=="TEXTAREA"&&!t.target.isContentEditable},La=function(i){const t=i.originalEvent;return"pointerId"in t&&t.pointerType=="mouse"},Wm=function(i){const t=i.originalEvent;return"pointerId"in t&&t.isPrimary&&t.button===0};class Vm extends hs{constructor(t){t=t||{},super(t),t.handleDownEvent&&(this.handleDownEvent=t.handleDownEvent),t.handleDragEvent&&(this.handleDragEvent=t.handleDragEvent),t.handleMoveEvent&&(this.handleMoveEvent=t.handleMoveEvent),t.handleUpEvent&&(this.handleUpEvent=t.handleUpEvent),t.stopDown&&(this.stopDown=t.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(t){return!1}handleDragEvent(t){}handleEvent(t){if(!t.originalEvent)return!0;let e=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence){if(t.type==tt.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==tt.POINTERUP){const n=this.handleUpEvent(t);this.handlingDownUpSequence=n&&this.targetPointers.length>0}}else if(t.type==tt.POINTERDOWN){const n=this.handleDownEvent(t);this.handlingDownUpSequence=n,e=this.stopDown(n)}else t.type==tt.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}}function Pa(i){const t=i.length;let e=0,n=0;for(let s=0;s<t;s++)e+=i[s].clientX,n+=i[s].clientY;return{clientX:e/t,clientY:n/t}}const hi=Vm;class Um extends hi{constructor(t){super({stopDown:Hn}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:Ta(Sa,Wm);this.condition_=t.onFocusOnly?Ta(Ac,e):e,this.noKinetic_=!1}handleDragEvent(t){const e=t.map;this.panning_||(this.panning_=!0,e.getView().beginInteraction());const n=this.targetPointers,s=e.getEventPixel(Pa(n));if(n.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(s[0],s[1]),this.lastCentroid){const r=[this.lastCentroid[0]-s[0],s[1]-this.lastCentroid[1]],a=t.map.getView();bl(r,a.getResolution()),Zr(r,a.getRotation()),a.adjustCenterInternal(r)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=s,this.lastPointersCount_=n.length,t.originalEvent.preventDefault()}handleUpEvent(t){const e=t.map,n=e.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const s=this.kinetic_.getDistance(),r=this.kinetic_.getAngle(),o=n.getCenterInternal(),a=e.getPixelFromCoordinateInternal(o),l=e.getCoordinateFromPixelInternal([a[0]-s*Math.cos(r),a[1]-s*Math.sin(r)]);n.animateInternal({center:n.getConstrainedCenter(l),duration:500,easing:Rn})}return this.panning_&&(this.panning_=!1,n.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(t){if(this.targetPointers.length>0&&this.condition_(t)){const n=t.map.getView();return this.lastCentroid=null,n.getAnimating()&&n.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}}const Km=Um;class $m extends hi{constructor(t){t=t||{},super({stopDown:Hn}),this.condition_=t.condition?t.condition:jm,this.lastAngle_=void 0,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){if(!La(t))return;const e=t.map,n=e.getView();if(n.getConstraints().rotation===la)return;const s=e.getSize(),r=t.pixel,o=Math.atan2(s[1]/2-r[1],r[0]-s[0]/2);if(this.lastAngle_!==void 0){const a=o-this.lastAngle_;n.adjustRotationInternal(-a)}this.lastAngle_=o}handleUpEvent(t){return La(t)?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){return La(t)&&Oc(t)&&this.condition_(t)?(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}}const Zm=$m;class Hm extends Gs{constructor(t){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const t=this.startPixel_,e=this.endPixel_,n="px",s=this.element_.style;s.left=Math.min(t[0],e[0])+n,s.top=Math.min(t[1],e[1])+n,s.width=Math.abs(e[0]-t[0])+n,s.height=Math.abs(e[1]-t[1])+n}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const e=this.element_.style;e.left="inherit",e.top="inherit",e.width="inherit",e.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;const t=this.startPixel_,e=this.endPixel_,s=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);s[4]=s[0].slice(),this.geometry_?this.geometry_.setCoordinates([s]):this.geometry_=new Zt([s])}getGeometry(){return this.geometry_}}const qm=Hm,ci={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"};class cs extends se{constructor(t,e,n){super(t),this.coordinate=e,this.mapBrowserEvent=n}}class Jm extends hi{constructor(t){super(),this.on,this.once,this.un,t=t??{},this.box_=new qm(t.className||"ol-dragbox"),this.minArea_=t.minArea??64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition??Oc,this.boxEndCondition_=t.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,n){const s=n[0]-e[0],r=n[1]-e[1];return s*s+r*r>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.startPixel_&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new cs(ci.BOXDRAG,t.coordinate,t)))}handleUpEvent(t){if(!this.startPixel_)return!1;const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new cs(e?ci.BOXEND:ci.BOXCANCEL,t.coordinate,t)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(t){return this.condition_(t)?(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new cs(ci.BOXSTART,t.coordinate,t)),!0):!1}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new cs(ci.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}setMap(t){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new cs(ci.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(t)}}const Qm=Jm;class tp extends Qm{constructor(t){t=t||{};const e=t.condition?t.condition:Ia;super({condition:e,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=t.duration!==void 0?t.duration:200,this.out_=t.out!==void 0?t.out:!1}onBoxEnd(t){const n=this.getMap().getView();let s=this.getGeometry();if(this.out_){const r=n.rotatedExtentForGeometry(s),o=n.getResolutionForExtentInternal(r),a=n.getResolution()/o;s=s.clone(),s.scale(a*a)}n.fitInternal(s,{duration:this.duration_,easing:Rn})}}const ep=tp,In={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};class np extends hs{constructor(t){super(),t=t||{},this.defaultCondition_=function(e){return Sa(e)&&Dc(e)},this.condition_=t.condition!==void 0?t.condition:this.defaultCondition_,this.duration_=t.duration!==void 0?t.duration:100,this.pixelDelta_=t.pixelDelta!==void 0?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==z.KEYDOWN){const n=t.originalEvent,s=n.key;if(this.condition_(t)&&(s==In.DOWN||s==In.LEFT||s==In.RIGHT||s==In.UP)){const o=t.map.getView(),a=o.getResolution()*this.pixelDelta_;let l=0,h=0;s==In.DOWN?h=-a:s==In.LEFT?l=-a:s==In.RIGHT?l=a:h=a;const c=[l,h];Zr(c,o.getRotation()),km(o,c,this.duration_),n.preventDefault(),e=!0}}return!e}}const ip=np;class sp extends hs{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(e){return!Ym(e)&&Dc(e)},this.delta_=t.delta?t.delta:1,this.duration_=t.duration!==void 0?t.duration:100}handleEvent(t){let e=!1;if(t.type==z.KEYDOWN||t.type==z.KEYPRESS){const n=t.originalEvent,s=n.key;if(this.condition_(t)&&(s==="+"||s==="-")){const r=t.map,o=s==="+"?this.delta_:-this.delta_,a=r.getView();Ra(a,o,void 0,this.duration_),n.preventDefault(),e=!0}}return!e}}const rp=sp,op=40,ap=300;class lp extends hs{constructor(t){t=t||{},super(t),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=t.maxDelta!==void 0?t.maxDelta:1,this.duration_=t.duration!==void 0?t.duration:250,this.timeout_=t.timeout!==void 0?t.timeout:80,this.useAnchor_=t.useAnchor!==void 0?t.useAnchor:!0,this.constrainResolution_=t.constrainResolution!==void 0?t.constrainResolution:!1;const e=t.condition?t.condition:_r;this.condition_=t.onFocusOnly?Ta(Ac,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();if(!t)return;t.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(t){if(!this.condition_(t)||t.type!==z.WHEEL)return!0;const n=t.map,s=t.originalEvent;s.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.pixel);let r=s.deltaY;switch(s.deltaMode){case WheelEvent.DOM_DELTA_LINE:r*=op;break;case WheelEvent.DOM_DELTA_PAGE:r*=ap;break}if(r===0)return!1;this.lastDelta_=r;const o=Date.now();this.startTime_===void 0&&(this.startTime_=o),(!this.mode_||o-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(r)<4?"trackpad":"wheel");const a=n.getView();if(this.mode_==="trackpad"&&!(a.getConstrainResolution()||this.constrainResolution_))return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(a.getAnimating()&&a.cancelAnimations(),a.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),a.adjustZoom(-r/this.deltaPerZoom_,this.lastAnchor_?n.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=o,!1;this.totalDelta_+=r;const l=Math.max(this.timeout_-(o-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,n),l),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let n=-ot(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),Ra(e,n,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}}const hp=lp;class cp extends hi{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=Hn),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=t.threshold!==void 0?t.threshold:.3,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){let e=0;const n=this.targetPointers[0],s=this.targetPointers[1],r=Math.atan2(s.clientY-n.clientY,s.clientX-n.clientX);if(this.lastAngle_!==void 0){const l=r-this.lastAngle_;this.rotationDelta_+=l,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=l}this.lastAngle_=r;const o=t.map,a=o.getView();a.getConstraints().rotation!==la&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(Pa(this.targetPointers))),this.rotating_&&(o.render(),a.adjustRotationInternal(e,this.anchor_)))}handleUpEvent(t){return this.targetPointers.length<2?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}const up=cp;class dp extends hi{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=Hn),super(e),this.anchor_=null,this.duration_=t.duration!==void 0?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const n=this.targetPointers[0],s=this.targetPointers[1],r=n.clientX-s.clientX,o=n.clientY-s.clientY,a=Math.sqrt(r*r+o*o);this.lastDistance_!==void 0&&(e=this.lastDistance_/a),this.lastDistance_=a;const l=t.map,h=l.getView();e!=1&&(this.lastScaleDelta_=e),this.anchor_=l.getCoordinateFromPixelInternal(l.getEventPixel(Pa(this.targetPointers))),l.render(),h.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const n=t.map.getView(),s=this.lastScaleDelta_>1?1:-1;return n.endInteraction(this.duration_,s),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}const fp=dp;function gp(i){i=i||{};const t=new Ht,e=new Dm(-.005,.05,100);return(i.altShiftDragRotate!==void 0?i.altShiftDragRotate:!0)&&t.push(new Zm),(i.doubleClickZoom!==void 0?i.doubleClickZoom:!0)&&t.push(new Gm({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan!==void 0?i.dragPan:!0)&&t.push(new Km({onFocusOnly:i.onFocusOnly,kinetic:e})),(i.pinchRotate!==void 0?i.pinchRotate:!0)&&t.push(new up),(i.pinchZoom!==void 0?i.pinchZoom:!0)&&t.push(new fp({duration:i.zoomDuration})),(i.keyboard!==void 0?i.keyboard:!0)&&(t.push(new ip),t.push(new rp({delta:i.zoomDelta,duration:i.zoomDuration}))),(i.mouseWheelZoom!==void 0?i.mouseWheelZoom:!0)&&t.push(new hp({onFocusOnly:i.onFocusOnly,duration:i.zoomDuration})),(i.shiftDragZoom!==void 0?i.shiftDragZoom:!0)&&t.push(new ep({duration:i.zoomDuration})),t}const sn={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"};class rn extends se{constructor(t,e){super(t),this.layer=e}}const ba={LAYERS:"layers"};class Ma extends as{constructor(t){t=t||{};const e=Object.assign({},t);delete e.layers;let n=t.layers;super(e),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(ba.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new Ht(n.slice(),{unique:!0}):J(typeof n.getArray=="function","Expected `layers` to be an array or a `Collection`"):n=new Ht(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(it),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push($(t,kt.ADD,this.handleLayersAdd_,this),$(t,kt.REMOVE,this.handleLayersRemove_,this));for(const n in this.listenerKeys_)this.listenerKeys_[n].forEach(it);Oi(this.listenerKeys_);const e=t.getArray();for(let n=0,s=e.length;n<s;n++){const r=e[n];this.registerLayerListeners_(r),this.dispatchEvent(new rn(sn.ADDLAYER,r))}this.changed()}registerLayerListeners_(t){const e=[$(t,qn.PROPERTYCHANGE,this.handleLayerChange_,this),$(t,z.CHANGE,this.handleLayerChange_,this)];t instanceof Ma&&e.push($(t,sn.ADDLAYER,this.handleLayerGroupAdd_,this),$(t,sn.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[q(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new rn(sn.ADDLAYER,t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new rn(sn.REMOVELAYER,t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new rn(sn.ADDLAYER,e)),this.changed()}handleLayersRemove_(t){const e=t.element,n=q(e);this.listenerKeys_[n].forEach(it),delete this.listenerKeys_[n],this.dispatchEvent(new rn(sn.REMOVELAYER,e)),this.changed()}getLayers(){return this.get(ba.LAYERS)}setLayers(t){const e=this.getLayers();if(e){const n=e.getArray();for(let s=0,r=n.length;s<r;++s)this.dispatchEvent(new rn(sn.REMOVELAYER,n[s]))}this.set(ba.LAYERS,t)}getLayersArray(t){return t=t!==void 0?t:[],this.getLayers().forEach(function(e){e.getLayersArray(t)}),t}getLayerStatesArray(t){const e=t!==void 0?t:[],n=e.length;this.getLayers().forEach(function(o){o.getLayerStatesArray(e)});const s=this.getLayerState();let r=s.zIndex;!t&&s.zIndex===void 0&&(r=0);for(let o=n,a=e.length;o<a;o++){const l=e[o];l.opacity*=s.opacity,l.visible=l.visible&&s.visible,l.maxResolution=Math.min(l.maxResolution,s.maxResolution),l.minResolution=Math.max(l.minResolution,s.minResolution),l.minZoom=Math.max(l.minZoom,s.minZoom),l.maxZoom=Math.min(l.maxZoom,s.maxZoom),s.extent!==void 0&&(l.extent!==void 0?l.extent=Se(l.extent,s.extent):l.extent=s.extent),l.zIndex===void 0&&(l.zIndex=r)}return e}getSourceState(){return"ready"}}const mr=Ma;class _p extends Gs{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){j()}calculateMatrices2D(t){const e=t.viewState,n=t.coordinateToPixelTransform,s=t.pixelToCoordinateTransform;ye(n,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),wh(s,n)}forEachFeatureAtCoordinate(t,e,n,s,r,o,a,l){let h;const c=e.viewState;function u(E,w,T,v){return r.call(o,w,E?T:null,v)}const d=c.projection,f=Ol(t.slice(),d),g=[[0,0]];if(d.canWrapX()&&s){const E=d.getExtent(),w=K(E);g.push([-w,0],[w,0])}const _=e.layerStatesArray,m=_.length,p=[],y=[];for(let E=0;E<g.length;E++)for(let w=m-1;w>=0;--w){const T=_[w],v=T.layer;if(v.hasRenderer()&&da(T,c)&&a.call(l,v)){const R=v.getRenderer(),I=v.getSource();if(R&&I){const b=I.getWrapX()?f:t,O=u.bind(null,T.managed);y[0]=b[0]+g[E][0],y[1]=b[1]+g[E][1],h=R.forEachFeatureAtCoordinate(y,e,n,O,p)}if(h)return h}}if(p.length===0)return;const C=1/p.length;return p.forEach((E,w)=>E.distanceSq+=w*C),p.sort((E,w)=>E.distanceSq-w.distanceSq),p.some(E=>h=E.callback(E.feature,E.layer,E.geometry)),h}hasFeatureAtCoordinate(t,e,n,s,r,o){return this.forEachFeatureAtCoordinate(t,e,n,s,Zn,this,r,o)!==void 0}getMap(){return this.map_}renderFrame(t){j()}scheduleExpireIconCache(t){Ut.canExpireCache()&&t.postRenderFunctions.push(mp)}}function mp(i,t){Ut.expire()}const pp=_p;class yp extends pp{constructor(t){super(t),this.fontChangeListenerKey_=$(ti,qn.PROPERTYCHANGE,t.redrawText,t),this.element_=Bt?zl():document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=Bs+" ol-layers";const n=t.getViewport();n&&n.insertBefore(this.element_,n.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(t,e){const n=this.getMap();if(n.hasListener(t)){const s=new Xh(t,void 0,e);n.dispatchEvent(s)}}disposeInternal(){it(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(t){if(!t){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(t),this.dispatchRenderEvent(Vt.PRECOMPOSE,t);const e=t.layerStatesArray.sort((h,c)=>h.zIndex-c.zIndex);e.some(h=>h.layer instanceof vc&&h.layer.getDeclutter())&&(t.declutter={});const s=t.viewState;this.children_.length=0;const r=[];let o=null;for(let h=0,c=e.length;h<c;++h){const u=e[h];t.layerIndex=h;const d=u.layer,f=d.getSourceState();if(!da(u,s)||f!="ready"&&f!="undefined"){d.unrender();continue}const g=d.render(t,o);g&&(g!==o&&(this.children_.push(g),o=g),r.push(u))}this.declutter(t,r),Sd(this.element_,this.children_);const l=this.getMap().getTargetElement();if(Ve(l)){const h=l.getContext("2d");for(const c of this.children_){const u=c.firstElementChild||c,d=c.style.backgroundColor;if(d&&(!Ve(u)||u.width>0)&&(h.fillStyle=d,h.fillRect(0,0,l.width,l.height)),Ve(u)&&u.width>0){const f=c.style.opacity||u.style.opacity;h.globalAlpha=f===""?1:Number(f);const g=u.style.transform;if(g)h.setTransform(...Po(g));else{const _=parseFloat(u.style.width)/u.width,m=parseFloat(u.style.height)/u.height;h.setTransform(_,0,0,m,0,0)}h.drawImage(u,0,0)}}h.globalAlpha=1,h.setTransform(1,0,0,1,0,0)}this.dispatchRenderEvent(Vt.POSTCOMPOSE,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}declutter(t,e){if(t.declutter){for(let n=e.length-1;n>=0;--n){const s=e[n],r=s.layer;r.getDeclutter()&&r.renderDeclutter(t,s)}e.forEach(n=>n.layer.renderDeferred(t))}}}const xp=yp;function Fc(i){if(i instanceof ls){i.setMapInternal(null);return}i instanceof mr&&i.getLayers().forEach(Fc)}function kc(i,t){if(i instanceof ls){i.setMapInternal(t);return}if(i instanceof mr){const e=i.getLayers().getArray();for(let n=0,s=e.length;n<s;++n)kc(e[n],t)}}let Ep=class extends Kt{constructor(t){super(),t=t||{},this.on,this.once,this.un;const e=Cp(t);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=t.maxTilesLoading!==void 0?t.maxTilesLoading:16,this.pixelRatio_=t.pixelRatio!==void 0?t.pixelRatio:wd,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=re(),this.pixelToCoordinateTransform_=re(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,Bt||(this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_)),this.mapBrowserEventHandler_=null,this.moveTolerance_=t.moveTolerance,this.keyboardEventTarget_=e.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,Bt||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=e.controls||(Bt?new Ht:Mc()),this.interactions=e.interactions||(Bt?new Ht:gp({onFocusOnly:!0})),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new Rm(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(vt.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(vt.VIEW,this.handleViewChanged_),this.addChangeListener(vt.SIZE,this.handleSizeChanged_),this.addChangeListener(vt.TARGET,this.handleTargetChanged_),this.setProperties(e.values);const n=this;t.view&&!(t.view instanceof ce)&&t.view.then(function(s){n.setView(new ce(s))}),this.controls.addEventListener(kt.ADD,s=>{s.element.setMap(this)}),this.controls.addEventListener(kt.REMOVE,s=>{s.element.setMap(null)}),this.interactions.addEventListener(kt.ADD,s=>{s.element.setMap(this)}),this.interactions.addEventListener(kt.REMOVE,s=>{s.element.setMap(null)}),this.overlays_.addEventListener(kt.ADD,s=>{this.addOverlayInternal_(s.element)}),this.overlays_.addEventListener(kt.REMOVE,s=>{const r=s.element.getId();r!==void 0&&delete this.overlayIdIndex_[r.toString()],s.element.setMap(null)}),this.controls.forEach(s=>{s.setMap(this)}),this.interactions.forEach(s=>{s.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}handleLayerAdd_(t){kc(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();e!==void 0&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){var t;this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),(t=this.resizeObserver_)==null||t.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,n){if(!this.frameState_||!this.renderer_)return;const s=this.getCoordinateFromPixelInternal(t);n=n!==void 0?n:{};const r=n.hitTolerance!==void 0?n.hitTolerance:0,o=n.layerFilter!==void 0?n.layerFilter:Zn,a=n.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(s,this.frameState_,r,a,e,null,o,null)}getFeaturesAtPixel(t,e){const n=[];return this.forEachFeatureAtPixel(t,function(s){n.push(s)},e),n}getAllLayers(){const t=[];function e(n){n.forEach(function(s){s instanceof mr?e(s.getLayers()):t.push(s)})}return e(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const n=this.getCoordinateFromPixelInternal(t);e=e!==void 0?e:{};const s=e.layerFilter!==void 0?e.layerFilter:Zn,r=e.hitTolerance!==void 0?e.hitTolerance:0,o=e.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(n,this.frameState_,r,o,s,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const n=this.viewport_.getBoundingClientRect(),s=this.getSize(),r=n.width/s[0],o=n.height/s[1],a="changedTouches"in t?t.changedTouches[0]:t;return[(a.clientX-n.left)/r,(a.clientY-n.top)/o]}getTarget(){return this.get(vt.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return lo(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?gt(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){const e=this.overlayIdIndex_[t.toString()];return e!==void 0?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(vt.LAYERGROUP)}setLayers(t){const e=this.getLayerGroup();if(t instanceof Ht){e.setLayers(t);return}const n=e.getLayers();n.clear(),n.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,n=t.length;e<n;++e){const s=t[e];if(!s.visible)continue;const r=s.layer.getRenderer();if(r&&!r.ready)return!0;const o=s.layer.getSource();if(o&&o.loading)return!0}return!1}getPixelFromCoordinate(t){const e=Wt(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?gt(e.coordinateToPixelTransform,t.slice(0,2)):null}getRenderer(){return this.renderer_}getSize(){return this.get(vt.SIZE)}getView(){return this.get(vt.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const t=this.getTargetElement();return t?t.ownerDocument:document}getTilePriority(t,e,n,s){return Tm(this.frameState_,t,e,n,s)}handleBrowserEvent(t,e){e=e||t.type;const n=new Ne(e,this,t);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(t){if(!this.frameState_)return;const e=t.originalEvent,n=e.type;if(n===Ca.POINTERDOWN||n===z.WHEEL||n===z.KEYDOWN){const s=this.getOwnerDocument(),r=this.viewport_.getRootNode?this.viewport_.getRootNode():s,o=e.target,a=r instanceof ShadowRoot?r.host===o?r.host.ownerDocument:r:r===s?s.documentElement:r;if(this.overlayContainerStopEvent_.contains(o)||!a.contains(o))return}if(t.frameState=this.frameState_,this.dispatchEvent(t)!==!1){const s=this.getInteractions().getArray().slice();for(let r=s.length-1;r>=0;r--){const o=s[r];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(t)||t.propagationStopped)break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let s=this.maxTilesLoading_,r=s;if(t){const o=t.viewHints;if(o[rt.ANIMATING]||o[rt.INTERACTING]){const a=Date.now()-t.time>8;s=a?0:8,r=a?0:2}}e.getTilesLoading()<s&&(e.reprioritize(),e.loadMoreTiles(s,r))}t&&this.renderer_&&!t.animate&&(this.renderComplete_?(this.hasListener(Vt.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(Vt.RENDERCOMPLETE,t),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new li(Ge.LOADEND,this,t)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new li(Ge.LOADSTART,this,t))));const n=this.postRenderFunctions_;if(t)for(let s=0,r=n.length;s<r;++s)n[s](this,t);n.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){var n,s;if(this.mapBrowserEventHandler_){for(let r=0,o=this.targetChangeHandlerKeys_.length;r<o;++r)it(this.targetChangeHandlerKeys_[r]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(z.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(z.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!Ve(this.targetElement_)){(n=this.resizeObserver_)==null||n.unobserve(this.targetElement_);const r=this.targetElement_.getRootNode();r instanceof ShadowRoot&&this.resizeObserver_.unobserve(r.host),this.setSize(void 0)}const t=this.getTarget(),e=typeof t=="string"?document.getElementById(t):t;if(this.targetElement_=e,!e)this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0);else{if(Ve(e)||e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new xp(this)),!Ve(e)){this.mapBrowserEventHandler_=new Em(this,this.moveTolerance_);for(const o in tt)this.mapBrowserEventHandler_.addEventListener(tt[o],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(z.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(z.WHEEL,this.boundHandleBrowserEvent_,kl?{passive:!1}:!1);let r;if(this.keyboardEventTarget_)r=this.keyboardEventTarget_;else{const o=e.getRootNode();r=o instanceof ShadowRoot?o.host:e}if(this.targetChangeHandlerKeys_=[$(r,z.KEYDOWN,this.handleBrowserEvent,this),$(r,z.KEYPRESS,this.handleBrowserEvent,this)],e instanceof HTMLElement){const o=e.getRootNode();o instanceof ShadowRoot&&this.resizeObserver_.observe(o.host),(s=this.resizeObserver_)==null||s.observe(e)}}this.updateSize()}}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(it(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(it(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=$(t,qn.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=$(t,z.CHANGE,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(it),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new rn("addlayer",t)),this.layerGroupPropertyListenerKeys_=[$(t,qn.PROPERTYCHANGE,this.render,this),$(t,z.CHANGE,this.render,this),$(t,"addlayer",this.handleLayerAdd_,this),$(t,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;const t=this.frameState_.layerStatesArray;for(let e=0,n=t.length;e<n;++e){const s=t[e].layer;s.hasRenderer()&&s.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(t){return this.getControls().remove(t)}removeInteraction(t){return this.getInteractions().remove(t)}removeLayer(t){return this.getLayerGroup().getLayers().remove(t)}handleLayerRemove_(t){Fc(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){const e=this.getSize(),n=this.getView(),s=this.frameState_;let r=null;if(e!==void 0&&Ih(e)&&n&&n.isDef()){const o=n.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=n.getState();if(r={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:Ts(a.center,a.resolution,a.rotation,e),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:e,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{},mapId:q(this),renderTargets:{}},a.nextCenter&&a.nextResolution){const l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;r.nextExtent=Ts(a.nextCenter,a.nextResolution,l,e)}}this.frameState_=r,this.renderer_.renderFrame(r),r&&(r.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,r.postRenderFunctions),s&&(!this.previousExtent_||!Bn(this.previousExtent_)&&!jn(r.extent,this.previousExtent_))&&(this.dispatchEvent(new li(Ge.MOVESTART,this,s)),this.previousExtent_=Ii(this.previousExtent_)),this.previousExtent_&&!r.viewHints[rt.ANIMATING]&&!r.viewHints[rt.INTERACTING]&&!jn(r.extent,this.previousExtent_)&&(this.dispatchEvent(new li(Ge.MOVEEND,this,r)),Cl(r.extent,this.previousExtent_))),this.dispatchEvent(new li(Ge.POSTRENDER,this,r)),this.renderComplete_=(this.hasListener(Ge.LOADSTART)||this.hasListener(Ge.LOADEND)||this.hasListener(Vt.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new rn("removelayer",e)),this.set(vt.LAYERGROUP,t)}setSize(t){this.set(vt.SIZE,t)}setTarget(t){this.set(vt.TARGET,t)}setView(t){if(!t||t instanceof ce){this.set(vt.VIEW,t);return}this.set(vt.VIEW,new ce);const e=this;t.then(function(n){e.setView(new ce(n))})}updateSize(){const t=this.getTargetElement();let e;if(t){let s,r;if(Ve(t))s=t.width,r=t.height;else{const o=getComputedStyle(t);s=t.offsetWidth-parseFloat(o.borderLeftWidth)-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight)-parseFloat(o.borderRightWidth),r=t.offsetHeight-parseFloat(o.borderTopWidth)-parseFloat(o.paddingTop)-parseFloat(o.paddingBottom)-parseFloat(o.borderBottomWidth)}!isNaN(s)&&!isNaN(r)&&(e=[Math.max(0,s),Math.max(0,r)],!Ih(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&Xl("No map visible because the map container's width or height are 0."))}const n=this.getSize();e&&(!n||!Be(e,n))&&(this.setSize(e),this.updateViewportSize_(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}};function Cp(i){let t=null;i.keyboardEventTarget!==void 0&&(t=typeof i.keyboardEventTarget=="string"?document.getElementById(i.keyboardEventTarget):i.keyboardEventTarget);const e={},n=i.layers&&typeof i.layers.getLayers=="function"?i.layers:new mr({layers:i.layers});e[vt.LAYERGROUP]=n,e[vt.TARGET]=i.target,e[vt.VIEW]=i.view instanceof ce?i.view:new ce;let s;i.controls!==void 0&&(Array.isArray(i.controls)?s=new Ht(i.controls.slice()):(J(typeof i.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),s=i.controls));let r;i.interactions!==void 0&&(Array.isArray(i.interactions)?r=new Ht(i.interactions.slice()):(J(typeof i.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),r=i.interactions));let o;return i.overlays!==void 0?Array.isArray(i.overlays)?o=new Ht(i.overlays.slice()):(J(typeof i.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=i.overlays):o=new Ht,{controls:s,interactions:r,keyboardEventTarget:t,overlays:o,values:e}}const Ln=Ep;class wp extends zi{constructor(t,e,n){super(),n=n||{},this.tileCoord=t,this.state=e,this.key="",this.transition_=n.transition===void 0?250:n.transition,this.transitionStarts_={},this.interpolate=!!n.interpolate}changed(){this.dispatchEvent(z.CHANGE)}release(){this.setState(F.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==F.EMPTY){if(this.state!==F.ERROR&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}}load(){j()}getAlpha(t,e){if(!this.transition_)return 1;let n=this.transitionStarts_[t];if(!n)n=e,this.transitionStarts_[t]=n;else if(n===-1)return 1;const s=e-n+1e3/60;return s>=this.transition_?1:ac(s/this.transition_)}inTransition(t){return this.transition_?this.transitionStarts_[t]!==-1:!1}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}disposeInternal(){this.release(),super.disposeInternal()}}const Aa=wp;function Oa(i){return i instanceof Image||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageBitmap?i:null}const vp=new Error("disposed"),Rp=[256,256];class Tp extends Aa{constructor(t){const e=F.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=Oa(this.data_);return t?[t.width,t.height]:Rp}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==F.IDLE&&this.state!==F.ERROR)return;this.state=F.LOADING,this.changed();const t=this;this.loader_().then(function(e){t.data_=e,t.state=F.LOADED,t.changed()}).catch(function(e){t.error_=e,t.state=F.ERROR,t.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(vp),this.controller_=null),super.disposeInternal()}}const Nc=Tp;class Sp extends Aa{constructor(t,e,n,s,r,o){super(t,e,o),this.crossOrigin_=s,this.src_=n,this.key=n,this.image_,Bt?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,s!==null&&(this.image_.crossOrigin=s)),this.unlisten_=null,this.tileLoadFunction_=r}getImage(){return this.image_}setImage(t){this.image_=t,this.state=F.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}handleImageError_(){this.state=F.ERROR,this.unlistenImage_(),this.image_=Ip(),this.changed()}handleImageLoad_(){if(Bt)this.state=F.LOADED;else{const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=F.LOADED:this.state=F.EMPTY}this.unlistenImage_(),this.changed()}load(){this.state==F.ERROR&&(this.state=F.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==F.IDLE&&(this.state=F.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=xf(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}}function Ip(){const i=ft(1,1);return i.fillStyle="rgba(0,0,0,0)",i.fillRect(0,0,1,1),i.canvas}const Gc=Sp;class zc{constructor(t,e,n,s){this.minX=t,this.maxX=e,this.minY=n,this.maxY=s}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.minX<this.minX&&(this.minX=t.minX),t.maxX>this.maxX&&(this.maxX=t.maxX),t.minY<this.minY&&(this.minY=t.minY),t.maxY>this.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 ui(i,t,e,n,s){return s!==void 0?(s.minX=i,s.maxX=t,s.minY=e,s.maxY=n,s):new zc(i,t,e,n)}const jc=zc;let Da;const di=[];function Xc(i,t,e,n,s){i.beginPath(),i.moveTo(0,0),i.lineTo(t,e),i.lineTo(n,s),i.closePath(),i.save(),i.clip(),i.fillRect(0,0,Math.max(t,n)+1,Math.max(e,s)),i.restore()}function Fa(i,t){return Math.abs(i[t*4]-210)>2||Math.abs(i[t*4+3]-191.25)>2}function Lp(){if(Da===void 0){const i=ft(6,6,di);i.globalCompositeOperation="lighter",i.fillStyle="rgba(210, 0, 0, 0.75)",Xc(i,4,5,4,0),Xc(i,4,5,0,5);const t=i.getImageData(0,0,3,3).data;Da=Fa(t,0)||Fa(t,4)||Fa(t,8),bs(i),di.push(i.canvas)}return Da}function pr(i,t,e,n){const s=ao(e,t,i);let r=nh(t,n,e);const o=t.getMetersPerUnit();o!==void 0&&(r*=o);const a=i.getMetersPerUnit();a!==void 0&&(r/=a);const l=i.getExtent();if(!l||cn(l,s)){const h=nh(i,r,s)/r;isFinite(h)&&h>0&&(r/=h)}return r}function Pp(i,t,e,n){const s=ie(e);let r=pr(i,t,s,n);return(!isFinite(r)||r<=0)&&Ur(e,function(o){return r=pr(i,t,o,n),isFinite(r)&&r>0}),r}function Bc(i,t,e,n,s,r,o,a,l,h,c,u,d,f){const g=ft(Math.round(e*i),Math.round(e*t),di);if(u||(g.imageSmoothingEnabled=!1),l.length===0)return g.canvas;g.scale(e,e);function _(w){return Math.round(w*e)/e}g.globalCompositeOperation="lighter";const m=Mt();l.forEach(function(w,T,v){wl(m,w.extent)});let p;const y=e/n,C=(u?1:1+Math.pow(2,-24))/y;if(!d||l.length!==1||h!==0){if(p=ft(Math.round(K(m)*y),Math.round(ut(m)*y),di),u||(p.imageSmoothingEnabled=!1),s&&f){const w=(s[0]-m[0])*y,T=-(s[3]-m[3])*y,v=K(s)*y,R=ut(s)*y;p.rect(w,T,v,R),p.clip()}l.forEach(function(w,T,v){if(w.image.width>0&&w.image.height>0){if(w.clipExtent){p.save();const D=(w.clipExtent[0]-m[0])*y,P=-(w.clipExtent[3]-m[3])*y,A=K(w.clipExtent)*y,W=ut(w.clipExtent)*y;p.rect(u?D:Math.round(D),u?P:Math.round(P),u?A:Math.round(D+A)-Math.round(D),u?W:Math.round(P+W)-Math.round(P)),p.clip()}const R=(w.extent[0]-m[0])*y,I=-(w.extent[3]-m[3])*y,b=K(w.extent)*y,O=ut(w.extent)*y;p.drawImage(w.image,h,h,w.image.width-2*h,w.image.height-2*h,u?R:Math.round(R),u?I:Math.round(I),u?b:Math.round(R+b)-Math.round(R),u?O:Math.round(I+O)-Math.round(I)),w.clipExtent&&p.restore()}})}const E=Ye(o);return a.getTriangles().forEach(function(w,T,v){const R=w.source,I=w.target;let b=R[0][0],O=R[0][1],D=R[1][0],P=R[1][1],A=R[2][0],W=R[2][1];const N=_((I[0][0]-E[0])/r),B=_(-(I[0][1]-E[1])/r),k=_((I[1][0]-E[0])/r),U=_(-(I[1][1]-E[1])/r),H=_((I[2][0]-E[0])/r),nt=_(-(I[2][1]-E[1])/r),L=b,It=O;b=0,O=0,D-=L,P-=It,A-=L,W-=It;const yt=[[D,P,0,0,k-N],[A,W,0,0,H-N],[0,0,D,P,U-B],[0,0,A,W,nt-B]],dt=xd(yt);if(!dt)return;if(g.save(),g.beginPath(),Lp()||!u){g.moveTo(k,U);const Lt=4,Ce=N-k,fe=B-U;for(let Xt=0;Xt<Lt;Xt++)g.lineTo(k+_((Xt+1)*Ce/Lt),U+_(Xt*fe/(Lt-1))),Xt!=Lt-1&&g.lineTo(k+_((Xt+1)*Ce/Lt),U+_((Xt+1)*fe/(Lt-1)));g.lineTo(H,nt)}else g.moveTo(k,U),g.lineTo(N,B),g.lineTo(H,nt);g.clip(),g.transform(dt[0],dt[2],dt[1],dt[3],N,B),g.translate(m[0]-L,m[3]-It);let jt;if(p)jt=p.canvas,g.scale(C,-C);else{const Lt=l[0],Ce=Lt.extent;jt=Lt.image,g.scale(K(Ce)/jt.width,-ut(Ce)/jt.height)}g.drawImage(jt,0,0),g.restore()}),p&&(bs(p),di.push(p.canvas)),c&&(g.save(),g.globalCompositeOperation="source-over",g.strokeStyle="black",g.lineWidth=1,a.getTriangles().forEach(function(w,T,v){const R=w.target,I=(R[0][0]-E[0])/r,b=-(R[0][1]-E[1])/r,O=(R[1][0]-E[0])/r,D=-(R[1][1]-E[1])/r,P=(R[2][0]-E[0])/r,A=-(R[2][1]-E[1])/r;g.beginPath(),g.moveTo(O,D),g.lineTo(I,b),g.lineTo(P,A),g.closePath(),g.stroke()}),g.restore()),g.canvas}const bp=10,Yc=.25;class Mp{constructor(t,e,n,s,r,o,a){this.sourceProj_=t,this.targetProj_=e;let l={};const h=a?sf(C=>gt(a,ao(C,this.targetProj_,this.sourceProj_))):Fi(this.targetProj_,this.sourceProj_);this.transformInv_=function(C){const E=C[0]+"/"+C[1];return l[E]||(l[E]=h(C)),l[E]},this.maxSourceExtent_=s,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!s&&!!this.sourceProj_.getExtent()&&K(s)>=K(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?K(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?K(this.targetProj_.getExtent()):null;const c=Ye(n),u=bi(n),d=Pi(n),f=Xn(n),g=this.transformInv_(c),_=this.transformInv_(u),m=this.transformInv_(d),p=this.transformInv_(f),y=bp+(o?Math.max(0,Math.ceil(Math.log2(Kr(n)/(o*o*256*256)))):0);if(this.addQuad_(c,u,d,f,g,_,m,p,y),this.wrapsXInSource_){let C=1/0;this.triangles_.forEach(function(E,w,T){C=Math.min(C,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])-C>this.sourceWorldWidth_/2){const w=[[E.source[0][0],E.source[0][1]],[E.source[1][0],E.source[1][1]],[E.source[2][0],E.source[2][1]]];w[0][0]-C>this.sourceWorldWidth_/2&&(w[0][0]-=this.sourceWorldWidth_),w[1][0]-C>this.sourceWorldWidth_/2&&(w[1][0]-=this.sourceWorldWidth_),w[2][0]-C>this.sourceWorldWidth_/2&&(w[2][0]-=this.sourceWorldWidth_);const T=Math.min(w[0][0],w[1][0],w[2][0]);Math.max(w[0][0],w[1][0],w[2][0])-T<this.sourceWorldWidth_/2&&(E.source=w)}})}l={}}addTriangle_(t,e,n,s,r,o){this.triangles_.push({source:[s,r,o],target:[t,e,n]})}addQuad_(t,e,n,s,r,o,a,l,h){const c=Rs([r,o,a,l]),u=this.sourceWorldWidth_?K(c)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,f=this.sourceProj_.canWrapX()&&u>.5&&u<1;let g=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const m=Rs([t,e,n,s]);g=K(m)/this.targetWorldWidth_>Yc||g}!f&&this.sourceProj_.isGlobal()&&u&&(g=u>Yc||g)}if(!g&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!Ct(c,this.maxSourceExtent_))return;let _=0;if(!g&&(!isFinite(r[0])||!isFinite(r[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(h>0)g=!0;else if(_=(!isFinite(r[0])||!isFinite(r[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),_!=1&&_!=2&&_!=4&&_!=8)return}if(h>0){if(!g){const m=[(t[0]+n[0])/2,(t[1]+n[1])/2],p=this.transformInv_(m);let y;f?y=(un(r[0],d)+un(a[0],d))/2-un(p[0],d):y=(r[0]+a[0])/2-p[0];const C=(r[1]+a[1])/2-p[1];g=y*y+C*C>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-n[0])<=Math.abs(t[1]-n[1])){const m=[(e[0]+n[0])/2,(e[1]+n[1])/2],p=this.transformInv_(m),y=[(s[0]+t[0])/2,(s[1]+t[1])/2],C=this.transformInv_(y);this.addQuad_(t,e,m,y,r,o,p,C,h-1),this.addQuad_(y,m,n,s,C,p,a,l,h-1)}else{const m=[(t[0]+e[0])/2,(t[1]+e[1])/2],p=this.transformInv_(m),y=[(n[0]+s[0])/2,(n[1]+s[1])/2],C=this.transformInv_(y);this.addQuad_(t,m,y,s,r,p,C,l,h-1),this.addQuad_(m,e,n,y,p,o,a,C,h-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}_&11||this.addTriangle_(t,n,s,r,a,l),_&14||this.addTriangle_(t,n,e,r,a,o),_&&(_&13||this.addTriangle_(e,s,t,o,l,r),_&7||this.addTriangle_(e,s,n,o,l,a))}calculateSourceExtent(){const t=Mt();return this.triangles_.forEach(function(e,n,s){const r=e.source;Li(t,r[0]),Li(t,r[1]),Li(t,r[2])}),t}getTriangles(){return this.triangles_}}const Wc=Mp,Vc=.5;class Ap extends Aa{constructor(t,e,n,s,r,o,a,l,h,c,u,d){super(r,F.IDLE,d),this.renderEdges_=u!==void 0?u:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=s,this.wrappedTileCoord_=o||r,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()?t.getExtent():void 0;const f=s.getTileCoordExtent(this.wrappedTileCoord_),g=this.targetTileGrid_.getExtent();let _=this.sourceTileGrid_.getExtent();const m=g?Se(f,g):f;if(Kr(m)===0){this.state=F.EMPTY;return}const p=t.getExtent();p&&(_?_=Se(_,p):_=p);const y=s.getResolution(this.wrappedTileCoord_[0]),C=Pp(t,n,m,y);if(!isFinite(C)||C<=0){this.state=F.EMPTY;return}const E=c!==void 0?c:Vc;if(this.triangulation_=new Wc(t,n,m,_,C*E,y),this.triangulation_.getTriangles().length===0){this.state=F.EMPTY;return}this.sourceZ_=e.getZForResolution(C);let w=this.triangulation_.calculateSourceExtent();if(_&&(t.canWrapX()?(w[1]=ot(w[1],_[1],_[3]),w[3]=ot(w[3],_[1],_[3])):w=Se(w,_)),!Kr(w))this.state=F.EMPTY;else{let T=0,v=0;t.canWrapX()&&(T=K(p),v=Math.floor((w[0]-p[0])/T)),Sl(w.slice(),t,!0).forEach(I=>{const b=e.getTileRangeForExtentAndZ(I,this.sourceZ_);for(let O=b.minX;O<=b.maxX;O++)for(let D=b.minY;D<=b.maxY;D++){const P=h(this.sourceZ_,O,D,a);if(P){const A=v*T;this.sourceTiles_.push({tile:P,offset:A})}}++v}),this.sourceTiles_.length===0&&(this.state=F.EMPTY)}}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{var s;const n=e.tile;if(n&&n.getState()==F.LOADED){const r=this.sourceTileGrid_.getTileCoordExtent(n.tileCoord);r[0]+=e.offset,r[2]+=e.offset;const o=(s=this.clipExtent_)==null?void 0:s.slice();o&&(o[0]+=e.offset,o[2]+=e.offset),t.push({extent:r,clipExtent:o,image:n.getImage()})}}),this.sourceTiles_.length=0,t.length===0)this.state=F.ERROR;else{const e=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(e),s=typeof n=="number"?n:n[0],r=typeof n=="number"?n:n[1],o=this.targetTileGrid_.getResolution(e),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Bc(s,r,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=F.LOADED}this.changed()}load(){if(this.state==F.IDLE){this.state=F.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:e})=>{const n=e.getState();if(n==F.IDLE||n==F.LOADING){t++;const s=$(e,z.CHANGE,r=>{const o=e.getState();(o==F.LOADED||o==F.ERROR||o==F.EMPTY)&&(it(s),t--,t===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(s)}}),t===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:e},n,s){e.getState()==F.IDLE&&e.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(it),this.sourcesListenerKeys_=null}release(){this.canvas_&&(bs(this.canvas_.getContext("2d")),di.push(this.canvas_),this.canvas_=null),super.release()}}const Uc=Ap;class Op{constructor(t){this.highWaterMark=t!==void 0?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){const t=this.pop();t instanceof Gs&&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 n=this.entries_[t];return J(n!==void 0,"Tried to get a value for a key that does not exist in the cache"),n===this.newest_||(n===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(n.newer.older=n.older,n.older.newer=n.newer),n.newer=null,n.older=this.newest_,this.newest_.newer=n,this.newest_=n),n.value_}remove(t){const e=this.entries_[t];return J(e!==void 0,"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=0,n;for(n=this.newest_;n;n=n.older)t[e++]=n.key_;return t}getValues(){const t=new Array(this.count_);let e=0,n;for(n=this.newest_;n;n=n.older)t[e++]=n.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){var e;return(e=this.entries_[t])==null?void 0:e.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){J(!(t in this.entries_),"Tried to set a value for a key that is used already");const n={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[t]=n,++this.count_}setSize(t){this.highWaterMark=t}}const Kc=Op;function yr(i,t,e,n){return n!==void 0?(n[0]=i,n[1]=t,n[2]=e,n):[i,t,e]}function Dp(i,t,e){return i+"/"+t+"/"+e}function xr(i,t,e,n,s){return`${q(i)},${t},${Dp(e,n,s)}`}function $c(i){return Fp(i[0],i[1],i[2])}function Fp(i,t,e){return(t<<i)+e}function kp(i,t){const e=i[0],n=i[1],s=i[2];if(t.getMinZoom()>e||e>t.getMaxZoom())return!1;const r=t.getFullTileRange(e);return r?r.containsXY(n,s):!0}function ka(i,t,e){if(!(e in i))return i[e]=new Set([t]),!0;const n=i[e],s=n.has(t);return s||n.add(t),!s}function Np(i,t,e){const n=i[e];return n?n.delete(t):!1}function Zc(i,t){const e=i.layerStatesArray[i.layerIndex];e.extent&&(t=Se(t,me(e.extent,i.viewState.projection)));const n=e.layer.getRenderSource();if(!n.getWrapX()){const s=n.getTileGridForProjection(i.viewState.projection).getExtent();s&&(t=Se(t,s))}return t}class Gp extends Xo{constructor(t,e){super(t),e=e||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceKey_,this.renderedSourceRevision_,this.tempExtent=Mt(),this.tempTileRange_=new jc(0,0,0,0),this.tempTileCoord_=yr(0,0,0);const n=e.cacheSize!==void 0?e.cacheSize:512;this.tileCache_=new Kc(n),this.sourceTileCache_=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new Kc(512)),this.sourceTileCache_}getOrCreateTile(t,e,n,s){const r=this.tileCache_,a=this.getLayer().getSource(),l=xr(a,a.getKey(),t,e,n);let h;if(r.containsKey(l))h=r.get(l);else{const c=s.viewState.projection,u=a.getProjection();if(h=a.getTile(t,e,n,s.pixelRatio,c,!u||mn(u,c)?void 0:this.getSourceTileCache()),!h)return null;r.set(l,h)}return h}getTile(t,e,n,s){const r=this.getOrCreateTile(t,e,n,s);return r||null}getData(t){const e=this.frameState;if(!e)return null;const n=this.getLayer(),s=gt(e.pixelToCoordinateTransform,t.slice()),r=n.getExtent();if(r&&!cn(r,s))return null;const o=e.viewState,a=n.getRenderSource(),l=a.getTileGridForProjection(o.projection),h=a.getTilePixelRatio(e.pixelRatio);for(let c=l.getZForResolution(o.resolution);c>=l.getMinZoom();--c){const u=l.getTileCoordForCoordAndZ(s,c),d=this.getTile(c,u[1],u[2],e);if(!d||d.getState()!==F.LOADED)continue;const f=l.getOrigin(c),g=Ot(l.getTileSize(c)),_=l.getResolution(c);let m;if(d instanceof Gc||d instanceof Uc)m=d.getImage();else if(d instanceof Nc){if(m=Oa(d.getData()),!m)continue}else continue;const p=Math.floor(h*((s[0]-f[0])/_-u[1]*g[0])),y=Math.floor(h*((f[1]-s[1])/_-u[2]*g[1])),C=Math.round(h*a.getGutterForProjection(o.projection));return this.getImageData(m,p+C,y+C)}return null}prepareFrame(t){var s;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 n=e.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==n&&(this.renderedSourceRevision_=n,this.renderedSourceKey_===e.getKey()&&(this.tileCache_.clear(),(s=this.sourceTileCache_)==null||s.clear())):this.renderedSourceRevision_=n,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(t,e,n,s,r){const o=t.viewState,a=this.getLayer(),l=a.getRenderSource(),h=l.getTileGridForProjection(o.projection),c=q(l);c in t.wantedTiles||(t.wantedTiles[c]={});const u=t.wantedTiles[c],d=a.getMapInternal(),f=Math.max(n-r,h.getMinZoom(),h.getZForResolution(Math.min(a.getMaxResolution(),d?d.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):h.getResolution(0)),l.zDirection)),g=o.rotation,_=g?Rl(o.center,o.resolution,g,t.size):void 0;for(let m=n;m>=f;--m){const p=h.getTileRangeForExtentAndZ(e,m,this.tempTileRange_),y=h.getResolution(m);for(let C=p.minX;C<=p.maxX;++C)for(let E=p.minY;E<=p.maxY;++E){if(g&&!h.tileCoordIntersectsViewport([m,C,E],_))continue;const w=this.getTile(m,C,E,t);if(!w||!ka(s,w,m))continue;const v=w.getKey();if(u[v]=!0,w.getState()===F.IDLE&&!t.tileQueue.isKeyQueued(v)){const R=yr(m,C,E,this.tempTileCoord_);t.tileQueue.enqueue([w,c,h.getTileCoordCenter(R),y])}}}}findStaleTile_(t,e){const n=this.tileCache_,s=t[0],r=t[1],o=t[2],a=this.getStaleKeys();for(let l=0;l<a.length;++l){const h=xr(this.getLayer().getSource(),a[l],s,r,o);if(n.containsKey(h)){const c=n.peek(h);if(c.getState()===F.LOADED)return c.endTransition(q(this)),ka(e,c,s),!0}}return!1}findAltTiles_(t,e,n,s){const r=t.getTileRangeForTileCoordAndZ(e,n,this.tempTileRange_);if(!r)return!1;let o=!0;const a=this.tileCache_,l=this.getLayer().getRenderSource(),h=l.getKey();for(let c=r.minX;c<=r.maxX;++c)for(let u=r.minY;u<=r.maxY;++u){const d=xr(l,h,n,c,u);let f=!1;if(a.containsKey(d)){const g=a.peek(d);g.getState()===F.LOADED&&(ka(s,g,n),f=!0)}f||(o=!1)}return o}renderFrame(t,e){this.renderComplete=!0;const n=t.layerStatesArray[t.layerIndex],s=t.viewState,r=s.projection,o=s.resolution,a=s.center,l=t.pixelRatio,h=this.getLayer(),c=h.getSource(),u=c.getTileGridForProjection(r),d=u.getZForResolution(o,c.zDirection),f=u.getResolution(d),g=c.getKey();this.renderedSourceKey_?this.renderedSourceKey_!==g&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=g):this.renderedSourceKey_=g;let _=t.extent;const m=c.getTilePixelRatio(l);this.prepareContainer(t,e);const p=this.context.canvas.width,y=this.context.canvas.height,C=n.extent&&me(n.extent);C&&(_=Se(_,me(n.extent)));const E=f*p/2/m,w=f*y/2/m,T=[a[0]-E,a[1]-w,a[0]+E,a[1]+w],v={};this.renderedTiles.length=0;const R=h.getPreload();if(t.nextExtent&&this.enqueueTilesForNextExtent()){const k=u.getZForResolution(s.nextResolution,c.zDirection),U=Zc(t,t.nextExtent);this.enqueueTiles(t,U,k,v,R)}const I=Zc(t,_);if(this.enqueueTiles(t,I,d,v,0),R>0&&setTimeout(()=>{this.enqueueTiles(t,I,d-1,v,R-1)},0),!(d in v))return this.container;const b=q(this),O=t.time;for(const k of v[d]){const U=k.getState();if(U===F.EMPTY)continue;const H=k.tileCoord;if(U===F.LOADED&&k.getAlpha(b,O)===1){k.endTransition(b);continue}if(U!==F.ERROR&&(this.renderComplete=!1),this.findStaleTile_(H,v)){Np(v,k,d),t.animate=!0;continue}if(this.findAltTiles_(u,H,d+1,v))continue;const It=u.getMinZoom();for(let yt=d-1;yt>=It&&!this.findAltTiles_(u,H,yt,v);--yt);}const D=f/o*l/m,P=this.getRenderContext(t);ye(this.tempTransform,p/2,y/2,D,D,0,-p/2,-y/2),n.extent&&this.clipUnrotated(P,t,C),c.getInterpolate()||(P.imageSmoothingEnabled=!1),this.preRender(P,t);const A=Object.keys(v).map(Number);A.sort(Re);let W;const N=[],B=[];for(let k=A.length-1;k>=0;--k){const U=A[k],H=c.getTilePixelSize(U,l,r),L=u.getResolution(U)/f,It=H[0]*L*D,yt=H[1]*L*D,dt=u.getTileCoordForCoordAndZ(Ye(T),U),jt=u.getTileCoordExtent(dt),Lt=gt(this.tempTransform,[m*(jt[0]-T[0])/f,m*(T[3]-jt[3])/f]),Ce=m*c.getGutterForProjection(r);for(const fe of v[U]){if(fe.getState()!==F.LOADED)continue;const Xt=fe.tileCoord,zr=dt[1]-Xt[1],gl=Math.round(Lt[0]-(zr-1)*It),ys=dt[2]-Xt[2],kn=Math.round(Lt[1]-(ys-1)*yt),Jt=Math.round(Lt[0]-zr*It),we=Math.round(Lt[1]-ys*yt),vi=gl-Jt,Ri=kn-we,xs=A.length===1;let Nn=!1;W=[Jt,we,Jt+vi,we,Jt+vi,we+Ri,Jt,we+Ri];for(let Ti=0,Si=N.length;Ti<Si;++Ti)if(!xs&&U<B[Ti]){const xt=N[Ti];Ct([Jt,we,Jt+vi,we+Ri],[xt[0],xt[3],xt[4],xt[7]])&&(Nn||(P.save(),Nn=!0),P.beginPath(),P.moveTo(W[0],W[1]),P.lineTo(W[2],W[3]),P.lineTo(W[4],W[5]),P.lineTo(W[6],W[7]),P.moveTo(xt[6],xt[7]),P.lineTo(xt[4],xt[5]),P.lineTo(xt[2],xt[3]),P.lineTo(xt[0],xt[1]),P.clip())}N.push(W),B.push(U),this.drawTile(fe,t,Jt,we,vi,Ri,Ce,xs),Nn&&P.restore(),this.renderedTiles.unshift(fe),this.updateUsedTiles(t.usedTiles,c,fe)}}if(this.renderedResolution=f,this.extentChanged=!this.renderedExtent_||!jn(this.renderedExtent_,T),this.renderedExtent_=T,this.renderedPixelRatio=l,this.postRender(this.context,t),n.extent&&P.restore(),P.imageSmoothingEnabled=!0,this.renderComplete){const k=(U,H)=>{var yt;const nt=q(c),L=H.wantedTiles[nt],It=L?Object.keys(L).length:0;this.updateCacheSize(It),this.tileCache_.expireCache(),(yt=this.sourceTileCache_)==null||yt.expireCache()};t.postRenderFunctions.push(k)}return this.container}updateCacheSize(t){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,t*2)}drawTile(t,e,n,s,r,o,a,l){let h;if(t instanceof Nc){if(h=Oa(t.getData()),!h)throw new Error("Rendering array data is not yet supported")}else h=this.getTileImage(t);if(!h)return;const c=this.getRenderContext(e),u=q(this),d=e.layerStatesArray[e.layerIndex],f=d.opacity*(l?t.getAlpha(u,e.time):1),g=f!==c.globalAlpha;g&&(c.save(),c.globalAlpha=f),c.drawImage(h,a,a,h.width-2*a,h.height-2*a,n,s,r,o),g&&c.restore(),f!==d.opacity?e.animate=!0:l&&t.endTransition(u)}getImage(){const t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}updateUsedTiles(t,e,n){const s=q(e);s in t||(t[s]={}),t[s][n.getKey()]=!0}}const zp=Gp,Er={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class jp extends ls{constructor(t){t=t||{};const e=Object.assign({},t),n=t.cacheSize;delete t.cacheSize,delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=n,this.setPreload(t.preload!==void 0?t.preload:0),this.setUseInterimTilesOnError(t.useInterimTilesOnError!==void 0?t.useInterimTilesOnError:!0)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(Er.PRELOAD)}setPreload(t){this.set(Er.PRELOAD,t)}getUseInterimTilesOnError(){return this.get(Er.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(t){this.set(Er.USE_INTERIM_TILES_ON_ERROR,t)}getData(t){return super.getData(t)}}const Xp=jp;class Bp extends Xp{constructor(t){super(t)}createRenderer(){return new zp(this,{cacheSize:this.getCacheSize()})}}const on=Bp,fi=[0,0,0],an=5;class Yp{constructor(t){this.minZoom=t.minZoom!==void 0?t.minZoom:0,this.resolutions_=t.resolutions,J(dd(this.resolutions_,(s,r)=>r-s,!0),"`resolutions` must be sorted in descending order");let e;if(!t.origins){for(let s=0,r=this.resolutions_.length-1;s<r;++s)if(!e)e=this.resolutions_[s]/this.resolutions_[s+1];else if(this.resolutions_[s]/this.resolutions_[s+1]!==e){e=void 0;break}}this.zoomFactor_=e,this.maxZoom=this.resolutions_.length-1,this.origin_=t.origin!==void 0?t.origin:null,this.origins_=null,t.origins!==void 0&&(this.origins_=t.origins,J(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const n=t.extent;n!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=Ye(n)),J(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,t.tileSizes!==void 0&&(this.tileSizes_=t.tileSizes,J(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=t.tileSize!==void 0?t.tileSize:this.tileSizes_?null:ha,J(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=n!==void 0?n:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],t.sizes!==void 0?this.fullTileRanges_=t.sizes.map((s,r)=>{const o=new jc(Math.min(0,s[0]),Math.max(s[0]-1,-1),Math.min(0,s[1]),Math.max(s[1]-1,-1));if(n){const a=this.getTileRangeForExtentAndZ(n,r);o.minX=Math.max(a.minX,o.minX),o.maxX=Math.min(a.maxX,o.maxX),o.minY=Math.max(a.minY,o.minY),o.maxY=Math.min(a.maxY,o.maxY)}return o}):n&&this.calculateTileRanges_(n)}forEachTileCoord(t,e,n){const s=this.getTileRangeForExtentAndZ(t,e);for(let r=s.minX,o=s.maxX;r<=o;++r)for(let a=s.minY,l=s.maxY;a<=l;++a)n([e,r,a])}forEachTileCoordParentTileRange(t,e,n,s){let r,o,a,l=null,h=t[0]-1;for(this.zoomFactor_===2?(o=t[1],a=t[2]):l=this.getTileCoordExtent(t,s);h>=this.minZoom;){if(o!==void 0&&a!==void 0?(o=Math.floor(o/2),a=Math.floor(a/2),r=ui(o,o,a,a,n)):r=this.getTileRangeForExtentAndZ(l,h,n),e(h,r))return!0;--h}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,n){if(t[0]<this.maxZoom){if(this.zoomFactor_===2){const r=t[1]*2,o=t[2]*2;return ui(r,r+1,o,o+1,e)}const s=this.getTileCoordExtent(t,n||this.tmpExtent_);return this.getTileRangeForExtentAndZ(s,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,n){if(e>this.maxZoom||e<this.minZoom)return null;const s=t[0],r=t[1],o=t[2];if(e===s)return ui(r,o,r,o,n);if(this.zoomFactor_){const l=Math.pow(this.zoomFactor_,e-s),h=Math.floor(r*l),c=Math.floor(o*l);if(e<s)return ui(h,h,c,c,n);const u=Math.floor(l*(r+1))-1,d=Math.floor(l*(o+1))-1;return ui(h,u,c,d,n)}const a=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,e,n)}getTileRangeForExtentAndZ(t,e,n){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,fi);const s=fi[1],r=fi[2];this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,fi);const o=fi[1],a=fi[2];return ui(s,o,r,a,n)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),n=this.getResolution(t[0]),s=Ot(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*s[0]*n,e[1]-(t[2]+.5)*s[1]*n]}getTileCoordExtent(t,e){const n=this.getOrigin(t[0]),s=this.getResolution(t[0]),r=Ot(this.getTileSize(t[0]),this.tmpSize_),o=n[0]+t[1]*r[0]*s,a=n[1]-(t[2]+1)*r[1]*s,l=o+r[0]*s,h=a+r[1]*s;return Te(o,a,l,h,e)}getTileCoordForCoordAndResolution(t,e,n){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,n)}getTileCoordForXYAndResolution_(t,e,n,s,r){const o=this.getZForResolution(n),a=n/this.getResolution(o),l=this.getOrigin(o),h=Ot(this.getTileSize(o),this.tmpSize_);let c=a*(t-l[0])/n/h[0],u=a*(l[1]-e)/n/h[1];return s?(c=We(c,an)-1,u=We(u,an)-1):(c=Is(c,an),u=Is(u,an)),yr(o,c,u,r)}getTileCoordForXYAndZ_(t,e,n,s,r){const o=this.getOrigin(n),a=this.getResolution(n),l=Ot(this.getTileSize(n),this.tmpSize_);let h=(t-o[0])/a/l[0],c=(o[1]-e)/a/l[1];return s?(h=We(h,an)-1,c=We(c,an)-1):(h=Is(h,an),c=Is(c,an)),yr(n,h,c,r)}getTileCoordForCoordAndZ(t,e,n){return this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,n)}getTileCoordResolution(t){return this.resolutions_[t[0]]}getTileSize(t){return this.tileSize_?this.tileSize_:this.tileSizes_[t]}getFullTileRange(t){return this.fullTileRanges_?this.fullTileRanges_[t]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,t):null}getZForResolution(t,e){const n=vs(this.resolutions_,t,e||0);return ot(n,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return mc(e,0,e.length,2,this.getTileCoordExtent(t))}calculateTileRanges_(t){const e=this.resolutions_.length,n=new Array(e);for(let s=this.minZoom;s<e;++s)n[s]=this.getTileRangeForExtentAndZ(t,s);this.fullTileRanges_=n}}const Hc=Yp;function qc(i){let t=i.getDefaultTileGrid();return t||(t=Kp(i),i.setDefaultTileGrid(t)),t}function Wp(i,t,e){const n=t[0],s=i.getTileCoordCenter(t),r=Na(e);if(!cn(r,s)){const o=K(r),a=Math.ceil((r[0]-s[0])/o);return s[0]+=o*a,i.getTileCoordForCoordAndZ(s,n)}return t}function Vp(i,t,e,n){n=n!==void 0?n:"top-left";const s=Jc(i,t,e);return new Hc({extent:i,origin:gd(i,n),resolutions:s,tileSize:e})}function Up(i){const t=i||{},e=t.extent||at("EPSG:3857").getExtent(),n={extent:e,minZoom:t.minZoom,tileSize:t.tileSize,resolutions:Jc(e,t.maxZoom,t.tileSize,t.maxResolution)};return new Hc(n)}function Jc(i,t,e,n){t=t!==void 0?t:H_,e=Ot(e!==void 0?e:ha);const s=ut(i),r=K(i);n=n>0?n:Math.max(r/e[0],s/e[1]);const o=t+1,a=new Array(o);for(let l=0;l<o;++l)a[l]=n/Math.pow(2,l);return a}function Kp(i,t,e,n){const s=Na(i);return Vp(s,t,e,n)}function Na(i){i=at(i);let t=i.getExtent();if(!t){const e=180*Mi.degrees/i.getMetersPerUnit();t=Te(-e,-e,e,e)}return t}function Qc(i,t){const e=[];Object.keys(t).forEach(function(s){t[s]!==null&&t[s]!==void 0&&e.push(s+"="+encodeURIComponent(t[s]))});const n=e.join("&");return i=i.replace(/[?&]$/,""),i+=i.includes("?")?"&":"?",i+n}const $p=/\{z\}/g,Zp=/\{x\}/g,Hp=/\{y\}/g,qp=/\{-y\}/g;function Jp(i,t,e,n,s){return i.replace($p,t.toString()).replace(Zp,e.toString()).replace(Hp,n.toString()).replace(qp,function(){if(s===void 0)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(s-n).toString()})}function Qp(i){const t=[];let e=/\{([a-z])-([a-z])\}/.exec(i);if(e){const n=e[1].charCodeAt(0),s=e[2].charCodeAt(0);let r;for(r=n;r<=s;++r)t.push(i.replace(e[0],String.fromCharCode(r)));return t}if(e=/\{(\d+)-(\d+)\}/.exec(i),e){const n=parseInt(e[2],10);for(let s=parseInt(e[1],10);s<=n;s++)t.push(i.replace(e[0],s.toString()));return t}return t.push(i),t}function ty(i,t){return function(e,n,s){if(!e)return;let r;const o=e[0];if(t){const a=t.getFullTileRange(o);a&&(r=a.getHeight()-1)}return Jp(i,o,e[1],e[2],r)}}function ey(i,t){const e=i.length,n=new Array(e);for(let s=0;s<e;++s)n[s]=ty(i[s],t);return ny(n)}function ny(i){return i.length===1?i[0]:function(t,e,n){if(!t)return;const s=$c(t),r=un(s,i.length);return i[r](t,e,n)}}class iy extends Ea{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_=t.tilePixelRatio!==void 0?t.tilePixelRatio:1,this.tileGrid=t.tileGrid!==void 0?t.tileGrid:null;const e=[256,256];this.tileGrid&&Ot(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tmpSize=[0,0],this.key_=t.key||q(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,n,s,r,o){return j()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:qc(t)}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,n){const s=this.getTileGridForProjection(n),r=this.getTilePixelRatio(e),o=Ot(s.getTileSize(t),this.tmpSize);return r==1?o:fg(o,r,this.tmpSize)}getTileCoordForTileUrlFunction(t,e){const n=e!==void 0?e:this.getProjection(),s=e!==void 0?this.getTileGridForProjection(n):this.tileGrid||this.getTileGridForProjection(n);return this.getWrapX()&&n.isGlobal()&&(t=Wp(s,t,n)),kp(t,s)?t:null}clear(){}refresh(){this.clear(),super.refresh()}}class sy extends se{constructor(t,e){super(t),this.tile=e}}const ry=iy,Ga={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};class za extends ry{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===za.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,n=q(e),s=e.getState();let r;s==F.LOADING?(this.tileLoadingKeys_[n]=!0,r=Ga.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],r=s==F.ERROR?Ga.TILELOADERROR:s==F.LOADED?Ga.TILELOADEND:void 0),r!=null&&this.dispatchEvent(new sy(r,e))}setTileLoadFunction(t){this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,typeof e<"u"?this.setKey(e):this.changed()}setUrl(t){const e=Qp(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join(`
7
+ `);this.generateTileUrlFunction_?this.setTileUrlFunction(ey(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,n){}}const oy=za;class ay extends oy{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:ly,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate!==void 0?t.interpolate:!0,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.crossOrigin=t.crossOrigin!==void 0?t.crossOrigin:null,this.tileClass=t.tileClass!==void 0?t.tileClass:Gc,this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(t){return this.getProjection()&&t&&!mn(this.getProjection(),t)?0:this.getGutter()}getGutter(){return 0}getKey(){let t=super.getKey();return this.getInterpolate()||(t+=":disable-interpolation"),t}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||mn(e,t)))return this.tileGrid;const n=q(t);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=qc(t)),this.tileGridForProjection[n]}createTile_(t,e,n,s,r,o){const a=[t,e,n],l=this.getTileCoordForTileUrlFunction(a,r),h=l?this.tileUrlFunction(l,s,r):void 0,c=new this.tileClass(a,h!==void 0?F.IDLE:F.EMPTY,h!==void 0?h:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return c.key=o,c.addEventListener(z.CHANGE,this.handleTileChange.bind(this)),c}getTile(t,e,n,s,r,o){const a=this.getProjection();if(!a||!r||mn(a,r))return this.getTileInternal(t,e,n,s,a||r);const l=[t,e,n],h=this.getKey(),c=this.getTileGridForProjection(a),u=this.getTileGridForProjection(r),d=this.getTileCoordForTileUrlFunction(l,r),f=new Uc(a,c,r,u,l,d,this.getTilePixelRatio(s),this.getGutter(),(g,_,m,p)=>this.getTileInternal(g,_,m,p,a,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return f.key=h,f}getTileInternal(t,e,n,s,r,o){const a=this.getKey(),l=xr(this,a,t,e,n);if(o&&o.containsKey(l))return o.get(l);const h=this.createTile_(t,e,n,s,r,a);return o==null||o.set(l,h),h}setRenderReprojectionEdges(t){this.renderReprojectionEdges_!=t&&(this.renderReprojectionEdges_=t,this.changed())}setTileGridForProjection(t,e){const n=at(t);if(n){const s=q(n);s in this.tileGridForProjection||(this.tileGridForProjection[s]=e)}}}function ly(i,t){if(Bt){const e=i.getCrossOrigin();let n="same-origin",s="same-origin";e==="anonymous"||e===""?(n="cors",s="omit"):e==="use-credentials"&&(n="cors",s="include"),fetch(t,{mode:n,credentials:s}).then(r=>{if(!r.ok)throw new Error(`HTTP ${r.status}`);return r.blob()}).then(r=>createImageBitmap(r)).then(r=>{var l;const o=i.getImage();o.width=r.width,o.height=r.height,o.getContext("2d").drawImage(r,0,0),(l=r.close)==null||l.call(r),o.dispatchEvent(new Event("load"))}).catch(()=>{i.getImage().dispatchEvent(new Event("error"))});return}i.getImage().src=t}const tu=ay;class hy extends tu{constructor(t){t=t||{};const e=t.projection!==void 0?t.projection:"EPSG:3857",n=t.tileGrid!==void 0?t.tileGrid:Up({extent:Na(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize});super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:e,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:n,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX!==void 0?t.wrapX:!0,transition:t.transition,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.gutter_=t.gutter!==void 0?t.gutter:0}getGutter(){return this.gutter_}}const Pn=hy;var V={};V.create=function(i,t){t=t||{};var e;if(i==="TEXT")e=document.createTextNode(t.html||""),t.parent&&t.parent.appendChild(e);else{e=document.createElement(i),/button/i.test(i)&&e.setAttribute("type","button");for(var n in t)switch(n){case"className":{t.className&&t.className.trim&&e.setAttribute("class",t.className.trim());break}case"text":{e.innerText=t.text;break}case"html":{t.html instanceof Element?e.appendChild(t.html):t.html!==void 0&&(e.innerHTML=t.html);break}case"parent":{t.parent&&t.parent.appendChild(e);break}case"options":{if(/select/i.test(i))for(var s in t.options)V.create("OPTION",{html:s,value:t.options[s],parent:e});break}case"style":{V.setStyle(e,t.style);break}case"change":case"click":{V.addListener(e,n,t[n]);break}case"on":{for(var r in t.on)V.addListener(e,r,t.on[r]);break}case"checked":{e.checked=!!t.checked;break}default:{e.setAttribute(n,t[n]);break}}}return e},V.createSwitch=function(i){var t=V.create("INPUT",{type:"checkbox",on:i.on,click:i.click,change:i.change,parent:i.parent});return Object.assign({input:t},i||{}),t},V.createCheck=function(i){var t=V.create("INPUT",{name:i.name,type:i.type==="radio"?"radio":"checkbox",on:i.on,parent:i.parent});return Object.assign({input:t},i||{}),i.type,t},V.setHTML=function(i,t){t instanceof Element?i.appendChild(t):t!==void 0&&(i.innerHTML=t)},V.appendText=function(i,t){i.appendChild(document.createTextNode(t||""))},V.addListener=function(i,t,e,n){typeof t=="string"&&(t=t.split(" ")),t.forEach(function(s){i.addEventListener(s,e,n)})},V.removeListener=function(i,t,e){typeof t=="string"&&(t=t.split(" ")),t.forEach(function(n){i.removeEventListener(n,e)})},V.show=function(i){i.style.display=""},V.hide=function(i){i.style.display="none"},V.hidden=function(i){return V.getStyle(i,"display")==="none"},V.toggle=function(i){i.style.display=i.style.display==="none"?"":"none"},V.setStyle=function(i,t){for(var e in t)switch(e){case"top":case"left":case"bottom":case"right":case"minWidth":case"maxWidth":case"width":case"height":{typeof t[e]=="number"?i.style[e]=t[e]+"px":i.style[e]=t[e];break}default:i.style[e]=t[e]}},V.getStyle=function(i,t){var e,n=(i.ownerDocument||document).defaultView;if(n&&n.getComputedStyle)t=t.replace(/([A-Z])/g,"-$1").toLowerCase(),e=n.getComputedStyle(i,null).getPropertyValue(t);else if(i.currentStyle&&(t=t.replace(/-(\w)/g,function(s,r){return r.toUpperCase()}),e=i.currentStyle[t],/^\d+(em|pt|%|ex)?$/i.test(e)))return function(s){var r=i.style.left,o=i.runtimeStyle.left;return i.runtimeStyle.left=i.currentStyle.left,i.style.left=s||0,s=i.style.pixelLeft+"px",i.style.left=r,i.runtimeStyle.left=o,s}(e);return/px$/.test(e)?parseInt(e):e},V.outerHeight=function(i){return i.offsetHeight+V.getStyle(i,"marginBottom")},V.outerWidth=function(i){return i.offsetWidth+V.getStyle(i,"marginLeft")},V.offsetRect=function(i){var t=i.getBoundingClientRect();return{top:t.top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0),left:t.left+(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0),height:t.height||t.bottom-t.top,width:t.width||t.right-t.left}},V.getFixedOffset=function(i){var t={left:0,top:0},e=function(n){if(!n)return t;if(V.getStyle(n,"position")==="absolute"&&V.getStyle(n,"transform")!=="none"){var s=n.getBoundingClientRect();return t.left+=s.left,t.top+=s.top,t}return e(n.offsetParent)};return e(i.offsetParent)},V.positionRect=function(i,t){var e=0,n=0,s=function(r){if(r)return e+=r.offsetLeft,n+=r.offsetTop,s(r.offsetParent);var o={top:i.offsetTop+n,left:i.offsetLeft+e};return t&&(o.top-=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,o.left-=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0),o.bottom=o.top+i.offsetHeight,o.right=o.top+i.offsetWidth,o};return s(i.offsetParent)},V.scrollDiv=function(i,t){t=t||{};var e=!1,n=0,s,r=0,o=typeof t.onmove=="function"?t.onmove:function(){},a=t.vertical?"screenY":"screenX",l=t.vertical?"scrollTop":"scrollLeft",h=!1,c,u,d=0,f=function(){C&&(d++,setTimeout(g))},g=function(){if(C){if(d--,d)return;var v=i.clientHeight,R=i.scrollHeight;c=v/R,C.style.height=c*100+"%",C.style.top=i.scrollTop/R*100+"%",y.style.height=v+"px",v>R-.5?y.classList.add("ol-100pc"):y.classList.remove("ol-100pc")}},_=function(v){v.target.classList.contains("ol-noscroll")||(h=!1,e=v[a],r=new Date,i.classList.add("ol-move"),v.preventDefault(),window.addEventListener("pointermove",m),V.addListener(window,["pointerup","pointercancel"],w))},m=function(v){if(e!==!1){var R=(u?-1/c:1)*(e-v[a]);h=h||Math.round(R),i[l]+=R,s=new Date,s-r&&(n=(n+R/(s-r))/2),e=v[a],r=s,R&&o(!0)}else h=!0},p=function(v){var R=v>0?Math.min(100,v/2):Math.max(-100,v/2);v-=R,i[l]+=R,-1<v&&v<1?(h?setTimeout(function(){i.classList.remove("ol-move")}):i.classList.remove("ol-move"),h=!1,o(!1)):setTimeout(function(){p(v)},40)},y,C;if(t.vertical&&t.minibar){var E=function(v){i.removeEventListener("pointermove",E),i.parentNode.classList.add("ol-miniscroll"),C=V.create("DIV"),y=V.create("DIV",{className:"ol-scroll",html:C}),i.parentNode.insertBefore(y,i),C.addEventListener("pointerdown",function(R){u=!0,_(R)}),t.mousewheel&&(V.addListener(y,["mousewheel","DOMMouseScroll","onmousewheel"],function(R){T(R)}),V.addListener(C,["mousewheel","DOMMouseScroll","onmousewheel"],function(R){T(R)})),i.parentNode.addEventListener("pointerenter",f),window.addEventListener("resize",f),v!==!1&&f()};i.parentNode?E(!1):i.addEventListener("pointermove",E),i.addEventListener("scroll",function(){f()})}i.style["touch-action"]="none",i.style.overflow="hidden",i.classList.add("ol-scrolldiv"),V.addListener(i,["pointerdown"],function(v){u=!1,_(v)}),i.addEventListener("click",function(v){i.classList.contains("ol-move")&&(v.preventDefault(),v.stopPropagation())},!0);var w=function(v){r=new Date-r,r>100||u?n=0:r>0&&(n=((n||0)+(e-v[a])/r)/2),p(t.animate===!1?0:n*200),e=!1,n=0,r=0,i.classList.contains("ol-move")?i.classList.remove("ol-hasClick"):(i.classList.add("ol-hasClick"),setTimeout(function(){i.classList.remove("ol-hasClick")},500)),u=!1,window.removeEventListener("pointermove",m),V.removeListener(window,["pointerup","pointercancel"],w)},T=function(v){var R=Math.max(-1,Math.min(1,v.wheelDelta||-v.detail));return i.classList.add("ol-move"),i[l]-=R*30,i.classList.remove("ol-move"),!1};return t.mousewheel&&V.addListener(i,["mousewheel","DOMMouseScroll","onmousewheel"],T),{refresh:f}},V.dispatchEvent=function(i,t){var e;try{e=new CustomEvent(i)}catch{e=document.createEvent("CustomEvent"),e.initCustomEvent(i,!0,!0,{})}t.dispatchEvent(e)};const Rt={ELEMENT:"element",MAP:"map",OFFSET:"offset",POSITION:"position",POSITIONING:"positioning"};class cy extends Kt{constructor(t){super(),this.on,this.once,this.un,this.options=t,this.id=t.id,this.insertFirst=t.insertFirst!==void 0?t.insertFirst:!0,this.stopEvent=t.stopEvent!==void 0?t.stopEvent:!0,this.element=document.createElement("div"),this.element.className=t.className!==void 0?t.className:"ol-overlay-container "+If,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=t.autoPan===!0?{}:t.autoPan||void 0,this.rendered={transform_:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(Rt.ELEMENT,this.handleElementChanged),this.addChangeListener(Rt.MAP,this.handleMapChanged),this.addChangeListener(Rt.OFFSET,this.handleOffsetChanged),this.addChangeListener(Rt.POSITION,this.handlePositionChanged),this.addChangeListener(Rt.POSITIONING,this.handlePositioningChanged),t.element!==void 0&&this.setElement(t.element),this.setOffset(t.offset!==void 0?t.offset:[0,0]),this.setPositioning(t.positioning||"top-left"),t.position!==void 0&&this.setPosition(t.position)}getElement(){return this.get(Rt.ELEMENT)}getId(){return this.id}getMap(){return this.get(Rt.MAP)||null}getOffset(){return this.get(Rt.OFFSET)}getPosition(){return this.get(Rt.POSITION)}getPositioning(){return this.get(Rt.POSITIONING)}handleElementChanged(){Gl(this.element);const t=this.getElement();t&&this.element.appendChild(t)}handleMapChanged(){var e;this.mapPostrenderListenerKey&&((e=this.element)==null||e.remove(),it(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const t=this.getMap();if(t){this.mapPostrenderListenerKey=$(t,Ge.POSTRENDER,this.render,this),this.updatePixelPosition();const n=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();this.insertFirst?n.insertBefore(this.element,n.childNodes[0]||null):n.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(t){this.set(Rt.ELEMENT,t)}setMap(t){this.set(Rt.MAP,t)}setOffset(t){this.set(Rt.OFFSET,t)}setPosition(t){this.set(Rt.POSITION,t)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(t){const e=this.getMap();if(!e||!e.getTargetElement()||!this.get(Rt.POSITION))return;const n=this.getRect(e.getTargetElement(),e.getSize()),s=this.getElement(),r=this.getRect(s,[Rd(s),Td(s)]);t=t||{};const o=t.margin===void 0?20:t.margin;if(!ge(n,r)){const a=r[0]-n[0],l=n[2]-r[2],h=r[1]-n[1],c=n[3]-r[3],u=[0,0];if(a<0?u[0]=a-o:l<0&&(u[0]=Math.abs(l)+o),h<0?u[1]=h-o:c<0&&(u[1]=Math.abs(c)+o),u[0]!==0||u[1]!==0){const d=e.getView().getCenterInternal(),f=e.getPixelFromCoordinateInternal(d);if(!f)return;const g=[f[0]+u[0],f[1]+u[1]],_=t.animation||{};e.getView().animateInternal({center:e.getCoordinateFromPixelInternal(g),duration:_.duration,easing:_.easing})}}}getRect(t,e){const n=t.getBoundingClientRect(),s=n.left+window.pageXOffset,r=n.top+window.pageYOffset;return[s,r,s+e[0],r+e[1]]}setPositioning(t){this.set(Rt.POSITIONING,t)}setVisible(t){this.rendered.visible!==t&&(this.element.style.display=t?"":"none",this.rendered.visible=t)}updatePixelPosition(){const t=this.getMap(),e=this.getPosition();if(!t||!t.isRendered()||!e){this.setVisible(!1);return}const n=t.getPixelFromCoordinate(e),s=t.getSize();this.updateRenderedPosition(n,s)}updateRenderedPosition(t,e){const n=this.element.style,s=this.getOffset(),r=this.getPositioning();this.setVisible(!0);const o=`${t[0]+s[0]}px`,a=`${t[1]+s[1]}px`;let l="0%",h="0%";r=="bottom-right"||r=="center-right"||r=="top-right"?l="-100%":(r=="bottom-center"||r=="center-center"||r=="top-center")&&(l="-50%"),r=="bottom-left"||r=="bottom-center"||r=="bottom-right"?h="-100%":(r=="center-left"||r=="center-center"||r=="center-right")&&(h="-50%");const c=`translate(${l}, ${h}) translate(${o}, ${a})`;this.rendered.transform_!=c&&(this.rendered.transform_=c,n.transform=c)}getOptions(){return this.options}}const ja=cy;var lt={};lt.getTransform=function(i){var t=window.getComputedStyle(i,null),e=t.getPropertyValue("-webkit-transform")||t.getPropertyValue("-moz-transform")||t.getPropertyValue("-ms-transform")||t.getPropertyValue("-o-transform")||t.getPropertyValue("transform"),n=e.split("(")[1].split(")")[0].split(","),s=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],r,o;if(n.length===16)for(r=0;r<4;++r)for(o=0;o<4;++o)s[o][r]=+n[r*4+o];else for(r=0;r<3;++r)for(o=0;o<2;++o)s[o][r]=+n[r*2+o];return s},lt.getTransformOrigin=function(i){for(var t=window.getComputedStyle(i,null),e=t.getPropertyValue("-webkit-transform-origin")||t.getPropertyValue("-moz-transform-origin")||t.getPropertyValue("-ms-transform-origin")||t.getPropertyValue("-o-transform-origin")||t.getPropertyValue("transform-origin"),n=e.split(" "),s=[0,0,0,1],r=0;r<n.length;++r)s[r]=parseInt(n[r]);return s},lt.translateMatrix=function(i,t,e){return[[1,0,0,i],[0,1,0,t],[0,0,1,e],[0,0,0,1]]},lt.identity=function(){return[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]},lt.roundTo=function(i,t){t||(t=1e-10);for(var e=[[],[],[],[]],n=0;n<4;n++)for(var s=0;s<4;s++)e[n][s]=Math.round(i[n][s]/t)*t;return e},lt.multiply=function(i,t){for(var e=[[],[],[],[]],n=0;n<4;++n)for(var s=0;s<4;++s){for(var r=0,o=0;o<4;++o)r+=i[o][n]*t[s][o];e[s][n]=r}return e},lt.computeTransformMatrix=function(i,t){var e=lt.translateMatrix(-t[0],-t[1],-t[2]),n=lt.translateMatrix(t[0],t[1],t[2]),s=lt.multiply(e,i);return lt.multiply(s,n)},lt.transformVertex=function(i,t){for(var e=[t[0],t[1],0,1],n=[],s=0;s<4;++s){n[s]=0;for(var r=0;r<4;++r)n[s]+=+i[s][r]*e[r]}return n},lt.projectVertex=function(i){for(var t=[],e=0;e<4;++e)t[e]=i[e]/i[3];return t},lt.inverse=function(i){var t=i[0][0]*i[1][1]-i[1][0]*i[0][1],e=i[0][0]*i[1][2]-i[1][0]*i[0][2],n=i[0][0]*i[1][3]-i[1][0]*i[0][3],s=i[0][1]*i[1][2]-i[1][1]*i[0][2],r=i[0][1]*i[1][3]-i[1][1]*i[0][3],o=i[0][2]*i[1][3]-i[1][2]*i[0][3],a=i[2][2]*i[3][3]-i[3][2]*i[2][3],l=i[2][1]*i[3][3]-i[3][1]*i[2][3],h=i[2][1]*i[3][2]-i[3][1]*i[2][2],c=i[2][0]*i[3][3]-i[3][0]*i[2][3],u=i[2][0]*i[3][2]-i[3][0]*i[2][2],d=i[2][0]*i[3][1]-i[3][0]*i[2][1],f=1/(t*a-e*l+n*h+s*c-r*u+o*d);if(isNaN(f)||f===1/0)throw new Error("Inverse determinant attempted to divide by zero.");return[[(i[1][1]*a-i[1][2]*l+i[1][3]*h)*f,(-i[0][1]*a+i[0][2]*l-i[0][3]*h)*f,(i[3][1]*o-i[3][2]*r+i[3][3]*s)*f,(-i[2][1]*o+i[2][2]*r-i[2][3]*s)*f],[(-i[1][0]*a+i[1][2]*c-i[1][3]*u)*f,(i[0][0]*a-i[0][2]*c+i[0][3]*u)*f,(-i[3][0]*o+i[3][2]*n-i[3][3]*e)*f,(i[2][0]*o-i[2][2]*n+i[2][3]*e)*f],[(i[1][0]*l-i[1][1]*c+i[1][3]*d)*f,(-i[0][0]*l+i[0][1]*c-i[0][3]*d)*f,(i[3][0]*r-i[3][1]*n+i[3][3]*t)*f,(-i[2][0]*r+i[2][1]*n-i[2][3]*t)*f],[(-i[1][0]*h+i[1][1]*u-i[1][2]*d)*f,(i[0][0]*h-i[0][1]*u+i[0][2]*d)*f,(-i[3][0]*s+i[3][1]*e-i[3][2]*t)*f,(i[2][0]*s-i[2][1]*e+i[2][2]*t)*f]]};var uy=class extends Ln{constructor(t){var e=t.target instanceof Element?t.target:document.getElementById(t.target);window.getComputedStyle(e).position!=="absolute"&&(e.style.position="relative"),e.style.overflow="hidden";var n=V.create("DIV",{className:"ol-perspective-map",parent:e}),s={};Object.assign(s,t),s.target=n,super(s),this._tiltCondition=t.tiltCondition||zm}getPixelRatio(){return window.devicePixelRatio}setPerspective(t,e){e=e||{},t>30?t=30:t<0&&(t=0);var n=this._angle||0,s=Math.round(t*10)/10,r=this.getTarget().querySelector(".ol-layers").style;cancelAnimationFrame(this._animatedPerspective),requestAnimationFrame((function(o){this._animatePerpective(o,o,r,n,s,e.duration,e.easing||Zo)}).bind(this))}_animatePerpective(t,e,n,s,r,o,a){var l,h;o===0?(l=1,h=!0):(l=(e-t)/(o||500),h=l>=1),l=a(l);var c;h?c=this._angle=r:c=this._angle=s+(r-s)*l;var u=c/30;n.transform="translateY(-"+17*u+"%) perspective(200px) rotateX("+c+"deg) scaleY("+(1-u/2)+")",this.getMatrix3D(!0),this.render(),h||requestAnimationFrame((function(d){this._animatePerpective(t,d,n,s,r,o||500,a||Zo)}).bind(this)),this.dispatchEvent({type:"change:perspective",angle:c,animating:!h})}handleMapBrowserEvent(t){if(t.pixel=[t.originalEvent.offsetX/this.getPixelRatio(),t.originalEvent.offsetY/this.getPixelRatio()],t.coordinate=this.getCoordinateFromPixel(t.pixel),Ln.prototype.handleMapBrowserEvent.call(this,t),this._tiltCondition(t))switch(t.type){case"pointerdown":{this._dragging=t.originalEvent.offsetY;break}case"pointerup":{this._dragging=!1;break}case"pointerdrag":{if(this._dragging!==!1){var e=t.originalEvent.offsetY>this._dragging?.5:-.5;e&&this.setPerspective((this._angle||0)+e,{duration:0}),this._dragging=t.originalEvent.offsetY}break}}else this._dragging=!1}getMatrix3D(t){if(t){var e=this.getTarget().querySelector(".ol-layers"),n=lt.getTransform(e),s=lt.getTransformOrigin(e);this._matrixTransform=lt.computeTransformMatrix(n,s)}return this._matrixTransform||(this._matrixTransform=lt.identity()),this._matrixTransform}getPixelScreenFromCoordinate(t){var e=this.getPixelFromCoordinate(t),n=this.getMatrix3D(),s=lt.transformVertex(n,e);return s=lt.projectVertex(s),[s[0],s[1]]}getPixelFromPixelScreen(t){var e=lt.inverse(this.getMatrix3D()),n=lt.transformVertex(e,t);return n=lt.projectVertex(n),[n[0],n[1]]}};(function(){var i=ja.prototype.updatePixelPosition;ja.prototype.updatePixelPosition=function(){var t=this.getMap();if(t&&t instanceof uy){var e=this.getPosition();if(!t||!t.isRendered()||!e){this.setVisible(!1);return}var n=t.getPixelScreenFromCoordinate(e),s=t.getSize();n[0]-=s[0]/4,n[1]-=s[1]/4,this.updateRenderedPosition(n,s)}else i.call(this)}})();let gi="0711195325a7623fc91fa85aa075b7d4";const eu="/sky/map?token=nszx_sk_img&x={x}&y={y}&l={z}",nu="/sky/map?token=nszx_sk_label&x={x}&y={y}&l={z}",iu=`https://t0.tianditu.gov.cn/img_w/wmts?tk=${gi}&service=wmts&request=gettile&version=1.0.0&layer=img&style=default&format=tiles&tilematrixset=w&width=256&height=256&tilematrix={z}&tilerow={y}&tilecol={x}`,su=`https://t0.tianditu.gov.cn/cia_w/wmts?tk=${gi}&service=wmts&request=gettile&version=1.0.0&layer=cia&style=default&format=tiles&tilematrixset=w&width=256&height=256&tilematrix={z}&tilerow={y}&tilecol={x}`,ru=`https://t0.tianditu.gov.cn/vec_w/wmts?tk=${gi}&service=wmts&request=gettile&version=1.0.0&layer=vec&style=default&format=tiles&tilematrixset=w&width=256&height=256&tilematrix={z}&tilerow={y}&tilecol={x}`,ou=`https://t0.tianditu.gov.cn/cva_w/wmts?tk=${gi}&service=wmts&request=gettile&version=1.0.0&layer=cva&style=default&format=tiles&tilematrixset=w&width=256&height=256&tilematrix={z}&tilerow={y}&tilecol={x}`,dy=(i,t)=>{const e=i.getImage();fetch(t).then(n=>{if(console.log(`天地图请求状态码: ${n.status}`),n.status===429){console.error("⚠️ 天地图请求过多,已达到速率限制!"),gi="9ecb10975f45744bbf807e0ad0644816",fy(),e.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";return}if(!n.ok)throw new Error(`HTTP错误,状态码: ${n.status}`);return n.blob().then(s=>{const r=URL.createObjectURL(s);e.src=r})}).catch(n=>{console.error("瓦片加载错误:",n),e.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"})};function fy(){const i=t=>`https://t0.tianditu.gov.cn/${t}_w/wmts?tk=${gi}&service=wmts&request=gettile&version=1.0.0&layer=${t}&style=default&format=tiles&tilematrixset=w&width=256&height=256&tilematrix={z}&tilerow={y}&tilecol={x}`;st.tdt_img.getSource().setUrl(i("img")),st.tdt_cia.getSource().setUrl(i("cia")),st.tdt_vec.getSource().setUrl(i("vec")),st.tdt_cva.getSource().setUrl(i("cva"))}const st={sky_map:new on({source:new Pn({url:eu}),visible:!1}),sky_note:new on({source:new Pn({url:nu}),visible:!1,zIndex:2}),tdt_img:new on({source:new Pn({url:iu,crossOrigin:"anonymous",tileLoadFunction:dy})}),tdt_cia:new on({source:new Pn({url:su}),zIndex:2}),tdt_vec:new on({source:new Pn({url:ru}),visible:!1}),tdt_cva:new on({source:new Pn({url:ou}),visible:!1,zIndex:2})},gy=()=>window.xmMap,_y=Ln;let Cr=!1,Xa=!0;const my=i=>{console.log(i,"laaa"),i==="tdt_img"?Cr||(st.sky_map.setVisible(!0),st.sky_note.setVisible(!0),st.tdt_img.setVisible(!1),st.tdt_cia.setVisible(!1),Cr=!0,Xa=!1):Xa||(st.sky_map.setVisible(!1),st.sky_note.setVisible(!1),st.tdt_img.setVisible(!0),st.tdt_cia.setVisible(!0),Xa=!0,Cr=!1)},py=i=>{i?(st.sky_map.setVisible(!1),st.sky_note.setVisible(!1),st.tdt_img.setVisible(!1),st.tdt_cia.setVisible(!1)):Cr?(st.sky_map.setVisible(!0),st.sky_note.setVisible(!0)):(st.tdt_img.setVisible(!0),st.tdt_cia.setVisible(!0))},yy=()=>new ce({projection:"EPSG:4326",center:[102.836837,30.38723],zoom:7}),au={layers:[st.sky_map,st.sky_note,st.tdt_img,st.tdt_cia],target:"olMap",view:new ce({projection:"EPSG:4326",center:[102.836837,30.38723],zoom:7}),controls:Mc({zoom:!1,rotate:!1,attribution:!1}).extend([])},xy=()=>{let i=new Ln(au);return window.xmMap=i,i},us={},Ey=i=>{const{listenType:t,callback:e,removeListener:n,data:s}=i,r=window.xmMap;if(n){const a=us[t];a&&(a.forEach(l=>r.un([t],l)),delete us[t]);return}const o=a=>{e&&e(a,s)};r.on([t],o),us[t]||(us[t]=[]),us[t].push(o)},Cy=()=>{window.xmMap?(Gr(!0),window.xmMap.dispose(),console.warn("地图摧毁完成"),window.xmMap=null,window.xmglobalLayer=null):console.warn("地图实例不存在")};class wy{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=zt,this.supportedMediaTypes=null}getReadOptions(t,e){if(e){let n=e.dataProjection?at(e.dataProjection):this.readProjection(t);e.extent&&n&&n.getUnits()==="tile-pixels"&&(n=at(n),n.setWorldExtent(e.extent)),e={dataProjection:n,featureProjection:e.featureProjection}}return this.adaptOptions(e)}adaptOptions(t){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},t)}getType(){return j()}readFeature(t,e){return j()}readFeatures(t,e){return j()}readGeometry(t,e){return j()}readProjection(t){return j()}writeFeature(t,e){return j()}writeFeatures(t,e){return j()}writeGeometry(t,e){return j()}}function Ba(i,t,e){const n=e?at(e.featureProjection):null,s=e?at(e.dataProjection):null;let r=i;if(n&&s&&!mn(n,s)){t&&(r=i.clone());const o=t?n:s,a=t?s:n;o.getUnits()==="tile-pixels"?r.transform(o,a):r.applyTransform(Fi(o,a))}if(t&&e&&e.decimals!==void 0){const o=Math.pow(10,e.decimals),a=function(l){for(let h=0,c=l.length;h<c;++h)l[h]=Math.round(l[h]*o)/o;return l};r===i&&(r=i.clone()),r.applyTransform(a)}return r}const vy={Point:he,LineString:Sn,Polygon:Zt,MultiPoint:ya,MultiLineString:ma,MultiPolygon:xa};function Ry(i,t,e){return Array.isArray(t[0])?(yc(i,0,t,e)||(i=i.slice(),ra(i,0,t,e)),i):(sa(i,0,t,e)||(i=i.slice(),rr(i,0,t,e)),i)}function lu(i,t){var r;const e=i.geometry;if(!e)return[];if(Array.isArray(e))return e.map(o=>lu({...i,geometry:o})).flat();const n=e.type==="MultiPolygon"?"Polygon":e.type;if(n==="GeometryCollection"||n==="Circle")throw new Error("Unsupported geometry type: "+n);const s=e.layout.length;return Ba(new en(n,n==="Polygon"?Ry(e.flatCoordinates,e.ends,s):e.flatCoordinates,(r=e.ends)==null?void 0:r.flat(),s,i.properties||{},i.id).enableSimplifyTransformed(),!1,t)}function Ya(i,t){if(!i)return null;if(Array.isArray(i)){const n=i.map(s=>Ya(s,t));return new Ic(n)}const e=vy[i.type];return Ba(new e(i.flatCoordinates,i.layout||"XY",i.ends),!1,t)}class Ty extends wy{constructor(){super()}getType(){return"json"}readFeature(t,e){return this.readFeatureFromObject(wr(t),this.getReadOptions(t,e))}readFeatures(t,e){return this.readFeaturesFromObject(wr(t),this.getReadOptions(t,e))}readFeatureFromObject(t,e){return j()}readFeaturesFromObject(t,e){return j()}readGeometry(t,e){return this.readGeometryFromObject(wr(t),this.getReadOptions(t,e))}readGeometryFromObject(t,e){return j()}readProjection(t){return this.readProjectionFromObject(wr(t))}readProjectionFromObject(t){return j()}writeFeature(t,e){return JSON.stringify(this.writeFeatureObject(t,e))}writeFeatureObject(t,e){return j()}writeFeatures(t,e){return JSON.stringify(this.writeFeaturesObject(t,e))}writeFeaturesObject(t,e){return j()}writeGeometry(t,e){return JSON.stringify(this.writeGeometryObject(t,e))}writeGeometryObject(t,e){return j()}}function wr(i){if(typeof i=="string"){const t=JSON.parse(i);return t||null}return i!==null?i:null}const Sy=Ty;class Iy extends Sy{constructor(t){t=t||{},super(),this.dataProjection=at(t.dataProjection?t.dataProjection:"EPSG:4326"),t.featureProjection&&(this.defaultFeatureProjection=at(t.featureProjection)),t.featureClass&&(this.featureClass=t.featureClass),this.geometryName_=t.geometryName,this.extractGeometryName_=t.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(t,e){let n=null;t.type==="Feature"?n=t:n={type:"Feature",geometry:t,properties:null};const s=Wa(n.geometry);if(this.featureClass===en)return lu({geometry:s,id:n.id,properties:n.properties},e);const r=new zt;return this.geometryName_?r.setGeometryName(this.geometryName_):this.extractGeometryName_&&n.geometry_name&&r.setGeometryName(n.geometry_name),r.setGeometry(Ya(s,e)),"id"in n&&r.setId(n.id),n.properties&&r.setProperties(n.properties,!0),r}readFeaturesFromObject(t,e){const n=t;let s=null;if(n.type==="FeatureCollection"){const r=t;s=[];const o=r.features;for(let a=0,l=o.length;a<l;++a){const h=this.readFeatureFromObject(o[a],e);h&&s.push(h)}}else s=[this.readFeatureFromObject(t,e)];return s.flat()}readGeometryFromObject(t,e){return Ly(t,e)}readProjectionFromObject(t){const e=t.crs;let n;if(e)if(e.type=="name")n=at(e.properties.name);else if(e.type==="EPSG")n=at("EPSG:"+e.properties.code);else throw new Error("Unknown SRS type");else n=this.dataProjection;return n}writeFeatureObject(t,e){e=this.adaptOptions(e);const n={type:"Feature",geometry:null,properties:null},s=t.getId();if(s!==void 0&&(n.id=s),!t.hasProperties())return n;const r=t.getProperties(),o=t.getGeometry();return o&&(n.geometry=Va(o,e),delete r[t.getGeometryName()]),gn(r)||(n.properties=r),n}writeFeaturesObject(t,e){e=this.adaptOptions(e);const n=[];for(let s=0,r=t.length;s<r;++s)n.push(this.writeFeatureObject(t[s],e));return{type:"FeatureCollection",features:n}}writeGeometryObject(t,e){return Va(t,this.adaptOptions(e))}}function Wa(i,t){if(!i)return null;let e;switch(i.type){case"Point":{e=by(i);break}case"LineString":{e=My(i);break}case"Polygon":{e=Fy(i);break}case"MultiPoint":{e=Oy(i);break}case"MultiLineString":{e=Ay(i);break}case"MultiPolygon":{e=Dy(i);break}case"GeometryCollection":{e=Py(i);break}default:throw new Error("Unsupported GeoJSON type: "+i.type)}return e}function Ly(i,t){const e=Wa(i);return Ya(e,t)}function Py(i,t){return i.geometries.map(function(n){return Wa(n)})}function by(i){const t=i.coordinates;return{type:"Point",flatCoordinates:t,layout:Cn(t.length)}}function My(i){var n;const t=i.coordinates,e=t.flat();return{type:"LineString",flatCoordinates:e,ends:[e.length],layout:Cn(((n=t[0])==null?void 0:n.length)||2)}}function Ay(i){var r,o;const t=i.coordinates,e=((o=(r=t[0])==null?void 0:r[0])==null?void 0:o.length)||2,n=[],s=os(n,0,t,e);return{type:"MultiLineString",flatCoordinates:n,ends:s,layout:Cn(e)}}function Oy(i){var e;const t=i.coordinates;return{type:"MultiPoint",flatCoordinates:t.flat(),layout:Cn(((e=t[0])==null?void 0:e.length)||2)}}function Dy(i){var r,o;const t=i.coordinates,e=[],n=((o=(r=t[0])==null?void 0:r[0])==null?void 0:o[0].length)||2,s=dc(e,0,t,n);return{type:"MultiPolygon",flatCoordinates:e,ends:s,layout:Cn(n)}}function Fy(i){var r,o;const t=i.coordinates,e=[],n=(o=(r=t[0])==null?void 0:r[0])==null?void 0:o.length,s=os(e,0,t,n);return{type:"Polygon",flatCoordinates:e,ends:s,layout:Cn(n)}}function Va(i,t){i=Ba(i,!0,t);const e=i.getType();let n;switch(e){case"Point":{n=Xy(i);break}case"LineString":{n=Ny(i);break}case"Polygon":{n=By(i,t);break}case"MultiPoint":{n=zy(i);break}case"MultiLineString":{n=Gy(i);break}case"MultiPolygon":{n=jy(i,t);break}case"GeometryCollection":{n=ky(i,t);break}case"Circle":{n={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+e)}return n}function ky(i,t){return t=Object.assign({},t),delete t.featureProjection,{type:"GeometryCollection",geometries:i.getGeometriesArray().map(function(n){return Va(n,t)})}}function Ny(i,t){return{type:"LineString",coordinates:i.getCoordinates()}}function Gy(i,t){return{type:"MultiLineString",coordinates:i.getCoordinates()}}function zy(i,t){return{type:"MultiPoint",coordinates:i.getCoordinates()}}function jy(i,t){let e;return t&&(e=t.rightHanded),{type:"MultiPolygon",coordinates:i.getCoordinates(e)}}function Xy(i,t){return{type:"Point",coordinates:i.getCoordinates()}}function By(i,t){let e;return t&&(e=t.rightHanded),{type:"Polygon",coordinates:i.getCoordinates(e)}}const vr=Iy;var Yy=class extends Kt{constructor(t){super(t),this._listener=[],t&&t.active===!1?this.set("active",!1):this.set("active",!0)}setActive(t){this.set("active",t===!0)}getActive(){return this.get("active")}};(function(){function i(r){this.get("active")&&r.context&&this.precompose(r)}function t(r){this.get("active")&&r.context&&this.postcompose(r)}function e(){if(this.renderSync)try{this.renderSync()}catch{}else this.changed()}function n(r){this.filters_||(this.filters_=[]),this.filters_.push(r),r.addToLayer&&r.addToLayer(this),r.precompose&&r._listener.push({listener:this.on(["precompose","prerender"],i.bind(r)),target:this}),r.postcompose&&r._listener.push({listener:this.on(["postcompose","postrender"],t.bind(r)),target:this}),r._listener.push({listener:r.on("propertychange",e.bind(this)),target:this}),e.call(this)}function s(r){var o;if(this.filters_||(this.filters_=[]),!r){this.filters_.forEach((function(a){this.removeFilter(a)}).bind(this));return}for(o=this.filters_.length-1;o>=0;o--)this.filters_[o]===r&&this.filters_.splice(o,1);for(o=r._listener.length-1;o>=0;o--)r._listener[o].target===this&&(r.removeFromLayer&&r.removeFromLayer(this),ch(r._listener[o].listener),r._listener.splice(o,1));e.call(this)}Ln.prototype.addFilter=function(r){console.warn("[OL-EXT] addFilter deprecated on map."),n.call(this,r)},Ln.prototype.removeFilter=function(r){s.call(this,r)},Ln.prototype.getFilters=function(){return this.filters_||[]},as.prototype.addFilter=function(r){n.call(this,r)},as.prototype.removeFilter=function(r){s.call(this,r)},as.prototype.getFilters=function(){return this.filters_||[]}})();var Wy=class extends Yy{constructor(t){if(t=t||{},super(t),t.feature)switch(t.feature.getGeometry().getType()){case"Polygon":case"MultiPolygon":this.feature_=t.feature;break}this.set("inner",t.inner),this._fillColor=t.fill&&Ue(t.fill.getColor())||"rgba(0,0,0,0.2)",this._shadowColor=t.shadowColor&&Ue(t.shadowColor)||"rgba(0,0,0,0.5)",this.set("shadowWidth",t.shadowWidth||0),this.set("shadowMapUnits",t.shadowMapUnits===!0)}setFillColor(t){this._fillColor=t&&Ue(t)||"rgba(0,0,0,0.2)"}setShadowColor(t){this._shadowColor=t&&Ue(t)||"rgba(0,0,0,0.5)"}drawFeaturePath_(t,e){var n=t.context,s=n.canvas,r=t.frameState.pixelRatio,o;if(t.frameState.coordinateToPixelTransform){var a=t.frameState.coordinateToPixelTransform;if(t.inversePixelTransform){var l=t.inversePixelTransform;o=function(C){return C=[C[0]*a[0]+C[1]*a[1]+a[4],C[0]*a[2]+C[1]*a[3]+a[5]],[C[0]*l[0]-C[1]*l[1]+l[4],-C[0]*l[2]+C[1]*l[3]+l[5]]}}else o=function(C){return[(C[0]*a[0]+C[1]*a[1]+a[4])*r,(C[0]*a[2]+C[1]*a[3]+a[5])*r]}}else a=t.frameState.coordinateToPixelMatrix,o=function(C){return[(C[0]*a[0]+C[1]*a[1]+a[12])*r,(C[0]*a[4]+C[1]*a[5]+a[13])*r]};var h=this.feature_.getGeometry().getCoordinates();this.feature_.getGeometry().getType()==="Polygon"&&(h=[h]);function c(C){for(var E=0;E<h.length;E++)for(var w=h[E],T=0;T<w.length;T++){var v=o([w[T][0][0]+C,w[T][0][1]]);n.moveTo(v[0],v[1]);for(var R=1;R<w[T].length;R++)v=o([w[T][R][0]+C,w[T][R][1]]),n.lineTo(v[0],v[1])}}if(n.beginPath(),e&&(n.moveTo(-100,-100),n.lineTo(s.width+100,-100),n.lineTo(s.width+100,s.height+100),n.lineTo(-100,s.height+100),n.lineTo(-100,-100)),this.get("wrapX")){var u=t.frameState.viewState.projection.getExtent(),d=u[2]-u[0],f=t.frameState.extent,g=this.feature_.getGeometry().getExtent(),_=g[2]-g[1],m=Math.floor((f[0]-_-u[0])/d),p=Math.floor((f[2]+_-u[2])/d)+1;m>p&&([m,p]=[p,m]);for(var y=m;y<=p;y++)c(y*d)}else c(0)}postcompose(t){if(this.feature_){var e=t.context;if(e.save(),this.drawFeaturePath_(t,!this.get("inner")),e.fillStyle=this._fillColor,e.fill("evenodd"),this.get("shadowWidth")){var n=this.get("shadowWidth")*t.frameState.pixelRatio;this.get("shadowMapUnits")&&(n/=t.frameState.viewState.resolution),e.clip("evenodd"),e.filter="blur("+n+"px)",e.strokeStyle=this._shadowColor,e.lineCap="round",e.lineJoin="round",e.lineWidth=n,e.stroke()}e.restore()}}};const Vy=i=>{const{layerId:t,data:e,innerStyle:n,zIndex:s=3,maskFillColor:r,shadowColor:o,shadowWidth:a}=i,h=new vr().readFeatures(e),c=new zt(h[0].getGeometry());n?c.setStyle(n):c.setStyle(new $t({fill:new wt({color:"rgba(0, 0, 0, 0)"})}));const u=new Wy({feature:c,fill:new wt({color:r||"rgba(67, 100, 116, 0.61)"}),shadowWidth:a||0,shadowMapUnits:!0,shadowColor:o||"rgba(0,0,0,0)",wrapX:!0}),d=new ke({features:[c]}),f=new Fe({source:d,zIndex:s,renderBuffer:100});return f.addFilter(u),Ee(t,f),window.xmMap.addLayer(f),{layer:f,source:d}};class Uy extends Xo{constructor(t){super(t),this.image=null}getImage(){return this.image?this.image.getImage():null}prepareFrame(t){const e=t.layerStatesArray[t.layerIndex],n=t.pixelRatio,s=t.viewState,r=s.resolution,o=this.getLayer().getSource(),a=t.viewHints;let l=t.extent;if(e.extent!==void 0&&(l=Se(l,me(e.extent,s.projection))),!a[rt.ANIMATING]&&!a[rt.INTERACTING]&&!Bn(l))if(o){const h=s.projection,c=o.getImage(l,r,n,h);c&&(this.loadImage(c)?this.image=c:c.getState()===M.EMPTY&&(this.image=null))}else this.image=null;return!!this.image}getData(t){const e=this.frameState;if(!e)return null;const n=this.getLayer(),s=gt(e.pixelToCoordinateTransform,t.slice()),r=n.getExtent();if(r&&!cn(r,s))return null;const o=this.image.getExtent(),a=this.image.getImage(),l=K(o),h=Math.floor(a.width*((s[0]-o[0])/l));if(h<0||h>=a.width)return null;const c=ut(o),u=Math.floor(a.height*((o[3]-s[1])/c));return u<0||u>=a.height?null:this.getImageData(a,h,u)}renderFrame(t,e){const n=this.image,s=n.getExtent(),r=n.getResolution(),[o,a]=Array.isArray(r)?r:[r,r],l=n.getPixelRatio(),h=t.layerStatesArray[t.layerIndex],c=t.pixelRatio,u=t.viewState,d=u.center,f=u.resolution,g=c*o/(f*l),_=c*a/(f*l);this.prepareContainer(t,e);const m=this.context.canvas.width,p=this.context.canvas.height,y=this.getRenderContext(t);let C=!1,E=!0;if(h.extent){const I=me(h.extent,u.projection);E=Ct(I,t.extent),C=E&&!ge(I,t.extent),C&&this.clipUnrotated(y,t,I)}const w=n.getImage(),T=ye(this.tempTransform,m/2,p/2,g,_,0,l*(s[0]-d[0])/o,l*(d[1]-s[3])/a);this.renderedResolution=a*c/l;const v=w.width*T[0],R=w.height*T[3];if(this.getLayer().getSource().getInterpolate()||(y.imageSmoothingEnabled=!1),this.preRender(y,t),E&&v>=.5&&R>=.5){const I=T[4],b=T[5],O=h.opacity;O!==1&&(y.save(),y.globalAlpha=O),y.drawImage(w,0,0,+w.width,+w.height,I,b,v,R),O!==1&&y.restore()}return this.postRender(this.context,t),C&&y.restore(),y.imageSmoothingEnabled=!0,this.container}}const Ky=Uy;class $y extends ls{constructor(t){t=t||{},super(t)}}const Zy=$y;class Hy extends Zy{constructor(t){super(t)}createRenderer(){return new Ky(this)}getData(t){return super.getData(t)}}const qy=Hy;class Jy extends Eo{constructor(t,e,n,s,r){const o=r!==void 0?M.IDLE:M.LOADED;super(t,e,n,o),this.loader_=r!==void 0?r:null,this.canvas_=s,this.error_=null}getError(){return this.error_}handleLoad_(t){t?(this.error_=t,this.state=M.ERROR):this.state=M.LOADED,this.changed()}load(){this.state==M.IDLE&&(this.state=M.LOADING,this.changed(),this.loader_(this.handleLoad_.bind(this)))}getImage(){return this.canvas_}}const Qy=Jy;function Ua(i){return Array.isArray(i)?Math.min(...i):i}class t0 extends Eo{constructor(t,e,n,s,r,o,a){let l=t.getExtent();l&&t.canWrapX()&&(l=l.slice(),l[0]=-1/0,l[2]=1/0);let h=e.getExtent();h&&e.canWrapX()&&(h=h.slice(),h[0]=-1/0,h[2]=1/0);const c=h?Se(n,h):n,u=ie(c),d=pr(t,e,u,s),f=Vc,g=new Wc(t,e,c,l,d*f,s),_=g.calculateSourceExtent(),m=Bn(_)?null:o(_,d,r),p=m?M.IDLE:M.EMPTY,y=m?m.getPixelRatio():1;super(n,s,y,p),this.targetProj_=e,this.maxSourceExtent_=l,this.triangulation_=g,this.targetResolution_=s,this.targetExtent_=n,this.sourceImage_=m,this.sourcePixelRatio_=y,this.interpolate_=a,this.canvas_=null,this.sourceListenerKey_=null}disposeInternal(){this.state==M.LOADING&&this.unlistenSource_(),super.disposeInternal()}getImage(){return this.canvas_}getProjection(){return this.targetProj_}reproject_(){const t=this.sourceImage_.getState();if(t==M.LOADED){const e=K(this.targetExtent_)/this.targetResolution_,n=ut(this.targetExtent_)/this.targetResolution_;this.canvas_=Bc(e,n,this.sourcePixelRatio_,Ua(this.sourceImage_.getResolution()),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0,void 0,this.interpolate_,!0)}this.state=t,this.changed()}load(){if(this.state==M.IDLE){this.state=M.LOADING,this.changed();const t=this.sourceImage_.getState();t==M.LOADED||t==M.ERROR?this.reproject_():(this.sourceListenerKey_=$(this.sourceImage_,z.CHANGE,e=>{const n=this.sourceImage_.getState();(n==M.LOADED||n==M.ERROR)&&(this.unlistenSource_(),this.reproject_())}),this.sourceImage_.load())}}unlistenSource_(){it(this.sourceListenerKey_),this.sourceListenerKey_=null}}const e0=t0,_i=4,Ka={IMAGELOADSTART:"imageloadstart",IMAGELOADEND:"imageloadend",IMAGELOADERROR:"imageloaderror"};class n0 extends se{constructor(t,e){super(t),this.image=e}}class i0 extends Ea{constructor(t){super({attributions:t.attributions,projection:t.projection,state:t.state,interpolate:t.interpolate!==void 0?t.interpolate:!0}),this.on,this.once,this.un,this.loader=t.loader||null,this.resolutions_=t.resolutions!==void 0?t.resolutions:null,this.reprojectedImage_=null,this.reprojectedRevision_=0,this.image=null,this.wantedExtent_,this.wantedResolution_,this.static_=t.loader?t.loader.length===0:!1,this.wantedProjection_=null}getResolutions(){return this.resolutions_}setResolutions(t){this.resolutions_=t}findNearestResolution(t){const e=this.getResolutions();if(e){const n=vs(e,t,0);t=e[n]}return t}getImage(t,e,n,s){const r=this.getProjection();if(!r||!s||mn(r,s))return r&&(s=r),this.getImageInternal(t,e,n,s);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&mn(this.reprojectedImage_.getProjection(),s)&&this.reprojectedImage_.getResolution()==e&&jn(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new e0(r,s,t,e,n,(o,a,l)=>this.getImageInternal(o,a,l,r),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(t,e,n,s){if(this.loader){const r=s0(t,e,n,1),o=this.findNearestResolution(e);if(this.image&&(this.static_||this.wantedProjection_===s&&(this.wantedExtent_&&ge(this.wantedExtent_,r)||ge(this.image.getExtent(),r))&&(this.wantedResolution_&&Ua(this.wantedResolution_)===o||Ua(this.image.getResolution())===o)))return this.image;this.wantedProjection_=s,this.wantedExtent_=r,this.wantedResolution_=o,this.image=new Eo(r,o,n,this.loader),this.image.addEventListener(z.CHANGE,this.handleImageChange.bind(this))}return this.image}handleImageChange(t){const e=t.target;let n;switch(e.getState()){case M.LOADING:this.loading=!0,n=Ka.IMAGELOADSTART;break;case M.LOADED:this.loading=!1,n=Ka.IMAGELOADEND;break;case M.ERROR:this.loading=!1,n=Ka.IMAGELOADERROR;break;default:return}this.hasListener(n)&&this.dispatchEvent(new n0(n,e))}}function s0(i,t,e,n){const s=t/e,r=ie(i),o=We(K(i)/s,_i),a=We(ut(i)/s,_i),l=We((n-1)*o/2,_i),h=o+2*l,c=We((n-1)*a/2,_i),u=a+2*c;return Ts(r,s,0,[h,u])}const r0=i0;class o0 extends r0{constructor(t){t=t||{},super({attributions:t.attributions,interpolate:t.interpolate,projection:t.projection,resolutions:t.resolutions,state:t.state}),this.canvasFunction_=t.canvasFunction,this.canvas_=null,this.renderedRevision_=0,this.ratio_=t.ratio!==void 0?t.ratio:1.5}getImageInternal(t,e,n,s){e=this.findNearestResolution(e);let r=this.canvas_;if(r&&this.renderedRevision_==this.getRevision()&&r.getResolution()==e&&r.getPixelRatio()==n&&ge(r.getExtent(),t))return r;t=t.slice(),md(t,this.ratio_);const o=K(t)/e,a=ut(t)/e,l=[o*n,a*n],h=this.canvasFunction_.call(this,t,e,n,l,s);return h&&(r=new Qy(t,e,n,h)),this.canvas_=r,this.renderedRevision_=this.getRevision(),r}}const a0=o0;var l0=class extends qy{constructor(t){t=t||{};var e=document.createElement("canvas");super({source:new a0({canvasFunction:function(n,s,r,o){return e.width=o[0],e.height=o[1],e}}),center:t.center||[.5,1],defaultHeight:t.defaultHeight||0,maxResolution:t.maxResolution||1/0}),this._source=t.source,this.height_=this.getHfn(t.height),this.setStyle(t.style),this.on(["postcompose","postrender"],this.onPostcompose_.bind(this))}setStyle(t){if(t instanceof $t?this._style=t:this._style=new $t,this._style.getStroke()||this._style.setStroke(new Ae({width:1,color:"red"})),this._style.getFill()||this._style.setFill(new wt({color:"rgba(0,0,255,0.5)"})),this._style.getText()||this._style.setText(new wt({color:"red"})),t&&t.getGeometry()){var e=t.getGeometry();typeof e=="function"?this.set("geometry",e):this.set("geometry",function(){return e})}else this.set("geometry",function(n){return n.getGeometry()})}getStyle(){return this._style}onPostcompose_(t){var e=t.frameState.viewState.resolution;if(!(e>this.get("maxResolution"))){if(this.res_=e*400,this.animate_){var n=t.frameState.time-this.animate_;n<this.animateDuration_?(this.elapsedRatio_=this.easing_(n/this.animateDuration_),t.frameState.animate=!0):(this.animate_=!1,this.height_=this.toHeight_)}var s=t.frameState.pixelRatio,r=t.context,o=this.matrix_=t.frameState.coordinateToPixelTransform;o||(o=t.frameState.coordinateToPixelMatrix,o[2]=o[4],o[3]=o[5],o[4]=o[12],o[5]=o[13]),this.center_=[r.canvas.width*this.get("center")[0]/s,r.canvas.height*this.get("center")[1]/s];var a=this._source.getFeaturesInExtent(t.frameState.extent);r.save(),r.scale(s,s);var l=this.getStyle();r.lineWidth=l.getStroke().getWidth(),r.lineCap=l.getStroke().getLineCap(),r.strokeStyle=Ue(l.getStroke().getColor()),r.fillStyle=Ue(l.getFill().getColor());for(var h=[],c=0;c<a.length;c++)h.push(this.getFeature3D_(a[c],this._getFeatureHeight(a[c])));this.drawFeature3D_(r,h),r.restore()}}getHfn(t){switch(typeof t){case"function":return t;case"string":{var e=this.get("defaultHeight");return function(n){return Number(n.get(t))||e}}case"number":return function(){return t};default:return function(){return 10}}}animate(t){t=t||{},this.toHeight_=this.getHfn(t.height),this.animate_=new Date().getTime(),this.animateDuration_=t.duration||1e3,this.easing_=t.easing||Rn,this.changed()}animating(){return this.animate_&&new Date().getTime()-this.animate_>this.animateDuration_&&(this.animate_=!1),!!this.animate_}_getFeatureHeight(t){if(this.animate_){var e=this.height_(t),n=this.toHeight_(t);return e*(1-this.elapsedRatio_)+this.elapsedRatio_*n}else return this.height_(t)}hvector_(t,e){var n=[t[0]*this.matrix_[0]+t[1]*this.matrix_[1]+this.matrix_[4],t[0]*this.matrix_[2]+t[1]*this.matrix_[3]+this.matrix_[5]];return{p0:n,p1:[n[0]+e/this.res_*(n[0]-this.center_[0]),n[1]+e/this.res_*(n[1]-this.center_[1])]}}getFeature3D_(t,e){var n=this.get("geometry")(t),s=n.getCoordinates();switch(n.getType()){case"Polygon":s=[s];case"MultiPolygon":for(var r=[],o=0;o<s.length;o++)for(var a=0;a<s[o].length;a++){for(var l=[],h=0;h<s[o][a].length;h++)l.push(this.hvector_(s[o][a][h],e));r.push(l)}return{type:"MultiPolygon",feature:t,geom:r};case"Point":return{type:"Point",feature:t,geom:this.hvector_(s,e)};default:return{}}}drawFeature3D_(t,e){var n,s,r,o;for(n=0;n<e.length;n++)switch(e[n].type){case"MultiPolygon":{for(s=0;s<e[n].geom.length;s++)for(r=e[n].geom[s],o=0;o<r.length;o++)t.beginPath(),t.moveTo(r[o].p0[0],r[o].p0[1]),t.lineTo(r[o].p1[0],r[o].p1[1]),t.stroke();break}case"Point":{var a=e[n].geom;t.beginPath(),t.moveTo(a.p0[0],a.p0[1]),t.lineTo(a.p1[0],a.p1[1]),t.stroke();break}}for(n=0;n<e.length;n++)switch(e[n].type){case"MultiPolygon":{for(t.beginPath(),s=0;s<e[n].geom.length;s++){if(r=e[n].geom[s],s==0)for(t.moveTo(r[0].p1[0],r[0].p1[1]),o=1;o<r.length;o++)t.lineTo(r[o].p1[0],r[o].p1[1]);else for(t.moveTo(r[0].p1[0],r[0].p1[1]),o=r.length-2;o>=0;o--)t.lineTo(r[o].p1[0],r[o].p1[1]);t.closePath()}t.fill("evenodd"),t.stroke();break}case"Point":{r=e[n];var l=r.feature.get("label");if(l){var h=r.geom.p1,c=t.measureText(l),u=Number(t.font.match(/\d+(\.\d+)?/g).join([]));t.fillRect(h[0]-c.width/2-5,h[1]-u-5,c.width+10,u+10),t.strokeRect(h[0]-c.width/2-5,h[1]-u-5,c.width+10,u+10),t.save(),t.fillStyle=Ue(this._style.getText().getFill().getColor()),t.textAlign="center",t.textBaseline="bottom",t.fillText(l,h[0],h[1]),t.restore()}break}}}};const h0=i=>{const{layerId:t,data:e}=i,s=new vr().readFeatures(e),r=new zt(s[0].getGeometry()),o=new ke({features:[r]}),a=new l0({source:o,style:new $t({fill:new wt({color:"rgba(255, 255, 255, 0)"}),stroke:new Ae({color:"blue",width:1})}),defaultHeight:-1e-4,maxResolution:10,height:1e-4,center:[102.836837,30.38723]});return window.xmMap.addLayer(a),Ee(t,a),a};class c0 extends ke{constructor(t){t=t||{},super({attributions:t.attributions,wrapX:t.wrapX}),this.resolution=void 0,this.distance=t.distance!==void 0?t.distance:20,this.minDistance=t.minDistance||0,this.interpolationRatio=0,this.features=[],this.geometryFunction=t.geometryFunction||function(e){const n=e.getGeometry();return J(!n||n.getType()==="Point","The default `geometryFunction` can only handle `Point` or null geometries"),n},this.createCustomCluster_=t.createCluster,this.source=null,this.boundRefresh_=this.refresh.bind(this),this.updateDistance(this.distance,this.minDistance),this.setSource(t.source||null)}clear(t){this.features.length=0,super.clear(t)}getDistance(){return this.distance}getSource(){return this.source}loadFeatures(t,e,n){var s;(s=this.source)==null||s.loadFeatures(t,e,n),e!==this.resolution&&(this.resolution=e,this.refresh())}setDistance(t){this.updateDistance(t,this.minDistance)}setMinDistance(t){this.updateDistance(this.distance,t)}getMinDistance(){return this.minDistance}setSource(t){this.source&&this.source.removeEventListener(z.CHANGE,this.boundRefresh_),this.source=t,t&&t.addEventListener(z.CHANGE,this.boundRefresh_),this.refresh()}refresh(){this.clear(),this.cluster(),this.addFeatures(this.features)}updateDistance(t,e){const n=t===0?0:Math.min(e,t)/t,s=t!==this.distance||this.interpolationRatio!==n;this.distance=t,this.minDistance=e,this.interpolationRatio=n,s&&this.refresh()}cluster(){if(this.resolution===void 0||!this.source)return;const t=Mt(),e=this.distance*this.resolution,n=this.source.getFeatures(),s={};for(let r=0,o=n.length;r<o;r++){const a=n[r];if(!(q(a)in s)){const l=this.geometryFunction(a);if(l){const h=l.getCoordinates();Wr(h,t),zn(t,e,t);const c=this.source.getFeaturesInExtent(t).filter(function(u){const d=q(u);return d in s?!1:(s[d]=!0,!0)});this.features.push(this.createCluster(c,t))}}}}createCluster(t,e){const n=[0,0];for(let a=t.length-1;a>=0;--a){const l=this.geometryFunction(t[a]);l?Pl(n,l.getCoordinates()):t.splice(a,1)}bl(n,1/t.length);const s=ie(e),r=this.interpolationRatio,o=new he([n[0]*(1-r)+s[0]*r,n[1]*(1-r)+s[1]*r]);return this.createCustomCluster_?this.createCustomCluster_(o,t):new zt({geometry:o,features:t})}}const u0=c0,$a="1.3.0";function d0(i,t,e,n,s){s.WIDTH=e[0],s.HEIGHT=e[1];const r=n.getAxisOrientation(),o=Ll(s.VERSION,"1.3")>=0;s[o?"CRS":"SRS"]=n.getCode();const a=o&&r.startsWith("ne")?[t[1],t[0],t[3],t[2]]:t;return s.BBOX=a.join(","),Qc(i,s)}function f0(i,t,e,n,s,r,o){r=Object.assign({REQUEST:"GetMap"},r);const a=t/e,l=[Il(K(i)/a,_i),Il(ut(i)/a,_i)];if(e!=1)switch(o){case"geoserver":const c=90*e+.5|0;"FORMAT_OPTIONS"in r?r.FORMAT_OPTIONS+=";dpi:"+c:r.FORMAT_OPTIONS="dpi:"+c;break;case"mapserver":r.MAP_RESOLUTION=90*e;break;case"carmentaserver":case"qgis":r.DPI=90*e;break;default:throw new Error("Unknown `serverType` configured")}return d0(s,i,l,n,r)}function hu(i,t){return Object.assign({REQUEST:t,SERVICE:"WMS",VERSION:$a,FORMAT:"image/png",STYLES:"",TRANSPARENT:"TRUE"},i)}class g0 extends tu{constructor(t){t=t||{};const e=Object.assign({},t.params);super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileClass:t.tileClass,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction,url:t.url,urls:t.urls,wrapX:t.wrapX!==void 0?t.wrapX:!0,transition:t.transition,zDirection:t.zDirection}),this.gutter_=t.gutter!==void 0?t.gutter:0,this.params_=e,this.v13_=!0,this.serverType_=t.serverType,this.hidpi_=t.hidpi!==void 0?t.hidpi:!0,this.tmpExtent_=Mt(),this.updateV13_(),this.setKey(this.getKeyForParams_())}getFeatureInfoUrl(t,e,n,s){const r=at(n),o=this.getProjection()||r;let a=this.getTileGrid();a||(a=this.getTileGridForProjection(o));const l=ao(t,r,o),h=pr(o,r,t,e),c=a.getZForResolution(h,this.zDirection),u=a.getResolution(c),d=a.getTileCoordForCoordAndZ(l,c);if(a.getResolutions().length<=d[0])return;let f=a.getTileCoordExtent(d,this.tmpExtent_);const g=this.gutter_;g!==0&&(f=zn(f,u*g,f));const _={QUERY_LAYERS:this.params_.LAYERS};Object.assign(_,hu(this.params_,"GetFeatureInfo"),s);const m=Math.floor((l[0]-f[0])/u),p=Math.floor((f[3]-l[1])/u);return _[this.v13_?"I":"X"]=m,_[this.v13_?"J":"Y"]=p,this.getRequestUrl_(d,f,1,o||r,_)}getLegendUrl(t,e){if(this.urls[0]===void 0)return;const n={SERVICE:"WMS",VERSION:$a,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(e===void 0||e.LAYER===void 0){const s=this.params_.LAYERS;if(!(!Array.isArray(s)||s.length===1))return;n.LAYER=s}if(t!==void 0){const s=this.getProjection()?this.getProjection().getMetersPerUnit():1,r=28e-5;n.SCALE=t*s/r}return Object.assign(n,e),Qc(this.urls[0],n)}getGutter(){return this.gutter_}getParams(){return this.params_}getRequestUrl_(t,e,n,s,r){const o=this.urls;if(!o)return;let a;if(o.length==1)a=o[0];else{const l=un($c(t),o.length);a=o[l]}return f0(e,(this.tileGrid||this.getTileGridForProjection(s)).getResolution(t[0]),n,s,a,r,this.serverType_)}getTilePixelRatio(t){return!this.hidpi_||this.serverType_===void 0?1:t}getKeyForParams_(){let t=0;const e=[];for(const n in this.params_)e[t++]=n+"-"+this.params_[n];return e.join("/")}setParams_(t){this.params_=t,this.updateV13_(),this.setKey(this.getKeyForParams_())}setParams(t){this.setParams_(Object.assign({},t))}updateParams(t){this.setParams_(Object.assign(this.params_,t))}updateV13_(){const t=this.params_.VERSION||$a;this.v13_=Ll(t,"1.3")>=0}tileUrlFunction(t,e,n){let s=this.getTileGrid();if(s||(s=this.getTileGridForProjection(n)),s.getResolutions().length<=t[0])return;e!=1&&(!this.hidpi_||this.serverType_===void 0)&&(e=1);const r=s.getResolution(t[0]);let o=s.getTileCoordExtent(t,this.tmpExtent_);const a=this.gutter_;a!==0&&(o=zn(o,r*a,o));const l=Object.assign({},hu(this.params_,"GetMap"));return this.getRequestUrl_(t,o,e,n,l)}}const _0=g0,m0=i=>{let t;typeof i=="string"?t=JSON.parse(i):t=i;const n=new vr().readFeatures(t),s=[];return n.forEach(r=>{s.push(new zt(r.getGeometry()))}),s},p0=i=>{const{layerId:t,data:e,customStyle:n,zIndex:s=3}=i;let r=m0(e);const o=new ke({features:r}),a=new Fe({source:o,style:n,zIndex:s});return a.setVisible(!0),Ee(t,a),window.xmMap.addLayer(a),{layer:a,source:o}},y0=i=>{const{layerId:t,url:e,zIndex:n=3}=i,s=new on({source:new Pn({url:e}),zIndex:n});return Ee(t,s),window.xmMap.addLayer(s),s},x0=i=>{const{layerId:t,url:e,zIndex:n=3,LAYERS:s}=i,r=new on({source:new _0({url:e,params:{SERVICE:"WMS",VERSION:"1.1.1",REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0,LAYERS:s,exceptions:"application/vnd.ogc.se_inimage",SRS:"EPSG:4326",STYLES:"",WIDTH:"768",HEIGHT:"567",BBOX:"94.50439453125,23.961181640625,111.37939453125,36.419677734375"}}),zIndex:n});return Ee(t,r),window.xmMap.addLayer(r),r};let E0=new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAACN1JREFUeF7NWwuMXFUZ/v47c+9sN9RIYnmUnTtt6Pbe2WrRCk2gxVKf0Wgp0VAiUmjA8OgD0QSKjwDxQSEBlbeCtioY8RFra3xWW1SoKdhAsTsz3W3cubNuxappoCk7Z2bub+7ujOzOzL33nHtndr3JZpM93//6zn9e/zlLmKFvMKMvI6Y1xNQH4j4C+hhIe+YJKDEwCqZRJvZ+dg0UKwdnwjXqlpGhRUi5ZWMta/QuMH8IwAJFWyMg+gW5/ActJXb2D6OsKC8F7zgB+UzPQsC9EoxPALCkvAgHFUB4EtCesovjfwuHyyM6RsDQWZhXS6XuArMX+Fx5F5SQr4HoyUS5fEf/P3BcSdIH3BECcn3JS6BpjxOwqBNOhelgYBiu+8nsaHVfGDasPTYBhbR+ExM9HGaoG+3EvNEqVR6JozsWAQVTX8+g78RxIK4sga+2nMp3o+qJTICX9qRpe6Ma7qQcu+7qqMMhEgFDGX1ZjWk/AEMhkBMg7HOZniGqHai6iVe08fIrnrzbkzozqdXOZE4s14hXgXEJgDcr6BYJ4gv7I+wdlAnw1veaMJ4DsEzSQcGMB4Sb+Pp5f399VEbmpXPm9Bla7WYibFEg+WDCEBep7heUCSiYxlYG7pYJBMABl/jGqLs6b/eoMT0KYLmMPQJutxyxTQbbwCgRMJROnVuDux9E8ySM7LYdsUYCFwrJm8YuAB8JBTIfT0C7sL9UPhqKrQOUCMin9YdBdFOYcgbuyjrizjCcSnvONO4k4I5QGeZH7FJlYyhOlYDcgp4FmuvmGOgJVk6P2U75RlkHVHB5M/UowDcEyRAw7mpaNjsyPiKjWzoDJHvgxdc1sfodIzjhZ7yQ0a8Daxcwu4sBLKnjDhNpR0Du81ax8oSf7PC5p51RrYg/A1gYFJxKBkoTkM8YBTA8p30/l3HZQEnsbAfIW5iLU/ouEHlLnP/HvA+9lTV2Aa+11WOmbgb4a4E6CEfsopA6iEkRILPpIeBpyxFXtHNs4qBkGP+USckGJiHEGX4Hnrxp5MNOmrKbIykC8mnjUhDa9mzD4aB9ecHUf8ug96oQQOA9llN5X/ssMO4BcGtwJmGtXRI/C7MpRcCgqa/XQvb8fj0W57DkR+rQOXP6aolaKXA4gq8ekDgjSBGQM1ObCfxAgMF/2454S7v2gmn8ld+Y7MI6ZFo7AYctR7y1nVDONP5DwOl+Chm0JeuUHwwzKEVAPmN8HowvBih72XbE0uZ2b+kk141VwWFNW9huSSuYxiADWV+fCF+wi+JLHSGgkEltYuYgNp+zHbGi2dhg2linEX4Q5kRgKjOuGCiJp5sx+bS+N2hFIaLNVrH8UJhtqQzIZYyPEuPHfsoIOGo5oqUaNGimPqWBvxrmRPBYplsGnHLLspdPG16d0HdZZsLHskXxkzDbcgT0GW8jDYcClJ20HdFSByyk9QuY6ECYE0HtxLzcKlWeb8kA03g1qPbILpZmR8XLYbalCPCU5E3DG8u+pe2kS/2LRsvDUw3uBZJnm4ZXvFQ5209VceKYI+atBqpT/zhkGgM14HBAcCO2IwJ3iw1ZeQLSqSdAfK2fUQ20ZXGbWTdnGrtI5iTXRjEDu7NtTpSh23Kmb9ml8nVhve+1yxNgGpcDaJmM/meE8Uu7JLwLkGlfwUyuZGh/lHGmGUNwL7ac6p9adYYuretsR/xQxqY0AfV0HgTQ76uY+Fq7WPl2c3suo99HTJ+WcaiBYeL7s8XKZ1rHfuhZYOiYIwaah42fbWkC6vOAV225LSCQAlXFSmsM/2ohwTTuJmCrDAkMbMs64vZmrORp8B7bEVJ2lIaAB5aZ1Qn0TcspX98u0JypvxPANvI5FzB4D4CtWafyl3byedPwyt9XBZHot2p0JAPqWfBrAO8P7km6xW6zdjdkhvtSi2oJ9BNP3iQxYThRw1DzKjLVRujENwn+je2ID8hkWQOjNAQ8oZypX0+gxySMXG474kcSuFCIzHF8gkjwDVmn8o1QhVMAygQcPAvzeg3jRQDzJQzFJiGf1jeAqGVibWN77JQQb1+meGmqTMBkFkgWKCe9vM12xL0SZE2DDM+fk64lqrcy0SYZWZUy2FR9kQgYyfSePc7VFySzwNtuPAvGvbW55V8tGYQICsirHlVTqXXE7BU8Jl6QSHxjPZQ8f0Hx1DEJ7DRIJAIiZEHDqLd/389Ee+DiUCqZfMlrKFer50HDUmL3gwBdDEBXCSRq73s2IhOgngUqISlhI/d+LAJiZIFSdGHgOL0fm4D/gyyI1fuxCZjtLIjb+x0h4PA8nJboNbxZvqUmGJa+sdoJh2qnxIolx3Eyjp7Ik+BUowVTv4pBkZ+pRAmAwOstp/K9KLKx9wHtjOYzxk/BWBvXISl5wk67KC6TwoaAOpIBno28mVwBaC3Fi0442arDXWk71Wc7obtjBHjOFDL6faxY+FANgojvt9oUSlT1NPAdJaC+LHrvh1TfBcv6P9JDyYuibHn9DHSUgMksSG1k5tALCdmIp01YRJusYrmjjzI7TkB9b7CbgA9HCdJPhoGfZx0R/k5I0WhXCCj06ctZo2cQ+pxG2ttxcnmVNVqJdcnSzlpXCJgYCmnjs0z4snSIAUBifM4qia90Qlezjq4RMLE0hlxgSgXEvM8uVVZLYSOAuktApufdYPd3Efx6Q4S099jF8d/H0hGUXd1S3NCbU7gPaPbF736gkz53NQM8R8fmo/fVpOFNiOcrOv7Cm6pi1fwxnFKUU4J3nYDJuSC1BsShD5amec50qV0qe09ku/rNCAFeBLm0/iDJVniZH8qWKpu7Gnld+YwRUL/X84aCHRJYPqkbqxYdPan0rjAqWTNGgOfgkYzxcZfxVJCzGuHKxUXx/agBqcrNKAETQ8E0thNwTTtHGdiRdcQG1SDi4GeegMmnc97/GjWfGEdY01bLvvKOE/RU2RknoD4hXkNE26c6wswbsqXKjk4FJqtnVgjwnCuYxnauDwUCdlgznPoNgmaNgPor0ol/u5uN1J91AhpDwfs9G6nfIOC/gAk7bjiR6jcAAAAASUVORK5CYII=",self.location);const cu=i=>{const{style:t,title:e,customStyle:n}=i;let s=null,r=null;if(t!=null&&t.gradient){r=document.createElement("canvas"),s=r.getContext("2d");const a=s.createLinearGradient(0,0,r.width,0);a.addColorStop(0,t.gradient[0]),a.addColorStop(1,t.gradient[t.gradient.length-1]),s.fillStyle=a,s.fillRect(0,0,r.width,r.height)}let o;return n?o=n:o=new $t({image:new No({anchor:[.5,.5],anchorXUnits:"fraction",anchorYUnits:"pixels",width:t!=null&&t.iconSrc&&typeof(t==null?void 0:t.width)=="number"&&!Number.isNaN(t.width)?t.width:30,height:t!=null&&t.iconSrc&&typeof(t==null?void 0:t.height)=="number"&&!Number.isNaN(t.height)?t.height:30,src:(t==null?void 0:t.iconSrc)||E0.pathname}),text:new Oh({text:e||"默认点",fill:new wt({color:(t==null?void 0:t.textColor)||"#FFF"}),offsetY:t!=null&&t.iconSrc?t==null?void 0:t.offsetY:50,offsetX:t!=null&&t.iconSrc?t==null?void 0:t.offsetX:-35,textAlign:(t==null?void 0:t.textAlign)||"left",padding:(t==null?void 0:t.padding)||[5,5,5,5],font:t!=null&&t.textFont?`${t==null?void 0:t.textFont} MicrosoftYaHei`:"16px MicrosoftYaHei",backgroundFill:new wt({color:(t==null?void 0:t.textbackground)||(s?s.createPattern(r,"repeat"):"rgba(0, 0, 0, 0)")}),stroke:new Ae({color:(t==null?void 0:t.textStrokeColor)||"",width:(t==null?void 0:t.textStrokeWidth)||0}),backgroundStroke:new Ae({color:(t==null?void 0:t.backgroundStrokeColor)||"rgba(0, 0, 0, 0)",width:(t==null?void 0:t.backgroundStrokeWidth)||0})})}),o},C0=i=>{const{id:t,className:e,style:n}=i;let s=null,r=null;if(t&&(s=document.getElementById(t)),!s){s=document.createElement("div"),s.id="popupContain",e&&(s.className=e),n&&Object.assign(s.style,n),r=document.createElement("div"),r.id="popupContent";const a={position:"absolute",width:"13rem",backgroundColor:"#fff",borderRadius:"10px",zIndex:"50",padding:"0.625rem",border:"1px solid #ddd",paddingLeft:"1.5rem",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24)"};Object.assign(s.style,a),s.appendChild(r),r.innerHTML="<p>这个是示例信息</p>"}const o=new ja({element:s,positioning:"bottom-center",stopEvent:!1,offset:[10,10]});return window.xmMap.addOverlay(o),{overlay:o,contentElement:r}},uu=(i,t)=>{const{data:e,style:n,iconOutStyle:s,setStyleCallBack:r,customStyle:o,noStyle:a,overlay:l,HoverBack:h,ClickBack:c}=i;if(console.log(i,"接收的参数option"),e.length===0)return[];const u=window.xmMap.getTargetElement(),d=e.map(f=>{let g=Number(f.lng),_=Number(f.lat);!g&&!_&&console.warn("坐标格式错误");const m=[g,_],p=new he(m);var y=new zt({geometry:p,properties:{...f}});let C=[];if(!a){if(s&&typeof s=="boolean"?C.push(new $t({image:new Ks({radius:9,fill:new wt({color:"#fff"})})})):s&&typeof s=="function"&&C.push(s(f)),r&&typeof r=="function")C.push(r(f));else{let E=cu({style:n,title:f.rsnm,customStyle:o});C.push(E)}y.setStyle(C)}return mt.xmMapListener({listenType:"pointermove",removeListener:!0}),l&&h&&mt.xmMapListener({listenType:"pointermove",callback:async E=>{var v;const w=E.pixel,T=window.xmMap.forEachFeatureAtPixel(w,R=>R);if(T&&T.getGeometry()instanceof he){const R=(v=T==null?void 0:T.getGeometry())==null?void 0:v.getCoordinates();u.style.cursor="pointer",await h(E,T.getProperties()),l.setPosition(R)}else u.style.cursor="",l.setPosition(void 0)}}),y});return c&&(mt.xmMapListener({listenType:"click",removeListener:!0}),mt.xmMapListener({listenType:"click",callback:f=>{var m;const g=f.pixel,_=window.xmMap.forEachFeatureAtPixel(g,p=>p);_&&_.getGeometry()instanceof he&&((m=_==null?void 0:_.getGeometry())==null||m.getCoordinates(),l&&h&&(u.style.cursor="",l.setPosition(void 0)),c(f,_.getProperties()))}})),t&&(mt.xmMapListener({...t,removeListener:!0}),mt.xmMapListener({...t,data:d})),d},w0=i=>{let t=uu(i);return new ke({features:t})},v0=i=>{const{layerId:t,features:e,zIndex:n=3,style:s}=i,r=new ke({features:e});let o;return s?o=new Fe({source:r,zIndex:n,style:s}):o=new Fe({source:r,zIndex:n}),Ee(t,o),window.xmMap.addLayer(o),o},R0=i=>{const{data:t,distance:e}=i;let n=mt.xmPointSource({data:t,noStyle:!0});return new u0({distance:e,minDistance:100,source:n})},T0=i=>{const{layerId:t,source:e,zIndex:n=3,styleCallBack:s}=i,r=new Fe({source:e,zIndex:n,style:s});return Ee(t,r),window.xmMap.addLayer(r),r};function mi(i,t){const e=i.length;return t<0?i[t+e]:t>=e?i[t-e]:i[t]}function pi(i,t){const e=i.length;let n=Math.floor(t);const s=t-n;n>=e?n-=e:n<0&&(n+=e);let r=n+1;r>=e&&(r-=e);const o=i[n],a=o[0],l=o[1],h=i[r],c=h[0]-a,u=h[1]-l;return[a+c*s,l+u*s]}const Rr={index:-1,endIndex:NaN,closestTargetDistance:1/0};function S0(i,t,e,n){const s=i[0],r=i[1];let o=1/0,a=-1,l=NaN;for(let u=0;u<t.targets.length;++u){const d=t.targets[u],f=d.coordinates;let g=1/0,_;for(let m=0;m<f.length-1;++m){const p=f[m],y=f[m+1],C=fu(s,r,p,y);C.squaredDistance<g&&(g=C.squaredDistance,_=m+C.along)}g<o&&(o=g,d.ring&&t.targetIndex===u&&(d.endIndex>d.startIndex?_<d.startIndex&&(_+=f.length):d.endIndex<d.startIndex&&_>d.startIndex&&(_-=f.length)),l=_,a=u)}const h=t.targets[a];let c=h.ring;if(t.targetIndex===a&&c){const u=pi(h.coordinates,l),d=e.getPixelFromCoordinate(u),f=e.getPixelFromCoordinate(t.startCoord);Al(d,f)>n&&(c=!1)}if(c){const u=h.coordinates,d=u.length,f=h.startIndex,g=l;if(f<g){const _=Ir(u,f,g);Ir(u,f,g-d)<_&&(l-=d)}else{const _=Ir(u,f,g);Ir(u,f,g+d)<_&&(l+=d)}}return Rr.index=a,Rr.endIndex=l,Rr.closestTargetDistance=o,Rr}function I0(i,t){const e=[];for(let n=0;n<t.length;++n){const r=t[n].getGeometry();du(i,r,e)}return e}function du(i,t,e){if(t instanceof Sn){Tr(i,t.getCoordinates(),!1,e);return}if(t instanceof ma){const n=t.getCoordinates();for(let s=0,r=n.length;s<r;++s)Tr(i,n[s],!1,e);return}if(t instanceof Zt){const n=t.getCoordinates();for(let s=0,r=n.length;s<r;++s)Tr(i,n[s],!0,e);return}if(t instanceof xa){const n=t.getCoordinates();for(let s=0,r=n.length;s<r;++s){const o=n[s];for(let a=0,l=o.length;a<l;++a)Tr(i,o[a],!0,e)}return}if(t instanceof Ic){const n=t.getGeometries();for(let s=0;s<n.length;++s)du(i,n[s],e);return}}function Tr(i,t,e,n){const s=i[0],r=i[1];for(let o=0,a=t.length-1;o<a;++o){const l=t[o],h=t[o+1],c=fu(s,r,l,h);if(c.squaredDistance===0){const u=o+c.along;n.push({coordinates:t,ring:e,startIndex:u,endIndex:u});return}}}function Sr(i,t){return Ie(i[0],i[1],t[0],t[1])}function Ir(i,t,e){let n,s;t<e?(n=t,s=e):(n=e,s=t);const r=Math.ceil(n),o=Math.floor(s);if(r>o){const l=pi(i,n),h=pi(i,s);return Sr(l,h)}let a=0;if(n<r){const l=pi(i,n),h=mi(i,r);a+=Sr(l,h)}if(o<s){const l=mi(i,o),h=pi(i,s);a+=Sr(l,h)}for(let l=r;l<o-1;++l){const h=mi(i,l),c=mi(i,l+1);a+=Sr(h,c)}return a}const Za={along:0,squaredDistance:0};function fu(i,t,e,n){const s=e[0],r=e[1],o=n[0],a=n[1],l=o-s,h=a-r;let c=0,u=s,d=r;return(l!==0||h!==0)&&(c=ot(((i-s)*l+(t-r)*h)/(l*l+h*h),0,1),u+=l*c,d+=h*c),Za.along=c,Za.squaredDistance=Yn(Ie(i,t,u,d),10),Za}const Lr={DRAWSTART:"drawstart",DRAWEND:"drawend",DRAWABORT:"drawabort"};class Pr extends se{constructor(t,e){super(t),this.feature=e}}class L0 extends hi{constructor(t){const e=t;e.stopDown||(e.stopDown=Hn),super(e),this.on,this.once,this.un,this.options_=t,this.shouldHandle_=!1,this.downPx_=null,this.downTimeout_,this.lastDragTime_,this.pointerType_,this.freehand_=!1,this.source_=t.source?t.source:null,this.features_=t.features?t.features:null,this.snapTolerance_=t.snapTolerance?t.snapTolerance:12,this.type_=t.type,this.mode_=M0(this.type_),this.stopClick_=!!t.stopClick,this.ignoreNextUpEvent_=!1,this.minPoints_=t.minPoints?t.minPoints:this.mode_==="Polygon"?3:2,this.maxPoints_=this.mode_==="Circle"?2:t.maxPoints?t.maxPoints:1/0,this.finishCondition_=t.finishCondition?t.finishCondition:Zn,this.geometryLayout_=t.geometryLayout?t.geometryLayout:"XY";let n=t.geometryFunction;if(!n){const s=this.mode_;if(s==="Circle")n=(r,o,a)=>{const l=o||new fm([NaN,NaN]),h=Wt(r[0]),c=Ml(h,Wt(r[r.length-1]));return l.setCenterAndRadius(h,Math.sqrt(c),this.geometryLayout_),l};else{let r;s==="Point"?r=he:s==="LineString"?r=Sn:s==="Polygon"&&(r=Zt),n=(o,a,l)=>(a?s==="Polygon"?o[0].length?a.setCoordinates([o[0].concat([o[0][0]])],this.geometryLayout_):a.setCoordinates([],this.geometryLayout_):a.setCoordinates(o,this.geometryLayout_):a=new r(o,this.geometryLayout_),a)}}this.geometryFunction_=n,this.dragVertexDelay_=t.dragVertexDelay!==void 0?t.dragVertexDelay:500,this.finishCoordinate_=null,this.sketchFeature_=null,this.sketchPoint_=null,this.sketchCoords_=null,this.sketchLine_=null,this.sketchLineCoords_=null,this.squaredClickTolerance_=t.clickTolerance?t.clickTolerance*t.clickTolerance:36,this.overlay_=new Fe({source:new ke({useSpatialIndex:!1,wrapX:t.wrapX?t.wrapX:!1}),style:t.style?t.style:P0(),updateWhileInteracting:!0}),this.geometryName_=t.geometryName,this.condition_=t.condition?t.condition:Sa,this.freehandCondition_,t.freehand?this.freehandCondition_=_r:this.freehandCondition_=t.freehandCondition?t.freehandCondition:Ia,this.traceCondition_,this.setTrace(t.trace||!1),this.traceState_={active:!1},this.traceSource_=t.traceSource||t.source||null,this.addChangeListener(va.ACTIVE,this.updateState_)}setTrace(t){let e;t?t===!0?e=_r:e=t:e=Bm,this.traceCondition_=e}setMap(t){super.setMap(t),this.updateState_()}setFreehand(t){this.freehand_=t,this.freehand_?this.freehandCondition_=_r:this.freehandCondition_=this.options_&&this.options_.freehandCondition?this.options_.freehandCondition:Ia}getOverlay(){return this.overlay_}getFreehand(){return this.freehand_}handleEvent(t){t.originalEvent.type===z.CONTEXTMENU&&t.originalEvent.preventDefault(),this.freehand_=this.mode_!=="Point"&&this.freehandCondition_(t);let e=t.type===tt.POINTERMOVE,n=!0;return!this.freehand_&&this.lastDragTime_&&t.type===tt.POINTERDRAG&&(Date.now()-this.lastDragTime_>=this.dragVertexDelay_?(this.downPx_=t.pixel,this.shouldHandle_=!this.freehand_,e=!0):this.lastDragTime_=void 0,this.shouldHandle_&&this.downTimeout_!==void 0&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0)),this.freehand_&&t.type===tt.POINTERDRAG&&this.sketchFeature_!==null?(this.addToDrawing_(t.coordinate),n=!1):this.freehand_&&t.type===tt.POINTERDOWN?n=!1:e&&this.getPointerCount()<2?(n=t.type===tt.POINTERMOVE,n&&this.freehand_?(this.handlePointerMove_(t),this.shouldHandle_&&t.originalEvent.preventDefault()):(t.originalEvent.pointerType==="mouse"||t.type===tt.POINTERDRAG&&this.downTimeout_===void 0)&&this.handlePointerMove_(t)):t.type===tt.DBLCLICK&&(n=!1),super.handleEvent(t)&&n}handleDownEvent(t){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=t.pixel,this.finishCoordinate_||this.startDrawing_(t.coordinate),!0):this.condition_(t)?(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout(()=>{this.handlePointerMove_(new Ne(tt.POINTERMOVE,t.map,t.originalEvent,!1,t.frameState))},this.dragVertexDelay_),this.downPx_=t.pixel,!0):(this.lastDragTime_=void 0,!1)}deactivateTrace_(){this.traceState_={active:!1}}toggleTraceState_(t){if(!this.traceSource_||!this.traceCondition_(t))return;if(this.traceState_.active){this.deactivateTrace_();return}const e=this.getMap(),n=e.getCoordinateFromPixel([t.pixel[0]-this.snapTolerance_,t.pixel[1]+this.snapTolerance_]),s=e.getCoordinateFromPixel([t.pixel[0]+this.snapTolerance_,t.pixel[1]-this.snapTolerance_]),r=Rs([n,s]),o=this.traceSource_.getFeaturesInExtent(r);if(o.length===0)return;const a=I0(t.coordinate,o);a.length&&(this.traceState_={active:!0,startCoord:t.coordinate.slice(),targets:a,targetIndex:-1})}addOrRemoveTracedCoordinates_(t,e){const n=t.startIndex<=t.endIndex,s=t.startIndex<=e;n===s?n&&e>t.endIndex||!n&&e<t.endIndex?this.addTracedCoordinates_(t,t.endIndex,e):(n&&e<t.endIndex||!n&&e>t.endIndex)&&this.removeTracedCoordinates_(e,t.endIndex):(this.removeTracedCoordinates_(t.startIndex,t.endIndex),this.addTracedCoordinates_(t,t.startIndex,e))}removeTracedCoordinates_(t,e){if(t===e)return;let n=0;if(t<e){const s=Math.ceil(t);let r=Math.floor(e);r===e&&(r-=1),n=r-s+1}else{const s=Math.floor(t);let r=Math.ceil(e);r===e&&(r+=1),n=s-r+1}n>0&&this.removeLastPoints_(n)}addTracedCoordinates_(t,e,n){if(e===n)return;const s=[];if(e<n){const r=Math.ceil(e);let o=Math.floor(n);o===n&&(o-=1);for(let a=r;a<=o;++a)s.push(mi(t.coordinates,a))}else{const r=Math.floor(e);let o=Math.ceil(n);o===n&&(o+=1);for(let a=r;a>=o;--a)s.push(mi(t.coordinates,a))}s.length&&this.appendCoordinates(s)}updateTrace_(t){const e=this.traceState_;if(!e.active)return;if(e.targetIndex===-1){const a=t.map.getPixelFromCoordinate(e.startCoord);if(Al(a,t.pixel)<this.snapTolerance_)return}const n=S0(t.coordinate,e,this.getMap(),this.snapTolerance_);if(e.targetIndex!==n.index){if(e.targetIndex!==-1){const l=e.targets[e.targetIndex];this.removeTracedCoordinates_(l.startIndex,l.endIndex)}const a=e.targets[n.index];this.addTracedCoordinates_(a,a.startIndex,n.endIndex)}else{const a=e.targets[e.targetIndex];this.addOrRemoveTracedCoordinates_(a,n.endIndex)}e.targetIndex=n.index;const s=e.targets[e.targetIndex];s.endIndex=n.endIndex;const r=pi(s.coordinates,s.endIndex),o=this.getMap().getPixelFromCoordinate(r);t.coordinate=r,t.pixel=[Math.round(o[0]),Math.round(o[1])]}handleDragEvent(t){this.ignoreNextUpEvent_=!0,super.handleDragEvent(t)}handleUpEvent(t){let e=!0;if(this.getPointerCount()===0){this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0),this.handlePointerMove_(t);const n=this.traceState_.active;if(this.ignoreNextUpEvent_||this.toggleTraceState_(t),this.shouldHandle_){const s=!this.finishCoordinate_;s&&this.startDrawing_(t.coordinate),!s&&this.freehand_?this.finishDrawing():!this.freehand_&&(!s||this.mode_==="Point")&&(this.atFinish_(t.pixel,n)?this.finishCondition_(t)&&this.finishDrawing():this.addToDrawing_(t.coordinate)),e=!1}else this.freehand_&&this.abortDrawing()}return this.ignoreNextUpEvent_=!1,!e&&this.stopClick_&&t.preventDefault(),e}handlePointerMove_(t){if(this.pointerType_=t.originalEvent.pointerType,this.downPx_&&(!this.freehand_&&this.shouldHandle_||this.freehand_&&!this.shouldHandle_)){const e=this.downPx_,n=t.pixel,s=e[0]-n[0],r=e[1]-n[1],o=s*s+r*r;if(this.shouldHandle_=this.freehand_?o>this.squaredClickTolerance_:o<=this.squaredClickTolerance_,!this.shouldHandle_)return}if(!this.finishCoordinate_){this.createOrUpdateSketchPoint_(t.coordinate.slice());return}this.updateTrace_(t),this.modifyDrawing_(t.coordinate)}atFinish_(t,e){let n=!1;if(this.sketchFeature_){let s=!1,r=[this.finishCoordinate_];const o=this.mode_;if(o==="Point")n=!0;else if(o==="Circle")n=this.sketchCoords_.length===2;else if(o==="LineString")s=!e&&this.sketchCoords_.length>this.minPoints_;else if(o==="Polygon"){const a=this.sketchCoords_;s=a[0].length>this.minPoints_,r=[a[0][0],a[0][a[0].length-2]],e?r=[a[0][0]]:r=[a[0][0],a[0][a[0].length-2]]}if(s){const a=this.getMap();for(let l=0,h=r.length;l<h;l++){const c=r[l],u=a.getPixelFromCoordinate(c),d=t[0]-u[0],f=t[1]-u[1],g=this.freehand_?1:this.snapTolerance_;if(n=Math.sqrt(d*d+f*f)<=g,n){this.finishCoordinate_=c;break}}}}return n}createOrUpdateSketchPoint_(t){this.sketchPoint_?this.sketchPoint_.getGeometry().setCoordinates(t):(this.sketchPoint_=new zt(new he(t)),this.updateSketchFeatures_())}createOrUpdateCustomSketchLine_(t){this.sketchLine_||(this.sketchLine_=new zt);const e=t.getLinearRing(0);let n=this.sketchLine_.getGeometry();n?(n.setFlatCoordinates(e.getLayout(),e.getFlatCoordinates()),n.changed()):(n=new Sn(e.getFlatCoordinates(),e.getLayout()),this.sketchLine_.setGeometry(n))}startDrawing_(t){const e=this.getMap().getView().getProjection(),n=$s(this.geometryLayout_);for(;t.length<n;)t.push(0);this.finishCoordinate_=t,this.mode_==="Point"?this.sketchCoords_=t.slice():this.mode_==="Polygon"?(this.sketchCoords_=[[t.slice(),t.slice()]],this.sketchLineCoords_=this.sketchCoords_[0]):this.sketchCoords_=[t.slice(),t.slice()],this.sketchLineCoords_&&(this.sketchLine_=new zt(new Sn(this.sketchLineCoords_)));const s=this.geometryFunction_(this.sketchCoords_,void 0,e);this.sketchFeature_=new zt,this.geometryName_&&this.sketchFeature_.setGeometryName(this.geometryName_),this.sketchFeature_.setGeometry(s),this.updateSketchFeatures_(),this.dispatchEvent(new Pr(Lr.DRAWSTART,this.sketchFeature_))}modifyDrawing_(t){const e=this.getMap(),n=this.sketchFeature_.getGeometry(),s=e.getView().getProjection(),r=$s(this.geometryLayout_);let o,a;for(;t.length<r;)t.push(0);this.mode_==="Point"?a=this.sketchCoords_:this.mode_==="Polygon"?(o=this.sketchCoords_[0],a=o[o.length-1],this.atFinish_(e.getPixelFromCoordinate(t))&&(t=this.finishCoordinate_.slice())):(o=this.sketchCoords_,a=o[o.length-1]),a[0]=t[0],a[1]=t[1],this.geometryFunction_(this.sketchCoords_,n,s),this.sketchPoint_&&this.sketchPoint_.getGeometry().setCoordinates(t),n.getType()==="Polygon"&&this.mode_!=="Polygon"?this.createOrUpdateCustomSketchLine_(n):this.sketchLineCoords_&&this.sketchLine_.getGeometry().setCoordinates(this.sketchLineCoords_),this.updateSketchFeatures_()}addToDrawing_(t){const e=this.sketchFeature_.getGeometry(),n=this.getMap().getView().getProjection();let s,r;const o=this.mode_;return o==="LineString"||o==="Circle"?(this.finishCoordinate_=t.slice(),r=this.sketchCoords_,r.length>=this.maxPoints_&&(this.freehand_?r.pop():s=!0),r.push(t.slice()),this.geometryFunction_(r,e,n)):o==="Polygon"&&(r=this.sketchCoords_[0],r.length>=this.maxPoints_&&(this.freehand_?r.pop():s=!0),r.push(t.slice()),s&&(this.finishCoordinate_=r[0]),this.geometryFunction_(this.sketchCoords_,e,n)),this.createOrUpdateSketchPoint_(t.slice()),this.updateSketchFeatures_(),s?this.finishDrawing():this.sketchFeature_}removeLastPoints_(t){if(!this.sketchFeature_)return;const e=this.sketchFeature_.getGeometry(),n=this.getMap().getView().getProjection(),s=this.mode_;for(let r=0;r<t;++r){let o;if(s==="LineString"||s==="Circle"){if(o=this.sketchCoords_,o.splice(-2,1),o.length>=2){this.finishCoordinate_=o[o.length-2].slice();const a=this.finishCoordinate_.slice();o[o.length-1]=a,this.createOrUpdateSketchPoint_(a)}this.geometryFunction_(o,e,n),e.getType()==="Polygon"&&this.sketchLine_&&this.createOrUpdateCustomSketchLine_(e)}else if(s==="Polygon"){o=this.sketchCoords_[0],o.splice(-2,1);const a=this.sketchLine_.getGeometry();if(o.length>=2){const l=o[o.length-2].slice();o[o.length-1]=l,this.createOrUpdateSketchPoint_(l)}a.setCoordinates(o),this.geometryFunction_(this.sketchCoords_,e,n)}if(o.length===1){this.abortDrawing();break}}this.updateSketchFeatures_()}removeLastPoint(){this.removeLastPoints_(1)}finishDrawing(){const t=this.abortDrawing_();if(!t)return null;let e=this.sketchCoords_;const n=t.getGeometry(),s=this.getMap().getView().getProjection();return this.mode_==="LineString"?(e.pop(),this.geometryFunction_(e,n,s)):this.mode_==="Polygon"&&(e[0].pop(),this.geometryFunction_(e,n,s),e=n.getCoordinates()),this.type_==="MultiPoint"?t.setGeometry(new ya([e])):this.type_==="MultiLineString"?t.setGeometry(new ma([e])):this.type_==="MultiPolygon"&&t.setGeometry(new xa([e])),this.dispatchEvent(new Pr(Lr.DRAWEND,t)),this.features_&&this.features_.push(t),this.source_&&this.source_.addFeature(t),t}abortDrawing_(){this.finishCoordinate_=null;const t=this.sketchFeature_;return this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0),this.deactivateTrace_(),t}abortDrawing(){const t=this.abortDrawing_();t&&this.dispatchEvent(new Pr(Lr.DRAWABORT,t))}appendCoordinates(t){const e=this.mode_,n=!this.sketchFeature_;n&&this.startDrawing_(t[0]);let s;if(e==="LineString"||e==="Circle")s=this.sketchCoords_;else if(e==="Polygon")s=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[];else return;n&&s.shift(),s.pop();for(let o=0;o<t.length;o++)this.addToDrawing_(t[o]);const r=t[t.length-1];this.sketchFeature_=this.addToDrawing_(r),this.modifyDrawing_(r)}extend(t){const n=t.getGeometry();this.sketchFeature_=t,this.sketchCoords_=n.getCoordinates();const s=this.sketchCoords_[this.sketchCoords_.length-1];this.finishCoordinate_=s.slice(),this.sketchCoords_.push(s.slice()),this.sketchPoint_=new zt(new he(s)),this.updateSketchFeatures_(),this.dispatchEvent(new Pr(Lr.DRAWSTART,this.sketchFeature_))}updateSketchFeatures_(){const t=[];this.sketchFeature_&&t.push(this.sketchFeature_),this.sketchLine_&&t.push(this.sketchLine_),this.sketchPoint_&&t.push(this.sketchPoint_);const e=this.overlay_.getSource();e.clear(!0),e.addFeatures(t)}updateState_(){const t=this.getMap(),e=this.getActive();(!t||!e)&&this.abortDrawing(),this.overlay_.setMap(e?t:null)}}function P0(){const i=_g();return function(t,e){return i[t.getGeometry().getType()]}}function b0(){return function(i,t,e){const n=Rs([i[0],i[i.length-1]].map(function(r){return Wt(r)})),s=[[Xn(n),Pi(n),bi(n),Ye(n),Xn(n)]];return t?t.setCoordinates(s):t=new Zt(s),t}}function M0(i){switch(i){case"Point":case"MultiPoint":return"Point";case"LineString":case"MultiLineString":return"LineString";case"Polygon":case"MultiPolygon":return"Polygon";case"Circle":return"Circle";default:throw new Error("Invalid type: "+i)}}const gu=L0,_u=Symbol(),br="el",A0="is-",bn=(i,t,e,n,s)=>{let r=`${i}-${t}`;return e&&(r+=`-${e}`),n&&(r+=`__${n}`),s&&(r+=`--${s}`),r},mu=Symbol("namespaceContextKey"),O0=i=>{const t=i||(x.getCurrentInstance()?x.inject(mu,x.ref(br)):x.ref(br));return x.computed(()=>x.unref(t)||br)},Ha=(i,t)=>{const e=O0(t);return{namespace:e,b:(_="")=>bn(e.value,i,_,"",""),e:_=>_?bn(e.value,i,"",_,""):"",m:_=>_?bn(e.value,i,"","",_):"",be:(_,m)=>_&&m?bn(e.value,i,_,m,""):"",em:(_,m)=>_&&m?bn(e.value,i,"",_,m):"",bm:(_,m)=>_&&m?bn(e.value,i,_,"",m):"",bem:(_,m,p)=>_&&m&&p?bn(e.value,i,_,m,p):"",is:(_,...m)=>{const p=m.length>=1?m[0]:!0;return _&&p?`${A0}${_}`:""},cssVar:_=>{const m={};for(const p in _)_[p]&&(m[`--${e.value}-${p}`]=_[p]);return m},cssVarName:_=>`--${e.value}-${_}`,cssVarBlock:_=>{const m={};for(const p in _)_[p]&&(m[`--${e.value}-${i}-${p}`]=_[p]);return m},cssVarBlockName:_=>`--${e.value}-${i}-${_}`}};/**
8
8
  * @vue/shared v3.5.27
9
9
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
10
10
  * @license MIT
11
- **/process.env.NODE_ENV!=="production"&&Object.freeze({}),process.env.NODE_ENV!=="production"&&Object.freeze([]);const A0=Object.prototype.hasOwnProperty,qa=(i,t)=>A0.call(i,t),O0=Array.isArray,Mr=i=>typeof i=="function",yi=i=>typeof i=="string",mu=i=>i!==null&&typeof i=="object";var D0=typeof global=="object"&&global&&global.Object===Object&&global;const F0=D0;var k0=typeof self=="object"&&self&&self.Object===Object&&self,N0=F0||k0||Function("return this")();const Ja=N0;var G0=Ja.Symbol;const xi=G0;var pu=Object.prototype,z0=pu.hasOwnProperty,j0=pu.toString,ds=xi?xi.toStringTag:void 0;function X0(i){var t=z0.call(i,ds),e=i[ds];try{i[ds]=void 0;var n=!0}catch{}var s=j0.call(i);return n&&(t?i[ds]=e:delete i[ds]),s}var B0=Object.prototype,Y0=B0.toString;function W0(i){return Y0.call(i)}var V0="[object Null]",U0="[object Undefined]",yu=xi?xi.toStringTag:void 0;function xu(i){return i==null?i===void 0?U0:V0:yu&&yu in Object(i)?X0(i):W0(i)}function K0(i){return i!=null&&typeof i=="object"}var $0="[object Symbol]";function Qa(i){return typeof i=="symbol"||K0(i)&&xu(i)==$0}function Z0(i,t){for(var e=-1,n=i==null?0:i.length,s=Array(n);++e<n;)s[e]=t(i[e],e,i);return s}var H0=Array.isArray;const tl=H0;var q0=1/0,Eu=xi?xi.prototype:void 0,Cu=Eu?Eu.toString:void 0;function wu(i){if(typeof i=="string")return i;if(tl(i))return Z0(i,wu)+"";if(Qa(i))return Cu?Cu.call(i):"";var t=i+"";return t=="0"&&1/i==-q0?"-0":t}function vu(i){var t=typeof i;return i!=null&&(t=="object"||t=="function")}var J0="[object AsyncFunction]",Q0="[object Function]",tx="[object GeneratorFunction]",ex="[object Proxy]";function nx(i){if(!vu(i))return!1;var t=xu(i);return t==Q0||t==tx||t==J0||t==ex}var ix=Ja["__core-js_shared__"];const el=ix;var Ru=function(){var i=/[^.]+$/.exec(el&&el.keys&&el.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""}();function sx(i){return!!Ru&&Ru in i}var rx=Function.prototype,ox=rx.toString;function ax(i){if(i!=null){try{return ox.call(i)}catch{}try{return i+""}catch{}}return""}var lx=/[\\^$.*+?()[\]{}|]/g,hx=/^\[object .+?Constructor\]$/,cx=Function.prototype,ux=Object.prototype,dx=cx.toString,fx=ux.hasOwnProperty,gx=RegExp("^"+dx.call(fx).replace(lx,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function _x(i){if(!vu(i)||sx(i))return!1;var t=nx(i)?gx:hx;return t.test(ax(i))}function mx(i,t){return i==null?void 0:i[t]}function Tu(i,t){var e=mx(i,t);return _x(e)?e:void 0}function px(i,t){return i===t||i!==i&&t!==t}var yx=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,xx=/^\w*$/;function Ex(i,t){if(tl(i))return!1;var e=typeof i;return e=="number"||e=="symbol"||e=="boolean"||i==null||Qa(i)?!0:xx.test(i)||!yx.test(i)||t!=null&&i in Object(t)}var Cx=Tu(Object,"create");const fs=Cx;function wx(){this.__data__=fs?fs(null):{},this.size=0}function vx(i){var t=this.has(i)&&delete this.__data__[i];return this.size-=t?1:0,t}var Rx="__lodash_hash_undefined__",Tx=Object.prototype,Sx=Tx.hasOwnProperty;function Ix(i){var t=this.__data__;if(fs){var e=t[i];return e===Rx?void 0:e}return Sx.call(t,i)?t[i]:void 0}var Lx=Object.prototype,Px=Lx.hasOwnProperty;function bx(i){var t=this.__data__;return fs?t[i]!==void 0:Px.call(t,i)}var Mx="__lodash_hash_undefined__";function Ax(i,t){var e=this.__data__;return this.size+=this.has(i)?0:1,e[i]=fs&&t===void 0?Mx:t,this}function bn(i){var t=-1,e=i==null?0:i.length;for(this.clear();++t<e;){var n=i[t];this.set(n[0],n[1])}}bn.prototype.clear=wx,bn.prototype.delete=vx,bn.prototype.get=Ix,bn.prototype.has=bx,bn.prototype.set=Ax;function Ox(){this.__data__=[],this.size=0}function Ar(i,t){for(var e=i.length;e--;)if(px(i[e][0],t))return e;return-1}var Dx=Array.prototype,Fx=Dx.splice;function kx(i){var t=this.__data__,e=Ar(t,i);if(e<0)return!1;var n=t.length-1;return e==n?t.pop():Fx.call(t,e,1),--this.size,!0}function Nx(i){var t=this.__data__,e=Ar(t,i);return e<0?void 0:t[e][1]}function Gx(i){return Ar(this.__data__,i)>-1}function zx(i,t){var e=this.__data__,n=Ar(e,i);return n<0?(++this.size,e.push([i,t])):e[n][1]=t,this}function Ei(i){var t=-1,e=i==null?0:i.length;for(this.clear();++t<e;){var n=i[t];this.set(n[0],n[1])}}Ei.prototype.clear=Ox,Ei.prototype.delete=kx,Ei.prototype.get=Nx,Ei.prototype.has=Gx,Ei.prototype.set=zx;var jx=Tu(Ja,"Map");const Xx=jx;function Bx(){this.size=0,this.__data__={hash:new bn,map:new(Xx||Ei),string:new bn}}function Yx(i){var t=typeof i;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?i!=="__proto__":i===null}function Or(i,t){var e=i.__data__;return Yx(t)?e[typeof t=="string"?"string":"hash"]:e.map}function Wx(i){var t=Or(this,i).delete(i);return this.size-=t?1:0,t}function Vx(i){return Or(this,i).get(i)}function Ux(i){return Or(this,i).has(i)}function Kx(i,t){var e=Or(this,i),n=e.size;return e.set(i,t),this.size+=e.size==n?0:1,this}function Mn(i){var t=-1,e=i==null?0:i.length;for(this.clear();++t<e;){var n=i[t];this.set(n[0],n[1])}}Mn.prototype.clear=Bx,Mn.prototype.delete=Wx,Mn.prototype.get=Vx,Mn.prototype.has=Ux,Mn.prototype.set=Kx;var $x="Expected a function";function nl(i,t){if(typeof i!="function"||t!=null&&typeof t!="function")throw new TypeError($x);var e=function(){var n=arguments,s=t?t.apply(this,n):n[0],r=e.cache;if(r.has(s))return r.get(s);var o=i.apply(this,n);return e.cache=r.set(s,o)||r,o};return e.cache=new(nl.Cache||Mn),e}nl.Cache=Mn;var Zx=500;function Hx(i){var t=nl(i,function(n){return e.size===Zx&&e.clear(),n}),e=t.cache;return t}var qx=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Jx=/\\(\\)?/g,Qx=Hx(function(i){var t=[];return i.charCodeAt(0)===46&&t.push(""),i.replace(qx,function(e,n,s,r){t.push(s?r.replace(Jx,"$1"):n||e)}),t});const tE=Qx;function eE(i){return i==null?"":wu(i)}function nE(i,t){return tl(i)?i:Ex(i,t)?[i]:tE(eE(i))}var iE=1/0;function sE(i){if(typeof i=="string"||Qa(i))return i;var t=i+"";return t=="0"&&1/i==-iE?"-0":t}function rE(i,t){t=nE(t,i);for(var e=0,n=t.length;i!=null&&e<n;)i=i[sE(t[e++])];return e&&e==n?i:void 0}function oE(i,t,e){var n=i==null?void 0:rE(i,t);return n===void 0?e:n}function aE(i){for(var t=-1,e=i==null?0:i.length,n={};++t<e;){var s=i[t];n[s[0]]=s[1]}return n}const il=i=>typeof i=="boolean",An=i=>typeof i=="number",lE=i=>typeof Element>"u"?!1:i instanceof Element,hE=i=>yi(i)?!Number.isNaN(Number(i)):!1;function sl(i){return x.getCurrentScope()?(x.onScopeDispose(i),!0):!1}function rl(i){return typeof i=="function"?i():x.unref(i)}const Ci=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const cE=Object.prototype.toString,uE=i=>cE.call(i)==="[object Object]",dE=()=>{};function fE(i,t,e={}){const{immediate:n=!0}=e,s=x.ref(!1);let r=null;function o(){r&&(clearTimeout(r),r=null)}function a(){s.value=!1,o()}function l(...h){o(),s.value=!0,r=setTimeout(()=>{s.value=!1,r=null,i(...h)},rl(t))}return n&&(s.value=!0,Ci&&l()),sl(a),{isPending:x.readonly(s),start:l,stop:a}}function ol(i){var t;const e=rl(i);return(t=e==null?void 0:e.$el)!=null?t:e}const Su=Ci?window:void 0;function gE(...i){let t,e,n,s;if(typeof i[0]=="string"||Array.isArray(i[0])?([e,n,s]=i,t=Su):[t,e,n,s]=i,!t)return dE;Array.isArray(e)||(e=[e]),Array.isArray(n)||(n=[n]);const r=[],o=()=>{r.forEach(c=>c()),r.length=0},a=(c,u,d,f)=>(c.addEventListener(u,d,f),()=>c.removeEventListener(u,d,f)),l=x.watch(()=>[ol(t),rl(s)],([c,u])=>{if(o(),!c)return;const d=uE(u)?{...u}:u;r.push(...e.flatMap(f=>n.map(g=>a(c,f,g,d))))},{immediate:!0,flush:"post"}),h=()=>{l(),o()};return sl(h),h}function _E(){const i=x.ref(!1),t=x.getCurrentInstance();return t&&x.onMounted(()=>{i.value=!0},t),i}function mE(i){const t=_E();return x.computed(()=>(t.value,!!i()))}function pE(i,t,e={}){const{window:n=Su,...s}=e;let r;const o=mE(()=>n&&"ResizeObserver"in n),a=()=>{r&&(r.disconnect(),r=void 0)},l=x.computed(()=>Array.isArray(i)?i.map(u=>ol(u)):[ol(i)]),h=x.watch(l,u=>{if(a(),o.value&&n){r=new ResizeObserver(t);for(const d of u)d&&r.observe(d,s)}},{immediate:!0,flush:"post"}),c=()=>{a(),h()};return sl(c),{isSupported:o,stop:c}}class yE extends Error{constructor(t){super(t),this.name="ElementPlusError"}}function gs(i,t){if(process.env.NODE_ENV!=="production"){const e=yi(i)?new yE(`[${i}] ${t}`):i;console.warn(e)}}const Iu={current:0},Lu=x.ref(0),Pu=2e3,bu=Symbol("elZIndexContextKey"),Mu=Symbol("zIndexContextKey"),xE=i=>{const t=x.getCurrentInstance()?x.inject(bu,Iu):Iu,e=i||(x.getCurrentInstance()?x.inject(Mu,void 0):void 0),n=x.computed(()=>{const o=x.unref(e);return An(o)?o:Pu}),s=x.computed(()=>n.value+Lu.value),r=()=>(t.current++,Lu.value=t.current,s.value);return!Ci&&!x.inject(bu)&&gs("ZIndexInjection",`Looks like you are using server rendering, you must provide a z-index provider to ensure the hydration process to be succeed
12
- usage: app.provide(ZINDEX_INJECTION_KEY, { current: 0 })`),{initialZIndex:n,currentZIndex:s,nextZIndex:r}};var EE={name:"en",el:{breadcrumb:{label:"Breadcrumb"},colorpicker:{confirm:"OK",clear:"Clear",defaultLabel:"color picker",description:"current color is {color}. press enter to select a new color.",alphaLabel:"pick alpha value",alphaDescription:"alpha {alpha}, current color is {color}",hueLabel:"pick hue value",hueDescription:"hue {hue}, current color is {color}",svLabel:"pick saturation and brightness value",svDescription:"saturation {saturation}, brightness {brightness}, current color is {color}",predefineDescription:"select {value} as the color"},datepicker:{now:"Now",today:"Today",cancel:"Cancel",clear:"Clear",confirm:"OK",dateTablePrompt:"Use the arrow keys and enter to select the day of the month",monthTablePrompt:"Use the arrow keys and enter to select the month",yearTablePrompt:"Use the arrow keys and enter to select the year",selectedDate:"Selected date",selectDate:"Select date",selectTime:"Select time",startDate:"Start Date",startTime:"Start Time",endDate:"End Date",endTime:"End Time",prevYear:"Previous Year",nextYear:"Next Year",prevMonth:"Previous Month",nextMonth:"Next Month",year:"",month1:"January",month2:"February",month3:"March",month4:"April",month5:"May",month6:"June",month7:"July",month8:"August",month9:"September",month10:"October",month11:"November",month12:"December",weeks:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weeksFull:{sun:"Sunday",mon:"Monday",tue:"Tuesday",wed:"Wednesday",thu:"Thursday",fri:"Friday",sat:"Saturday"},months:{jan:"Jan",feb:"Feb",mar:"Mar",apr:"Apr",may:"May",jun:"Jun",jul:"Jul",aug:"Aug",sep:"Sep",oct:"Oct",nov:"Nov",dec:"Dec"}},inputNumber:{decrease:"decrease number",increase:"increase number"},select:{loading:"Loading",noMatch:"No matching data",noData:"No data",placeholder:"Select"},mention:{loading:"Loading"},dropdown:{toggleDropdown:"Toggle Dropdown"},cascader:{noMatch:"No matching data",loading:"Loading",placeholder:"Select",noData:"No data"},pagination:{goto:"Go to",pagesize:"/page",total:"Total {total}",pageClassifier:"",page:"Page",prev:"Go to previous page",next:"Go to next page",currentPage:"page {pager}",prevPages:"Previous {pager} pages",nextPages:"Next {pager} pages",deprecationWarning:"Deprecated usages detected, please refer to the el-pagination documentation for more details"},dialog:{close:"Close this dialog"},drawer:{close:"Close this dialog"},messagebox:{title:"Message",confirm:"OK",cancel:"Cancel",error:"Illegal input",close:"Close this dialog"},upload:{deleteTip:"press delete to remove",delete:"Delete",preview:"Preview",continue:"Continue"},slider:{defaultLabel:"slider between {min} and {max}",defaultRangeStartLabel:"pick start value",defaultRangeEndLabel:"pick end value"},table:{emptyText:"No Data",confirmFilter:"Confirm",resetFilter:"Reset",clearFilter:"All",sumText:"Sum",selectAllLabel:"Select all rows",selectRowLabel:"Select this row",expandRowLabel:"Expand this row",collapseRowLabel:"Collapse this row",sortLabel:"Sort by {column}",filterLabel:"Filter by {column}"},tag:{close:"Close this tag"},tour:{next:"Next",previous:"Previous",finish:"Finish",close:"Close this dialog"},tree:{emptyText:"No Data"},transfer:{noMatch:"No matching data",noData:"No data",titles:["List 1","List 2"],filterPlaceholder:"Enter keyword",noCheckedFormat:"{total} items",hasCheckedFormat:"{checked}/{total} checked"},image:{error:"FAILED"},pageHeader:{title:"Back"},popconfirm:{confirmButtonText:"Yes",cancelButtonText:"No"},carousel:{leftArrow:"Carousel arrow left",rightArrow:"Carousel arrow right",indicator:"Carousel switch to index {index}"}}};const CE=i=>(t,e)=>wE(t,e,x.unref(i)),wE=(i,t,e)=>oE(e,i,i).replace(/\{(\w+)\}/g,(n,s)=>{var r;return`${(r=t==null?void 0:t[s])!=null?r:`{${s}}`}`}),vE=i=>{const t=x.computed(()=>x.unref(i).name),e=x.isRef(i)?i:x.ref(i);return{lang:t,locale:e,t:CE(i)}},Au=Symbol("localeContextKey"),RE=i=>{const t=i||x.inject(Au,x.ref());return vE(x.computed(()=>t.value||EE))},Ou="__epPropKey",Nt=i=>i,TE=i=>mu(i)&&!!i[Ou],Du=(i,t)=>{if(!mu(i)||TE(i))return i;const{values:e,required:n,default:s,type:r,validator:o}=i,l={type:r,required:!!n,validator:e||o?h=>{let c=!1,u=[];if(e&&(u=Array.from(e),qa(i,"default")&&u.push(s),c||(c=u.includes(h))),o&&(c||(c=o(h))),!c&&u.length>0){const d=[...new Set(u)].map(f=>JSON.stringify(f)).join(", ");x.warn(`Invalid prop: validation failed${t?` for prop "${t}"`:""}. Expected one of [${d}], got value ${JSON.stringify(h)}.`)}return c}:void 0,[Ou]:!0};return qa(i,"default")&&(l.default=s),l},_s=i=>aE(Object.entries(i).map(([t,e])=>[t,Du(e,t)])),SE=Du({type:String,values:["","default","small","large"],required:!1}),IE=Symbol("size"),LE=Symbol("emptyValuesContextKey"),PE=_s({emptyValues:Array,valueOnClear:{type:Nt([String,Number,Boolean,Function]),default:void 0,validator:i=>(i=Mr(i)?i():i,O0(i)?i.every(t=>!t):!i)}}),Fu=i=>Object.keys(i),Dr=x.ref();function ku(i,t=void 0){const e=x.getCurrentInstance()?x.inject(gu,Dr):Dr;return i?x.computed(()=>{var n,s;return(s=(n=e.value)==null?void 0:n[i])!=null?s:t}):e}function bE(i,t){const e=ku(),n=Ha(i,x.computed(()=>{var a;return((a=e.value)==null?void 0:a.namespace)||br})),s=RE(x.computed(()=>{var a;return(a=e.value)==null?void 0:a.locale})),r=xE(x.computed(()=>{var a;return((a=e.value)==null?void 0:a.zIndex)||Pu})),o=x.computed(()=>{var a;return x.unref(t)||((a=e.value)==null?void 0:a.size)||""});return Nu(x.computed(()=>x.unref(e)||{})),{ns:n,locale:s,zIndex:r,size:o}}const Nu=(i,t,e=!1)=>{var n;const s=!!x.getCurrentInstance(),r=s?ku():void 0,o=(n=t==null?void 0:t.provide)!=null?n:s?x.provide:void 0;if(!o){gs("provideGlobalConfig","provideGlobalConfig() can only be used inside setup().");return}const a=x.computed(()=>{const l=x.unref(i);return r!=null&&r.value?ME(r.value,l):l});return o(gu,a),o(Au,x.computed(()=>a.value.locale)),o(_u,x.computed(()=>a.value.namespace)),o(Mu,x.computed(()=>a.value.zIndex)),o(IE,{size:x.computed(()=>a.value.size||"")}),o(LE,x.computed(()=>({emptyValues:a.value.emptyValues,valueOnClear:a.value.valueOnClear}))),(e||!Dr.value)&&(Dr.value=a.value),a},ME=(i,t)=>{const e=[...new Set([...Fu(i),...Fu(t)])],n={};for(const s of e)n[s]=t[s]!==void 0?t[s]:i[s];return n};var al=(i,t)=>{const e=i.__vccOpts||i;for(const[n,s]of t)e[n]=s;return e};const Gu=(i,t)=>{if(i.install=e=>{for(const n of[i,...Object.values(t??{})])e.component(n.name,n)},t)for(const[e,n]of Object.entries(t))i[e]=n;return i},AE=(i,t)=>(i.install=e=>{i._context=e._context,e.config.globalProperties[t]=i},i),OE="utils/dom/style";function ll(i,t="px"){if(!i&&i!==0)return"";if(An(i)||hE(i))return`${i}${t}`;if(yi(i))return i;gs(OE,"binding value must be a string or number")}const DE=_s({size:{type:Nt([Number,String])},color:{type:String}}),FE=x.defineComponent({name:"ElIcon",inheritAttrs:!1,__name:"icon",props:DE,setup(i){const t=i,e=Ha("icon"),n=x.computed(()=>{const{size:s,color:r}=t,o=ll(s);return!o&&!r?{}:{fontSize:o,"--color":r}});return(s,r)=>(x.openBlock(),x.createElementBlock("i",x.mergeProps({class:x.unref(e).b(),style:n.value},s.$attrs),[x.renderSlot(s.$slots,"default")],16))}});var kE=al(FE,[["__file","/home/runner/work/element-plus/element-plus/packages/components/icon/src/icon.vue"]]);const zu=Gu(kE);/*! Element Plus Icons Vue v2.3.2 */var NE=x.defineComponent({name:"CircleCloseFilled",__name:"circle-close-filled",setup(i){return(t,e)=>(x.openBlock(),x.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[x.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 393.664L407.936 353.6a38.4 38.4 0 1 0-54.336 54.336L457.664 512 353.6 616.064a38.4 38.4 0 1 0 54.336 54.336L512 566.336 616.064 670.4a38.4 38.4 0 1 0 54.336-54.336L566.336 512 670.4 407.936a38.4 38.4 0 1 0-54.336-54.336z"})]))}}),ju=NE,GE=x.defineComponent({name:"Close",__name:"close",setup(i){return(t,e)=>(x.openBlock(),x.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[x.createElementVNode("path",{fill:"currentColor",d:"M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"})]))}}),zE=GE,jE=x.defineComponent({name:"InfoFilled",__name:"info-filled",setup(i){return(t,e)=>(x.openBlock(),x.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[x.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896.064A448 448 0 0 1 512 64m67.2 275.072c33.28 0 60.288-23.104 60.288-57.344s-27.072-57.344-60.288-57.344c-33.28 0-60.16 23.104-60.16 57.344s26.88 57.344 60.16 57.344M590.912 699.2c0-6.848 2.368-24.64 1.024-34.752l-52.608 60.544c-10.88 11.456-24.512 19.392-30.912 17.28a12.99 12.99 0 0 1-8.256-14.72l87.68-276.992c7.168-35.136-12.544-67.2-54.336-71.296-44.096 0-108.992 44.736-148.48 101.504 0 6.784-1.28 23.68.064 33.792l52.544-60.608c10.88-11.328 23.552-19.328 29.952-17.152a12.8 12.8 0 0 1 7.808 16.128L388.48 728.576c-10.048 32.256 8.96 63.872 55.04 71.04 67.84 0 107.904-43.648 147.456-100.416z"})]))}}),hl=jE,XE=x.defineComponent({name:"SuccessFilled",__name:"success-filled",setup(i){return(t,e)=>(x.openBlock(),x.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[x.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.27 38.27 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z"})]))}}),Xu=XE,BE=x.defineComponent({name:"WarningFilled",__name:"warning-filled",setup(i){return(t,e)=>(x.openBlock(),x.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[x.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 192a58.43 58.43 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.43 58.43 0 0 0 512 256m0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4"})]))}}),Bu=BE;const YE=Nt([String,Object,Function]),WE={Close:zE,SuccessFilled:Xu,InfoFilled:hl,WarningFilled:Bu,CircleCloseFilled:ju},Yu={primary:hl,success:Xu,warning:Bu,error:ju,info:hl},VE=()=>Ci&&/android/i.test(window.navigator.userAgent),UE=i=>i,cl={tab:"Tab",enter:"Enter",space:"Space",left:"ArrowLeft",up:"ArrowUp",right:"ArrowRight",down:"ArrowDown",esc:"Escape",delete:"Delete",backspace:"Backspace",numpadEnter:"NumpadEnter",pageUp:"PageUp",pageDown:"PageDown",home:"Home",end:"End"},KE=i=>{if(i.code&&i.code!=="Unidentified")return i.code;const t=$E(i);if(t){if(Object.values(cl).includes(t))return t;switch(t){case" ":return cl.space;default:return""}}return""},$E=i=>{let t=i.key&&i.key!=="Unidentified"?i.key:"";if(!t&&i.type==="keyup"&&VE()){const e=i.target;t=e.value.charAt(e.selectionStart-1)}return t},ZE=_s({value:{type:[String,Number],default:""},max:{type:Number,default:99},isDot:Boolean,hidden:Boolean,type:{type:String,values:["primary","success","warning","info","danger"],default:"danger"},showZero:{type:Boolean,default:!0},color:String,badgeStyle:{type:Nt([String,Object,Array])},offset:{type:Nt(Array),default:[0,0]},badgeClass:{type:String}}),HE=x.defineComponent({name:"ElBadge",__name:"badge",props:ZE,setup(i,{expose:t}){const e=i,n=Ha("badge"),s=x.computed(()=>e.isDot?"":An(e.value)&&An(e.max)?e.max<e.value?`${e.max}+`:`${e.value}`:`${e.value}`),r=x.computed(()=>{var o;return[{backgroundColor:e.color,marginRight:ll(-e.offset[0]),marginTop:ll(e.offset[1])},(o=e.badgeStyle)!=null?o:{}]});return t({content:s}),(o,a)=>(x.openBlock(),x.createElementBlock("div",{class:x.normalizeClass(x.unref(n).b())},[x.renderSlot(o.$slots,"default"),x.createVNode(x.Transition,{name:`${x.unref(n).namespace.value}-zoom-in-center`,persisted:""},{default:x.withCtx(()=>[x.withDirectives(x.createElementVNode("sup",{class:x.normalizeClass([x.unref(n).e("content"),x.unref(n).em("content",o.type),x.unref(n).is("fixed",!!o.$slots.default),x.unref(n).is("dot",o.isDot),x.unref(n).is("hide-zero",!o.showZero&&o.value===0),o.badgeClass]),style:x.normalizeStyle(r.value)},[x.renderSlot(o.$slots,"content",{value:s.value},()=>[x.createTextVNode(x.toDisplayString(s.value),1)])],6),[[x.vShow,!o.hidden&&(s.value||o.isDot||o.$slots.content)]])]),_:3},8,["name"])],2))}});var qE=al(HE,[["__file","/home/runner/work/element-plus/element-plus/packages/components/badge/src/badge.vue"]]);const JE=Gu(qE),QE=_s({a11y:{type:Boolean,default:!0},locale:{type:Nt(Object)},size:SE,button:{type:Nt(Object)},card:{type:Nt(Object)},dialog:{type:Nt(Object)},link:{type:Nt(Object)},experimentalFeatures:{type:Nt(Object)},keyboardNavigation:{type:Boolean,default:!0},message:{type:Nt(Object)},zIndex:Number,namespace:{type:String,default:"el"},...PE}),Tt={placement:"top"};x.defineComponent({name:"ElConfigProvider",props:QE,setup(i,{slots:t}){const e=Nu(i);return x.watch(()=>i.message,n=>{var s,r;Object.assign(Tt,(r=(s=e==null?void 0:e.value)==null?void 0:s.message)!=null?r:{},n??{})},{immediate:!0,deep:!0}),()=>x.renderSlot(t,"default",{config:e==null?void 0:e.value})}});const Wu=["primary","success","info","warning","error"],Vu=["top","top-left","top-right","bottom","bottom-left","bottom-right"],wi="top",St=UE({customClass:"",dangerouslyUseHTMLString:!1,duration:3e3,icon:void 0,id:"",message:"",onClose:void 0,showClose:!1,type:"info",plain:!1,offset:16,placement:void 0,zIndex:0,grouping:!1,repeatNum:1,appendTo:Ci?document.body:void 0}),tC=_s({customClass:{type:String,default:St.customClass},dangerouslyUseHTMLString:{type:Boolean,default:St.dangerouslyUseHTMLString},duration:{type:Number,default:St.duration},icon:{type:YE,default:St.icon},id:{type:String,default:St.id},message:{type:Nt([String,Object,Function]),default:St.message},onClose:{type:Nt(Function),default:St.onClose},showClose:{type:Boolean,default:St.showClose},type:{type:String,values:Wu,default:St.type},plain:{type:Boolean,default:St.plain},offset:{type:Number,default:St.offset},placement:{type:String,values:Vu,default:St.placement},zIndex:{type:Number,default:St.zIndex},grouping:{type:Boolean,default:St.grouping},repeatNum:{type:Number,default:St.repeatNum}}),eC={destroy:()=>!0},ce=x.shallowReactive({}),nC=i=>(ce[i]||(ce[i]=x.shallowReactive([])),ce[i]),iC=(i,t)=>{const e=ce[t]||[],n=e.findIndex(o=>o.id===i),s=e[n];let r;return n>0&&(r=e[n-1]),{current:s,prev:r}},sC=(i,t)=>{const{prev:e}=iC(i,t);return e?e.vm.exposed.bottom.value:0},rC=(i,t,e)=>(ce[e]||[]).findIndex(r=>r.id===i)>0?16:t,oC=["id"],aC=["innerHTML"],lC=x.defineComponent({name:"ElMessage",__name:"message",props:tC,emits:eC,setup(i,{expose:t,emit:e}){const{Close:n}=WE,s=i,r=e,o=x.ref(!1),{ns:a,zIndex:l}=bE("message"),{currentZIndex:h,nextZIndex:c}=l,u=x.ref(),d=x.ref(!1),f=x.ref(0);let g;const _=x.computed(()=>s.type?s.type==="error"?"danger":s.type:"info"),m=x.computed(()=>{const P=s.type;return{[a.bm("icon",P)]:P&&Yu[P]}}),p=x.computed(()=>s.icon||Yu[s.type]||""),y=x.computed(()=>s.placement||wi),C=x.computed(()=>sC(s.id,y.value)),E=x.computed(()=>rC(s.id,s.offset,y.value)+C.value),w=x.computed(()=>f.value+E.value),T=x.computed(()=>y.value.includes("left")?a.is("left"):y.value.includes("right")?a.is("right"):a.is("center")),v=x.computed(()=>y.value.startsWith("top")?"top":"bottom"),R=x.computed(()=>({[v.value]:`${E.value}px`,zIndex:h.value}));function I(){s.duration!==0&&({stop:g}=fE(()=>{O()},s.duration))}function b(){g==null||g()}function O(){d.value=!1,x.nextTick(()=>{var P;o.value||((P=s.onClose)==null||P.call(s),r("destroy"))})}function D(P){KE(P)===cl.esc&&O()}return x.onMounted(()=>{I(),c(),d.value=!0}),x.watch(()=>s.repeatNum,()=>{b(),I()}),gE(document,"keydown",D),pE(u,()=>{f.value=u.value.getBoundingClientRect().height}),t({visible:d,bottom:w,close:O}),(P,A)=>(x.openBlock(),x.createBlock(x.Transition,{name:x.unref(a).b("fade"),onBeforeEnter:A[0]||(A[0]=W=>o.value=!0),onBeforeLeave:P.onClose,onAfterLeave:A[1]||(A[1]=W=>P.$emit("destroy")),persisted:""},{default:x.withCtx(()=>[x.withDirectives(x.createElementVNode("div",{id:P.id,ref_key:"messageRef",ref:u,class:x.normalizeClass([x.unref(a).b(),{[x.unref(a).m(P.type)]:P.type},x.unref(a).is("closable",P.showClose),x.unref(a).is("plain",P.plain),x.unref(a).is("bottom",v.value==="bottom"),T.value,P.customClass]),style:x.normalizeStyle(R.value),role:"alert",onMouseenter:b,onMouseleave:I},[P.repeatNum>1?(x.openBlock(),x.createBlock(x.unref(JE),{key:0,value:P.repeatNum,type:_.value,class:x.normalizeClass(x.unref(a).e("badge"))},null,8,["value","type","class"])):x.createCommentVNode("v-if",!0),p.value?(x.openBlock(),x.createBlock(x.unref(zu),{key:1,class:x.normalizeClass([x.unref(a).e("icon"),m.value])},{default:x.withCtx(()=>[(x.openBlock(),x.createBlock(x.resolveDynamicComponent(p.value)))]),_:1},8,["class"])):x.createCommentVNode("v-if",!0),x.renderSlot(P.$slots,"default",{},()=>[P.dangerouslyUseHTMLString?(x.openBlock(),x.createElementBlock(x.Fragment,{key:1},[x.createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "),x.createElementVNode("p",{class:x.normalizeClass(x.unref(a).e("content")),innerHTML:P.message},null,10,aC)],2112)):(x.openBlock(),x.createElementBlock("p",{key:0,class:x.normalizeClass(x.unref(a).e("content"))},x.toDisplayString(P.message),3))]),P.showClose?(x.openBlock(),x.createBlock(x.unref(zu),{key:2,class:x.normalizeClass(x.unref(a).e("closeBtn")),onClick:x.withModifiers(O,["stop"])},{default:x.withCtx(()=>[x.createVNode(x.unref(n))]),_:1},8,["class"])):x.createCommentVNode("v-if",!0)],46,oC),[[x.vShow,d.value]])]),_:3},8,["name","onBeforeLeave"]))}});var hC=al(lC,[["__file","/home/runner/work/element-plus/element-plus/packages/components/message/src/message.vue"]]);let cC=1;const uC=i=>{if(!i.appendTo)i.appendTo=document.body;else if(yi(i.appendTo)){let e=document.querySelector(i.appendTo);lE(e)||(gs("ElMessage","the appendTo option is not an HTMLElement. Falling back to document.body."),e=document.body),i.appendTo=e}},dC=i=>{!i.placement&&yi(Tt.placement)&&Tt.placement&&(i.placement=Tt.placement),i.placement||(i.placement=wi),Vu.includes(i.placement)||(gs("ElMessage",`Invalid placement: ${i.placement}. Falling back to '${wi}'.`),i.placement=wi)},Uu=i=>{const t=!i||yi(i)||x.isVNode(i)||Mr(i)?{message:i}:i,e={...St,...t};return uC(e),dC(e),il(Tt.grouping)&&!e.grouping&&(e.grouping=Tt.grouping),An(Tt.duration)&&e.duration===3e3&&(e.duration=Tt.duration),An(Tt.offset)&&e.offset===16&&(e.offset=Tt.offset),il(Tt.showClose)&&!e.showClose&&(e.showClose=Tt.showClose),il(Tt.plain)&&!e.plain&&(e.plain=Tt.plain),e},fC=i=>{const t=i.props.placement||wi,e=ce[t],n=e.indexOf(i);if(n===-1)return;e.splice(n,1);const{handler:s}=i;s.close()},gC=({appendTo:i,...t},e)=>{const n=`message_${cC++}`,s=t.onClose,r=document.createElement("div"),o={...t,id:n,onClose:()=>{s==null||s(),fC(c)},onDestroy:()=>{x.render(null,r)}},a=x.createVNode(hC,o,Mr(o.message)||x.isVNode(o.message)?{default:Mr(o.message)?o.message:()=>o.message}:null);a.appContext=e||On._context,x.render(a,r),i.appendChild(r.firstElementChild);const l=a.component,c={id:n,vnode:a,vm:l,handler:{close:()=>{l.exposed.close()}},props:a.component.props};return c},On=(i={},t)=>{if(!Ci)return{close:()=>{}};const e=Uu(i),n=nC(e.placement||wi);if(e.grouping&&n.length){const r=n.find(({vnode:o})=>{var a;return((a=o.props)==null?void 0:a.message)===e.message});if(r)return r.props.repeatNum+=1,r.props.type=e.type,r.handler}if(An(Tt.max)&&n.length>=Tt.max)return{close:()=>{}};const s=gC(e,t);return n.push(s),s.handler};Wu.forEach(i=>{On[i]=(t={},e)=>{const n=Uu(t);return On({...n,type:i},e)}});function _C(i){for(const t in ce)if(qa(ce,t)){const e=[...ce[t]];for(const n of e)(!i||i===n.props.type)&&n.handler.close()}}function mC(i){if(!ce[i])return;[...ce[i]].forEach(e=>e.handler.close())}On.closeAll=_C,On.closeAllByPlacement=mC,On._context=null;const pC=AE(On,"$message");let ul,Fr,kr,Ku=!1;const yC=(i,t)=>{const{boxStyle:e,layerId:n,drawType:s="Circle"}=i;return s==="Circle"&&(mt.removeLayerById("cricleBoxs"),mt.removeLayerById("dingwei_cricleLayer")),pC({message:"双击退出绘制",type:"info"}),Ku&&mt.removeLayerById(n),mt.xmEmptyLayer({layerId:n,zIndex:999}),kr=new fu({type:s,geometryFunction:s==="Polygon"?void 0:L0(),source:mt.getLayerSource(n),style:e}),window.xmMap.addInteraction(kr),kr.on("drawend",function(r){ul=r.feature;const o=ul.getGeometry();Fr=o.getExtent(),console.log("矩形范围:",r,o,Fr);const l=new vr().writeFeature(ul);console.log("geojsonData:",l),window.xmMap.removeInteraction(kr),Ku=!0,t(Fr,l)}),{feature:Fr}};let Dn,dl=!1,Nr=!1,ms,ln;const xC=(i,t)=>{if(ln){ln.setActive(!1),ln=void 0;return}mt.removeLayerById("DrawBox");const{style:e,zIndex:n,radioVal:s}=i;dl&&Nr&&(mt.removeLayerById("cricleBoxs"),mt.removeLayerById("dingwei_cricleLayer"),window.xmMap.removeLayer(ms),dl=!1,Nr=!1),mt.xmEmptyLayer({layerId:"cricleBoxs",zIndex:n,style:e});let r=mt.getLayerSource("cricleBoxs");ln=new fu({source:r,type:"Point",style:{"circle-radius":5,"circle-fill-color":"#ccc"}}),window.xmMap.addInteraction(ln),ln.once("drawend",function(o){const l=o.feature.getGeometry();l&&(Dn=l.getExtent(),fl({radioVal:s,style:new $t({fill:new wt({color:[250,205,145,.3]})})}),window.xmMap.removeInteraction(ln),t(Dn),dl=!0,console.log("范围:",Dn,Dn[0],Dn[1])),ln=void 0})},fl=i=>{const{radioVal:t,style:e}=i;let n=new zt({type:"area",geometry:W_([Dn[0],Dn[1]],Number(t)*1e3)});n.setStyle(e),ms=new Fe({source:new ke({features:[n]}),zIndex:4}),mt.addLayerToMap("dingwei_cricleLayer",ms),window.xmMap.addLayer(ms),Nr=!0},EC={IconDingwei:xC,addCricleLayer:fl,Radius:i=>{Nr&&(window.xmMap.removeLayer(ms),fl({radioVal:i,style:new $t({fill:new wt({color:[250,205,145,.3]})})}))}};let ue=new Map;const Ee=(i,t)=>{if(!i)return console.error("图层ID不能为空");ue.has(i)&&(console.warn(`图层ID ${i} 已存在,可能导致覆盖现有图层`),console.log("现有图层IDs:",Array.from(ue.keys()))),ue.set(i,t),console.log(ue,"现有图层集合")},ps=i=>{const t=ue.get(i);return t||console.warn(`图层ID ${i} 不存在`),t},$u=i=>{if(ue.has(i)){let t=ps(i);window.xmMap.removeLayer(t),ue.delete(i)}else console.warn(`图层中没有当前ID${i}的图层`)},Gr=(i=!1)=>{i?(ue.clear(),console.warn("清空了当前的图层集合,不会销毁地图,不会移除图层,需手动调用usexmMapProps.destroyMap方法摧毁图层")):(ue.forEach(t=>{window.xmMap.removeLayer(t)}),ue.clear())},Zu=(i,t)=>{ue.has(i)?ps(i).setVisible(t):console.warn(`图层中没有当前ID${i}的图层`)},Hu=i=>{const{layerId:t="globalLayer",zIndex:e=2,style:n}=i,s=new ke;let r;return n?r=new Fe({source:s,zIndex:e,style:n}):r=new Fe({source:s,zIndex:e}),Ee(t,r),window.xmMap.addLayer(r),t||(console.warn("生成了一个空图层放在了全局,如果需要使用,可以通过globalLayer这个id获取"),window.xmglobalLayer=r),r},qu=(i="globalLayer")=>ps(i).getSource(),Ju=i=>{window.xmMap.getView().animate({center:i,zoom:13,duration:1e3})},Qu=(i,t,e)=>{const n=[i,t],s=e,r=window.xmMap.getView(),o=2e3;r.animate({center:n,zoom:s,duration:o})},CC={sky_map:eu,sky_note:nu,tdt_img:iu,tdt_cia:su,tdt_vec:ru,tdt_cva:ou},mt={getMap:fy,changeBaseMap:gy,closeBaseMap:_y,xmMapListener:yy,xmMask:Yy,xmVector3DLayer:a0,xmEmptyLayer:Hu,getLayerSource:qu,addLayerToMap:Ee,getLayerById:ps,removeLayerById:$u,removeAllLayer:Gr,setVisibleLayerById:Zu,xmGeoJSONLayer:_0,xmXYZTileLayer:m0,xmWMSTileLayer:p0,xmPointStyle:hu,xmaddOverlay:x0,xmPointFeature:cu,xmPointSource:E0,xmPointLayer:C0,clusterPointSource:w0,xmClusterLayer:v0,moveToPoint:Ju,toHome:Qu,DrawBox:yC,postionFn:EC},wC=()=>{x.onMounted(()=>{py()}),x.onBeforeUnmount(()=>{Gr(!0),xy()})};return dt.addLayerToMap=Ee,dt.getLayerById=ps,dt.getLayerSource=qu,dt.moveToPoint=Ju,dt.removeAllLayer=Gr,dt.removeLayerById=$u,dt.setVisibleLayerById=Zu,dt.toHome=Qu,dt.useMapInfo=CC,dt.usexmMapProps=mt,dt.usexmMapWorld=wC,dt.xmEmptyLayer=Hu,Object.defineProperty(dt,Symbol.toStringTag,{value:"Module"}),dt}({},Vue);
11
+ **/process.env.NODE_ENV!=="production"&&Object.freeze({}),process.env.NODE_ENV!=="production"&&Object.freeze([]);const D0=Object.prototype.hasOwnProperty,qa=(i,t)=>D0.call(i,t),F0=Array.isArray,Mr=i=>typeof i=="function",yi=i=>typeof i=="string",pu=i=>i!==null&&typeof i=="object";var k0=typeof global=="object"&&global&&global.Object===Object&&global;const N0=k0;var G0=typeof self=="object"&&self&&self.Object===Object&&self,z0=N0||G0||Function("return this")();const Ja=z0;var j0=Ja.Symbol;const xi=j0;var yu=Object.prototype,X0=yu.hasOwnProperty,B0=yu.toString,ds=xi?xi.toStringTag:void 0;function Y0(i){var t=X0.call(i,ds),e=i[ds];try{i[ds]=void 0;var n=!0}catch{}var s=B0.call(i);return n&&(t?i[ds]=e:delete i[ds]),s}var W0=Object.prototype,V0=W0.toString;function U0(i){return V0.call(i)}var K0="[object Null]",$0="[object Undefined]",xu=xi?xi.toStringTag:void 0;function Eu(i){return i==null?i===void 0?$0:K0:xu&&xu in Object(i)?Y0(i):U0(i)}function Z0(i){return i!=null&&typeof i=="object"}var H0="[object Symbol]";function Qa(i){return typeof i=="symbol"||Z0(i)&&Eu(i)==H0}function q0(i,t){for(var e=-1,n=i==null?0:i.length,s=Array(n);++e<n;)s[e]=t(i[e],e,i);return s}var J0=Array.isArray;const tl=J0;var Q0=1/0,Cu=xi?xi.prototype:void 0,wu=Cu?Cu.toString:void 0;function vu(i){if(typeof i=="string")return i;if(tl(i))return q0(i,vu)+"";if(Qa(i))return wu?wu.call(i):"";var t=i+"";return t=="0"&&1/i==-Q0?"-0":t}function Ru(i){var t=typeof i;return i!=null&&(t=="object"||t=="function")}var tx="[object AsyncFunction]",ex="[object Function]",nx="[object GeneratorFunction]",ix="[object Proxy]";function sx(i){if(!Ru(i))return!1;var t=Eu(i);return t==ex||t==nx||t==tx||t==ix}var rx=Ja["__core-js_shared__"];const el=rx;var Tu=function(){var i=/[^.]+$/.exec(el&&el.keys&&el.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""}();function ox(i){return!!Tu&&Tu in i}var ax=Function.prototype,lx=ax.toString;function hx(i){if(i!=null){try{return lx.call(i)}catch{}try{return i+""}catch{}}return""}var cx=/[\\^$.*+?()[\]{}|]/g,ux=/^\[object .+?Constructor\]$/,dx=Function.prototype,fx=Object.prototype,gx=dx.toString,_x=fx.hasOwnProperty,mx=RegExp("^"+gx.call(_x).replace(cx,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function px(i){if(!Ru(i)||ox(i))return!1;var t=sx(i)?mx:ux;return t.test(hx(i))}function yx(i,t){return i==null?void 0:i[t]}function Su(i,t){var e=yx(i,t);return px(e)?e:void 0}function xx(i,t){return i===t||i!==i&&t!==t}var Ex=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Cx=/^\w*$/;function wx(i,t){if(tl(i))return!1;var e=typeof i;return e=="number"||e=="symbol"||e=="boolean"||i==null||Qa(i)?!0:Cx.test(i)||!Ex.test(i)||t!=null&&i in Object(t)}var vx=Su(Object,"create");const fs=vx;function Rx(){this.__data__=fs?fs(null):{},this.size=0}function Tx(i){var t=this.has(i)&&delete this.__data__[i];return this.size-=t?1:0,t}var Sx="__lodash_hash_undefined__",Ix=Object.prototype,Lx=Ix.hasOwnProperty;function Px(i){var t=this.__data__;if(fs){var e=t[i];return e===Sx?void 0:e}return Lx.call(t,i)?t[i]:void 0}var bx=Object.prototype,Mx=bx.hasOwnProperty;function Ax(i){var t=this.__data__;return fs?t[i]!==void 0:Mx.call(t,i)}var Ox="__lodash_hash_undefined__";function Dx(i,t){var e=this.__data__;return this.size+=this.has(i)?0:1,e[i]=fs&&t===void 0?Ox:t,this}function Mn(i){var t=-1,e=i==null?0:i.length;for(this.clear();++t<e;){var n=i[t];this.set(n[0],n[1])}}Mn.prototype.clear=Rx,Mn.prototype.delete=Tx,Mn.prototype.get=Px,Mn.prototype.has=Ax,Mn.prototype.set=Dx;function Fx(){this.__data__=[],this.size=0}function Ar(i,t){for(var e=i.length;e--;)if(xx(i[e][0],t))return e;return-1}var kx=Array.prototype,Nx=kx.splice;function Gx(i){var t=this.__data__,e=Ar(t,i);if(e<0)return!1;var n=t.length-1;return e==n?t.pop():Nx.call(t,e,1),--this.size,!0}function zx(i){var t=this.__data__,e=Ar(t,i);return e<0?void 0:t[e][1]}function jx(i){return Ar(this.__data__,i)>-1}function Xx(i,t){var e=this.__data__,n=Ar(e,i);return n<0?(++this.size,e.push([i,t])):e[n][1]=t,this}function Ei(i){var t=-1,e=i==null?0:i.length;for(this.clear();++t<e;){var n=i[t];this.set(n[0],n[1])}}Ei.prototype.clear=Fx,Ei.prototype.delete=Gx,Ei.prototype.get=zx,Ei.prototype.has=jx,Ei.prototype.set=Xx;var Bx=Su(Ja,"Map");const Yx=Bx;function Wx(){this.size=0,this.__data__={hash:new Mn,map:new(Yx||Ei),string:new Mn}}function Vx(i){var t=typeof i;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?i!=="__proto__":i===null}function Or(i,t){var e=i.__data__;return Vx(t)?e[typeof t=="string"?"string":"hash"]:e.map}function Ux(i){var t=Or(this,i).delete(i);return this.size-=t?1:0,t}function Kx(i){return Or(this,i).get(i)}function $x(i){return Or(this,i).has(i)}function Zx(i,t){var e=Or(this,i),n=e.size;return e.set(i,t),this.size+=e.size==n?0:1,this}function An(i){var t=-1,e=i==null?0:i.length;for(this.clear();++t<e;){var n=i[t];this.set(n[0],n[1])}}An.prototype.clear=Wx,An.prototype.delete=Ux,An.prototype.get=Kx,An.prototype.has=$x,An.prototype.set=Zx;var Hx="Expected a function";function nl(i,t){if(typeof i!="function"||t!=null&&typeof t!="function")throw new TypeError(Hx);var e=function(){var n=arguments,s=t?t.apply(this,n):n[0],r=e.cache;if(r.has(s))return r.get(s);var o=i.apply(this,n);return e.cache=r.set(s,o)||r,o};return e.cache=new(nl.Cache||An),e}nl.Cache=An;var qx=500;function Jx(i){var t=nl(i,function(n){return e.size===qx&&e.clear(),n}),e=t.cache;return t}var Qx=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,tE=/\\(\\)?/g,eE=Jx(function(i){var t=[];return i.charCodeAt(0)===46&&t.push(""),i.replace(Qx,function(e,n,s,r){t.push(s?r.replace(tE,"$1"):n||e)}),t});const nE=eE;function iE(i){return i==null?"":vu(i)}function sE(i,t){return tl(i)?i:wx(i,t)?[i]:nE(iE(i))}var rE=1/0;function oE(i){if(typeof i=="string"||Qa(i))return i;var t=i+"";return t=="0"&&1/i==-rE?"-0":t}function aE(i,t){t=sE(t,i);for(var e=0,n=t.length;i!=null&&e<n;)i=i[oE(t[e++])];return e&&e==n?i:void 0}function lE(i,t,e){var n=i==null?void 0:aE(i,t);return n===void 0?e:n}function hE(i){for(var t=-1,e=i==null?0:i.length,n={};++t<e;){var s=i[t];n[s[0]]=s[1]}return n}const il=i=>typeof i=="boolean",On=i=>typeof i=="number",cE=i=>typeof Element>"u"?!1:i instanceof Element,uE=i=>yi(i)?!Number.isNaN(Number(i)):!1;function sl(i){return x.getCurrentScope()?(x.onScopeDispose(i),!0):!1}function rl(i){return typeof i=="function"?i():x.unref(i)}const Ci=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const dE=Object.prototype.toString,fE=i=>dE.call(i)==="[object Object]",gE=()=>{};function _E(i,t,e={}){const{immediate:n=!0}=e,s=x.ref(!1);let r=null;function o(){r&&(clearTimeout(r),r=null)}function a(){s.value=!1,o()}function l(...h){o(),s.value=!0,r=setTimeout(()=>{s.value=!1,r=null,i(...h)},rl(t))}return n&&(s.value=!0,Ci&&l()),sl(a),{isPending:x.readonly(s),start:l,stop:a}}function ol(i){var t;const e=rl(i);return(t=e==null?void 0:e.$el)!=null?t:e}const Iu=Ci?window:void 0;function mE(...i){let t,e,n,s;if(typeof i[0]=="string"||Array.isArray(i[0])?([e,n,s]=i,t=Iu):[t,e,n,s]=i,!t)return gE;Array.isArray(e)||(e=[e]),Array.isArray(n)||(n=[n]);const r=[],o=()=>{r.forEach(c=>c()),r.length=0},a=(c,u,d,f)=>(c.addEventListener(u,d,f),()=>c.removeEventListener(u,d,f)),l=x.watch(()=>[ol(t),rl(s)],([c,u])=>{if(o(),!c)return;const d=fE(u)?{...u}:u;r.push(...e.flatMap(f=>n.map(g=>a(c,f,g,d))))},{immediate:!0,flush:"post"}),h=()=>{l(),o()};return sl(h),h}function pE(){const i=x.ref(!1),t=x.getCurrentInstance();return t&&x.onMounted(()=>{i.value=!0},t),i}function yE(i){const t=pE();return x.computed(()=>(t.value,!!i()))}function xE(i,t,e={}){const{window:n=Iu,...s}=e;let r;const o=yE(()=>n&&"ResizeObserver"in n),a=()=>{r&&(r.disconnect(),r=void 0)},l=x.computed(()=>Array.isArray(i)?i.map(u=>ol(u)):[ol(i)]),h=x.watch(l,u=>{if(a(),o.value&&n){r=new ResizeObserver(t);for(const d of u)d&&r.observe(d,s)}},{immediate:!0,flush:"post"}),c=()=>{a(),h()};return sl(c),{isSupported:o,stop:c}}class EE extends Error{constructor(t){super(t),this.name="ElementPlusError"}}function gs(i,t){if(process.env.NODE_ENV!=="production"){const e=yi(i)?new EE(`[${i}] ${t}`):i;console.warn(e)}}const Lu={current:0},Pu=x.ref(0),bu=2e3,Mu=Symbol("elZIndexContextKey"),Au=Symbol("zIndexContextKey"),CE=i=>{const t=x.getCurrentInstance()?x.inject(Mu,Lu):Lu,e=i||(x.getCurrentInstance()?x.inject(Au,void 0):void 0),n=x.computed(()=>{const o=x.unref(e);return On(o)?o:bu}),s=x.computed(()=>n.value+Pu.value),r=()=>(t.current++,Pu.value=t.current,s.value);return!Ci&&!x.inject(Mu)&&gs("ZIndexInjection",`Looks like you are using server rendering, you must provide a z-index provider to ensure the hydration process to be succeed
12
+ usage: app.provide(ZINDEX_INJECTION_KEY, { current: 0 })`),{initialZIndex:n,currentZIndex:s,nextZIndex:r}};var wE={name:"en",el:{breadcrumb:{label:"Breadcrumb"},colorpicker:{confirm:"OK",clear:"Clear",defaultLabel:"color picker",description:"current color is {color}. press enter to select a new color.",alphaLabel:"pick alpha value",alphaDescription:"alpha {alpha}, current color is {color}",hueLabel:"pick hue value",hueDescription:"hue {hue}, current color is {color}",svLabel:"pick saturation and brightness value",svDescription:"saturation {saturation}, brightness {brightness}, current color is {color}",predefineDescription:"select {value} as the color"},datepicker:{now:"Now",today:"Today",cancel:"Cancel",clear:"Clear",confirm:"OK",dateTablePrompt:"Use the arrow keys and enter to select the day of the month",monthTablePrompt:"Use the arrow keys and enter to select the month",yearTablePrompt:"Use the arrow keys and enter to select the year",selectedDate:"Selected date",selectDate:"Select date",selectTime:"Select time",startDate:"Start Date",startTime:"Start Time",endDate:"End Date",endTime:"End Time",prevYear:"Previous Year",nextYear:"Next Year",prevMonth:"Previous Month",nextMonth:"Next Month",year:"",month1:"January",month2:"February",month3:"March",month4:"April",month5:"May",month6:"June",month7:"July",month8:"August",month9:"September",month10:"October",month11:"November",month12:"December",weeks:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weeksFull:{sun:"Sunday",mon:"Monday",tue:"Tuesday",wed:"Wednesday",thu:"Thursday",fri:"Friday",sat:"Saturday"},months:{jan:"Jan",feb:"Feb",mar:"Mar",apr:"Apr",may:"May",jun:"Jun",jul:"Jul",aug:"Aug",sep:"Sep",oct:"Oct",nov:"Nov",dec:"Dec"}},inputNumber:{decrease:"decrease number",increase:"increase number"},select:{loading:"Loading",noMatch:"No matching data",noData:"No data",placeholder:"Select"},mention:{loading:"Loading"},dropdown:{toggleDropdown:"Toggle Dropdown"},cascader:{noMatch:"No matching data",loading:"Loading",placeholder:"Select",noData:"No data"},pagination:{goto:"Go to",pagesize:"/page",total:"Total {total}",pageClassifier:"",page:"Page",prev:"Go to previous page",next:"Go to next page",currentPage:"page {pager}",prevPages:"Previous {pager} pages",nextPages:"Next {pager} pages",deprecationWarning:"Deprecated usages detected, please refer to the el-pagination documentation for more details"},dialog:{close:"Close this dialog"},drawer:{close:"Close this dialog"},messagebox:{title:"Message",confirm:"OK",cancel:"Cancel",error:"Illegal input",close:"Close this dialog"},upload:{deleteTip:"press delete to remove",delete:"Delete",preview:"Preview",continue:"Continue"},slider:{defaultLabel:"slider between {min} and {max}",defaultRangeStartLabel:"pick start value",defaultRangeEndLabel:"pick end value"},table:{emptyText:"No Data",confirmFilter:"Confirm",resetFilter:"Reset",clearFilter:"All",sumText:"Sum",selectAllLabel:"Select all rows",selectRowLabel:"Select this row",expandRowLabel:"Expand this row",collapseRowLabel:"Collapse this row",sortLabel:"Sort by {column}",filterLabel:"Filter by {column}"},tag:{close:"Close this tag"},tour:{next:"Next",previous:"Previous",finish:"Finish",close:"Close this dialog"},tree:{emptyText:"No Data"},transfer:{noMatch:"No matching data",noData:"No data",titles:["List 1","List 2"],filterPlaceholder:"Enter keyword",noCheckedFormat:"{total} items",hasCheckedFormat:"{checked}/{total} checked"},image:{error:"FAILED"},pageHeader:{title:"Back"},popconfirm:{confirmButtonText:"Yes",cancelButtonText:"No"},carousel:{leftArrow:"Carousel arrow left",rightArrow:"Carousel arrow right",indicator:"Carousel switch to index {index}"}}};const vE=i=>(t,e)=>RE(t,e,x.unref(i)),RE=(i,t,e)=>lE(e,i,i).replace(/\{(\w+)\}/g,(n,s)=>{var r;return`${(r=t==null?void 0:t[s])!=null?r:`{${s}}`}`}),TE=i=>{const t=x.computed(()=>x.unref(i).name),e=x.isRef(i)?i:x.ref(i);return{lang:t,locale:e,t:vE(i)}},Ou=Symbol("localeContextKey"),SE=i=>{const t=i||x.inject(Ou,x.ref());return TE(x.computed(()=>t.value||wE))},Du="__epPropKey",Nt=i=>i,IE=i=>pu(i)&&!!i[Du],Fu=(i,t)=>{if(!pu(i)||IE(i))return i;const{values:e,required:n,default:s,type:r,validator:o}=i,l={type:r,required:!!n,validator:e||o?h=>{let c=!1,u=[];if(e&&(u=Array.from(e),qa(i,"default")&&u.push(s),c||(c=u.includes(h))),o&&(c||(c=o(h))),!c&&u.length>0){const d=[...new Set(u)].map(f=>JSON.stringify(f)).join(", ");x.warn(`Invalid prop: validation failed${t?` for prop "${t}"`:""}. Expected one of [${d}], got value ${JSON.stringify(h)}.`)}return c}:void 0,[Du]:!0};return qa(i,"default")&&(l.default=s),l},_s=i=>hE(Object.entries(i).map(([t,e])=>[t,Fu(e,t)])),LE=Fu({type:String,values:["","default","small","large"],required:!1}),PE=Symbol("size"),bE=Symbol("emptyValuesContextKey"),ME=_s({emptyValues:Array,valueOnClear:{type:Nt([String,Number,Boolean,Function]),default:void 0,validator:i=>(i=Mr(i)?i():i,F0(i)?i.every(t=>!t):!i)}}),ku=i=>Object.keys(i),Dr=x.ref();function Nu(i,t=void 0){const e=x.getCurrentInstance()?x.inject(_u,Dr):Dr;return i?x.computed(()=>{var n,s;return(s=(n=e.value)==null?void 0:n[i])!=null?s:t}):e}function AE(i,t){const e=Nu(),n=Ha(i,x.computed(()=>{var a;return((a=e.value)==null?void 0:a.namespace)||br})),s=SE(x.computed(()=>{var a;return(a=e.value)==null?void 0:a.locale})),r=CE(x.computed(()=>{var a;return((a=e.value)==null?void 0:a.zIndex)||bu})),o=x.computed(()=>{var a;return x.unref(t)||((a=e.value)==null?void 0:a.size)||""});return Gu(x.computed(()=>x.unref(e)||{})),{ns:n,locale:s,zIndex:r,size:o}}const Gu=(i,t,e=!1)=>{var n;const s=!!x.getCurrentInstance(),r=s?Nu():void 0,o=(n=t==null?void 0:t.provide)!=null?n:s?x.provide:void 0;if(!o){gs("provideGlobalConfig","provideGlobalConfig() can only be used inside setup().");return}const a=x.computed(()=>{const l=x.unref(i);return r!=null&&r.value?OE(r.value,l):l});return o(_u,a),o(Ou,x.computed(()=>a.value.locale)),o(mu,x.computed(()=>a.value.namespace)),o(Au,x.computed(()=>a.value.zIndex)),o(PE,{size:x.computed(()=>a.value.size||"")}),o(bE,x.computed(()=>({emptyValues:a.value.emptyValues,valueOnClear:a.value.valueOnClear}))),(e||!Dr.value)&&(Dr.value=a.value),a},OE=(i,t)=>{const e=[...new Set([...ku(i),...ku(t)])],n={};for(const s of e)n[s]=t[s]!==void 0?t[s]:i[s];return n};var al=(i,t)=>{const e=i.__vccOpts||i;for(const[n,s]of t)e[n]=s;return e};const zu=(i,t)=>{if(i.install=e=>{for(const n of[i,...Object.values(t??{})])e.component(n.name,n)},t)for(const[e,n]of Object.entries(t))i[e]=n;return i},DE=(i,t)=>(i.install=e=>{i._context=e._context,e.config.globalProperties[t]=i},i),FE="utils/dom/style";function ll(i,t="px"){if(!i&&i!==0)return"";if(On(i)||uE(i))return`${i}${t}`;if(yi(i))return i;gs(FE,"binding value must be a string or number")}const kE=_s({size:{type:Nt([Number,String])},color:{type:String}}),NE=x.defineComponent({name:"ElIcon",inheritAttrs:!1,__name:"icon",props:kE,setup(i){const t=i,e=Ha("icon"),n=x.computed(()=>{const{size:s,color:r}=t,o=ll(s);return!o&&!r?{}:{fontSize:o,"--color":r}});return(s,r)=>(x.openBlock(),x.createElementBlock("i",x.mergeProps({class:x.unref(e).b(),style:n.value},s.$attrs),[x.renderSlot(s.$slots,"default")],16))}});var GE=al(NE,[["__file","/home/runner/work/element-plus/element-plus/packages/components/icon/src/icon.vue"]]);const ju=zu(GE);/*! Element Plus Icons Vue v2.3.2 */var zE=x.defineComponent({name:"CircleCloseFilled",__name:"circle-close-filled",setup(i){return(t,e)=>(x.openBlock(),x.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[x.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 393.664L407.936 353.6a38.4 38.4 0 1 0-54.336 54.336L457.664 512 353.6 616.064a38.4 38.4 0 1 0 54.336 54.336L512 566.336 616.064 670.4a38.4 38.4 0 1 0 54.336-54.336L566.336 512 670.4 407.936a38.4 38.4 0 1 0-54.336-54.336z"})]))}}),Xu=zE,jE=x.defineComponent({name:"Close",__name:"close",setup(i){return(t,e)=>(x.openBlock(),x.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[x.createElementVNode("path",{fill:"currentColor",d:"M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"})]))}}),XE=jE,BE=x.defineComponent({name:"InfoFilled",__name:"info-filled",setup(i){return(t,e)=>(x.openBlock(),x.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[x.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896.064A448 448 0 0 1 512 64m67.2 275.072c33.28 0 60.288-23.104 60.288-57.344s-27.072-57.344-60.288-57.344c-33.28 0-60.16 23.104-60.16 57.344s26.88 57.344 60.16 57.344M590.912 699.2c0-6.848 2.368-24.64 1.024-34.752l-52.608 60.544c-10.88 11.456-24.512 19.392-30.912 17.28a12.99 12.99 0 0 1-8.256-14.72l87.68-276.992c7.168-35.136-12.544-67.2-54.336-71.296-44.096 0-108.992 44.736-148.48 101.504 0 6.784-1.28 23.68.064 33.792l52.544-60.608c10.88-11.328 23.552-19.328 29.952-17.152a12.8 12.8 0 0 1 7.808 16.128L388.48 728.576c-10.048 32.256 8.96 63.872 55.04 71.04 67.84 0 107.904-43.648 147.456-100.416z"})]))}}),hl=BE,YE=x.defineComponent({name:"SuccessFilled",__name:"success-filled",setup(i){return(t,e)=>(x.openBlock(),x.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[x.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.27 38.27 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z"})]))}}),Bu=YE,WE=x.defineComponent({name:"WarningFilled",__name:"warning-filled",setup(i){return(t,e)=>(x.openBlock(),x.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[x.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 192a58.43 58.43 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.43 58.43 0 0 0 512 256m0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4"})]))}}),Yu=WE;const VE=Nt([String,Object,Function]),UE={Close:XE,SuccessFilled:Bu,InfoFilled:hl,WarningFilled:Yu,CircleCloseFilled:Xu},Wu={primary:hl,success:Bu,warning:Yu,error:Xu,info:hl},KE=()=>Ci&&/android/i.test(window.navigator.userAgent),$E=i=>i,cl={tab:"Tab",enter:"Enter",space:"Space",left:"ArrowLeft",up:"ArrowUp",right:"ArrowRight",down:"ArrowDown",esc:"Escape",delete:"Delete",backspace:"Backspace",numpadEnter:"NumpadEnter",pageUp:"PageUp",pageDown:"PageDown",home:"Home",end:"End"},ZE=i=>{if(i.code&&i.code!=="Unidentified")return i.code;const t=HE(i);if(t){if(Object.values(cl).includes(t))return t;switch(t){case" ":return cl.space;default:return""}}return""},HE=i=>{let t=i.key&&i.key!=="Unidentified"?i.key:"";if(!t&&i.type==="keyup"&&KE()){const e=i.target;t=e.value.charAt(e.selectionStart-1)}return t},qE=_s({value:{type:[String,Number],default:""},max:{type:Number,default:99},isDot:Boolean,hidden:Boolean,type:{type:String,values:["primary","success","warning","info","danger"],default:"danger"},showZero:{type:Boolean,default:!0},color:String,badgeStyle:{type:Nt([String,Object,Array])},offset:{type:Nt(Array),default:[0,0]},badgeClass:{type:String}}),JE=x.defineComponent({name:"ElBadge",__name:"badge",props:qE,setup(i,{expose:t}){const e=i,n=Ha("badge"),s=x.computed(()=>e.isDot?"":On(e.value)&&On(e.max)?e.max<e.value?`${e.max}+`:`${e.value}`:`${e.value}`),r=x.computed(()=>{var o;return[{backgroundColor:e.color,marginRight:ll(-e.offset[0]),marginTop:ll(e.offset[1])},(o=e.badgeStyle)!=null?o:{}]});return t({content:s}),(o,a)=>(x.openBlock(),x.createElementBlock("div",{class:x.normalizeClass(x.unref(n).b())},[x.renderSlot(o.$slots,"default"),x.createVNode(x.Transition,{name:`${x.unref(n).namespace.value}-zoom-in-center`,persisted:""},{default:x.withCtx(()=>[x.withDirectives(x.createElementVNode("sup",{class:x.normalizeClass([x.unref(n).e("content"),x.unref(n).em("content",o.type),x.unref(n).is("fixed",!!o.$slots.default),x.unref(n).is("dot",o.isDot),x.unref(n).is("hide-zero",!o.showZero&&o.value===0),o.badgeClass]),style:x.normalizeStyle(r.value)},[x.renderSlot(o.$slots,"content",{value:s.value},()=>[x.createTextVNode(x.toDisplayString(s.value),1)])],6),[[x.vShow,!o.hidden&&(s.value||o.isDot||o.$slots.content)]])]),_:3},8,["name"])],2))}});var QE=al(JE,[["__file","/home/runner/work/element-plus/element-plus/packages/components/badge/src/badge.vue"]]);const tC=zu(QE),eC=_s({a11y:{type:Boolean,default:!0},locale:{type:Nt(Object)},size:LE,button:{type:Nt(Object)},card:{type:Nt(Object)},dialog:{type:Nt(Object)},link:{type:Nt(Object)},experimentalFeatures:{type:Nt(Object)},keyboardNavigation:{type:Boolean,default:!0},message:{type:Nt(Object)},zIndex:Number,namespace:{type:String,default:"el"},...ME}),Tt={placement:"top"};x.defineComponent({name:"ElConfigProvider",props:eC,setup(i,{slots:t}){const e=Gu(i);return x.watch(()=>i.message,n=>{var s,r;Object.assign(Tt,(r=(s=e==null?void 0:e.value)==null?void 0:s.message)!=null?r:{},n??{})},{immediate:!0,deep:!0}),()=>x.renderSlot(t,"default",{config:e==null?void 0:e.value})}});const Vu=["primary","success","info","warning","error"],Uu=["top","top-left","top-right","bottom","bottom-left","bottom-right"],wi="top",St=$E({customClass:"",dangerouslyUseHTMLString:!1,duration:3e3,icon:void 0,id:"",message:"",onClose:void 0,showClose:!1,type:"info",plain:!1,offset:16,placement:void 0,zIndex:0,grouping:!1,repeatNum:1,appendTo:Ci?document.body:void 0}),nC=_s({customClass:{type:String,default:St.customClass},dangerouslyUseHTMLString:{type:Boolean,default:St.dangerouslyUseHTMLString},duration:{type:Number,default:St.duration},icon:{type:VE,default:St.icon},id:{type:String,default:St.id},message:{type:Nt([String,Object,Function]),default:St.message},onClose:{type:Nt(Function),default:St.onClose},showClose:{type:Boolean,default:St.showClose},type:{type:String,values:Vu,default:St.type},plain:{type:Boolean,default:St.plain},offset:{type:Number,default:St.offset},placement:{type:String,values:Uu,default:St.placement},zIndex:{type:Number,default:St.zIndex},grouping:{type:Boolean,default:St.grouping},repeatNum:{type:Number,default:St.repeatNum}}),iC={destroy:()=>!0},ue=x.shallowReactive({}),sC=i=>(ue[i]||(ue[i]=x.shallowReactive([])),ue[i]),rC=(i,t)=>{const e=ue[t]||[],n=e.findIndex(o=>o.id===i),s=e[n];let r;return n>0&&(r=e[n-1]),{current:s,prev:r}},oC=(i,t)=>{const{prev:e}=rC(i,t);return e?e.vm.exposed.bottom.value:0},aC=(i,t,e)=>(ue[e]||[]).findIndex(r=>r.id===i)>0?16:t,lC=["id"],hC=["innerHTML"],cC=x.defineComponent({name:"ElMessage",__name:"message",props:nC,emits:iC,setup(i,{expose:t,emit:e}){const{Close:n}=UE,s=i,r=e,o=x.ref(!1),{ns:a,zIndex:l}=AE("message"),{currentZIndex:h,nextZIndex:c}=l,u=x.ref(),d=x.ref(!1),f=x.ref(0);let g;const _=x.computed(()=>s.type?s.type==="error"?"danger":s.type:"info"),m=x.computed(()=>{const P=s.type;return{[a.bm("icon",P)]:P&&Wu[P]}}),p=x.computed(()=>s.icon||Wu[s.type]||""),y=x.computed(()=>s.placement||wi),C=x.computed(()=>oC(s.id,y.value)),E=x.computed(()=>aC(s.id,s.offset,y.value)+C.value),w=x.computed(()=>f.value+E.value),T=x.computed(()=>y.value.includes("left")?a.is("left"):y.value.includes("right")?a.is("right"):a.is("center")),v=x.computed(()=>y.value.startsWith("top")?"top":"bottom"),R=x.computed(()=>({[v.value]:`${E.value}px`,zIndex:h.value}));function I(){s.duration!==0&&({stop:g}=_E(()=>{O()},s.duration))}function b(){g==null||g()}function O(){d.value=!1,x.nextTick(()=>{var P;o.value||((P=s.onClose)==null||P.call(s),r("destroy"))})}function D(P){ZE(P)===cl.esc&&O()}return x.onMounted(()=>{I(),c(),d.value=!0}),x.watch(()=>s.repeatNum,()=>{b(),I()}),mE(document,"keydown",D),xE(u,()=>{f.value=u.value.getBoundingClientRect().height}),t({visible:d,bottom:w,close:O}),(P,A)=>(x.openBlock(),x.createBlock(x.Transition,{name:x.unref(a).b("fade"),onBeforeEnter:A[0]||(A[0]=W=>o.value=!0),onBeforeLeave:P.onClose,onAfterLeave:A[1]||(A[1]=W=>P.$emit("destroy")),persisted:""},{default:x.withCtx(()=>[x.withDirectives(x.createElementVNode("div",{id:P.id,ref_key:"messageRef",ref:u,class:x.normalizeClass([x.unref(a).b(),{[x.unref(a).m(P.type)]:P.type},x.unref(a).is("closable",P.showClose),x.unref(a).is("plain",P.plain),x.unref(a).is("bottom",v.value==="bottom"),T.value,P.customClass]),style:x.normalizeStyle(R.value),role:"alert",onMouseenter:b,onMouseleave:I},[P.repeatNum>1?(x.openBlock(),x.createBlock(x.unref(tC),{key:0,value:P.repeatNum,type:_.value,class:x.normalizeClass(x.unref(a).e("badge"))},null,8,["value","type","class"])):x.createCommentVNode("v-if",!0),p.value?(x.openBlock(),x.createBlock(x.unref(ju),{key:1,class:x.normalizeClass([x.unref(a).e("icon"),m.value])},{default:x.withCtx(()=>[(x.openBlock(),x.createBlock(x.resolveDynamicComponent(p.value)))]),_:1},8,["class"])):x.createCommentVNode("v-if",!0),x.renderSlot(P.$slots,"default",{},()=>[P.dangerouslyUseHTMLString?(x.openBlock(),x.createElementBlock(x.Fragment,{key:1},[x.createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "),x.createElementVNode("p",{class:x.normalizeClass(x.unref(a).e("content")),innerHTML:P.message},null,10,hC)],2112)):(x.openBlock(),x.createElementBlock("p",{key:0,class:x.normalizeClass(x.unref(a).e("content"))},x.toDisplayString(P.message),3))]),P.showClose?(x.openBlock(),x.createBlock(x.unref(ju),{key:2,class:x.normalizeClass(x.unref(a).e("closeBtn")),onClick:x.withModifiers(O,["stop"])},{default:x.withCtx(()=>[x.createVNode(x.unref(n))]),_:1},8,["class"])):x.createCommentVNode("v-if",!0)],46,lC),[[x.vShow,d.value]])]),_:3},8,["name","onBeforeLeave"]))}});var uC=al(cC,[["__file","/home/runner/work/element-plus/element-plus/packages/components/message/src/message.vue"]]);let dC=1;const fC=i=>{if(!i.appendTo)i.appendTo=document.body;else if(yi(i.appendTo)){let e=document.querySelector(i.appendTo);cE(e)||(gs("ElMessage","the appendTo option is not an HTMLElement. Falling back to document.body."),e=document.body),i.appendTo=e}},gC=i=>{!i.placement&&yi(Tt.placement)&&Tt.placement&&(i.placement=Tt.placement),i.placement||(i.placement=wi),Uu.includes(i.placement)||(gs("ElMessage",`Invalid placement: ${i.placement}. Falling back to '${wi}'.`),i.placement=wi)},Ku=i=>{const t=!i||yi(i)||x.isVNode(i)||Mr(i)?{message:i}:i,e={...St,...t};return fC(e),gC(e),il(Tt.grouping)&&!e.grouping&&(e.grouping=Tt.grouping),On(Tt.duration)&&e.duration===3e3&&(e.duration=Tt.duration),On(Tt.offset)&&e.offset===16&&(e.offset=Tt.offset),il(Tt.showClose)&&!e.showClose&&(e.showClose=Tt.showClose),il(Tt.plain)&&!e.plain&&(e.plain=Tt.plain),e},_C=i=>{const t=i.props.placement||wi,e=ue[t],n=e.indexOf(i);if(n===-1)return;e.splice(n,1);const{handler:s}=i;s.close()},mC=({appendTo:i,...t},e)=>{const n=`message_${dC++}`,s=t.onClose,r=document.createElement("div"),o={...t,id:n,onClose:()=>{s==null||s(),_C(c)},onDestroy:()=>{x.render(null,r)}},a=x.createVNode(uC,o,Mr(o.message)||x.isVNode(o.message)?{default:Mr(o.message)?o.message:()=>o.message}:null);a.appContext=e||Dn._context,x.render(a,r),i.appendChild(r.firstElementChild);const l=a.component,c={id:n,vnode:a,vm:l,handler:{close:()=>{l.exposed.close()}},props:a.component.props};return c},Dn=(i={},t)=>{if(!Ci)return{close:()=>{}};const e=Ku(i),n=sC(e.placement||wi);if(e.grouping&&n.length){const r=n.find(({vnode:o})=>{var a;return((a=o.props)==null?void 0:a.message)===e.message});if(r)return r.props.repeatNum+=1,r.props.type=e.type,r.handler}if(On(Tt.max)&&n.length>=Tt.max)return{close:()=>{}};const s=mC(e,t);return n.push(s),s.handler};Vu.forEach(i=>{Dn[i]=(t={},e)=>{const n=Ku(t);return Dn({...n,type:i},e)}});function pC(i){for(const t in ue)if(qa(ue,t)){const e=[...ue[t]];for(const n of e)(!i||i===n.props.type)&&n.handler.close()}}function yC(i){if(!ue[i])return;[...ue[i]].forEach(e=>e.handler.close())}Dn.closeAll=pC,Dn.closeAllByPlacement=yC,Dn._context=null;const xC=DE(Dn,"$message");let ul,Fr,kr,$u=!1;const EC=(i,t)=>{const{boxStyle:e,layerId:n,drawType:s="Circle"}=i;return s==="Circle"&&(mt.removeLayerById("cricleBoxs"),mt.removeLayerById("dingwei_cricleLayer")),xC({message:"双击退出绘制",type:"info"}),$u&&mt.removeLayerById(n),mt.xmEmptyLayer({layerId:n,zIndex:999}),kr=new gu({type:s,geometryFunction:s==="Polygon"?void 0:b0(),source:mt.getLayerSource(n),style:e}),window.xmMap.addInteraction(kr),kr.on("drawend",function(r){ul=r.feature;const o=ul.getGeometry();Fr=o.getExtent(),console.log("矩形范围:",r,o,Fr);const l=new vr().writeFeature(ul);console.log("geojsonData:",l),window.xmMap.removeInteraction(kr),$u=!0,t(Fr,l)}),{feature:Fr}};let Fn,dl=!1,Nr=!1,ms,ln;const CC=(i,t)=>{if(ln){ln.setActive(!1),ln=void 0;return}mt.removeLayerById("DrawBox");const{style:e,zIndex:n,radioVal:s}=i;dl&&Nr&&(mt.removeLayerById("cricleBoxs"),mt.removeLayerById("dingwei_cricleLayer"),window.xmMap.removeLayer(ms),dl=!1,Nr=!1),mt.xmEmptyLayer({layerId:"cricleBoxs",zIndex:n,style:e});let r=mt.getLayerSource("cricleBoxs");ln=new gu({source:r,type:"Point",style:{"circle-radius":5,"circle-fill-color":"#ccc"}}),window.xmMap.addInteraction(ln),ln.once("drawend",function(o){const l=o.feature.getGeometry();l&&(Fn=l.getExtent(),fl({radioVal:s,style:new $t({fill:new wt({color:[250,205,145,.3]})})}),window.xmMap.removeInteraction(ln),t(Fn),dl=!0,console.log("范围:",Fn,Fn[0],Fn[1])),ln=void 0})},fl=i=>{const{radioVal:t,style:e}=i;let n=new zt({type:"area",geometry:V_([Fn[0],Fn[1]],Number(t)*1e3)});n.setStyle(e),ms=new Fe({source:new ke({features:[n]}),zIndex:4}),mt.addLayerToMap("dingwei_cricleLayer",ms),window.xmMap.addLayer(ms),Nr=!0},wC={IconDingwei:CC,addCricleLayer:fl,Radius:i=>{Nr&&(window.xmMap.removeLayer(ms),fl({radioVal:i,style:new $t({fill:new wt({color:[250,205,145,.3]})})}))}};let de=new Map;const Ee=(i,t)=>{if(!i)return console.error("图层ID不能为空");de.has(i)&&(console.warn(`图层ID ${i} 已存在,可能导致覆盖现有图层`),console.log("现有图层IDs:",Array.from(de.keys()))),de.set(i,t),console.log(de,"现有图层集合")},ps=i=>{const t=de.get(i);return t||console.warn(`图层ID ${i} 不存在`),t},Zu=i=>{if(de.has(i)){let t=ps(i);window.xmMap.removeLayer(t),de.delete(i)}else console.warn(`图层中没有当前ID${i}的图层`)},Gr=(i=!1)=>{i?(de.clear(),console.warn("清空了当前的图层集合,不会销毁地图,不会移除图层,需手动调用usexmMapProps.destroyMap方法摧毁图层")):(de.forEach(t=>{window.xmMap.removeLayer(t)}),de.clear())},Hu=(i,t)=>{de.has(i)?ps(i).setVisible(t):console.warn(`图层中没有当前ID${i}的图层`)},qu=i=>{const{layerId:t="globalLayer",zIndex:e=2,style:n}=i,s=new ke;let r;return n?r=new Fe({source:s,zIndex:e,style:n}):r=new Fe({source:s,zIndex:e}),Ee(t,r),window.xmMap.addLayer(r),t||(console.warn("生成了一个空图层放在了全局,如果需要使用,可以通过globalLayer这个id获取"),window.xmglobalLayer=r),r},Ju=(i="globalLayer")=>ps(i).getSource(),Qu=i=>{window.xmMap.getView().animate({center:i,zoom:13,duration:1e3})},td=(i,t,e)=>{const n=[i,t],s=e,r=window.xmMap.getView(),o=2e3;r.animate({center:n,zoom:s,duration:o})},vC={sky_map:eu,sky_note:nu,tdt_img:iu,tdt_cia:su,tdt_vec:ru,tdt_cva:ou,mapBase:st,option:au},mt={getMap:gy,initMapView:yy,changeBaseMap:my,closeBaseMap:py,xmMapListener:Ey,xmMask:Vy,xmVector3DLayer:h0,xmEmptyLayer:qu,getLayerSource:Ju,addLayerToMap:Ee,getLayerById:ps,removeLayerById:Zu,removeAllLayer:Gr,setVisibleLayerById:Hu,xmGeoJSONLayer:p0,xmXYZTileLayer:y0,xmWMSTileLayer:x0,xmPointStyle:cu,xmaddOverlay:C0,xmPointFeature:uu,xmPointSource:w0,xmPointLayer:v0,clusterPointSource:R0,xmClusterLayer:T0,moveToPoint:Qu,toHome:td,DrawBox:EC,postionFn:wC},RC=()=>{x.onMounted(()=>{xy()}),x.onBeforeUnmount(()=>{Gr(!0),Cy()})};return ct.addLayerToMap=Ee,ct.getLayerById=ps,ct.getLayerSource=Ju,ct.moveToPoint=Qu,ct.olMap=_y,ct.removeAllLayer=Gr,ct.removeLayerById=Zu,ct.setVisibleLayerById=Hu,ct.toHome=td,ct.useMapInfo=vC,ct.usexmMapProps=mt,ct.usexmMapWorld=RC,ct.xmEmptyLayer=qu,Object.defineProperty(ct,Symbol.toStringTag,{value:"Module"}),ct}({},Vue);