@plannco-ppe/ppe-core 0.4.1 → 0.6.0
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.
- package/dist/index.iife.js +11 -0
- package/dist/index.umd.js +1 -1
- package/package.json +14 -7
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
var Hg=Object.defineProperty;var qg=(Wt,J,ii)=>J in Wt?Hg(Wt,J,{enumerable:!0,configurable:!0,writable:!0,value:ii}):Wt[J]=ii;var fh=(Wt,J,ii)=>qg(Wt,typeof J!="symbol"?J+"":J,ii);var ppe=(function(Wt){"use strict";const J={ANIMATING:0,INTERACTING:1};function ii(s,t,e){let i,n;e=e||Ne;let r=0,o=s.length,a=!1;for(;r<o;)i=r+(o-r>>1),n=+e(s[i],t),n<0?r=i+1:(o=i,a=!n);return a?r:~r}function Ne(s,t){return s>t?1:s<t?-1:0}function gh(s,t){return s<t?1:s>t?-1:0}function Ps(s,t,e){if(s[0]<=t)return 0;const i=s.length;if(t<=s[i-1])return i-1;if(typeof e=="function"){for(let n=1;n<i;++n){const r=s[n];if(r===t)return n;if(r<t)return e(t,s[n-1],r)>0?n-1:n}return i-1}if(e>0){for(let n=1;n<i;++n)if(s[n]<t)return n-1;return i-1}if(e<0){for(let n=1;n<i;++n)if(s[n]<=t)return n;return i-1}for(let n=1;n<i;++n){if(s[n]==t)return n;if(s[n]<t)return s[n-1]-t<t-s[n]?n-1:n}return i-1}function _h(s,t,e){for(;t<e;){const i=s[t];s[t]=s[e],s[e]=i,++t,--e}}function At(s,t){const e=Array.isArray(t)?t:[t],i=e.length;for(let n=0;n<i;n++)s[s.length]=e[n]}function ne(s,t){const e=s.length;if(e!==t.length)return!1;for(let i=0;i<e;i++)if(s[i]!==t[i])return!1;return!0}const lt={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function ht(s){const t=Ft();for(let e=0,i=s.length;e<i;++e)Gi(t,s[e]);return t}function bi(s,t,e){return e?(e[0]=s[0]-t,e[1]=s[1]-t,e[2]=s[2]+t,e[3]=s[3]+t,e):[s[0]-t,s[1]-t,s[2]+t,s[3]+t]}function Oo(s,t){return t?(t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t):s.slice()}function Ge(s,t,e){let i,n;return t<s[0]?i=s[0]-t:s[2]<t?i=t-s[2]:i=0,e<s[1]?n=s[1]-e:s[3]<e?n=e-s[3]:n=0,i*i+n*n}function Di(s,t){return Ms(s,t[0],t[1])}function se(s,t){return s[0]<=t[0]&&t[2]<=s[2]&&s[1]<=t[1]&&t[3]<=s[3]}function Ms(s,t,e){return s[0]<=t&&t<=s[2]&&s[1]<=e&&e<=s[3]}function Ls(s,t){const e=s[0],i=s[1],n=s[2],r=s[3],o=t[0],a=t[1];let l=lt.UNKNOWN;return o<e?l=l|lt.LEFT:o>n&&(l=l|lt.RIGHT),a<i?l=l|lt.BELOW:a>r&&(l=l|lt.ABOVE),l===lt.UNKNOWN&&(l=lt.INTERSECTING),l}function Ft(){return[1/0,1/0,-1/0,-1/0]}function We(s,t,e,i,n){return n?(n[0]=s,n[1]=t,n[2]=e,n[3]=i,n):[s,t,e,i]}function Oi(s){return We(1/0,1/0,-1/0,-1/0,s)}function ki(s,t){const e=s[0],i=s[1];return We(e,i,e,i,t)}function As(s,t,e,i,n){const r=Oi(n);return No(r,s,t,e,i)}function Ni(s,t){return s[0]==t[0]&&s[2]==t[2]&&s[1]==t[1]&&s[3]==t[3]}function ko(s,t){return t[0]<s[0]&&(s[0]=t[0]),t[2]>s[2]&&(s[2]=t[2]),t[1]<s[1]&&(s[1]=t[1]),t[3]>s[3]&&(s[3]=t[3]),s}function Gi(s,t){t[0]<s[0]&&(s[0]=t[0]),t[0]>s[2]&&(s[2]=t[0]),t[1]<s[1]&&(s[1]=t[1]),t[1]>s[3]&&(s[3]=t[1])}function No(s,t,e,i,n){for(;e<i;e+=n)mh(s,t[e],t[e+1]);return s}function mh(s,t,e){s[0]=Math.min(s[0],t),s[1]=Math.min(s[1],e),s[2]=Math.max(s[2],t),s[3]=Math.max(s[3],e)}function Go(s,t){let e;return e=t(Fs(s)),e||(e=t(bs(s)),e)||(e=t(Os(s)),e)||(e=t(Pn(s)),e)?e:!1}function yh(s){let t=0;return ni(s)||(t=U(s)*ct(s)),t}function Fs(s){return[s[0],s[1]]}function bs(s){return[s[2],s[1]]}function Ht(s){return[(s[0]+s[2])/2,(s[1]+s[3])/2]}function Tn(s,t,e,i,n){const[r,o,a,l,h,c,u,d]=ph(s,t,e,i);return We(Math.min(r,a,h,u),Math.min(o,l,c,d),Math.max(r,a,h,u),Math.max(o,l,c,d),n)}function ph(s,t,e,i){const n=t*i[0]/2,r=t*i[1]/2,o=Math.cos(e),a=Math.sin(e),l=n*o,h=n*a,c=r*o,u=r*a,d=s[0],f=s[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(s){return s[3]-s[1]}function Ds(s,t,e){const i=e||Ft();return dt(s,t)?(s[0]>t[0]?i[0]=s[0]:i[0]=t[0],s[1]>t[1]?i[1]=s[1]:i[1]=t[1],s[2]<t[2]?i[2]=s[2]:i[2]=t[2],s[3]<t[3]?i[3]=s[3]:i[3]=t[3]):Oi(i),i}function Pn(s){return[s[0],s[3]]}function Os(s){return[s[2],s[3]]}function U(s){return s[2]-s[0]}function dt(s,t){return s[0]<=t[2]&&s[2]>=t[0]&&s[1]<=t[3]&&s[3]>=t[1]}function ni(s){return s[2]<s[0]||s[3]<s[1]}function xh(s,t){return t?(t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t):s}function Eh(s,t,e){let i=!1;const n=Ls(s,t),r=Ls(s,e);if(n===lt.INTERSECTING||r===lt.INTERSECTING)i=!0;else{const o=s[0],a=s[1],l=s[2],h=s[3],c=t[0],u=t[1],d=e[0],f=e[1],g=(f-u)/(d-c);let m,_;r<.ABOVE&&!(n<.ABOVE)&&(m=d-(f-h)/g,i=m>=o&&m<=l),!i&&r<.RIGHT&&!(n<.RIGHT)&&(_=f-(d-l)*g,i=_>=a&&_<=h),!i&&r<.BELOW&&!(n<.BELOW)&&(m=d-(f-a)/g,i=m>=o&&m<=l),!i&&r<.LEFT&&!(n<.LEFT)&&(_=f-(d-o)*g,i=_>=a&&_<=h)}return i}function Wo(s,t){const e=t.getExtent(),i=Ht(s);if(t.canWrapX()&&(i[0]<e[0]||i[0]>=e[2])){const n=U(e),o=Math.floor((i[0]-e[0])/n)*n;s[0]-=o,s[2]-=o}return s}function Ch(s,t,e){if(t.canWrapX()){const i=t.getExtent();if(!isFinite(s[0])||!isFinite(s[2]))return[[i[0],s[1],i[2],s[3]]];Wo(s,t);const n=U(i);if(U(s)>n)return[[i[0],s[1],i[2],s[3]]];if(s[0]<i[0])return[[s[0]+n,s[1],i[2],s[3]],[i[0],s[1],s[2],s[3]]];if(s[2]>i[2])return[[s[0],s[1],i[2],s[3]],[i[0],s[1],s[2]-n,s[3]]]}return[s]}function rt(s,t,e){return Math.min(Math.max(s,t),e)}function wh(s,t,e,i,n,r){const o=n-e,a=r-i;if(o!==0||a!==0){const l=((s-e)*o+(t-i)*a)/(o*o+a*a);l>1?(e=n,i=r):l>0&&(e+=o*l,i+=a*l)}return re(s,t,e,i)}function re(s,t,e,i){const n=e-s,r=i-t;return n*n+r*r}function Sh(s){const t=s.length;for(let i=0;i<t;i++){let n=i,r=Math.abs(s[i][i]);for(let a=i+1;a<t;a++){const l=Math.abs(s[a][i]);l>r&&(r=l,n=a)}if(r===0)return null;const o=s[n];s[n]=s[i],s[i]=o;for(let a=i+1;a<t;a++){const l=-s[a][i]/s[i][i];for(let h=i;h<t+1;h++)i==h?s[a][h]=0:s[a][h]+=l*s[i][h]}}const e=new Array(t);for(let i=t-1;i>=0;i--){e[i]=s[i][t]/s[i][i];for(let n=i-1;n>=0;n--)s[n][t]-=s[n][i]*e[i]}return e}function zo(s){return s*180/Math.PI}function we(s){return s*Math.PI/180}function si(s,t){const e=s%t;return e*t<0?e+t:e}function Pt(s,t,e){return s+e*(t-s)}function Mn(s,t){const e=Math.pow(10,t);return Math.round(s*e)/e}function Ln(s,t){return Math.ceil(Mn(s,t))}function ks(s,t,e){if(s>=t&&s<e)return s;const i=e-t;return((s-t)%i+i)%i+t}function Ih(s,t){return s[0]+=+t[0],s[1]+=+t[1],s}function Rh(s,t){const e=t.getRadius(),i=t.getCenter(),n=i[0],r=i[1],o=s[0],a=s[1];let l=o-n;const h=a-r;l===0&&h===0&&(l=1);const c=Math.sqrt(l*l+h*h),u=n+e*l/c,d=r+e*h/c;return[u,d]}function Ns(s,t){const e=s[0],i=s[1],n=t[0],r=t[1],o=n[0],a=n[1],l=r[0],h=r[1],c=l-o,u=h-a,d=c===0&&u===0?0:(c*(e-o)+u*(i-a))/(c*c+u*u||0);let f,g;return d<=0?(f=o,g=a):d>=1?(f=l,g=h):(f=o+d*c,g=a+d*u),[f,g]}function Et(s,t){let e=!0;for(let i=s.length-1;i>=0;--i)if(s[i]!=t[i]){e=!1;break}return e}function Gs(s,t){const e=Math.cos(t),i=Math.sin(t),n=s[0]*e-s[1]*i,r=s[1]*e+s[0]*i;return s[0]=n,s[1]=r,s}function vh(s,t){return s[0]*=t,s[1]*=t,s}function oe(s,t){const e=s[0]-t[0],i=s[1]-t[1];return e*e+i*i}function An(s,t){return Math.sqrt(oe(s,t))}function Th(s,t){return oe(s,Ns(s,t))}function jo(s,t){if(t.canWrapX()){const e=U(t.getExtent()),i=Ph(s,t,e);i&&(s[0]-=i*e)}return s}function Ph(s,t,e){const i=t.getExtent();let n=0;return t.canWrapX()&&(s[0]<i[0]||s[0]>i[2])&&(e=e||U(i),n=Math.floor((s[0]-i[0])/e)),n}const ze=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"";ze.includes("safari")&&!ze.includes("chrom")&&(ze.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(ze));const Mh=ze.includes("webkit")&&!ze.includes("edge"),Ws=ze.includes("macintosh"),Lh=typeof devicePixelRatio<"u"?devicePixelRatio:1,zs=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,Xo=typeof Image<"u"&&Image.prototype.decode,Vo=typeof createImageBitmap=="function",Bo=(function(){let s=!1;try{const t=Object.defineProperty({},"passive",{get:function(){s=!0}});window.addEventListener("_",null,t),window.removeEventListener("_",null,t)}catch{}return s})();function ut(s,t,e,i){let n;return e&&e.length?n=e.shift():zs?n=new OffscreenCanvas(s||300,t||300):n=document.createElement("canvas"),s&&(n.width=s),t&&(n.height=t),n.getContext("2d",i)}let js;function Fn(){return js||(js=ut(1,1)),js}function Xs(s){const t=s.canvas;t.width=1,t.height=1,s.clearRect(0,0,1,1)}function Ah(s){let t=s.offsetWidth;const e=getComputedStyle(s);return t+=parseInt(e.marginLeft,10)+parseInt(e.marginRight,10),t}function Fh(s){let t=s.offsetHeight;const e=getComputedStyle(s);return t+=parseInt(e.marginTop,10)+parseInt(e.marginBottom,10),t}function Yo(s,t){const e=t.parentNode;e&&e.replaceChild(s,t)}function Ko(s){for(;s.lastChild;)s.lastChild.remove()}function bh(s,t){const e=s.childNodes;for(let i=0;;++i){const n=e[i],r=t[i];if(!n&&!r)break;if(n!==r){if(!n){s.appendChild(r);continue}if(!r){s.removeChild(n),--i;continue}s.insertBefore(r,n)}}}function Uo(...s){console.warn(...s)}const Zo={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class bn{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_||Zo[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 Wi=6378137,ri=Math.PI*Wi,Dh=[-ri,-ri,ri,ri],Oh=[-180,-85,180,85],Dn=Wi*Math.log(Math.tan(Math.PI/2));class oi extends bn{constructor(t){super({code:t,units:"m",extent:Dh,global:!0,worldExtent:Oh,getPointResolution:function(e,i){return e/Math.cosh(i[1]/Wi)}})}}const Ho=[new oi("EPSG:3857"),new oi("EPSG:102100"),new oi("EPSG:102113"),new oi("EPSG:900913"),new oi("http://www.opengis.net/def/crs/EPSG/0/3857"),new oi("http://www.opengis.net/gml/srs/epsg.xml#3857")];function kh(s,t,e,i){const n=s.length;e=e>1?e:2,i=i??e,t===void 0&&(e>2?t=s.slice():t=new Array(n));for(let r=0;r<n;r+=i){t[r]=ri*s[r]/180;let o=Wi*Math.log(Math.tan(Math.PI*(+s[r+1]+90)/360));o>Dn?o=Dn:o<-Dn&&(o=-Dn),t[r+1]=o}return t}function Nh(s,t,e,i){const n=s.length;e=e>1?e:2,i=i??e,t===void 0&&(e>2?t=s.slice():t=new Array(n));for(let r=0;r<n;r+=i)t[r]=180*s[r]/ri,t[r+1]=360*Math.atan(Math.exp(s[r+1]/Wi))/Math.PI-90;return t}const Gh=6378137,qo=[-180,-90,180,90],Wh=Math.PI*Gh/180;class je extends bn{constructor(t,e){super({code:t,units:"degrees",extent:qo,axisOrientation:e,global:!0,metersPerUnit:Wh,worldExtent:qo})}}const $o=[new je("CRS:84"),new je("EPSG:4326","neu"),new je("urn:ogc:def:crs:OGC:1.3:CRS84"),new je("urn:ogc:def:crs:OGC:2:84"),new je("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new je("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new je("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Vs={};function zh(s){return Vs[s]||Vs[s.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function jh(s,t){Vs[s]=t}function ai(s){for(const t in s)delete s[t]}function Xe(s){let t;for(t in s)return!1;return!t}let li={};function zi(s,t,e){const i=s.getCode(),n=t.getCode();i in li||(li[i]={}),li[i][n]=e}function Bs(s,t){return s in li&&t in li[s]?li[s][t]:null}const On=.9996,bt=.00669438,kn=bt*bt,Nn=kn*bt,Ve=bt/(1-bt),Jo=Math.sqrt(1-bt),hi=(1-Jo)/(1+Jo),Qo=hi*hi,Ys=Qo*hi,Ks=Ys*hi,ta=Ks*hi,ea=1-bt/4-3*kn/64-5*Nn/256,Xh=3*bt/8+3*kn/32+45*Nn/1024,Vh=15*kn/256+45*Nn/1024,Bh=35*Nn/3072,Yh=3/2*hi-27/32*Ys+269/512*ta,Kh=21/16*Qo-55/32*Ks,Uh=151/96*Ys-417/128*ta,Zh=1097/512*Ks,Gn=6378137;function Hh(s,t,e){const i=s-5e5,o=(e.north?t:t-1e7)/On/(Gn*ea),a=o+Yh*Math.sin(2*o)+Kh*Math.sin(4*o)+Uh*Math.sin(6*o)+Zh*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-bt*h,m=Math.sqrt(1-bt*h),_=Gn/m,y=(1-bt)/g,p=Ve*c**2,E=p*p,x=i/(_*On),C=x*x,S=C*x,T=S*x,I=T*x,R=I*x,M=a-u/y*(C/2-T/24*(5+3*d+10*p-4*E-9*Ve))+R/720*(61+90*d+298*p+45*f-252*Ve-3*E);let k=(x-S/6*(1+2*d+p)+I/120*(5-2*p+28*d-3*E+8*Ve+24*f))/c;return k=ks(k+we(sa(e.number)),-Math.PI,Math.PI),[zo(k),zo(M)]}const ia=-80,na=84,qh=-180,$h=180;function Jh(s,t,e){s=ks(s,qh,$h),t<ia?t=ia:t>na&&(t=na);const i=we(t),n=Math.sin(i),r=Math.cos(i),o=n/r,a=o*o,l=a*a,h=we(s),c=sa(e.number),u=we(c),d=Gn/Math.sqrt(1-bt*n**2),f=Ve*r**2,g=r*ks(h-u,-Math.PI,Math.PI),m=g*g,_=m*g,y=_*g,p=y*g,E=p*g,x=Gn*(ea*i-Xh*Math.sin(2*i)+Vh*Math.sin(4*i)-Bh*Math.sin(6*i)),C=On*d*(g+_/6*(1-a+f)+p/120*(5-18*a+l+72*f-58*Ve))+5e5;let S=On*(x+d*o*(m/2+y/24*(5-a+9*f+4*f**2)+E/720*(61-58*a+l+600*f-330*Ve)));return e.north||(S+=1e7),[C,S]}function sa(s){return(s-1)*6-180+3}const Qh=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function ra(s){let t=0;for(const n of Qh){const r=s.match(n);if(r){t=parseInt(r[1]);break}}if(!t)return null;let e=0,i=!1;return t>32700&&t<32761?e=t-32700:t>32600&&t<32661&&(i=!0,e=t-32600),e?{number:e,north:i}:null}function oa(s,t){return function(e,i,n,r){const o=e.length;n=n>1?n:2,r=r??n,i||(n>2?i=e.slice():i=new Array(o));for(let a=0;a<o;a+=r){const l=e[a],h=e[a+1],c=s(l,h,t);i[a]=c[0],i[a+1]=c[1]}return i}}function tc(s){return ra(s)?new bn({code:s,units:"m"}):null}function ec(s){const t=ra(s.getCode());return t?{forward:oa(Jh,t),inverse:oa(Hh,t)}:null}const ic=63710088e-1;function aa(s,t,e){e=e||ic;const i=we(s[1]),n=we(t[1]),r=(n-i)/2,o=we(t[0]-s[0])/2,a=Math.sin(r)*Math.sin(r)+Math.sin(o)*Math.sin(o)*Math.cos(i)*Math.cos(n);return 2*e*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}const nc=[ec],sc=[tc];let Us=!0;function rc(s){Us=!1}function Zs(s,t){if(t!==void 0){for(let e=0,i=s.length;e<i;++e)t[e]=s[e];t=t}else t=s.slice();return t}function Hs(s){jh(s.getCode(),s),zi(s,s,Zs)}function oc(s){s.forEach(Hs)}function ot(s){if(typeof s!="string")return s;const t=zh(s);if(t)return t;for(const e of sc){const i=e(s);if(i)return i}return null}function la(s,t,e,i){s=ot(s);let n;const r=s.getPointResolutionFunc();if(r)n=r(t,e);else{const o=s.getUnits();if(o=="degrees"&&!i||i=="degrees")n=t;else{const a=Js(s,ot("EPSG:4326"));if(!a&&o!=="degrees")n=t*s.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=aa(h.slice(0,2),h.slice(2,4)),u=aa(h.slice(4,6),h.slice(6,8));n=(c+u)/2}const l=s.getMetersPerUnit();l!==void 0&&(n/=l)}}return n}function ha(s){oc(s),s.forEach(function(t){s.forEach(function(e){t!==e&&zi(t,e,Zs)})})}function ac(s,t,e,i){s.forEach(function(n){t.forEach(function(r){zi(n,r,e),zi(r,n,i)})})}function qs(s,t){return s?typeof s=="string"?ot(s):s:ot(t)}function lc(s){return(function(t,e,i,n){const r=t.length;i=i!==void 0?i:2,n=n??i,e=e!==void 0?e:new Array(r);for(let o=0;o<r;o+=n){const a=s(t.slice(o,o+i)),l=a.length;for(let h=0,c=n;h<c;++h)e[o+h]=h>=l?t[o+h]:a[h]}return e})}function $s(s,t){if(s===t)return!0;const e=s.getUnits()===t.getUnits();return(s.getCode()===t.getCode()||Js(s,t)===Zs)&&e}function Js(s,t){const e=s.getCode(),i=t.getCode();let n=Bs(e,i);if(n)return n;let r=null,o=null;for(const l of nc)r||(r=l(s)),o||(o=l(t));if(!r&&!o)return null;const a="EPSG:4326";if(o)if(r)n=Qs(r.inverse,o.forward);else{const l=Bs(e,a);l&&(n=Qs(l,o.forward))}else{const l=Bs(a,i);l&&(n=Qs(r.inverse,l))}return n&&(Hs(s),Hs(t),zi(s,t,n)),n}function Qs(s,t){return function(e,i,n,r){return i=s(e,i,n,r),t(i,i,n,r)}}function ji(s,t){const e=ot(s),i=ot(t);return Js(e,i)}function ca(s,t,e){const i=ji(t,e);if(!i){const n=ot(t).getCode(),r=ot(e).getCode();throw new Error(`No transform available between ${n} and ${r}`)}return i(s,void 0,s.length)}function Se(s,t){return s}function Z(s,t){return Us&&!Et(s,[0,0])&&s[0]>=-180&&s[0]<=180&&s[1]>=-90&&s[1]<=90&&(Us=!1,Uo("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),s}function Wn(s,t){return s}function Ie(s,t){return s}function hc(){ha(Ho),ha($o),ac($o,Ho,kh,Nh)}hc();const Dt={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"},P={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4},tr=[NaN,NaN,NaN,0];let er;function cc(){return er||(er=ut(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),er}const uc=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,dc=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,fc=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,gc=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function zn(s,t){return s.endsWith("%")?Number(s.substring(0,s.length-1))/t:Number(s)}function Xi(s){throw new Error('failed to parse "'+s+'" as color')}function ua(s){if(s.toLowerCase().startsWith("rgb")){const r=s.match(dc)||s.match(uc)||s.match(fc);if(r){const o=r[4],a=100/255;return[rt(zn(r[1],a)+.5|0,0,255),rt(zn(r[2],a)+.5|0,0,255),rt(zn(r[3],a)+.5|0,0,255),o!==void 0?rt(zn(o,100),0,1):1]}Xi(s)}if(s.startsWith("#")){if(gc.test(s)){const r=s.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}Xi(s)}const t=cc();t.fillStyle="#abcdef";let e=t.fillStyle;t.fillStyle=s,t.fillStyle===e&&(t.fillStyle="#fedcba",e=t.fillStyle,t.fillStyle=s,t.fillStyle===e&&Xi(s));const i=t.fillStyle;if(i.startsWith("#")||i.startsWith("rgba"))return ua(i);t.clearRect(0,0,1,1),t.fillRect(0,0,1,1);const n=Array.from(t.getImageData(0,0,1,1).data);return n[3]=Mn(n[3]/255,3),n}function _c(s){return typeof s=="string"?s:lr(s)}const mc=1024,Vi={};let ir=0;function yc(s){if(s.length===4)return s;const t=s.slice();return t[3]=1,t}function nr(s){return s>.0031308?Math.pow(s,.4166666666666667)*269.025-14.025:s*3294.6}function sr(s){return s>.2068965?Math.pow(s,3):(s-.13793103448275862)*.12841854934601665}function rr(s){return s>10.314724?Math.pow((s+14.025)/269.025,2.4):s/3294.6}function or(s){return s>.0088564?Math.pow(s,.3333333333333333):s/.12841854934601665+.13793103448275862}function da(s){const t=rr(s[0]),e=rr(s[1]),i=rr(s[2]),n=or(t*.222488403+e*.716873169+i*.06060791),r=500*(or(t*.452247074+e*.399439023+i*.148375274)-n),o=200*(n-or(t*.016863605+e*.117638439+i*.865350722)),a=Math.atan2(o,r)*(180/Math.PI);return[116*n-16,Math.sqrt(r*r+o*o),a<0?a+360:a,s[3]]}function pc(s){const t=(s[0]+16)/116,e=s[1],i=s[2]*Math.PI/180,n=sr(t),r=sr(t+e/500*Math.cos(i)),o=sr(t-e/200*Math.sin(i)),a=nr(r*3.021973625-n*1.617392459-o*.404875592),l=nr(r*-.943766287+n*1.916279586+o*.027607165),h=nr(r*.069407491-n*.22898585+o*1.159737864);return[rt(a+.5|0,0,255),rt(l+.5|0,0,255),rt(h+.5|0,0,255),s[3]]}function ar(s){if(s==="none")return tr;if(Vi.hasOwnProperty(s))return Vi[s];if(ir>=mc){let e=0;for(const i in Vi)(e++&3)===0&&(delete Vi[i],--ir)}const t=ua(s);t.length!==4&&Xi(s);for(const e of t)isNaN(e)&&Xi(s);return Vi[s]=t,++ir,t}function ci(s){return Array.isArray(s)?s:ar(s)}function lr(s){let t=s[0];t!=(t|0)&&(t=t+.5|0);let e=s[1];e!=(e|0)&&(e=e+.5|0);let i=s[2];i!=(i|0)&&(i=i+.5|0);const n=s[3]===void 0?1:Math.round(s[3]*1e3)/1e3;return"rgba("+t+","+e+","+i+","+n+")"}const D={CHANGE:"change",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",KEYDOWN:"keydown",KEYPRESS:"keypress",TOUCHMOVE:"touchmove",WHEEL:"wheel"};class hr{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function zt(){return!0}function Be(){return!1}function Bi(){}function fa(s){let t,e,i;return function(){const n=Array.prototype.slice.call(arguments);return(!e||this!==i||!ne(n,e))&&(i=this,e=n,t=s.apply(this,arguments)),t}}function ga(s){function t(){let e;try{e=s()}catch(i){return Promise.reject(i)}return e instanceof Promise?e:Promise.resolve(e)}return t()}class St{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}class jn extends hr{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),n=i[t]||(i[t]=[]);n.includes(e)||n.push(e)}dispatchEvent(t){const e=typeof t=="string",i=e?t:t.type,n=this.listeners_&&this.listeners_[i];if(!n)return;const r=e?new St(t):t;r.target||(r.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});i in o||(o[i]=0,a[i]=0),++o[i];let l;for(let h=0,c=n.length;h<c;++h)if("handleEvent"in n[h]?l=n[h].handleEvent(r):l=n[h].call(this,r),l===!1||r.propagationStopped){l=!1;break}if(--o[i]===0){let h=a[i];for(delete a[i];h--;)this.removeEventListener(i,Bi);delete o[i]}return l}disposeInternal(){this.listeners_&&ai(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 i=this.listeners_[t];if(!i)return;const n=i.indexOf(e);n!==-1&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=Bi,++this.pendingRemovals_[t]):(i.splice(n,1),i.length===0&&delete this.listeners_[t]))}}function W(s,t,e,i,n){if(n){const o=e;e=function(a){return s.removeEventListener(t,e),o.call(i??this,a)}}else i&&i!==s&&(e=e.bind(i));const r={target:s,type:t,listener:e};return s.addEventListener(t,e),r}function _a(s,t,e,i){return W(s,t,e,i,!0)}function $(s){s&&s.target&&(s.target.removeEventListener(s.type,s.listener),ai(s))}class cr extends jn{constructor(t,e,i,n){super(),this.extent=t,this.pixelRatio_=i,this.resolution=e,this.state=typeof n=="function"?P.IDLE:n,this.image_=null,this.loader=typeof n=="function"?n:null}changed(){this.dispatchEvent(D.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==P.IDLE&&this.loader){this.state=P.LOADING,this.changed();const t=this.getResolution(),e=Array.isArray(t)?t[0]:t;ga(()=>this.loader(this.getExtent(),e,this.getPixelRatio())).then(i=>{"image"in i&&(this.image_=i.image),"extent"in i&&(this.extent=i.extent),"resolution"in i&&(this.resolution=i.resolution),"pixelRatio"in i&&(this.pixelRatio_=i.pixelRatio),(i instanceof HTMLImageElement||Vo&&i instanceof ImageBitmap||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement)&&(this.image_=i),this.state=P.LOADED}).catch(i=>{this.state=P.ERROR,console.error(i)}).finally(()=>this.changed())}}setImage(t){this.image_=t}setResolution(t){this.resolution=t}}function xc(s,t){return new Promise((e,i)=>{function n(){o(),e(s)}function r(){o(),i(new Error("Image load error"))}function o(){s.removeEventListener("load",n),s.removeEventListener("error",r)}s.addEventListener("load",n),s.addEventListener("error",r)})}function ma(s,t){return t&&(s.src=t),s.src&&Xo?new Promise((e,i)=>s.decode().then(()=>e(s)).catch(n=>s.complete&&s.width?e(s):i(n))):xc(s)}function ya(s,t){return t&&(s.src=t),s.src&&Xo&&Vo?s.decode().then(()=>createImageBitmap(s)).catch(e=>{if(s.complete&&s.width)return s;throw e}):ma(s)}class Ec{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const i=this.cache_[e];(t++&3)===0&&!i.hasListener()&&(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e,i){const n=ur(t,e,i);return n in this.cache_?this.cache_[n]:null}getPattern(t,e,i){const n=ur(t,e,i);return n in this.patternCache_?this.patternCache_[n]:null}set(t,e,i,n,r){const o=ur(t,e,i),a=o in this.cache_;this.cache_[o]=n,r&&(n.getImageState()===P.IDLE&&n.load(),n.getImageState()===P.LOADING?n.ready().then(()=>{this.patternCache_[o]=Fn().createPattern(n.getImage(1),"repeat")}):this.patternCache_[o]=Fn().createPattern(n.getImage(1),"repeat")),a||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function ur(s,t,e){const i=e?ci(e):"null";return t+":"+s+":"+i}const Ot=new Ec;let Yi=null;class pa extends jn{constructor(t,e,i,n,r){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i,this.canvas_={},this.color_=r,this.imageState_=n===void 0?P.IDLE:n,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_===P.LOADED){Yi||(Yi=ut(1,1,void 0,{willReadFrequently:!0})),Yi.drawImage(this.image_,0,0);try{Yi.getImageData(0,0,1,1),this.tainted_=!1}catch{Yi=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(D.CHANGE)}handleImageError_(){this.imageState_=P.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=P.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],i=ut(t,e);i.fillRect(0,0,t,e),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===P.IDLE){this.image_||this.initializeImage_(),this.imageState_=P.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&ma(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_!==P.LOADED)return;const e=this.image_,i=ut(Math.ceil(e.width*t),Math.ceil(e.height*t)),n=i.canvas;i.scale(t,t),i.drawImage(e,0,0),i.globalCompositeOperation="multiply",i.fillStyle=_c(this.color_),i.fillRect(0,0,n.width/t,n.height/t),i.globalCompositeOperation="destination-in",i.drawImage(e,0,0),this.canvas_[t]=n}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(this.imageState_===P.LOADED||this.imageState_===P.ERROR)t();else{const e=()=>{(this.imageState_===P.LOADED||this.imageState_===P.ERROR)&&(this.removeEventListener(D.CHANGE,e),t())};this.addEventListener(D.CHANGE,e)}})),this.ready_}}function dr(s,t,e,i,n,r){let o=t===void 0?void 0:Ot.get(t,e,n);return o||(o=new pa(s,s&&"src"in s?s.src||void 0:t,e,i,n),Ot.set(t,e,n,o,r)),r&&o&&!Ot.getPattern(t,e,n)&&Ot.set(t,e,n,o,r),o}function qt(s){return s?Array.isArray(s)?lr(s):typeof s=="object"&&"src"in s?Cc(s):s:null}function Cc(s){if(!s.offset||!s.size)return Ot.getPattern(s.src,"anonymous",s.color);const t=s.src+":"+s.offset,e=Ot.getPattern(t,void 0,s.color);if(e)return e;const i=Ot.get(s.src,"anonymous",null);if(i.getImageState()!==P.LOADED)return null;const n=ut(s.size[0],s.size[1]);return n.drawImage(i.getImage(1),s.offset[0],s.offset[1],s.size[0],s.size[1],0,0,s.size[0],s.size[1]),dr(n.canvas,t,void 0,P.LOADED,s.color,!0),Ot.getPattern(t,void 0,s.color)}function Re(s,t,e,i,n){n=n!==void 0?n:[];let r=0;for(let o=t;o<e;o+=i)n[r++]=s.slice(o,o+i);return n.length=r,n}function Ki(s,t,e,i,n){n=n!==void 0?n:[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];n[r++]=Re(s,t,l,i,n[r]),t=l}return n.length=r,n}function fr(s,t,e,i,n){n=n!==void 0?n:[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];n[r++]=l.length===1&&l[0]===t?[]:Ki(s,t,l,i,n[r]),t=l[l.length-1]}return n.length=r,n}class xa{drawCustom(t,e,i,n,r){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,i){}drawFeature(t,e,i){}drawGeometryCollection(t,e,i){}drawLineString(t,e,i){}drawMultiLineString(t,e,i){}drawMultiPoint(t,e,i){}drawMultiPolygon(t,e,i){}drawPoint(t,e,i){}drawPolygon(t,e,i){}drawText(t,e,i){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}}const ui={PROPERTYCHANGE:"propertychange"};class Ui extends jn{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(D.CHANGE)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=W(this,t[r],e);return n}return W(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const n=t.length;i=new Array(n);for(let r=0;r<n;++r)i[r]=_a(this,t[r],e)}else i=_a(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)wc(i);else if(Array.isArray(t))for(let n=0,r=t.length;n<r;++n)this.removeEventListener(t[n],e);else this.removeEventListener(t,e)}}Ui.prototype.on,Ui.prototype.once,Ui.prototype.un;function wc(s){if(Array.isArray(s))for(let t=0,e=s.length;t<e;++t)$(s[t]);else $(s)}function O(){throw new Error("Unimplemented abstract method.")}let Sc=0;function V(s){return s.ol_uid||(s.ol_uid=String(++Sc))}class Ea extends St{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}class jt extends Ui{constructor(t){super(),this.on,this.once,this.un,V(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 i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new Ea(i,t,e)),i=ui.PROPERTYCHANGE,this.hasListener(i)&&this.dispatchEvent(new Ea(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const n=this.values_||(this.values_={});if(i)n[t]=e;else{const r=n[t];n[t]=e,r!==e&&this.notify(t,r)}}setProperties(t,e){for(const i in t)this.set(i,t[i],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const i=this.values_[t];delete this.values_[t],Xe(this.values_)&&(this.values_=null),e||this.notify(t,i)}}}const Xn="ol-hidden",Ic="ol-selectable",Vn="ol-unselectable",gr="ol-control",Ca="ol-collapsed",Rc=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"),wa=["style","variant","weight","size","lineHeight","family"],_r={normal:400,bold:700},mr=function(s){const t=s.match(Rc);if(!t)return null;const e={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let i=0,n=wa.length;i<n;++i){const r=t[i+1];r!==void 0&&(e[wa[i]]=typeof r=="string"?r.trim():r)}return isNaN(Number(e.weight))&&e.weight in _r&&(e.weight=_r[e.weight]),e.families=e.family.split(/,\s?/).map(i=>i.trim().replace(/^['"]|['"]$/g,"")),e},Sa="10px sans-serif",It="#000",di="round",ae=[],le=0,fi="round",Zi=10,Hi="#000",qi="center",Bn="middle",Ye=[0,0,0,0],$i=1,gi=new jt;let Ji=null,Ia;const yr={},vc=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function Tc(s,t,e){return`${s} ${t} 16px "${e}"`}const Pc=(function(){let t,e;async function i(r){await e.ready;const o=await e.load(r);if(o.length===0)return!1;const a=mr(r),l=a.families[0].toLowerCase(),h=a.weight;return o.some(c=>{const u=c.family.replace(/^['"]|['"]$/g,"").toLowerCase(),d=_r[c.weight]||c.weight;return u===l&&c.style===a.style&&d==h})}async function n(){await e.ready;let r=!0;const o=gi.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 i(h)?(ai(yr),gi.set(h,100)):(c+=10,gi.set(h,c,!0),c<100&&(r=!1)))}t=void 0,r||(t=setTimeout(n,100))}return async function(r){e||(e=zs?self.fonts:document.fonts);const o=mr(r);if(!o)return;const a=o.families;let l=!1;for(const h of a){if(vc.has(h))continue;const c=Tc(o.style,o.weight,h);gi.get(c)===void 0&&(gi.set(c,0,!0),l=!0)}l&&(clearTimeout(t),t=setTimeout(n,100))}})(),Mc=(function(){let s;return function(t){let e=yr[t];if(e==null){if(zs){const i=mr(t),n=Ra(t,"Žg");e=(isNaN(Number(i.lineHeight))?1.2:Number(i.lineHeight))*(n.actualBoundingBoxAscent+n.actualBoundingBoxDescent)}else s||(s=document.createElement("div"),s.innerHTML="M",s.style.minHeight="0",s.style.maxHeight="none",s.style.height="auto",s.style.padding="0",s.style.border="none",s.style.position="absolute",s.style.display="block",s.style.left="-99999px"),s.style.font=t,document.body.appendChild(s),e=s.offsetHeight,document.body.removeChild(s);yr[t]=e}return e}})();function Ra(s,t){return Ji||(Ji=ut(1,1)),s!=Ia&&(Ji.font=s,Ia=Ji.font),Ji.measureText(t)}function va(s,t){return Ra(s,t).width}function Ta(s,t,e){if(t in e)return e[t];const i=t.split(`
|
|
2
|
+
`).reduce((n,r)=>Math.max(n,va(s,r)),0);return e[t]=i,i}function Lc(s,t){const e=[],i=[],n=[];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),n.push(o),o=0,a+=l,l=0;continue}const d=t[h+1]||s.font,f=va(d,u);e.push(f),o+=f;const g=Mc(d);i.push(g),l=Math.max(l,g)}return{width:r,height:a,widths:e,heights:i,lineWidths:n}}function Ac(s,t,e,i,n,r,o,a,l,h,c){s.save(),e!==1&&(s.globalAlpha===void 0?s.globalAlpha=u=>u.globalAlpha*=e:s.globalAlpha*=e),t&&s.transform.apply(s,t),i.contextInstructions?(s.translate(l,h),s.scale(c[0],c[1]),Fc(i,s)):c[0]<0||c[1]<0?(s.translate(l,h),s.scale(c[0],c[1]),s.drawImage(i,n,r,o,a,0,0,o,a)):s.drawImage(i,n,r,o,a,l,h,o*c[0],a*c[1]),s.restore()}function Fc(s,t){const e=s.contextInstructions;for(let i=0,n=e.length;i<n;i+=2)Array.isArray(e[i+1])?t[e[i]].apply(t,e[i+1]):t[e[i]]=e[i+1]}const L={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},Yn=[L.FILL],ve=[L.STROKE],Ke=[L.BEGIN_PATH],Pa=[L.CLOSE_PATH];class Qi extends xa{constructor(t,e,i,n){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=n,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){const e=this.pixelRatio;return e==1?t:t.map(function(i){return i*e})}appendFlatPointCoordinates(t,e){const i=this.getBufferedMaxExtent(),n=this.tmpCoordinate_,r=this.coordinates;let o=r.length;for(let a=0,l=t.length;a<l;a+=e)n[0]=t[a],n[1]=t[a+1],Di(i,n)&&(r[o++]=n[0],r[o++]=n[1]);return o}appendFlatLineCoordinates(t,e,i,n,r,o){const a=this.coordinates;let l=a.length;const h=this.getBufferedMaxExtent();o&&(e+=n);let c=t[e],u=t[e+1];const d=this.tmpCoordinate_;let f=!0,g,m,_;for(g=e+n;g<i;g+=n)d[0]=t[g],d[1]=t[g+1],_=Ls(h,d),_!==m?(f&&(a[l++]=c,a[l++]=u,f=!1),a[l++]=d[0],a[l++]=d[1]):_===lt.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+n)&&(a[l++]=c,a[l++]=u),l}drawCustomCoordinates_(t,e,i,n,r){for(let o=0,a=i.length;o<a;++o){const l=i[o],h=this.appendFlatLineCoordinates(t,e,l,n,!1,!1);r.push(h),e=l}return e}drawCustom(t,e,i,n,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 m=0,_=g.length;m<_;++m){const y=[];f=this.drawCustomCoordinates_(h,f,g[m],a,y),d.push(y)}this.instructions.push([L.CUSTOM,l,d,t,i,fr,r]),this.hitDetectionInstructions.push([L.CUSTOM,l,d,t,n||i,fr,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([L.CUSTOM,l,u,t,i,Ki,r]),this.hitDetectionInstructions.push([L.CUSTOM,l,u,t,n||i,Ki,r]);break;case"LineString":case"Circle":h=t.getFlatCoordinates(),c=this.appendFlatLineCoordinates(h,0,h.length,a,!1,!1),this.instructions.push([L.CUSTOM,l,c,t,i,Re,r]),this.hitDetectionInstructions.push([L.CUSTOM,l,c,t,n||i,Re,r]);break;case"MultiPoint":h=t.getFlatCoordinates(),c=this.appendFlatPointCoordinates(h,a),c>l&&(this.instructions.push([L.CUSTOM,l,c,t,i,Re,r]),this.hitDetectionInstructions.push([L.CUSTOM,l,c,t,n||i,Re,r]));break;case"Point":h=t.getFlatCoordinates(),this.coordinates.push(h[0],h[1]),c=this.coordinates.length,this.instructions.push([L.CUSTOM,l,c,t,i,void 0,r]),this.hitDetectionInstructions.push([L.CUSTOM,l,c,t,n||i,void 0,r]);break}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[L.BEGIN_GEOMETRY,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[L.BEGIN_GEOMETRY,e,0,t,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;t.reverse();let e;const i=t.length;let n,r,o=-1;for(e=0;e<i;++e)n=t[e],r=n[0],r==L.END_GEOMETRY?o=e:r==L.BEGIN_GEOMETRY&&(n[2]=e,_h(this.hitDetectionInstructions,o,e),o=-1)}fillStyleToState(t,e={}){if(t){const i=t.getColor();e.fillPatternScale=i&&typeof i=="object"&&"src"in i?this.pixelRatio:1,e.fillStyle=qt(i||It)}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){const i=t.getColor();e.strokeStyle=qt(i||Hi);const n=t.getLineCap();e.lineCap=n!==void 0?n:di;const r=t.getLineDash();e.lineDash=r?r.slice():ae;const o=t.getLineDashOffset();e.lineDashOffset=o||le;const a=t.getLineJoin();e.lineJoin=a!==void 0?a:fi;const l=t.getWidth();e.lineWidth=l!==void 0?l:$i;const h=t.getMiterLimit();e.miterLimit=h!==void 0?h:Zi,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 i=this.state;this.fillStyleToState(t,i),this.strokeStyleToState(e,i)}createFill(t){const e=t.fillStyle,i=[L.SET_FILL_STYLE,e];return typeof e!="string"&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[L.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 i=t.fillStyle;(typeof i!="string"||t.currentFillStyle!=i)&&(this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,n=t.lineCap,r=t.lineDash,o=t.lineDashOffset,a=t.lineJoin,l=t.lineWidth,h=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=n||r!=t.currentLineDash&&!ne(t.currentLineDash,r)||t.currentLineDashOffset!=o||t.currentLineJoin!=a||t.currentLineWidth!=l||t.currentMiterLimit!=h)&&(e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,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=[L.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Oo(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;bi(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class bc extends Qi{constructor(t,e,i,n){super(t,e,i,n),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e,i){if(!this.image_||this.maxExtent&&!Di(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),r=t.getStride(),o=this.coordinates.length,a=this.appendFlatPointCoordinates(n,r);this.instructions.push([L.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([L.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,i){if(!this.image_)return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),r=[];for(let l=0,h=n.length;l<h;l+=t.getStride())(!this.maxExtent||Di(this.maxExtent,n.slice(l,l+2)))&&r.push(n[l],n[l+1]);const o=this.coordinates.length,a=this.appendFlatPointCoordinates(r,2);this.instructions.push([L.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([L.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 i=t.getAnchor(),n=t.getSize(),r=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=n[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_=n[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}class Dc extends Qi{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinates_(t,e,i,n){const r=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,i,n,!1,!1),a=[L.MOVE_TO_LINE_TO,r,o];return this.instructions.push(a),this.hitDetectionInstructions.push(a),i}drawLineString(t,e,i){const n=this.state,r=n.strokeStyle,o=n.lineWidth;if(r===void 0||o===void 0)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([L.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,ae,le],Ke);const a=t.getFlatCoordinates(),l=t.getStride();this.drawFlatCoordinates_(a,0,a.length,l),this.hitDetectionInstructions.push(ve),this.endGeometry(e)}drawMultiLineString(t,e,i){const n=this.state,r=n.strokeStyle,o=n.lineWidth;if(r===void 0||o===void 0)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([L.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,ae,le],Ke);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(ve),this.endGeometry(e)}finish(){const t=this.state;return t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&this.instructions.push(ve),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(ve),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(Ke)}}function Kn(s,t,e,i,n,r,o){const a=(e-t)/i;if(a<3){for(;t<e;t+=i)r[o++]=s[t],r[o++]=s[t+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const h=[t,e-i];let c=0;for(;h.length>0;){const u=h.pop(),d=h.pop();let f=0;const g=s[d],m=s[d+1],_=s[u],y=s[u+1];for(let p=d+i;p<u;p+=i){const E=s[p],x=s[p+1],C=wh(E,x,g,m,_,y);C>f&&(c=p,f=C)}f>n&&(l[(c-t)/i]=1,d+i<c&&h.push(d,c),c+i<u&&h.push(c,u))}for(let u=0;u<a;++u)l[u]&&(r[o++]=s[t+u*i],r[o++]=s[t+u*i+1]);return o}function Ma(s,t,e,i,n,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l];o=Kn(s,t,c,i,n,r,o),a.push(o),t=c}return o}function Ue(s,t){return t*Math.round(s/t)}function Oc(s,t,e,i,n,r,o){if(t==e)return o;let a=Ue(s[t],n),l=Ue(s[t+1],n);t+=i,r[o++]=a,r[o++]=l;let h,c;do if(h=Ue(s[t],n),c=Ue(s[t+1],n),t+=i,t==e)return r[o++]=h,r[o++]=c,o;while(h==a&&c==l);for(;t<e;){const u=Ue(s[t],n),d=Ue(s[t+1],n);if(t+=i,u==h&&d==c)continue;const f=h-a,g=c-l,m=u-a,_=d-l;if(f*_==g*m&&(f<0&&m<f||f==m||f>0&&m>f)&&(g<0&&_<g||g==_||g>0&&_>g)){h=u,c=d;continue}r[o++]=h,r[o++]=c,a=h,l=c,h=u,c=d}return r[o++]=h,r[o++]=c,o}function pr(s,t,e,i,n,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l];o=Oc(s,t,c,i,n,r,o),a.push(o),t=c}return o}function kc(s,t,e,i,n,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l],u=[];o=pr(s,t,c,i,n,r,o,u),a.push(u),t=c[c.length-1]}return o}class La extends Qi{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinatess_(t,e,i,n){const r=this.state,o=r.fillStyle!==void 0,a=r.strokeStyle!==void 0,l=i.length;this.instructions.push(Ke),this.hitDetectionInstructions.push(Ke);for(let h=0;h<l;++h){const c=i[h],u=this.coordinates.length,d=this.appendFlatLineCoordinates(t,e,c,n,!0,!a),f=[L.MOVE_TO_LINE_TO,u,d];this.instructions.push(f),this.hitDetectionInstructions.push(f),a&&(this.instructions.push(Pa),this.hitDetectionInstructions.push(Pa)),e=c}return o&&(this.instructions.push(Yn),this.hitDetectionInstructions.push(Yn)),a&&(this.instructions.push(ve),this.hitDetectionInstructions.push(ve)),e}drawCircle(t,e,i){const n=this.state,r=n.fillStyle,o=n.strokeStyle;if(r===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),n.fillStyle!==void 0&&this.hitDetectionInstructions.push([L.SET_FILL_STYLE,It]),n.strokeStyle!==void 0&&this.hitDetectionInstructions.push([L.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,ae,le]);const a=t.getFlatCoordinates(),l=t.getStride(),h=this.coordinates.length;this.appendFlatLineCoordinates(a,0,a.length,l,!1,!1);const c=[L.CIRCLE,h];this.instructions.push(Ke,c),this.hitDetectionInstructions.push(Ke,c),n.fillStyle!==void 0&&(this.instructions.push(Yn),this.hitDetectionInstructions.push(Yn)),n.strokeStyle!==void 0&&(this.instructions.push(ve),this.hitDetectionInstructions.push(ve)),this.endGeometry(e)}drawPolygon(t,e,i){const n=this.state,r=n.fillStyle,o=n.strokeStyle;if(r===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),n.fillStyle!==void 0&&this.hitDetectionInstructions.push([L.SET_FILL_STYLE,It]),n.strokeStyle!==void 0&&this.hitDetectionInstructions.push([L.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,ae,le]);const a=t.getEnds(),l=t.getOrientedFlatCoordinates(),h=t.getStride();this.drawFlatCoordinatess_(l,0,a,h),this.endGeometry(e)}drawMultiPolygon(t,e,i){const n=this.state,r=n.fillStyle,o=n.strokeStyle;if(r===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),n.fillStyle!==void 0&&this.hitDetectionInstructions.push([L.SET_FILL_STYLE,It]),n.strokeStyle!==void 0&&this.hitDetectionInstructions.push([L.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,ae,le]);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 i=0,n=e.length;i<n;++i)e[i]=Ue(e[i],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;this.updateFillStyle(t,this.createFill),this.updateStrokeStyle(t,this.applyStroke)}}function Nc(s,t,e,i,n){const r=[];let o=e,a=0,l=t.slice(e,2);for(;a<s&&o+n<i;){const[h,c]=l.slice(-2),u=t[o+n],d=t[o+n+1],f=Math.sqrt((u-h)*(u-h)+(d-c)*(d-c));if(a+=f,a>=s){const g=(s-a+f)/f,m=Pt(h,u,g),_=Pt(c,d,g);l.push(m,_),r.push(l),l=[m,_],a==s&&(o+=n),a=0}else if(a<s)l.push(t[o+n],t[o+n+1]),o+=n;else{const g=f-a,m=Pt(h,u,g/f),_=Pt(c,d,g/f);l.push(m,_),r.push(l),l=[m,_],a=0,o+=n}}return a>0&&r.push(l),r}function Gc(s,t,e,i,n){let r=e,o=e,a=0,l=0,h=e,c,u,d,f,g,m,_,y,p,E;for(u=e;u<i;u+=n){const x=t[u],C=t[u+1];g!==void 0&&(p=x-g,E=C-m,f=Math.sqrt(p*p+E*E),_!==void 0&&(l+=d,c=Math.acos((_*p+y*E)/(d*f)),c>s&&(l>a&&(a=l,r=h,o=u),l=0,h=u-n)),d=f,_=p,y=E),g=x,m=C}return l+=f,l>a?[h,u]:[r,o]}const Un={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class Wc extends Qi{constructor(t,e,i,n){super(t,e,i,n),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[It]={fillStyle:It},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,i){const n=this.textFillState_,r=this.textStrokeState_,o=this.textState_;if(this.text_===""||!o||!n&&!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(!dt(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 _=t.getEndss();d=[];for(let y=0,p=_.length;y<p;++y)d.push(_[y][0])}this.beginGeometry(t,e,i);const f=o.repeat,g=f?void 0:o.textAlign;let m=0;for(let _=0,y=d.length;_<y;++_){let p;f?p=Nc(f*this.resolution,c,m,d[_],u):p=[c.slice(m,d[_])];for(let E=0,x=p.length;E<x;++E){const C=p[E];let S=0,T=C.length;if(g==null){const R=Gc(o.maxAngle,C,0,C.length,2);S=R[0],T=R[1]}for(let R=S;R<T;R+=u)a.push(C[R],C[R+1]);const I=a.length;m=d[_],this.drawChars_(l,I),l=I}}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 x=t.getFlatInteriorPoints();c=[];for(let C=0,S=x.length;C<S;C+=3)o.overflow||d.push(x[C+2]/this.resolution),c.push(x[C],x[C+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 x=l/2;d=d.filter((C,S)=>{const T=a[(x+S)*2]===c[S*u]&&a[(x+S)*2+1]===c[S*u+1];return T||--x,T})}this.saveTextStates_();const g=o.backgroundFill?this.createFill(this.fillStyleToState(o.backgroundFill)):null,m=o.backgroundStroke?this.createStroke(this.strokeStyleToState(o.backgroundStroke)):null;this.beginGeometry(t,e,i);let _=o.padding;if(_!=Ye&&(o.scale[0]<0||o.scale[1]<0)){let x=o.padding[0],C=o.padding[1],S=o.padding[2],T=o.padding[3];o.scale[0]<0&&(C=-C,T=-T),o.scale[1]<0&&(x=-x,S=-S),_=[x,C,S,T]}const y=this.pixelRatio;this.instructions.push([L.DRAW_IMAGE,l,f,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,_==Ye?Ye:_.map(function(x){return x*y}),g,m,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]);const p=1/y,E=g?g.slice(0):null;E&&(E[1]=It),this.hitDetectionInstructions.push([L.DRAW_IMAGE,l,f,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[p,p],NaN,this.declutterMode_,this.declutterImageWithText_,_,E,m,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?It:this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]),this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,n=this.strokeKey_;t&&(n in this.strokeStates||(this.strokeStates[n]={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||qi,justify:e.justify,textBaseline:e.textBaseline||Bn,scale:e.scale});const o=this.fillKey_;i&&(o in this.fillStates||(this.fillStates[o]={fillStyle:i.fillStyle}))}drawChars_(t,e){const i=this.textStrokeState_,n=this.textState_,r=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();const l=this.pixelRatio,h=Un[n.textBaseline],c=this.textOffsetY_*l,u=this.text_,d=i?i.lineWidth*Math.abs(n.scale[0])/2:0;this.instructions.push([L.DRAW_CHARS,t,e,h,n.overflow,a,n.maxAngle,l,c,r,d*l,u,o,1,this.declutterMode_,this.textKeepUpright_]),this.hitDetectionInstructions.push([L.DRAW_CHARS,t,e,h,n.overflow,a&&It,n.maxAngle,l,c,r,d*l,u,o,1/l,this.declutterMode_,this.textKeepUpright_])}setTextStyle(t,e){let i,n,r;if(!t)this.text_="";else{const o=t.getFill();o?(n=this.textFillState_,n||(n={},this.textFillState_=n),n.fillStyle=qt(o.getColor()||It)):(n=null,this.textFillState_=n);const a=t.getStroke();if(!a)r=null,this.textStrokeState_=r;else{r=this.textStrokeState_,r||(r={},this.textStrokeState_=r);const m=a.getLineDash(),_=a.getLineDashOffset(),y=a.getWidth(),p=a.getMiterLimit();r.lineCap=a.getLineCap()||di,r.lineDash=m?m.slice():ae,r.lineDashOffset=_===void 0?le:_,r.lineJoin=a.getLineJoin()||fi,r.lineWidth=y===void 0?$i:y,r.miterLimit=p===void 0?Zi:p,r.strokeStyle=qt(a.getColor()||Hi)}i=this.textState_;const l=t.getFont()||Sa;Pc(l);const h=t.getScaleArray();i.overflow=t.getOverflow(),i.font=l,i.maxAngle=t.getMaxAngle(),i.placement=t.getPlacement(),i.textAlign=t.getTextAlign(),i.repeat=t.getRepeat(),i.justify=t.getJustify(),i.textBaseline=t.getTextBaseline()||Bn,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||Ye,i.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:V(r.strokeStyle))+r.lineCap+r.lineDashOffset+"|"+r.lineWidth+r.lineJoin+r.miterLimit+"["+r.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.repeat||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=n&&n.fillStyle?typeof n.fillStyle=="string"?n.fillStyle:"|"+V(n.fillStyle):""}this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}const zc={Circle:La,Default:Qi,Image:bc,LineString:Dc,Polygon:La,Text:Wc};class jc{constructor(t,e,i,n){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=n,this.resolution_=i,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const i=this.buildersByZIndex_[e];for(const n in i){const r=i[n].finish();t[e][n]=r}}return t}getBuilder(t,e){const i=t!==void 0?t.toString():"0";let n=this.buildersByZIndex_[i];n===void 0&&(n={},this.buildersByZIndex_[i]=n);let r=n[e];if(r===void 0){const o=zc[e];r=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),n[e]=r}return r}}function Te(s,t,e,i,n,r,o){r=r||[],o=o||2;let a=0;for(let l=t;l<e;l+=i){const h=s[l],c=s[l+1];r[a++]=n[0]*h+n[2]*c+n[4],r[a++]=n[1]*h+n[3]*c+n[5];for(let u=2;u<o;u++)r[a++]=s[l+u]}return r&&r.length!=a&&(r.length=a),r}function xr(s,t,e,i,n,r,o){o=o||[];const a=Math.cos(n),l=Math.sin(n),h=r[0],c=r[1];let u=0;for(let d=t;d<e;d+=i){const f=s[d]-h,g=s[d+1]-c;o[u++]=h+f*a-g*l,o[u++]=c+f*l+g*a;for(let m=d+2;m<d+i;++m)o[u++]=s[m]}return o&&o.length!=u&&(o.length=u),o}function Xc(s,t,e,i,n,r,o,a){a=a||[];const l=o[0],h=o[1];let c=0;for(let u=t;u<e;u+=i){const d=s[u]-l,f=s[u+1]-h;a[c++]=l+n*d,a[c++]=h+r*f;for(let g=u+2;g<u+i;++g)a[c++]=s[g]}return a&&a.length!=c&&(a.length=c),a}function Vc(s,t,e,i,n,r,o){o=o||[];let a=0;for(let l=t;l<e;l+=i){o[a++]=s[l]+n,o[a++]=s[l+1]+r;for(let h=l+2;h<l+i;++h)o[a++]=s[h]}return o&&o.length!=a&&(o.length=a),o}function it(s,t){if(!s)throw new Error(t)}new Array(6);function Xt(){return[1,0,0,1,0,0]}function Bc(s,t){return s[0]=t[0],s[1]=t[1],s[2]=t[2],s[3]=t[3],s[4]=t[4],s[5]=t[5],s}function ft(s,t){const e=t[0],i=t[1];return t[0]=s[0]*e+s[2]*i+s[4],t[1]=s[1]*e+s[3]*i+s[5],t}function he(s,t,e,i,n,r,o,a){const l=Math.sin(r),h=Math.cos(r);return s[0]=i*h,s[1]=n*l,s[2]=-i*l,s[3]=n*h,s[4]=o*i*h-a*i*l+t,s[5]=o*n*l+a*n*h+e,s}function Aa(s,t){const e=Yc(t);it(e!==0,"Transformation matrix cannot be inverted");const i=t[0],n=t[1],r=t[2],o=t[3],a=t[4],l=t[5];return s[0]=o/e,s[1]=-n/e,s[2]=-r/e,s[3]=i/e,s[4]=(r*l-o*a)/e,s[5]=-(i*l-n*a)/e,s}function Yc(s){return s[0]*s[3]-s[1]*s[2]}const Kc=[1e5,1e5,1e5,1e5,2,2];function Uc(s){return"matrix("+s.join(", ")+")"}function Fa(s){return s.substring(7,s.length-1).split(",").map(parseFloat)}function Zc(s,t){const e=Fa(s),i=Fa(t);for(let n=0;n<6;++n)if(Math.round((e[n]-i[n])*Kc[n])!==0)return!1;return!0}function Er(s,t,e,i){let n=s[t],r=s[t+1],o=0;for(let a=t+i;a<e;a+=i){const l=s[a],h=s[a+1];o+=Math.sqrt((l-n)*(l-n)+(h-r)*(h-r)),n=l,r=h}return o}function Hc(s,t,e,i,n,r,o,a,l,h,c,u,d=!0){let f=s[t],g=s[t+1],m=0,_=0,y=0,p=0;function E(){m=f,_=g,t+=i,f=s[t],g=s[t+1],p+=y,y=Math.sqrt((f-m)*(f-m)+(g-_)*(g-_))}do E();while(t<e-i&&p+y<r);let x=y===0?0:(r-p)/y;const C=Pt(m,f,x),S=Pt(_,g,x),T=t-i,I=p,R=r+a*l(h,n,c);for(;t<e-i&&p+y<R;)E();x=y===0?0:(R-p)/y;const M=Pt(m,f,x),k=Pt(_,g,x);let N=!1;if(d)if(u){const z=[C,S,M,k];xr(z,0,4,2,u,z,z),N=z[0]>z[2]}else N=C>M;const j=Math.PI,F=[],q=T+i===t;t=T,y=0,p=I,f=s[t],g=s[t+1];let b;if(q){E(),b=Math.atan2(g-_,f-m),N&&(b+=b>0?-j:j);const z=(M+C)/2,X=(k+S)/2;return F[0]=[z,X,(R-r)/2,b,n],F}n=n.replace(/\n/g," ");for(let z=0,X=n.length;z<X;){E();let tt=Math.atan2(g-_,f-m);if(N&&(tt+=tt>0?-j:j),b!==void 0){let xt=tt-b;if(xt+=xt>j?-2*j:xt<-j?2*j:0,Math.abs(xt)>o)return null}b=tt;const Q=z;let et=0;for(;z<X;++z){const xt=N?X-z-1:z,te=a*l(h,n[xt],c);if(t+i<e&&p+y<r+et+te/2)break;et+=te}if(z===Q)continue;const v=N?n.substring(X-Q,X-z):n.substring(Q,z);x=y===0?0:(r+et/2-p)/y;const pe=Pt(m,f,x),ti=Pt(_,g,x);F.push([pe,ti,et/2,tt,v]),r+=et}return F}class ba{constructor(){fh(this,"pushMethodArgs_",(...t)=>(this.push_(t),this));this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(Fn(),{get:(t,e)=>{if(typeof Fn()[e]=="function")return this.push_(e),this.pushMethodArgs_},set:(t,e,i)=>(this.push_(e,i),!0)})}push_(...t){const e=this.instructions_,i=this.zIndex+this.offset_;e[i]||(e[i]=[]),e[i].push(...t)}pushFunction(t){this.push_(t)}getContext(){return this.context_}draw(t){this.instructions_.forEach(e=>{for(let i=0,n=e.length;i<n;++i){const r=e[i];if(typeof r=="function"){r(t);continue}const o=e[++i];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 _i=Ft(),Pe=[],ce=[],ue=[],Me=[];function Da(s){return s[3].declutterBox}const Oa=new RegExp("[֑-ࣿיִ-﷿ﹰ-ﻼࠀ--]");function Cr(s,t){return t==="start"?t=Oa.test(s)?"right":"left":t==="end"&&(t=Oa.test(s)?"left":"right"),Un[t]}function qc(s,t,e){return e>0&&s.push(`
|
|
4
|
+
`,""),s.push(t,""),s}function $c(s,t,e){return e%2===0&&(s+=t),s}class Jc{constructor(t,e,i,n,r){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=Xt(),this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=r?new ba:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,i,n){const r=t+e+i+n;if(this.labels_[r])return this.labels_[r];const o=n?this.strokeStates[n]:null,a=i?this.fillStates[i]:null,l=this.textStates[e],h=this.pixelRatio,c=[l.scale[0]*h,l.scale[1]*h],u=l.justify?Un[l.justify]:Cr(Array.isArray(t)?t[0]:t,l.textAlign||qi),d=n&&o.lineWidth?o.lineWidth:0,f=Array.isArray(t)?t:String(t).split(`
|
|
5
|
+
`).reduce(qc,[]),{width:g,height:m,widths:_,heights:y,lineWidths:p}=Lc(l,f),E=g+d,x=[],C=(E+2)*c[0],S=(m+d)*c[1],T={width:C<0?Math.floor(C):Math.ceil(C),height:S<0?Math.floor(S):Math.ceil(S),contextInstructions:x};(c[0]!=1||c[1]!=1)&&x.push("scale",c),n&&(x.push("strokeStyle",o.strokeStyle),x.push("lineWidth",d),x.push("lineCap",o.lineCap),x.push("lineJoin",o.lineJoin),x.push("miterLimit",o.miterLimit),x.push("setLineDash",[o.lineDash]),x.push("lineDashOffset",o.lineDashOffset)),i&&x.push("fillStyle",a.fillStyle),x.push("textBaseline","middle"),x.push("textAlign","center");const I=.5-u;let R=u*E+I*d;const M=[],k=[];let N=0,j=0,F=0,q=0,b;for(let z=0,X=f.length;z<X;z+=2){const tt=f[z];if(tt===`
|
|
6
|
+
`){j+=N,N=0,R=u*E+I*d,++q;continue}const Q=f[z+1]||l.font;Q!==b&&(n&&M.push("font",Q),i&&k.push("font",Q),b=Q),N=Math.max(N,y[F]);const et=[tt,R+I*_[F]+u*(_[F]-p[q]),.5*(d+N)+j];R+=_[F],n&&M.push("strokeText",et),i&&k.push("fillText",et),++F}return Array.prototype.push.apply(x,M),Array.prototype.push.apply(x,k),this.labels_[r]=T,T}replayTextBackground_(t,e,i,n,r,o,a){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,n),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,i,n,r,o,a,l,h,c,u,d,f,g,m,_){a*=d[0],l*=d[1];let y=i-a,p=n-l;const E=r+h>t?t-h:r,x=o+c>e?e-c:o,C=g[3]+E*d[0]+g[1],S=g[0]+x*d[1]+g[2],T=y-g[3],I=p-g[0];(m||u!==0)&&(Pe[0]=T,Me[0]=T,Pe[1]=I,ce[1]=I,ce[0]=T+C,ue[0]=ce[0],ue[1]=I+S,Me[1]=ue[1]);let R;return u!==0?(R=he(Xt(),i,n,1,1,u,-i,-n),ft(R,Pe),ft(R,ce),ft(R,ue),ft(R,Me),We(Math.min(Pe[0],ce[0],ue[0],Me[0]),Math.min(Pe[1],ce[1],ue[1],Me[1]),Math.max(Pe[0],ce[0],ue[0],Me[0]),Math.max(Pe[1],ce[1],ue[1],Me[1]),_i)):We(Math.min(T,T+C),Math.min(I,I+S),Math.max(T,T+C),Math.max(I,I+S),_i),f&&(y=Math.round(y),p=Math.round(p)),{drawImageX:y,drawImageY:p,drawImageW:E,drawImageH:x,originX:h,originY:c,declutterBox:{minX:_i[0],minY:_i[1],maxX:_i[2],maxY:_i[3],value:_},canvasTransform:R,scale:d}}replayImageOrLabel_(t,e,i,n,r,o,a){const l=!!(o||a),h=n.declutterBox,c=a?a[2]*n.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,Pe,ce,ue,Me,o,a),Ac(t,n.canvasTransform,r,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const i=ft(this.renderedTransform_,[0,0]),n=512*this.pixelRatio;t.save(),t.translate(i[0]%n,i[1]%n),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,i,n){const r=this.textStates[e],o=this.createLabel(t,e,n,i),a=this.strokeStates[i],l=this.pixelRatio,h=Cr(Array.isArray(t)?t[0]:t,r.textAlign||qi),c=Un[r.textBaseline||Bn],u=a&&a.lineWidth?a.lineWidth:0,d=o.width/l-2*r.scale[0],f=h*d+2*(.5-h)*u,g=c*o.height/l+2*(.5-c)*u;return{label:o,anchorX:f,anchorY:g}}execute_(t,e,i,n,r,o,a,l){const h=this.zIndexContext_;let c;this.pixelCoordinates_&&ne(i,this.renderedTransform_)?c=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),c=Te(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),Bc(this.renderedTransform_,i));let u=0;const d=n.length;let f=0,g,m,_,y,p,E,x,C,S,T,I,R,M,k=0,N=0;const j=this.coordinateCache_,F=this.viewRotation_,q=Math.round(Math.atan2(-i[1],i[0])*1e12)/1e12,b={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:F},z=this.instructions!=n||this.overlaps?0:200;let X,tt,Q,et;for(;u<d;){const v=n[u];switch(v[0]){case L.BEGIN_GEOMETRY:X=v[1],et=v[3],X.getGeometry()?a!==void 0&&!dt(a,et.getExtent())?u=v[2]+1:++u:u=v[2],h&&(h.zIndex=v[4]);break;case L.BEGIN_PATH:k>z&&(this.fill_(t),k=0),N>z&&(t.stroke(),N=0),!k&&!N&&(t.beginPath(),p=NaN,E=NaN),++u;break;case L.CIRCLE:f=v[1];const ti=c[f],xt=c[f+1],te=c[f+2],Zt=c[f+3],ke=te-ti,Cn=Zt-xt,ee=Math.sqrt(ke*ke+Cn*Cn);t.moveTo(ti+ee,xt),t.arc(ti,xt,ee,0,2*Math.PI,!0),++u;break;case L.CLOSE_PATH:t.closePath(),++u;break;case L.CUSTOM:f=v[1],g=v[2];const Gg=v[3],Wg=v[4],sh=v[5];b.geometry=Gg,b.feature=X,u in j||(j[u]=[]);const wn=j[u];sh?sh(c,f,g,2,wn):(wn[0]=c[f],wn[1]=c[f+1],wn.length=2),h&&(h.zIndex=v[6]),Wg(wn,b),++u;break;case L.DRAW_IMAGE:f=v[1],g=v[2],S=v[3],m=v[4],_=v[5];let Po=v[6];const zg=v[7],jg=v[8],Xg=v[9],rh=v[10];let Mo=v[11];const Vg=v[12];let Rs=v[13];y=v[14]||"declutter";const Sn=v[15];if(!S&&v.length>=20){T=v[19],I=v[20],R=v[21],M=v[22];const kt=this.drawLabelWithPointPlacement_(T,I,R,M);S=kt.label,v[3]=S;const ei=v[23];m=(kt.anchorX-ei)*this.pixelRatio,v[4]=m;const Nt=v[24];_=(kt.anchorY-Nt)*this.pixelRatio,v[5]=_,Po=S.height,v[6]=Po,Rs=S.width,v[13]=Rs}let Lo;v.length>25&&(Lo=v[25]);let Ao,vs,Ts;v.length>17?(Ao=v[16],vs=v[17],Ts=v[18]):(Ao=Ye,vs=null,Ts=null),rh&&q?Mo+=F:!rh&&!q&&(Mo-=F);let Bg=0;for(;f<g;f+=2){if(Lo&&Lo[Bg++]<Rs/this.pixelRatio)continue;const kt=this.calculateImageOrLabelDimensions_(S.width,S.height,c[f],c[f+1],Rs,Po,m,_,jg,Xg,Mo,Vg,r,Ao,!!vs||!!Ts,X),ei=[t,e,S,kt,zg,vs,Ts];if(l){let Nt,ie,Gt;if(Sn){const st=g-f;if(!Sn[st]){Sn[st]={args:ei,declutterMode:y};continue}const wt=Sn[st];Nt=wt.args,ie=wt.declutterMode,delete Sn[st],Gt=Da(Nt)}let xe,Ee;if(Nt&&(ie!=="declutter"||!l.collides(Gt))&&(xe=!0),(y!=="declutter"||!l.collides(kt.declutterBox))&&(Ee=!0),ie==="declutter"&&y==="declutter"){const st=xe&&Ee;xe=st,Ee=st}xe&&(ie!=="none"&&l.insert(Gt),this.replayImageOrLabel_.apply(this,Nt)),Ee&&(y!=="none"&&l.insert(kt.declutterBox),this.replayImageOrLabel_.apply(this,ei))}else this.replayImageOrLabel_.apply(this,ei)}++u;break;case L.DRAW_CHARS:const oh=v[1],ah=v[2],Fo=v[3],Yg=v[4];M=v[5];const Kg=v[6],lh=v[7],hh=v[8];R=v[9];const bo=v[10];T=v[11],Array.isArray(T)&&(T=T.reduce($c,"")),I=v[12];const ch=[v[13],v[13]];y=v[14]||"declutter";const Ug=v[15],Do=this.textStates[I],In=Do.font,Rn=[Do.scale[0]*lh,Do.scale[1]*lh];let vn;In in this.widths_?vn=this.widths_[In]:(vn={},this.widths_[In]=vn);const uh=Er(c,oh,ah,2),dh=Math.abs(Rn[0])*Ta(In,T,vn);if(Yg||dh<=uh){const kt=this.textStates[I].textAlign,ei=(uh-dh)*Cr(T,kt),Nt=Hc(c,oh,ah,2,T,ei,Kg,Math.abs(Rn[0]),Ta,In,vn,q?0:this.viewRotation_,Ug);t:if(Nt){const ie=[];let Gt,xe,Ee,st,wt;if(R)for(Gt=0,xe=Nt.length;Gt<xe;++Gt){wt=Nt[Gt],Ee=wt[4],st=this.createLabel(Ee,I,"",R),m=wt[2]+(Rn[0]<0?-bo:bo),_=Fo*st.height+(.5-Fo)*2*bo*Rn[1]/Rn[0]-hh;const Ce=this.calculateImageOrLabelDimensions_(st.width,st.height,wt[0],wt[1],st.width,st.height,m,_,0,0,wt[3],ch,!1,Ye,!1,X);if(l&&y==="declutter"&&l.collides(Ce.declutterBox))break t;ie.push([t,e,st,Ce,1,null,null])}if(M)for(Gt=0,xe=Nt.length;Gt<xe;++Gt){wt=Nt[Gt],Ee=wt[4],st=this.createLabel(Ee,I,M,""),m=wt[2],_=Fo*st.height-hh;const Ce=this.calculateImageOrLabelDimensions_(st.width,st.height,wt[0],wt[1],st.width,st.height,m,_,0,0,wt[3],ch,!1,Ye,!1,X);if(l&&y==="declutter"&&l.collides(Ce.declutterBox))break t;ie.push([t,e,st,Ce,1,null,null])}l&&y!=="none"&&l.load(ie.map(Da));for(let Ce=0,Zg=ie.length;Ce<Zg;++Ce)this.replayImageOrLabel_.apply(this,ie[Ce])}}++u;break;case L.END_GEOMETRY:if(o!==void 0){X=v[1];const kt=o(X,et,y);if(kt)return kt}++u;break;case L.FILL:z?k++:this.fill_(t),++u;break;case L.MOVE_TO_LINE_TO:for(f=v[1],g=v[2],tt=c[f],Q=c[f+1],t.moveTo(tt,Q),p=tt+.5|0,E=Q+.5|0,f+=2;f<g;f+=2)tt=c[f],Q=c[f+1],x=tt+.5|0,C=Q+.5|0,(f==g-2||x!==p||C!==E)&&(t.lineTo(tt,Q),p=x,E=C);++u;break;case L.SET_FILL_STYLE:this.alignAndScaleFill_=v[2],k&&(this.fill_(t),k=0,N&&(t.stroke(),N=0)),t.fillStyle=v[1],++u;break;case L.SET_STROKE_STYLE:N&&(t.stroke(),N=0),this.setStrokeStyle_(t,v),++u;break;case L.STROKE:z?N++:t.stroke(),++u;break;default:++u;break}}k&&this.fill_(t),N&&t.stroke()}execute(t,e,i,n,r,o){this.viewRotation_=n,this.execute_(t,e,i,this.instructions,r,void 0,void 0,o)}executeHitDetection(t,e,i,n,r){return this.viewRotation_=i,this.execute_(t,[t.canvas.width,t.canvas.height],e,this.hitDetectionInstructions,!0,n,r)}}const Ze=["Polygon","Circle","LineString","Image","Text","Default"],ka=["Image","Text"],Qc=Ze.filter(s=>!ka.includes(s));class tu{constructor(t,e,i,n,r,o,a){this.maxExtent_=t,this.overlaps_=n,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=Xt(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(r,a)}clip(t,e){const i=this.getClipCoords(e);t.beginPath(),t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3]),t.lineTo(i[4],i[5]),t.lineTo(i[6],i[7]),t.clip()}createExecutors_(t,e){for(const i in t){let n=this.executorsByZIndex_[i];n===void 0&&(n={},this.executorsByZIndex_[i]=n);const r=t[i];for(const o in r){const a=r[o];n[o]=new Jc(this.resolution_,this.pixelRatio_,this.overlaps_,a,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const i=this.executorsByZIndex_[e];for(let n=0,r=t.length;n<r;++n)if(t[n]in i)return!0}return!1}forEachFeatureAtCoordinate(t,e,i,n,r,o){n=Math.round(n);const a=n*2+1,l=he(this.hitDetectionTransform_,n+.5,n+.5,1/e,-1/e,-i,-t[0],-t[1]),h=!this.hitDetectionContext_;h&&(this.hitDetectionContext_=ut(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=Ft(),Gi(u,t),bi(u,e*(this.renderBuffer_+n),u));const d=eu(n);let f;function g(C,S,T){const I=c.getImageData(0,0,a,a).data;for(let R=0,M=d.length;R<M;R++)if(I[d[R]]>0){if(!o||T==="none"||f!=="Image"&&f!=="Text"||o.includes(C)){const k=(d[R]-3)/4,N=n-k%a,j=n-(k/a|0),F=r(C,S,N*N+j*j);if(F)return F}c.clearRect(0,0,a,a);break}}const m=Object.keys(this.executorsByZIndex_).map(Number);m.sort(Ne);let _,y,p,E,x;for(_=m.length-1;_>=0;--_){const C=m[_].toString();for(p=this.executorsByZIndex_[C],y=Ze.length-1;y>=0;--y)if(f=Ze[y],E=p[f],E!==void 0&&(x=E.executeHitDetection(c,l,i,g,u),x))return x}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],n=e[1],r=e[2],o=e[3],a=[i,n,i,o,r,o,r,n];return Te(a,0,8,2,t,a),a}isEmpty(){return Xe(this.executorsByZIndex_)}execute(t,e,i,n,r,o,a){const l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?gh:Ne),o=o||Ze;const h=Ze.length;for(let c=0,u=l.length;c<u;++c){const d=l[c].toString(),f=this.executorsByZIndex_[d];for(let g=0,m=o.length;g<m;++g){const _=o[g],y=f[_];if(y!==void 0){const p=a===null?void 0:y.getZIndexContext(),E=p?p.getContext():t,x=this.maxExtent_&&_!=="Image"&&_!=="Text";if(x&&(E.save(),this.clip(E,i)),!p||_==="Text"||_==="Image"?y.execute(E,e,i,n,r,a):p.pushFunction(C=>y.execute(C,e,i,n,r,a)),x&&E.restore(),p){p.offset();const C=l[c]*h+Ze.indexOf(_);this.deferredZIndexContexts_[C]||(this.deferredZIndexContexts_[C]=[]),this.deferredZIndexContexts_[C].push(p)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(Ne);for(let i=0,n=e.length;i<n;++i)t[e[i]].forEach(r=>{r.draw(this.renderedContext_),r.clear()}),t[e[i]].length=0}}const wr={};function eu(s){if(wr[s]!==void 0)return wr[s];const t=s*2+1,e=s*s,i=new Array(e+1);for(let r=0;r<=s;++r)for(let o=0;o<=s;++o){const a=r*r+o*o;if(a>e)break;let l=i[a];l||(l=[],i[a]=l),l.push(((s+r)*t+(s+o))*4+3),r>0&&l.push(((s-r)*t+(s+o))*4+3),o>0&&(l.push(((s+r)*t+(s-o))*4+3),r>0&&l.push(((s-r)*t+(s-o))*4+3))}const n=[];for(let r=0,o=i.length;r<o;++r)i[r]&&n.push(...i[r]);return wr[s]=n,n}function Na(s){return s[0]>0&&s[1]>0}function mi(s,t){return Array.isArray(s)?s:(t===void 0?t=[s,s]:(t[0]=s,t[1]=s),t)}class Zn{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=mi(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new Zn({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 O()}getImage(t){return O()}getHitDetectionImage(){return O()}getPixelRatio(t){return 1}getImageState(){return O()}getImageSize(){return O()}getOrigin(){return O()}getSize(){return O()}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_=mi(t)}listenImageChange(t){O()}load(){O()}unlistenImageChange(t){O()}ready(){return Promise.resolve()}}class Hn extends Zn{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()?P.LOADING:P.LOADED,this.imageState_===P.LOADING&&this.ready().then(()=>this.imageState_=P.LOADED),this.render()}clone(){const t=this.getScale(),e=new Hn({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_,e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){var r,o;const e=(r=this.fill_)==null?void 0:r.getKey(),i=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(",");let n=(o=Ot.get(i,null,null))==null?void 0:o.getImage(1);if(!n){const a=this.renderOptions_,l=Math.ceil(a.size*t),h=ut(l,l);this.draw_(a,h,t),n=h.canvas,Ot.set(i,null,null,new pa(n,void 0,null,P.LOADED,null))}return n}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}getRadius2(){return this.radius2_}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(e===0||this.points_===1/0||t!=="bevel"&&t!=="miter")return e;let n=this.radius,r=this.radius2_===void 0?n:this.radius2_;if(n<r){const S=n;n=r,r=S}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=n-h,u=Math.sqrt(l*l+c*c),d=u/l;if(t==="miter"&&d<=i)return d*e;const f=e/2/d,g=e/2*(c/u),_=Math.sqrt((n+f)*(n+f)+g*g)-n;if(this.radius2_===void 0||t==="bevel")return _*2;const y=n*Math.sin(a),p=Math.sqrt(n*n-y*y),E=r-p,C=Math.sqrt(y*y+E*E)/y;if(C<=i){const S=C*e/2-r-n;return 2*Math.max(_,S)}return _*2}createRenderOptions(){let t=di,e=fi,i=0,n=null,r=0,o,a=0;this.stroke_&&(o=qt(this.stroke_.getColor()??Hi),a=this.stroke_.getWidth()??$i,n=this.stroke_.getLineDash(),r=this.stroke_.getLineDashOffset()??0,e=this.stroke_.getLineJoin()??fi,t=this.stroke_.getLineCap()??di,i=this.stroke_.getMiterLimit()??Zi);const l=this.calculateLineJoinSize_(e,a,i),h=Math.max(this.radius,this.radius2_||0),c=Math.ceil(2*h+l);return{strokeStyle:o,strokeWidth:a,size:c,lineCap:t,lineDash:n,lineDashOffset:r,lineJoin:e,miterLimit:i}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,e,i){if(e.scale(i,i),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let n=this.fill_.getColor();n===null&&(n=It),e.fillStyle=qt(n),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 i=this.fill_.getColor(),n=0;typeof i=="string"&&(i=ci(i)),i===null?n=1:Array.isArray(i)&&(n=i.length===4?i[3]:1),n===0&&(e=ut(t.size,t.size),this.drawHitDetectionCanvas_(t,e))}return e?e.canvas:this.getImage(1)}createPath_(t){let e=this.points_;const i=this.radius;if(e===1/0)t.arc(0,0,i,0,2*Math.PI);else{const n=this.radius2_===void 0?i: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?i:n;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=It,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()}}class tn extends Hn{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 tn({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()}}class Le{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 Le({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=dr(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()===P.IDLE&&e.load(),e.getImageState()===P.LOADING&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?V(t):typeof t=="object"&&"src"in t?t.src+":"+t.offset:ci(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}function Ga(s,t,e,i){return e!==void 0&&i!==void 0?[e/s,i/t]:e!==void 0?e/s:i!==void 0?i/t:1}class qn extends Zn{constructor(t){t=t||{};const e=t.opacity!==void 0?t.opacity:1,i=t.rotation!==void 0?t.rotation:0,n=t.scale!==void 0?t.scale:1,r=t.rotateWithView!==void 0?t.rotateWithView:!1;super({opacity:e,rotation:i,scale:n,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;it(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||V(o)),it(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),it(!((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=P.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?P.LOADED:P.IDLE:l=P.LOADING:l=P.LOADED),this.color_=t.color!==void 0?ci(t.color):null,this.iconImage_=dr(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(Ga(f[0],f[1],t.width,t.height))};this.listenImageChange(d);return}}h!==void 0&&this.setScale(Ga(h,c,t.width,t.height))}}clone(){let t,e,i;return this.initialOptions_?(e=this.initialOptions_.width,i=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new qn({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:i,size: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 n=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!n)return null;t=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(t[0]*=n[0]),this.anchorYUnits_=="fraction"&&(t[1]*=n[1])}if(this.anchorOrigin_!="top-left"){if(!n)return null;t===this.anchor_&&(t=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(t[0]=-t[0]+n[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(t[1]=-t[1]+n[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),i=this.getScaleArray();return[t[0]-e[0]/i[0],t[1]+e[1]/i[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if(this.offsetOrigin_!="top-left"){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(t[0]=i[0]-e[0]-t[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();if(this.size_)return this.size_[0]*t[0];if(this.iconImage_.getImageState()==P.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()==P.LOADED)return this.iconImage_.getSize()[1]*t[1]}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(D.CHANGE,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(D.CHANGE,t)}ready(){return this.iconImage_.ready()}}class Ae{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 Ae({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}}class Mt{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=za,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 Mt({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_=za,this.geometry_=t}setZIndex(t){this.zIndex_=t}}function iu(s){let t;if(typeof s=="function")t=s;else{let e;Array.isArray(s)?e=s:(it(typeof s.getZIndex=="function","Expected an `Style` or an array of `Style`"),e=[s]),t=function(){return e}}return t}let Sr=null;function Wa(s,t){if(!Sr){const e=new Le({color:"rgba(255,255,255,0.4)"}),i=new Ae({color:"#3399CC",width:1.25});Sr=[new Mt({image:new tn({fill:e,stroke:i,radius:5}),fill:e,stroke:i})]}return Sr}function Ir(){const s={},t=[255,255,255,1],e=[0,153,255,1],i=3;return s.Polygon=[new Mt({fill:new Le({color:[255,255,255,.5]})})],s.MultiPolygon=s.Polygon,s.LineString=[new Mt({stroke:new Ae({color:t,width:i+2})}),new Mt({stroke:new Ae({color:e,width:i})})],s.MultiLineString=s.LineString,s.Circle=s.Polygon.concat(s.LineString),s.Point=[new Mt({image:new tn({radius:i*2,fill:new Le({color:e}),stroke:new Ae({color:t,width:i/2})}),zIndex:1/0})],s.MultiPoint=s.Point,s.GeometryCollection=s.Polygon.concat(s.LineString,s.Point),s}function za(s){return s.getGeometry()}const nu="#333";class Rr{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_=mi(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 Le({color:nu}),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 Rr({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setKeepUpright(t){this.keepUpright_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=mi(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 ja=Xt(),su=[NaN,NaN];class Xa extends jt{constructor(){super(),this.extent_=Ft(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=fa((t,e,i)=>{if(!i)return this.getSimplifiedGeometry(e);const n=this.clone();return n.applyTransform(i),n.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return O()}closestPointXY(t,e,i,n){return O()}containsXY(t,e){return this.closestPointXY(t,e,su,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 O()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&Oi(e),this.extentRevision_=this.getRevision()}return xh(this.extent_,t)}rotate(t,e){O()}scale(t,e,i){O()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return O()}getType(){return O()}applyTransform(t){O()}intersectsExtent(t){return O()}translate(t,e){O()}transform(t,e){const i=ot(t),n=i.getUnits()=="tile-pixels"?function(r,o,a){const l=i.getExtent(),h=i.getWorldExtent(),c=ct(h)/ct(l);he(ja,h[0],h[3],c,-c,0,0,0);const u=Te(r,0,r.length,a,ja,o),d=ji(i,e);return d?d(u,u,a):u}:ji(i,e);return this.applyTransform(n),this}}class Fe extends Xa{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return As(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return O()}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=$n(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){O()}setLayout(t,e,i){let n;if(t)n=$n(t);else{for(let r=0;r<i;++r){if(e.length===0){this.layout="XY",this.stride=2;return}e=e[0]}n=e.length,t=He(n)}this.layout=t,this.stride=n}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();xr(i,0,i.length,n,t,e,i),this.changed()}}scale(t,e,i){e===void 0&&(e=t),i||(i=Ht(this.getExtent()));const n=this.getFlatCoordinates();if(n){const r=this.getStride();Xc(n,0,n.length,r,t,e,i,n),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();Vc(i,0,i.length,n,t,e,i),this.changed()}}}function He(s){let t;return s==2?t="XY":s==3?t="XYZ":s==4&&(t="XYZM"),t}function $n(s){let t;return s=="XY"?t=2:s=="XYZ"||s=="XYM"?t=3:s=="XYZM"&&(t=4),t}function ru(s,t,e){const i=s.getFlatCoordinates();if(!i)return null;const n=s.getStride();return Te(i,0,i.length,n,t,e)}class ou extends xa{constructor(t,e,i,n,r,o,a){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=n,this.transformRotation_=n?Mn(Math.atan2(n[1],n[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_=Xt()}drawImages_(t,e,i,n){if(!this.image_)return;const r=Te(t,e,i,n,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_,m=f+this.imageAnchorY_;he(a,g,m,1,1,h,-g,-m),o.save(),o.transform.apply(o,a),o.translate(g,m),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,i,n){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const r=Te(t,e,i,n,this.transform_,this.pixelCoordinates_),o=this.context_;let a=this.textRotation_;for(this.transformRotation_===0&&(a-=this.viewRotation_),this.textRotateWithView_&&(a+=this.viewRotation_);e<i;e+=n){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,i,n,r){const o=this.context_,a=Te(t,e,i,n,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(),i}drawRings_(t,e,i,n){for(let r=0,o=i.length;r<o;++r)e=this.moveToLineTo_(t,e,i[r],n,!0);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!dt(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=ru(t,this.transform_,this.pixelCoordinates_),i=e[2]-e[0],n=e[3]-e[1],r=Math.sqrt(i*i+n*n),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 i=e.getGeometryFunction()(t);i&&(this.setStyle(e),this.drawGeometry(i))}drawGeometryCollection(t){const e=t.getGeometriesArray();for(let i=0,n=e.length;i<n;++i)this.drawGeometry(e[i])}drawPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),this.text_!==""&&this.drawText_(e,0,e.length,i)}drawMultiPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),this.text_!==""&&this.drawText_(e,0,e.length,i)}drawLineString(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!dt(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(i,0,i.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(dt(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const i=this.context_,n=t.getFlatCoordinates();let r=0;const o=t.getEnds(),a=t.getStride();i.beginPath();for(let l=0,h=o.length;l<h;++l)r=this.moveToLineTo_(n,r,o[l],a,!1);i.stroke()}if(this.text_!==""){const i=t.getFlatMidpoints();this.drawText_(i,0,i.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!dt(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_)),!!dt(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_,i=t.getOrientedFlatCoordinates();let n=0;const r=t.getEndss(),o=t.getStride();e.beginPath();for(let a=0,l=r.length;a<l;++a){const h=r[a];n=this.drawRings_(i,n,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_,i=this.contextFillState_;i?i.fillStyle!=t.fillStyle&&(i.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){const e=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=t.lineCap&&(i.lineCap=t.lineCap,e.lineCap=t.lineCap),ne(i.lineDash,t.lineDash)||e.setLineDash(i.lineDash=t.lineDash),i.lineDashOffset!=t.lineDashOffset&&(i.lineDashOffset=t.lineDashOffset,e.lineDashOffset=t.lineDashOffset),i.lineJoin!=t.lineJoin&&(i.lineJoin=t.lineJoin,e.lineJoin=t.lineJoin),i.lineWidth!=t.lineWidth&&(i.lineWidth=t.lineWidth,e.lineWidth=t.lineWidth),i.miterLimit!=t.miterLimit&&(i.miterLimit=t.miterLimit,e.miterLimit=t.miterLimit),i.strokeStyle!=t.strokeStyle&&(i.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_,i=this.contextTextState_,n=t.textAlign?t.textAlign:qi;i?(i.font!=t.font&&(i.font=t.font,e.font=t.font),i.textAlign!=n&&(i.textAlign=n,e.textAlign=n),i.textBaseline!=t.textBaseline&&(i.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=n,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:n,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(!t)this.fillState_=null;else{const i=t.getColor();this.fillState_={fillStyle:qt(i||It)}}if(!e)this.strokeState_=null;else{const i=e.getColor(),n=e.getLineCap(),r=e.getLineDash(),o=e.getLineDashOffset(),a=e.getLineJoin(),l=e.getWidth(),h=e.getMiterLimit(),c=r||ae;this.strokeState_={lineCap:n!==void 0?n:di,lineDash:this.pixelRatio_===1?c:c.map(u=>u*this.pixelRatio_),lineDashOffset:(o||le)*this.pixelRatio_,lineJoin:a!==void 0?a:fi,lineWidth:(l!==void 0?l:$i)*this.pixelRatio_,miterLimit:h!==void 0?h:Zi,strokeStyle:qt(i||Hi)}}}setImageStyle(t){let e;if(!t||!(e=t.getSize())){this.image_=null;return}const i=t.getPixelRatio(this.pixelRatio_),n=t.getAnchor(),r=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*i,this.imageAnchorY_=n[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=r[0],this.imageOriginY_=r[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const o=t.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/i,o[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(!t)this.text_="";else{const e=t.getFill();if(!e)this.textFillState_=null;else{const f=e.getColor();this.textFillState_={fillStyle:qt(f||It)}}const i=t.getStroke();if(!i)this.textStrokeState_=null;else{const f=i.getColor(),g=i.getLineCap(),m=i.getLineDash(),_=i.getLineDashOffset(),y=i.getLineJoin(),p=i.getWidth(),E=i.getMiterLimit();this.textStrokeState_={lineCap:g!==void 0?g:di,lineDash:m||ae,lineDashOffset:_||le,lineJoin:y!==void 0?y:fi,lineWidth:p!==void 0?p:$i,miterLimit:E!==void 0?E:Zi,strokeStyle:qt(f||Hi)}}const n=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:n!==void 0?n:Sa,textAlign:u!==void 0?u:qi,textBaseline:d!==void 0?d:Bn},this.text_=c!==void 0?Array.isArray(c)?c.reduce((f,g,m)=>f+=m%2?" ":g,""):c:"",this.textOffsetX_=r!==void 0?this.pixelRatio_*r:0,this.textOffsetY_=o!==void 0?this.pixelRatio_*o:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*h[0],this.pixelRatio_*h[1]]}}}const $t=.5;function au(s,t,e,i,n,r,o,a,l){const h=n,c=s[0]*$t,u=s[1]*$t,d=ut(c,u);d.imageSmoothingEnabled=!1;const f=d.canvas,g=new ou(d,$t,n,null,o,a,null),m=e.length,_=Math.floor((256*256*256-1)/m),y={};for(let E=1;E<=m;++E){const x=e[E-1],C=x.getStyleFunction()||i;if(!C)continue;let S=C(x,r);if(!S)continue;Array.isArray(S)||(S=[S]);const I=(E*_).toString(16).padStart(7,"#00000");for(let R=0,M=S.length;R<M;++R){const k=S[R],N=k.getGeometryFunction()(x);if(!N||!dt(h,N.getExtent()))continue;const j=k.clone(),F=j.getFill();F&&F.setColor(I);const q=j.getStroke();q&&(q.setColor(I),q.setLineDash(null)),j.setText(void 0);const b=k.getImage();if(b){const Q=b.getImageSize();if(!Q)continue;const et=ut(Q[0],Q[1],void 0,{alpha:!1}),v=et.canvas;et.fillStyle=I,et.fillRect(0,0,v.width,v.height),j.setImage(new qn({img:v,anchor:b.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:b.getOrigin(),opacity:1,size:b.getSize(),scale:b.getScale(),rotation:b.getRotation(),rotateWithView:b.getRotateWithView()}))}const z=j.getZIndex()||0;let X=y[z];X||(X={},y[z]=X,X.Polygon=[],X.Circle=[],X.LineString=[],X.Point=[]);const tt=N.getType();if(tt==="GeometryCollection"){const Q=N.getGeometriesArrayRecursive();for(let et=0,v=Q.length;et<v;++et){const pe=Q[et];X[pe.getType().replace("Multi","")].push(pe,j)}}else X[tt.replace("Multi","")].push(N,j)}}const p=Object.keys(y).map(Number).sort(Ne);for(let E=0,x=p.length;E<x;++E){const C=y[p[E]];for(const S in C){const T=C[S];for(let I=0,R=T.length;I<R;I+=2){g.setStyle(T[I+1]);for(let M=0,k=t.length;M<k;++M)g.setTransform(t[M]),g.drawGeometry(T[I])}}}return d.getImageData(0,0,f.width,f.height)}function lu(s,t,e){const i=[];if(e){const n=Math.floor(Math.round(s[0])*$t),r=Math.floor(Math.round(s[1])*$t),o=(rt(n,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&&i.push(t[c/u-1])}return i}const hu=.5,Va={Point:yu,LineString:gu,Polygon:xu,MultiPoint:pu,MultiLineString:_u,MultiPolygon:mu,GeometryCollection:fu,Circle:uu};function cu(s,t){return parseInt(V(s),10)-parseInt(V(t),10)}function Ba(s,t){const e=Ya(s,t);return e*e}function Ya(s,t){return hu*s/t}function uu(s,t,e,i,n){const r=e.getFill(),o=e.getStroke();if(r||o){const l=s.getBuilder(e.getZIndex(),"Circle");l.setFillStrokeStyle(r,o),l.drawCircle(t,i,n)}const a=e.getText();if(a&&a.getText()){const l=s.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i)}}function Ka(s,t,e,i,n,r,o,a){const l=[],h=e.getImage();if(h){let d=!0;const f=h.getImageState();f==P.LOADED||f==P.ERROR?d=!1:f==P.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(()=>n(null)),du(s,t,e,i,r,o,a),u}function du(s,t,e,i,n,r,o){const a=e.getGeometryFunction()(t);if(!a)return;const l=a.simplifyTransformed(i,n);if(e.getRenderer())Ua(s,l,e,t,o);else{const c=Va[l.getType()];c(s,l,e,t,o,r)}}function Ua(s,t,e,i,n){if(t.getType()=="GeometryCollection"){const o=t.getGeometries();for(let a=0,l=o.length;a<l;++a)Ua(s,o[a],e,i,n);return}s.getBuilder(e.getZIndex(),"Default").drawCustom(t,i,e.getRenderer(),e.getHitDetectionRenderer(),n)}function fu(s,t,e,i,n,r){const o=t.getGeometriesArray();let a,l;for(a=0,l=o.length;a<l;++a){const h=Va[o[a].getType()];h(s,o[a],e,i,n,r)}}function gu(s,t,e,i,n){const r=e.getStroke();if(r){const a=s.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,r),a.drawLineString(t,i,n)}const o=e.getText();if(o&&o.getText()){const a=s.getBuilder(e.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,i,n)}}function _u(s,t,e,i,n){const r=e.getStroke();if(r){const a=s.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,r),a.drawMultiLineString(t,i,n)}const o=e.getText();if(o&&o.getText()){const a=s.getBuilder(e.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,i,n)}}function mu(s,t,e,i,n){const r=e.getFill(),o=e.getStroke();if(o||r){const l=s.getBuilder(e.getZIndex(),"Polygon");l.setFillStrokeStyle(r,o),l.drawMultiPolygon(t,i,n)}const a=e.getText();if(a&&a.getText()){const l=s.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i,n)}}function yu(s,t,e,i,n,r){const o=e.getImage(),a=e.getText(),l=a&&a.getText(),h=r&&o&&l?{}:void 0;if(o){if(o.getImageState()!=P.LOADED)return;const c=s.getBuilder(e.getZIndex(),"Image");c.setImageStyle(o,h),c.drawPoint(t,i,n)}if(l){const c=s.getBuilder(e.getZIndex(),"Text");c.setTextStyle(a,h),c.drawText(t,i,n)}}function pu(s,t,e,i,n,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()!=P.LOADED)return;const u=s.getBuilder(e.getZIndex(),"Image");u.setImageStyle(o,c),u.drawMultiPoint(t,i,n)}if(h){const u=s.getBuilder(e.getZIndex(),"Text");u.setTextStyle(l,c),u.drawText(t,i,n)}}function xu(s,t,e,i,n){const r=e.getFill(),o=e.getStroke();if(r||o){const l=s.getBuilder(e.getZIndex(),"Polygon");l.setFillStrokeStyle(r,o),l.drawPolygon(t,i,n)}const a=e.getText();if(a&&a.getText()){const l=s.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i,n)}}class Za extends St{constructor(t,e,i,n){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=n}}const Eu=5;class Cu extends Ui{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.staleKeys_=new Array,this.maxStaleKeys=Eu}getStaleKeys(){return this.staleKeys_}prependStaleKey(t){this.staleKeys_.unshift(t),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(t){return O()}getData(t){return null}prepareFrame(t){return O()}renderFrame(t,e){return O()}forEachFeatureAtCoordinate(t,e,i,n,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;(e.getState()===P.LOADED||e.getState()===P.ERROR)&&this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=P.LOADED&&e!=P.ERROR&&t.addEventListener(D.CHANGE,this.boundHandleImageChange_),e==P.IDLE&&(t.load(),e=t.getState()),e==P.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&t.getSourceState()==="ready"&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}}const Ha=[];let yi=null;function wu(){yi=ut(1,1,void 0,{willReadFrequently:!0})}class qa extends Cu{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=Xt(),this.pixelTransform=Xt(),this.inversePixelTransform=Xt(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,i){yi||wu(),yi.clearRect(0,0,1,1);let n;try{yi.drawImage(t,e,i,1,1,0,0,1,1),n=yi.getImageData(0,0,1,1).data}catch{return yi=null,null}return n}getBackground(t){let i=this.getLayer().getBackground();return typeof i=="function"&&(i=i(t.viewState.resolution)),i||void 0}useContainer(t,e,i){const n=this.getLayer().getClassName();let r,o;if(t&&t.className===n&&(!i||t&&t.style.backgroundColor&&ne(ci(t.style.backgroundColor),ci(i)))){const a=t.firstElementChild;a instanceof HTMLCanvasElement&&(o=a.getContext("2d"))}if(o&&Zc(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=document.createElement("div"),r.className=n;let a=r.style;a.position="absolute",a.width="100%",a.height="100%",o=ut();const l=o.canvas;r.appendChild(l),a=l.style,a.position="absolute",a.left="0",a.transformOrigin="top left",this.container=r,this.context=o}!this.containerReused&&i&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const n=Pn(i),r=Os(i),o=bs(i),a=Fs(i);ft(e.coordinateToPixelTransform,n),ft(e.coordinateToPixelTransform,r),ft(e.coordinateToPixelTransform,o),ft(e.coordinateToPixelTransform,a);const l=this.inversePixelTransform;ft(l,n),ft(l,r),ft(l,o),ft(l,a),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.lineTo(Math.round(a[0]),Math.round(a[1])),t.clip()}prepareContainer(t,e){const i=t.extent,n=t.viewState.resolution,r=t.viewState.rotation,o=t.pixelRatio,a=Math.round(U(i)/n*o),l=Math.round(ct(i)/n*o);he(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/o,1/o,r,-a/2,-l/2),Aa(this.inversePixelTransform,this.pixelTransform);const h=Uc(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,i){const n=this.getLayer();if(n.hasListener(t)){const r=new Za(t,this.inversePixelTransform,i,e);n.dispatchEvent(r)}}preRender(t,e){this.frameState=e,!e.declutter&&this.dispatchRenderEvent_(Dt.PRERENDER,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(Dt.POSTRENDER,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new ba),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(Dt.PRERENDER,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(Dt.POSTRENDER,this.context,t))}getRenderTransform(t,e,i,n,r,o,a){const l=r/2,h=o/2,c=n/e,u=-c,d=-t[0]+a,f=-t[1];return he(this.tempTransform,l,h,c,u,-i,d,f)}disposeInternal(){delete this.frameState,super.disposeInternal()}}class Su extends qa{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_=Ft(),this.wrappedRenderedExtent_=Ft(),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,i){const n=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,m=!(g[J.ANIMATING]||g[J.INTERACTING]),_=this.context,y=Math.round(U(n)/a*f),p=Math.round(ct(n)/a*f),E=u.getWrapX()&&l.canWrapX(),x=E?U(c):null,C=E?Math.ceil((n[2]-c[2])/x)+1:1;let S=E?Math.floor((n[0]-c[0])/x):0;do{let T=this.getRenderTransform(o,a,0,f,y,p,S*x);e.declutter&&(T=T.slice(0)),t.execute(_,[_.canvas.width,_.canvas.height],T,h,m,i===void 0?Ze:i?ka:Qc,i?d&&e.declutter[d]:void 0)}while(++S<C)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=ut(this.context.canvas.width,this.context.canvas.height,Ha))}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,Xs(this.context),Ha.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 i=t.layerStatesArray[t.layerIndex];this.opacity_=i.opacity;const n=t.viewState;this.prepareContainer(t,e);const r=this.context,o=this.replayGroup_;let a=o&&!o.isEmpty();if(!a&&!(this.getLayer().hasListener(Dt.PRERENDER)||this.getLayer().hasListener(Dt.POSTRENDER)))return this.container;if(this.setDrawContext_(),this.preRender(r,t),n.projection,this.clipped_=!1,a&&i.extent&&this.clipping){const l=Ie(i.extent);a=dt(l,t.extent),this.clipped_=a&&!se(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_!==n.rotation&&(this.renderedRotation_=n.rotation,this.hitDetectionImageData_=null),t.declutter||this.resetDrawContext_(),this.container}getFeatures(t){return new Promise(e=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const i=this.frameState.size.slice(),n=this.renderedCenter_,r=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,h=this.getLayer(),c=[],u=i[0]*$t,d=i[1]*$t;c.push(this.getRenderTransform(n,r,o,$t,u,d,0).slice());const f=h.getSource(),g=a.getExtent();if(f.getWrapX()&&a.canWrapX()&&!se(g,l)){let m=l[0];const _=U(g);let y=0,p;for(;m<g[0];)--y,p=_*y,c.push(this.getRenderTransform(n,r,o,$t,u,d,p).slice()),m+=_;for(y=0,m=l[2];m>g[2];)++y,p=_*y,c.push(this.getRenderTransform(n,r,o,$t,u,d,p).slice()),m-=_}this.hitDetectionImageData_=au(i,c,this.renderedFeatures_,h.getStyleFunction(),l,r,o,Ba(r,this.renderedPixelRatio_))}e(lu(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,i,n,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 y=V(g),p=h[y];if(p){if(p!==!0&&_<p.distanceSq){if(_===0)return h[y]=!0,r.splice(r.lastIndexOf(p),1),n(g,l,m);p.geometry=m,p.distanceSq=_}}else{if(_===0)return h[y]=!0,n(g,l,m);r.push(h[y]={feature:g,layer:l,geometry:m,distanceSq:_,callback:n})}},u=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,o,a,i,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(),i=e.getSource();if(!i)return!1;const n=t.viewHints[J.ANIMATING],r=t.viewHints[J.INTERACTING],o=e.getUpdateWhileAnimating(),a=e.getUpdateWhileInteracting();if(this.ready&&!o&&n||!a&&r)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const l=t.extent,h=t.viewState,c=h.projection,u=h.resolution,d=t.pixelRatio,f=e.getRevision(),g=e.getRenderBuffer();let m=e.getRenderOrder();m===void 0&&(m=cu);const _=h.center.slice(),y=bi(l,g*u),p=y.slice(),E=[y.slice()],x=c.getExtent();if(i.getWrapX()&&c.canWrapX()&&!se(x,t.extent)){const F=U(x),q=Math.max(U(y)/2,F);y[0]=x[0]-q,y[2]=x[2]+q,jo(_,c);const b=Wo(E[0],c);b[0]<x[0]&&b[2]<x[2]?E.push([b[0]+F,b[1],b[2]+F,b[3]]):b[0]>x[0]&&b[2]>x[2]&&E.push([b[0]-F,b[1],b[2]-F,b[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedRevision_==f&&this.renderedRenderOrder_==m&&this.renderedFrameDeclutter_===!!t.declutter&&se(this.wrappedRenderedExtent_,y))return ne(this.renderedExtent_,p)||(this.hitDetectionImageData_=null,this.renderedExtent_=p),this.renderedCenter_=_,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const C=new jc(Ya(u,d),y,u,d);let S;for(let F=0,q=E.length;F<q;++F)i.loadFeatures(E[F],u,c);const T=Ba(u,d);let I=!0;const R=(F,q)=>{let b;const z=F.getStyleFunction()||e.getStyleFunction();if(z&&(b=z(F,u)),b){const X=this.renderFeature(F,T,b,C,S,this.getLayer().getDeclutter(),q);I=I&&!X}},M=Wn(y),k=i.getFeaturesInExtent(M);m&&k.sort(m);for(let F=0,q=k.length;F<q;++F)R(k[F],F);this.renderedFeatures_=k,this.ready=I;const N=C.finish(),j=new tu(y,u,d,i.getOverlaps(),N,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=u,this.renderedRevision_=f,this.renderedRenderOrder_=m,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=p,this.wrappedRenderedExtent_=y,this.renderedCenter_=_,this.renderedProjection_=c,this.renderedPixelRatio_=d,this.replayGroup_=j,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,n,r,o,a){if(!i)return!1;let l=!1;if(Array.isArray(i))for(let h=0,c=i.length;h<c;++h)l=Ka(n,t,i[h],e,this.boundHandleStyleImageChange_,r,o,a)||l;else l=Ka(n,t,i,e,this.boundHandleStyleImageChange_,r,o,a);return l}}function $a(s,t,e=0,i=s.length-1,n=Iu){for(;i>e;){if(i-e>600){const l=i-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(i,Math.floor(t+(l-h)*u/l+d));$a(s,t,f,g,n)}const r=s[t];let o=e,a=i;for(en(s,e,t),n(s[i],r)>0&&en(s,e,i);o<a;){for(en(s,o,a),o++,a--;n(s[o],r)<0;)o++;for(;n(s[a],r)>0;)a--}n(s[e],r)===0?en(s,e,a):(a++,en(s,a,i)),a<=t&&(e=a+1),t<=a&&(i=a-1)}}function en(s,t,e){const i=s[t];s[t]=s[e],s[e]=i}function Iu(s,t){return s<t?-1:s>t?1:0}let Ja=class{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const i=[];if(!Qn(t,e))return i;const n=this.toBBox,r=[];for(;e;){for(let o=0;o<e.children.length;o++){const a=e.children[o],l=e.leaf?n(a):a;Qn(t,l)&&(e.leaf?i.push(a):Tr(t,l)?this._all(a,i):r.push(a))}e=r.pop()}return i}collides(t){let e=this.data;if(!Qn(t,e))return!1;const i=[];for(;e;){for(let n=0;n<e.children.length;n++){const r=e.children[n],o=e.leaf?this.toBBox(r):r;if(Qn(t,o)){if(e.leaf||Tr(t,o))return!0;i.push(r)}}e=i.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let i=0;i<t.length;i++)this.insert(t[i]);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 i=this.data;this.data=e,e=i}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=xi([]),this}remove(t,e){if(!t)return this;let i=this.data;const n=this.toBBox(t),r=[],o=[];let a,l,h;for(;i||r.length;){if(i||(i=r.pop(),l=r[r.length-1],a=o.pop(),h=!0),i.leaf){const c=Ru(t,i.children,e);if(c!==-1)return i.children.splice(c,1),r.push(i),this._condense(r),this}!h&&!i.leaf&&Tr(i,n)?(r.push(i),o.push(a),a=0,l=i,i=i.children[0]):l?(a++,i=l.children[a],h=!1):i=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 i=[];for(;t;)t.leaf?e.push(...t.children):i.push(...t.children),t=i.pop();return e}_build(t,e,i,n){const r=i-e+1;let o=this._maxEntries,a;if(r<=o)return a=xi(t.slice(e,i+1)),pi(a,this.toBBox),a;n||(n=Math.ceil(Math.log(r)/Math.log(o)),o=Math.ceil(r/Math.pow(o,n-1))),a=xi([]),a.leaf=!1,a.height=n;const l=Math.ceil(r/o),h=l*Math.ceil(Math.sqrt(o));Qa(t,e,i,h,this.compareMinX);for(let c=e;c<=i;c+=h){const u=Math.min(c+h-1,i);Qa(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,n-1))}}return pi(a,this.toBBox),a}_chooseSubtree(t,e,i,n){for(;n.push(e),!(e.leaf||n.length-1===i);){let r=1/0,o=1/0,a;for(let l=0;l<e.children.length;l++){const h=e.children[l],c=vr(h),u=Pu(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,i){const n=i?t:this.toBBox(t),r=[],o=this._chooseSubtree(n,this.data,e,r);for(o.children.push(t),sn(o,n);e>=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(n,r,e)}_split(t,e){const i=t[e],n=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,n);const o=this._chooseSplitIndex(i,r,n),a=xi(i.children.splice(o,i.children.length-o));a.height=i.height,a.leaf=i.leaf,pi(i,this.toBBox),pi(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)}_splitRoot(t,e){this.data=xi([t,e]),this.data.height=t.height+1,this.data.leaf=!1,pi(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let n,r=1/0,o=1/0;for(let a=e;a<=i-e;a++){const l=nn(t,0,a,this.toBBox),h=nn(t,a,i,this.toBBox),c=Mu(l,h),u=vr(l)+vr(h);c<r?(r=c,n=a,o=u<o?u:o):c===r&&u<o&&(o=u,n=a)}return n||i-e}_chooseSplitAxis(t,e,i){const n=t.leaf?this.compareMinX:vu,r=t.leaf?this.compareMinY:Tu,o=this._allDistMargin(t,e,i,n),a=this._allDistMargin(t,e,i,r);o<a&&t.children.sort(n)}_allDistMargin(t,e,i,n){t.children.sort(n);const r=this.toBBox,o=nn(t,0,e,r),a=nn(t,i-e,i,r);let l=Jn(o)+Jn(a);for(let h=e;h<i-e;h++){const c=t.children[h];sn(o,t.leaf?r(c):c),l+=Jn(o)}for(let h=i-e-1;h>=e;h--){const c=t.children[h];sn(a,t.leaf?r(c):c),l+=Jn(a)}return l}_adjustParentBBoxes(t,e,i){for(let n=i;n>=0;n--)sn(e[n],t)}_condense(t){for(let e=t.length-1,i;e>=0;e--)t[e].children.length===0?e>0?(i=t[e-1].children,i.splice(i.indexOf(t[e]),1)):this.clear():pi(t[e],this.toBBox)}};function Ru(s,t,e){if(!e)return t.indexOf(s);for(let i=0;i<t.length;i++)if(e(s,t[i]))return i;return-1}function pi(s,t){nn(s,0,s.children.length,t,s)}function nn(s,t,e,i,n){n||(n=xi(null)),n.minX=1/0,n.minY=1/0,n.maxX=-1/0,n.maxY=-1/0;for(let r=t;r<e;r++){const o=s.children[r];sn(n,s.leaf?i(o):o)}return n}function sn(s,t){return s.minX=Math.min(s.minX,t.minX),s.minY=Math.min(s.minY,t.minY),s.maxX=Math.max(s.maxX,t.maxX),s.maxY=Math.max(s.maxY,t.maxY),s}function vu(s,t){return s.minX-t.minX}function Tu(s,t){return s.minY-t.minY}function vr(s){return(s.maxX-s.minX)*(s.maxY-s.minY)}function Jn(s){return s.maxX-s.minX+(s.maxY-s.minY)}function Pu(s,t){return(Math.max(t.maxX,s.maxX)-Math.min(t.minX,s.minX))*(Math.max(t.maxY,s.maxY)-Math.min(t.minY,s.minY))}function Mu(s,t){const e=Math.max(s.minX,t.minX),i=Math.max(s.minY,t.minY),n=Math.min(s.maxX,t.maxX),r=Math.min(s.maxY,t.maxY);return Math.max(0,n-e)*Math.max(0,r-i)}function Tr(s,t){return s.minX<=t.minX&&s.minY<=t.minY&&t.maxX<=s.maxX&&t.maxY<=s.maxY}function Qn(s,t){return t.minX<=s.maxX&&t.minY<=s.maxY&&t.maxX>=s.minX&&t.maxY>=s.minY}function xi(s){return{children:s,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Qa(s,t,e,i,n){const r=[t,e];for(;r.length;){if(e=r.pop(),t=r.pop(),e-t<=i)continue;const o=t+Math.ceil((e-t)/i/2)*i;$a(s,o,t,e,n),r.push(t,o,o,e)}}let qe=0;const Ct=1<<qe++,B=1<<qe++,Rt=1<<qe++,Vt=1<<qe++,$e=1<<qe++,rn=1<<qe++,ts=Math.pow(2,qe)-1,Pr={[Ct]:"boolean",[B]:"number",[Rt]:"string",[Vt]:"color",[$e]:"number[]",[rn]:"size"},Lu=Object.keys(Pr).map(Number).sort(Ne);function Au(s){return s in Pr}function on(s){const t=[];for(const e of Lu)an(s,e)&&t.push(Pr[e]);return t.length===0?"untyped":t.length<3?t.join(" or "):t.slice(0,-1).join(", ")+", or "+t[t.length-1]}function an(s,t){return(s&t)===t}function be(s,t){return s===t}class at{constructor(t,e){if(!Au(t))throw new Error(`literal expressions must have a specific type, got ${on(t)}`);this.type=t,this.value=e}}class Fu{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}}function tl(){return{variables:new Set,properties:new Set,featureId:!1,geometryType:!1,mapState:!1}}function gt(s,t,e){switch(typeof s){case"boolean":{if(be(t,Rt))return new at(Rt,s?"true":"false");if(!an(t,Ct))throw new Error(`got a boolean, but expected ${on(t)}`);return new at(Ct,s)}case"number":{if(be(t,rn))return new at(rn,mi(s));if(be(t,Ct))return new at(Ct,!!s);if(be(t,Rt))return new at(Rt,s.toString());if(!an(t,B))throw new Error(`got a number, but expected ${on(t)}`);return new at(B,s)}case"string":{if(be(t,Vt))return new at(Vt,ar(s));if(be(t,Ct))return new at(Ct,!!s);if(!an(t,Rt))throw new Error(`got a string, but expected ${on(t)}`);return new at(Rt,s)}}if(!Array.isArray(s))throw new Error("expression must be an array or a primitive value");if(s.length===0)throw new Error("empty expression");if(typeof s[0]=="string")return Vu(s,t,e);for(const i of s)if(typeof i!="number")throw new Error("expected an array of numbers");if(be(t,rn)){if(s.length!==2)throw new Error(`expected an array of two values for a size, got ${s.length}`);return new at(rn,s)}if(be(t,Vt)){if(s.length===3)return new at(Vt,[...s,1]);if(s.length===4)return new at(Vt,s);throw new Error(`expected an array of 3 or 4 values for a color, got ${s.length}`)}if(!an(t,$e))throw new Error(`got an array of numbers, but expected ${on(t)}`);return new at($e,s)}const w={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"},bu={[w.Get]:A(G(1,1/0),el),[w.Var]:A(G(1,1),Du),[w.Has]:A(G(1,1/0),el),[w.Id]:A(Ou,Ei),[w.Concat]:A(G(2,1/0),K(Rt)),[w.GeometryType]:A(ku,Ei),[w.LineMetric]:A(Ei),[w.Resolution]:A(Mr,Ei),[w.Zoom]:A(Mr,Ei),[w.Time]:A(Mr,Ei),[w.Any]:A(G(2,1/0),K(Ct)),[w.All]:A(G(2,1/0),K(Ct)),[w.Not]:A(G(1,1),K(Ct)),[w.Equal]:A(G(2,2),K(ts)),[w.NotEqual]:A(G(2,2),K(ts)),[w.GreaterThan]:A(G(2,2),K(B)),[w.GreaterThanOrEqualTo]:A(G(2,2),K(B)),[w.LessThan]:A(G(2,2),K(B)),[w.LessThanOrEqualTo]:A(G(2,2),K(B)),[w.Multiply]:A(G(2,1/0),il),[w.Coalesce]:A(G(2,1/0),il),[w.Divide]:A(G(2,2),K(B)),[w.Add]:A(G(2,1/0),K(B)),[w.Subtract]:A(G(2,2),K(B)),[w.Clamp]:A(G(3,3),K(B)),[w.Mod]:A(G(2,2),K(B)),[w.Pow]:A(G(2,2),K(B)),[w.Abs]:A(G(1,1),K(B)),[w.Floor]:A(G(1,1),K(B)),[w.Ceil]:A(G(1,1),K(B)),[w.Round]:A(G(1,1),K(B)),[w.Sin]:A(G(1,1),K(B)),[w.Cos]:A(G(1,1),K(B)),[w.Atan]:A(G(1,2),K(B)),[w.Sqrt]:A(G(1,1),K(B)),[w.Match]:A(G(4,1/0),nl,Gu),[w.Between]:A(G(3,3),K(B)),[w.Interpolate]:A(G(6,1/0),nl,Wu),[w.Case]:A(G(3,1/0),Nu,zu),[w.In]:A(G(2,2),ju),[w.Number]:A(G(1,1/0),K(ts)),[w.String]:A(G(1,1/0),K(ts)),[w.Array]:A(G(1,1/0),K(B)),[w.Color]:A(G(1,4),K(B)),[w.Band]:A(G(1,3),K(B)),[w.Palette]:A(G(2,2),Xu),[w.ToString]:A(G(1,1),K(Ct|B|Rt|Vt))};function el(s,t,e){const i=s.length-1,n=new Array(i);for(let r=0;r<i;++r){const o=s[r+1];switch(typeof o){case"number":{n[r]=new at(B,o);break}case"string":{n[r]=new at(Rt,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 n}function Du(s,t,e){const i=s[1];if(typeof i!="string")throw new Error("expected a string argument for var operation");return e.variables.add(i),[new at(Rt,i)]}function Ou(s,t,e){e.featureId=!0}function ku(s,t,e){e.geometryType=!0}function Mr(s,t,e){e.mapState=!0}function Ei(s,t,e){const i=s[0];if(s.length!==1)throw new Error(`expected no arguments for ${i} operation`);return[]}function G(s,t){return function(e,i,n){const r=e[0],o=e.length-1;if(s===t){if(o!==s){const a=s===1?"":"s";throw new Error(`expected ${s} argument${a} for ${r}, got ${o}`)}}else if(o<s||o>t){const a=t===1/0?`${s} or more`:`${s} to ${t}`;throw new Error(`expected ${a} arguments for ${r}, got ${o}`)}}}function il(s,t,e){const i=s.length-1,n=new Array(i);for(let r=0;r<i;++r){const o=gt(s[r+1],t,e);n[r]=o}return n}function K(s){return function(t,e,i){const n=t.length-1,r=new Array(n);for(let o=0;o<n;++o){const a=gt(t[o+1],s,i);r[o]=a}return r}}function Nu(s,t,e){const i=s[0],n=s.length-1;if(n%2===0)throw new Error(`expected an odd number of arguments for ${i}, got ${n} instead`)}function nl(s,t,e){const i=s[0],n=s.length-1;if(n%2===1)throw new Error(`expected an even number of arguments for operation ${i}, got ${n} instead`)}function Gu(s,t,e){const i=s.length-1,n=Rt|B|Ct,r=gt(s[1],n,e),o=gt(s[s.length-1],t,e),a=new Array(i-2);for(let l=0;l<i-2;l+=2){try{const h=gt(s[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=gt(s[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 Wu(s,t,e){const i=s[1];let n;switch(i[0]){case"linear":n=1;break;case"exponential":const l=i[1];if(typeof l!="number"||l<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(l)} instead`);n=l;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(i)}`)}const r=new at(B,n);let o;try{o=gt(s[2],B,e)}catch(l){throw new Error(`failed to parse argument 1 in interpolate expression: ${l.message}`)}const a=new Array(s.length-3);for(let l=0;l<a.length;l+=2){try{const h=gt(s[l+3],B,e);a[l]=h}catch(h){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${h.message}`)}try{const h=gt(s[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 zu(s,t,e){const i=gt(s[s.length-1],t,e),n=new Array(s.length-1);for(let r=0;r<n.length-1;r+=2){try{const o=gt(s[r+1],Ct,e);n[r]=o}catch(o){throw new Error(`failed to parse argument ${r} of case expression: ${o.message}`)}try{const o=gt(s[r+2],i.type,e);n[r+1]=o}catch(o){throw new Error(`failed to parse argument ${r+1} of case expression: ${o.message}`)}}return n[n.length-1]=i,n}function ju(s,t,e){let i=s[2];if(!Array.isArray(i))throw new Error('the second argument for the "in" operator must be an array');let n;if(typeof i[0]=="string"){if(i[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(i[1]))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array');i=i[1],n=Rt}else n=B;const r=new Array(i.length);for(let a=0;a<r.length;a++)try{const l=gt(i[a],n,e);r[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[gt(s[1],n,e),...r]}function Xu(s,t,e){let i;try{i=gt(s[1],B,e)}catch(o){throw new Error(`failed to parse first argument in palette expression: ${o.message}`)}const n=s[2];if(!Array.isArray(n))throw new Error("the second argument of palette must be an array");const r=new Array(n.length);for(let o=0;o<r.length;o++){let a;try{a=gt(n[o],Vt,e)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof at))throw new Error(`the palette color at index ${o} must be a literal value`);r[o]=a}return[i,...r]}function A(...s){return function(t,e,i){const n=t[0];let r;for(let o=0;o<s.length;o++){const a=s[o](t,e,i);if(o==s.length-1){if(!a)throw new Error("expected last argument validator to return the parsed args");r=a}}return new Fu(e,n,...r)}}function Vu(s,t,e){const i=s[0],n=bu[i];if(!n)throw new Error(`unknown operator: ${i}`);return n(s,t,e)}function sl(s){if(!s)return"";const t=s.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 sl(s.getGeometries()[0]);default:return""}}function rl(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function de(s,t,e){const i=gt(s,t,e);return Bt(i)}function Bt(s,t){if(s instanceof at){if(s.type===Vt&&typeof s.value=="string"){const i=ar(s.value);return function(){return i}}return function(){return s.value}}const e=s.operator;switch(e){case w.Number:case w.String:case w.Coalesce:return Bu(s);case w.Get:case w.Var:case w.Has:return Yu(s);case w.Id:return i=>i.featureId;case w.GeometryType:return i=>i.geometryType;case w.Concat:{const i=s.args.map(n=>Bt(n));return n=>"".concat(...i.map(r=>r(n).toString()))}case w.Resolution:return i=>i.resolution;case w.Any:case w.All:case w.Between:case w.In:case w.Not:return Uu(s);case w.Equal:case w.NotEqual:case w.LessThan:case w.LessThanOrEqualTo:case w.GreaterThan:case w.GreaterThanOrEqualTo:return Ku(s);case w.Multiply:case w.Divide:case w.Add:case w.Subtract:case w.Clamp:case w.Mod:case w.Pow:case w.Abs:case w.Floor:case w.Ceil:case w.Round:case w.Sin:case w.Cos:case w.Atan:case w.Sqrt:return Zu(s);case w.Case:return Hu(s);case w.Match:return qu(s);case w.Interpolate:return $u(s);case w.ToString:return Ju(s);default:throw new Error(`Unsupported operator ${e}`)}}function Bu(s,t){const e=s.operator,i=s.args.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=Bt(s.args[r]);switch(e){case w.Coalesce:return r=>{for(let o=0;o<i;++o){const a=n[o](r);if(typeof a<"u"&&a!==null)return a}throw new Error("Expected one of the values to be non-null")};case w.Number:case w.String:return r=>{for(let o=0;o<i;++o){const a=n[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 Yu(s,t){const i=s.args[0].value;switch(s.operator){case w.Get:return n=>{const r=s.args;let o=n.properties[i];for(let a=1,l=r.length;a<l;++a){const c=r[a].value;o=o[c]}return o};case w.Var:return n=>n.variables[i];case w.Has:return n=>{const r=s.args;if(!(i in n.properties))return!1;let o=n.properties[i];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 ${s.operator}`)}}function Ku(s,t){const e=s.operator,i=Bt(s.args[0]),n=Bt(s.args[1]);switch(e){case w.Equal:return r=>i(r)===n(r);case w.NotEqual:return r=>i(r)!==n(r);case w.LessThan:return r=>i(r)<n(r);case w.LessThanOrEqualTo:return r=>i(r)<=n(r);case w.GreaterThan:return r=>i(r)>n(r);case w.GreaterThanOrEqualTo:return r=>i(r)>=n(r);default:throw new Error(`Unsupported comparison operator ${e}`)}}function Uu(s,t){const e=s.operator,i=s.args.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=Bt(s.args[r]);switch(e){case w.Any:return r=>{for(let o=0;o<i;++o)if(n[o](r))return!0;return!1};case w.All:return r=>{for(let o=0;o<i;++o)if(!n[o](r))return!1;return!0};case w.Between:return r=>{const o=n[0](r),a=n[1](r),l=n[2](r);return o>=a&&o<=l};case w.In:return r=>{const o=n[0](r);for(let a=1;a<i;++a)if(o===n[a](r))return!0;return!1};case w.Not:return r=>!n[0](r);default:throw new Error(`Unsupported logical operator ${e}`)}}function Zu(s,t){const e=s.operator,i=s.args.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=Bt(s.args[r]);switch(e){case w.Multiply:return r=>{let o=1;for(let a=0;a<i;++a)o*=n[a](r);return o};case w.Divide:return r=>n[0](r)/n[1](r);case w.Add:return r=>{let o=0;for(let a=0;a<i;++a)o+=n[a](r);return o};case w.Subtract:return r=>n[0](r)-n[1](r);case w.Clamp:return r=>{const o=n[0](r),a=n[1](r);if(o<a)return a;const l=n[2](r);return o>l?l:o};case w.Mod:return r=>n[0](r)%n[1](r);case w.Pow:return r=>Math.pow(n[0](r),n[1](r));case w.Abs:return r=>Math.abs(n[0](r));case w.Floor:return r=>Math.floor(n[0](r));case w.Ceil:return r=>Math.ceil(n[0](r));case w.Round:return r=>Math.round(n[0](r));case w.Sin:return r=>Math.sin(n[0](r));case w.Cos:return r=>Math.cos(n[0](r));case w.Atan:return i===2?r=>Math.atan2(n[0](r),n[1](r)):r=>Math.atan(n[0](r));case w.Sqrt:return r=>Math.sqrt(n[0](r));default:throw new Error(`Unsupported numeric operator ${e}`)}}function Hu(s,t){const e=s.args.length,i=new Array(e);for(let n=0;n<e;++n)i[n]=Bt(s.args[n]);return n=>{for(let r=0;r<e-1;r+=2)if(i[r](n))return i[r+1](n);return i[e-1](n)}}function qu(s,t){const e=s.args.length,i=new Array(e);for(let n=0;n<e;++n)i[n]=Bt(s.args[n]);return n=>{const r=i[0](n);for(let o=1;o<e-1;o+=2)if(r===i[o](n))return i[o+1](n);return i[e-1](n)}}function $u(s,t){const e=s.args.length,i=new Array(e);for(let n=0;n<e;++n)i[n]=Bt(s.args[n]);return n=>{const r=i[0](n),o=i[1](n);let a,l;for(let h=2;h<e;h+=2){const c=i[h](n);let u=i[h+1](n);const d=Array.isArray(u);if(d&&(u=yc(u)),c>=o)return h===2?u:d?Qu(r,o,a,l,c,u):ln(r,o,a,l,c,u);a=c,l=u}return l}}function Ju(s,t){const e=s.operator,i=s.args.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=Bt(s.args[r]);switch(e){case w.ToString:return r=>{const o=n[0](r);return s.args[0].type===Vt?lr(o):o.toString()};default:throw new Error(`Unsupported convert operator ${e}`)}}function ln(s,t,e,i,n,r){const o=n-e;if(o===0)return i;const a=t-e,l=s===1?a/o:(Math.pow(s,a)-1)/(Math.pow(s,o)-1);return i+l*(r-i)}function Qu(s,t,e,i,n,r){if(n-e===0)return i;const a=da(i),l=da(r);let h=l[2]-a[2];h>180?h-=360:h<-180&&(h+=360);const c=[ln(s,t,e,a[0],n,l[0]),ln(s,t,e,a[1],n,l[1]),a[2]+ln(s,t,e,0,n,h),ln(s,t,e,i[3],n,r[3])];return pc(c)}function td(s){return!0}function ed(s){const t=tl(),e=id(s,t),i=rl();return function(n,r){if(i.properties=n.getPropertiesInternal(),i.resolution=r,t.featureId){const o=n.getId();o!==void 0?i.featureId=o:i.featureId=null}return t.geometryType&&(i.geometryType=sl(n.getGeometry())),e(i)}}function ol(s){const t=tl(),e=s.length,i=new Array(e);for(let o=0;o<e;++o)i[o]=Lr(s[o],t);const n=rl(),r=new Array(e);return function(o,a){if(n.properties=o.getPropertiesInternal(),n.resolution=a,t.featureId){const h=o.getId();h!==void 0?n.featureId=h:n.featureId=null}let l=0;for(let h=0;h<e;++h){const c=i[h](n);c&&(r[l]=c,l+=1)}return r.length=l,r}}function id(s,t){const e=s.length,i=new Array(e);for(let n=0;n<e;++n){const r=s[n],o="filter"in r?de(r.filter,Ct,t):td;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]=Lr(r.style[h],t)}else a=[Lr(r.style,t)];i[n]={filter:o,styles:a}}return function(n){const r=[];let o=!1;for(let a=0;a<e;++a){const l=i[a].filter;if(l(n)&&!(s[a].else&&o)){o=!0;for(const h of i[a].styles){const c=h(n);c&&r.push(c)}}}return r}}function Lr(s,t){const e=hn(s,"",t),i=cn(s,"",t),n=nd(s,t),r=sd(s,t),o=vt(s,"z-index",t);if(!e&&!i&&!n&&!r&&!Xe(s))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(s));const a=new Mt;return function(l){let h=!0;if(e){const c=e(l);c&&(h=!1),a.setFill(c)}if(i){const c=i(l);c&&(h=!1),a.setStroke(c)}if(n){const c=n(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 hn(s,t,e){let i;if(t+"fill-pattern-src"in s)i=ld(s,t+"fill-",e);else{if(s[t+"fill-color"]==="none")return r=>null;i=Ar(s,t+"fill-color",e)}if(!i)return null;const n=new Le;return function(r){const o=i(r);return o===tr?null:(n.setColor(o),n)}}function cn(s,t,e){const i=vt(s,t+"stroke-width",e),n=Ar(s,t+"stroke-color",e);if(!i&&!n)return null;const r=fe(s,t+"stroke-line-cap",e),o=fe(s,t+"stroke-line-join",e),a=al(s,t+"stroke-line-dash",e),l=vt(s,t+"stroke-line-dash-offset",e),h=vt(s,t+"stroke-miter-limit",e),c=new Ae;return function(u){if(n){const d=n(u);if(d===tr)return null;c.setColor(d)}if(i&&c.setWidth(i(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 nd(s,t){const e="text-",i=fe(s,e+"value",t);if(!i)return null;const n=hn(s,e,t),r=hn(s,e+"background-",t),o=cn(s,e,t),a=cn(s,e+"background-",t),l=fe(s,e+"font",t),h=vt(s,e+"max-angle",t),c=vt(s,e+"offset-x",t),u=vt(s,e+"offset-y",t),d=Ci(s,e+"overflow",t),f=fe(s,e+"placement",t),g=vt(s,e+"repeat",t),m=is(s,e+"scale",t),_=Ci(s,e+"rotate-with-view",t),y=vt(s,e+"rotation",t),p=fe(s,e+"align",t),E=fe(s,e+"justify",t),x=fe(s,e+"baseline",t),C=Ci(s,e+"keep-upright",t),S=al(s,e+"padding",t),T=ss(s,e+"declutter-mode"),I=new Rr({declutterMode:T});return function(R){if(I.setText(i(R)),n&&I.setFill(n(R)),r&&I.setBackgroundFill(r(R)),o&&I.setStroke(o(R)),a&&I.setBackgroundStroke(a(R)),l&&I.setFont(l(R)),h&&I.setMaxAngle(h(R)),c&&I.setOffsetX(c(R)),u&&I.setOffsetY(u(R)),d&&I.setOverflow(d(R)),f){const M=f(R);if(M!=="point"&&M!=="line")throw new Error("Expected point or line for text-placement");I.setPlacement(M)}if(g&&I.setRepeat(g(R)),m&&I.setScale(m(R)),_&&I.setRotateWithView(_(R)),y&&I.setRotation(y(R)),p){const M=p(R);if(M!=="left"&&M!=="center"&&M!=="right"&&M!=="end"&&M!=="start")throw new Error("Expected left, right, center, start, or end for text-align");I.setTextAlign(M)}if(E){const M=E(R);if(M!=="left"&&M!=="right"&&M!=="center")throw new Error("Expected left, right, or center for text-justify");I.setJustify(M)}if(x){const M=x(R);if(M!=="bottom"&&M!=="top"&&M!=="middle"&&M!=="alphabetic"&&M!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");I.setTextBaseline(M)}return S&&I.setPadding(S(R)),C&&I.setKeepUpright(C(R)),I}}function sd(s,t){return"icon-src"in s?rd(s,t):"shape-points"in s?od(s,t):"circle-radius"in s?ad(s,t):null}function rd(s,t){const e="icon-",i=e+"src",n=ul(s[i],i),r=es(s,e+"anchor",t),o=is(s,e+"scale",t),a=vt(s,e+"opacity",t),l=es(s,e+"displacement",t),h=vt(s,e+"rotation",t),c=Ci(s,e+"rotate-with-view",t),u=hl(s,e+"anchor-origin"),d=cl(s,e+"anchor-x-units"),f=cl(s,e+"anchor-y-units"),g=dd(s,e+"color"),m=cd(s,e+"cross-origin"),_=ud(s,e+"offset"),y=hl(s,e+"offset-origin"),p=ns(s,e+"width"),E=ns(s,e+"height"),x=hd(s,e+"size"),C=ss(s,e+"declutter-mode"),S=new qn({src:n,anchorOrigin:u,anchorXUnits:d,anchorYUnits:f,color:g,crossOrigin:m,offset:_,offsetOrigin:y,height:E,width:p,size:x,declutterMode:C});return function(T){return a&&S.setOpacity(a(T)),l&&S.setDisplacement(l(T)),h&&S.setRotation(h(T)),c&&S.setRotateWithView(c(T)),o&&S.setScale(o(T)),r&&S.setAnchor(r(T)),S}}function od(s,t){const e="shape-",i=e+"points",n=e+"radius",r=Fr(s[i],i),o=Fr(s[n],n),a=hn(s,e,t),l=cn(s,e,t),h=is(s,e+"scale",t),c=es(s,e+"displacement",t),u=vt(s,e+"rotation",t),d=Ci(s,e+"rotate-with-view",t),f=ns(s,e+"radius2"),g=ns(s,e+"angle"),m=ss(s,e+"declutter-mode"),_=new Hn({points:r,radius:o,radius2:f,angle:g,declutterMode:m});return function(y){return a&&_.setFill(a(y)),l&&_.setStroke(l(y)),c&&_.setDisplacement(c(y)),u&&_.setRotation(u(y)),d&&_.setRotateWithView(d(y)),h&&_.setScale(h(y)),_}}function ad(s,t){const e="circle-",i=hn(s,e,t),n=cn(s,e,t),r=vt(s,e+"radius",t),o=is(s,e+"scale",t),a=es(s,e+"displacement",t),l=vt(s,e+"rotation",t),h=Ci(s,e+"rotate-with-view",t),c=ss(s,e+"declutter-mode"),u=new tn({radius:5,declutterMode:c});return function(d){return r&&u.setRadius(r(d)),i&&u.setFill(i(d)),n&&u.setStroke(n(d)),a&&u.setDisplacement(a(d)),l&&u.setRotation(l(d)),h&&u.setRotateWithView(h(d)),o&&u.setScale(o(d)),u}}function vt(s,t,e){if(!(t in s))return;const i=de(s[t],B,e);return function(n){return Fr(i(n),t)}}function fe(s,t,e){if(!(t in s))return null;const i=de(s[t],Rt,e);return function(n){return ul(i(n),t)}}function ld(s,t,e){const i=fe(s,t+"pattern-src",e),n=ll(s,t+"pattern-offset",e),r=ll(s,t+"pattern-size",e),o=Ar(s,t+"color",e);return function(a){return{src:i(a),offset:n&&n(a),size:r&&r(a),color:o&&o(a)}}}function Ci(s,t,e){if(!(t in s))return null;const i=de(s[t],Ct,e);return function(n){const r=i(n);if(typeof r!="boolean")throw new Error(`Expected a boolean for ${t}`);return r}}function Ar(s,t,e){if(!(t in s))return null;const i=de(s[t],Vt,e);return function(n){return dl(i(n),t)}}function al(s,t,e){if(!(t in s))return null;const i=de(s[t],$e,e);return function(n){return un(i(n),t)}}function es(s,t,e){if(!(t in s))return null;const i=de(s[t],$e,e);return function(n){const r=un(i(n),t);if(r.length!==2)throw new Error(`Expected two numbers for ${t}`);return r}}function ll(s,t,e){if(!(t in s))return null;const i=de(s[t],$e,e);return function(n){return fl(i(n),t)}}function is(s,t,e){if(!(t in s))return null;const i=de(s[t],$e|B,e);return function(n){return fd(i(n),t)}}function ns(s,t){const e=s[t];if(e!==void 0){if(typeof e!="number")throw new Error(`Expected a number for ${t}`);return e}}function hd(s,t){const e=s[t];if(e!==void 0){if(typeof e=="number")return mi(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 cd(s,t){const e=s[t];if(e!==void 0){if(typeof e!="string")throw new Error(`Expected a string for ${t}`);return e}}function hl(s,t){const e=s[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 cl(s,t){const e=s[t];if(e!==void 0){if(e!=="pixels"&&e!=="fraction")throw new Error(`Expected pixels or fraction for ${t}`);return e}}function ud(s,t){const e=s[t];if(e!==void 0)return un(e,t)}function ss(s,t){const e=s[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 dd(s,t){const e=s[t];if(e!==void 0)return dl(e,t)}function un(s,t){if(!Array.isArray(s))throw new Error(`Expected an array for ${t}`);const e=s.length;for(let i=0;i<e;++i)if(typeof s[i]!="number")throw new Error(`Expected an array of numbers for ${t}`);return s}function ul(s,t){if(typeof s!="string")throw new Error(`Expected a string for ${t}`);return s}function Fr(s,t){if(typeof s!="number")throw new Error(`Expected a number for ${t}`);return s}function dl(s,t){if(typeof s=="string")return s;const e=un(s,t),i=e.length;if(i<3||i>4)throw new Error(`Expected a color with 3 or 4 values for ${t}`);return e}function fl(s,t){const e=un(s,t);if(e.length!==2)throw new Error(`Expected an array of two numbers for ${t}`);return e}function fd(s,t){return typeof s=="number"?s:fl(s,t)}const Yt={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function gl(s,t,e){return(function(i,n,r,o,a){if(!i)return;if(!n&&!t)return i;const l=t?0:r[0]*n,h=t?0:r[1]*n,c=a?a[0]:0,u=a?a[1]:0;let d=s[0]+l/2+c,f=s[2]-l/2+c,g=s[1]+h/2+u,m=s[3]-h/2+u;d>f&&(d=(f+d)/2,f=d),g>m&&(g=(m+g)/2,m=g);let _=rt(i[0],d,f),y=rt(i[1],g,m);if(o&&e&&n){const p=30*n;_+=-p*Math.log(1+Math.max(0,d-i[0])/p)+p*Math.log(1+Math.max(0,i[0]-f)/p),y+=-p*Math.log(1+Math.max(0,g-i[1])/p)+p*Math.log(1+Math.max(0,i[1]-m)/p)}return[_,y]})}function gd(s){return s}function _d(s){return Math.pow(s,3)}function wi(s){return 1-_d(1-s)}function md(s){return 3*s*s-2*s*s*s}function yd(s){return s}function _l(s,t,e,i){let n=0;const r=s[e-i],o=s[e-i+1];let a=0,l=0;for(;t<e;t+=i){const h=s[t]-r,c=s[t+1]-o;n+=l*h-a*c,a=h,l=c}return n/2}function ml(s,t,e,i){let n=0;for(let r=0,o=e.length;r<o;++r){const a=e[r];n+=_l(s,t,a,i),t=a}return n}function pd(s,t,e,i){let n=0;for(let r=0,o=e.length;r<o;++r){const a=e[r];n+=ml(s,t,a,i),t=a[a.length-1]}return n}function yl(s,t,e,i,n,r,o){const a=s[t],l=s[t+1],h=s[e]-a,c=s[e+1]-l;let u;if(h===0&&c===0)u=t;else{const d=((n-a)*h+(r-l)*c)/(h*h+c*c);if(d>1)u=e;else if(d>0){for(let f=0;f<i;++f)o[f]=Pt(s[t+f],s[e+f],d);o.length=i;return}else u=t}for(let d=0;d<i;++d)o[d]=s[u+d];o.length=i}function br(s,t,e,i,n){let r=s[t],o=s[t+1];for(t+=i;t<e;t+=i){const a=s[t],l=s[t+1],h=re(r,o,a,l);h>n&&(n=h),r=a,o=l}return n}function Dr(s,t,e,i,n){for(let r=0,o=e.length;r<o;++r){const a=e[r];n=br(s,t,a,i,n),t=a}return n}function xd(s,t,e,i,n){for(let r=0,o=e.length;r<o;++r){const a=e[r];n=Dr(s,t,a,i,n),t=a[a.length-1]}return n}function Or(s,t,e,i,n,r,o,a,l,h,c){if(t==e)return h;let u,d;if(n===0){if(d=re(o,a,s[t],s[t+1]),d<h){for(u=0;u<i;++u)l[u]=s[t+u];return l.length=i,d}return h}c=c||[NaN,NaN];let f=t+i;for(;f<e;)if(yl(s,f-i,f,i,o,a,c),d=re(o,a,c[0],c[1]),d<h){for(h=d,u=0;u<i;++u)l[u]=c[u];l.length=i,f+=i}else f+=i*Math.max((Math.sqrt(d)-Math.sqrt(h))/n|0,1);if(r&&(yl(s,e-i,t,i,o,a,c),d=re(o,a,c[0],c[1]),d<h)){for(h=d,u=0;u<i;++u)l[u]=c[u];l.length=i}return h}function kr(s,t,e,i,n,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=Or(s,t,f,i,n,r,o,a,l,h,c),t=f}return h}function Ed(s,t,e,i,n,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=kr(s,t,f,i,n,r,o,a,l,h,c),t=f[f.length-1]}return h}function pl(s,t,e,i){for(let n=0,r=e.length;n<r;++n)s[t++]=e[n];return t}function rs(s,t,e,i){for(let n=0,r=e.length;n<r;++n){const o=e[n];for(let a=0;a<i;++a)s[t++]=o[a]}return t}function dn(s,t,e,i,n){n=n||[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=rs(s,t,e[o],i);n[r++]=l,t=l}return n.length=r,n}function xl(s,t,e,i,n){n=n||[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=dn(s,t,e[o],i,n[r]);l.length===0&&(l[0]=t),n[r++]=l,t=l[l.length-1]}return n.length=r,n}class fn extends Fe{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 fn(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,n){return n<Ge(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(br(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Or(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,n))}getArea(){return _l(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Re(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=Kn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new fn(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=rs(this.flatCoordinates,0,t,this.stride),this.changed()}}class Kt extends Fe{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new Kt(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const r=this.flatCoordinates,o=re(t,e,r[0],r[1]);if(o<n){const a=this.stride;for(let l=0;l<a;++l)i[l]=r[l];return i.length=a,o}return n}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return ki(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return Ms(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=pl(this.flatCoordinates,0,t,this.stride),this.changed()}}function Cd(s,t,e,i,n){return!Go(n,function(o){return!Je(s,t,e,i,o[0],o[1])})}function Je(s,t,e,i,n,r){let o=0,a=s[e-i],l=s[e-i+1];for(;t<e;t+=i){const h=s[t],c=s[t+1];l<=r?c>r&&(h-a)*(r-l)-(n-a)*(c-l)>0&&o++:c<=r&&(h-a)*(r-l)-(n-a)*(c-l)<0&&o--,a=h,l=c}return o!==0}function Nr(s,t,e,i,n,r){if(e.length===0||!Je(s,t,e[0],i,n,r))return!1;for(let o=1,a=e.length;o<a;++o)if(Je(s,e[o-1],e[o],i,n,r))return!1;return!0}function wd(s,t,e,i,n,r){if(e.length===0)return!1;for(let o=0,a=e.length;o<a;++o){const l=e[o];if(Nr(s,t,l,i,n,r))return!0;t=l[l.length-1]}return!1}function Gr(s,t,e,i,n,r,o){let a,l,h,c,u,d,f;const g=n[r+1],m=[];for(let p=0,E=e.length;p<E;++p){const x=e[p];for(c=s[x-i],d=s[x-i+1],a=t;a<x;a+=i)u=s[a],f=s[a+1],(g<=d&&f<=g||d<=g&&g<=f)&&(h=(g-d)/(f-d)*(u-c)+c,m.push(h)),c=u,d=f}let _=NaN,y=-1/0;for(m.sort(Ne),c=m[0],a=1,l=m.length;a<l;++a){u=m[a];const p=Math.abs(u-c);p>y&&(h=(c+u)/2,Nr(s,t,e,i,h,g)&&(_=h,y=p)),c=u}return isNaN(_)&&(_=n[r]),o?(o.push(_,g,y),o):[_,g,y]}function El(s,t,e,i,n){let r=[];for(let o=0,a=e.length;o<a;++o){const l=e[o];r=Gr(s,t,l,i,n,2*o,r),t=l[l.length-1]}return r}function Cl(s,t,e,i,n){let r;for(t+=i;t<e;t+=i)if(r=n(s.slice(t-i,t),s.slice(t,t+i)),r)return r;return!1}function wl(s,t){const[e,i]=s,[n,r]=t,o=((e[0]-n[0])*(n[1]-r[1])-(e[1]-n[1])*(n[0]-r[0]))/((e[0]-i[0])*(n[1]-r[1])-(e[1]-i[1])*(n[0]-r[0])),a=((e[0]-n[0])*(e[1]-i[1])-(e[1]-n[1])*(e[0]-i[0]))/((e[0]-i[0])*(n[1]-r[1])-(e[1]-i[1])*(n[0]-r[0]));if(0<=o&&o<=1&&0<=a&&a<=1)return[e[0]+o*(i[0]-e[0]),e[1]+o*(i[1]-e[1])]}function os(s,t,e,i,n,r){return r=r??No(Ft(),s,t,e,i),dt(n,r)?r[0]>=n[0]&&r[2]<=n[2]||r[1]>=n[1]&&r[3]<=n[3]?!0:Cl(s,t,e,i,function(o,a){return Eh(n,o,a)}):!1}function Sd(s,t,e,i,n){for(let r=0,o=e.length;r<o;++r){if(os(s,t,e[r],i,n))return!0;t=e[r]}return!1}function Id(s,t,e,i,n){return!!(os(s,t,e,i,n)||Je(s,t,e,i,n[0],n[1])||Je(s,t,e,i,n[0],n[3])||Je(s,t,e,i,n[2],n[1])||Je(s,t,e,i,n[2],n[3]))}function Sl(s,t,e,i,n){if(!Id(s,t,e[0],i,n))return!1;if(e.length===1)return!0;for(let r=1,o=e.length;r<o;++r)if(Cd(s,e[r-1],e[r],i,n)&&!os(s,e[r-1],e[r],i,n))return!1;return!0}function Rd(s,t,e,i,n){for(let r=0,o=e.length;r<o;++r){const a=e[r];if(Sl(s,t,a,i,n))return!0;t=a[a.length-1]}return!1}function vd(s,t,e,i){for(;t<e-i;){for(let n=0;n<i;++n){const r=s[t+n];s[t+n]=s[e-i+n],s[e-i+n]=r}t+=i,e-=i}}function Wr(s,t,e,i){let n=0,r=s[e-i],o=s[e-i+1];for(;t<e;t+=i){const a=s[t],l=s[t+1];n+=(a-r)*(l+o),r=a,o=l}return n===0?void 0:n>0}function zr(s,t,e,i,n){n=n!==void 0?n:!1;for(let r=0,o=e.length;r<o;++r){const a=e[r],l=Wr(s,t,a,i);if(r===0){if(n&&l||!n&&!l)return!1}else if(n&&!l||!n&&l)return!1;t=a}return!0}function Il(s,t,e,i,n){for(let r=0,o=e.length;r<o;++r){const a=e[r];if(!zr(s,t,a,i,n))return!1;a.length&&(t=a[a.length-1])}return!0}function as(s,t,e,i,n){n=n!==void 0?n:!1;for(let r=0,o=e.length;r<o;++r){const a=e[r],l=Wr(s,t,a,i);(r===0?n&&l||!n&&!l:n&&!l||!n&&l)&&vd(s,t,a,i),t=a}return t}function jr(s,t,e,i,n){for(let r=0,o=e.length;r<o;++r)t=as(s,t,e[r],i,n);return t}function Td(s,t){const e=[];let i=0,n=0,r;for(let o=0,a=t.length;o<a;++o){const l=t[o],h=Wr(s,i,l,2);if(r===void 0&&(r=h),h===r)e.push(t.slice(n,o+1));else{if(e.length===0)continue;e[e.length-1].push(t[n])}n=o+1,i=l}return e}class Ut extends Fe{constructor(t,e,i){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,e!==void 0&&i?(this.setFlatCoordinates(e,t),this.ends_=i):this.setCoordinates(t,e)}appendLinearRing(t){this.flatCoordinates?At(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Ut(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<Ge(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Dr(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),kr(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,n))}containsXY(t,e){return Nr(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return ml(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),as(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,Ki(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=Ht(this.getExtent());this.flatInteriorPoint_=Gr(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Kt(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new fn(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,n=[];let r=0;for(let o=0,a=i.length;o<a;++o){const l=i[o],h=new fn(e.slice(r,l),t);n.push(h),r=l}return n}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;zr(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=as(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=pr(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new Ut(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return Sl(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=dn(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()}}function Rl(s){if(ni(s))throw new Error("Cannot create polygon from empty extent");const t=s[0],e=s[1],i=s[2],n=s[3],r=[t,e,t,n,i,n,i,e,t,e];return new Ut(r,"XY",[r.length])}function Pd(s,t,e){t=t||32;const i=s.getStride(),n=s.getLayout(),r=s.getCenter(),o=i*(t+1),a=new Array(o);for(let c=0;c<o;c+=i){a[c]=0,a[c+1]=0;for(let u=2;u<i;u++)a[c+u]=r[u]}const l=[a.length],h=new Ut(a,n,l);return Md(h,r,s.getRadius()),h}function Md(s,t,e,i){const n=s.getFlatCoordinates(),r=s.getStride(),o=n.length/r-1,a=0;for(let l=0;l<=o;++l){const h=l*r,c=a+si(l,o)*2*Math.PI/o;n[h]=t[0]+e*Math.cos(c),n[h+1]=t[1]+e*Math.sin(c)}s.changed()}function Xr(s,t,e,i){const n=U(t)/e[0],r=ct(t)/e[1];return i?Math.min(s,Math.max(n,r)):Math.min(s,Math.min(n,r))}function Vr(s,t,e){let i=Math.min(s,t);const n=50;return i*=Math.log(1+n*Math.max(0,s/t-1))/n+1,e&&(i=Math.max(i,e),i/=Math.log(1+n*Math.max(0,e/s-1))/n+1),rt(i,e/2,t*2)}function Ld(s,t,e,i){return t=t!==void 0?t:!0,(function(n,r,o,a){if(n!==void 0){const l=s[0],h=s[s.length-1],c=e?Xr(l,e,o,i):l;if(a)return t?Vr(n,c,h):rt(n,h,c);const u=Math.min(c,n),d=Math.floor(Ps(s,u,r));return s[d]>c&&d<s.length-1?s[d+1]:s[d]}})}function Ad(s,t,e,i,n,r){return i=i!==void 0?i:!0,e=e!==void 0?e:0,(function(o,a,l,h){if(o!==void 0){const c=n?Xr(t,n,l,r):t;if(h)return i?Vr(o,c,e):rt(o,e,c);const u=1e-9,d=Math.ceil(Math.log(t/c)/Math.log(s)-u),f=-a*(.5-u)+.5,g=Math.min(c,o),m=Math.floor(Math.log(t/g)/Math.log(s)+f),_=Math.max(d,m),y=t/Math.pow(s,_);return rt(y,e,c)}})}function vl(s,t,e,i,n){return e=e!==void 0?e:!0,(function(r,o,a,l){if(r!==void 0){const h=i?Xr(s,i,a,n):s;return!e||!l?rt(r,t,h):Vr(r,h,t)}})}function Br(s){if(s!==void 0)return 0}function Tl(s){if(s!==void 0)return s}function Fd(s){const t=2*Math.PI/s;return(function(e,i){if(i)return e;if(e!==void 0)return e=Math.floor(e/t+.5)*t,e})}function bd(s){const t=we(5);return(function(e,i){return i||e===void 0?e:Math.abs(e)<=t?0:e})}const Dd=256,Yr=0;class Jt extends jt{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=qs(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&&rc(),t.center&&(t.center=Z(t.center,this.projection_)),t.extent&&(t.extent=Ie(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const a in Yt)delete e[a];this.setProperties(e,!0);const i=kd(t);this.maxResolution_=i.maxResolution,this.minResolution_=i.minResolution,this.zoomFactor_=i.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=i.minZoom;const n=Od(t),r=i.constraint,o=Nd(t);this.constraints_={center:n,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 i=this.getCenterInternal();if(i){const n=t||[0,0,0,0];e=e||[0,0,0,0];const r=this.getResolution(),o=r/2*(n[3]-e[3]+e[1]-n[1]),a=r/2*(n[0]-e[0]+e[2]-n[2]);this.setCenterInternal([i[0]+o,i[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 i=0;i<e.length;++i){let n=arguments[i];n.center&&(n=Object.assign({},n),n.center=Z(n.center,this.getProjection())),n.anchor&&(n=Object.assign({},n),n.anchor=Z(n.anchor,this.getProjection())),e[i]=n}this.animateInternal.apply(this,e)}animateInternal(t){let e=arguments.length,i;e>1&&typeof arguments[e-1]=="function"&&(i=arguments[e-1],--e);let n=0;for(;n<e&&!this.isDef();++n){const c=arguments[n];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(n===e){i&&ls(i,!0);return}let r=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_;const h=[];for(;n<e;++n){const c=arguments[n],u={start:r,complete:!1,anchor:c.anchor,duration:c.duration!==void 0?c.duration:1e3,easing:c.easing||md,callback:i};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=si(c.rotation-l+Math.PI,2*Math.PI)-Math.PI;u.targetRotation=l+d,l=u.targetRotation}Gd(u)?u.complete=!0:r+=u.duration,h.push(u)}this.animations_.push(h),this.setHint(J.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[J.ANIMATING]>0}getInteracting(){return this.hints_[J.INTERACTING]>0}cancelAnimations(){this.setHint(J.ANIMATING,-this.hints_[J.ANIMATING]);let t;for(let e=0,i=this.animations_.length;e<i;++e){const n=this.animations_[e];if(n[0].callback&&ls(n[0].callback,!1),!t)for(let r=0,o=n.length;r<o;++r){const a=n[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 i=this.animations_.length-1;i>=0;--i){const n=this.animations_[i];let r=!0;for(let o=0,a=n.length;o<a;++o){const l=n[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],m=l.targetCenter[1];this.nextCenter_=l.targetCenter;const _=d+u*(g-d),y=f+u*(m-f);this.targetCenter_=[_,y]}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?si(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+u*(l.targetRotation-l.sourceRotation);if(l.anchor){const f=this.constraints_.rotation(d,!0);this.targetCenter_=this.calculateCenterRotate(f,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=d}if(this.applyTargetState_(!0),e=!0,!l.complete)break}if(r){this.animations_[i]=null,this.setHint(J.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const o=n[0].callback;o&&ls(o,!0)}}this.animations_=this.animations_.filter(Boolean),e&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const n=this.getCenterInternal();return n!==void 0&&(i=[n[0]-e[0],n[1]-e[1]],Gs(i,t-this.getRotation()),Ih(i,e)),i}calculateCenterZoom(t,e){let i;const n=this.getCenterInternal(),r=this.getResolution();if(n!==void 0&&r!==void 0){const o=e[0]-t*(e[0]-n[0])/r,a=e[1]-t*(e[1]-n[1])/r;i=[o,a]}return i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],n=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(n*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t&&Se(t,this.getProjection())}getCenterInternal(){return this.get(Yt.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 Wn(e,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();it(e,"The view center is not defined");const i=this.getResolution();it(i!==void 0,"The view resolution is not defined");const n=this.getRotation();return it(n!==void 0,"The view rotation is not defined"),Tn(e,i,n,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(Yt.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(Ie(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=U(t)/e[0],n=ct(t)/e[1];return Math.max(i,n)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,n=Math.log(e/i)/Math.log(t);return(function(r){return e/Math.pow(t,r*n)})}getRotation(){return this.get(Yt.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(i/n)/e;return(function(o){return Math.log(i/o)/e/r})}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let n=this.getCenterInternal();const r=this.padding_;if(r){const o=this.getViewportSizeMinusPadding_();n=Kr(n,this.getViewportSize_(),[o[0]/2+r[3],o[1]/2+r[0]],e,i)}return{center:n.slice(0),projection:t!==void 0?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return e!==void 0&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e=this.minZoom_||0,i,n;if(this.resolutions_){const r=Ps(this.resolutions_,t,1);e=r,i=this.resolutions_[r],r==this.resolutions_.length-1?n=2:n=i/this.resolutions_[r+1]}else i=this.maxResolution_,n=this.zoomFactor_;return e+Math.log(i/t)/Math.log(n)}getResolutionForZoom(t){var e;if((e=this.resolutions_)!=null&&e.length){if(this.resolutions_.length===1)return this.resolutions_[0];const i=rt(Math.floor(t),0,this.resolutions_.length-2),n=this.resolutions_[i]/this.resolutions_[i+1];return this.resolutions_[i]/Math.pow(n,rt(t-i,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(it(Array.isArray(t)||typeof t.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){it(!ni(t),"Cannot fit empty extent provided as `geometry`");const n=Ie(t,this.getProjection());i=Rl(n)}else if(t.getType()==="Circle"){const n=Ie(t.getExtent(),this.getProjection());i=Rl(n),i.rotate(this.getRotation(),Ht(n))}else i=t;this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),n=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]*i-r[u+1]*n,g=r[u]*n+r[u+1]*i;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 i=e.size;i||(i=this.getViewportSizeMinusPadding_());const n=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,[i[0]-n[1]-n[3],i[1]-n[0]-n[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=Ht(a);d[0]+=(n[1]-n[3])/2*l,d[1]+=(n[0]-n[2])/2*l;const f=d[0]*u-d[1]*c,g=d[1]*u+d[0]*c,m=this.getConstrainedCenter([f,g],l),_=e.callback?e.callback:Bi;e.duration!==void 0?this.animateInternal({resolution:l,center:m,duration:e.duration,easing:e.easing},_):(this.targetResolution_=l,this.targetCenter_=m,this.applyTargetState_(!1,!0),ls(_,!0))}centerOn(t,e,i){this.centerOnInternal(Z(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(Kr(t,e,i,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,i,n){let r;const o=this.padding_;if(o&&t){const a=this.getViewportSizeMinusPadding_(-i),l=Kr(t,n,[a[0]/2+o[3],a[1]/2+o[0]],e,i);r=[t[0]-l[0],t[1]-l[1]]}return r}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(t){const e=Se(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&&Z(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.getViewportSize_(this.getRotation()),r=this.constraints_.resolution(this.targetResolution_*t,0,n,i);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=Z(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.constraints_.rotation(this.targetRotation_+t,i);e&&(this.targetCenter_=this.calculateCenterRotate(n,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t&&Z(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 i=this.getAnimating()||this.getInteracting()||e,n=this.constraints_.rotation(this.targetRotation_,i),r=this.getViewportSize_(n),o=this.constraints_.resolution(this.targetResolution_,0,r,i),a=this.constraints_.center(this.targetCenter_,o,r,i,this.calculateCenterShift(this.targetCenter_,o,n,r));this.get(Yt.ROTATION)!==n&&this.set(Yt.ROTATION,n),this.get(Yt.RESOLUTION)!==o&&(this.set(Yt.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(Yt.CENTER)||!Et(this.get(Yt.CENTER),a))&&this.set(Yt.CENTER,a),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,i){t=t!==void 0?t:200;const n=e||0,r=this.constraints_.rotation(this.targetRotation_),o=this.getViewportSize_(r),a=this.constraints_.resolution(this.targetResolution_,n,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}i=i||(t===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==r||!this.getCenterInternal()||!Et(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:r,center:l,resolution:a,duration:t,easing:wi,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(J.INTERACTING,1)}endInteraction(t,e,i){i=i&&Z(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(J.INTERACTING,-1),this.resolveConstraints(t,e,i))}getConstrainedCenter(t,e){const i=this.getViewportSize_(this.getRotation());return this.constraints_.center(t,e||this.getResolution(),i)}getConstrainedZoom(t,e){const i=this.getResolutionForZoom(t);return this.getZoomForResolution(this.getConstrainedResolution(i,e))}getConstrainedResolution(t,e){e=e||0;const i=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(t,e,i)}}function ls(s,t){setTimeout(function(){s(t)},0)}function Od(s){if(s.extent!==void 0){const e=s.smoothExtentConstraint!==void 0?s.smoothExtentConstraint:!0;return gl(s.extent,s.constrainOnlyCenter,e)}const t=qs(s.projection,"EPSG:3857");if(s.multiWorld!==!0&&t.isGlobal()){const e=t.getExtent().slice();return e[0]=-1/0,e[2]=1/0,gl(e,!1,!1)}return gd}function kd(s){let t,e,i,o=s.minZoom!==void 0?s.minZoom:Yr,a=s.maxZoom!==void 0?s.maxZoom:28;const l=s.zoomFactor!==void 0?s.zoomFactor:2,h=s.multiWorld!==void 0?s.multiWorld:!1,c=s.smoothResolutionConstraint!==void 0?s.smoothResolutionConstraint:!0,u=s.showFullExtent!==void 0?s.showFullExtent:!1,d=qs(s.projection,"EPSG:3857"),f=d.getExtent();let g=s.constrainOnlyCenter,m=s.extent;if(!h&&!m&&d.isGlobal()&&(g=!1,m=f),s.resolutions!==void 0){const _=s.resolutions;e=_[o],i=_[a]!==void 0?_[a]:_[_.length-1],s.constrainResolution?t=Ld(_,c,!g&&m,u):t=vl(e,i,c,!g&&m,u)}else{const y=(f?Math.max(U(f),ct(f)):360*Zo.degrees/d.getMetersPerUnit())/Dd/Math.pow(2,Yr),p=y/Math.pow(2,28-Yr);e=s.maxResolution,e!==void 0?o=0:e=y/Math.pow(l,o),i=s.minResolution,i===void 0&&(s.maxZoom!==void 0?s.maxResolution!==void 0?i=e/Math.pow(l,a):i=y/Math.pow(l,a):i=p),a=o+Math.floor(Math.log(e/i)/Math.log(l)),i=e/Math.pow(l,a-o),s.constrainResolution?t=Ad(l,e,i,c,!g&&m,u):t=vl(e,i,c,!g&&m,u)}return{constraint:t,maxResolution:e,minResolution:i,minZoom:o,zoomFactor:l}}function Nd(s){if(s.enableRotation!==void 0?s.enableRotation:!0){const e=s.constrainRotation;return e===void 0||e===!0?bd():e===!1?Tl:typeof e=="number"?Fd(e):Tl}return Br}function Gd(s){return!(s.sourceCenter&&s.targetCenter&&!Et(s.sourceCenter,s.targetCenter)||s.sourceResolution!==s.targetResolution||s.sourceRotation!==s.targetRotation)}function Kr(s,t,e,i,n){const r=Math.cos(-n);let o=Math.sin(-n),a=s[0]*r-s[1]*o,l=s[1]*r+s[0]*o;a+=(t[0]/2-e[0])*i,l+=(e[1]-t[1]/2)*i,o=-o;const h=a*r-l*o,c=l*r+a*o;return[h,c]}const H={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 Pl extends jt{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[H.OPACITY]=t.opacity!==void 0?t.opacity:1,it(typeof e[H.OPACITY]=="number","Layer opacity must be a number"),e[H.VISIBLE]=t.visible!==void 0?t.visible:!0,e[H.Z_INDEX]=t.zIndex,e[H.MAX_RESOLUTION]=t.maxResolution!==void 0?t.maxResolution:1/0,e[H.MIN_RESOLUTION]=t.minResolution!==void 0?t.minResolution:0,e[H.MIN_ZOOM]=t.minZoom!==void 0?t.minZoom:-1/0,e[H.MAX_ZOOM]=t.maxZoom!==void 0?t.maxZoom:1/0,this.className_=e.className!==void 0?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:t===void 0?!0:t},i=this.getZIndex();return e.opacity=rt(Math.round(this.getOpacity()*100)/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=i===void 0&&!e.managed?1/0:i,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return O()}getLayerStatesArray(t){return O()}getExtent(){return this.get(H.EXTENT)}getMaxResolution(){return this.get(H.MAX_RESOLUTION)}getMinResolution(){return this.get(H.MIN_RESOLUTION)}getMinZoom(){return this.get(H.MIN_ZOOM)}getMaxZoom(){return this.get(H.MAX_ZOOM)}getOpacity(){return this.get(H.OPACITY)}getSourceState(){return O()}getVisible(){return this.get(H.VISIBLE)}getZIndex(){return this.get(H.Z_INDEX)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(H.EXTENT,t)}setMaxResolution(t){this.set(H.MAX_RESOLUTION,t)}setMinResolution(t){this.set(H.MIN_RESOLUTION,t)}setMaxZoom(t){this.set(H.MAX_ZOOM,t)}setMinZoom(t){this.set(H.MIN_ZOOM,t)}setOpacity(t){it(typeof t=="number","Layer opacity must be a number"),this.set(H.OPACITY,t)}setVisible(t){this.set(H.VISIBLE,t)}setZIndex(t){this.set(H.Z_INDEX,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}class hs extends Pl{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(H.SOURCE,this.handleSourcePropertyChange_);const i=t.source?t.source:null;this.setSource(i)}getLayersArray(t){return t=t||[],t.push(this),t}getLayerStatesArray(t){return t=t||[],t.push(this.getLayerState()),t}getSource(){return this.get(H.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_&&($(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=W(t,D.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 i=this.getMapInternal();!t&&i&&(t=i.getView()),t instanceof Jt?e={viewState:t.getState(),extent:t.calculateExtent()}:e=t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray());let n;if(e.layerStatesArray){if(n=e.layerStatesArray.find(o=>o.layer===this),!n)return!1}else n=this.getLayerState();const r=this.getExtent();return Ur(n,e.viewState)&&(!r||dt(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 i=t instanceof Jt?t.getViewStateAndExtent():t;let n=e(i);return Array.isArray(n)||(n=[n]),n}render(t,e){const i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(t,e){}renderDeferred(t){const e=this.getRenderer();e&&e.renderDeferred(t)}setMapInternal(t){t||this.unrender(),this.set(H.MAP,t)}getMapInternal(){return this.get(H.MAP)}setMap(t){this.mapPrecomposeKey_&&($(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&($(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=W(t,Dt.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=W(this,D.CHANGE,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);it(!e.some(n=>n.layer===i.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(i)}setSource(t){this.set(H.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 Ur(s,t){if(!s.visible)return!1;const e=t.resolution;if(e<s.minResolution||e>=s.maxResolution)return!1;const i=t.zoom;return i>s.minZoom&&i<=s.maxZoom}const Ml={RENDER_ORDER:"renderOrder"};class Ll extends hs{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(Ml.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){const i=this.getDeclutter();i in t.declutter||(t.declutter[i]=new Ja(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(Ml.RENDER_ORDER,t)}setStyle(t){this.style_=t===void 0?Wa:t;const e=Wd(t);this.styleFunction_=t===null?void 0:iu(e),this.changed()}setDeclutter(t){this.declutter_=t?String(t):void 0,this.changed()}}function Wd(s){if(s===void 0)return Wa;if(!s)return null;if(typeof s=="function"||s instanceof Mt)return s;if(!Array.isArray(s))return ol([s]);if(s.length===0)return[];const t=s.length,e=s[0];if(e instanceof Mt){const n=new Array(t);for(let r=0;r<t;++r){const o=s[r];if(!(o instanceof Mt))throw new Error("Expected a list of style instances");n[r]=o}return n}if("style"in e){const n=new Array(t);for(let r=0;r<t;++r){const o=s[r];if(!("style"in o))throw new Error("Expected a list of rules with a style property");n[r]=o}return ed(n)}return ol(s)}class cs extends Ll{constructor(t){super(t)}createRenderer(){return new Su(this)}}const nt={ADD:"add",REMOVE:"remove"},Al={LENGTH:"length"};class us extends St{constructor(t,e,i){super(t),this.element=e,this.index=i}}class _t extends jt{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t||[],this.unique_)for(let i=0,n=this.array_.length;i<n;++i)this.assertUnique_(this.array_[i],i);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(t){for(let e=0,i=t.length;e<i;++e)this.push(t[e]);return this}forEach(t){const e=this.array_;for(let i=0,n=e.length;i<n;++i)t(e[i],i,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(Al.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 us(nt.ADD,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){this.unique_&&this.assertUnique_(t);const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,n=e.length;i<n;++i)if(e[i]===t)return this.removeAt(i)}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 us(nt.REMOVE,e,t)),e}setAt(t,e){const i=this.getLength();if(t>=i){this.insertAt(t,e);return}if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const n=this.array_[t];this.array_[t]=e,this.dispatchEvent(new us(nt.REMOVE,n,t)),this.dispatchEvent(new us(nt.ADD,e,t))}updateLength_(){this.set(Al.LENGTH,this.array_.length)}assertUnique_(t,e){for(let i=0,n=this.array_.length;i<n;++i)if(this.array_[i]===t&&i!==e)throw new Error("Duplicate item added to a unique collection")}}let zd=!1;function jd(s,t,e,i,n,r,o){const a=new XMLHttpRequest;a.open("GET",typeof s=="function"?s(e,i,n):s,!0),t.getType()=="arraybuffer"&&(a.responseType="arraybuffer"),a.withCredentials=zd,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:n}),t.readProjection(c)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function Fl(s,t){return function(e,i,n,r,o){jd(s,t,e,i,n,(a,l)=>{this.addFeatures(a),r!==void 0&&r(a)},()=>{this.changed(),o!==void 0&&o()})}}function Xd(s,t){return[[-1/0,-1/0,1/0,1/0]]}class Tt extends jt{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 Tt(this.hasProperties()?this.getProperties():null);t.setGeometryName(this.getGeometryName());const e=this.getGeometry();e&&t.setGeometry(e.clone());const i=this.getStyle();return i&&t.setStyle(i),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&($(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=W(t,D.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?Vd(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 Vd(s){if(typeof s=="function")return s;let t;return Array.isArray(s)?t=s:(it(typeof s.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),t=[s]),function(){return t}}function bl(s,t,e,i){const n=[];let r=Ft();for(let o=0,a=e.length;o<a;++o){const l=e[o];r=As(s,t,l[0],i),n.push((r[0]+r[2])/2,(r[1]+r[3])/2),t=l[l.length-1]}return n}function ds(s,t,e,i,n,r,o){let a,l;const h=(e-t)/i;if(h===1)a=t;else if(h===2)a=t,l=n;else if(h!==0){let c=s[t],u=s[t+1],d=0;const f=[0];for(let _=t+i;_<e;_+=i){const y=s[_],p=s[_+1];d+=Math.sqrt((y-c)*(y-c)+(p-u)*(p-u)),f.push(d),c=y,u=p}const g=n*d,m=ii(f,g);m<0?(l=(g-f[-m-2])/(f[-m-1]-f[-m-2]),a=t+(-m-2)*i):a=t+m*i}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?s[a+c]:Pt(s[a+c],s[a+i+c],l);return r}function Zr(s,t,e,i,n,r){if(e==t)return null;let o;if(n<s[t+i-1])return r?(o=s.slice(t,t+i),o[i-1]=n,o):null;if(s[e-1]<n)return r?(o=s.slice(e-i,e),o[i-1]=n,o):null;if(n==s[t+i-1])return s.slice(t,t+i);let a=t/i,l=e/i;for(;a<l;){const d=a+l>>1;n<s[(d+1)*i-1]?l=d:a=d+1}const h=s[a*i-1];if(n==h)return s.slice((a-1)*i,(a-1)*i+i);const c=s[(a+1)*i-1],u=(n-h)/(c-h);o=[];for(let d=0;d<i-1;++d)o.push(Pt(s[(a-1)*i+d],s[a*i+d],u));return o.push(n),o}function Bd(s,t,e,i,n,r,o){if(o)return Zr(s,t,e[e.length-1],i,n,r);let a;if(n<s[i-1])return r?(a=s.slice(0,i),a[i-1]=n,a):null;if(s[s.length-1]<n)return r?(a=s.slice(s.length-i),a[i-1]=n,a):null;for(let l=0,h=e.length;l<h;++l){const c=e[l];if(t!=c){if(n<s[t+i-1])return null;if(n<=s[c-1])return Zr(s,t,c,i,n,!1);t=c}}return null}class fs extends Fe{constructor(t,e,i){super(),i!==void 0&&e===void 0?this.setFlatCoordinates(i,t):(e=e||0,this.setCenterAndRadius(t,e,i))}clone(){const t=new fs(this.flatCoordinates.slice(),void 0,this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const r=this.flatCoordinates,o=t-r[0],a=e-r[1],l=o*o+a*a;if(l<n){if(l===0)for(let h=0;h<this.stride;++h)i[h]=r[h];else{const h=this.getRadius()/Math.sqrt(l);i[0]=r[0]+h*o,i[1]=r[1]+h*a;for(let c=2;c<this.stride;++c)i[c]=r[c]}return i.length=this.stride,l}return n}containsXY(t,e){const i=this.flatCoordinates,n=t-i[0],r=e-i[1];return n*n+r*r<=this.getRadiusSquared_()}getCenter(){return this.flatCoordinates.slice(0,this.stride)}computeExtent(t){const e=this.flatCoordinates,i=e[this.stride]-e[0];return We(e[0]-i,e[1]-i,e[0]+i,e[1]+i,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(dt(t,e)){const i=this.getCenter();return t[0]<=i[0]&&t[2]>=i[0]||t[1]<=i[1]&&t[3]>=i[1]?!0:Go(t,this.intersectsCoordinate.bind(this))}return!1}setCenter(t){const e=this.stride,i=this.flatCoordinates[e]-this.flatCoordinates[0],n=t.slice();n[e]=n[0]+i;for(let r=1;r<e;++r)n[e+r]=t[r];this.setFlatCoordinates(this.layout,n),this.changed()}setCenterAndRadius(t,e,i){this.setLayout(i,t,0),this.flatCoordinates||(this.flatCoordinates=[]);const n=this.flatCoordinates;let r=pl(n,0,t,this.stride);n[r++]=n[0]+e;for(let o=1,a=this.stride;o<a;++o)n[r++]=n[o];n.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 i=this.getCenter(),n=this.getStride();this.setCenter(xr(i,0,i.length,n,t,e,i)),this.changed()}}fs.prototype.transform;class gn extends Xa{constructor(t){super(),this.geometries_=t,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach($),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const t=this.geometries_;for(let e=0,i=t.length;e<i;++e)this.changeEventsKeys_.push(W(t[e],D.CHANGE,this.changed,this))}clone(){const t=new gn(Hr(this.geometries_));return t.applyProperties(this),t}closestPointXY(t,e,i,n){if(n<Ge(this.getExtent(),t,e))return n;const r=this.geometries_;for(let o=0,a=r.length;o<a;++o)n=r[o].closestPointXY(t,e,i,n);return n}containsXY(t,e){const i=this.geometries_;for(let n=0,r=i.length;n<r;++n)if(i[n].containsXY(t,e))return!0;return!1}computeExtent(t){Oi(t);const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)ko(t,e[i].getExtent());return t}getGeometries(){return Hr(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let t=[];const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)e[i].getType()===this.getType()?t=t.concat(e[i].getGeometriesArrayRecursive()):t.push(e[i]);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=[],i=this.geometries_;let n=!1;for(let r=0,o=i.length;r<o;++r){const a=i[r],l=a.getSimplifiedGeometry(t);e.push(l),l!==a&&(n=!0)}return n?new gn(e):(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getType(){return"GeometryCollection"}intersectsExtent(t){const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)if(e[i].intersectsExtent(t))return!0;return!1}isEmpty(){return this.geometries_.length===0}rotate(t,e){const i=this.geometries_;for(let n=0,r=i.length;n<r;++n)i[n].rotate(t,e);this.changed()}scale(t,e,i){i||(i=Ht(this.getExtent()));const n=this.geometries_;for(let r=0,o=n.length;r<o;++r)n[r].scale(t,e,i);this.changed()}setGeometries(t){this.setGeometriesArray(Hr(t))}setGeometriesArray(t){this.unlistenGeometriesChange_(),this.geometries_=t,this.listenGeometriesChange_(),this.changed()}applyTransform(t){const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)e[i].applyTransform(t);this.changed()}translate(t,e){const i=this.geometries_;for(let n=0,r=i.length;n<r;++n)i[n].translate(t,e);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}}function Hr(s){return s.map(t=>t.clone())}class Qt extends Fe{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){At(this.flatCoordinates,t),this.changed()}clone(){const t=new Qt(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<Ge(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(br(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Or(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,e,i,n))}forEachSegment(t){return Cl(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,Zr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e))}getCoordinates(){return Re(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return ds(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return Er(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=Kn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new Qt(e,"XY")}getType(){return"LineString"}intersectsExtent(t){return os(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=rs(this.flatCoordinates,0,t,this.stride),this.changed()}}class Si extends Fe{constructor(t,e,i){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(t[0]))this.setCoordinates(t,e);else if(e!==void 0&&i)this.setFlatCoordinates(e,t),this.ends_=i;else{const n=t,r=[],o=[];for(let l=0,h=n.length;l<h;++l){const c=n[l];At(r,c.getFlatCoordinates()),o.push(r.length)}const a=n.length===0?this.getLayout():n[0].getLayout();this.setFlatCoordinates(a,r),this.ends_=o}}appendLineString(t){At(this.flatCoordinates,t.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Si(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<Ge(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Dr(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),kr(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,t,e,i,n))}getCoordinateAtM(t,e,i){return this.layout!="XYM"&&this.layout!="XYZM"||this.flatCoordinates.length===0?null:(e=e!==void 0?e:!1,i=i!==void 0?i:!1,Bd(this.flatCoordinates,0,this.ends_,this.stride,t,e,i))}getCoordinates(){return Ki(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(t){return t<0||this.ends_.length<=t?null:new Qt(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLineStrings(){const t=this.flatCoordinates,e=this.ends_,i=this.layout,n=[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o],h=new Qt(t.slice(r,l),i);n.push(h),r=l}return n}getLength(){const t=this.ends_;let e=0,i=0;for(let n=0,r=t.length;n<r;++n)i+=Er(this.flatCoordinates,e,t[n],this.stride),e=t[n];return i}getFlatMidpoints(){const t=[],e=this.flatCoordinates;let i=0;const n=this.ends_,r=this.stride;for(let o=0,a=n.length;o<a;++o){const l=n[o],h=ds(e,i,l,r,.5);At(t,h),i=l}return t}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=Ma(this.flatCoordinates,0,this.ends_,this.stride,t,e,0,i),new Si(e,"XY",i)}getType(){return"MultiLineString"}intersectsExtent(t){return Sd(this.flatCoordinates,0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=dn(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()}}class _n extends Fe{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){At(this.flatCoordinates,t.getFlatCoordinates()),this.changed()}clone(){const t=new _n(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){if(n<Ge(this.getExtent(),t,e))return n;const r=this.flatCoordinates,o=this.stride;for(let a=0,l=r.length;a<l;a+=o){const h=re(t,e,r[a],r[a+1]);if(h<n){n=h;for(let c=0;c<o;++c)i[c]=r[a+c];i.length=o}}return n}getCoordinates(){return Re(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){const e=this.flatCoordinates.length/this.stride;return t<0||e<=t?null:new Kt(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)}getPoints(){const t=this.flatCoordinates,e=this.layout,i=this.stride,n=[];for(let r=0,o=t.length;r<o;r+=i){const a=new Kt(t.slice(r,r+i),e);n.push(a)}return n}getType(){return"MultiPoint"}intersectsExtent(t){const e=this.flatCoordinates,i=this.stride;for(let n=0,r=e.length;n<r;n+=i){const o=e[n],a=e[n+1];if(Ms(t,o,a))return!0}return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=rs(this.flatCoordinates,0,t,this.stride),this.changed()}}class Ii extends Fe{constructor(t,e,i){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!i&&!Array.isArray(t[0])){const n=t,r=[],o=[];for(let a=0,l=n.length;a<l;++a){const h=n[a],c=r.length,u=h.getEnds();for(let d=0,f=u.length;d<f;++d)u[d]+=c;At(r,h.getFlatCoordinates()),o.push(u)}e=n.length===0?this.getLayout():n[0].getLayout(),t=r,i=o}e!==void 0&&i?(this.setFlatCoordinates(e,t),this.endss_=i):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 i=this.flatCoordinates.length;At(this.flatCoordinates,t.getFlatCoordinates()),e=t.getEnds().slice();for(let n=0,r=e.length;n<r;++n)e[n]+=i}this.endss_.push(e),this.changed()}clone(){const t=this.endss_.length,e=new Array(t);for(let n=0;n<t;++n)e[n]=this.endss_[n].slice();const i=new Ii(this.flatCoordinates.slice(),this.layout,e);return i.applyProperties(this),i}closestPointXY(t,e,i,n){return n<Ge(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(xd(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Ed(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,t,e,i,n))}containsXY(t,e){return wd(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t,e)}getArea(){return pd(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),jr(e,0,this.endss_,this.stride,t)):e=this.flatCoordinates,fr(e,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const t=bl(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=El(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new _n(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;Il(t,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=jr(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=kc(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),e,0,i),new Ii(e,"XY",i)}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 i=this.endss_[t].slice(),n=i[i.length-1];if(e!==0)for(let r=0,o=i.length;r<o;++r)i[r]-=e;return new Ut(this.flatCoordinates.slice(e,n),this.layout,i)}getPolygons(){const t=this.layout,e=this.flatCoordinates,i=this.endss_,n=[];let r=0;for(let o=0,a=i.length;o<a;++o){const l=i[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 Ut(e.slice(r,h),t,l);n.push(c),r=h}return n}getType(){return"MultiPolygon"}intersectsExtent(t){return Rd(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,3),this.flatCoordinates||(this.flatCoordinates=[]);const i=xl(this.flatCoordinates,0,t,this.stride,this.endss_);if(i.length===0)this.flatCoordinates.length=0;else{const n=i[i.length-1];this.flatCoordinates.length=n.length===0?0:n[n.length-1]}this.changed()}}const Dl=Xt();class Lt{constructor(t,e,i,n,r,o){this.styleFunction,this.extent_,this.id_=o,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i||null,this.properties_=r,this.squaredTolerance_,this.stride_=n,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?ki(this.flatCoordinates_):As(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=Ht(this.getExtent());this.flatInteriorPoints_=Gr(this.flatCoordinates_,0,this.ends_,2,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=Td(this.flatCoordinates_,this.ends_),e=bl(this.flatCoordinates_,0,t,2);this.flatInteriorPoints_=El(this.flatCoordinates_,0,t,2,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=ds(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const t=this.flatCoordinates_;let e=0;const i=this.ends_;for(let n=0,r=i.length;n<r;++n){const o=i[n],a=ds(t,e,o,2,.5);At(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=ot(t);const e=t.getExtent(),i=t.getWorldExtent();if(e&&i){const n=ct(i)/ct(e);he(Dl,i[0],i[3],n,-n,0,0,0),Te(this.flatCoordinates_,0,this.flatCoordinates_.length,2,Dl,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){var t;return new Lt(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=fa((t,e)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);const i=this.simplifiedGeometry_.getFlatCoordinates();let n;switch(this.type_){case"LineString":i.length=Kn(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),n=[i.length];break;case"MultiLineString":n=[],i.length=Ma(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,n);break;case"Polygon":n=[],i.length=pr(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,n);break}return n&&(this.simplifiedGeometry_=new Lt(this.type_,i,n,2,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}}Lt.prototype.getFlatCoordinates=Lt.prototype.getOrientedFlatCoordinates;class gs{constructor(t){this.rbush_=new Ja(t),this.items_={}}insert(t,e){const i={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(i),this.items_[V(e)]=i}load(t,e){const i=new Array(e.length);for(let n=0,r=e.length;n<r;n++){const o=t[n],a=e[n],l={minX:o[0],minY:o[1],maxX:o[2],maxY:o[3],value:a};i[n]=l,this.items_[V(a)]=l}this.rbush_.load(i)}remove(t){const e=V(t),i=this.items_[e];return delete this.items_[e],this.rbush_.remove(i)!==null}update(t,e){const i=this.items_[V(e)],n=[i.minX,i.minY,i.maxX,i.maxY];Ni(n,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(n){return n.value})}forEach(t){return this.forEach_(this.getAll(),t)}forEachInExtent(t,e){return this.forEach_(this.getInExtent(t),e)}forEach_(t,e){let i;for(let n=0,r=t.length;n<r;n++)if(i=e(t[n]),i)return i;return i}isEmpty(){return Xe(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return We(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]}}class Ol extends jt{constructor(t){super(),this.projection=ot(t.projection),this.attributions_=kl(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(i,n){e.viewResolver=i,e.viewRejector=n})}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_=kl(t),this.changed()}setState(t){this.state_=t,this.changed()}}function kl(s){return s?typeof s=="function"?s:(Array.isArray(s)||(s=[s]),t=>s):null}const mt={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};class De extends St{constructor(t,e,i){super(t),this.feature=e,this.features=i}}class qr extends Ol{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_=Bi,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&&(it(this.format_,"`format` must be set when `url` is set"),this.loader_=Fl(this.url_,this.format_)),this.strategy_=t.strategy!==void 0?t.strategy:Xd;const e=t.useSpatialIndex!==void 0?t.useSpatialIndex:!0;this.featuresRtree_=e?new gs:null,this.loadedExtentsRtree_=new gs,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let i,n;Array.isArray(t.features)?n=t.features:t.features&&(i=t.features,n=i.getArray()),!e&&i===void 0&&(i=new _t(n)),n!==void 0&&this.addFeaturesInternal(n),i!==void 0&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=V(t);if(!this.addToIndex_(e,t)){this.featuresCollection_&&this.featuresCollection_.remove(t);return}this.setupChangeEvents_(e,t);const i=t.getGeometry();if(i){const n=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(n,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new De(mt.ADDFEATURE,t))}setupChangeEvents_(t,e){e instanceof Lt||(this.featureChangeKeys_[t]=[W(e,D.CHANGE,this.handleFeatureChange_,this),W(e,ui.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(t,e){let i=!0;if(e.getId()!==void 0){const n=String(e.getId());if(!(n in this.idIndex_))this.idIndex_[n]=e;else if(e instanceof Lt){const r=this.idIndex_[n];r instanceof Lt?Array.isArray(r)?r.push(e):this.idIndex_[n]=[r,e]:i=!1}else i=!1}return i&&(it(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],i=[],n=[];for(let r=0,o=t.length;r<o;r++){const a=t[r],l=V(a);this.addToIndex_(l,a)&&i.push(a)}for(let r=0,o=i.length;r<o;r++){const a=i[r],l=V(a);this.setupChangeEvents_(l,a);const h=a.getGeometry();if(h){const c=h.getExtent();e.push(c),n.push(a)}else this.nullGeometryFeatures_[l]=a}if(this.featuresRtree_&&this.featuresRtree_.load(e,n),this.hasListener(mt.ADDFEATURE))for(let r=0,o=i.length;r<o;r++)this.dispatchEvent(new De(mt.ADDFEATURE,i[r]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(mt.ADDFEATURE,function(i){e||(e=!0,t.push(i.feature),e=!1)}),this.addEventListener(mt.REMOVEFEATURE,function(i){e||(e=!0,t.remove(i.feature),e=!1)}),t.addEventListener(nt.ADD,i=>{e||(e=!0,this.addFeature(i.element),e=!1)}),t.addEventListener(nt.REMOVE,i=>{e||(e=!0,this.removeFeature(i.element),e=!1)}),this.featuresCollection_=t}clear(t){if(t){for(const i in this.featureChangeKeys_)this.featureChangeKeys_[i].forEach($);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(i=>{this.removeFeatureInternal(i)});for(const i in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[i])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new De(mt.CLEAR);this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){const i=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(i,function(n){const r=n.getGeometry();if(r instanceof Lt||r.intersectsCoordinate(t))return e(n)})}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,function(i){const n=i.getGeometry();if(n instanceof Lt||n.intersectsExtent(t)){const r=e(i);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(),Xe(this.nullGeometryFeatures_)||At(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,function(i){e.push(i)}),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);const n=Ch(t,e);return[].concat(...n.map(r=>this.featuresRtree_.getInExtent(r)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],n=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||zt,this.featuresRtree_.forEachInExtent(l,function(h){if(e(h)){const c=h.getGeometry(),u=a;if(a=c instanceof Lt?0:c.closestPointXY(i,n,o,a),a<u){r=h;const d=Math.sqrt(a);l[0]=i-d,l[1]=n-d,l[2]=i+d,l[3]=n+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,i=V(e),n=e.getGeometry();if(!n)i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(e),this.nullGeometryFeatures_[i]=e);else{const o=n.getExtent();i in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[i],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_[i]=e;this.changed(),this.dispatchEvent(new De(mt.CHANGEFEATURE,e))}hasFeature(t){const e=t.getId();return e!==void 0?e in this.idIndex_:V(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Xe(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(t,e,i){const n=this.loadedExtentsRtree_,r=this.strategy_(t,e,i);for(let o=0,a=r.length;o<a;++o){const l=r[o];n.forEachInExtent(l,function(c){return se(c.extent,l)})||(++this.loadingExtentsCount_,this.dispatchEvent(new De(mt.FEATURESLOADSTART)),this.loader_.call(this,l,e,i,c=>{--this.loadingExtentsCount_,this.dispatchEvent(new De(mt.FEATURESLOADEND,void 0,c))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new De(mt.FEATURESLOADERROR))}),n.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_,i=e.forEachInExtent(t,function(n){if(Ni(n.extent,t))return n});i&&e.remove(i)}removeFeatures(t){let e=!1;for(let i=0,n=t.length;i<n;++i)e=this.removeFeatureInternal(t[i])||e;e&&this.changed()}removeFeature(t){if(!t)return;this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=V(t);if(!(e in this.uidIndex_))return!1;e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t);const i=this.featureChangeKeys_[e];i==null||i.forEach($),delete this.featureChangeKeys_[e];const n=t.getId();if(n!==void 0){const r=n.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(mt.REMOVEFEATURE)&&this.dispatchEvent(new De(mt.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){it(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader(Fl(t,this.format_))}setOverlaps(t){this.overlaps_=t,this.changed()}}const Y={SINGLECLICK:"singleclick",CLICK:D.CLICK,DBLCLICK:D.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},_s={ACTIVE:"active"};class Ri extends jt{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(_s.ACTIVE)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(_s.ACTIVE,t)}setMap(t){this.map_=t}}function Yd(s,t,e){const i=s.getCenterInternal();if(i){const n=[i[0]+t[0],i[1]+t[1]];s.animateInternal({duration:e!==void 0?e:250,easing:yd,center:s.getConstrainedCenter(n)})}}function $r(s,t,e,i){const n=s.getZoom();if(n===void 0)return;const r=s.getConstrainedZoom(n+t),o=s.getResolutionForZoom(r);s.getAnimating()&&s.cancelAnimations(),s.animate({resolution:o,anchor:e,duration:i!==void 0?i:250,easing:wi})}class Kd extends Ri{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==Y.DBLCLICK){const i=t.originalEvent,n=t.map,r=t.coordinate,o=i.shiftKey?-this.delta_:this.delta_,a=n.getView();$r(a,o,r,this.duration_),i.preventDefault(),e=!0}return!e}}function Jr(s){const t=arguments;return function(e){let i=!0;for(let n=0,r=t.length;n<r&&(i=i&&t[n](e),!!i);++n);return i}}const Ud=function(s){const t=s.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey},Zd=function(s){const t=s.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},Hd=function(s){const t=s.map.getTargetElement(),e=t.getRootNode(),i=s.map.getOwnerDocument().activeElement;return e instanceof ShadowRoot?e.host.contains(i):t.contains(i)},Nl=function(s){const t=s.map.getTargetElement(),e=t.getRootNode();return(e instanceof ShadowRoot?e.host:t).hasAttribute("tabindex")?Hd(s):!0},mn=zt,Gl=function(s){const t=s.originalEvent;return"pointerId"in t&&t.button==0&&!(Mh&&Ws&&t.ctrlKey)},Qr=Be,Wl=function(s){return s.type==Y.SINGLECLICK},to=function(s){const t=s.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey},qd=function(s){const t=s.originalEvent;return!t.altKey&&(Ws?t.metaKey:t.ctrlKey)&&!t.shiftKey},$d=function(s){const t=s.originalEvent;return Ws?t.metaKey:t.ctrlKey},eo=function(s){const t=s.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},zl=function(s){const t=s.originalEvent,e=t.target.tagName;return e!=="INPUT"&&e!=="SELECT"&&e!=="TEXTAREA"&&!t.target.isContentEditable},io=function(s){const t=s.originalEvent;return"pointerId"in t&&t.pointerType=="mouse"},jl=function(s){const t=s.originalEvent;return"pointerId"in t&&t.isPrimary&&t.button===0};class Jd extends hr{constructor(t){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const t=this.startPixel_,e=this.endPixel_,i="px",n=this.element_.style;n.left=Math.min(t[0],e[0])+i,n.top=Math.min(t[1],e[1])+i,n.width=Math.abs(e[0]-t[0])+i,n.height=Math.abs(e[1]-t[1])+i}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const 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_,n=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);n[4]=n[0].slice(),this.geometry_?this.geometry_.setCoordinates([n]):this.geometry_=new Ut([n])}getGeometry(){return this.geometry_}}class ge extends Ri{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==Y.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==Y.POINTERUP){const i=this.handleUpEvent(t);this.handlingDownUpSequence=i&&this.targetPointers.length>0}}else if(t.type==Y.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==Y.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 no(s){const t=s.length;let e=0,i=0;for(let n=0;n<t;n++)e+=s[n].clientX,i+=s[n].clientY;return{clientX:e/t,clientY:i/t}}const vi={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"};class yn extends St{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}class Qd extends ge{constructor(t){super(),this.on,this.once,this.un,t=t??{},this.box_=new Jd(t.className||"ol-dragbox"),this.minArea_=t.minArea??64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition??Gl,this.boxEndCondition_=t.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,i){const n=i[0]-e[0],r=i[1]-e[1];return n*n+r*r>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.startPixel_&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new yn(vi.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 yn(e?vi.BOXEND:vi.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 yn(vi.BOXSTART,t.coordinate,t)),!0):!1}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new yn(vi.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}setMap(t){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new yn(vi.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(t)}}class tf extends ge{constructor(t){super({stopDown:Be}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:Jr(to,jl);this.condition_=t.onFocusOnly?Jr(Nl,e):e,this.noKinetic_=!1}handleDragEvent(t){const e=t.map;this.panning_||(this.panning_=!0,e.getView().beginInteraction());const i=this.targetPointers,n=e.getEventPixel(no(i));if(i.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(n[0],n[1]),this.lastCentroid){const r=[this.lastCentroid[0]-n[0],n[1]-this.lastCentroid[1]],a=t.map.getView();vh(r,a.getResolution()),Gs(r,a.getRotation()),a.adjustCenterInternal(r)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=n,this.lastPointersCount_=i.length,t.originalEvent.preventDefault()}handleUpEvent(t){const e=t.map,i=e.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const n=this.kinetic_.getDistance(),r=this.kinetic_.getAngle(),o=i.getCenterInternal(),a=e.getPixelFromCoordinateInternal(o),l=e.getCoordinateFromPixelInternal([a[0]-n*Math.cos(r),a[1]-n*Math.sin(r)]);i.animateInternal({center:i.getConstrainedCenter(l),duration:500,easing:wi})}return this.panning_&&(this.panning_=!1,i.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(t){if(this.targetPointers.length>0&&this.condition_(t)){const i=t.map.getView();return this.lastCentroid=null,i.getAnimating()&&i.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}}class ef extends ge{constructor(t){t=t||{},super({stopDown:Be}),this.condition_=t.condition?t.condition:Zd,this.lastAngle_=void 0,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){if(!io(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===Br)return;const n=e.getSize(),r=t.pixel,o=Math.atan2(n[1]/2-r[1],r[0]-n[0]/2);if(this.lastAngle_!==void 0){const a=o-this.lastAngle_;i.adjustRotationInternal(-a)}this.lastAngle_=o}handleUpEvent(t){return io(t)?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){return io(t)&&Gl(t)&&this.condition_(t)?(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}}class nf extends Qd{constructor(t){t=t||{};const e=t.condition?t.condition:eo;super({condition:e,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=t.duration!==void 0?t.duration:200,this.out_=t.out!==void 0?t.out:!1}onBoxEnd(t){const i=this.getMap().getView();let n=this.getGeometry();if(this.out_){const r=i.rotatedExtentForGeometry(n),o=i.getResolutionForExtentInternal(r),a=i.getResolution()/o;n=n.clone(),n.scale(a*a)}i.fitInternal(n,{duration:this.duration_,easing:wi})}}class Ti extends St{constructor(t,e,i){super(t),this.map=e,this.frameState=i!==void 0?i:null}}class _e extends Ti{constructor(t,e,i,n,r,o){super(t,e,r),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=n!==void 0?n:!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 ms={DRAWSTART:"drawstart",DRAWEND:"drawend",DRAWABORT:"drawabort"};class ys extends St{constructor(t,e){super(t),this.feature=e}}function sf(s,t){const e=[];for(let i=0;i<t.length;++i){const r=t[i].getGeometry();Xl(s,r,e)}return e}function ps(s,t){return re(s[0],s[1],t[0],t[1])}function Pi(s,t){const e=s.length;return t<0?s[t+e]:t>=e?s[t-e]:s[t]}function xs(s,t,e){let i,n;t<e?(i=t,n=e):(i=e,n=t);const r=Math.ceil(i),o=Math.floor(n);if(r>o){const l=Mi(s,i),h=Mi(s,n);return ps(l,h)}let a=0;if(i<r){const l=Mi(s,i),h=Pi(s,r);a+=ps(l,h)}if(o<n){const l=Pi(s,o),h=Mi(s,n);a+=ps(l,h)}for(let l=r;l<o-1;++l){const h=Pi(s,l),c=Pi(s,l+1);a+=ps(h,c)}return a}function Xl(s,t,e){if(t instanceof Qt){Es(s,t.getCoordinates(),!1,e);return}if(t instanceof Si){const i=t.getCoordinates();for(let n=0,r=i.length;n<r;++n)Es(s,i[n],!1,e);return}if(t instanceof Ut){const i=t.getCoordinates();for(let n=0,r=i.length;n<r;++n)Es(s,i[n],!0,e);return}if(t instanceof Ii){const i=t.getCoordinates();for(let n=0,r=i.length;n<r;++n){const o=i[n];for(let a=0,l=o.length;a<l;++a)Es(s,o[a],!0,e)}return}if(t instanceof gn){const i=t.getGeometries();for(let n=0;n<i.length;++n)Xl(s,i[n],e);return}}const so={index:-1,endIndex:NaN};function rf(s,t,e,i){const n=s[0],r=s[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,m;for(let _=0;_<f.length-1;++_){const y=f[_],p=f[_+1],E=Vl(n,r,y,p);E.squaredDistance<g&&(g=E.squaredDistance,m=_+E.along)}g<o&&(o=g,d.ring&&t.targetIndex===u&&(d.endIndex>d.startIndex?m<d.startIndex&&(m+=f.length):d.endIndex<d.startIndex&&m>d.startIndex&&(m-=f.length)),l=m,a=u)}const h=t.targets[a];let c=h.ring;if(t.targetIndex===a&&c){const u=Mi(h.coordinates,l),d=e.getPixelFromCoordinate(u);An(d,t.startPx)>i&&(c=!1)}if(c){const u=h.coordinates,d=u.length,f=h.startIndex,g=l;if(f<g){const m=xs(u,f,g);xs(u,f,g-d)<m&&(l-=d)}else{const m=xs(u,f,g);xs(u,f,g+d)<m&&(l+=d)}}return so.index=a,so.endIndex=l,so}function Es(s,t,e,i){const n=s[0],r=s[1];for(let o=0,a=t.length-1;o<a;++o){const l=t[o],h=t[o+1],c=Vl(n,r,l,h);if(c.squaredDistance===0){const u=o+c.along;i.push({coordinates:t,ring:e,startIndex:u,endIndex:u});return}}}const ro={along:0,squaredDistance:0};function Vl(s,t,e,i){const n=e[0],r=e[1],o=i[0],a=i[1],l=o-n,h=a-r;let c=0,u=n,d=r;return(l!==0||h!==0)&&(c=rt(((s-n)*l+(t-r)*h)/(l*l+h*h),0,1),u+=l*c,d+=h*c),ro.along=c,ro.squaredDistance=Mn(re(s,t,u,d),10),ro}function Mi(s,t){const e=s.length;let i=Math.floor(t);const n=t-i;i>=e?i-=e:i<0&&(i+=e);let r=i+1;r>=e&&(r-=e);const o=s[i],a=o[0],l=o[1],h=s[r],c=h[0]-a,u=h[1]-l;return[a+c*n,l+u*n]}class of extends ge{constructor(t){const e=t;e.stopDown||(e.stopDown=Be),super(e),this.on,this.once,this.un,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_=lf(this.type_),this.stopClick_=!!t.stopClick,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:zt,this.geometryLayout_=t.geometryLayout?t.geometryLayout:"XY";let i=t.geometryFunction;if(!i){const n=this.mode_;if(n==="Circle")i=(r,o,a)=>{const l=o||new fs([NaN,NaN]),h=Z(r[0]),c=oe(h,Z(r[r.length-1]));return l.setCenterAndRadius(h,Math.sqrt(c),this.geometryLayout_),l};else{let r;n==="Point"?r=Kt:n==="LineString"?r=Qt:n==="Polygon"&&(r=Ut),i=(o,a,l)=>(a?n==="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_=i,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 cs({source:new qr({useSpatialIndex:!1,wrapX:t.wrapX?t.wrapX:!1}),style:t.style?t.style:af(),updateWhileInteracting:!0}),this.geometryName_=t.geometryName,this.condition_=t.condition?t.condition:to,this.freehandCondition_,t.freehand?this.freehandCondition_=mn:this.freehandCondition_=t.freehandCondition?t.freehandCondition:eo,this.traceCondition_,this.setTrace(t.trace||!1),this.traceState_={active:!1},this.traceSource_=t.traceSource||t.source||null,this.addChangeListener(_s.ACTIVE,this.updateState_)}setTrace(t){let e;t?t===!0?e=mn:e=t:e=Qr,this.traceCondition_=e}setMap(t){super.setMap(t),this.updateState_()}getOverlay(){return this.overlay_}handleEvent(t){t.originalEvent.type===D.CONTEXTMENU&&t.originalEvent.preventDefault(),this.freehand_=this.mode_!=="Point"&&this.freehandCondition_(t);let e=t.type===Y.POINTERMOVE,i=!0;return!this.freehand_&&this.lastDragTime_&&t.type===Y.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===Y.POINTERDRAG&&this.sketchFeature_!==null?(this.addToDrawing_(t.coordinate),i=!1):this.freehand_&&t.type===Y.POINTERDOWN?i=!1:e&&this.getPointerCount()<2?(i=t.type===Y.POINTERMOVE,i&&this.freehand_?(this.handlePointerMove_(t),this.shouldHandle_&&t.originalEvent.preventDefault()):(t.originalEvent.pointerType==="mouse"||t.type===Y.POINTERDRAG&&this.downTimeout_===void 0)&&this.handlePointerMove_(t)):t.type===Y.DBLCLICK&&(i=!1),super.handleEvent(t)&&i}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 _e(Y.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(),i=e.getCoordinateFromPixel([t.pixel[0]-this.snapTolerance_,t.pixel[1]+this.snapTolerance_]),n=e.getCoordinateFromPixel([t.pixel[0]+this.snapTolerance_,t.pixel[1]-this.snapTolerance_]),r=ht([i,n]),o=this.traceSource_.getFeaturesInExtent(r);if(o.length===0)return;const a=sf(t.coordinate,o);a.length&&(this.traceState_={active:!0,startPx:t.pixel.slice(),targets:a,targetIndex:-1})}addOrRemoveTracedCoordinates_(t,e){const i=t.startIndex<=t.endIndex,n=t.startIndex<=e;i===n?i&&e>t.endIndex||!i&&e<t.endIndex?this.addTracedCoordinates_(t,t.endIndex,e):(i&&e<t.endIndex||!i&&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 i=0;if(t<e){const n=Math.ceil(t);let r=Math.floor(e);r===e&&(r-=1),i=r-n+1}else{const n=Math.floor(t);let r=Math.ceil(e);r===e&&(r+=1),i=n-r+1}i>0&&this.removeLastPoints_(i)}addTracedCoordinates_(t,e,i){if(e===i)return;const n=[];if(e<i){const r=Math.ceil(e);let o=Math.floor(i);o===i&&(o-=1);for(let a=r;a<=o;++a)n.push(Pi(t.coordinates,a))}else{const r=Math.floor(e);let o=Math.ceil(i);o===i&&(o+=1);for(let a=r;a>=o;--a)n.push(Pi(t.coordinates,a))}n.length&&this.appendCoordinates(n)}updateTrace_(t){const e=this.traceState_;if(!e.active||e.targetIndex===-1&&An(e.startPx,t.pixel)<this.snapTolerance_)return;const i=rf(t.coordinate,e,this.getMap(),this.snapTolerance_);if(e.targetIndex!==i.index){if(e.targetIndex!==-1){const l=e.targets[e.targetIndex];this.removeTracedCoordinates_(l.startIndex,l.endIndex)}const a=e.targets[i.index];this.addTracedCoordinates_(a,a.startIndex,i.endIndex)}else{const a=e.targets[e.targetIndex];this.addOrRemoveTracedCoordinates_(a,i.endIndex)}e.targetIndex=i.index;const n=e.targets[e.targetIndex];n.endIndex=i.endIndex;const r=Mi(n.coordinates,n.endIndex),o=this.getMap().getPixelFromCoordinate(r);t.coordinate=r,t.pixel=[Math.round(o[0]),Math.round(o[1])]}handleUpEvent(t){let e=!0;if(this.getPointerCount()===0){this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0),this.handlePointerMove_(t);const i=this.traceState_.active;if(this.toggleTraceState_(t),this.shouldHandle_){const n=!this.finishCoordinate_;n&&this.startDrawing_(t.coordinate),!n&&this.freehand_?this.finishDrawing():!this.freehand_&&(!n||this.mode_==="Point")&&(this.atFinish_(t.pixel,i)?this.finishCondition_(t)&&this.finishDrawing():this.addToDrawing_(t.coordinate)),e=!1}else this.freehand_&&this.abortDrawing()}return!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_,i=t.pixel,n=e[0]-i[0],r=e[1]-i[1],o=n*n+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 i=!1;if(this.sketchFeature_){let n=!1,r=[this.finishCoordinate_];const o=this.mode_;if(o==="Point")i=!0;else if(o==="Circle")i=this.sketchCoords_.length===2;else if(o==="LineString")n=!e&&this.sketchCoords_.length>this.minPoints_;else if(o==="Polygon"){const a=this.sketchCoords_;n=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(n){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(i=Math.sqrt(d*d+f*f)<=g,i){this.finishCoordinate_=c;break}}}}return i}createOrUpdateSketchPoint_(t){this.sketchPoint_?this.sketchPoint_.getGeometry().setCoordinates(t):(this.sketchPoint_=new Tt(new Kt(t)),this.updateSketchFeatures_())}createOrUpdateCustomSketchLine_(t){this.sketchLine_||(this.sketchLine_=new Tt);const e=t.getLinearRing(0);let i=this.sketchLine_.getGeometry();i?(i.setFlatCoordinates(e.getLayout(),e.getFlatCoordinates()),i.changed()):(i=new Qt(e.getFlatCoordinates(),e.getLayout()),this.sketchLine_.setGeometry(i))}startDrawing_(t){const e=this.getMap().getView().getProjection(),i=$n(this.geometryLayout_);for(;t.length<i;)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 Tt(new Qt(this.sketchLineCoords_)));const n=this.geometryFunction_(this.sketchCoords_,void 0,e);this.sketchFeature_=new Tt,this.geometryName_&&this.sketchFeature_.setGeometryName(this.geometryName_),this.sketchFeature_.setGeometry(n),this.updateSketchFeatures_(),this.dispatchEvent(new ys(ms.DRAWSTART,this.sketchFeature_))}modifyDrawing_(t){const e=this.getMap(),i=this.sketchFeature_.getGeometry(),n=e.getView().getProjection(),r=$n(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_,i,n),this.sketchPoint_&&this.sketchPoint_.getGeometry().setCoordinates(t),i.getType()==="Polygon"&&this.mode_!=="Polygon"?this.createOrUpdateCustomSketchLine_(i):this.sketchLineCoords_&&this.sketchLine_.getGeometry().setCoordinates(this.sketchLineCoords_),this.updateSketchFeatures_()}addToDrawing_(t){const e=this.sketchFeature_.getGeometry(),i=this.getMap().getView().getProjection();let n,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():n=!0),r.push(t.slice()),this.geometryFunction_(r,e,i)):o==="Polygon"&&(r=this.sketchCoords_[0],r.length>=this.maxPoints_&&(this.freehand_?r.pop():n=!0),r.push(t.slice()),n&&(this.finishCoordinate_=r[0]),this.geometryFunction_(this.sketchCoords_,e,i)),this.createOrUpdateSketchPoint_(t.slice()),this.updateSketchFeatures_(),n?this.finishDrawing():this.sketchFeature_}removeLastPoints_(t){if(!this.sketchFeature_)return;const e=this.sketchFeature_.getGeometry(),i=this.getMap().getView().getProjection(),n=this.mode_;for(let r=0;r<t;++r){let o;if(n==="LineString"||n==="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,i),e.getType()==="Polygon"&&this.sketchLine_&&this.createOrUpdateCustomSketchLine_(e)}else if(n==="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,i)}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 i=t.getGeometry(),n=this.getMap().getView().getProjection();return this.mode_==="LineString"?(e.pop(),this.geometryFunction_(e,i,n)):this.mode_==="Polygon"&&(e[0].pop(),this.geometryFunction_(e,i,n),e=i.getCoordinates()),this.type_==="MultiPoint"?t.setGeometry(new _n([e])):this.type_==="MultiLineString"?t.setGeometry(new Si([e])):this.type_==="MultiPolygon"&&t.setGeometry(new Ii([e])),this.dispatchEvent(new ys(ms.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 ys(ms.DRAWABORT,t))}appendCoordinates(t){const e=this.mode_,i=!this.sketchFeature_;i&&this.startDrawing_(t[0]);let n;if(e==="LineString"||e==="Circle")n=this.sketchCoords_;else if(e==="Polygon")n=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[];else return;i&&n.shift(),n.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 i=t.getGeometry();this.sketchFeature_=t,this.sketchCoords_=i.getCoordinates();const n=this.sketchCoords_[this.sketchCoords_.length-1];this.finishCoordinate_=n.slice(),this.sketchCoords_.push(n.slice()),this.sketchPoint_=new Tt(new Kt(n)),this.updateSketchFeatures_(),this.dispatchEvent(new ys(ms.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 af(){const s=Ir();return function(t,e){return s[t.getGeometry().getType()]}}function lf(s){switch(s){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: "+s)}}const Qe={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};class hf extends Ri{constructor(t){super(),t=t||{},this.defaultCondition_=function(e){return to(e)&&zl(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==D.KEYDOWN){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&(n==Qe.DOWN||n==Qe.LEFT||n==Qe.RIGHT||n==Qe.UP)){const o=t.map.getView(),a=o.getResolution()*this.pixelDelta_;let l=0,h=0;n==Qe.DOWN?h=-a:n==Qe.LEFT?l=-a:n==Qe.RIGHT?l=a:h=a;const c=[l,h];Gs(c,o.getRotation()),Yd(o,c,this.duration_),i.preventDefault(),e=!0}}return!e}}class cf extends Ri{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(e){return!$d(e)&&zl(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==D.KEYDOWN||t.type==D.KEYPRESS){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&(n==="+"||n==="-")){const r=t.map,o=n==="+"?this.delta_:-this.delta_,a=r.getView();$r(a,o,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}}const me={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},Bl=0,pn=1,Yl=[0,0,0,0],Li=[],oo={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"};class ao extends St{constructor(t,e,i){super(t),this.features=e,this.mapBrowserEvent=i}}class uf extends ge{constructor(t){super(t),this.on,this.once,this.un,this.boundHandleFeatureChange_=this.handleFeatureChange_.bind(this),this.condition_=t.condition?t.condition:jl,this.defaultDeleteCondition_=function(i){return Ud(i)&&Wl(i)},this.deleteCondition_=t.deleteCondition?t.deleteCondition:this.defaultDeleteCondition_,this.insertVertexCondition_=t.insertVertexCondition?t.insertVertexCondition:mn,this.vertexFeature_=null,this.vertexSegments_=null,this.lastPixel_=[0,0],this.ignoreNextSingleClick_=!1,this.featuresBeingModified_=null,this.rBush_=new gs,this.pixelTolerance_=t.pixelTolerance!==void 0?t.pixelTolerance:10,this.snappedToVertex_=!1,this.changingFeature_=!1,this.dragSegments_=[],this.overlay_=new cs({source:new qr({useSpatialIndex:!1,wrapX:!!t.wrapX}),style:t.style?t.style:ff(),updateWhileAnimating:!0,updateWhileInteracting:!0}),this.SEGMENT_WRITERS_={Point:this.writePointGeometry_.bind(this),LineString:this.writeLineStringGeometry_.bind(this),LinearRing:this.writeLineStringGeometry_.bind(this),Polygon:this.writePolygonGeometry_.bind(this),MultiPoint:this.writeMultiPointGeometry_.bind(this),MultiLineString:this.writeMultiLineStringGeometry_.bind(this),MultiPolygon:this.writeMultiPolygonGeometry_.bind(this),Circle:this.writeCircleGeometry_.bind(this),GeometryCollection:this.writeGeometryCollectionGeometry_.bind(this)},this.source_=null,this.hitDetection_=null;let e;if(t.features?e=t.features:t.source&&(this.source_=t.source,e=new _t(this.source_.getFeatures()),this.source_.addEventListener(mt.ADDFEATURE,this.handleSourceAdd_.bind(this)),this.source_.addEventListener(mt.REMOVEFEATURE,this.handleSourceRemove_.bind(this))),!e)throw new Error("The modify interaction requires features, a source or a layer");t.hitDetection&&(this.hitDetection_=t.hitDetection),this.features_=e,this.features_.forEach(this.addFeature_.bind(this)),this.features_.addEventListener(nt.ADD,this.handleFeatureAdd_.bind(this)),this.features_.addEventListener(nt.REMOVE,this.handleFeatureRemove_.bind(this)),this.lastPointerEvent_=null,this.delta_=[0,0],this.snapToPointer_=t.snapToPointer===void 0?!this.hitDetection_:t.snapToPointer}addFeature_(t){const e=t.getGeometry();if(e){const n=this.SEGMENT_WRITERS_[e.getType()];n&&n(t,e)}const i=this.getMap();i&&i.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(i.getCoordinateFromPixel(this.lastPixel_)),t.addEventListener(D.CHANGE,this.boundHandleFeatureChange_)}willModifyFeatures_(t,e){if(!this.featuresBeingModified_){this.featuresBeingModified_=new _t;const i=this.featuresBeingModified_.getArray();for(let n=0,r=e.length;n<r;++n){const o=e[n].feature;o&&!i.includes(o)&&this.featuresBeingModified_.push(o)}this.featuresBeingModified_.getLength()===0?this.featuresBeingModified_=null:this.dispatchEvent(new ao(oo.MODIFYSTART,this.featuresBeingModified_,t))}}removeFeature_(t){this.removeFeatureSegmentData_(t),this.vertexFeature_&&this.features_.getLength()===0&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.removeEventListener(D.CHANGE,this.boundHandleFeatureChange_)}removeFeatureSegmentData_(t){const e=this.rBush_,i=[];e.forEach(function(n){t===n.feature&&i.push(n)});for(let n=i.length-1;n>=0;--n){const r=i[n];for(let o=this.dragSegments_.length-1;o>=0;--o)this.dragSegments_[o][0]===r&&this.dragSegments_.splice(o,1);e.remove(r)}}setActive(t){this.vertexFeature_&&!t&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),super.setActive(t)}setMap(t){this.overlay_.setMap(t),super.setMap(t)}getOverlay(){return this.overlay_}handleSourceAdd_(t){t.feature&&this.features_.push(t.feature)}handleSourceRemove_(t){t.feature&&this.features_.remove(t.feature)}handleFeatureAdd_(t){this.addFeature_(t.element)}handleFeatureChange_(t){if(!this.changingFeature_){const e=t.target;this.removeFeature_(e),this.addFeature_(e)}}handleFeatureRemove_(t){this.removeFeature_(t.element)}writePointGeometry_(t,e){const i=e.getCoordinates(),n={feature:t,geometry:e,segment:[i,i]};this.rBush_.insert(e.getExtent(),n)}writeMultiPointGeometry_(t,e){const i=e.getCoordinates();for(let n=0,r=i.length;n<r;++n){const o=i[n],a={feature:t,geometry:e,depth:[n],index:n,segment:[o,o]};this.rBush_.insert(e.getExtent(),a)}}writeLineStringGeometry_(t,e){const i=e.getCoordinates();for(let n=0,r=i.length-1;n<r;++n){const o=i.slice(n,n+2),a={feature:t,geometry:e,index:n,segment:o};this.rBush_.insert(ht(o),a)}}writeMultiLineStringGeometry_(t,e){const i=e.getCoordinates();for(let n=0,r=i.length;n<r;++n){const o=i[n];for(let a=0,l=o.length-1;a<l;++a){const h=o.slice(a,a+2),c={feature:t,geometry:e,depth:[n],index:a,segment:h};this.rBush_.insert(ht(h),c)}}}writePolygonGeometry_(t,e){const i=e.getCoordinates();for(let n=0,r=i.length;n<r;++n){const o=i[n];for(let a=0,l=o.length-1;a<l;++a){const h=o.slice(a,a+2),c={feature:t,geometry:e,depth:[n],index:a,segment:h};this.rBush_.insert(ht(h),c)}}}writeMultiPolygonGeometry_(t,e){const i=e.getCoordinates();for(let n=0,r=i.length;n<r;++n){const o=i[n];for(let a=0,l=o.length;a<l;++a){const h=o[a];for(let c=0,u=h.length-1;c<u;++c){const d=h.slice(c,c+2),f={feature:t,geometry:e,depth:[a,n],index:c,segment:d};this.rBush_.insert(ht(d),f)}}}}writeCircleGeometry_(t,e){const i=e.getCenter(),n={feature:t,geometry:e,index:Bl,segment:[i,i]},r={feature:t,geometry:e,index:pn,segment:[i,i]},o=[n,r];n.featureSegments=o,r.featureSegments=o,this.rBush_.insert(ki(i),n);let a=e;this.rBush_.insert(a.getExtent(),r)}writeGeometryCollectionGeometry_(t,e){const i=e.getGeometriesArray();for(let n=0;n<i.length;++n){const r=i[n],o=this.SEGMENT_WRITERS_[r.getType()];o(t,r)}}createOrUpdateVertexFeature_(t,e,i,n){let r=this.vertexFeature_;return r?r.getGeometry().setCoordinates(t):(r=new Tt(new Kt(t)),this.vertexFeature_=r,this.overlay_.getSource().addFeature(r)),r.set("features",e),r.set("geometries",i),r.set("existing",n),r}handleEvent(t){if(!t.originalEvent)return!0;this.lastPointerEvent_=t;let e;return!t.map.getView().getInteracting()&&t.type==Y.POINTERMOVE&&!this.handlingDownUpSequence&&this.handlePointerMove_(t),this.vertexFeature_&&this.deleteCondition_(t)&&(t.type!=Y.SINGLECLICK||!this.ignoreNextSingleClick_?e=this.removePoint():e=!0),t.type==Y.SINGLECLICK&&(this.ignoreNextSingleClick_=!1),super.handleEvent(t)&&!e}findInsertVerticesAndUpdateDragSegments_(t){this.handlePointerAtPixel_(t),this.dragSegments_.length=0,this.featuresBeingModified_=null;const e=this.vertexFeature_;if(!e)return;this.getMap().getView().getProjection();const i=[],n=e.getGeometry().getCoordinates(),r=ht([n]),o=this.rBush_.getInExtent(r),a={};o.sort(df);for(let l=0,h=o.length;l<h;++l){const c=o[l],u=c.segment;let d=V(c.geometry);const f=c.depth;if(f&&(d+="-"+f.join("-")),a[d]||(a[d]=new Array(2)),c.geometry.getType()==="Circle"&&c.index===pn){const g=Ul(t,c);Et(g,n)&&!a[d][0]&&(this.dragSegments_.push([c,0]),a[d][0]=c);continue}if(Et(u[0],n)&&!a[d][0]){this.dragSegments_.push([c,0]),a[d][0]=c;continue}if(Et(u[1],n)&&!a[d][1]){if(a[d][0]&&a[d][0].index===0){let g=c.geometry.getCoordinates();switch(c.geometry.getType()){case"LineString":case"MultiLineString":continue;case"MultiPolygon":g=g[f[1]];case"Polygon":if(c.index!==g[f[0]].length-2)continue;break}}this.dragSegments_.push([c,1]),a[d][1]=c;continue}V(u)in this.vertexSegments_&&!a[d][0]&&!a[d][1]&&i.push(c)}return i}handleDragEvent(t){this.ignoreNextSingleClick_=!1,this.willModifyFeatures_(t,this.dragSegments_.map(([r])=>r));const e=[t.coordinate[0]+this.delta_[0],t.coordinate[1]+this.delta_[1]],i=[],n=[];for(let r=0,o=this.dragSegments_.length;r<o;++r){const a=this.dragSegments_[r],l=a[0],h=l.feature;i.includes(h)||i.push(h);const c=l.geometry;n.includes(c)||n.push(c);const u=l.depth;let d;const f=l.segment,g=a[1];for(;e.length<c.getStride();)e.push(f[g][e.length]);switch(c.getType()){case"Point":d=e,f[0]=e,f[1]=e;break;case"MultiPoint":d=c.getCoordinates(),d[l.index]=e,f[0]=e,f[1]=e;break;case"LineString":d=c.getCoordinates(),d[l.index+g]=e,f[g]=e;break;case"MultiLineString":d=c.getCoordinates(),d[u[0]][l.index+g]=e,f[g]=e;break;case"Polygon":d=c.getCoordinates(),d[u[0]][l.index+g]=e,f[g]=e;break;case"MultiPolygon":d=c.getCoordinates(),d[u[1]][u[0]][l.index+g]=e,f[g]=e;break;case"Circle":const m=c;if(f[0]=e,f[1]=e,l.index===Bl)this.changingFeature_=!0,m.setCenter(e),this.changingFeature_=!1;else{this.changingFeature_=!0,t.map.getView().getProjection();let _=An(Z(m.getCenter()),Z(e));m.setRadius(_),this.changingFeature_=!1}break}d&&this.setGeometryCoordinates_(c,d)}this.createOrUpdateVertexFeature_(e,i,n,!0)}handleDownEvent(t){if(!this.condition_(t))return!1;const e=t.coordinate,i=this.findInsertVerticesAndUpdateDragSegments_(e);if(i!=null&&i.length&&this.insertVertexCondition_(t)&&(this.willModifyFeatures_(t,i),this.vertexFeature_)){const n=this.vertexFeature_.getGeometry().getCoordinates();for(let r=i.length-1;r>=0;--r)this.insertVertex_(i[r],n);this.ignoreNextSingleClick_=!0}return!!this.vertexFeature_}handleUpEvent(t){for(let e=this.dragSegments_.length-1;e>=0;--e){const i=this.dragSegments_[e][0],n=i.geometry;if(n.getType()==="Circle"){const r=n,o=r.getCenter(),a=i.featureSegments[0],l=i.featureSegments[1];a.segment[0]=o,a.segment[1]=o,l.segment[0]=o,l.segment[1]=o,this.rBush_.update(ki(o),a);let h=r;this.rBush_.update(h.getExtent(),l)}else this.rBush_.update(ht(i.segment),i)}return this.featuresBeingModified_&&(this.dispatchEvent(new ao(oo.MODIFYEND,this.featuresBeingModified_,t)),this.featuresBeingModified_=null),!1}handlePointerMove_(t){this.lastPixel_=t.pixel,this.handlePointerAtPixel_(t.coordinate)}handlePointerAtPixel_(t){const e=this.getMap(),i=e.getPixelFromCoordinate(t);e.getView().getProjection();const n=function(a,l){return Kl(t,a)-Kl(t,l)};let r,o;if(this.hitDetection_){const a=typeof this.hitDetection_=="object"?l=>l===this.hitDetection_:void 0;e.forEachFeatureAtPixel(i,(l,h,c)=>{c&&c.getType()==="Point"&&(c=new Kt(Se(c.getCoordinates())));const u=c||l.getGeometry();if(u&&u.getType()==="Point"&&l instanceof Tt&&this.features_.getArray().includes(l)){o=u;const d=l.getGeometry().getFlatCoordinates().slice(0,2);r=[{feature:l,geometry:o,segment:[d,d]}]}return!0},{layerFilter:a})}if(!r){const a=Ie(ki(t,Yl)),l=e.getView().getResolution()*this.pixelTolerance_,h=Wn(bi(a,l,Yl));r=this.rBush_.getInExtent(h)}if(r&&r.length>0){const a=r.sort(n)[0],l=a.segment;let h=Ul(t,a);const c=e.getPixelFromCoordinate(h);let u=An(i,c);if(o||u<=this.pixelTolerance_){const d={};if(d[V(l)]=!0,this.snapToPointer_||(this.delta_[0]=h[0]-t[0],this.delta_[1]=h[1]-t[1]),a.geometry.getType()==="Circle"&&a.index===pn)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(h,[a.feature],[a.geometry],this.snappedToVertex_);else{const f=e.getPixelFromCoordinate(l[0]),g=e.getPixelFromCoordinate(l[1]),m=oe(c,f),_=oe(c,g);if(u=Math.sqrt(Math.min(m,_)),this.snappedToVertex_=u<=this.pixelTolerance_,!this.snappedToVertex_&&!this.insertVertexCondition_(this.lastPointerEvent_)){this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null);return}this.snappedToVertex_&&(h=m>_?l[1]:l[0]),this.createOrUpdateVertexFeature_(h,[a.feature],[a.geometry],this.snappedToVertex_);const y={};y[V(a.geometry)]=!0;for(let p=1,E=r.length;p<E;++p){const x=r[p].segment;if(Et(l[0],x[0])&&Et(l[1],x[1])||Et(l[0],x[1])&&Et(l[1],x[0])){const C=V(r[p].geometry);C in y||(y[C]=!0,d[V(x)]=!0)}else break}}this.vertexSegments_=d;return}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)}insertVertex_(t,e){const i=t.segment,n=t.feature,r=t.geometry,o=t.depth,a=t.index;let l;for(;e.length<r.getStride();)e.push(0);switch(r.getType()){case"MultiLineString":l=r.getCoordinates(),l[o[0]].splice(a+1,0,e);break;case"Polygon":l=r.getCoordinates(),l[o[0]].splice(a+1,0,e);break;case"MultiPolygon":l=r.getCoordinates(),l[o[1]][o[0]].splice(a+1,0,e);break;case"LineString":l=r.getCoordinates(),l.splice(a+1,0,e);break;default:return!1}this.setGeometryCoordinates_(r,l);const h=this.rBush_;h.remove(t),this.updateSegmentIndices_(r,a,o,1);const c={segment:[i[0],e],feature:n,geometry:r,depth:o,index:a};h.insert(ht(c.segment),c),this.dragSegments_.push([c,1]);const u={segment:[e,i[1]],feature:n,geometry:r,depth:o,index:a+1};return h.insert(ht(u.segment),u),this.dragSegments_.push([u,0]),!0}updatePointer_(t){var e;return t&&this.findInsertVerticesAndUpdateDragSegments_(t),(e=this.vertexFeature_)==null?void 0:e.getGeometry().getCoordinates()}getPoint(){var e;const t=(e=this.vertexFeature_)==null?void 0:e.getGeometry().getCoordinates();return t?Se(t,this.getMap().getView().getProjection()):null}canRemovePoint(){if(!this.vertexFeature_||this.vertexFeature_.get("geometries").every(i=>i.getType()==="Circle"||i.getType().endsWith("Point")))return!1;const t=this.vertexFeature_.getGeometry().getCoordinates();return this.rBush_.getInExtent(ht([t])).some(({segment:i})=>Et(i[0],t)||Et(i[1],t))}removePoint(t){if(t&&(t=Z(t,this.getMap().getView().getProjection()),this.updatePointer_(t)),!this.lastPointerEvent_||this.lastPointerEvent_&&this.lastPointerEvent_.type!=Y.POINTERDRAG){const e=this.lastPointerEvent_;this.willModifyFeatures_(e,this.dragSegments_.map(([n])=>n));const i=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new ao(oo.MODIFYEND,this.featuresBeingModified_,e)),this.featuresBeingModified_=null,i}return!1}removeVertex_(){const t=this.dragSegments_,e={};let i=!1,n,r,o,a,l,h,c,u,d,f,g;for(l=t.length-1;l>=0;--l)o=t[l],f=o[0],g=V(f.feature),f.depth&&(g+="-"+f.depth.join("-")),g in e||(e[g]={}),o[1]===0?(e[g].right=f,e[g].index=f.index):o[1]==1&&(e[g].left=f,e[g].index=f.index+1);for(g in e){switch(d=e[g].right,c=e[g].left,h=e[g].index,u=h-1,c!==void 0?f=c:f=d,u<0&&(u=0),a=f.geometry,r=a.getCoordinates(),n=r,i=!1,a.getType()){case"MultiLineString":r[f.depth[0]].length>2&&(r[f.depth[0]].splice(h,1),i=!0);break;case"LineString":r.length>2&&(r.splice(h,1),i=!0);break;case"MultiPolygon":n=n[f.depth[1]];case"Polygon":n=n[f.depth[0]],n.length>4&&(h==n.length-1&&(h=0),n.splice(h,1),i=!0,h===0&&(n.pop(),n.push(n[0]),u=n.length-1));break}if(i){this.setGeometryCoordinates_(a,r);const m=[];if(c!==void 0&&(this.rBush_.remove(c),m.push(c.segment[0])),d!==void 0&&(this.rBush_.remove(d),m.push(d.segment[1])),c!==void 0&&d!==void 0){const _={depth:f.depth,feature:f.feature,geometry:f.geometry,index:u,segment:m};this.rBush_.insert(ht(_.segment),_)}this.updateSegmentIndices_(a,h,f.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.length=0}}return i}canInsertPoint(){if(!this.vertexFeature_||this.vertexFeature_.get("geometries").every(i=>i.getType()==="Circle"||i.getType().endsWith("Point")))return!1;const t=this.vertexFeature_.getGeometry().getCoordinates();return this.rBush_.getInExtent(ht([t])).some(({segment:i})=>!(Et(i[0],t)||Et(i[1],t)))}insertPoint(t){var n;const e=t?Z(t,this.getMap().getView().getProjection()):(n=this.vertexFeature_)==null?void 0:n.getGeometry().getCoordinates();return e?this.findInsertVerticesAndUpdateDragSegments_(e).reduce((r,o)=>r||this.insertVertex_(o,e),!1):!1}setGeometryCoordinates_(t,e){this.changingFeature_=!0,t.setCoordinates(e),this.changingFeature_=!1}updateSegmentIndices_(t,e,i,n){this.rBush_.forEachInExtent(t.getExtent(),function(r){r.geometry===t&&(i===void 0||r.depth===void 0||ne(r.depth,i))&&r.index>e&&(r.index+=n)})}}function df(s,t){return s.index-t.index}function Kl(s,t,e){const i=t.geometry;if(i.getType()==="Circle"){let r=i;if(t.index===pn){const o=oe(r.getCenter(),Z(s)),a=Math.sqrt(o)-r.getRadius();return a*a}}const n=Z(s);return Li[0]=Z(t.segment[0]),Li[1]=Z(t.segment[1]),Th(n,Li)}function Ul(s,t,e){const i=t.geometry;if(i.getType()==="Circle"&&t.index===pn)return Se(i.getClosestPoint(Z(s)));const n=Z(s);return Li[0]=Z(t.segment[0]),Li[1]=Z(t.segment[1]),Se(Ns(n,Li))}function ff(){const s=Ir();return function(t,e){return s.Point}}const gf=40,_f=300;class mf extends Ri{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:mn;this.condition_=t.onFocusOnly?Jr(Nl,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!==D.WHEEL)return!0;const i=t.map,n=t.originalEvent;n.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.pixel);let r=n.deltaY;switch(n.deltaMode){case WheelEvent.DOM_DELTA_LINE:r*=gf;break;case WheelEvent.DOM_DELTA_PAGE:r*=_f;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=i.getView();if(this.mode_==="trackpad"&&!(a.getConstrainResolution()||this.constrainResolution_))return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(a.getAnimating()&&a.cancelAnimations(),a.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),a.adjustZoom(-r/this.deltaPerZoom_,this.lastAnchor_?i.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,i),l),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let i=-rt(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),$r(e,i,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)}}class yf extends ge{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=Be),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=t.threshold!==void 0?t.threshold:.3,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){let e=0;const i=this.targetPointers[0],n=this.targetPointers[1],r=Math.atan2(n.clientY-i.clientY,n.clientX-i.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!==Br&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(no(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}}class pf extends ge{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=Be),super(e),this.anchor_=null,this.duration_=t.duration!==void 0?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const i=this.targetPointers[0],n=this.targetPointers[1],r=i.clientX-n.clientX,o=i.clientY-n.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(no(this.targetPointers))),l.render(),h.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const i=t.map.getView(),n=this.lastScaleDelta_>1?1:-1;return i.endInteraction(this.duration_,n),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}const xf={SELECT:"select"};class Ef extends St{constructor(t,e,i,n){super(t),this.selected=e,this.deselected=i,this.mapBrowserEvent=n}}const Cs={};class lo extends Ri{constructor(t){super(),this.on,this.once,this.un,t=t||{},this.boundAddFeature_=this.addFeature_.bind(this),this.boundRemoveFeature_=this.removeFeature_.bind(this),this.condition_=t.condition?t.condition:Wl,this.addCondition_=t.addCondition?t.addCondition:Qr,this.removeCondition_=t.removeCondition?t.removeCondition:Qr,this.toggleCondition_=t.toggleCondition?t.toggleCondition:eo,this.multi_=t.multi?t.multi:!1,this.filter_=t.filter?t.filter:zt,this.hitTolerance_=t.hitTolerance?t.hitTolerance:0,this.style_=t.style!==void 0?t.style:Cf(),this.features_=t.features||new _t;let e;if(t.layers)if(typeof t.layers=="function")e=t.layers;else{const i=t.layers;e=function(n){return i.includes(n)}}else e=zt;this.layerFilter_=e,this.featureLayerAssociation_={}}addFeatureLayerAssociation_(t,e){this.featureLayerAssociation_[V(t)]=e}getFeatures(){return this.features_}getHitTolerance(){return this.hitTolerance_}getLayer(t){return this.featureLayerAssociation_[V(t)]}setHitTolerance(t){this.hitTolerance_=t}setMap(t){this.getMap()&&this.style_&&this.features_.forEach(this.restorePreviousStyle_.bind(this)),super.setMap(t),t?(this.features_.addEventListener(nt.ADD,this.boundAddFeature_),this.features_.addEventListener(nt.REMOVE,this.boundRemoveFeature_),this.style_&&this.features_.forEach(this.applySelectedStyle_.bind(this))):(this.features_.removeEventListener(nt.ADD,this.boundAddFeature_),this.features_.removeEventListener(nt.REMOVE,this.boundRemoveFeature_))}addFeature_(t){const e=t.element;if(this.style_&&this.applySelectedStyle_(e),!this.getLayer(e)){const i=this.getMap().getAllLayers().find(function(n){if(n instanceof cs&&n.getSource()&&n.getSource().hasFeature(e))return n});i&&this.addFeatureLayerAssociation_(e,i)}}removeFeature_(t){this.style_&&this.restorePreviousStyle_(t.element)}getStyle(){return this.style_}applySelectedStyle_(t){const e=V(t);e in Cs||(Cs[e]=t.getStyle()),t.setStyle(this.style_)}restorePreviousStyle_(t){const e=this.getMap().getInteractions().getArray();for(let n=e.length-1;n>=0;--n){const r=e[n];if(r!==this&&r instanceof lo&&r.getStyle()&&r.getFeatures().getArray().lastIndexOf(t)!==-1){t.setStyle(r.getStyle());return}}const i=V(t);t.setStyle(Cs[i]),delete Cs[i]}removeFeatureLayerAssociation_(t){delete this.featureLayerAssociation_[V(t)]}handleEvent(t){if(!this.condition_(t))return!0;const e=this.addCondition_(t),i=this.removeCondition_(t),n=this.toggleCondition_(t),r=!e&&!i&&!n,o=t.map,a=this.getFeatures(),l=[],h=[];if(r){ai(this.featureLayerAssociation_),o.forEachFeatureAtPixel(t.pixel,(c,u)=>{if(!(!(c instanceof Tt)||!this.filter_(c,u)))return this.addFeatureLayerAssociation_(c,u),h.push(c),!this.multi_},{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(let c=a.getLength()-1;c>=0;--c){const u=a.item(c),d=h.indexOf(u);d>-1?h.splice(d,1):(a.remove(u),l.push(u))}h.length!==0&&a.extend(h)}else{o.forEachFeatureAtPixel(t.pixel,(c,u)=>{if(!(!(c instanceof Tt)||!this.filter_(c,u)))return(e||n)&&!a.getArray().includes(c)?(this.addFeatureLayerAssociation_(c,u),h.push(c)):(i||n)&&a.getArray().includes(c)&&(l.push(c),this.removeFeatureLayerAssociation_(c)),!this.multi_},{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(let c=l.length-1;c>=0;--c)a.remove(l[c]);a.extend(h)}return(h.length>0||l.length>0)&&this.dispatchEvent(new Ef(xf.SELECT,h,l,t)),!0}}function Cf(){const s=Ir();return At(s.Polygon,s.LineString),At(s.GeometryCollection,s.LineString),function(t){return t.getGeometry()?s[t.getGeometry().getType()]:null}}const ho={SNAP:"snap",UNSNAP:"unsnap"};class co extends St{constructor(t,e){super(t),this.vertex=e.vertex,this.vertexPixel=e.vertexPixel,this.feature=e.feature,this.segment=e.segment}}const uo={Circle(s,t){const i=Pd(s);return uo.Polygon(i)},GeometryCollection(s,t){const e=[],i=s.getGeometriesArray();for(let n=0;n<i.length;++n){const r=uo[i[n].getType()];r&&e.push(r(i[n],t))}return e.flat()},LineString(s){const t=[],e=s.getFlatCoordinates(),i=s.getStride();for(let n=0,r=e.length-i;n<r;n+=i)t.push([e.slice(n,n+2),e.slice(n+i,n+i+2)]);return t},MultiLineString(s){const t=[],e=s.getFlatCoordinates(),i=s.getStride(),n=s.getEnds();let r=0;for(let o=0,a=n.length;o<a;++o){const l=n[o];for(let h=r,c=l-i;h<c;h+=i)t.push([e.slice(h,h+2),e.slice(h+i,h+i+2)]);r=l}return t},MultiPoint(s){const t=[],e=s.getFlatCoordinates(),i=s.getStride();for(let n=0,r=e.length;n<r;n+=i)t.push([e.slice(n,n+2)]);return t},MultiPolygon(s){const t=[],e=s.getFlatCoordinates(),i=s.getStride(),n=s.getEndss();let r=0;for(let o=0,a=n.length;o<a;++o){const l=n[o];for(let h=0,c=l.length;h<c;++h){const u=l[h];for(let d=r,f=u-i;d<f;d+=i)t.push([e.slice(d,d+2),e.slice(d+i,d+i+2)]);r=u}}return t},Point(s){return[[s.getFlatCoordinates().slice(0,2)]]},Polygon(s){const t=[],e=s.getFlatCoordinates(),i=s.getStride(),n=s.getEnds();let r=0;for(let o=0,a=n.length;o<a;++o){const l=n[o];for(let h=r,c=l-i;h<c;h+=i)t.push([e.slice(h,h+2),e.slice(h+i,h+i+2)]);r=l}return t}};function Zl(s){return s.feature?s.feature:s.element?s.element:null}const fo=[],ye=[],Ai=[];class wf extends ge{constructor(t){t=t||{};const e=t;e.handleDownEvent||(e.handleDownEvent=zt),e.stopDown||(e.stopDown=Be),super(e),this.on,this.once,this.un,this.source_=t.source?t.source:null,this.vertex_=t.vertex!==void 0?t.vertex:!0,this.edge_=t.edge!==void 0?t.edge:!0,this.intersection_=t.intersection!==void 0?t.intersection:!1,this.features_=t.features?t.features:null,this.featuresListenerKeys_=[],this.featureChangeListenerKeys_={},this.indexedFeaturesExtents_={},this.pendingFeatures_={},this.pixelTolerance_=t.pixelTolerance!==void 0?t.pixelTolerance:10,this.rBush_=new gs,this.snapped_=null,this.segmenters_=Object.assign({},uo,t.segmenters)}addFeature(t,e){e=e!==void 0?e:!0;const i=V(t),n=t.getGeometry();if(n){const r=this.segmenters_[n.getType()];if(r){this.indexedFeaturesExtents_[i]=n.getExtent(Ft());const o=r(n,this.getMap().getView().getProjection());let a=o.length;for(let l=0;l<a;++l){const h=o[l];ye[l]=ht(h),Ai[l]={feature:t,segment:h}}if(ye.length=a,Ai.length=a,this.intersection_)for(let l=0,h=o.length;l<h;++l){const c=o[l];if(c.length===1)continue;const u=ye[l];for(let f=0,g=o.length;f<g;++f){if(l===f||l-1===f||l+1===f)continue;const m=o[f];if(!dt(u,ye[f]))continue;const _=wl(c,m);if(!_)continue;const y=[_];ye[a]=ht(y),Ai[a++]={feature:t,segment:y,isIntersection:!0}}const d=this.rBush_.getInExtent(ye[l]);for(const{segment:f}of d){if(f.length===1)continue;const g=wl(c,f);if(!g)continue;const m=[g];ye[a]=ht(m),Ai[a++]={feature:t,segment:m,isIntersection:!0}}}a===1?this.rBush_.insert(ye[0],Ai[0]):this.rBush_.load(ye,Ai)}}e&&(this.featureChangeListenerKeys_[i]=W(t,D.CHANGE,this.handleFeatureChange_,this))}getFeatures_(){let t;return this.features_?t=this.features_:this.source_&&(t=this.source_.getFeatures()),t}areSnapDataEqual_(t,e){return t.segment===e.segment&&t.feature===e.feature}handleEvent(t){const e=this.snapTo(t.pixel,t.coordinate,t.map);return e?(t.coordinate=e.vertex.slice(0,2),t.pixel=e.vertexPixel,this.snapped_&&!this.areSnapDataEqual_(this.snapped_,e)&&this.dispatchEvent(new co(ho.UNSNAP,this.snapped_)),this.snapped_={vertex:t.coordinate,vertexPixel:t.pixel,feature:e.feature,segment:e.segment},this.dispatchEvent(new co(ho.SNAP,this.snapped_))):this.snapped_&&(this.dispatchEvent(new co(ho.UNSNAP,this.snapped_)),this.snapped_=null),super.handleEvent(t)}handleFeatureAdd_(t){const e=Zl(t);e&&this.addFeature(e)}handleFeatureRemove_(t){const e=Zl(t);e&&this.removeFeature(e)}handleFeatureChange_(t){const e=t.target;if(this.handlingDownUpSequence){const i=V(e);i in this.pendingFeatures_||(this.pendingFeatures_[i]=e)}else this.updateFeature_(e)}handleUpEvent(t){const e=Object.values(this.pendingFeatures_);if(e.length)for(const i of e)this.updateFeature_(i);return!1}removeFeature(t,e){const i=e!==void 0?e:!0,n=V(t),r=this.indexedFeaturesExtents_[n];if(r){const o=this.rBush_,a=[];o.forEachInExtent(r,function(l){t===l.feature&&a.push(l)});for(let l=a.length-1;l>=0;--l)o.remove(a[l])}i&&($(this.featureChangeListenerKeys_[n]),delete this.featureChangeListenerKeys_[n])}setMap(t){const e=this.getMap(),i=this.featuresListenerKeys_;let n=this.getFeatures_();if(Array.isArray(n)||(n=n.getArray()),e&&(i.forEach($),i.length=0,this.rBush_.clear(),Object.values(this.featureChangeListenerKeys_).forEach($),this.featureChangeListenerKeys_={}),super.setMap(t),t){this.features_?i.push(W(this.features_,nt.ADD,this.handleFeatureAdd_,this),W(this.features_,nt.REMOVE,this.handleFeatureRemove_,this)):this.source_&&i.push(W(this.source_,mt.ADDFEATURE,this.handleFeatureAdd_,this),W(this.source_,mt.REMOVEFEATURE,this.handleFeatureRemove_,this));for(const r of n)this.addFeature(r)}}snapTo(t,e,i){i.getView().getProjection();const n=Z(e),r=Wn(bi(ht([n]),i.getView().getResolution()*this.pixelTolerance_)),o=this.rBush_.getInExtent(r),a=o.length;if(a===0)return null;let l,h=1/0,c,u=null,d;const f=this.pixelTolerance_*this.pixelTolerance_,g=()=>{if(l){const m=i.getPixelFromCoordinate(l);if(oe(t,m)<=f&&(d&&this.intersection_||!d&&(this.vertex_||this.edge_)))return{vertex:l,vertexPixel:[Math.round(m[0]),Math.round(m[1])],feature:c,segment:u}}return null};if(this.vertex_||this.intersection_){for(let _=0;_<a;++_){const y=o[_];if(y.feature.getGeometry().getType()!=="Circle")for(const p of y.segment){const E=Z(p),x=oe(n,E);x<h&&(l=p,h=x,c=y.feature,d=y.isIntersection)}}const m=g();if(m)return m}if(this.edge_){for(let _=0;_<a;++_){let y=null;const p=o[_];if(p.feature.getGeometry().getType()==="Circle"){let E=p.feature.getGeometry();y=Rh(n,E)}else{const[E,x]=p.segment;x&&(fo[0]=Z(E),fo[1]=Z(x),y=Ns(n,fo))}if(y){const E=oe(n,y);E<h&&(l=Se(y),u=p.feature.getGeometry().getType()==="Circle"?null:p.segment,h=E,c=p.feature)}}const m=g();if(m)return m}return null}updateFeature_(t){this.removeFeature(t,!1),this.addFeature(t,!1)}}const go={TRANSLATESTART:"translatestart",TRANSLATING:"translating",TRANSLATEEND:"translateend"};class _o extends St{constructor(t,e,i,n,r){super(t),this.features=e,this.coordinate=i,this.startCoordinate=n,this.mapBrowserEvent=r}}class Sf extends ge{constructor(t){t=t||{},super(t),this.on,this.once,this.un,this.lastCoordinate_=null,this.startCoordinate_=null,this.features_=t.features!==void 0?t.features:null;let e;if(t.layers&&!this.features_)if(typeof t.layers=="function")e=t.layers;else{const i=t.layers;e=function(n){return i.includes(n)}}else e=zt;this.layerFilter_=e,this.filter_=t.filter&&!this.features_?t.filter:zt,this.hitTolerance_=t.hitTolerance?t.hitTolerance:0,this.condition_=t.condition?t.condition:mn,this.lastFeature_=null,this.addChangeListener(_s.ACTIVE,this.handleActiveChanged_)}handleDownEvent(t){if(!t.originalEvent||!this.condition_(t))return!1;if(this.lastFeature_=this.featuresAtPixel_(t.pixel,t.map),!this.lastCoordinate_&&this.lastFeature_){this.startCoordinate_=t.coordinate,this.lastCoordinate_=t.coordinate,this.handleMoveEvent(t);const e=this.features_||new _t([this.lastFeature_]);return this.dispatchEvent(new _o(go.TRANSLATESTART,e,t.coordinate,this.startCoordinate_,t)),!0}return!1}handleUpEvent(t){if(this.lastCoordinate_){this.lastCoordinate_=null,this.handleMoveEvent(t);const e=this.features_||new _t([this.lastFeature_]);return this.dispatchEvent(new _o(go.TRANSLATEEND,e,t.coordinate,this.startCoordinate_,t)),this.startCoordinate_=null,!0}return!1}handleDragEvent(t){if(this.lastCoordinate_){const e=t.coordinate;t.map.getView().getProjection();const i=Z(e),n=Z(this.lastCoordinate_),r=i[0]-n[0],o=i[1]-n[1],a=this.features_||new _t([this.lastFeature_]);a.forEach(function(l){const h=l.getGeometry();h.translate(r,o),l.setGeometry(h)}),this.lastCoordinate_=e,this.dispatchEvent(new _o(go.TRANSLATING,a,e,this.startCoordinate_,t))}}handleMoveEvent(t){const e=t.map.getViewport();this.featuresAtPixel_(t.pixel,t.map)?(e.classList.remove(this.lastCoordinate_?"ol-grab":"ol-grabbing"),e.classList.add(this.lastCoordinate_?"ol-grabbing":"ol-grab")):e.classList.remove("ol-grab","ol-grabbing")}featuresAtPixel_(t,e){return e.forEachFeatureAtPixel(t,(i,n)=>{if(!(!(i instanceof Tt)||!this.filter_(i,n))&&!(this.features_&&!this.features_.getArray().includes(i)))return i},{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_})}getHitTolerance(){return this.hitTolerance_}setHitTolerance(t){this.hitTolerance_=t}setMap(t){const e=this.getMap();super.setMap(t),this.updateState_(e)}handleActiveChanged_(){this.updateState_(null)}updateState_(t){let e=this.getMap();const i=this.getActive();(!e||!i)&&(e=e||t,e&&e.getViewport().classList.remove("ol-grab","ol-grabbing"))}}class If{constructor(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]<t)return!1;let i=e-3;for(;i>0&&this.points_[i+2]>t;)i-=3;const n=this.points_[e+2]-this.points_[i+2];if(n<16.666666666666668)return!1;const r=this.points_[e]-this.points_[i],o=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(o,r),this.initialVelocity_=Math.sqrt(r*r+o*o)/n,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}function Rf(s){s=s||{};const t=new _t,e=new If(-.005,.05,100);return(s.altShiftDragRotate!==void 0?s.altShiftDragRotate:!0)&&t.push(new ef),(s.doubleClickZoom!==void 0?s.doubleClickZoom:!0)&&t.push(new Kd({delta:s.zoomDelta,duration:s.zoomDuration})),(s.dragPan!==void 0?s.dragPan:!0)&&t.push(new tf({onFocusOnly:s.onFocusOnly,kinetic:e})),(s.pinchRotate!==void 0?s.pinchRotate:!0)&&t.push(new yf),(s.pinchZoom!==void 0?s.pinchZoom:!0)&&t.push(new pf({duration:s.zoomDuration})),(s.keyboard!==void 0?s.keyboard:!0)&&(t.push(new hf),t.push(new cf({delta:s.zoomDelta,duration:s.zoomDuration}))),(s.mouseWheelZoom!==void 0?s.mouseWheelZoom:!0)&&t.push(new mf({onFocusOnly:s.onFocusOnly,duration:s.zoomDuration})),(s.shiftDragZoom!==void 0?s.shiftDragZoom:!0)&&t.push(new nf({duration:s.zoomDuration})),t}class vf{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=Tt,this.supportedMediaTypes=null}getReadOptions(t,e){if(e){let i=e.dataProjection?ot(e.dataProjection):this.readProjection(t);e.extent&&i&&i.getUnits()==="tile-pixels"&&(i=ot(i),i.setWorldExtent(e.extent)),e={dataProjection:i,featureProjection:e.featureProjection}}return this.adaptOptions(e)}adaptOptions(t){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},t)}getType(){return O()}readFeature(t,e){return O()}readFeatures(t,e){return O()}readGeometry(t,e){return O()}readProjection(t){return O()}writeFeature(t,e){return O()}writeFeatures(t,e){return O()}writeGeometry(t,e){return O()}}function mo(s,t,e){const i=e?ot(e.featureProjection):null,n=e?ot(e.dataProjection):null;let r=s;if(i&&n&&!$s(i,n)){t&&(r=s.clone());const o=t?i:n,a=t?n:i;o.getUnits()==="tile-pixels"?r.transform(o,a):r.applyTransform(ji(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===s&&(r=s.clone()),r.applyTransform(a)}return r}const Tf={Point:Kt,LineString:Qt,Polygon:Ut,MultiPoint:_n,MultiLineString:Si,MultiPolygon:Ii};function Pf(s,t,e){return Array.isArray(t[0])?(Il(s,0,t,e)||(s=s.slice(),jr(s,0,t,e)),s):(zr(s,0,t,e)||(s=s.slice(),as(s,0,t,e)),s)}function Hl(s,t){var r;const e=s.geometry;if(!e)return[];if(Array.isArray(e))return e.map(o=>Hl({...s,geometry:o})).flat();const i=e.type==="MultiPolygon"?"Polygon":e.type;if(i==="GeometryCollection"||i==="Circle")throw new Error("Unsupported geometry type: "+i);const n=e.layout.length;return mo(new Lt(i,i==="Polygon"?Pf(e.flatCoordinates,e.ends,n):e.flatCoordinates,(r=e.ends)==null?void 0:r.flat(),n,s.properties||{},s.id).enableSimplifyTransformed(),!1,t)}function yo(s,t){if(!s)return null;if(Array.isArray(s)){const i=s.map(n=>yo(n,t));return new gn(i)}const e=Tf[s.type];return mo(new e(s.flatCoordinates,s.layout||"XY",s.ends),!1,t)}class Mf extends vf{constructor(){super()}getType(){return"json"}readFeature(t,e){return this.readFeatureFromObject(ws(t),this.getReadOptions(t,e))}readFeatures(t,e){return this.readFeaturesFromObject(ws(t),this.getReadOptions(t,e))}readFeatureFromObject(t,e){return O()}readFeaturesFromObject(t,e){return O()}readGeometry(t,e){return this.readGeometryFromObject(ws(t),this.getReadOptions(t,e))}readGeometryFromObject(t,e){return O()}readProjection(t){return this.readProjectionFromObject(ws(t))}readProjectionFromObject(t){return O()}writeFeature(t,e){return JSON.stringify(this.writeFeatureObject(t,e))}writeFeatureObject(t,e){return O()}writeFeatures(t,e){return JSON.stringify(this.writeFeaturesObject(t,e))}writeFeaturesObject(t,e){return O()}writeGeometry(t,e){return JSON.stringify(this.writeGeometryObject(t,e))}writeGeometryObject(t,e){return O()}}function ws(s){if(typeof s=="string"){const t=JSON.parse(s);return t||null}return s!==null?s:null}class ql extends Mf{constructor(t){t=t||{},super(),this.dataProjection=ot(t.dataProjection?t.dataProjection:"EPSG:4326"),t.featureProjection&&(this.defaultFeatureProjection=ot(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 i=null;t.type==="Feature"?i=t:i={type:"Feature",geometry:t,properties:null};const n=po(i.geometry);if(this.featureClass===Lt)return Hl({geometry:n,id:i.id,properties:i.properties},e);const r=new Tt;return this.geometryName_?r.setGeometryName(this.geometryName_):this.extractGeometryName_&&i.geometry_name&&r.setGeometryName(i.geometry_name),r.setGeometry(yo(n,e)),"id"in i&&r.setId(i.id),i.properties&&r.setProperties(i.properties,!0),r}readFeaturesFromObject(t,e){const i=t;let n=null;if(i.type==="FeatureCollection"){const r=t;n=[];const o=r.features;for(let a=0,l=o.length;a<l;++a){const h=this.readFeatureFromObject(o[a],e);h&&n.push(h)}}else n=[this.readFeatureFromObject(t,e)];return n.flat()}readGeometryFromObject(t,e){return Lf(t,e)}readProjectionFromObject(t){const e=t.crs;let i;if(e)if(e.type=="name")i=ot(e.properties.name);else if(e.type==="EPSG")i=ot("EPSG:"+e.properties.code);else throw new Error("Unknown SRS type");else i=this.dataProjection;return i}writeFeatureObject(t,e){e=this.adaptOptions(e);const i={type:"Feature",geometry:null,properties:null},n=t.getId();if(n!==void 0&&(i.id=n),!t.hasProperties())return i;const r=t.getProperties(),o=t.getGeometry();return o&&(i.geometry=xo(o,e),delete r[t.getGeometryName()]),Xe(r)||(i.properties=r),i}writeFeaturesObject(t,e){e=this.adaptOptions(e);const i=[];for(let n=0,r=t.length;n<r;++n)i.push(this.writeFeatureObject(t[n],e));return{type:"FeatureCollection",features:i}}writeGeometryObject(t,e){return xo(t,this.adaptOptions(e))}}function po(s,t){if(!s)return null;let e;switch(s.type){case"Point":{e=Ff(s);break}case"LineString":{e=bf(s);break}case"Polygon":{e=Nf(s);break}case"MultiPoint":{e=Of(s);break}case"MultiLineString":{e=Df(s);break}case"MultiPolygon":{e=kf(s);break}case"GeometryCollection":{e=Af(s);break}default:throw new Error("Unsupported GeoJSON type: "+s.type)}return e}function Lf(s,t){const e=po(s);return yo(e,t)}function Af(s,t){return s.geometries.map(function(i){return po(i)})}function Ff(s){const t=s.coordinates;return{type:"Point",flatCoordinates:t,layout:He(t.length)}}function bf(s){var i;const t=s.coordinates,e=t.flat();return{type:"LineString",flatCoordinates:e,ends:[e.length],layout:He(((i=t[0])==null?void 0:i.length)||2)}}function Df(s){var r,o;const t=s.coordinates,e=((o=(r=t[0])==null?void 0:r[0])==null?void 0:o.length)||2,i=[],n=dn(i,0,t,e);return{type:"MultiLineString",flatCoordinates:i,ends:n,layout:He(e)}}function Of(s){var e;const t=s.coordinates;return{type:"MultiPoint",flatCoordinates:t.flat(),layout:He(((e=t[0])==null?void 0:e.length)||2)}}function kf(s){var r,o;const t=s.coordinates,e=[],i=((o=(r=t[0])==null?void 0:r[0])==null?void 0:o[0].length)||2,n=xl(e,0,t,i);return{type:"MultiPolygon",flatCoordinates:e,ends:n,layout:He(i)}}function Nf(s){var r,o;const t=s.coordinates,e=[],i=(o=(r=t[0])==null?void 0:r[0])==null?void 0:o.length,n=dn(e,0,t,i);return{type:"Polygon",flatCoordinates:e,ends:n,layout:He(i)}}function xo(s,t){s=mo(s,!0,t);const e=s.getType();let i;switch(e){case"Point":{i=Vf(s);break}case"LineString":{i=Wf(s);break}case"Polygon":{i=Bf(s,t);break}case"MultiPoint":{i=jf(s);break}case"MultiLineString":{i=zf(s);break}case"MultiPolygon":{i=Xf(s,t);break}case"GeometryCollection":{i=Gf(s,t);break}case"Circle":{i={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+e)}return i}function Gf(s,t){return t=Object.assign({},t),delete t.featureProjection,{type:"GeometryCollection",geometries:s.getGeometriesArray().map(function(i){return xo(i,t)})}}function Wf(s,t){return{type:"LineString",coordinates:s.getCoordinates()}}function zf(s,t){return{type:"MultiLineString",coordinates:s.getCoordinates()}}function jf(s,t){return{type:"MultiPoint",coordinates:s.getCoordinates()}}function Xf(s,t){let e;return t&&(e=t.rightHanded),{type:"MultiPolygon",coordinates:s.getCoordinates(e)}}function Vf(s,t){return{type:"Point",coordinates:s.getCoordinates()}}function Bf(s,t){let e;return t&&(e=t.rightHanded),{type:"Polygon",coordinates:s.getCoordinates(e)}}function $l(s,t){t.feature.set("__type","zone");const e=s.getView().getProjection(),{geometry:i}=new ql().writeFeatureObject(t.feature,{featureProjection:e,dataProjection:e});return i}function Yf(s){return{type:"Feature",id:s.id,geometry:s.geometry,properties:{id:s.id,name:s.name,color:s.color,__type:"zone"}}}function Kf(s){return{type:"FeatureCollection",features:s.filter(t=>t.geometry).map(Yf)}}function Uf(s,t){const e=s.getView().getProjection();return new ql().readFeatures(Kf(t),{featureProjection:e,dataProjection:e})}function Zf({colors:s,angles:t=[45,-45],gap:e=32,lineWidth:i=32,background:n=null,lineCap:r="butt",dash:o}){return(!s||s.length===0)&&(s=["#000"]),new Mt({renderer(a,l){a=a;const h=l.context,c=l.geometry.clone();c.setCoordinates(a),h.save(),h.beginPath(),a[0].forEach(([p,E],x)=>{x===0?h.moveTo(p,E):h.lineTo(p,E)}),h.closePath(),h.clip("nonzero"),n&&(h.fillStyle=n,h.fill("nonzero"));const[u,d,f,g]=c.getExtent(),m=f-u,_=g-d;if(m<=0||_<=0){h.restore();return}const y=Math.hypot(m,_);h.lineWidth=i,h.lineCap=r,o&&o.length&&h.setLineDash(o),t.forEach(p=>{if(p>0)return;h.save();const E=u+m/2,x=d+_/2;h.translate(E,x),h.rotate(p*Math.PI/180),h.translate(-E,-x);const C=d-y,S=g+y;let T=0;for(let I=C;I<=S;I+=e,T++)h.strokeStyle=s[T%s.length],h.beginPath(),h.moveTo(u-y,I),h.lineTo(f+y,I),h.stroke();h.restore()}),o&&o.length&&h.setLineDash([]),h.restore()}})}const Jl={name:"ppe-zoning",getInitialState:s=>{const{layer:t,source:e}=eg(s==null?void 0:s._extent),i=new lo({layers:[t]}),n=new uf({source:e,features:i.getFeatures()}),r=new Sf({layers:[t],condition:qd,features:i.getFeatures()});return{zones:[],_zoneLayer:t,_zoneSource:e,_zoneModify:n,_zoneSelect:i,_zoneTranslate:r,...s}},createPlanEditor:s=>{const{_zoneModify:t,_zoneSelect:e,_zoneLayer:i,_zoneTranslate:n}=s.initialState;i&&s.addLayer(i),e&&s.addInteraction(e),t&&s.addInteraction(t),n&&s.addInteraction(n),Hf(s),tg(s),s.drawZone=r=>qf(s,r),s.deleteZone=r=>Jf(s,r),s.updateZone=r=>$f(s,r),s.setZoningMode=r=>Qf(s,r)}};function Hf(s){const{zones:t}=s.getState();s.initialState._zoneSource.addFeatures(Uf(s,t))}function qf(s,t){const e=s.initialState;e._zoneDraw&&s.removeInteraction(e._zoneDraw),e._zoneSnap&&s.removeInteraction(e._zoneSnap),e._zoneSelect&&s.removeInteraction(e._zoneSelect),e._zoneDraw=new of({source:e._zoneSource,type:"Polygon",geometryName:"zone"}),e._zoneSnap=new wf({source:e._zoneSource}),s.addInteraction(e._zoneDraw),s.addInteraction(e._zoneSnap),e._zoneDraw.on("drawend",i=>{var r,o;i.feature.setId(t.id),i.feature.setProperties({id:t.id,name:t.name,color:t.color});const n=$l(s,i);(o=(r=s.options).onZoneDrawn)==null||o.call(r,{...t,geometry:n}),e._zoneDraw&&s.removeInteraction(e._zoneDraw),e._zoneSnap&&s.removeInteraction(e._zoneSnap),e._zoneSelect&&s.addInteraction(e._zoneSelect)})}function $f(s,t){var r;const{_zoneModify:e,_zoneSelect:i}=s.initialState,n=(r=s.initialState._zoneSource)==null?void 0:r.getFeatureById(t.id);!e||!i||!n||(s.addInteraction(e),i.getFeatures().push(n),e.on("modifyend",()=>{var a,l;const o=$l(s,{feature:n});(l=(a=s.options).onZoneUpdated)==null||l.call(a,{...t,geometry:o})}))}function Jf(s,t){var i,n,r,o;const e=(i=s.initialState._zoneSource)==null?void 0:i.getFeatureById(t);e&&((n=s.initialState._zoneSource)==null||n.removeFeature(e)),(o=(r=s.options).onZoneDeleted)==null||o.call(r,t)}function Qf(s,t){const{_zoneLayer:e}=s.initialState;t==="occupation"?e.setStyle(i=>{var a,l;const n=i.getProperties(),r=((l=(a=s.options).getZoneOccupationColors)==null?void 0:l.call(a,n))??[n.color],o=r.length?r:["rgba(0,0,0,0)"];return[...Eo(i.getProperties()),Zf({colors:o})]}):e.setStyle(i=>Eo(i.getProperties()))}function tg(s){s.on("pointermove",t=>{var i;const e=s.forEachFeatureAtPixel(t.pixel,n=>n);if(e&&e.get("__type")==="zone"){const n=e.getProperties(),r=(i=s.options.zoningConfig)==null?void 0:i.popup,o=r&&r.template?r.template(n):ig(n);s._showPopup({event:t,content:o})}else e||s._hidePopup()})}function eg(s){const t=new qr({wrapX:!1}),e=new cs({source:t,style:i=>Eo(i.getProperties())});return s&&e.setExtent(s),{layer:e,source:t}}function Eo({color:s}){return[new Mt({stroke:new Ae({color:s,width:3}),fill:new Le({color:s+"80"})})]}function ig(s){return`
|
|
7
|
+
<div style="display: flex; gap: 1rem; background-color: rgba(220,220,220,0.75); padding: 1rem">
|
|
8
|
+
<div style="height: 1rem; width: 1rem; background-color: ${s.color}"></div>
|
|
9
|
+
<div>${s.name}</div>
|
|
10
|
+
</div>
|
|
11
|
+
`}let Co;const xn=[];function Ql(s,t,e,i,n){s.beginPath(),s.moveTo(0,0),s.lineTo(t,e),s.lineTo(i,n),s.closePath(),s.save(),s.clip(),s.fillRect(0,0,Math.max(t,i)+1,Math.max(e,n)),s.restore()}function wo(s,t){return Math.abs(s[t*4]-210)>2||Math.abs(s[t*4+3]-191.25)>2}function ng(){if(Co===void 0){const s=ut(6,6,xn);s.globalCompositeOperation="lighter",s.fillStyle="rgba(210, 0, 0, 0.75)",Ql(s,4,5,4,0),Ql(s,4,5,0,5);const t=s.getImageData(0,0,3,3).data;Co=wo(t,0)||wo(t,4)||wo(t,8),Xs(s),xn.push(s.canvas)}return Co}function sg(s,t,e,i){const n=ca(e,t,s);let r=la(t,i,e);const o=t.getMetersPerUnit();o!==void 0&&(r*=o);const a=s.getMetersPerUnit();a!==void 0&&(r/=a);const l=s.getExtent();if(!l||Di(l,n)){const h=la(s,r,n)/r;isFinite(h)&&h>0&&(r/=h)}return r}function rg(s,t,e,i,n,r,o,a,l,h,c,u,d,f){const g=ut(Math.round(e*s),Math.round(e*t),xn);if(u||(g.imageSmoothingEnabled=!1),l.length===0)return g.canvas;g.scale(e,e);function m(C){return Math.round(C*e)/e}g.globalCompositeOperation="lighter";const _=Ft();l.forEach(function(C,S,T){ko(_,C.extent)});let y;const p=e/i,E=(u?1:1+Math.pow(2,-24))/p;(l.length!==1||h!==0)&&(y=ut(Math.round(U(_)*p),Math.round(ct(_)*p),xn),u||(y.imageSmoothingEnabled=!1),l.forEach(function(C,S,T){if(C.image.width>0&&C.image.height>0){if(C.clipExtent){y.save();const N=(C.clipExtent[0]-_[0])*p,j=-(C.clipExtent[3]-_[3])*p,F=U(C.clipExtent)*p,q=ct(C.clipExtent)*p;y.rect(u?N:Math.round(N),u?j:Math.round(j),u?F:Math.round(N+F)-Math.round(N),u?q:Math.round(j+q)-Math.round(j)),y.clip()}const I=(C.extent[0]-_[0])*p,R=-(C.extent[3]-_[3])*p,M=U(C.extent)*p,k=ct(C.extent)*p;y.drawImage(C.image,h,h,C.image.width-2*h,C.image.height-2*h,u?I:Math.round(I),u?R:Math.round(R),u?M:Math.round(I+M)-Math.round(I),u?k:Math.round(R+k)-Math.round(R)),C.clipExtent&&y.restore()}}));const x=Pn(o);return a.getTriangles().forEach(function(C,S,T){const I=C.source,R=C.target;let M=I[0][0],k=I[0][1],N=I[1][0],j=I[1][1],F=I[2][0],q=I[2][1];const b=m((R[0][0]-x[0])/r),z=m(-(R[0][1]-x[1])/r),X=m((R[1][0]-x[0])/r),tt=m(-(R[1][1]-x[1])/r),Q=m((R[2][0]-x[0])/r),et=m(-(R[2][1]-x[1])/r),v=M,pe=k;M=0,k=0,N-=v,j-=pe,F-=v,q-=pe;const ti=[[N,j,0,0,X-b],[F,q,0,0,Q-b],[0,0,N,j,tt-z],[0,0,F,q,et-z]],xt=Sh(ti);if(!xt)return;if(g.save(),g.beginPath(),ng()||!u){g.moveTo(X,tt);const Zt=4,ke=b-X,Cn=z-tt;for(let ee=0;ee<Zt;ee++)g.lineTo(X+m((ee+1)*ke/Zt),tt+m(ee*Cn/(Zt-1))),ee!=Zt-1&&g.lineTo(X+m((ee+1)*ke/Zt),tt+m((ee+1)*Cn/(Zt-1)));g.lineTo(Q,et)}else g.moveTo(X,tt),g.lineTo(b,z),g.lineTo(Q,et);g.clip(),g.transform(xt[0],xt[2],xt[1],xt[3],b,z),g.translate(_[0]-v,_[3]-pe);let te;if(y)te=y.canvas,g.scale(E,-E);else{const Zt=l[0],ke=Zt.extent;te=Zt.image,g.scale(U(ke)/te.width,-ct(ke)/te.height)}g.drawImage(te,0,0),g.restore()}),y&&(Xs(y),xn.push(y.canvas)),g.canvas}function So(s){return Array.isArray(s)?Math.min(...s):s}const og=10,th=.25;class ag{constructor(t,e,i,n,r,o,a){this.sourceProj_=t,this.targetProj_=e;let l={};const h=a?lc(E=>ft(a,ca(E,this.targetProj_,this.sourceProj_))):ji(this.targetProj_,this.sourceProj_);this.transformInv_=function(E){const x=E[0]+"/"+E[1];return l[x]||(l[x]=h(E)),l[x]},this.maxSourceExtent_=n,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&U(n)>=U(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?U(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?U(this.targetProj_.getExtent()):null;const c=Pn(i),u=Os(i),d=bs(i),f=Fs(i),g=this.transformInv_(c),m=this.transformInv_(u),_=this.transformInv_(d),y=this.transformInv_(f),p=og+(o?Math.max(0,Math.ceil(Math.log2(yh(i)/(o*o*256*256)))):0);if(this.addQuad_(c,u,d,f,g,m,_,y,p),this.wrapsXInSource_){let E=1/0;this.triangles_.forEach(function(x,C,S){E=Math.min(E,x.source[0][0],x.source[1][0],x.source[2][0])}),this.triangles_.forEach(x=>{if(Math.max(x.source[0][0],x.source[1][0],x.source[2][0])-E>this.sourceWorldWidth_/2){const C=[[x.source[0][0],x.source[0][1]],[x.source[1][0],x.source[1][1]],[x.source[2][0],x.source[2][1]]];C[0][0]-E>this.sourceWorldWidth_/2&&(C[0][0]-=this.sourceWorldWidth_),C[1][0]-E>this.sourceWorldWidth_/2&&(C[1][0]-=this.sourceWorldWidth_),C[2][0]-E>this.sourceWorldWidth_/2&&(C[2][0]-=this.sourceWorldWidth_);const S=Math.min(C[0][0],C[1][0],C[2][0]);Math.max(C[0][0],C[1][0],C[2][0])-S<this.sourceWorldWidth_/2&&(x.source=C)}})}l={}}addTriangle_(t,e,i,n,r,o){this.triangles_.push({source:[n,r,o],target:[t,e,i]})}addQuad_(t,e,i,n,r,o,a,l,h){const c=ht([r,o,a,l]),u=this.sourceWorldWidth_?U(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 _=ht([t,e,i,n]);g=U(_)/this.targetWorldWidth_>th||g}!f&&this.sourceProj_.isGlobal()&&u&&(g=u>th||g)}if(!g&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!dt(c,this.maxSourceExtent_))return;let m=0;if(!g&&(!isFinite(r[0])||!isFinite(r[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(h>0)g=!0;else if(m=(!isFinite(r[0])||!isFinite(r[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),m!=1&&m!=2&&m!=4&&m!=8)return}if(h>0){if(!g){const _=[(t[0]+i[0])/2,(t[1]+i[1])/2],y=this.transformInv_(_);let p;f?p=(si(r[0],d)+si(a[0],d))/2-si(y[0],d):p=(r[0]+a[0])/2-y[0];const E=(r[1]+a[1])/2-y[1];g=p*p+E*E>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const _=[(e[0]+i[0])/2,(e[1]+i[1])/2],y=this.transformInv_(_),p=[(n[0]+t[0])/2,(n[1]+t[1])/2],E=this.transformInv_(p);this.addQuad_(t,e,_,p,r,o,y,E,h-1),this.addQuad_(p,_,i,n,E,y,a,l,h-1)}else{const _=[(t[0]+e[0])/2,(t[1]+e[1])/2],y=this.transformInv_(_),p=[(i[0]+n[0])/2,(i[1]+n[1])/2],E=this.transformInv_(p);this.addQuad_(t,_,p,n,r,y,E,l,h-1),this.addQuad_(_,e,i,p,y,o,a,E,h-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(m&11)==0&&this.addTriangle_(t,i,n,r,a,l),(m&14)==0&&this.addTriangle_(t,i,e,r,a,o),m&&((m&13)==0&&this.addTriangle_(e,n,t,o,l,r),(m&7)==0&&this.addTriangle_(e,n,i,o,l,a))}calculateSourceExtent(){const t=Ft();return this.triangles_.forEach(function(e,i,n){const r=e.source;Gi(t,r[0]),Gi(t,r[1]),Gi(t,r[2])}),t}getTriangles(){return this.triangles_}}const lg=.5;class hg extends cr{constructor(t,e,i,n,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?Ds(i,h):i,u=Ht(c),d=sg(t,e,u,n),f=lg,g=new ag(t,e,c,l,d*f,n),m=g.calculateSourceExtent(),_=ni(m)?null:o(m,d,r),y=_?P.IDLE:P.EMPTY,p=_?_.getPixelRatio():1;super(i,n,p,y),this.targetProj_=e,this.maxSourceExtent_=l,this.triangulation_=g,this.targetResolution_=n,this.targetExtent_=i,this.sourceImage_=_,this.sourcePixelRatio_=p,this.interpolate_=a,this.canvas_=null,this.sourceListenerKey_=null}disposeInternal(){this.state==P.LOADING&&this.unlistenSource_(),super.disposeInternal()}getImage(){return this.canvas_}getProjection(){return this.targetProj_}reproject_(){const t=this.sourceImage_.getState();if(t==P.LOADED){const e=U(this.targetExtent_)/this.targetResolution_,i=ct(this.targetExtent_)/this.targetResolution_;this.canvas_=rg(e,i,this.sourcePixelRatio_,So(this.sourceImage_.getResolution()),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0,void 0,this.interpolate_)}this.state=t,this.changed()}load(){if(this.state==P.IDLE){this.state=P.LOADING,this.changed();const t=this.sourceImage_.getState();t==P.LOADED||t==P.ERROR?this.reproject_():(this.sourceListenerKey_=W(this.sourceImage_,D.CHANGE,e=>{const i=this.sourceImage_.getState();(i==P.LOADED||i==P.ERROR)&&(this.unlistenSource_(),this.reproject_())}),this.sourceImage_.load())}}unlistenSource_(){$(this.sourceListenerKey_),this.sourceListenerKey_=null}}const Ss=4,Io={IMAGELOADSTART:"imageloadstart",IMAGELOADEND:"imageloadend",IMAGELOADERROR:"imageloaderror"};class cg extends St{constructor(t,e){super(t),this.image=e}}class ug extends Ol{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 i=Ps(e,t,0);t=e[i]}return t}getImage(t,e,i,n){const r=this.getProjection();if(!r||!n||$s(r,n))return r&&(n=r),this.getImageInternal(t,e,i,n);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&$s(this.reprojectedImage_.getProjection(),n)&&this.reprojectedImage_.getResolution()==e&&Ni(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new hg(r,n,t,e,i,(o,a,l)=>this.getImageInternal(o,a,l,r),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(t,e,i,n){if(this.loader){const r=fg(t,e,i,1),o=this.findNearestResolution(e);if(this.image&&(this.static_||this.wantedProjection_===n&&(this.wantedExtent_&&se(this.wantedExtent_,r)||se(this.image.getExtent(),r))&&(this.wantedResolution_&&So(this.wantedResolution_)===o||So(this.image.getResolution())===o)))return this.image;this.wantedProjection_=n,this.wantedExtent_=r,this.wantedResolution_=o,this.image=new cr(r,o,i,this.loader),this.image.addEventListener(D.CHANGE,this.handleImageChange.bind(this))}return this.image}handleImageChange(t){const e=t.target;let i;switch(e.getState()){case P.LOADING:this.loading=!0,i=Io.IMAGELOADSTART;break;case P.LOADED:this.loading=!1,i=Io.IMAGELOADEND;break;case P.ERROR:this.loading=!1,i=Io.IMAGELOADERROR;break;default:return}this.hasListener(i)&&this.dispatchEvent(new cg(i,e))}}function dg(s,t){s.getImage().src=t}function fg(s,t,e,i){const n=t/e,r=Ht(s),o=Ln(U(s)/n,Ss),a=Ln(ct(s)/n,Ss),l=Ln((i-1)*o/2,Ss),h=o+2*l,c=Ln((i-1)*a/2,Ss),u=a+2*c;return Tn(r,n,0,[h,u])}function gg(s){const t=s.load||ya,e=s.imageExtent,i=s.crossOrigin??null;return()=>{const n=new Image;return n.crossOrigin=i,t(n,s.url).then(r=>{const o=U(e)/r.width,a=ct(e)/r.height;return{image:r,extent:e,resolution:o!==a?[o,a]:a,pixelRatio:1}})}}class _g extends ug{constructor(t){const e=t.crossOrigin!==void 0?t.crossOrigin:null,i=t.imageLoadFunction!==void 0?t.imageLoadFunction:dg;super({attributions:t.attributions,interpolate:t.interpolate,projection:ot(t.projection)}),this.url_=t.url,this.imageExtent_=t.imageExtent,this.image=null,this.image=new cr(this.imageExtent_,void 0,1,gg({url:t.url,imageExtent:t.imageExtent,crossOrigin:e,load:(n,r)=>(this.image.setImage(n),i(this.image,r),ya(n))})),this.image.addEventListener(D.CHANGE,this.handleImageChange.bind(this))}getImageExtent(){return this.imageExtent_}getImageInternal(t,e,i,n){return dt(t,this.image.getExtent())?this.image:null}getUrl(){return this.url_}}class mg extends qa{constructor(t){super(t),this.image=null}getImage(){return this.image?this.image.getImage():null}prepareFrame(t){const e=t.layerStatesArray[t.layerIndex],i=t.pixelRatio,n=t.viewState,r=n.resolution,o=this.getLayer().getSource(),a=t.viewHints;let l=t.extent;if(e.extent!==void 0&&(l=Ds(l,Ie(e.extent,n.projection))),!a[J.ANIMATING]&&!a[J.INTERACTING]&&!ni(l))if(o){const h=n.projection,c=o.getImage(l,r,i,h);c&&(this.loadImage(c)?this.image=c:c.getState()===P.EMPTY&&(this.image=null))}else this.image=null;return!!this.image}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=ft(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!Di(r,n))return null;const o=this.image.getExtent(),a=this.image.getImage(),l=U(o),h=Math.floor(a.width*((n[0]-o[0])/l));if(h<0||h>=a.width)return null;const c=ct(o),u=Math.floor(a.height*((o[3]-n[1])/c));return u<0||u>=a.height?null:this.getImageData(a,h,u)}renderFrame(t,e){const i=this.image,n=i.getExtent(),r=i.getResolution(),[o,a]=Array.isArray(r)?r:[r,r],l=i.getPixelRatio(),h=t.layerStatesArray[t.layerIndex],c=t.pixelRatio,u=t.viewState,d=u.center,f=u.resolution,g=c*o/(f*l),m=c*a/(f*l);this.prepareContainer(t,e);const _=this.context.canvas.width,y=this.context.canvas.height,p=this.getRenderContext(t);let E=!1,x=!0;if(h.extent){const R=Ie(h.extent,u.projection);x=dt(R,t.extent),E=x&&!se(R,t.extent),E&&this.clipUnrotated(p,t,R)}const C=i.getImage(),S=he(this.tempTransform,_/2,y/2,g,m,0,l*(n[0]-d[0])/o,l*(d[1]-n[3])/a);this.renderedResolution=a*c/l;const T=C.width*S[0],I=C.height*S[3];if(this.getLayer().getSource().getInterpolate()||(p.imageSmoothingEnabled=!1),this.preRender(p,t),x&&T>=.5&&I>=.5){const R=S[4],M=S[5],k=h.opacity;k!==1&&(p.save(),p.globalAlpha=k),p.drawImage(C,0,0,+C.width,+C.height,R,M,T,I),k!==1&&p.restore()}return this.postRender(this.context,t),E&&p.restore(),p.imageSmoothingEnabled=!0,this.container}}class yg extends hs{constructor(t){t=t||{},super(t)}}class pg extends yg{constructor(t){super(t)}createRenderer(){return new mg(this)}getData(t){return super.getData(t)}}const En={IDLE:0,LOADED:2,ERROR:3,EMPTY:4},Ro={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown"};class xg extends jn{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 i=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=W(i,Ro.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=W(i,Ro.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(D.TOUCHMOVE,this.boundHandleTouchMove_,Bo?{passive:!1}:!1)}emulateClick_(t){let e=new _e(Y.CLICK,this.map_,t);this.dispatchEvent(e),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new _e(Y.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const i=new _e(Y.SINGLECLICK,this.map_,t);this.dispatchEvent(i)},250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==Y.POINTERUP||e.type==Y.POINTERCANCEL){delete this.trackedTouches_[i];for(const n in this.trackedTouches_)if(this.trackedTouches_[n].target!==e.target){delete this.trackedTouches_[n];break}}else(e.type==Y.POINTERDOWN||e.type==Y.POINTERMOVE)&&(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new _e(Y.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($),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 _e(Y.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 i=this.map_.getOwnerDocument();this.dragListenerKeys_.push(W(i,Y.POINTERMOVE,this.handlePointerMove_,this),W(i,Y.POINTERUP,this.handlePointerUp_,this),W(this.element_,Y.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==i&&this.dragListenerKeys_.push(W(this.element_.getRootNode(),Y.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new _e(Y.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 _e(Y.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_&&($(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(D.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&($(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach($),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const yt={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},Is=1/0;class Eg{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,ai(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,i=t[0];t.length==1?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const n=this.keyFunction_(i);return delete this.queuedElements_[n],i}enqueue(t){it(!(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!=Is?(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(t){return t*2+1}getRightChildIndex_(t){return t*2+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return this.elements_.length===0}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,n=e.length,r=e[t],o=i[t],a=t;for(;t<n>>1;){const l=this.getLeftChildIndex_(t),h=this.getRightChildIndex_(t),c=h<n&&i[h]<i[l]?h:l;e[t]=e[c],i[t]=i[c],t=c}e[t]=r,i[t]=o,this.siftDown_(a,t)}siftDown_(t,e){const i=this.elements_,n=this.priorities_,r=i[e],o=n[e];for(;e>t;){const a=this.getParentIndex_(e);if(n[a]>o)i[e]=i[a],n[e]=n[a],e=a;else break}i[e]=r,n[e]=o}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let n=0;const r=e.length;let o,a,l;for(a=0;a<r;++a)o=e[a],l=t(o),l==Is?delete this.queuedElements_[this.keyFunction_(o)]:(i[n]=l,e[n++]=o);e.length=n,i.length=n,this.heapify_()}}class Cg extends Eg{constructor(t,e){super(i=>t.apply(null,i),i=>i[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(D.CHANGE,this.boundHandleTileChange_),e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(i===En.LOADED||i===En.ERROR||i===En.EMPTY){i!==En.ERROR&&e.removeEventListener(D.CHANGE,this.boundHandleTileChange_);const n=e.getKey();n in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[n],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let i=0;for(;this.tilesLoading_<t&&i<e&&this.getCount()>0;){const n=this.dequeue()[0],r=n.getKey();n.getState()===En.IDLE&&!(r in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[r]=!0,++this.tilesLoading_,++i,n.load())}}}function wg(s,t,e,i,n){if(!s||!(e in s.wantedTiles)||!s.wantedTiles[e][t.getKey()])return Is;const r=s.viewState.center,o=i[0]-r[0],a=i[1]-r[1];return 65536*Math.log(n)+Math.sqrt(o*o+a*a)/n}class vo extends jt{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 i=0,n=this.listenerKeys.length;i<n;++i)$(this.listenerKeys[i]);if(this.listenerKeys.length=0,this.map_=t,t){const i=this.target_??t.getOverlayContainerStopEvent();this.element&&i.appendChild(this.element),this.render!==Bi&&this.listenerKeys.push(W(t,me.POSTRENDER,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_=typeof t=="string"?document.getElementById(t):t}}class Sg extends vo{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",i=t.tipLabel!==void 0?t.tipLabel:"Attributions",n=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=n):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=i,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener(D.CLICK,this.handleClick_.bind(this),!1);const h=e+" "+Vn+" "+gr+(this.collapsed_&&this.collapsible_?" "+Ca:"")+(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(),i=new Set(e.flatMap(n=>n.getAttributions(t)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(n=>i.add(n)):i.add(this.attributions_)),!this.overrideCollapsible_){const n=!e.some(r=>{var o;return((o=r.getSource())==null?void 0:o.getAttributionsCollapsible())===!1});this.setCollapsible(n)}return Array.from(i)}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(n=>ga(()=>n))),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!ne(e,this.renderedAttributions_)){Ko(this.ulElement_);for(let n=0,r=e.length;n<r;++n){const o=document.createElement("li");o.innerHTML=e[n],this.ulElement_.appendChild(o)}this.renderedAttributions_=e}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(Ca),this.collapsed_?Yo(this.collapseLabel_,this.label_):Yo(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)}}class Ig extends vo{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",i=t.label!==void 0?t.label:"⇧",n=t.compassClassName!==void 0?t.compassClassName:"ol-compass";this.label_=null,typeof i=="string"?(this.label_=document.createElement("span"),this.label_.className=n,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(n));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(D.CLICK,this.handleClick_.bind(this),!1);const a=e+" "+Vn+" "+gr,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(Xn)}handleClick_(t){t.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const e=this.getMap().getView();if(!e)return;const i=e.getRotation();i!==void 0&&(this.duration_>0&&i%(2*Math.PI)!==0?e.animate({rotation:0,duration:this.duration_,easing:wi}):e.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const i=e.viewState.rotation;if(i!=this.rotation_){const n="rotate("+i+"rad)";if(this.autoHide_){const r=this.element.classList.contains(Xn);!r&&i===0?this.element.classList.add(Xn):r&&i!==0&&this.element.classList.remove(Xn)}this.label_.style.transform=n}this.rotation_=i}}class Rg extends vo{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=t.className!==void 0?t.className:"ol-zoom",i=t.delta!==void 0?t.delta:1,n=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=n,c.setAttribute("type","button"),c.title=l,c.appendChild(typeof o=="string"?document.createTextNode(o):o),c.addEventListener(D.CLICK,this.handleClick_.bind(this,i),!1);const u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=h,u.appendChild(typeof a=="string"?document.createTextNode(a):a),u.addEventListener(D.CLICK,this.handleClick_.bind(this,-i),!1);const d=e+" "+Vn+" "+gr,f=this.element;f.className=d,f.appendChild(c),f.appendChild(u),this.duration_=t.duration!==void 0?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const i=this.getMap().getView();if(!i)return;const n=i.getZoom();if(n!==void 0){const r=i.getConstrainedZoom(n+t);this.duration_>0?(i.getAnimating()&&i.cancelAnimations(),i.animate({zoom:r,duration:this.duration_,easing:wi})):i.setZoom(r)}}}function vg(s){s=s||{};const t=new _t;return(s.zoom!==void 0?s.zoom:!0)&&t.push(new Rg(s.zoomOptions)),(s.rotate!==void 0?s.rotate:!0)&&t.push(new Ig(s.rotateOptions)),(s.attribution!==void 0?s.attribution:!0)&&t.push(new Sg(s.attributionOptions)),t}class Oe extends St{constructor(t,e){super(t),this.layer=e}}const To={LAYERS:"layers"};class Fi extends Pl{constructor(t){t=t||{};const e=Object.assign({},t);delete e.layers;let i=t.layers;super(e),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(To.LAYERS,this.handleLayersChanged_),i?Array.isArray(i)?i=new _t(i.slice(),{unique:!0}):it(typeof i.getArray=="function","Expected `layers` to be an array or a `Collection`"):i=new _t(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach($),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(W(t,nt.ADD,this.handleLayersAdd_,this),W(t,nt.REMOVE,this.handleLayersRemove_,this));for(const i in this.listenerKeys_)this.listenerKeys_[i].forEach($);ai(this.listenerKeys_);const e=t.getArray();for(let i=0,n=e.length;i<n;i++){const r=e[i];this.registerLayerListeners_(r),this.dispatchEvent(new Oe("addlayer",r))}this.changed()}registerLayerListeners_(t){const e=[W(t,ui.PROPERTYCHANGE,this.handleLayerChange_,this),W(t,D.CHANGE,this.handleLayerChange_,this)];t instanceof Fi&&e.push(W(t,"addlayer",this.handleLayerGroupAdd_,this),W(t,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[V(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new Oe("addlayer",t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new Oe("removelayer",t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new Oe("addlayer",e)),this.changed()}handleLayersRemove_(t){const e=t.element,i=V(e);this.listenerKeys_[i].forEach($),delete this.listenerKeys_[i],this.dispatchEvent(new Oe("removelayer",e)),this.changed()}getLayers(){return this.get(To.LAYERS)}setLayers(t){const e=this.getLayers();if(e){const i=e.getArray();for(let n=0,r=i.length;n<r;++n)this.dispatchEvent(new Oe("removelayer",i[n]))}this.set(To.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:[],i=e.length;this.getLayers().forEach(function(o){o.getLayerStatesArray(e)});const n=this.getLayerState();let r=n.zIndex;!t&&n.zIndex===void 0&&(r=0);for(let o=i,a=e.length;o<a;o++){const l=e[o];l.opacity*=n.opacity,l.visible=l.visible&&n.visible,l.maxResolution=Math.min(l.maxResolution,n.maxResolution),l.minResolution=Math.max(l.minResolution,n.minResolution),l.minZoom=Math.max(l.minZoom,n.minZoom),l.maxZoom=Math.min(l.maxZoom,n.maxZoom),n.extent!==void 0&&(l.extent!==void 0?l.extent=Ds(l.extent,n.extent):l.extent=n.extent),l.zIndex===void 0&&(l.zIndex=r)}return e}getSourceState(){return"ready"}}class Tg extends hr{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){O()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,n=t.pixelToCoordinateTransform;he(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),Aa(n,i)}forEachFeatureAtCoordinate(t,e,i,n,r,o,a,l){let h;const c=e.viewState;function u(x,C,S,T){return r.call(o,C,x?S:null,T)}const d=c.projection,f=jo(t.slice(),d),g=[[0,0]];if(d.canWrapX()&&n){const x=d.getExtent(),C=U(x);g.push([-C,0],[C,0])}const m=e.layerStatesArray,_=m.length,y=[],p=[];for(let x=0;x<g.length;x++)for(let C=_-1;C>=0;--C){const S=m[C],T=S.layer;if(T.hasRenderer()&&Ur(S,c)&&a.call(l,T)){const I=T.getRenderer(),R=T.getSource();if(I&&R){const M=R.getWrapX()?f:t,k=u.bind(null,S.managed);p[0]=M[0]+g[x][0],p[1]=M[1]+g[x][1],h=I.forEachFeatureAtCoordinate(p,e,i,k,y)}if(h)return h}}if(y.length===0)return;const E=1/y.length;return y.forEach((x,C)=>x.distanceSq+=C*E),y.sort((x,C)=>x.distanceSq-C.distanceSq),y.some(x=>h=x.callback(x.feature,x.layer,x.geometry)),h}hasFeatureAtCoordinate(t,e,i,n,r,o){return this.forEachFeatureAtCoordinate(t,e,i,n,zt,this,r,o)!==void 0}getMap(){return this.map_}renderFrame(t){O()}scheduleExpireIconCache(t){Ot.canExpireCache()&&t.postRenderFunctions.push(Pg)}}function Pg(s,t){Ot.expire()}class Mg extends Tg{constructor(t){super(t),this.fontChangeListenerKey_=W(gi,ui.PROPERTYCHANGE,t.redrawText,t),this.element_=document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=Vn+" ol-layers";const i=t.getViewport();i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const n=new Za(t,void 0,e);i.dispatchEvent(n)}}disposeInternal(){$(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(Dt.PRECOMPOSE,t);const e=t.layerStatesArray.sort((a,l)=>a.zIndex-l.zIndex);e.some(a=>a.layer instanceof Ll&&a.layer.getDeclutter())&&(t.declutter={});const n=t.viewState;this.children_.length=0;const r=[];let o=null;for(let a=0,l=e.length;a<l;++a){const h=e[a];t.layerIndex=a;const c=h.layer,u=c.getSourceState();if(!Ur(h,n)||u!="ready"&&u!="undefined"){c.unrender();continue}const d=c.render(t,o);d&&(d!==o&&(this.children_.push(d),o=d),r.push(h))}this.declutter(t,r),bh(this.element_,this.children_),this.dispatchRenderEvent(Dt.POSTCOMPOSE,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}declutter(t,e){if(t.declutter){for(let i=e.length-1;i>=0;--i){const n=e[i],r=n.layer;r.getDeclutter()&&r.renderDeclutter(t,n)}e.forEach(i=>i.layer.renderDeferred(t))}}}function eh(s){if(s instanceof hs){s.setMapInternal(null);return}s instanceof Fi&&s.getLayers().forEach(eh)}function ih(s,t){if(s instanceof hs){s.setMapInternal(t);return}if(s instanceof Fi){const e=s.getLayers().getArray();for(let i=0,n=e.length;i<n;++i)ih(e[i],t)}}class Lg extends jt{constructor(t){super(),t=t||{},this.on,this.once,this.un;const e=Ag(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:Lh,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=Xt(),this.pixelToCoordinateTransform_=Xt(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,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,this.resizeObserver_=new ResizeObserver(()=>this.updateSize()),this.controls=e.controls||vg(),this.interactions=e.interactions||Rf({onFocusOnly:!0}),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new Cg(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(yt.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(yt.VIEW,this.handleViewChanged_),this.addChangeListener(yt.SIZE,this.handleSizeChanged_),this.addChangeListener(yt.TARGET,this.handleTargetChanged_),this.setProperties(e.values);const i=this;t.view&&!(t.view instanceof Jt)&&t.view.then(function(n){i.setView(new Jt(n))}),this.controls.addEventListener(nt.ADD,n=>{n.element.setMap(this)}),this.controls.addEventListener(nt.REMOVE,n=>{n.element.setMap(null)}),this.interactions.addEventListener(nt.ADD,n=>{n.element.setMap(this)}),this.interactions.addEventListener(nt.REMOVE,n=>{n.element.setMap(null)}),this.overlays_.addEventListener(nt.ADD,n=>{this.addOverlayInternal_(n.element)}),this.overlays_.addEventListener(nt.REMOVE,n=>{const r=n.element.getId();r!==void 0&&delete this.overlayIdIndex_[r.toString()],n.element.setMap(null)}),this.controls.forEach(n=>{n.setMap(this)}),this.interactions.forEach(n=>{n.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){ih(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(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;const n=this.getCoordinateFromPixelInternal(t);i=i!==void 0?i:{};const r=i.hitTolerance!==void 0?i.hitTolerance:0,o=i.layerFilter!==void 0?i.layerFilter:zt,a=i.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(n,this.frameState_,r,a,e,null,o,null)}getFeaturesAtPixel(t,e){const i=[];return this.forEachFeatureAtPixel(t,function(n){i.push(n)},e),i}getAllLayers(){const t=[];function e(i){i.forEach(function(n){n instanceof Fi?e(n.getLayers()):t.push(n)})}return e(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(t);e=e!==void 0?e:{};const n=e.layerFilter!==void 0?e.layerFilter:zt,r=e.hitTolerance!==void 0?e.hitTolerance:0,o=e.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,r,o,n,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const i=this.viewport_.getBoundingClientRect(),n=this.getSize(),r=i.width/n[0],o=i.height/n[1],a="changedTouches"in t?t.changedTouches[0]:t;return[(a.clientX-i.left)/r,(a.clientY-i.top)/o]}getTarget(){return this.get(yt.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return Se(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?ft(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(yt.LAYERGROUP)}setLayers(t){const e=this.getLayerGroup();if(t instanceof _t){e.setLayers(t);return}const i=e.getLayers();i.clear(),i.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e<i;++e){const n=t[e];if(!n.visible)continue;const r=n.layer.getRenderer();if(r&&!r.ready)return!0;const o=n.layer.getSource();if(o&&o.loading)return!0}return!1}getPixelFromCoordinate(t){const e=Z(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?ft(e.coordinateToPixelTransform,t.slice(0,2)):null}getRenderer(){return this.renderer_}getSize(){return this.get(yt.SIZE)}getView(){return this.get(yt.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,i,n){return wg(this.frameState_,t,e,i,n)}handleBrowserEvent(t,e){e=e||t.type;const i=new _e(e,this,t);this.handleMapBrowserEvent(i)}handleMapBrowserEvent(t){if(!this.frameState_)return;const e=t.originalEvent,i=e.type;if(i===Ro.POINTERDOWN||i===D.WHEEL||i===D.KEYDOWN){const n=this.getOwnerDocument(),r=this.viewport_.getRootNode?this.viewport_.getRootNode():n,o=e.target,a=r instanceof ShadowRoot?r.host===o?r.host.ownerDocument:r:r===n?n.documentElement:r;if(this.overlayContainerStopEvent_.contains(o)||!a.contains(o))return}if(t.frameState=this.frameState_,this.dispatchEvent(t)!==!1){const n=this.getInteractions().getArray().slice();for(let r=n.length-1;r>=0;r--){const o=n[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 n=this.maxTilesLoading_,r=n;if(t){const o=t.viewHints;if(o[J.ANIMATING]||o[J.INTERACTING]){const a=Date.now()-t.time>8;n=a?0:8,r=a?0:2}}e.getTilesLoading()<n&&(e.reprioritize(),e.loadMoreTiles(n,r))}t&&this.renderer_&&!t.animate&&(this.renderComplete_?(this.hasListener(Dt.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(Dt.RENDERCOMPLETE,t),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Ti(me.LOADEND,this,t)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Ti(me.LOADSTART,this,t))));const i=this.postRenderFunctions_;if(t)for(let n=0,r=i.length;n<r;++n)i[n](this,t);i.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let i=0,n=this.targetChangeHandlerKeys_.length;i<n;++i)$(this.targetChangeHandlerKeys_[i]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(D.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(D.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_){this.resizeObserver_.unobserve(this.targetElement_);const i=this.targetElement_.getRootNode();i instanceof ShadowRoot&&this.resizeObserver_.unobserve(i.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{e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new Mg(this)),this.mapBrowserEventHandler_=new xg(this,this.moveTolerance_);for(const r in Y)this.mapBrowserEventHandler_.addEventListener(Y[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(D.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(D.WHEEL,this.boundHandleBrowserEvent_,Bo?{passive:!1}:!1);let i;if(this.keyboardEventTarget_)i=this.keyboardEventTarget_;else{const r=e.getRootNode();i=r instanceof ShadowRoot?r.host:e}this.targetChangeHandlerKeys_=[W(i,D.KEYDOWN,this.handleBrowserEvent,this),W(i,D.KEYPRESS,this.handleBrowserEvent,this)];const n=e.getRootNode();n instanceof ShadowRoot&&this.resizeObserver_.observe(n.host),this.resizeObserver_.observe(e)}this.updateSize()}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&($(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&($(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=W(t,ui.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=W(t,D.CHANGE,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach($),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new Oe("addlayer",t)),this.layerGroupPropertyListenerKeys_=[W(t,ui.PROPERTYCHANGE,this.render,this),W(t,D.CHANGE,this.render,this),W(t,"addlayer",this.handleLayerAdd_,this),W(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,i=t.length;e<i;++e){const n=t[e].layer;n.hasRenderer()&&n.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){eh(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){const e=this.getSize(),i=this.getView(),n=this.frameState_;let r=null;if(e!==void 0&&Na(e)&&i&&i.isDef()){const o=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=i.getState();if(r={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:Tn(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:V(this),renderTargets:{}},a.nextCenter&&a.nextResolution){const l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;r.nextExtent=Tn(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),n&&(!this.previousExtent_||!ni(this.previousExtent_)&&!Ni(r.extent,this.previousExtent_))&&(this.dispatchEvent(new Ti(me.MOVESTART,this,n)),this.previousExtent_=Oi(this.previousExtent_)),this.previousExtent_&&!r.viewHints[J.ANIMATING]&&!r.viewHints[J.INTERACTING]&&!Ni(r.extent,this.previousExtent_)&&(this.dispatchEvent(new Ti(me.MOVEEND,this,r)),Oo(r.extent,this.previousExtent_))),this.dispatchEvent(new Ti(me.POSTRENDER,this,r)),this.renderComplete_=(this.hasListener(me.LOADSTART)||this.hasListener(me.LOADEND)||this.hasListener(Dt.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 Oe("removelayer",e)),this.set(yt.LAYERGROUP,t)}setSize(t){this.set(yt.SIZE,t)}setTarget(t){this.set(yt.TARGET,t)}setView(t){if(!t||t instanceof Jt){this.set(yt.VIEW,t);return}this.set(yt.VIEW,new Jt);const e=this;t.then(function(i){e.setView(new Jt(i))})}updateSize(){const t=this.getTargetElement();let e;if(t){const n=getComputedStyle(t),r=t.offsetWidth-parseFloat(n.borderLeftWidth)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)-parseFloat(n.borderRightWidth),o=t.offsetHeight-parseFloat(n.borderTopWidth)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)-parseFloat(n.borderBottomWidth);!isNaN(r)&&!isNaN(o)&&(e=[Math.max(0,r),Math.max(0,o)],!Na(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&Uo("No map visible because the map container's width or height are 0."))}const i=this.getSize();e&&(!i||!ne(e,i))&&(this.setSize(e),this.updateViewportSize_(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}}function Ag(s){let t=null;s.keyboardEventTarget!==void 0&&(t=typeof s.keyboardEventTarget=="string"?document.getElementById(s.keyboardEventTarget):s.keyboardEventTarget);const e={},i=s.layers&&typeof s.layers.getLayers=="function"?s.layers:new Fi({layers:s.layers});e[yt.LAYERGROUP]=i,e[yt.TARGET]=s.target,e[yt.VIEW]=s.view instanceof Jt?s.view:new Jt;let n;s.controls!==void 0&&(Array.isArray(s.controls)?n=new _t(s.controls.slice()):(it(typeof s.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),n=s.controls));let r;s.interactions!==void 0&&(Array.isArray(s.interactions)?r=new _t(s.interactions.slice()):(it(typeof s.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),r=s.interactions));let o;return s.overlays!==void 0?Array.isArray(s.overlays)?o=new _t(s.overlays.slice()):(it(typeof s.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=s.overlays):o=new _t,{controls:n,interactions:r,keyboardEventTarget:t,overlays:o,values:e}}const pt={ELEMENT:"element",MAP:"map",OFFSET:"offset",POSITION:"position",POSITIONING:"positioning"};class Fg extends jt{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 "+Ic,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(pt.ELEMENT,this.handleElementChanged),this.addChangeListener(pt.MAP,this.handleMapChanged),this.addChangeListener(pt.OFFSET,this.handleOffsetChanged),this.addChangeListener(pt.POSITION,this.handlePositionChanged),this.addChangeListener(pt.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(pt.ELEMENT)}getId(){return this.id}getMap(){return this.get(pt.MAP)||null}getOffset(){return this.get(pt.OFFSET)}getPosition(){return this.get(pt.POSITION)}getPositioning(){return this.get(pt.POSITIONING)}handleElementChanged(){Ko(this.element);const t=this.getElement();t&&this.element.appendChild(t)}handleMapChanged(){var e;this.mapPostrenderListenerKey&&((e=this.element)==null||e.remove(),$(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const t=this.getMap();if(t){this.mapPostrenderListenerKey=W(t,me.POSTRENDER,this.render,this),this.updatePixelPosition();const i=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();this.insertFirst?i.insertBefore(this.element,i.childNodes[0]||null):i.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(t){this.set(pt.ELEMENT,t)}setMap(t){this.set(pt.MAP,t)}setOffset(t){this.set(pt.OFFSET,t)}setPosition(t){this.set(pt.POSITION,t)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(t){const e=this.getMap();if(!e||!e.getTargetElement()||!this.get(pt.POSITION))return;const i=this.getRect(e.getTargetElement(),e.getSize()),n=this.getElement(),r=this.getRect(n,[Ah(n),Fh(n)]);t=t||{};const o=t.margin===void 0?20:t.margin;if(!se(i,r)){const a=r[0]-i[0],l=i[2]-r[2],h=r[1]-i[1],c=i[3]-r[3],u=[0,0];if(a<0?u[0]=a-o:l<0&&(u[0]=Math.abs(l)+o),h<0?u[1]=h-o:c<0&&(u[1]=Math.abs(c)+o),u[0]!==0||u[1]!==0){const d=e.getView().getCenterInternal(),f=e.getPixelFromCoordinateInternal(d);if(!f)return;const g=[f[0]+u[0],f[1]+u[1]],m=t.animation||{};e.getView().animateInternal({center:e.getCoordinateFromPixelInternal(g),duration:m.duration,easing:m.easing})}}}getRect(t,e){const i=t.getBoundingClientRect(),n=i.left+window.pageXOffset,r=i.top+window.pageYOffset;return[n,r,n+e[0],r+e[1]]}setPositioning(t){this.set(pt.POSITIONING,t)}setVisible(t){this.rendered.visible!==t&&(this.element.style.display=t?"":"none",this.rendered.visible=t)}updatePixelPosition(){const t=this.getMap(),e=this.getPosition();if(!t||!t.isRendered()||!e){this.setVisible(!1);return}const i=t.getPixelFromCoordinate(e),n=t.getSize();this.updateRenderedPosition(i,n)}updateRenderedPosition(t,e){const i=this.element.style,n=this.getOffset(),r=this.getPositioning();this.setVisible(!0);const o=`${t[0]+n[0]}px`,a=`${t[1]+n[1]}px`;let l="0%",h="0%";r=="bottom-right"||r=="center-right"||r=="top-right"?l="-100%":(r=="bottom-center"||r=="center-center"||r=="top-center")&&(l="-50%"),r=="bottom-left"||r=="bottom-center"||r=="bottom-right"?h="-100%":(r=="center-left"||r=="center-center"||r=="center-right")&&(h="-50%");const c=`translate(${l}, ${h}) translate(${o}, ${a})`;this.rendered.transform_!=c&&(this.rendered.transform_=c,i.transform=c)}getOptions(){return this.options}}function bg(s,t){return typeof s=="function"?s(t):s}const Dg={name:"ppe-popup",getInitialState:s=>({...s}),createPlanEditor:s=>{const{overlay:t,closerElement:e,popupElement:i}=kg();s.addOverlay(t),e.addEventListener("click",()=>(t.setPosition(void 0),e.blur(),!1)),s._showPopup=(n,r)=>{t.setPosition(n.event.coordinate),i.innerHTML=n.content,r!=null&&r.offset&&t.setOffset(r.offset),t.setPositioning(Og(s,n.event,r==null?void 0:r.positioning))},s._hidePopup=()=>{t.setPosition(void 0)}}};function Og(s,t,e){if(e&&e!="auto")return e;const i=s.getSize();if(!i)return"top-right";const[n,r]=s.getPixelFromCoordinate(t.coordinate),[o,a]=i,l=n<o/2?"left":"right";return`${r<a/2?"top":"bottom"}-${l}`}function kg(){const s=document.createElement("div");s.id="ppe-popup",s.className="ppe-popup";const t=document.createElement("button");t.className="ppe-popup-closer";const e=document.createElement("div");return e.className="ppe-popup-content",s.insertAdjacentElement("beforeend",t),s.insertAdjacentElement("beforeend",e),{overlay:new Fg({element:s,stopEvent:!1}),popupElement:s,closerElement:t}}const nh=[Jl,Dg];function Ng(s){var m;const t=[...nh,...s._plugins??[]],{plan:e}=s,i=[0,0,e.file.width,e.file.height],n=new bn({code:"",units:"pixels",extent:i}),r=new _g({imageExtent:i,projection:n,url:e.file.original_url}),o=new pg({source:r}),a=new Jt({projection:n,center:Ht(i),zoom:0,minZoom:-10,maxZoom:10,extent:i}),l=new Lg({target:s.target??"map",layers:[o],view:a}),h={_extent:i,_projection:n},c=l;c._plugins=t;const u=c._plugins.reduce((_,y)=>{var p;return Object.assign(_,(p=y.getDefaultOptions)==null?void 0:p.call(y,c))},{});let d={...h,...s.initialState??{}};c._plugins.forEach(_=>{var y;d=((y=_.getInitialState)==null?void 0:y.call(_,d))??d});const f=_=>c.options.mergeOptions?c.options.mergeOptions(u,_):{...u,..._},g={_plugins:t,options:{...u,...s},initialState:d,reset:()=>{c.setState(c.initialState)},getState:()=>c.options.state,setState:_=>{var y,p;(p=(y=c.options).onStateChange)==null||p.call(y,_)},setOptions:_=>{const y=bg(_,c.options),p=c.getTarget(),E=f(y);c.options=E,E.target&&E.target!==p&&c.setTarget(E.target)}};Object.assign(c,g);for(const _ of c._plugins)(m=_==null?void 0:_.createPlanEditor)==null||m.call(_,c);return c}return Wt.ZoningPlugin=Jl,Wt.createPlanEditor=Ng,Wt.defaultPlugins=nh,Object.defineProperty(Wt,Symbol.toStringTag,{value:"Module"}),Wt})({});
|
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(St,U){typeof exports=="object"&&typeof module<"u"?U(exports):typeof define=="function"&&define.amd?define(["exports"],U):(St=typeof globalThis<"u"?globalThis:St||self,U(St.PpeCore={}))})(this,(function(St){"use strict";var Hg=Object.defineProperty;var qg=(St,U,ii)=>U in St?Hg(St,U,{enumerable:!0,configurable:!0,writable:!0,value:ii}):St[U]=ii;var fh=(St,U,ii)=>qg(St,typeof U!="symbol"?U+"":U,ii);const U={ANIMATING:0,INTERACTING:1};function ii(s,t,e){let i,n;e=e||Ne;let r=0,o=s.length,a=!1;for(;r<o;)i=r+(o-r>>1),n=+e(s[i],t),n<0?r=i+1:(o=i,a=!n);return a?r:~r}function Ne(s,t){return s>t?1:s<t?-1:0}function gh(s,t){return s<t?1:s>t?-1:0}function Ps(s,t,e){if(s[0]<=t)return 0;const i=s.length;if(t<=s[i-1])return i-1;if(typeof e=="function"){for(let n=1;n<i;++n){const r=s[n];if(r===t)return n;if(r<t)return e(t,s[n-1],r)>0?n-1:n}return i-1}if(e>0){for(let n=1;n<i;++n)if(s[n]<t)return n-1;return i-1}if(e<0){for(let n=1;n<i;++n)if(s[n]<=t)return n;return i-1}for(let n=1;n<i;++n){if(s[n]==t)return n;if(s[n]<t)return s[n-1]-t<t-s[n]?n-1:n}return i-1}function _h(s,t,e){for(;t<e;){const i=s[t];s[t]=s[e],s[e]=i,++t,--e}}function Ft(s,t){const e=Array.isArray(t)?t:[t],i=e.length;for(let n=0;n<i;n++)s[s.length]=e[n]}function ne(s,t){const e=s.length;if(e!==t.length)return!1;for(let i=0;i<e;i++)if(s[i]!==t[i])return!1;return!0}const lt={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function ht(s){const t=bt();for(let e=0,i=s.length;e<i;++e)Gi(t,s[e]);return t}function bi(s,t,e){return e?(e[0]=s[0]-t,e[1]=s[1]-t,e[2]=s[2]+t,e[3]=s[3]+t,e):[s[0]-t,s[1]-t,s[2]+t,s[3]+t]}function Oo(s,t){return t?(t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t):s.slice()}function Ge(s,t,e){let i,n;return t<s[0]?i=s[0]-t:s[2]<t?i=t-s[2]:i=0,e<s[1]?n=s[1]-e:s[3]<e?n=e-s[3]:n=0,i*i+n*n}function Di(s,t){return Ms(s,t[0],t[1])}function se(s,t){return s[0]<=t[0]&&t[2]<=s[2]&&s[1]<=t[1]&&t[3]<=s[3]}function Ms(s,t,e){return s[0]<=t&&t<=s[2]&&s[1]<=e&&e<=s[3]}function Ls(s,t){const e=s[0],i=s[1],n=s[2],r=s[3],o=t[0],a=t[1];let l=lt.UNKNOWN;return o<e?l=l|lt.LEFT:o>n&&(l=l|lt.RIGHT),a<i?l=l|lt.BELOW:a>r&&(l=l|lt.ABOVE),l===lt.UNKNOWN&&(l=lt.INTERSECTING),l}function bt(){return[1/0,1/0,-1/0,-1/0]}function We(s,t,e,i,n){return n?(n[0]=s,n[1]=t,n[2]=e,n[3]=i,n):[s,t,e,i]}function Oi(s){return We(1/0,1/0,-1/0,-1/0,s)}function ki(s,t){const e=s[0],i=s[1];return We(e,i,e,i,t)}function As(s,t,e,i,n){const r=Oi(n);return No(r,s,t,e,i)}function Ni(s,t){return s[0]==t[0]&&s[2]==t[2]&&s[1]==t[1]&&s[3]==t[3]}function ko(s,t){return t[0]<s[0]&&(s[0]=t[0]),t[2]>s[2]&&(s[2]=t[2]),t[1]<s[1]&&(s[1]=t[1]),t[3]>s[3]&&(s[3]=t[3]),s}function Gi(s,t){t[0]<s[0]&&(s[0]=t[0]),t[0]>s[2]&&(s[2]=t[0]),t[1]<s[1]&&(s[1]=t[1]),t[1]>s[3]&&(s[3]=t[1])}function No(s,t,e,i,n){for(;e<i;e+=n)mh(s,t[e],t[e+1]);return s}function mh(s,t,e){s[0]=Math.min(s[0],t),s[1]=Math.min(s[1],e),s[2]=Math.max(s[2],t),s[3]=Math.max(s[3],e)}function Go(s,t){let e;return e=t(Fs(s)),e||(e=t(bs(s)),e)||(e=t(Os(s)),e)||(e=t(Pn(s)),e)?e:!1}function ph(s){let t=0;return ni(s)||(t=Z(s)*ct(s)),t}function Fs(s){return[s[0],s[1]]}function bs(s){return[s[2],s[1]]}function Ht(s){return[(s[0]+s[2])/2,(s[1]+s[3])/2]}function Tn(s,t,e,i,n){const[r,o,a,l,h,c,u,d]=yh(s,t,e,i);return We(Math.min(r,a,h,u),Math.min(o,l,c,d),Math.max(r,a,h,u),Math.max(o,l,c,d),n)}function yh(s,t,e,i){const n=t*i[0]/2,r=t*i[1]/2,o=Math.cos(e),a=Math.sin(e),l=n*o,h=n*a,c=r*o,u=r*a,d=s[0],f=s[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(s){return s[3]-s[1]}function Ds(s,t,e){const i=e||bt();return dt(s,t)?(s[0]>t[0]?i[0]=s[0]:i[0]=t[0],s[1]>t[1]?i[1]=s[1]:i[1]=t[1],s[2]<t[2]?i[2]=s[2]:i[2]=t[2],s[3]<t[3]?i[3]=s[3]:i[3]=t[3]):Oi(i),i}function Pn(s){return[s[0],s[3]]}function Os(s){return[s[2],s[3]]}function Z(s){return s[2]-s[0]}function dt(s,t){return s[0]<=t[2]&&s[2]>=t[0]&&s[1]<=t[3]&&s[3]>=t[1]}function ni(s){return s[2]<s[0]||s[3]<s[1]}function xh(s,t){return t?(t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t):s}function Eh(s,t,e){let i=!1;const n=Ls(s,t),r=Ls(s,e);if(n===lt.INTERSECTING||r===lt.INTERSECTING)i=!0;else{const o=s[0],a=s[1],l=s[2],h=s[3],c=t[0],u=t[1],d=e[0],f=e[1],g=(f-u)/(d-c);let m,_;r<.ABOVE&&!(n<.ABOVE)&&(m=d-(f-h)/g,i=m>=o&&m<=l),!i&&r<.RIGHT&&!(n<.RIGHT)&&(_=f-(d-l)*g,i=_>=a&&_<=h),!i&&r<.BELOW&&!(n<.BELOW)&&(m=d-(f-a)/g,i=m>=o&&m<=l),!i&&r<.LEFT&&!(n<.LEFT)&&(_=f-(d-o)*g,i=_>=a&&_<=h)}return i}function Wo(s,t){const e=t.getExtent(),i=Ht(s);if(t.canWrapX()&&(i[0]<e[0]||i[0]>=e[2])){const n=Z(e),o=Math.floor((i[0]-e[0])/n)*n;s[0]-=o,s[2]-=o}return s}function Ch(s,t,e){if(t.canWrapX()){const i=t.getExtent();if(!isFinite(s[0])||!isFinite(s[2]))return[[i[0],s[1],i[2],s[3]]];Wo(s,t);const n=Z(i);if(Z(s)>n)return[[i[0],s[1],i[2],s[3]]];if(s[0]<i[0])return[[s[0]+n,s[1],i[2],s[3]],[i[0],s[1],s[2],s[3]]];if(s[2]>i[2])return[[s[0],s[1],i[2],s[3]],[i[0],s[1],s[2]-n,s[3]]]}return[s]}function rt(s,t,e){return Math.min(Math.max(s,t),e)}function wh(s,t,e,i,n,r){const o=n-e,a=r-i;if(o!==0||a!==0){const l=((s-e)*o+(t-i)*a)/(o*o+a*a);l>1?(e=n,i=r):l>0&&(e+=o*l,i+=a*l)}return re(s,t,e,i)}function re(s,t,e,i){const n=e-s,r=i-t;return n*n+r*r}function Sh(s){const t=s.length;for(let i=0;i<t;i++){let n=i,r=Math.abs(s[i][i]);for(let a=i+1;a<t;a++){const l=Math.abs(s[a][i]);l>r&&(r=l,n=a)}if(r===0)return null;const o=s[n];s[n]=s[i],s[i]=o;for(let a=i+1;a<t;a++){const l=-s[a][i]/s[i][i];for(let h=i;h<t+1;h++)i==h?s[a][h]=0:s[a][h]+=l*s[i][h]}}const e=new Array(t);for(let i=t-1;i>=0;i--){e[i]=s[i][t]/s[i][i];for(let n=i-1;n>=0;n--)s[n][t]-=s[n][i]*e[i]}return e}function zo(s){return s*180/Math.PI}function we(s){return s*Math.PI/180}function si(s,t){const e=s%t;return e*t<0?e+t:e}function Mt(s,t,e){return s+e*(t-s)}function Mn(s,t){const e=Math.pow(10,t);return Math.round(s*e)/e}function Ln(s,t){return Math.ceil(Mn(s,t))}function ks(s,t,e){if(s>=t&&s<e)return s;const i=e-t;return((s-t)%i+i)%i+t}function Ih(s,t){return s[0]+=+t[0],s[1]+=+t[1],s}function Rh(s,t){const e=t.getRadius(),i=t.getCenter(),n=i[0],r=i[1],o=s[0],a=s[1];let l=o-n;const h=a-r;l===0&&h===0&&(l=1);const c=Math.sqrt(l*l+h*h),u=n+e*l/c,d=r+e*h/c;return[u,d]}function Ns(s,t){const e=s[0],i=s[1],n=t[0],r=t[1],o=n[0],a=n[1],l=r[0],h=r[1],c=l-o,u=h-a,d=c===0&&u===0?0:(c*(e-o)+u*(i-a))/(c*c+u*u||0);let f,g;return d<=0?(f=o,g=a):d>=1?(f=l,g=h):(f=o+d*c,g=a+d*u),[f,g]}function Et(s,t){let e=!0;for(let i=s.length-1;i>=0;--i)if(s[i]!=t[i]){e=!1;break}return e}function Gs(s,t){const e=Math.cos(t),i=Math.sin(t),n=s[0]*e-s[1]*i,r=s[1]*e+s[0]*i;return s[0]=n,s[1]=r,s}function vh(s,t){return s[0]*=t,s[1]*=t,s}function oe(s,t){const e=s[0]-t[0],i=s[1]-t[1];return e*e+i*i}function An(s,t){return Math.sqrt(oe(s,t))}function Th(s,t){return oe(s,Ns(s,t))}function jo(s,t){if(t.canWrapX()){const e=Z(t.getExtent()),i=Ph(s,t,e);i&&(s[0]-=i*e)}return s}function Ph(s,t,e){const i=t.getExtent();let n=0;return t.canWrapX()&&(s[0]<i[0]||s[0]>i[2])&&(e=e||Z(i),n=Math.floor((s[0]-i[0])/e)),n}const ze=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"";ze.includes("safari")&&!ze.includes("chrom")&&(ze.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(ze));const Mh=ze.includes("webkit")&&!ze.includes("edge"),Ws=ze.includes("macintosh"),Lh=typeof devicePixelRatio<"u"?devicePixelRatio:1,zs=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,Xo=typeof Image<"u"&&Image.prototype.decode,Vo=typeof createImageBitmap=="function",Bo=(function(){let s=!1;try{const t=Object.defineProperty({},"passive",{get:function(){s=!0}});window.addEventListener("_",null,t),window.removeEventListener("_",null,t)}catch{}return s})();function ut(s,t,e,i){let n;return e&&e.length?n=e.shift():zs?n=new OffscreenCanvas(s||300,t||300):n=document.createElement("canvas"),s&&(n.width=s),t&&(n.height=t),n.getContext("2d",i)}let js;function Fn(){return js||(js=ut(1,1)),js}function Xs(s){const t=s.canvas;t.width=1,t.height=1,s.clearRect(0,0,1,1)}function Ah(s){let t=s.offsetWidth;const e=getComputedStyle(s);return t+=parseInt(e.marginLeft,10)+parseInt(e.marginRight,10),t}function Fh(s){let t=s.offsetHeight;const e=getComputedStyle(s);return t+=parseInt(e.marginTop,10)+parseInt(e.marginBottom,10),t}function Yo(s,t){const e=t.parentNode;e&&e.replaceChild(s,t)}function Ko(s){for(;s.lastChild;)s.lastChild.remove()}function bh(s,t){const e=s.childNodes;for(let i=0;;++i){const n=e[i],r=t[i];if(!n&&!r)break;if(n!==r){if(!n){s.appendChild(r);continue}if(!r){s.removeChild(n),--i;continue}s.insertBefore(r,n)}}}function Uo(...s){console.warn(...s)}const Zo={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class bn{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_||Zo[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 Wi=6378137,ri=Math.PI*Wi,Dh=[-ri,-ri,ri,ri],Oh=[-180,-85,180,85],Dn=Wi*Math.log(Math.tan(Math.PI/2));class oi extends bn{constructor(t){super({code:t,units:"m",extent:Dh,global:!0,worldExtent:Oh,getPointResolution:function(e,i){return e/Math.cosh(i[1]/Wi)}})}}const Ho=[new oi("EPSG:3857"),new oi("EPSG:102100"),new oi("EPSG:102113"),new oi("EPSG:900913"),new oi("http://www.opengis.net/def/crs/EPSG/0/3857"),new oi("http://www.opengis.net/gml/srs/epsg.xml#3857")];function kh(s,t,e,i){const n=s.length;e=e>1?e:2,i=i??e,t===void 0&&(e>2?t=s.slice():t=new Array(n));for(let r=0;r<n;r+=i){t[r]=ri*s[r]/180;let o=Wi*Math.log(Math.tan(Math.PI*(+s[r+1]+90)/360));o>Dn?o=Dn:o<-Dn&&(o=-Dn),t[r+1]=o}return t}function Nh(s,t,e,i){const n=s.length;e=e>1?e:2,i=i??e,t===void 0&&(e>2?t=s.slice():t=new Array(n));for(let r=0;r<n;r+=i)t[r]=180*s[r]/ri,t[r+1]=360*Math.atan(Math.exp(s[r+1]/Wi))/Math.PI-90;return t}const Gh=6378137,qo=[-180,-90,180,90],Wh=Math.PI*Gh/180;class je extends bn{constructor(t,e){super({code:t,units:"degrees",extent:qo,axisOrientation:e,global:!0,metersPerUnit:Wh,worldExtent:qo})}}const $o=[new je("CRS:84"),new je("EPSG:4326","neu"),new je("urn:ogc:def:crs:OGC:1.3:CRS84"),new je("urn:ogc:def:crs:OGC:2:84"),new je("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new je("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new je("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Vs={};function zh(s){return Vs[s]||Vs[s.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function jh(s,t){Vs[s]=t}function ai(s){for(const t in s)delete s[t]}function Xe(s){let t;for(t in s)return!1;return!t}let li={};function zi(s,t,e){const i=s.getCode(),n=t.getCode();i in li||(li[i]={}),li[i][n]=e}function Bs(s,t){return s in li&&t in li[s]?li[s][t]:null}const On=.9996,Dt=.00669438,kn=Dt*Dt,Nn=kn*Dt,Ve=Dt/(1-Dt),Jo=Math.sqrt(1-Dt),hi=(1-Jo)/(1+Jo),Qo=hi*hi,Ys=Qo*hi,Ks=Ys*hi,ta=Ks*hi,ea=1-Dt/4-3*kn/64-5*Nn/256,Xh=3*Dt/8+3*kn/32+45*Nn/1024,Vh=15*kn/256+45*Nn/1024,Bh=35*Nn/3072,Yh=3/2*hi-27/32*Ys+269/512*ta,Kh=21/16*Qo-55/32*Ks,Uh=151/96*Ys-417/128*ta,Zh=1097/512*Ks,Gn=6378137;function Hh(s,t,e){const i=s-5e5,o=(e.north?t:t-1e7)/On/(Gn*ea),a=o+Yh*Math.sin(2*o)+Kh*Math.sin(4*o)+Uh*Math.sin(6*o)+Zh*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-Dt*h,m=Math.sqrt(1-Dt*h),_=Gn/m,p=(1-Dt)/g,y=Ve*c**2,E=y*y,x=i/(_*On),C=x*x,S=C*x,T=S*x,I=T*x,R=I*x,M=a-u/p*(C/2-T/24*(5+3*d+10*y-4*E-9*Ve))+R/720*(61+90*d+298*y+45*f-252*Ve-3*E);let k=(x-S/6*(1+2*d+y)+I/120*(5-2*y+28*d-3*E+8*Ve+24*f))/c;return k=ks(k+we(sa(e.number)),-Math.PI,Math.PI),[zo(k),zo(M)]}const ia=-80,na=84,qh=-180,$h=180;function Jh(s,t,e){s=ks(s,qh,$h),t<ia?t=ia:t>na&&(t=na);const i=we(t),n=Math.sin(i),r=Math.cos(i),o=n/r,a=o*o,l=a*a,h=we(s),c=sa(e.number),u=we(c),d=Gn/Math.sqrt(1-Dt*n**2),f=Ve*r**2,g=r*ks(h-u,-Math.PI,Math.PI),m=g*g,_=m*g,p=_*g,y=p*g,E=y*g,x=Gn*(ea*i-Xh*Math.sin(2*i)+Vh*Math.sin(4*i)-Bh*Math.sin(6*i)),C=On*d*(g+_/6*(1-a+f)+y/120*(5-18*a+l+72*f-58*Ve))+5e5;let S=On*(x+d*o*(m/2+p/24*(5-a+9*f+4*f**2)+E/720*(61-58*a+l+600*f-330*Ve)));return e.north||(S+=1e7),[C,S]}function sa(s){return(s-1)*6-180+3}const Qh=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function ra(s){let t=0;for(const n of Qh){const r=s.match(n);if(r){t=parseInt(r[1]);break}}if(!t)return null;let e=0,i=!1;return t>32700&&t<32761?e=t-32700:t>32600&&t<32661&&(i=!0,e=t-32600),e?{number:e,north:i}:null}function oa(s,t){return function(e,i,n,r){const o=e.length;n=n>1?n:2,r=r??n,i||(n>2?i=e.slice():i=new Array(o));for(let a=0;a<o;a+=r){const l=e[a],h=e[a+1],c=s(l,h,t);i[a]=c[0],i[a+1]=c[1]}return i}}function tc(s){return ra(s)?new bn({code:s,units:"m"}):null}function ec(s){const t=ra(s.getCode());return t?{forward:oa(Jh,t),inverse:oa(Hh,t)}:null}const ic=63710088e-1;function aa(s,t,e){e=e||ic;const i=we(s[1]),n=we(t[1]),r=(n-i)/2,o=we(t[0]-s[0])/2,a=Math.sin(r)*Math.sin(r)+Math.sin(o)*Math.sin(o)*Math.cos(i)*Math.cos(n);return 2*e*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}const nc=[ec],sc=[tc];let Us=!0;function rc(s){Us=!1}function Zs(s,t){if(t!==void 0){for(let e=0,i=s.length;e<i;++e)t[e]=s[e];t=t}else t=s.slice();return t}function Hs(s){jh(s.getCode(),s),zi(s,s,Zs)}function oc(s){s.forEach(Hs)}function ot(s){if(typeof s!="string")return s;const t=zh(s);if(t)return t;for(const e of sc){const i=e(s);if(i)return i}return null}function la(s,t,e,i){s=ot(s);let n;const r=s.getPointResolutionFunc();if(r)n=r(t,e);else{const o=s.getUnits();if(o=="degrees"&&!i||i=="degrees")n=t;else{const a=Js(s,ot("EPSG:4326"));if(!a&&o!=="degrees")n=t*s.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=aa(h.slice(0,2),h.slice(2,4)),u=aa(h.slice(4,6),h.slice(6,8));n=(c+u)/2}const l=s.getMetersPerUnit();l!==void 0&&(n/=l)}}return n}function ha(s){oc(s),s.forEach(function(t){s.forEach(function(e){t!==e&&zi(t,e,Zs)})})}function ac(s,t,e,i){s.forEach(function(n){t.forEach(function(r){zi(n,r,e),zi(r,n,i)})})}function qs(s,t){return s?typeof s=="string"?ot(s):s:ot(t)}function lc(s){return(function(t,e,i,n){const r=t.length;i=i!==void 0?i:2,n=n??i,e=e!==void 0?e:new Array(r);for(let o=0;o<r;o+=n){const a=s(t.slice(o,o+i)),l=a.length;for(let h=0,c=n;h<c;++h)e[o+h]=h>=l?t[o+h]:a[h]}return e})}function $s(s,t){if(s===t)return!0;const e=s.getUnits()===t.getUnits();return(s.getCode()===t.getCode()||Js(s,t)===Zs)&&e}function Js(s,t){const e=s.getCode(),i=t.getCode();let n=Bs(e,i);if(n)return n;let r=null,o=null;for(const l of nc)r||(r=l(s)),o||(o=l(t));if(!r&&!o)return null;const a="EPSG:4326";if(o)if(r)n=Qs(r.inverse,o.forward);else{const l=Bs(e,a);l&&(n=Qs(l,o.forward))}else{const l=Bs(a,i);l&&(n=Qs(r.inverse,l))}return n&&(Hs(s),Hs(t),zi(s,t,n)),n}function Qs(s,t){return function(e,i,n,r){return i=s(e,i,n,r),t(i,i,n,r)}}function ji(s,t){const e=ot(s),i=ot(t);return Js(e,i)}function ca(s,t,e){const i=ji(t,e);if(!i){const n=ot(t).getCode(),r=ot(e).getCode();throw new Error(`No transform available between ${n} and ${r}`)}return i(s,void 0,s.length)}function Se(s,t){return s}function H(s,t){return Us&&!Et(s,[0,0])&&s[0]>=-180&&s[0]<=180&&s[1]>=-90&&s[1]<=90&&(Us=!1,Uo("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),s}function Wn(s,t){return s}function Ie(s,t){return s}function hc(){ha(Ho),ha($o),ac($o,Ho,kh,Nh)}hc();const Ot={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"},P={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4},tr=[NaN,NaN,NaN,0];let er;function cc(){return er||(er=ut(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),er}const uc=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,dc=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,fc=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,gc=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function zn(s,t){return s.endsWith("%")?Number(s.substring(0,s.length-1))/t:Number(s)}function Xi(s){throw new Error('failed to parse "'+s+'" as color')}function ua(s){if(s.toLowerCase().startsWith("rgb")){const r=s.match(dc)||s.match(uc)||s.match(fc);if(r){const o=r[4],a=100/255;return[rt(zn(r[1],a)+.5|0,0,255),rt(zn(r[2],a)+.5|0,0,255),rt(zn(r[3],a)+.5|0,0,255),o!==void 0?rt(zn(o,100),0,1):1]}Xi(s)}if(s.startsWith("#")){if(gc.test(s)){const r=s.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}Xi(s)}const t=cc();t.fillStyle="#abcdef";let e=t.fillStyle;t.fillStyle=s,t.fillStyle===e&&(t.fillStyle="#fedcba",e=t.fillStyle,t.fillStyle=s,t.fillStyle===e&&Xi(s));const i=t.fillStyle;if(i.startsWith("#")||i.startsWith("rgba"))return ua(i);t.clearRect(0,0,1,1),t.fillRect(0,0,1,1);const n=Array.from(t.getImageData(0,0,1,1).data);return n[3]=Mn(n[3]/255,3),n}function _c(s){return typeof s=="string"?s:lr(s)}const mc=1024,Vi={};let ir=0;function pc(s){if(s.length===4)return s;const t=s.slice();return t[3]=1,t}function nr(s){return s>.0031308?Math.pow(s,1/2.4)*269.025-14.025:s*3294.6}function sr(s){return s>.2068965?Math.pow(s,3):(s-4/29)*(108/841)}function rr(s){return s>10.314724?Math.pow((s+14.025)/269.025,2.4):s/3294.6}function or(s){return s>.0088564?Math.pow(s,1/3):s/(108/841)+4/29}function da(s){const t=rr(s[0]),e=rr(s[1]),i=rr(s[2]),n=or(t*.222488403+e*.716873169+i*.06060791),r=500*(or(t*.452247074+e*.399439023+i*.148375274)-n),o=200*(n-or(t*.016863605+e*.117638439+i*.865350722)),a=Math.atan2(o,r)*(180/Math.PI);return[116*n-16,Math.sqrt(r*r+o*o),a<0?a+360:a,s[3]]}function yc(s){const t=(s[0]+16)/116,e=s[1],i=s[2]*Math.PI/180,n=sr(t),r=sr(t+e/500*Math.cos(i)),o=sr(t-e/200*Math.sin(i)),a=nr(r*3.021973625-n*1.617392459-o*.404875592),l=nr(r*-.943766287+n*1.916279586+o*.027607165),h=nr(r*.069407491-n*.22898585+o*1.159737864);return[rt(a+.5|0,0,255),rt(l+.5|0,0,255),rt(h+.5|0,0,255),s[3]]}function ar(s){if(s==="none")return tr;if(Vi.hasOwnProperty(s))return Vi[s];if(ir>=mc){let e=0;for(const i in Vi)(e++&3)===0&&(delete Vi[i],--ir)}const t=ua(s);t.length!==4&&Xi(s);for(const e of t)isNaN(e)&&Xi(s);return Vi[s]=t,++ir,t}function ci(s){return Array.isArray(s)?s:ar(s)}function lr(s){let t=s[0];t!=(t|0)&&(t=t+.5|0);let e=s[1];e!=(e|0)&&(e=e+.5|0);let i=s[2];i!=(i|0)&&(i=i+.5|0);const n=s[3]===void 0?1:Math.round(s[3]*1e3)/1e3;return"rgba("+t+","+e+","+i+","+n+")"}const D={CHANGE:"change",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",KEYDOWN:"keydown",KEYPRESS:"keypress",TOUCHMOVE:"touchmove",WHEEL:"wheel"};class hr{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function zt(){return!0}function Be(){return!1}function Bi(){}function fa(s){let t,e,i;return function(){const n=Array.prototype.slice.call(arguments);return(!e||this!==i||!ne(n,e))&&(i=this,e=n,t=s.apply(this,arguments)),t}}function ga(s){function t(){let e;try{e=s()}catch(i){return Promise.reject(i)}return e instanceof Promise?e:Promise.resolve(e)}return t()}class It{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}class jn extends hr{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),n=i[t]||(i[t]=[]);n.includes(e)||n.push(e)}dispatchEvent(t){const e=typeof t=="string",i=e?t:t.type,n=this.listeners_&&this.listeners_[i];if(!n)return;const r=e?new It(t):t;r.target||(r.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});i in o||(o[i]=0,a[i]=0),++o[i];let l;for(let h=0,c=n.length;h<c;++h)if("handleEvent"in n[h]?l=n[h].handleEvent(r):l=n[h].call(this,r),l===!1||r.propagationStopped){l=!1;break}if(--o[i]===0){let h=a[i];for(delete a[i];h--;)this.removeEventListener(i,Bi);delete o[i]}return l}disposeInternal(){this.listeners_&&ai(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 i=this.listeners_[t];if(!i)return;const n=i.indexOf(e);n!==-1&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=Bi,++this.pendingRemovals_[t]):(i.splice(n,1),i.length===0&&delete this.listeners_[t]))}}function W(s,t,e,i,n){if(n){const o=e;e=function(a){return s.removeEventListener(t,e),o.call(i??this,a)}}else i&&i!==s&&(e=e.bind(i));const r={target:s,type:t,listener:e};return s.addEventListener(t,e),r}function _a(s,t,e,i){return W(s,t,e,i,!0)}function J(s){s&&s.target&&(s.target.removeEventListener(s.type,s.listener),ai(s))}class cr extends jn{constructor(t,e,i,n){super(),this.extent=t,this.pixelRatio_=i,this.resolution=e,this.state=typeof n=="function"?P.IDLE:n,this.image_=null,this.loader=typeof n=="function"?n:null}changed(){this.dispatchEvent(D.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==P.IDLE&&this.loader){this.state=P.LOADING,this.changed();const t=this.getResolution(),e=Array.isArray(t)?t[0]:t;ga(()=>this.loader(this.getExtent(),e,this.getPixelRatio())).then(i=>{"image"in i&&(this.image_=i.image),"extent"in i&&(this.extent=i.extent),"resolution"in i&&(this.resolution=i.resolution),"pixelRatio"in i&&(this.pixelRatio_=i.pixelRatio),(i instanceof HTMLImageElement||Vo&&i instanceof ImageBitmap||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement)&&(this.image_=i),this.state=P.LOADED}).catch(i=>{this.state=P.ERROR,console.error(i)}).finally(()=>this.changed())}}setImage(t){this.image_=t}setResolution(t){this.resolution=t}}function xc(s,t){return new Promise((e,i)=>{function n(){o(),e(s)}function r(){o(),i(new Error("Image load error"))}function o(){s.removeEventListener("load",n),s.removeEventListener("error",r)}s.addEventListener("load",n),s.addEventListener("error",r)})}function ma(s,t){return t&&(s.src=t),s.src&&Xo?new Promise((e,i)=>s.decode().then(()=>e(s)).catch(n=>s.complete&&s.width?e(s):i(n))):xc(s)}function pa(s,t){return t&&(s.src=t),s.src&&Xo&&Vo?s.decode().then(()=>createImageBitmap(s)).catch(e=>{if(s.complete&&s.width)return s;throw e}):ma(s)}class Ec{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const i=this.cache_[e];(t++&3)===0&&!i.hasListener()&&(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e,i){const n=ur(t,e,i);return n in this.cache_?this.cache_[n]:null}getPattern(t,e,i){const n=ur(t,e,i);return n in this.patternCache_?this.patternCache_[n]:null}set(t,e,i,n,r){const o=ur(t,e,i),a=o in this.cache_;this.cache_[o]=n,r&&(n.getImageState()===P.IDLE&&n.load(),n.getImageState()===P.LOADING?n.ready().then(()=>{this.patternCache_[o]=Fn().createPattern(n.getImage(1),"repeat")}):this.patternCache_[o]=Fn().createPattern(n.getImage(1),"repeat")),a||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function ur(s,t,e){const i=e?ci(e):"null";return t+":"+s+":"+i}const kt=new Ec;let Yi=null;class ya extends jn{constructor(t,e,i,n,r){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i,this.canvas_={},this.color_=r,this.imageState_=n===void 0?P.IDLE:n,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_===P.LOADED){Yi||(Yi=ut(1,1,void 0,{willReadFrequently:!0})),Yi.drawImage(this.image_,0,0);try{Yi.getImageData(0,0,1,1),this.tainted_=!1}catch{Yi=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(D.CHANGE)}handleImageError_(){this.imageState_=P.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=P.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],i=ut(t,e);i.fillRect(0,0,t,e),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===P.IDLE){this.image_||this.initializeImage_(),this.imageState_=P.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&ma(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_!==P.LOADED)return;const e=this.image_,i=ut(Math.ceil(e.width*t),Math.ceil(e.height*t)),n=i.canvas;i.scale(t,t),i.drawImage(e,0,0),i.globalCompositeOperation="multiply",i.fillStyle=_c(this.color_),i.fillRect(0,0,n.width/t,n.height/t),i.globalCompositeOperation="destination-in",i.drawImage(e,0,0),this.canvas_[t]=n}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(this.imageState_===P.LOADED||this.imageState_===P.ERROR)t();else{const e=()=>{(this.imageState_===P.LOADED||this.imageState_===P.ERROR)&&(this.removeEventListener(D.CHANGE,e),t())};this.addEventListener(D.CHANGE,e)}})),this.ready_}}function dr(s,t,e,i,n,r){let o=t===void 0?void 0:kt.get(t,e,n);return o||(o=new ya(s,s&&"src"in s?s.src||void 0:t,e,i,n),kt.set(t,e,n,o,r)),r&&o&&!kt.getPattern(t,e,n)&&kt.set(t,e,n,o,r),o}function qt(s){return s?Array.isArray(s)?lr(s):typeof s=="object"&&"src"in s?Cc(s):s:null}function Cc(s){if(!s.offset||!s.size)return kt.getPattern(s.src,"anonymous",s.color);const t=s.src+":"+s.offset,e=kt.getPattern(t,void 0,s.color);if(e)return e;const i=kt.get(s.src,"anonymous",null);if(i.getImageState()!==P.LOADED)return null;const n=ut(s.size[0],s.size[1]);return n.drawImage(i.getImage(1),s.offset[0],s.offset[1],s.size[0],s.size[1],0,0,s.size[0],s.size[1]),dr(n.canvas,t,void 0,P.LOADED,s.color,!0),kt.getPattern(t,void 0,s.color)}function Re(s,t,e,i,n){n=n!==void 0?n:[];let r=0;for(let o=t;o<e;o+=i)n[r++]=s.slice(o,o+i);return n.length=r,n}function Ki(s,t,e,i,n){n=n!==void 0?n:[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];n[r++]=Re(s,t,l,i,n[r]),t=l}return n.length=r,n}function fr(s,t,e,i,n){n=n!==void 0?n:[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];n[r++]=l.length===1&&l[0]===t?[]:Ki(s,t,l,i,n[r]),t=l[l.length-1]}return n.length=r,n}class xa{drawCustom(t,e,i,n,r){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,i){}drawFeature(t,e,i){}drawGeometryCollection(t,e,i){}drawLineString(t,e,i){}drawMultiLineString(t,e,i){}drawMultiPoint(t,e,i){}drawMultiPolygon(t,e,i){}drawPoint(t,e,i){}drawPolygon(t,e,i){}drawText(t,e,i){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}}const ui={PROPERTYCHANGE:"propertychange"};class Ui extends jn{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(D.CHANGE)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=W(this,t[r],e);return n}return W(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const n=t.length;i=new Array(n);for(let r=0;r<n;++r)i[r]=_a(this,t[r],e)}else i=_a(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)wc(i);else if(Array.isArray(t))for(let n=0,r=t.length;n<r;++n)this.removeEventListener(t[n],e);else this.removeEventListener(t,e)}}Ui.prototype.on,Ui.prototype.once,Ui.prototype.un;function wc(s){if(Array.isArray(s))for(let t=0,e=s.length;t<e;++t)J(s[t]);else J(s)}function O(){throw new Error("Unimplemented abstract method.")}let Sc=0;function V(s){return s.ol_uid||(s.ol_uid=String(++Sc))}class Ea extends It{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}class jt extends Ui{constructor(t){super(),this.on,this.once,this.un,V(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 i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new Ea(i,t,e)),i=ui.PROPERTYCHANGE,this.hasListener(i)&&this.dispatchEvent(new Ea(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const n=this.values_||(this.values_={});if(i)n[t]=e;else{const r=n[t];n[t]=e,r!==e&&this.notify(t,r)}}setProperties(t,e){for(const i in t)this.set(i,t[i],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const i=this.values_[t];delete this.values_[t],Xe(this.values_)&&(this.values_=null),e||this.notify(t,i)}}}const Xn="ol-hidden",Ic="ol-selectable",Vn="ol-unselectable",gr="ol-control",Ca="ol-collapsed",Rc=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"),wa=["style","variant","weight","size","lineHeight","family"],_r={normal:400,bold:700},mr=function(s){const t=s.match(Rc);if(!t)return null;const e={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let i=0,n=wa.length;i<n;++i){const r=t[i+1];r!==void 0&&(e[wa[i]]=typeof r=="string"?r.trim():r)}return isNaN(Number(e.weight))&&e.weight in _r&&(e.weight=_r[e.weight]),e.families=e.family.split(/,\s?/).map(i=>i.trim().replace(/^['"]|['"]$/g,"")),e},Sa="10px sans-serif",Rt="#000",di="round",ae=[],le=0,fi="round",Zi=10,Hi="#000",qi="center",Bn="middle",Ye=[0,0,0,0],$i=1,gi=new jt;let Ji=null,Ia;const pr={},vc=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function Tc(s,t,e){return`${s} ${t} 16px "${e}"`}const Pc=(function(){let t,e;async function i(r){await e.ready;const o=await e.load(r);if(o.length===0)return!1;const a=mr(r),l=a.families[0].toLowerCase(),h=a.weight;return o.some(c=>{const u=c.family.replace(/^['"]|['"]$/g,"").toLowerCase(),d=_r[c.weight]||c.weight;return u===l&&c.style===a.style&&d==h})}async function n(){await e.ready;let r=!0;const o=gi.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 i(h)?(ai(pr),gi.set(h,100)):(c+=10,gi.set(h,c,!0),c<100&&(r=!1)))}t=void 0,r||(t=setTimeout(n,100))}return async function(r){e||(e=zs?self.fonts:document.fonts);const o=mr(r);if(!o)return;const a=o.families;let l=!1;for(const h of a){if(vc.has(h))continue;const c=Tc(o.style,o.weight,h);gi.get(c)===void 0&&(gi.set(c,0,!0),l=!0)}l&&(clearTimeout(t),t=setTimeout(n,100))}})(),Mc=(function(){let s;return function(t){let e=pr[t];if(e==null){if(zs){const i=mr(t),n=Ra(t,"Žg");e=(isNaN(Number(i.lineHeight))?1.2:Number(i.lineHeight))*(n.actualBoundingBoxAscent+n.actualBoundingBoxDescent)}else s||(s=document.createElement("div"),s.innerHTML="M",s.style.minHeight="0",s.style.maxHeight="none",s.style.height="auto",s.style.padding="0",s.style.border="none",s.style.position="absolute",s.style.display="block",s.style.left="-99999px"),s.style.font=t,document.body.appendChild(s),e=s.offsetHeight,document.body.removeChild(s);pr[t]=e}return e}})();function Ra(s,t){return Ji||(Ji=ut(1,1)),s!=Ia&&(Ji.font=s,Ia=Ji.font),Ji.measureText(t)}function va(s,t){return Ra(s,t).width}function Ta(s,t,e){if(t in e)return e[t];const i=t.split(`
|
|
1
|
+
(function(St,U){typeof exports=="object"&&typeof module<"u"?U(exports):typeof define=="function"&&define.amd?define(["exports"],U):(St=typeof globalThis<"u"?globalThis:St||self,U(St.ppe={}))})(this,(function(St){"use strict";var Hg=Object.defineProperty;var qg=(St,U,ii)=>U in St?Hg(St,U,{enumerable:!0,configurable:!0,writable:!0,value:ii}):St[U]=ii;var fh=(St,U,ii)=>qg(St,typeof U!="symbol"?U+"":U,ii);const U={ANIMATING:0,INTERACTING:1};function ii(s,t,e){let i,n;e=e||Ne;let r=0,o=s.length,a=!1;for(;r<o;)i=r+(o-r>>1),n=+e(s[i],t),n<0?r=i+1:(o=i,a=!n);return a?r:~r}function Ne(s,t){return s>t?1:s<t?-1:0}function gh(s,t){return s<t?1:s>t?-1:0}function Ps(s,t,e){if(s[0]<=t)return 0;const i=s.length;if(t<=s[i-1])return i-1;if(typeof e=="function"){for(let n=1;n<i;++n){const r=s[n];if(r===t)return n;if(r<t)return e(t,s[n-1],r)>0?n-1:n}return i-1}if(e>0){for(let n=1;n<i;++n)if(s[n]<t)return n-1;return i-1}if(e<0){for(let n=1;n<i;++n)if(s[n]<=t)return n;return i-1}for(let n=1;n<i;++n){if(s[n]==t)return n;if(s[n]<t)return s[n-1]-t<t-s[n]?n-1:n}return i-1}function _h(s,t,e){for(;t<e;){const i=s[t];s[t]=s[e],s[e]=i,++t,--e}}function Ft(s,t){const e=Array.isArray(t)?t:[t],i=e.length;for(let n=0;n<i;n++)s[s.length]=e[n]}function ne(s,t){const e=s.length;if(e!==t.length)return!1;for(let i=0;i<e;i++)if(s[i]!==t[i])return!1;return!0}const lt={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function ht(s){const t=bt();for(let e=0,i=s.length;e<i;++e)Gi(t,s[e]);return t}function bi(s,t,e){return e?(e[0]=s[0]-t,e[1]=s[1]-t,e[2]=s[2]+t,e[3]=s[3]+t,e):[s[0]-t,s[1]-t,s[2]+t,s[3]+t]}function Oo(s,t){return t?(t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t):s.slice()}function Ge(s,t,e){let i,n;return t<s[0]?i=s[0]-t:s[2]<t?i=t-s[2]:i=0,e<s[1]?n=s[1]-e:s[3]<e?n=e-s[3]:n=0,i*i+n*n}function Di(s,t){return Ms(s,t[0],t[1])}function se(s,t){return s[0]<=t[0]&&t[2]<=s[2]&&s[1]<=t[1]&&t[3]<=s[3]}function Ms(s,t,e){return s[0]<=t&&t<=s[2]&&s[1]<=e&&e<=s[3]}function Ls(s,t){const e=s[0],i=s[1],n=s[2],r=s[3],o=t[0],a=t[1];let l=lt.UNKNOWN;return o<e?l=l|lt.LEFT:o>n&&(l=l|lt.RIGHT),a<i?l=l|lt.BELOW:a>r&&(l=l|lt.ABOVE),l===lt.UNKNOWN&&(l=lt.INTERSECTING),l}function bt(){return[1/0,1/0,-1/0,-1/0]}function We(s,t,e,i,n){return n?(n[0]=s,n[1]=t,n[2]=e,n[3]=i,n):[s,t,e,i]}function Oi(s){return We(1/0,1/0,-1/0,-1/0,s)}function ki(s,t){const e=s[0],i=s[1];return We(e,i,e,i,t)}function As(s,t,e,i,n){const r=Oi(n);return No(r,s,t,e,i)}function Ni(s,t){return s[0]==t[0]&&s[2]==t[2]&&s[1]==t[1]&&s[3]==t[3]}function ko(s,t){return t[0]<s[0]&&(s[0]=t[0]),t[2]>s[2]&&(s[2]=t[2]),t[1]<s[1]&&(s[1]=t[1]),t[3]>s[3]&&(s[3]=t[3]),s}function Gi(s,t){t[0]<s[0]&&(s[0]=t[0]),t[0]>s[2]&&(s[2]=t[0]),t[1]<s[1]&&(s[1]=t[1]),t[1]>s[3]&&(s[3]=t[1])}function No(s,t,e,i,n){for(;e<i;e+=n)mh(s,t[e],t[e+1]);return s}function mh(s,t,e){s[0]=Math.min(s[0],t),s[1]=Math.min(s[1],e),s[2]=Math.max(s[2],t),s[3]=Math.max(s[3],e)}function Go(s,t){let e;return e=t(Fs(s)),e||(e=t(bs(s)),e)||(e=t(Os(s)),e)||(e=t(Pn(s)),e)?e:!1}function ph(s){let t=0;return ni(s)||(t=Z(s)*ct(s)),t}function Fs(s){return[s[0],s[1]]}function bs(s){return[s[2],s[1]]}function Ht(s){return[(s[0]+s[2])/2,(s[1]+s[3])/2]}function Tn(s,t,e,i,n){const[r,o,a,l,h,c,u,d]=yh(s,t,e,i);return We(Math.min(r,a,h,u),Math.min(o,l,c,d),Math.max(r,a,h,u),Math.max(o,l,c,d),n)}function yh(s,t,e,i){const n=t*i[0]/2,r=t*i[1]/2,o=Math.cos(e),a=Math.sin(e),l=n*o,h=n*a,c=r*o,u=r*a,d=s[0],f=s[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(s){return s[3]-s[1]}function Ds(s,t,e){const i=e||bt();return dt(s,t)?(s[0]>t[0]?i[0]=s[0]:i[0]=t[0],s[1]>t[1]?i[1]=s[1]:i[1]=t[1],s[2]<t[2]?i[2]=s[2]:i[2]=t[2],s[3]<t[3]?i[3]=s[3]:i[3]=t[3]):Oi(i),i}function Pn(s){return[s[0],s[3]]}function Os(s){return[s[2],s[3]]}function Z(s){return s[2]-s[0]}function dt(s,t){return s[0]<=t[2]&&s[2]>=t[0]&&s[1]<=t[3]&&s[3]>=t[1]}function ni(s){return s[2]<s[0]||s[3]<s[1]}function xh(s,t){return t?(t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t):s}function Eh(s,t,e){let i=!1;const n=Ls(s,t),r=Ls(s,e);if(n===lt.INTERSECTING||r===lt.INTERSECTING)i=!0;else{const o=s[0],a=s[1],l=s[2],h=s[3],c=t[0],u=t[1],d=e[0],f=e[1],g=(f-u)/(d-c);let m,_;r<.ABOVE&&!(n<.ABOVE)&&(m=d-(f-h)/g,i=m>=o&&m<=l),!i&&r<.RIGHT&&!(n<.RIGHT)&&(_=f-(d-l)*g,i=_>=a&&_<=h),!i&&r<.BELOW&&!(n<.BELOW)&&(m=d-(f-a)/g,i=m>=o&&m<=l),!i&&r<.LEFT&&!(n<.LEFT)&&(_=f-(d-o)*g,i=_>=a&&_<=h)}return i}function Wo(s,t){const e=t.getExtent(),i=Ht(s);if(t.canWrapX()&&(i[0]<e[0]||i[0]>=e[2])){const n=Z(e),o=Math.floor((i[0]-e[0])/n)*n;s[0]-=o,s[2]-=o}return s}function Ch(s,t,e){if(t.canWrapX()){const i=t.getExtent();if(!isFinite(s[0])||!isFinite(s[2]))return[[i[0],s[1],i[2],s[3]]];Wo(s,t);const n=Z(i);if(Z(s)>n)return[[i[0],s[1],i[2],s[3]]];if(s[0]<i[0])return[[s[0]+n,s[1],i[2],s[3]],[i[0],s[1],s[2],s[3]]];if(s[2]>i[2])return[[s[0],s[1],i[2],s[3]],[i[0],s[1],s[2]-n,s[3]]]}return[s]}function rt(s,t,e){return Math.min(Math.max(s,t),e)}function wh(s,t,e,i,n,r){const o=n-e,a=r-i;if(o!==0||a!==0){const l=((s-e)*o+(t-i)*a)/(o*o+a*a);l>1?(e=n,i=r):l>0&&(e+=o*l,i+=a*l)}return re(s,t,e,i)}function re(s,t,e,i){const n=e-s,r=i-t;return n*n+r*r}function Sh(s){const t=s.length;for(let i=0;i<t;i++){let n=i,r=Math.abs(s[i][i]);for(let a=i+1;a<t;a++){const l=Math.abs(s[a][i]);l>r&&(r=l,n=a)}if(r===0)return null;const o=s[n];s[n]=s[i],s[i]=o;for(let a=i+1;a<t;a++){const l=-s[a][i]/s[i][i];for(let h=i;h<t+1;h++)i==h?s[a][h]=0:s[a][h]+=l*s[i][h]}}const e=new Array(t);for(let i=t-1;i>=0;i--){e[i]=s[i][t]/s[i][i];for(let n=i-1;n>=0;n--)s[n][t]-=s[n][i]*e[i]}return e}function zo(s){return s*180/Math.PI}function we(s){return s*Math.PI/180}function si(s,t){const e=s%t;return e*t<0?e+t:e}function Mt(s,t,e){return s+e*(t-s)}function Mn(s,t){const e=Math.pow(10,t);return Math.round(s*e)/e}function Ln(s,t){return Math.ceil(Mn(s,t))}function ks(s,t,e){if(s>=t&&s<e)return s;const i=e-t;return((s-t)%i+i)%i+t}function Ih(s,t){return s[0]+=+t[0],s[1]+=+t[1],s}function Rh(s,t){const e=t.getRadius(),i=t.getCenter(),n=i[0],r=i[1],o=s[0],a=s[1];let l=o-n;const h=a-r;l===0&&h===0&&(l=1);const c=Math.sqrt(l*l+h*h),u=n+e*l/c,d=r+e*h/c;return[u,d]}function Ns(s,t){const e=s[0],i=s[1],n=t[0],r=t[1],o=n[0],a=n[1],l=r[0],h=r[1],c=l-o,u=h-a,d=c===0&&u===0?0:(c*(e-o)+u*(i-a))/(c*c+u*u||0);let f,g;return d<=0?(f=o,g=a):d>=1?(f=l,g=h):(f=o+d*c,g=a+d*u),[f,g]}function Et(s,t){let e=!0;for(let i=s.length-1;i>=0;--i)if(s[i]!=t[i]){e=!1;break}return e}function Gs(s,t){const e=Math.cos(t),i=Math.sin(t),n=s[0]*e-s[1]*i,r=s[1]*e+s[0]*i;return s[0]=n,s[1]=r,s}function vh(s,t){return s[0]*=t,s[1]*=t,s}function oe(s,t){const e=s[0]-t[0],i=s[1]-t[1];return e*e+i*i}function An(s,t){return Math.sqrt(oe(s,t))}function Th(s,t){return oe(s,Ns(s,t))}function jo(s,t){if(t.canWrapX()){const e=Z(t.getExtent()),i=Ph(s,t,e);i&&(s[0]-=i*e)}return s}function Ph(s,t,e){const i=t.getExtent();let n=0;return t.canWrapX()&&(s[0]<i[0]||s[0]>i[2])&&(e=e||Z(i),n=Math.floor((s[0]-i[0])/e)),n}const ze=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"";ze.includes("safari")&&!ze.includes("chrom")&&(ze.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(ze));const Mh=ze.includes("webkit")&&!ze.includes("edge"),Ws=ze.includes("macintosh"),Lh=typeof devicePixelRatio<"u"?devicePixelRatio:1,zs=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,Xo=typeof Image<"u"&&Image.prototype.decode,Vo=typeof createImageBitmap=="function",Bo=(function(){let s=!1;try{const t=Object.defineProperty({},"passive",{get:function(){s=!0}});window.addEventListener("_",null,t),window.removeEventListener("_",null,t)}catch{}return s})();function ut(s,t,e,i){let n;return e&&e.length?n=e.shift():zs?n=new OffscreenCanvas(s||300,t||300):n=document.createElement("canvas"),s&&(n.width=s),t&&(n.height=t),n.getContext("2d",i)}let js;function Fn(){return js||(js=ut(1,1)),js}function Xs(s){const t=s.canvas;t.width=1,t.height=1,s.clearRect(0,0,1,1)}function Ah(s){let t=s.offsetWidth;const e=getComputedStyle(s);return t+=parseInt(e.marginLeft,10)+parseInt(e.marginRight,10),t}function Fh(s){let t=s.offsetHeight;const e=getComputedStyle(s);return t+=parseInt(e.marginTop,10)+parseInt(e.marginBottom,10),t}function Yo(s,t){const e=t.parentNode;e&&e.replaceChild(s,t)}function Ko(s){for(;s.lastChild;)s.lastChild.remove()}function bh(s,t){const e=s.childNodes;for(let i=0;;++i){const n=e[i],r=t[i];if(!n&&!r)break;if(n!==r){if(!n){s.appendChild(r);continue}if(!r){s.removeChild(n),--i;continue}s.insertBefore(r,n)}}}function Uo(...s){console.warn(...s)}const Zo={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class bn{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_||Zo[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 Wi=6378137,ri=Math.PI*Wi,Dh=[-ri,-ri,ri,ri],Oh=[-180,-85,180,85],Dn=Wi*Math.log(Math.tan(Math.PI/2));class oi extends bn{constructor(t){super({code:t,units:"m",extent:Dh,global:!0,worldExtent:Oh,getPointResolution:function(e,i){return e/Math.cosh(i[1]/Wi)}})}}const Ho=[new oi("EPSG:3857"),new oi("EPSG:102100"),new oi("EPSG:102113"),new oi("EPSG:900913"),new oi("http://www.opengis.net/def/crs/EPSG/0/3857"),new oi("http://www.opengis.net/gml/srs/epsg.xml#3857")];function kh(s,t,e,i){const n=s.length;e=e>1?e:2,i=i??e,t===void 0&&(e>2?t=s.slice():t=new Array(n));for(let r=0;r<n;r+=i){t[r]=ri*s[r]/180;let o=Wi*Math.log(Math.tan(Math.PI*(+s[r+1]+90)/360));o>Dn?o=Dn:o<-Dn&&(o=-Dn),t[r+1]=o}return t}function Nh(s,t,e,i){const n=s.length;e=e>1?e:2,i=i??e,t===void 0&&(e>2?t=s.slice():t=new Array(n));for(let r=0;r<n;r+=i)t[r]=180*s[r]/ri,t[r+1]=360*Math.atan(Math.exp(s[r+1]/Wi))/Math.PI-90;return t}const Gh=6378137,qo=[-180,-90,180,90],Wh=Math.PI*Gh/180;class je extends bn{constructor(t,e){super({code:t,units:"degrees",extent:qo,axisOrientation:e,global:!0,metersPerUnit:Wh,worldExtent:qo})}}const $o=[new je("CRS:84"),new je("EPSG:4326","neu"),new je("urn:ogc:def:crs:OGC:1.3:CRS84"),new je("urn:ogc:def:crs:OGC:2:84"),new je("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new je("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new je("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Vs={};function zh(s){return Vs[s]||Vs[s.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function jh(s,t){Vs[s]=t}function ai(s){for(const t in s)delete s[t]}function Xe(s){let t;for(t in s)return!1;return!t}let li={};function zi(s,t,e){const i=s.getCode(),n=t.getCode();i in li||(li[i]={}),li[i][n]=e}function Bs(s,t){return s in li&&t in li[s]?li[s][t]:null}const On=.9996,Dt=.00669438,kn=Dt*Dt,Nn=kn*Dt,Ve=Dt/(1-Dt),Jo=Math.sqrt(1-Dt),hi=(1-Jo)/(1+Jo),Qo=hi*hi,Ys=Qo*hi,Ks=Ys*hi,ta=Ks*hi,ea=1-Dt/4-3*kn/64-5*Nn/256,Xh=3*Dt/8+3*kn/32+45*Nn/1024,Vh=15*kn/256+45*Nn/1024,Bh=35*Nn/3072,Yh=3/2*hi-27/32*Ys+269/512*ta,Kh=21/16*Qo-55/32*Ks,Uh=151/96*Ys-417/128*ta,Zh=1097/512*Ks,Gn=6378137;function Hh(s,t,e){const i=s-5e5,o=(e.north?t:t-1e7)/On/(Gn*ea),a=o+Yh*Math.sin(2*o)+Kh*Math.sin(4*o)+Uh*Math.sin(6*o)+Zh*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-Dt*h,m=Math.sqrt(1-Dt*h),_=Gn/m,p=(1-Dt)/g,y=Ve*c**2,E=y*y,x=i/(_*On),C=x*x,S=C*x,T=S*x,I=T*x,R=I*x,M=a-u/p*(C/2-T/24*(5+3*d+10*y-4*E-9*Ve))+R/720*(61+90*d+298*y+45*f-252*Ve-3*E);let k=(x-S/6*(1+2*d+y)+I/120*(5-2*y+28*d-3*E+8*Ve+24*f))/c;return k=ks(k+we(sa(e.number)),-Math.PI,Math.PI),[zo(k),zo(M)]}const ia=-80,na=84,qh=-180,$h=180;function Jh(s,t,e){s=ks(s,qh,$h),t<ia?t=ia:t>na&&(t=na);const i=we(t),n=Math.sin(i),r=Math.cos(i),o=n/r,a=o*o,l=a*a,h=we(s),c=sa(e.number),u=we(c),d=Gn/Math.sqrt(1-Dt*n**2),f=Ve*r**2,g=r*ks(h-u,-Math.PI,Math.PI),m=g*g,_=m*g,p=_*g,y=p*g,E=y*g,x=Gn*(ea*i-Xh*Math.sin(2*i)+Vh*Math.sin(4*i)-Bh*Math.sin(6*i)),C=On*d*(g+_/6*(1-a+f)+y/120*(5-18*a+l+72*f-58*Ve))+5e5;let S=On*(x+d*o*(m/2+p/24*(5-a+9*f+4*f**2)+E/720*(61-58*a+l+600*f-330*Ve)));return e.north||(S+=1e7),[C,S]}function sa(s){return(s-1)*6-180+3}const Qh=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function ra(s){let t=0;for(const n of Qh){const r=s.match(n);if(r){t=parseInt(r[1]);break}}if(!t)return null;let e=0,i=!1;return t>32700&&t<32761?e=t-32700:t>32600&&t<32661&&(i=!0,e=t-32600),e?{number:e,north:i}:null}function oa(s,t){return function(e,i,n,r){const o=e.length;n=n>1?n:2,r=r??n,i||(n>2?i=e.slice():i=new Array(o));for(let a=0;a<o;a+=r){const l=e[a],h=e[a+1],c=s(l,h,t);i[a]=c[0],i[a+1]=c[1]}return i}}function tc(s){return ra(s)?new bn({code:s,units:"m"}):null}function ec(s){const t=ra(s.getCode());return t?{forward:oa(Jh,t),inverse:oa(Hh,t)}:null}const ic=63710088e-1;function aa(s,t,e){e=e||ic;const i=we(s[1]),n=we(t[1]),r=(n-i)/2,o=we(t[0]-s[0])/2,a=Math.sin(r)*Math.sin(r)+Math.sin(o)*Math.sin(o)*Math.cos(i)*Math.cos(n);return 2*e*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}const nc=[ec],sc=[tc];let Us=!0;function rc(s){Us=!1}function Zs(s,t){if(t!==void 0){for(let e=0,i=s.length;e<i;++e)t[e]=s[e];t=t}else t=s.slice();return t}function Hs(s){jh(s.getCode(),s),zi(s,s,Zs)}function oc(s){s.forEach(Hs)}function ot(s){if(typeof s!="string")return s;const t=zh(s);if(t)return t;for(const e of sc){const i=e(s);if(i)return i}return null}function la(s,t,e,i){s=ot(s);let n;const r=s.getPointResolutionFunc();if(r)n=r(t,e);else{const o=s.getUnits();if(o=="degrees"&&!i||i=="degrees")n=t;else{const a=Js(s,ot("EPSG:4326"));if(!a&&o!=="degrees")n=t*s.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=aa(h.slice(0,2),h.slice(2,4)),u=aa(h.slice(4,6),h.slice(6,8));n=(c+u)/2}const l=s.getMetersPerUnit();l!==void 0&&(n/=l)}}return n}function ha(s){oc(s),s.forEach(function(t){s.forEach(function(e){t!==e&&zi(t,e,Zs)})})}function ac(s,t,e,i){s.forEach(function(n){t.forEach(function(r){zi(n,r,e),zi(r,n,i)})})}function qs(s,t){return s?typeof s=="string"?ot(s):s:ot(t)}function lc(s){return(function(t,e,i,n){const r=t.length;i=i!==void 0?i:2,n=n??i,e=e!==void 0?e:new Array(r);for(let o=0;o<r;o+=n){const a=s(t.slice(o,o+i)),l=a.length;for(let h=0,c=n;h<c;++h)e[o+h]=h>=l?t[o+h]:a[h]}return e})}function $s(s,t){if(s===t)return!0;const e=s.getUnits()===t.getUnits();return(s.getCode()===t.getCode()||Js(s,t)===Zs)&&e}function Js(s,t){const e=s.getCode(),i=t.getCode();let n=Bs(e,i);if(n)return n;let r=null,o=null;for(const l of nc)r||(r=l(s)),o||(o=l(t));if(!r&&!o)return null;const a="EPSG:4326";if(o)if(r)n=Qs(r.inverse,o.forward);else{const l=Bs(e,a);l&&(n=Qs(l,o.forward))}else{const l=Bs(a,i);l&&(n=Qs(r.inverse,l))}return n&&(Hs(s),Hs(t),zi(s,t,n)),n}function Qs(s,t){return function(e,i,n,r){return i=s(e,i,n,r),t(i,i,n,r)}}function ji(s,t){const e=ot(s),i=ot(t);return Js(e,i)}function ca(s,t,e){const i=ji(t,e);if(!i){const n=ot(t).getCode(),r=ot(e).getCode();throw new Error(`No transform available between ${n} and ${r}`)}return i(s,void 0,s.length)}function Se(s,t){return s}function H(s,t){return Us&&!Et(s,[0,0])&&s[0]>=-180&&s[0]<=180&&s[1]>=-90&&s[1]<=90&&(Us=!1,Uo("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),s}function Wn(s,t){return s}function Ie(s,t){return s}function hc(){ha(Ho),ha($o),ac($o,Ho,kh,Nh)}hc();const Ot={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"},P={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4},tr=[NaN,NaN,NaN,0];let er;function cc(){return er||(er=ut(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),er}const uc=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,dc=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,fc=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,gc=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function zn(s,t){return s.endsWith("%")?Number(s.substring(0,s.length-1))/t:Number(s)}function Xi(s){throw new Error('failed to parse "'+s+'" as color')}function ua(s){if(s.toLowerCase().startsWith("rgb")){const r=s.match(dc)||s.match(uc)||s.match(fc);if(r){const o=r[4],a=100/255;return[rt(zn(r[1],a)+.5|0,0,255),rt(zn(r[2],a)+.5|0,0,255),rt(zn(r[3],a)+.5|0,0,255),o!==void 0?rt(zn(o,100),0,1):1]}Xi(s)}if(s.startsWith("#")){if(gc.test(s)){const r=s.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}Xi(s)}const t=cc();t.fillStyle="#abcdef";let e=t.fillStyle;t.fillStyle=s,t.fillStyle===e&&(t.fillStyle="#fedcba",e=t.fillStyle,t.fillStyle=s,t.fillStyle===e&&Xi(s));const i=t.fillStyle;if(i.startsWith("#")||i.startsWith("rgba"))return ua(i);t.clearRect(0,0,1,1),t.fillRect(0,0,1,1);const n=Array.from(t.getImageData(0,0,1,1).data);return n[3]=Mn(n[3]/255,3),n}function _c(s){return typeof s=="string"?s:lr(s)}const mc=1024,Vi={};let ir=0;function pc(s){if(s.length===4)return s;const t=s.slice();return t[3]=1,t}function nr(s){return s>.0031308?Math.pow(s,1/2.4)*269.025-14.025:s*3294.6}function sr(s){return s>.2068965?Math.pow(s,3):(s-4/29)*(108/841)}function rr(s){return s>10.314724?Math.pow((s+14.025)/269.025,2.4):s/3294.6}function or(s){return s>.0088564?Math.pow(s,1/3):s/(108/841)+4/29}function da(s){const t=rr(s[0]),e=rr(s[1]),i=rr(s[2]),n=or(t*.222488403+e*.716873169+i*.06060791),r=500*(or(t*.452247074+e*.399439023+i*.148375274)-n),o=200*(n-or(t*.016863605+e*.117638439+i*.865350722)),a=Math.atan2(o,r)*(180/Math.PI);return[116*n-16,Math.sqrt(r*r+o*o),a<0?a+360:a,s[3]]}function yc(s){const t=(s[0]+16)/116,e=s[1],i=s[2]*Math.PI/180,n=sr(t),r=sr(t+e/500*Math.cos(i)),o=sr(t-e/200*Math.sin(i)),a=nr(r*3.021973625-n*1.617392459-o*.404875592),l=nr(r*-.943766287+n*1.916279586+o*.027607165),h=nr(r*.069407491-n*.22898585+o*1.159737864);return[rt(a+.5|0,0,255),rt(l+.5|0,0,255),rt(h+.5|0,0,255),s[3]]}function ar(s){if(s==="none")return tr;if(Vi.hasOwnProperty(s))return Vi[s];if(ir>=mc){let e=0;for(const i in Vi)(e++&3)===0&&(delete Vi[i],--ir)}const t=ua(s);t.length!==4&&Xi(s);for(const e of t)isNaN(e)&&Xi(s);return Vi[s]=t,++ir,t}function ci(s){return Array.isArray(s)?s:ar(s)}function lr(s){let t=s[0];t!=(t|0)&&(t=t+.5|0);let e=s[1];e!=(e|0)&&(e=e+.5|0);let i=s[2];i!=(i|0)&&(i=i+.5|0);const n=s[3]===void 0?1:Math.round(s[3]*1e3)/1e3;return"rgba("+t+","+e+","+i+","+n+")"}const D={CHANGE:"change",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",KEYDOWN:"keydown",KEYPRESS:"keypress",TOUCHMOVE:"touchmove",WHEEL:"wheel"};class hr{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function zt(){return!0}function Be(){return!1}function Bi(){}function fa(s){let t,e,i;return function(){const n=Array.prototype.slice.call(arguments);return(!e||this!==i||!ne(n,e))&&(i=this,e=n,t=s.apply(this,arguments)),t}}function ga(s){function t(){let e;try{e=s()}catch(i){return Promise.reject(i)}return e instanceof Promise?e:Promise.resolve(e)}return t()}class It{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}class jn extends hr{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),n=i[t]||(i[t]=[]);n.includes(e)||n.push(e)}dispatchEvent(t){const e=typeof t=="string",i=e?t:t.type,n=this.listeners_&&this.listeners_[i];if(!n)return;const r=e?new It(t):t;r.target||(r.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});i in o||(o[i]=0,a[i]=0),++o[i];let l;for(let h=0,c=n.length;h<c;++h)if("handleEvent"in n[h]?l=n[h].handleEvent(r):l=n[h].call(this,r),l===!1||r.propagationStopped){l=!1;break}if(--o[i]===0){let h=a[i];for(delete a[i];h--;)this.removeEventListener(i,Bi);delete o[i]}return l}disposeInternal(){this.listeners_&&ai(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 i=this.listeners_[t];if(!i)return;const n=i.indexOf(e);n!==-1&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=Bi,++this.pendingRemovals_[t]):(i.splice(n,1),i.length===0&&delete this.listeners_[t]))}}function W(s,t,e,i,n){if(n){const o=e;e=function(a){return s.removeEventListener(t,e),o.call(i??this,a)}}else i&&i!==s&&(e=e.bind(i));const r={target:s,type:t,listener:e};return s.addEventListener(t,e),r}function _a(s,t,e,i){return W(s,t,e,i,!0)}function J(s){s&&s.target&&(s.target.removeEventListener(s.type,s.listener),ai(s))}class cr extends jn{constructor(t,e,i,n){super(),this.extent=t,this.pixelRatio_=i,this.resolution=e,this.state=typeof n=="function"?P.IDLE:n,this.image_=null,this.loader=typeof n=="function"?n:null}changed(){this.dispatchEvent(D.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==P.IDLE&&this.loader){this.state=P.LOADING,this.changed();const t=this.getResolution(),e=Array.isArray(t)?t[0]:t;ga(()=>this.loader(this.getExtent(),e,this.getPixelRatio())).then(i=>{"image"in i&&(this.image_=i.image),"extent"in i&&(this.extent=i.extent),"resolution"in i&&(this.resolution=i.resolution),"pixelRatio"in i&&(this.pixelRatio_=i.pixelRatio),(i instanceof HTMLImageElement||Vo&&i instanceof ImageBitmap||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement)&&(this.image_=i),this.state=P.LOADED}).catch(i=>{this.state=P.ERROR,console.error(i)}).finally(()=>this.changed())}}setImage(t){this.image_=t}setResolution(t){this.resolution=t}}function xc(s,t){return new Promise((e,i)=>{function n(){o(),e(s)}function r(){o(),i(new Error("Image load error"))}function o(){s.removeEventListener("load",n),s.removeEventListener("error",r)}s.addEventListener("load",n),s.addEventListener("error",r)})}function ma(s,t){return t&&(s.src=t),s.src&&Xo?new Promise((e,i)=>s.decode().then(()=>e(s)).catch(n=>s.complete&&s.width?e(s):i(n))):xc(s)}function pa(s,t){return t&&(s.src=t),s.src&&Xo&&Vo?s.decode().then(()=>createImageBitmap(s)).catch(e=>{if(s.complete&&s.width)return s;throw e}):ma(s)}class Ec{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const i=this.cache_[e];(t++&3)===0&&!i.hasListener()&&(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e,i){const n=ur(t,e,i);return n in this.cache_?this.cache_[n]:null}getPattern(t,e,i){const n=ur(t,e,i);return n in this.patternCache_?this.patternCache_[n]:null}set(t,e,i,n,r){const o=ur(t,e,i),a=o in this.cache_;this.cache_[o]=n,r&&(n.getImageState()===P.IDLE&&n.load(),n.getImageState()===P.LOADING?n.ready().then(()=>{this.patternCache_[o]=Fn().createPattern(n.getImage(1),"repeat")}):this.patternCache_[o]=Fn().createPattern(n.getImage(1),"repeat")),a||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function ur(s,t,e){const i=e?ci(e):"null";return t+":"+s+":"+i}const kt=new Ec;let Yi=null;class ya extends jn{constructor(t,e,i,n,r){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i,this.canvas_={},this.color_=r,this.imageState_=n===void 0?P.IDLE:n,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_===P.LOADED){Yi||(Yi=ut(1,1,void 0,{willReadFrequently:!0})),Yi.drawImage(this.image_,0,0);try{Yi.getImageData(0,0,1,1),this.tainted_=!1}catch{Yi=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(D.CHANGE)}handleImageError_(){this.imageState_=P.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=P.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],i=ut(t,e);i.fillRect(0,0,t,e),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===P.IDLE){this.image_||this.initializeImage_(),this.imageState_=P.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&ma(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_!==P.LOADED)return;const e=this.image_,i=ut(Math.ceil(e.width*t),Math.ceil(e.height*t)),n=i.canvas;i.scale(t,t),i.drawImage(e,0,0),i.globalCompositeOperation="multiply",i.fillStyle=_c(this.color_),i.fillRect(0,0,n.width/t,n.height/t),i.globalCompositeOperation="destination-in",i.drawImage(e,0,0),this.canvas_[t]=n}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(this.imageState_===P.LOADED||this.imageState_===P.ERROR)t();else{const e=()=>{(this.imageState_===P.LOADED||this.imageState_===P.ERROR)&&(this.removeEventListener(D.CHANGE,e),t())};this.addEventListener(D.CHANGE,e)}})),this.ready_}}function dr(s,t,e,i,n,r){let o=t===void 0?void 0:kt.get(t,e,n);return o||(o=new ya(s,s&&"src"in s?s.src||void 0:t,e,i,n),kt.set(t,e,n,o,r)),r&&o&&!kt.getPattern(t,e,n)&&kt.set(t,e,n,o,r),o}function qt(s){return s?Array.isArray(s)?lr(s):typeof s=="object"&&"src"in s?Cc(s):s:null}function Cc(s){if(!s.offset||!s.size)return kt.getPattern(s.src,"anonymous",s.color);const t=s.src+":"+s.offset,e=kt.getPattern(t,void 0,s.color);if(e)return e;const i=kt.get(s.src,"anonymous",null);if(i.getImageState()!==P.LOADED)return null;const n=ut(s.size[0],s.size[1]);return n.drawImage(i.getImage(1),s.offset[0],s.offset[1],s.size[0],s.size[1],0,0,s.size[0],s.size[1]),dr(n.canvas,t,void 0,P.LOADED,s.color,!0),kt.getPattern(t,void 0,s.color)}function Re(s,t,e,i,n){n=n!==void 0?n:[];let r=0;for(let o=t;o<e;o+=i)n[r++]=s.slice(o,o+i);return n.length=r,n}function Ki(s,t,e,i,n){n=n!==void 0?n:[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];n[r++]=Re(s,t,l,i,n[r]),t=l}return n.length=r,n}function fr(s,t,e,i,n){n=n!==void 0?n:[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];n[r++]=l.length===1&&l[0]===t?[]:Ki(s,t,l,i,n[r]),t=l[l.length-1]}return n.length=r,n}class xa{drawCustom(t,e,i,n,r){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,i){}drawFeature(t,e,i){}drawGeometryCollection(t,e,i){}drawLineString(t,e,i){}drawMultiLineString(t,e,i){}drawMultiPoint(t,e,i){}drawMultiPolygon(t,e,i){}drawPoint(t,e,i){}drawPolygon(t,e,i){}drawText(t,e,i){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}}const ui={PROPERTYCHANGE:"propertychange"};class Ui extends jn{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(D.CHANGE)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=W(this,t[r],e);return n}return W(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const n=t.length;i=new Array(n);for(let r=0;r<n;++r)i[r]=_a(this,t[r],e)}else i=_a(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)wc(i);else if(Array.isArray(t))for(let n=0,r=t.length;n<r;++n)this.removeEventListener(t[n],e);else this.removeEventListener(t,e)}}Ui.prototype.on,Ui.prototype.once,Ui.prototype.un;function wc(s){if(Array.isArray(s))for(let t=0,e=s.length;t<e;++t)J(s[t]);else J(s)}function O(){throw new Error("Unimplemented abstract method.")}let Sc=0;function V(s){return s.ol_uid||(s.ol_uid=String(++Sc))}class Ea extends It{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}class jt extends Ui{constructor(t){super(),this.on,this.once,this.un,V(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 i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new Ea(i,t,e)),i=ui.PROPERTYCHANGE,this.hasListener(i)&&this.dispatchEvent(new Ea(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const n=this.values_||(this.values_={});if(i)n[t]=e;else{const r=n[t];n[t]=e,r!==e&&this.notify(t,r)}}setProperties(t,e){for(const i in t)this.set(i,t[i],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const i=this.values_[t];delete this.values_[t],Xe(this.values_)&&(this.values_=null),e||this.notify(t,i)}}}const Xn="ol-hidden",Ic="ol-selectable",Vn="ol-unselectable",gr="ol-control",Ca="ol-collapsed",Rc=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"),wa=["style","variant","weight","size","lineHeight","family"],_r={normal:400,bold:700},mr=function(s){const t=s.match(Rc);if(!t)return null;const e={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let i=0,n=wa.length;i<n;++i){const r=t[i+1];r!==void 0&&(e[wa[i]]=typeof r=="string"?r.trim():r)}return isNaN(Number(e.weight))&&e.weight in _r&&(e.weight=_r[e.weight]),e.families=e.family.split(/,\s?/).map(i=>i.trim().replace(/^['"]|['"]$/g,"")),e},Sa="10px sans-serif",Rt="#000",di="round",ae=[],le=0,fi="round",Zi=10,Hi="#000",qi="center",Bn="middle",Ye=[0,0,0,0],$i=1,gi=new jt;let Ji=null,Ia;const pr={},vc=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function Tc(s,t,e){return`${s} ${t} 16px "${e}"`}const Pc=(function(){let t,e;async function i(r){await e.ready;const o=await e.load(r);if(o.length===0)return!1;const a=mr(r),l=a.families[0].toLowerCase(),h=a.weight;return o.some(c=>{const u=c.family.replace(/^['"]|['"]$/g,"").toLowerCase(),d=_r[c.weight]||c.weight;return u===l&&c.style===a.style&&d==h})}async function n(){await e.ready;let r=!0;const o=gi.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 i(h)?(ai(pr),gi.set(h,100)):(c+=10,gi.set(h,c,!0),c<100&&(r=!1)))}t=void 0,r||(t=setTimeout(n,100))}return async function(r){e||(e=zs?self.fonts:document.fonts);const o=mr(r);if(!o)return;const a=o.families;let l=!1;for(const h of a){if(vc.has(h))continue;const c=Tc(o.style,o.weight,h);gi.get(c)===void 0&&(gi.set(c,0,!0),l=!0)}l&&(clearTimeout(t),t=setTimeout(n,100))}})(),Mc=(function(){let s;return function(t){let e=pr[t];if(e==null){if(zs){const i=mr(t),n=Ra(t,"Žg");e=(isNaN(Number(i.lineHeight))?1.2:Number(i.lineHeight))*(n.actualBoundingBoxAscent+n.actualBoundingBoxDescent)}else s||(s=document.createElement("div"),s.innerHTML="M",s.style.minHeight="0",s.style.maxHeight="none",s.style.height="auto",s.style.padding="0",s.style.border="none",s.style.position="absolute",s.style.display="block",s.style.left="-99999px"),s.style.font=t,document.body.appendChild(s),e=s.offsetHeight,document.body.removeChild(s);pr[t]=e}return e}})();function Ra(s,t){return Ji||(Ji=ut(1,1)),s!=Ia&&(Ji.font=s,Ia=Ji.font),Ji.measureText(t)}function va(s,t){return Ra(s,t).width}function Ta(s,t,e){if(t in e)return e[t];const i=t.split(`
|
|
2
2
|
`).reduce((n,r)=>Math.max(n,va(s,r)),0);return e[t]=i,i}function Lc(s,t){const e=[],i=[],n=[];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
3
|
`||h===c){r=Math.max(r,o),n.push(o),o=0,a+=l,l=0;continue}const d=t[h+1]||s.font,f=va(d,u);e.push(f),o+=f;const g=Mc(d);i.push(g),l=Math.max(l,g)}return{width:r,height:a,widths:e,heights:i,lineWidths:n}}function Ac(s,t,e,i,n,r,o,a,l,h,c){s.save(),e!==1&&(s.globalAlpha===void 0?s.globalAlpha=u=>u.globalAlpha*=e:s.globalAlpha*=e),t&&s.transform.apply(s,t),i.contextInstructions?(s.translate(l,h),s.scale(c[0],c[1]),Fc(i,s)):c[0]<0||c[1]<0?(s.translate(l,h),s.scale(c[0],c[1]),s.drawImage(i,n,r,o,a,0,0,o,a)):s.drawImage(i,n,r,o,a,l,h,o*c[0],a*c[1]),s.restore()}function Fc(s,t){const e=s.contextInstructions;for(let i=0,n=e.length;i<n;i+=2)Array.isArray(e[i+1])?t[e[i]].apply(t,e[i+1]):t[e[i]]=e[i+1]}const L={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},Yn=[L.FILL],ve=[L.STROKE],Ke=[L.BEGIN_PATH],Pa=[L.CLOSE_PATH];class Qi extends xa{constructor(t,e,i,n){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=n,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){const e=this.pixelRatio;return e==1?t:t.map(function(i){return i*e})}appendFlatPointCoordinates(t,e){const i=this.getBufferedMaxExtent(),n=this.tmpCoordinate_,r=this.coordinates;let o=r.length;for(let a=0,l=t.length;a<l;a+=e)n[0]=t[a],n[1]=t[a+1],Di(i,n)&&(r[o++]=n[0],r[o++]=n[1]);return o}appendFlatLineCoordinates(t,e,i,n,r,o){const a=this.coordinates;let l=a.length;const h=this.getBufferedMaxExtent();o&&(e+=n);let c=t[e],u=t[e+1];const d=this.tmpCoordinate_;let f=!0,g,m,_;for(g=e+n;g<i;g+=n)d[0]=t[g],d[1]=t[g+1],_=Ls(h,d),_!==m?(f&&(a[l++]=c,a[l++]=u,f=!1),a[l++]=d[0],a[l++]=d[1]):_===lt.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+n)&&(a[l++]=c,a[l++]=u),l}drawCustomCoordinates_(t,e,i,n,r){for(let o=0,a=i.length;o<a;++o){const l=i[o],h=this.appendFlatLineCoordinates(t,e,l,n,!1,!1);r.push(h),e=l}return e}drawCustom(t,e,i,n,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 m=0,_=g.length;m<_;++m){const p=[];f=this.drawCustomCoordinates_(h,f,g[m],a,p),d.push(p)}this.instructions.push([L.CUSTOM,l,d,t,i,fr,r]),this.hitDetectionInstructions.push([L.CUSTOM,l,d,t,n||i,fr,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([L.CUSTOM,l,u,t,i,Ki,r]),this.hitDetectionInstructions.push([L.CUSTOM,l,u,t,n||i,Ki,r]);break;case"LineString":case"Circle":h=t.getFlatCoordinates(),c=this.appendFlatLineCoordinates(h,0,h.length,a,!1,!1),this.instructions.push([L.CUSTOM,l,c,t,i,Re,r]),this.hitDetectionInstructions.push([L.CUSTOM,l,c,t,n||i,Re,r]);break;case"MultiPoint":h=t.getFlatCoordinates(),c=this.appendFlatPointCoordinates(h,a),c>l&&(this.instructions.push([L.CUSTOM,l,c,t,i,Re,r]),this.hitDetectionInstructions.push([L.CUSTOM,l,c,t,n||i,Re,r]));break;case"Point":h=t.getFlatCoordinates(),this.coordinates.push(h[0],h[1]),c=this.coordinates.length,this.instructions.push([L.CUSTOM,l,c,t,i,void 0,r]),this.hitDetectionInstructions.push([L.CUSTOM,l,c,t,n||i,void 0,r]);break}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[L.BEGIN_GEOMETRY,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[L.BEGIN_GEOMETRY,e,0,t,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;t.reverse();let e;const i=t.length;let n,r,o=-1;for(e=0;e<i;++e)n=t[e],r=n[0],r==L.END_GEOMETRY?o=e:r==L.BEGIN_GEOMETRY&&(n[2]=e,_h(this.hitDetectionInstructions,o,e),o=-1)}fillStyleToState(t,e={}){if(t){const i=t.getColor();e.fillPatternScale=i&&typeof i=="object"&&"src"in i?this.pixelRatio:1,e.fillStyle=qt(i||Rt)}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){const i=t.getColor();e.strokeStyle=qt(i||Hi);const n=t.getLineCap();e.lineCap=n!==void 0?n:di;const r=t.getLineDash();e.lineDash=r?r.slice():ae;const o=t.getLineDashOffset();e.lineDashOffset=o||le;const a=t.getLineJoin();e.lineJoin=a!==void 0?a:fi;const l=t.getWidth();e.lineWidth=l!==void 0?l:$i;const h=t.getMiterLimit();e.miterLimit=h!==void 0?h:Zi,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 i=this.state;this.fillStyleToState(t,i),this.strokeStyleToState(e,i)}createFill(t){const e=t.fillStyle,i=[L.SET_FILL_STYLE,e];return typeof e!="string"&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[L.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 i=t.fillStyle;(typeof i!="string"||t.currentFillStyle!=i)&&(this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,n=t.lineCap,r=t.lineDash,o=t.lineDashOffset,a=t.lineJoin,l=t.lineWidth,h=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=n||r!=t.currentLineDash&&!ne(t.currentLineDash,r)||t.currentLineDashOffset!=o||t.currentLineJoin!=a||t.currentLineWidth!=l||t.currentMiterLimit!=h)&&(e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,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=[L.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Oo(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;bi(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class bc extends Qi{constructor(t,e,i,n){super(t,e,i,n),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e,i){if(!this.image_||this.maxExtent&&!Di(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),r=t.getStride(),o=this.coordinates.length,a=this.appendFlatPointCoordinates(n,r);this.instructions.push([L.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([L.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,i){if(!this.image_)return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),r=[];for(let l=0,h=n.length;l<h;l+=t.getStride())(!this.maxExtent||Di(this.maxExtent,n.slice(l,l+2)))&&r.push(n[l],n[l+1]);const o=this.coordinates.length,a=this.appendFlatPointCoordinates(r,2);this.instructions.push([L.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([L.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 i=t.getAnchor(),n=t.getSize(),r=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=n[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_=n[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}class Dc extends Qi{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinates_(t,e,i,n){const r=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,i,n,!1,!1),a=[L.MOVE_TO_LINE_TO,r,o];return this.instructions.push(a),this.hitDetectionInstructions.push(a),i}drawLineString(t,e,i){const n=this.state,r=n.strokeStyle,o=n.lineWidth;if(r===void 0||o===void 0)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([L.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,ae,le],Ke);const a=t.getFlatCoordinates(),l=t.getStride();this.drawFlatCoordinates_(a,0,a.length,l),this.hitDetectionInstructions.push(ve),this.endGeometry(e)}drawMultiLineString(t,e,i){const n=this.state,r=n.strokeStyle,o=n.lineWidth;if(r===void 0||o===void 0)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([L.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,ae,le],Ke);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(ve),this.endGeometry(e)}finish(){const t=this.state;return t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&this.instructions.push(ve),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(ve),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(Ke)}}function Kn(s,t,e,i,n,r,o){const a=(e-t)/i;if(a<3){for(;t<e;t+=i)r[o++]=s[t],r[o++]=s[t+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const h=[t,e-i];let c=0;for(;h.length>0;){const u=h.pop(),d=h.pop();let f=0;const g=s[d],m=s[d+1],_=s[u],p=s[u+1];for(let y=d+i;y<u;y+=i){const E=s[y],x=s[y+1],C=wh(E,x,g,m,_,p);C>f&&(c=y,f=C)}f>n&&(l[(c-t)/i]=1,d+i<c&&h.push(d,c),c+i<u&&h.push(c,u))}for(let u=0;u<a;++u)l[u]&&(r[o++]=s[t+u*i],r[o++]=s[t+u*i+1]);return o}function Ma(s,t,e,i,n,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l];o=Kn(s,t,c,i,n,r,o),a.push(o),t=c}return o}function Ue(s,t){return t*Math.round(s/t)}function Oc(s,t,e,i,n,r,o){if(t==e)return o;let a=Ue(s[t],n),l=Ue(s[t+1],n);t+=i,r[o++]=a,r[o++]=l;let h,c;do if(h=Ue(s[t],n),c=Ue(s[t+1],n),t+=i,t==e)return r[o++]=h,r[o++]=c,o;while(h==a&&c==l);for(;t<e;){const u=Ue(s[t],n),d=Ue(s[t+1],n);if(t+=i,u==h&&d==c)continue;const f=h-a,g=c-l,m=u-a,_=d-l;if(f*_==g*m&&(f<0&&m<f||f==m||f>0&&m>f)&&(g<0&&_<g||g==_||g>0&&_>g)){h=u,c=d;continue}r[o++]=h,r[o++]=c,a=h,l=c,h=u,c=d}return r[o++]=h,r[o++]=c,o}function yr(s,t,e,i,n,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l];o=Oc(s,t,c,i,n,r,o),a.push(o),t=c}return o}function kc(s,t,e,i,n,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l],u=[];o=yr(s,t,c,i,n,r,o,u),a.push(u),t=c[c.length-1]}return o}class La extends Qi{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinatess_(t,e,i,n){const r=this.state,o=r.fillStyle!==void 0,a=r.strokeStyle!==void 0,l=i.length;this.instructions.push(Ke),this.hitDetectionInstructions.push(Ke);for(let h=0;h<l;++h){const c=i[h],u=this.coordinates.length,d=this.appendFlatLineCoordinates(t,e,c,n,!0,!a),f=[L.MOVE_TO_LINE_TO,u,d];this.instructions.push(f),this.hitDetectionInstructions.push(f),a&&(this.instructions.push(Pa),this.hitDetectionInstructions.push(Pa)),e=c}return o&&(this.instructions.push(Yn),this.hitDetectionInstructions.push(Yn)),a&&(this.instructions.push(ve),this.hitDetectionInstructions.push(ve)),e}drawCircle(t,e,i){const n=this.state,r=n.fillStyle,o=n.strokeStyle;if(r===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),n.fillStyle!==void 0&&this.hitDetectionInstructions.push([L.SET_FILL_STYLE,Rt]),n.strokeStyle!==void 0&&this.hitDetectionInstructions.push([L.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,ae,le]);const a=t.getFlatCoordinates(),l=t.getStride(),h=this.coordinates.length;this.appendFlatLineCoordinates(a,0,a.length,l,!1,!1);const c=[L.CIRCLE,h];this.instructions.push(Ke,c),this.hitDetectionInstructions.push(Ke,c),n.fillStyle!==void 0&&(this.instructions.push(Yn),this.hitDetectionInstructions.push(Yn)),n.strokeStyle!==void 0&&(this.instructions.push(ve),this.hitDetectionInstructions.push(ve)),this.endGeometry(e)}drawPolygon(t,e,i){const n=this.state,r=n.fillStyle,o=n.strokeStyle;if(r===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),n.fillStyle!==void 0&&this.hitDetectionInstructions.push([L.SET_FILL_STYLE,Rt]),n.strokeStyle!==void 0&&this.hitDetectionInstructions.push([L.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,ae,le]);const a=t.getEnds(),l=t.getOrientedFlatCoordinates(),h=t.getStride();this.drawFlatCoordinatess_(l,0,a,h),this.endGeometry(e)}drawMultiPolygon(t,e,i){const n=this.state,r=n.fillStyle,o=n.strokeStyle;if(r===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),n.fillStyle!==void 0&&this.hitDetectionInstructions.push([L.SET_FILL_STYLE,Rt]),n.strokeStyle!==void 0&&this.hitDetectionInstructions.push([L.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,ae,le]);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 i=0,n=e.length;i<n;++i)e[i]=Ue(e[i],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;this.updateFillStyle(t,this.createFill),this.updateStrokeStyle(t,this.applyStroke)}}function Nc(s,t,e,i,n){const r=[];let o=e,a=0,l=t.slice(e,2);for(;a<s&&o+n<i;){const[h,c]=l.slice(-2),u=t[o+n],d=t[o+n+1],f=Math.sqrt((u-h)*(u-h)+(d-c)*(d-c));if(a+=f,a>=s){const g=(s-a+f)/f,m=Mt(h,u,g),_=Mt(c,d,g);l.push(m,_),r.push(l),l=[m,_],a==s&&(o+=n),a=0}else if(a<s)l.push(t[o+n],t[o+n+1]),o+=n;else{const g=f-a,m=Mt(h,u,g/f),_=Mt(c,d,g/f);l.push(m,_),r.push(l),l=[m,_],a=0,o+=n}}return a>0&&r.push(l),r}function Gc(s,t,e,i,n){let r=e,o=e,a=0,l=0,h=e,c,u,d,f,g,m,_,p,y,E;for(u=e;u<i;u+=n){const x=t[u],C=t[u+1];g!==void 0&&(y=x-g,E=C-m,f=Math.sqrt(y*y+E*E),_!==void 0&&(l+=d,c=Math.acos((_*y+p*E)/(d*f)),c>s&&(l>a&&(a=l,r=h,o=u),l=0,h=u-n)),d=f,_=y,p=E),g=x,m=C}return l+=f,l>a?[h,u]:[r,o]}const Un={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class Wc extends Qi{constructor(t,e,i,n){super(t,e,i,n),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[Rt]={fillStyle:Rt},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,i){const n=this.textFillState_,r=this.textStrokeState_,o=this.textState_;if(this.text_===""||!o||!n&&!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(!dt(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 _=t.getEndss();d=[];for(let p=0,y=_.length;p<y;++p)d.push(_[p][0])}this.beginGeometry(t,e,i);const f=o.repeat,g=f?void 0:o.textAlign;let m=0;for(let _=0,p=d.length;_<p;++_){let y;f?y=Nc(f*this.resolution,c,m,d[_],u):y=[c.slice(m,d[_])];for(let E=0,x=y.length;E<x;++E){const C=y[E];let S=0,T=C.length;if(g==null){const R=Gc(o.maxAngle,C,0,C.length,2);S=R[0],T=R[1]}for(let R=S;R<T;R+=u)a.push(C[R],C[R+1]);const I=a.length;m=d[_],this.drawChars_(l,I),l=I}}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 x=t.getFlatInteriorPoints();c=[];for(let C=0,S=x.length;C<S;C+=3)o.overflow||d.push(x[C+2]/this.resolution),c.push(x[C],x[C+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 x=l/2;d=d.filter((C,S)=>{const T=a[(x+S)*2]===c[S*u]&&a[(x+S)*2+1]===c[S*u+1];return T||--x,T})}this.saveTextStates_();const g=o.backgroundFill?this.createFill(this.fillStyleToState(o.backgroundFill)):null,m=o.backgroundStroke?this.createStroke(this.strokeStyleToState(o.backgroundStroke)):null;this.beginGeometry(t,e,i);let _=o.padding;if(_!=Ye&&(o.scale[0]<0||o.scale[1]<0)){let x=o.padding[0],C=o.padding[1],S=o.padding[2],T=o.padding[3];o.scale[0]<0&&(C=-C,T=-T),o.scale[1]<0&&(x=-x,S=-S),_=[x,C,S,T]}const p=this.pixelRatio;this.instructions.push([L.DRAW_IMAGE,l,f,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,_==Ye?Ye:_.map(function(x){return x*p}),g,m,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]);const y=1/p,E=g?g.slice(0):null;E&&(E[1]=Rt),this.hitDetectionInstructions.push([L.DRAW_IMAGE,l,f,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[y,y],NaN,this.declutterMode_,this.declutterImageWithText_,_,E,m,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?Rt:this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]),this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,n=this.strokeKey_;t&&(n in this.strokeStates||(this.strokeStates[n]={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||qi,justify:e.justify,textBaseline:e.textBaseline||Bn,scale:e.scale});const o=this.fillKey_;i&&(o in this.fillStates||(this.fillStates[o]={fillStyle:i.fillStyle}))}drawChars_(t,e){const i=this.textStrokeState_,n=this.textState_,r=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();const l=this.pixelRatio,h=Un[n.textBaseline],c=this.textOffsetY_*l,u=this.text_,d=i?i.lineWidth*Math.abs(n.scale[0])/2:0;this.instructions.push([L.DRAW_CHARS,t,e,h,n.overflow,a,n.maxAngle,l,c,r,d*l,u,o,1,this.declutterMode_,this.textKeepUpright_]),this.hitDetectionInstructions.push([L.DRAW_CHARS,t,e,h,n.overflow,a&&Rt,n.maxAngle,l,c,r,d*l,u,o,1/l,this.declutterMode_,this.textKeepUpright_])}setTextStyle(t,e){let i,n,r;if(!t)this.text_="";else{const o=t.getFill();o?(n=this.textFillState_,n||(n={},this.textFillState_=n),n.fillStyle=qt(o.getColor()||Rt)):(n=null,this.textFillState_=n);const a=t.getStroke();if(!a)r=null,this.textStrokeState_=r;else{r=this.textStrokeState_,r||(r={},this.textStrokeState_=r);const m=a.getLineDash(),_=a.getLineDashOffset(),p=a.getWidth(),y=a.getMiterLimit();r.lineCap=a.getLineCap()||di,r.lineDash=m?m.slice():ae,r.lineDashOffset=_===void 0?le:_,r.lineJoin=a.getLineJoin()||fi,r.lineWidth=p===void 0?$i:p,r.miterLimit=y===void 0?Zi:y,r.strokeStyle=qt(a.getColor()||Hi)}i=this.textState_;const l=t.getFont()||Sa;Pc(l);const h=t.getScaleArray();i.overflow=t.getOverflow(),i.font=l,i.maxAngle=t.getMaxAngle(),i.placement=t.getPlacement(),i.textAlign=t.getTextAlign(),i.repeat=t.getRepeat(),i.justify=t.getJustify(),i.textBaseline=t.getTextBaseline()||Bn,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||Ye,i.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:V(r.strokeStyle))+r.lineCap+r.lineDashOffset+"|"+r.lineWidth+r.lineJoin+r.miterLimit+"["+r.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.repeat||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=n&&n.fillStyle?typeof n.fillStyle=="string"?n.fillStyle:"|"+V(n.fillStyle):""}this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}const zc={Circle:La,Default:Qi,Image:bc,LineString:Dc,Polygon:La,Text:Wc};class jc{constructor(t,e,i,n){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=n,this.resolution_=i,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const i=this.buildersByZIndex_[e];for(const n in i){const r=i[n].finish();t[e][n]=r}}return t}getBuilder(t,e){const i=t!==void 0?t.toString():"0";let n=this.buildersByZIndex_[i];n===void 0&&(n={},this.buildersByZIndex_[i]=n);let r=n[e];if(r===void 0){const o=zc[e];r=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),n[e]=r}return r}}function Te(s,t,e,i,n,r,o){r=r||[],o=o||2;let a=0;for(let l=t;l<e;l+=i){const h=s[l],c=s[l+1];r[a++]=n[0]*h+n[2]*c+n[4],r[a++]=n[1]*h+n[3]*c+n[5];for(let u=2;u<o;u++)r[a++]=s[l+u]}return r&&r.length!=a&&(r.length=a),r}function xr(s,t,e,i,n,r,o){o=o||[];const a=Math.cos(n),l=Math.sin(n),h=r[0],c=r[1];let u=0;for(let d=t;d<e;d+=i){const f=s[d]-h,g=s[d+1]-c;o[u++]=h+f*a-g*l,o[u++]=c+f*l+g*a;for(let m=d+2;m<d+i;++m)o[u++]=s[m]}return o&&o.length!=u&&(o.length=u),o}function Xc(s,t,e,i,n,r,o,a){a=a||[];const l=o[0],h=o[1];let c=0;for(let u=t;u<e;u+=i){const d=s[u]-l,f=s[u+1]-h;a[c++]=l+n*d,a[c++]=h+r*f;for(let g=u+2;g<u+i;++g)a[c++]=s[g]}return a&&a.length!=c&&(a.length=c),a}function Vc(s,t,e,i,n,r,o){o=o||[];let a=0;for(let l=t;l<e;l+=i){o[a++]=s[l]+n,o[a++]=s[l+1]+r;for(let h=l+2;h<l+i;++h)o[a++]=s[h]}return o&&o.length!=a&&(o.length=a),o}function it(s,t){if(!s)throw new Error(t)}new Array(6);function Xt(){return[1,0,0,1,0,0]}function Bc(s,t){return s[0]=t[0],s[1]=t[1],s[2]=t[2],s[3]=t[3],s[4]=t[4],s[5]=t[5],s}function ft(s,t){const e=t[0],i=t[1];return t[0]=s[0]*e+s[2]*i+s[4],t[1]=s[1]*e+s[3]*i+s[5],t}function he(s,t,e,i,n,r,o,a){const l=Math.sin(r),h=Math.cos(r);return s[0]=i*h,s[1]=n*l,s[2]=-i*l,s[3]=n*h,s[4]=o*i*h-a*i*l+t,s[5]=o*n*l+a*n*h+e,s}function Aa(s,t){const e=Yc(t);it(e!==0,"Transformation matrix cannot be inverted");const i=t[0],n=t[1],r=t[2],o=t[3],a=t[4],l=t[5];return s[0]=o/e,s[1]=-n/e,s[2]=-r/e,s[3]=i/e,s[4]=(r*l-o*a)/e,s[5]=-(i*l-n*a)/e,s}function Yc(s){return s[0]*s[3]-s[1]*s[2]}const Kc=[1e5,1e5,1e5,1e5,2,2];function Uc(s){return"matrix("+s.join(", ")+")"}function Fa(s){return s.substring(7,s.length-1).split(",").map(parseFloat)}function Zc(s,t){const e=Fa(s),i=Fa(t);for(let n=0;n<6;++n)if(Math.round((e[n]-i[n])*Kc[n])!==0)return!1;return!0}function Er(s,t,e,i){let n=s[t],r=s[t+1],o=0;for(let a=t+i;a<e;a+=i){const l=s[a],h=s[a+1];o+=Math.sqrt((l-n)*(l-n)+(h-r)*(h-r)),n=l,r=h}return o}function Hc(s,t,e,i,n,r,o,a,l,h,c,u,d=!0){let f=s[t],g=s[t+1],m=0,_=0,p=0,y=0;function E(){m=f,_=g,t+=i,f=s[t],g=s[t+1],y+=p,p=Math.sqrt((f-m)*(f-m)+(g-_)*(g-_))}do E();while(t<e-i&&y+p<r);let x=p===0?0:(r-y)/p;const C=Mt(m,f,x),S=Mt(_,g,x),T=t-i,I=y,R=r+a*l(h,n,c);for(;t<e-i&&y+p<R;)E();x=p===0?0:(R-y)/p;const M=Mt(m,f,x),k=Mt(_,g,x);let N=!1;if(d)if(u){const z=[C,S,M,k];xr(z,0,4,2,u,z,z),N=z[0]>z[2]}else N=C>M;const j=Math.PI,F=[],$=T+i===t;t=T,p=0,y=I,f=s[t],g=s[t+1];let b;if($){E(),b=Math.atan2(g-_,f-m),N&&(b+=b>0?-j:j);const z=(M+C)/2,X=(k+S)/2;return F[0]=[z,X,(R-r)/2,b,n],F}n=n.replace(/\n/g," ");for(let z=0,X=n.length;z<X;){E();let tt=Math.atan2(g-_,f-m);if(N&&(tt+=tt>0?-j:j),b!==void 0){let xt=tt-b;if(xt+=xt>j?-2*j:xt<-j?2*j:0,Math.abs(xt)>o)return null}b=tt;const Q=z;let et=0;for(;z<X;++z){const xt=N?X-z-1:z,te=a*l(h,n[xt],c);if(t+i<e&&y+p<r+et+te/2)break;et+=te}if(z===Q)continue;const v=N?n.substring(X-Q,X-z):n.substring(Q,z);x=p===0?0:(r+et/2-y)/p;const ye=Mt(m,f,x),ti=Mt(_,g,x);F.push([ye,ti,et/2,tt,v]),r+=et}return F}class ba{constructor(){fh(this,"pushMethodArgs_",(...t)=>(this.push_(t),this));this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(Fn(),{get:(t,e)=>{if(typeof Fn()[e]=="function")return this.push_(e),this.pushMethodArgs_},set:(t,e,i)=>(this.push_(e,i),!0)})}push_(...t){const e=this.instructions_,i=this.zIndex+this.offset_;e[i]||(e[i]=[]),e[i].push(...t)}pushFunction(t){this.push_(t)}getContext(){return this.context_}draw(t){this.instructions_.forEach(e=>{for(let i=0,n=e.length;i<n;++i){const r=e[i];if(typeof r=="function"){r(t);continue}const o=e[++i];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 _i=bt(),Pe=[],ce=[],ue=[],Me=[];function Da(s){return s[3].declutterBox}const Oa=new RegExp("[֑-ࣿיִ-﷿ﹰ-ﻼࠀ--]");function Cr(s,t){return t==="start"?t=Oa.test(s)?"right":"left":t==="end"&&(t=Oa.test(s)?"left":"right"),Un[t]}function qc(s,t,e){return e>0&&s.push(`
|
|
4
4
|
`,""),s.push(t,""),s}function $c(s,t,e){return e%2===0&&(s+=t),s}class Jc{constructor(t,e,i,n,r){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=Xt(),this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=r?new ba:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,i,n){const r=t+e+i+n;if(this.labels_[r])return this.labels_[r];const o=n?this.strokeStates[n]:null,a=i?this.fillStates[i]:null,l=this.textStates[e],h=this.pixelRatio,c=[l.scale[0]*h,l.scale[1]*h],u=l.justify?Un[l.justify]:Cr(Array.isArray(t)?t[0]:t,l.textAlign||qi),d=n&&o.lineWidth?o.lineWidth:0,f=Array.isArray(t)?t:String(t).split(`
|
package/package.json
CHANGED
|
@@ -1,22 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plannco-ppe/ppe-core",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.js",
|
|
6
7
|
"types": "./dist/index.d.ts",
|
|
7
8
|
"exports": {
|
|
9
|
+
"./package.json": "./package.json",
|
|
8
10
|
".": {
|
|
11
|
+
"development": "./src/index.ts",
|
|
9
12
|
"types": "./dist/index.d.ts",
|
|
10
|
-
"import": "./dist/index.
|
|
11
|
-
"
|
|
12
|
-
"default": "./dist/index.es.js"
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"default": "./dist/index.js"
|
|
13
15
|
},
|
|
14
16
|
"./dist/*": "./dist/*",
|
|
15
17
|
"./index.css": "./dist/index.css"
|
|
16
18
|
},
|
|
17
19
|
"files": [
|
|
18
|
-
"dist"
|
|
20
|
+
"dist",
|
|
21
|
+
"!**/*.tsbuildinfo"
|
|
19
22
|
],
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"ol": "^10.6.1"
|
|
25
|
+
},
|
|
26
|
+
"private": false,
|
|
20
27
|
"publishConfig": {
|
|
21
28
|
"access": "public"
|
|
22
29
|
}
|